AgentSkillsCN

cc-iterator

自主的CC(Claude Code)迭代循环。通过拉取式问题跟踪机制,高效管理后台编码代理任务。

SKILL.md
--- frontmatter
name: cc-iterator
version: 0.1.2
description: "Autonomous CC (Claude Code) iteration loop. Manages background coding agent tasks with pull-based issue tracking."

CC Iterator — Autonomous Development Loop

Drive OpenLinkOS project forward by managing CC (Claude Code) background tasks.

Core Loop (Pull-based)

  1. Checkprocess action:list for active CC sessions
  2. Harvest — If CC completed: verify with pnpm test, git push, close issue
  3. Nextgh issue list --state open → has open issue → start CC
  4. 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 status to 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