Skip to main content

Commandr

~/repos/Commandr — the L3 bus in the 5-layer agent toolchain. A filesystem contract plus the shell tools that operate it. Not a monolith app — identity is waist and services. GitHub: https://github.com/vietbui1999ru/Commandr

Role in the 5-Layer Model

Thin waist: L1/L2/L5 talk to each other only through the .agents/ filesystem contract. Harnesses stay swappable because the contract is plain files, not any tool’s API.

Current Status (2026-06-17)


Bus Directory Layout

Global derived cache (never authoritative): ~/.agents/index.json (written by bin/index).

bin/ Tools (on PATH)


Protocol SPEC (v0.3)

Contract file: protocol/SPEC.md. Wins over PRD.md, ARCHITECTURE.md, and CLAUDE.md for cross-harness behavior. Conformance: protocol/conformance.sh — 28 cases, C01–C28, 0 failures. Definition of done for every adapter.

Adapters

Two adapters, both validated against the same conformance suite: Claude Code (adapters/claude-code/):
  • stop-hook.sh — per-turn bus checkpoint on Stop event
  • session-end-hook.sh — emits session_end on SessionEnd
OpenCode (adapters/opencode/):
  • checkpoint.js — listens session.status idle + deprecated session.idle; in-flight guard prevents double-fire
  • OpenCode session_end mapping deferred — OpenCode sessions are persistent/resumable; session.deleted fires on explicit deletion, not conclusion
Shared adapter code: adapters/lib/ (checkpoint + session-end cores).

Mission Packet Format

Key invariant: packet = complete work specification; adapters MUST treat it as such. No prior conversation assumed.

Claim Atomicity

Single-machine: mv inbox/T → claimed/{hostname}_{pid}_T — one rename(2), no lock files, first wins. Multi-machine (Phase 5): git push origin HEAD:refs/tasks/<id> — git ref creation is atomic by protocol. Critical: separator is _ not -. SPEC §11.4 — dash parsing is ambiguous. Any _ in hostname is replaced with - before composing the claimed filename.

Council Quality Gate

3 Haiku evaluators launched in parallel, each scoring a different dimension (acceptance criteria, code quality, style). Majority vote (≥2/3). Result: one council/<task-id>.json per task:
Event emitted: council_verdict in events.jsonl. bin/council also supports --diff <range>|- — bus-less mode that outputs verdict JSON to stdout for use outside the bus (C25–C27).

Annotation Loop (SPEC v0.3)

Human notes injected as next-prompt context. The DiffViewer mobile PWA or any tool writes bin/annotate-write <task-id> <turn> "<body>" → creates annotations/<task>/<turn>-<seq>.json. Adapters pick up unconsumed annotations and inject them into the next agent turn via the context_injection mechanism. This is the harness-independent human-in-the-loop channel — separate from the diff approval gate.

Key Design Invariants (do not re-grill)

Per the 11 locked decisions in docs/UNIFICATION-BLUEPRINT.md:
  1. No single vendor loop — decouple, keep harness swappable
  2. Thin waist — .agents/ bus is the one contract
  3. Per-repo .agents/ is source of truth; ~/.agents/index.json is derived
  4. Bus scope = queue + neutral progress only; loop-internal state stays harness-local
  5. DiffViewer reads the BUS, not CC hooks (Phase 2)
  6. One council engine: bin/council; wrappers (review-council, delegate-pi) delegate to it
  7. Context: qmd (knowledge) + CGC on KuzuDB (code graph)
  8. Pi = L2 execution substrate, NOT L1 orchestrator
  9. Human gate = async review + harness-independent git pre-commit gate
  10. Dual-primary adapters (CC + OpenCode), both conformance-validated
  11. Commandr = the bus (not a monolith app)
Recent synthesis reinforces the same boundary:
  • Agent-Native is action/state inspiration for the UI, not a replacement for .agents/.
  • Builderio Skills are workflow packages consumed by runners, not lifecycle state.
  • Builder.io Patterns for Commandr + DiffViewer defines the concrete action/artifact mapping: live SPEC actions go through bin/ tools; visual plans/recaps stay DiffViewer-local until a conformance-backed artifact event exists.
  • omp (oh-my-pi) is an L2 worker, not the owner of claims, approvals, events, or final task status.
Commandr should remain small: claim, progress, complete/fail, approval tokens, event log, council verdicts, annotations, and derived index. It should reference skills or runner capabilities, but not store skill internals or runner-local session state.

omp Tool Bridge Candidate

When omp becomes a bus-aware worker, expose Commandr as model-callable custom tools with Zod schemas: This is preferable to parsing prose from omp -p long-term, but it should follow a simpler commandr-omp-runner wrapper so the bus contract hardens before custom tool work.