CC Iterator — Autonomous Development Loop
Drive OpenLinkOS project forward by managing CC (Claude Code) background tasks.
Core Loop (Pull-based)
- •Check —
process action:listfor active CC sessions - •Harvest — If CC completed: verify with
pnpm test,git push, close issue - •Next —
gh issue list --state open→ has open issue → start CC - •Wait — No open issues → HEARTBEAT_OK (never auto-create issues)
Issues come from discussions, user feedback, or bug reports. Patrol executes, it does not decide.
Starting CC
bash
exec pty:true background:true workdir:/data/code/github.com/openlinkos/agent command:"IS_SANDBOX=1 claude --dangerously-skip-permissions -p 'PROMPT' --output-format text"
- •No timeout
- •Prompt ends with:
When done: gh issue close N && openclaw system event --text "Done: SUMMARY" --mode now - •Return immediately after starting, never poll-wait
CC Prompt Template
code
1. Task context: implementing X, Issue #N 2. Current state: N tests passing 3. Specific files and responsibilities 4. Requirements: tests, typecheck, build, no any types 5. Closing: git commit + gh issue close + openclaw system event
Failure Detection
- •Runtime < 2 min + minimal output = CC didn't start (API issue) → retry
- •Exit code 143 (SIGTERM) = killed, check if timed out
- •No output after 25+ min = likely hung → kill and retry
- •Check
git statusto confirm no code changes before retrying - •If CC partially completed: check
git log, continue from breakpoint
Lessons Learned
- •CC self-check won't catch CI environment differences (local has dist cache, CI doesn't)
- •Self-check prompt should include: verify CI workflow step ordering
- •Simple fixes (e.g. reordering CI steps) can be done manually, no need to spawn CC
Review Cadence
- •Every 3-4 development issues, create a batch review issue
- •Review checks: type safety, error handling, resource cleanup, API consistency
Project Context
- •Repo:
/data/code/github.com/openlinkos/agent - •Devlog:
memory/openlinkos-devlog.md - •GitHub:
https://github.com/openlinkos/agent