|
1 | 1 | --- |
2 | | -description: "[STUB] Execute the operation phase - manages operational tasks, deployment validation, and infrastructure readiness" |
3 | | -user-invocable: false |
| 2 | +description: Manage the operation phase - read operational plans, execute agent tasks, guide human tasks, and track operational status |
| 3 | +argument-hint: "[intent-slug]" |
4 | 4 | --- |
5 | 5 |
|
6 | 6 | ## Name |
7 | 7 |
|
8 | | -`haiku:operate` - Operation phase for operational tasks. |
| 8 | +`haiku:operate` - Run the HAIKU operation phase. |
9 | 9 |
|
10 | 10 | ## Synopsis |
11 | 11 |
|
12 | 12 | ``` |
13 | | -/operate |
| 13 | +/operate [intent-slug] |
14 | 14 | ``` |
15 | 15 |
|
16 | 16 | ## Description |
17 | 17 |
|
18 | | -**STUB** - This skill will be implemented in unit-03. |
| 18 | +**User-facing command** - Manage operational tasks for a completed or in-progress intent. |
19 | 19 |
|
20 | | -The operate skill reads operational plans and automates tasks related to: |
21 | | -- Deployment validation |
22 | | -- Configuration management |
23 | | -- Infrastructure readiness checks |
24 | | -- Operational documentation generation |
25 | | -- Runbook creation and validation |
26 | | - |
27 | | -It works with the Operator hat to ensure that execution results are operationally ready. |
| 20 | +The operate skill reads the operational plan from `.haiku/{intent-slug}/operations.md` and: |
| 21 | +- Displays the operational plan overview |
| 22 | +- Executes `owner: agent` tasks directly (runs commands, scripts) |
| 23 | +- Provides guidance, checklists, and reminders for `owner: human` tasks |
| 24 | +- Tracks operational status in intent state |
| 25 | +- Can trigger a new Elaboration if operational findings suggest changes |
28 | 26 |
|
29 | 27 | ## Implementation |
30 | 28 |
|
31 | | -This skill is not yet implemented. When called, it should output: |
| 29 | +### Step 0: Load State |
| 30 | + |
| 31 | +```bash |
| 32 | +# Source HAIKU libraries |
| 33 | +source "${CLAUDE_PLUGIN_ROOT}/lib/storage.sh" |
| 34 | +source "${CLAUDE_PLUGIN_ROOT}/lib/config.sh" |
| 35 | + |
| 36 | +# Determine intent slug |
| 37 | +INTENT_SLUG="${1:-$(storage_load_state "intent-slug")}" |
| 38 | +``` |
| 39 | + |
| 40 | +If no intent slug found: |
| 41 | +``` |
| 42 | +No HAIKU intent found. |
| 43 | +Run /elaborate to start a new task, or provide an intent slug: /operate my-intent |
| 44 | +``` |
| 45 | + |
| 46 | +### Step 1: Load Operational Plan |
| 47 | + |
| 48 | +```bash |
| 49 | +INTENT_DIR=".haiku/${INTENT_SLUG}" |
| 50 | +OPS_FILE="$INTENT_DIR/operations.md" |
| 51 | +``` |
| 52 | + |
| 53 | +If `operations.md` does not exist: |
| 54 | +``` |
| 55 | +No operational plan found at .haiku/{intent-slug}/operations.md |
| 56 | +
|
| 57 | +The operational plan is produced during the Execution phase when using |
| 58 | +the 'operational' or 'reflective' workflow. |
| 59 | +
|
| 60 | +To create one now, create operations.md in the intent directory with |
| 61 | +recurring, reactive, and manual task sections. |
| 62 | +``` |
| 63 | + |
| 64 | +### Step 2: Parse Operational Plan |
| 65 | + |
| 66 | +Read `operations.md` and parse its frontmatter and task sections: |
| 67 | + |
| 68 | +**Frontmatter fields:** |
| 69 | +- `intent` - Intent slug |
| 70 | +- `created` - ISO date when plan was created |
| 71 | +- `status` - One of: `active`, `paused`, `complete` |
| 72 | + |
| 73 | +**Task sections** (parsed from markdown body): |
| 74 | + |
| 75 | +1. **Recurring Tasks** - Tasks that run on a schedule |
| 76 | + - `name`, `schedule`, `owner` (agent|human), `description` |
| 77 | + - For agent tasks: optional `command` to execute |
| 78 | + |
| 79 | +2. **Reactive Tasks** - Tasks triggered by conditions |
| 80 | + - `name`, `trigger`, `owner` (agent|human) |
| 81 | + - For agent tasks: `command` to execute when triggered |
| 82 | + - For human tasks: `description` of what to do |
| 83 | + |
| 84 | +3. **Manual Tasks** - Tasks performed by humans on a cadence |
| 85 | + - `name`, `frequency`, `owner` (always human) |
| 86 | + - `checklist` - List of steps to complete |
| 87 | + - `description` - What this task accomplishes |
| 88 | + |
| 89 | +### Step 3: Display Operational Overview |
| 90 | + |
| 91 | +Output a summary of the operational plan: |
| 92 | + |
| 93 | +```markdown |
| 94 | +## Operational Plan: {Intent Title} |
| 95 | + |
| 96 | +**Intent:** {intent-slug} |
| 97 | +**Status:** {status} |
| 98 | +**Created:** {created} |
| 99 | + |
| 100 | +### Task Summary |
| 101 | + |
| 102 | +| Type | Count | Agent | Human | |
| 103 | +|------|-------|-------|-------| |
| 104 | +| Recurring | N | N | N | |
| 105 | +| Reactive | N | N | N | |
| 106 | +| Manual | N | 0 | N | |
| 107 | + |
| 108 | +### Recurring Tasks |
| 109 | +{list each task with schedule and owner} |
| 110 | + |
| 111 | +### Reactive Tasks |
| 112 | +{list each task with trigger and owner} |
| 113 | + |
| 114 | +### Manual Tasks |
| 115 | +{list each task with frequency and checklist} |
| 116 | +``` |
| 117 | + |
| 118 | +### Step 4: Handle Agent-Owned Tasks |
| 119 | + |
| 120 | +For tasks where `owner: agent`: |
| 121 | + |
| 122 | +1. **Recurring tasks with a command**: Execute the command and report results |
| 123 | +2. **Reactive tasks with a command**: Check if the trigger condition is met, then execute |
| 124 | +3. Report execution results including exit code and output |
| 125 | + |
| 126 | +```bash |
| 127 | +# Example: execute an agent task |
| 128 | +if [ -n "$TASK_COMMAND" ]; then |
| 129 | + echo "Executing: $TASK_NAME" |
| 130 | + if eval "$TASK_COMMAND"; then |
| 131 | + echo "Task completed successfully." |
| 132 | + else |
| 133 | + echo "Task failed with exit code $?." |
| 134 | + fi |
| 135 | +fi |
| 136 | +``` |
| 137 | + |
| 138 | +### Step 5: Handle Human-Owned Tasks |
| 139 | + |
| 140 | +For tasks where `owner: human`: |
| 141 | + |
| 142 | +1. Display the task description and any checklist items |
| 143 | +2. Show the schedule or frequency |
| 144 | +3. Provide actionable guidance |
| 145 | + |
| 146 | +```markdown |
| 147 | +### Human Task: {name} |
| 148 | + |
| 149 | +**Schedule:** {schedule/frequency} |
| 150 | +**Description:** {description} |
| 151 | + |
| 152 | +#### Checklist |
| 153 | +- [ ] {step 1} |
| 154 | +- [ ] {step 2} |
| 155 | +- [ ] {step 3} |
| 156 | +``` |
| 157 | + |
| 158 | +### Step 6: Track Operational Status |
| 159 | + |
| 160 | +Update operation status in intent state using the storage abstraction: |
| 161 | + |
| 162 | +```bash |
| 163 | +source "${CLAUDE_PLUGIN_ROOT}/lib/storage.sh" |
| 164 | + |
| 165 | +# Load or initialize operation status |
| 166 | +OP_STATUS=$(storage_load_state "operation-status.json") |
32 | 167 |
|
| 168 | +if [ -z "$OP_STATUS" ]; then |
| 169 | + OP_STATUS='{"phase":"operation","operationStatus":"active","operationalTasks":{}}' |
| 170 | +fi |
| 171 | + |
| 172 | +# Update task status after execution |
| 173 | +# Example: mark a task as run |
| 174 | +UPDATED=$(echo "$OP_STATUS" | jq --arg name "$TASK_NAME" --arg time "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ |
| 175 | + '.operationalTasks[$name] = {"lastRun": $time, "status": "on-track"}') |
| 176 | + |
| 177 | +storage_save_state "operation-status.json" "$UPDATED" |
| 178 | +``` |
| 179 | + |
| 180 | +**State schema:** |
| 181 | +```json |
| 182 | +{ |
| 183 | + "phase": "operation", |
| 184 | + "operationStatus": "active|monitoring|complete", |
| 185 | + "operationalTasks": { |
| 186 | + "task-name": { |
| 187 | + "lastRun": "2026-03-06T12:00:00Z", |
| 188 | + "status": "on-track|needs-attention|failed" |
| 189 | + } |
| 190 | + } |
| 191 | +} |
| 192 | +``` |
| 193 | + |
| 194 | +### Step 7: Trigger Re-Elaboration (If Needed) |
| 195 | + |
| 196 | +If operational findings suggest the intent needs changes: |
| 197 | + |
| 198 | +```markdown |
| 199 | +### Operational Finding |
| 200 | + |
| 201 | +{description of the issue} |
| 202 | + |
| 203 | +**Recommendation:** Re-elaborate this intent to address operational concerns. |
| 204 | + |
| 205 | +Run `/elaborate` to start a new elaboration cycle. |
33 | 206 | ``` |
34 | | -The /operate skill is a planned feature for the HAIKU Method. |
35 | | -It will automate operational validation and deployment readiness checks. |
36 | 207 |
|
37 | | -For now, use the Operator hat manually during the 'operational' or 'reflective' workflows. |
| 208 | +### Step 8: Output Summary |
| 209 | + |
| 210 | +```markdown |
| 211 | +## Operation Status |
| 212 | + |
| 213 | +**Intent:** {intent-slug} |
| 214 | +**Overall Status:** {operationStatus} |
| 215 | + |
| 216 | +### Task Results |
| 217 | + |
| 218 | +| Task | Type | Owner | Last Run | Status | |
| 219 | +|------|------|-------|----------|--------| |
| 220 | +| {name} | recurring | agent | {time} | on-track | |
| 221 | +| {name} | manual | human | - | pending | |
| 222 | + |
| 223 | +### Next Actions |
| 224 | +{list of upcoming or overdue tasks} |
38 | 225 | ``` |
0 commit comments