Skip to content

Commit acee292

Browse files
jwaldripclaude
andcommitted
feat: implement operation phase with /operate skill and enriched hats
Replace the /operate stub with a full skill implementation that reads operational plans from operations.md, executes agent-owned tasks, provides guidance for human-owned tasks, and tracks operational status via the storage abstraction. Enrich the Operator hat with detailed validation steps for operations.md including automated task verification and manual task clarity checks. Update the Executor hat to produce operations.md alongside deliverables when using operational or reflective workflows. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent eb1e5fa commit acee292

File tree

3 files changed

+291
-24
lines changed

3 files changed

+291
-24
lines changed

haiku-plugin/hats/executor.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,14 @@ The Executor implements the plan to satisfy the Unit's Completion Criteria, usin
6262
- You MUST NOT continue without making progress
6363
- **Validation**: Blockers documented with context
6464

65-
6. Complete or iterate
65+
6. Produce operational plan (when using operational or reflective workflow)
66+
- If the workflow includes an Operator hat, you MUST produce `operations.md` in the intent directory (`.haiku/{intent-slug}/operations.md`)
67+
- The operational plan should document recurring tasks, reactive tasks, and manual tasks needed to maintain or monitor the deliverables
68+
- For each task, specify: name, owner (agent or human), schedule/trigger/frequency, and either a command (agent) or checklist (human)
69+
- If `operations.md` already exists from a prior unit, append new tasks rather than overwriting
70+
- **Validation**: `operations.md` exists with actionable operational tasks
71+
72+
7. Complete or iterate
6673
- If all criteria met: Signal completion
6774
- If iteration limit reached: Save state for next iteration
6875
- You MUST save all working progress
@@ -77,6 +84,7 @@ The Executor implements the plan to satisfy the Unit's Completion Criteria, usin
7784
- [ ] Progress documented in scratchpad
7885
- [ ] Blockers documented if encountered
7986
- [ ] State saved for context recovery
87+
- [ ] `operations.md` produced (when using operational/reflective workflow)
8088

8189
## Error Handling
8290

haiku-plugin/hats/operator.md

Lines changed: 78 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ description: Reviews and validates operational plans, manages deployment and inf
99

1010
The Operator reviews and validates operational plans, ensuring that execution results can be deployed, configured, and maintained. This hat bridges execution and review by validating operational readiness.
1111

12+
During the Execution phase, the Operator also produces the `operations.md` file that the `/operate` skill uses for ongoing operational management.
13+
1214
## Parameters
1315

1416
- **Unit**: {unit} - The current Unit being operated on
@@ -35,30 +37,100 @@ The Operator reviews and validates operational plans, ensuring that execution re
3537
- You MUST identify deployment, configuration, or infrastructure needs
3638
- **Validation**: Operational requirements enumerated
3739

38-
2. Validate operational readiness
40+
2. Review the operational plan produced during Execution
41+
- You MUST check if `operations.md` exists in the intent directory
42+
- If it exists, you MUST validate its contents against execution results
43+
- If it does not exist, you MUST create it based on operational needs
44+
- **Validation**: `operations.md` exists and is accurate
45+
46+
3. Validate that all tasks are actionable and assigned
47+
- You MUST verify each task has a clear `owner` (agent or human)
48+
- You MUST verify each task has a clear `name` and description
49+
- For recurring tasks: verify `schedule` is defined
50+
- For reactive tasks: verify `trigger` condition is specific and testable
51+
- For manual tasks: verify `checklist` steps are clear and complete
52+
- **Validation**: All tasks are well-defined and assignable
53+
54+
4. Validate automated tasks
55+
- For `owner: agent` tasks with a `command`:
56+
- You MUST verify the command or script exists and can run
57+
- You SHOULD do a dry-run or syntax check where possible
58+
- You MUST verify the command path is correct relative to project root
59+
- **Validation**: Agent commands exist and are executable
60+
61+
5. Validate manual tasks
62+
- For `owner: human` tasks:
63+
- You MUST ensure descriptions are clear enough for someone unfamiliar
64+
- You MUST ensure checklists have actionable, concrete steps
65+
- You SHOULD verify frequency/schedule is realistic
66+
- **Validation**: Human tasks are self-explanatory
67+
68+
6. Validate operational readiness
3969
- You MUST verify that execution results meet operational requirements
4070
- You MUST check for missing operational artifacts (configs, scripts, documentation)
4171
- You MUST verify that operational procedures are documented
4272
- **Validation**: All operational requirements addressed
4373

44-
3. Check operational concerns
74+
7. Check operational concerns
4575
- You MUST verify error handling and recovery procedures exist
4676
- You SHOULD check for monitoring and observability
4777
- You SHOULD verify resource requirements are documented
4878
- **Validation**: Operational concerns addressed
4979

50-
4. Provide operational feedback
51-
- You MUST be specific about what operational gaps exist
80+
8. Report operational readiness status
81+
- You MUST provide a clear assessment: `ready`, `ready-with-caveats`, or `not-ready`
82+
- You MUST list any gaps that need addressing
5283
- You SHOULD suggest operational improvements
53-
- **Validation**: Feedback is actionable
84+
- **Validation**: Readiness status is clear and actionable
85+
86+
## Operations.md Format
87+
88+
When creating or validating `operations.md`, use this format:
89+
90+
```markdown
91+
---
92+
intent: {intent-slug}
93+
created: {ISO date}
94+
status: active
95+
---
96+
97+
# Operational Plan: {Intent Title}
98+
99+
## Recurring Tasks
100+
- name: "Task name"
101+
schedule: "daily|weekly|monthly|custom"
102+
owner: agent|human
103+
description: "What this task does"
104+
command: "./scripts/example.sh" # agent tasks only
105+
106+
## Reactive Tasks
107+
- name: "Task name"
108+
trigger: "condition description"
109+
owner: agent|human
110+
command: "./scripts/respond.sh" # agent tasks only
111+
description: "What to do when triggered" # human tasks
112+
113+
## Manual Tasks
114+
- name: "Task name"
115+
frequency: "weekly|bi-weekly|monthly|custom"
116+
owner: human
117+
description: "What this task accomplishes"
118+
checklist:
119+
- Step 1
120+
- Step 2
121+
- Step 3
122+
```
54123

55124
## Success Criteria
56125

57126
- [ ] Operational requirements identified and verified
127+
- [ ] `operations.md` exists with all task types properly defined
128+
- [ ] All agent-owned tasks have verified, executable commands
129+
- [ ] All human-owned tasks have clear descriptions and checklists
58130
- [ ] Deployment/configuration artifacts present
59131
- [ ] Operational procedures documented
60132
- [ ] Error handling and recovery reviewed
61-
- [ ] Clear operational readiness assessment
133+
- [ ] Clear operational readiness assessment provided
62134

63135
## Related Hats
64136

Lines changed: 204 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,225 @@
11
---
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]"
44
---
55

66
## Name
77

8-
`haiku:operate` - Operation phase for operational tasks.
8+
`haiku:operate` - Run the HAIKU operation phase.
99

1010
## Synopsis
1111

1212
```
13-
/operate
13+
/operate [intent-slug]
1414
```
1515

1616
## Description
1717

18-
**STUB** - This skill will be implemented in unit-03.
18+
**User-facing command** - Manage operational tasks for a completed or in-progress intent.
1919

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
2826

2927
## Implementation
3028

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")
32167

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.
33206
```
34-
The /operate skill is a planned feature for the HAIKU Method.
35-
It will automate operational validation and deployment readiness checks.
36207

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}
38225
```

0 commit comments

Comments
 (0)