Skip to content

Commit f21313d

Browse files
committed
docs(examples): add kubernetes operator dev loop
1 parent ea9ac82 commit f21313d

5 files changed

Lines changed: 538 additions & 0 deletions

File tree

‎examples/README.ja.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ timeout 10s ./roboppi daemon examples/daemon/simple-cron.yaml --verbose
4242
- `examples/todo-loop.yaml`: 反復ループの最小パターン
4343
- `examples/agent-pr-loop.yaml`: 大きめのエージェントループ(デモは `examples/agent-pr-loop-demo/`)
4444
- `examples/appthrust-dashboard/workflow.yaml`: チームプロジェクト向けの本番ワークフロー(design -> todo -> implement -> validate)
45+
- `examples/kubernetes-operator-dev-loop/workflow.yaml`: Kubernetes operator / controller 開発向けの汎用的な長期 agents ループ
4546

4647
## daemon の例
4748

‎examples/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ timeout 10s ./roboppi daemon examples/daemon/simple-cron.yaml --verbose
4343
- `examples/subworkflow-loop.yaml`: subworkflow step + completion_check loop (see `examples/subworkflow-loop-child.yaml`)
4444
- `examples/agent-pr-loop.yaml`: larger multi-step agent loop (see demo under `examples/agent-pr-loop-demo/`)
4545
- `examples/appthrust-dashboard/workflow.yaml`: production workflow for a team project (design -> todo -> implement -> validate)
46+
- `examples/kubernetes-operator-dev-loop/workflow.yaml`: generic long-running agents loop for Kubernetes operator / controller development
4647

4748
## Daemon examples
4849

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Kubernetes Operator Dev Loop
2+
3+
This example is a generic long-running agents workflow for developing a
4+
Kubernetes operator or controller-based platform component.
5+
6+
It is derived from a real multi-agent development loop, but the repo-specific
7+
names and assumptions were removed so it can serve as a reusable example.
8+
9+
## What It Demonstrates
10+
11+
- A lead-driven implement -> review -> verify loop
12+
- Planner-owned living TODO, memory, issue index, and rerun contract state
13+
- Dormant specialist activation for:
14+
- manual verification
15+
- long-running E2E
16+
- Kubernetes debugging
17+
- spec clarification
18+
- provenance / rerun gatekeeping
19+
- loop and stall recovery
20+
- Completion checks that look at TODO state, blockers, and verification results
21+
22+
## Intended Workspace
23+
24+
Run it against a repository that already has some combination of:
25+
26+
- `request.md`
27+
- `implementation-plan.md` or an equivalent repo-local design/plan document
28+
- `ARCHITECTURE.md` or `docs/**`
29+
- controller / API / chart / test code
30+
31+
Typical fit:
32+
33+
- an operator repo with CRDs and controllers
34+
- a platform repo with Kubernetes reconciliation logic
35+
- a repo where local fast gates and separate cluster-backed validation both exist
36+
37+
## Run
38+
39+
```bash
40+
cd /home/reoring/project/roboppi
41+
bun run src/workflow/run.ts \
42+
examples/kubernetes-operator-dev-loop/workflow.yaml \
43+
--workspace /path/to/your/operator-repo \
44+
--verbose
45+
```
46+
47+
Or with the built binary:
48+
49+
```bash
50+
cd /home/reoring/project/roboppi
51+
./roboppi workflow \
52+
examples/kubernetes-operator-dev-loop/workflow.yaml \
53+
--workspace /path/to/your/operator-repo \
54+
--verbose
55+
```
56+
57+
## Notes
58+
59+
- The workflow loads the colocated `agents.yaml` automatically.
60+
- `context_dir` is relative to the target workspace, so state is written under
61+
`.roboppi-loop/operator-dev/` in that repo.
62+
- You will usually want to adapt:
63+
- the fast-gate commands in `workflow.yaml`
64+
- the repo-local plan filename
65+
- the dormant specialist policies in `agents.yaml`
66+
- the completion-check criteria
Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
version: "1"
2+
3+
agents:
4+
lead_agent:
5+
description: "Lead — orchestrates operator implementation, review, and verification"
6+
worker: CLAUDE_CODE
7+
model: "claude-opus-4-6"
8+
capabilities: [READ, MAILBOX, TASKS]
9+
timeout: "60m"
10+
base_instructions: |
11+
You are the lead for a Kubernetes operator development loop.
12+
Coordinate via tasks and mailbox messages; keep iterations small and evidence-driven.
13+
14+
Persistent shared context:
15+
- Current run identity: .roboppi-loop/current-run.json and .roboppi-loop/operator-dev/run.json
16+
- Living TODO: .roboppi-loop/operator-dev/todo.md (planner-owned)
17+
- Team memory: .roboppi-loop/operator-dev/memory.md (planner-owned)
18+
- Issue index: .roboppi-loop/operator-dev/issues/index.md (planner-owned summary)
19+
- Canonical issue state: .roboppi-loop/operator-dev/issues/<safe-issue-id>/issue.json
20+
- Current rerun contract: .roboppi-loop/operator-dev/current-rerun-contract.json
21+
22+
Process:
23+
- Read the issue index before routing work.
24+
- When memory, the issue index, a task, or a mailbox handoff points at an active issue, read the relevant canonical issue.json first.
25+
- When the active phase, blocker, or owner changes, make sure planner refreshes the TUI overview via `roboppi agents status set`.
26+
- Do not start a new iteration until TODO sync has updated next actions and blockers.
27+
- Do not let blocker/remediation state live only in mailbox.
28+
- Wake dormant specialists only when there is a concrete blocker or validation phase that requires them.
29+
30+
Dormant specialist wake protocol:
31+
- `roboppi agents members upsert --member <member_id> --agent <agent_id> --name <member_id> --role member`
32+
- `roboppi agents tasks add --title "<canonical title>" --assigned-to <member_id> --json-stdin`
33+
- When their work is done and there is no immediate follow-up, put them back to `role dormant`.
34+
35+
scout:
36+
description: "Scout — compares the request, plan, and current codebase"
37+
worker: OPENCODE
38+
model: "openai/gpt-5.4"
39+
variant: xhigh
40+
capabilities: [READ, RUN_COMMANDS, MAILBOX, TASKS]
41+
timeout: "45m"
42+
base_instructions: |
43+
You are the scout.
44+
Find the highest-value spec-to-code gaps for the current operator change.
45+
Focus on API shape, controller behavior, generated assets, charts/RBAC, and tests.
46+
47+
implementation_planner:
48+
description: "Planner — owns TODO, memory, issue state, and rerun contracts"
49+
worker: CLAUDE_CODE
50+
model: "claude-sonnet-4-6"
51+
capabilities: [READ, EDIT, RUN_COMMANDS, MAILBOX, TASKS]
52+
timeout: "90m"
53+
base_instructions: |
54+
You are the planner.
55+
You own:
56+
- .roboppi-loop/operator-dev/todo.md
57+
- .roboppi-loop/operator-dev/memory.md
58+
- .roboppi-loop/operator-dev/issues/index.md
59+
- canonical issue.json files
60+
- .roboppi-loop/operator-dev/current-rerun-contract.json
61+
62+
Keep all of them synchronized after each meaningful handoff.
63+
64+
implementer:
65+
description: "Implementer — changes APIs, controllers, charts, and tests"
66+
worker: CLAUDE_CODE
67+
model: "claude-opus-4-6"
68+
capabilities: [READ, EDIT, RUN_TESTS, RUN_COMMANDS, MAILBOX, TASKS]
69+
timeout: "360m"
70+
max_steps: 400
71+
base_instructions: |
72+
You are the implementer.
73+
74+
Read first:
75+
- request.md
76+
- implementation-plan.md (or equivalent repo-local plan)
77+
- .roboppi-loop/operator-dev/todo.md
78+
- .roboppi-loop/operator-dev/memory.md
79+
- .roboppi-loop/operator-dev/issues/index.md
80+
81+
Rules:
82+
- Keep changes focused and avoid unrelated refactors.
83+
- If the repo has generated CRDs/RBAC/chart manifests, update them only when needed and report exactly what changed.
84+
- Never edit the planner-owned TODO/memory/issue index directly.
85+
- When blocked, report concrete evidence: file paths, failing commands, log paths, or issue ids.
86+
- Prefer the repo's standard tool wrapper for kubectl/helm/kind/go if one exists.
87+
88+
reviewer:
89+
description: "Reviewer — read-only review of APIs, reconciliation, and risk"
90+
worker: OPENCODE
91+
model: "openai/gpt-5.4"
92+
variant: xhigh
93+
capabilities: [READ, RUN_TESTS, RUN_COMMANDS, MAILBOX, TASKS]
94+
timeout: "60m"
95+
base_instructions: |
96+
You are the reviewer.
97+
Review for behavioral regressions, controller safety, spec mismatch, codegen/chart/RBAC drift, and missing tests.
98+
Send actionable feedback to the implementer and a concise summary to the lead.
99+
100+
tester:
101+
description: "Tester — runs fast local gates"
102+
worker: CODEX_CLI
103+
model: "gpt-5"
104+
capabilities: [READ, RUN_TESTS, RUN_COMMANDS, MAILBOX, TASKS]
105+
timeout: "90m"
106+
base_instructions: |
107+
You are the tester.
108+
Run the fast local acceptance gates for this repo.
109+
Report PASS/FAIL, the first failing command, and the key error lines.
110+
111+
publisher:
112+
description: "Publisher — commits and pushes a stable milestone"
113+
worker: CLAUDE_CODE
114+
model: "claude-sonnet-4-6"
115+
capabilities: [READ, EDIT, RUN_COMMANDS, MAILBOX, TASKS]
116+
timeout: "45m"
117+
base_instructions: |
118+
You are the publisher.
119+
Only act when the lead explicitly wakes you for a stable milestone.
120+
Do not publish partial or blocker-state work.
121+
122+
manual_verifier:
123+
description: "Manual verifier — preserves live cluster state during authoritative verification"
124+
worker: CLAUDE_CODE
125+
model: "claude-sonnet-4-6"
126+
capabilities: [READ, RUN_TESTS, RUN_COMMANDS, MAILBOX, TASKS]
127+
timeout: "180m"
128+
base_instructions: |
129+
You are the manual verifier.
130+
Handle cluster-preserving verification only after the lead wakes you for the current rerun contract.
131+
132+
e2e_runner:
133+
description: "E2E runner — runs long-running kind or cluster-backed acceptance flows"
134+
worker: CLAUDE_CODE
135+
model: "claude-sonnet-4-6"
136+
capabilities: [READ, RUN_TESTS, RUN_COMMANDS, MAILBOX, TASKS]
137+
timeout: "240m"
138+
base_instructions: |
139+
You are the E2E runner.
140+
Run authoritative long-running validation only when woken by the lead for the active rerun contract.
141+
142+
kubernetes_debugger:
143+
description: "Kubernetes debugger — classifies infra and cluster-backed blockers"
144+
worker: CLAUDE_CODE
145+
model: "claude-sonnet-4-6"
146+
capabilities: [READ, RUN_COMMANDS, MAILBOX, TASKS]
147+
timeout: "120m"
148+
base_instructions: |
149+
You are the Kubernetes debugger.
150+
Diagnose cluster-backed blockers and separate repo-owned issues from environment/infrastructure issues.
151+
152+
spec_referee:
153+
description: "Spec referee — resolves ambiguous API and behavior interpretations"
154+
worker: OPENCODE
155+
model: "openai/gpt-5.4"
156+
variant: xhigh
157+
capabilities: [READ, RUN_COMMANDS, MAILBOX, TASKS]
158+
timeout: "45m"
159+
base_instructions: |
160+
You are the spec referee.
161+
Resolve ambiguous spec or API interpretation questions and produce concise decisions with evidence.
162+
163+
gatekeeper:
164+
description: "Gatekeeper — verifies clean-tree provenance and rerun readiness"
165+
worker: CLAUDE_CODE
166+
model: "claude-sonnet-4-6"
167+
capabilities: [READ, RUN_COMMANDS, MAILBOX, TASKS]
168+
timeout: "90m"
169+
base_instructions: |
170+
You are the gatekeeper.
171+
Verify remediation provenance, clean execution snapshots, and rerun readiness before authoritative validation.
172+
173+
loop_resolver:
174+
description: "Loop resolver — normalizes duplicated tasks and stale workflow state"
175+
worker: CLAUDE_CODE
176+
model: "claude-sonnet-4-6"
177+
capabilities: [READ, EDIT, RUN_COMMANDS, MAILBOX, TASKS]
178+
timeout: "60m"
179+
base_instructions: |
180+
You are the loop resolver.
181+
Resolve duplicated tasks, stale artifacts, and reused-run state that cause the workflow to circle without progress.
182+
183+
stall_watcher:
184+
description: "Stall watcher — detects repeated discussion without code movement"
185+
worker: OPENCODE
186+
model: "openai/gpt-5.4"
187+
variant: medium
188+
capabilities: [READ, MAILBOX, TASKS]
189+
timeout: "30m"
190+
base_instructions: |
191+
You are the stall watcher.
192+
Notify the lead when the team is repeating the same discussion without new code, evidence, or decisions.
193+
194+
completion_checker:
195+
description: "Completion checker — verifies the current operator slice is actually done"
196+
worker: CLAUDE_CODE
197+
model: "claude-haiku-4-5"
198+
capabilities: [READ, RUN_TESTS, RUN_COMMANDS]
199+
timeout: "15m"
200+
base_instructions: |
201+
You are the completion checker.
202+
Verify whether the current operator-development slice is complete and write the decision JSON to the requested path.

0 commit comments

Comments
 (0)