Documents rationale for using Nim with ORC for the worker coordination
CLI: fast startup, single binary, Python-like syntax, excellent SQLite
support via tiny_sqlite, CLI generation via cligen.
Closes skills-q40
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Nim's varargs doesn't consume the last positional argument when there's
a trailing parameter with a default value. This caused calls like
`runGit("fetch", "origin")` to be parsed as:
- args = ["fetch"]
- workDir = "origin"
Instead of the intended:
- args = ["fetch", "origin"]
- workDir = ""
Fixed by changing from varargs to openArray, which requires explicit
array syntax at call sites: `runGit(["fetch", "origin"])`.
Also includes P2 bug fixes:
- Start heartbeat before state transition (skills-qekj)
- Reject symlinks when reading context file (skills-16zf)
- Case-insensitive conflict detection (skills-n3qp)
Smoke tested: spawn, status, start, show, cancel all work.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
worker.nim:
- Start heartbeat before state transition in start command
(prevents WORKING state without heartbeat if startup fails)
context.nim:
- Reject symlinks when reading context file (security)
(prevents reading arbitrary files via symlinked .worker-ctx.json)
git.nim:
- Use case-insensitive conflict detection in rebase/merge
(toLowerAscii instead of checking "CONFLICT" and "conflict" separately)
Closes: skills-qekj, skills-16zf, skills-n3qp
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
types.nim:
- Remove unused constants: BusJsonlPath, BlobsDir, WorkersDir
worker.nim:
- Remove unused 'by' and 'comment' parameters from approve()
Note: skills-5ax (unused imports in db.nim) no longer applies -
strutils is used for toHex in genOid fallback path.
Closes: skills-t9ub, skills-5ax, skills-fdu, skills-ghlb
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add branchName() and worktreePath() helpers for consistent path generation
- Add msToTime() for epoch ms to Time conversion (8 occurrences consolidated)
- Add validateTaskId() for CLI input validation (prevents path traversal)
- Add optString/optInt64 helpers for nullable DB values
- Add withTransaction template for automatic rollback on error
Closes: skills-lzh2, skills-3d9o, skills-5x2o, skills-qiq0, skills-73yu, skills-vuj2
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- genOid: use std/sysrand for cryptographic randomness instead of rand()
- HeartbeatThread: change from ptr with manual alloc/dealloc to ref object
- Add error handling for DB open in heartbeat thread
- Remove unused globalChannel and times import
Closes: skills-0wk, skills-bk7x, skills-69sz, skills-ib9u, skills-kvdl, skills-n6zf
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Covers: review-gate Stop hook fixes, circuit breaker, research on
OpenHands/Gastown/JWZ patterns, epic creation, phased approach
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Track block attempts per session in .attempts file
- After 3 attempts (configurable via REVIEW_MAX_ATTEMPTS), trip breaker
- Circuit breaker allows exit with warning instead of crashing
- Clear attempts on approve or when breaker trips
- Add 3 new tests for circuit breaker behavior (46 total)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When Claude continues after a Stop hook block, the next Stop hook
invocation has stop_hook_active: true. Detect this and allow exit
to break the loop and prevent stack overflow crash.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Change exit code to 2 (Claude Code blocking signal)
- Output JSON to stderr with decision: block and reason fields
- Add integration test harness for live Claude testing
- Update unit tests for new JSON output format
- Add hooks.json example for Stop hook
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Tests cover:
- All CLI commands (check, enable, approve, reject, status, list, clean)
- Exit codes (0 for allow, 1 for block)
- State file creation and JSON structure
- Session ID auto-detection from env vars
- Multiple issues in reject
- Workflow reset (re-enable after approve)
- Error handling
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- CLI tool with check/enable/approve/reject/status commands
- Stop hook integration for Claude Code blocking
- Adversarial reviewer prompt template
- Dual-publish structure (SKILL.md + .claude-plugin)
- Session ID auto-detection from env vars or git state
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comprehensive comparison of Claude Code, Gemini CLI, OpenCode, and Codex:
- Hooks/lifecycle events (Claude/Gemini best, OpenCode most comprehensive)
- Subagent spawning (MCP is universal bridge)
- File access (Gemini has path restrictions - skills-bo8)
- Sandboxing (Codex has OS-level, others approval-based)
- State persistence (need external store for cross-agent)
Key finding: Orchestrator pattern works across all agents.
Stop hooks only in Claude/Gemini - others need protocol-based gates.
Closes: skills-fqu
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>