Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ Workspace-based coordination CLI for multi-agent work. Uses jj workspaces + SQLi
2. bacchus claim <task-id> --agent-id <agent-id>
3. Work in .bacchus/workspaces/<task-id>/ (use jj -R, NEVER cd)
4. jj -R .bacchus/workspaces/<task-id>/ rebase -d main
5. Review loop until green (rebase → /simplify → bacchus review → fix → repeat)
6. bacchus release <task-id> --status done
5. Review loop until green (rebase → /tighten → bacchus review → fix → repeat)
6. /ship-review (final pre-release gate)
7. bacchus release <task-id> --status done
```

### Key Commands
Expand Down Expand Up @@ -183,15 +184,32 @@ quality:
lint: "cargo clippy --quiet -- -D warnings"

worker:
runner: "claude" # "claude" (default) or "codex"; selects the default cmd
cmd: "claude --dangerously-skip-permissions -p '/bacchus-worker $BACCHUS_AGENT_ID $BACCHUS_TASK_ID'"
# cmd overrides runner. Codex runner default (set via `bacchus init --runner codex`):
# cmd: "codex exec --dangerously-bypass-approvals-and-sandbox \"$(bacchus worker-prompt $BACCHUS_AGENT_ID $BACCHUS_TASK_ID)\""
# auto_spawn: true # Enable auto-spawn (default: true)
# retry_backoff_ms: 60000
# max_retries: 3
# stale_grace_ms: 60000
# max_runtime_ms: null
# kill_stale: false

memory: # Shared memory via kypp (opt-in; requires `kypp` on PATH)
# enabled: true
# project: "my-project" # KYPP_PROJECT; defaults to the project directory name
```

### Shared Memory (kypp)

When `memory.enabled`, bacchus scopes each worker's environment
(`KYPP_PROJECT`, `KYPP_REPO_ROOT`, `BACCHUS_MEMORY=1`) so the worker prompt's
`kypp briefing` / `recall` / `remember` steps bind the right store. Integration
is **agent-driven and fail-open**: if `kypp` is not installed the steps no-op.
Code grounding (`KYPP_REPO_ROOT`) points at the canonical project tree, not the
ephemeral per-task workspace. (Auto-capture/distill of session logs is Phase 2 —
it depends on `§0` session logs that arrive with the pillbox sandbox.)

## Environment

Env vars override `.bacchus/config.yaml` values for CI/scripting.
Expand All @@ -201,6 +219,9 @@ Env vars override `.bacchus/config.yaml` values for CI/scripting.
| `CLAUDE_PROJECT_DIR` | Workspace root (set by Claude Code) |
| `BACCHUS_DB_PATH` | Override DB location |
| `BACCHUS_WORKER_CMD` | Override `worker.cmd` from config.yaml |
| `BACCHUS_MEMORY` | Set to `1` by bacchus when `memory.enabled` — signals workers to use kypp |
| `KYPP_PROJECT` | kypp project binding, set per-worker from `memory.project` |
| `KYPP_REPO_ROOT` | Repo root kypp grounds code refs against (the project tree) |

## Error Handling

Expand Down
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,35 @@ bacchus session spawn-workers --count 3
# Then run `bacchus session check` in your stop-hook loop
```

### Worker Runners (Claude or Codex)

The worker is just a shell command (`worker.cmd`) that bacchus runs per task with
env vars injected (`$BACCHUS_AGENT_ID`, `$BACCHUS_TASK_ID`, …) — it is not tied to
Claude. The `worker.runner` config field selects the default command:

| Runner | Default `worker.cmd` |
|--------|----------------------|
| `claude` (default) | `claude --dangerously-skip-permissions -p '/bacchus-worker $BACCHUS_AGENT_ID $BACCHUS_TASK_ID'` |
| `codex` | `codex exec --dangerously-bypass-approvals-and-sandbox "$(bacchus worker-prompt $BACCHUS_AGENT_ID $BACCHUS_TASK_ID)"` |

Pick one at init time:

```bash
bacchus init --runner codex # writes a codex worker.cmd into .bacchus/config.yaml
```

Claude resolves the `/bacchus-worker` slash command from the installed skill. Codex
has no slash command, so `codex exec` is fed the protocol as plain text via
`bacchus worker-prompt <AGENT_ID> [TASK_ID]` (the same protocol, runner-agnostic).
Set `worker.runner: codex` (and leave `cmd` unset) to derive the codex command, or
set `cmd` explicitly to override. Liveness is bacchus-owned (the heartbeat loop),
not a Claude hook, so codex workers stay alive the same way.

The review loop calls the `/tighten` and `/ship-review` skills — install these for
your runner (both ship as Claude **and** Codex skills; bacchus bundles copies under
`skills/`). `codex exec` requires the [Codex CLI](https://grok-wiki.com/public/docs/openai-codex-c82680b15ec1)
on `PATH`.

## Commands

### Task Management
Expand Down Expand Up @@ -688,7 +717,7 @@ Only one orchestrator can hold the leader lease at a time; secondary orchestrato

Autonomous worker spawning controls:
- `BACCHUS_ORCHESTRATOR_AUTO_SPAWN=1` (default) enables auto-spawn attempts during `session check`.
- `BACCHUS_WORKER_CMD` sets the worker shell command (required for auto-spawn).
- `BACCHUS_WORKER_CMD` sets the worker shell command (required for auto-spawn); overrides `worker.runner`/`worker.cmd`. See Worker Runners for the Claude vs Codex defaults.
- `BACCHUS_WORKER_MAX_RETRIES` limits retries per task (default: `3`).
- `BACCHUS_WORKER_RETRY_BACKOFF_MS` sets retry backoff (default: `60000`).
- `BACCHUS_WORKER_STALE_GRACE_MS` extends stale-worker recovery grace beyond claim timeout (default: `60000`).
Expand Down
57 changes: 38 additions & 19 deletions evals/cases/worker/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"no_package_install": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -53,7 +54,8 @@
"no_package_install": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -83,7 +85,8 @@
"no_package_install": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -113,7 +116,8 @@
"no_package_install": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -143,7 +147,8 @@
"no_package_install": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -173,7 +178,8 @@
"no_package_install": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -203,7 +209,8 @@
"no_package_install": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true,
Expand Down Expand Up @@ -234,7 +241,8 @@
"no_package_install": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -264,7 +272,8 @@
"no_package_install": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -294,7 +303,8 @@
"no_package_install": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -324,7 +334,8 @@
"no_package_install": true,
"runs_review_loop": false,
"rebases_before_release": false,
"runs_simplify": false,
"runs_tighten": false,
"runs_ship_review": false,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -352,7 +363,8 @@
"no_package_install": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -383,7 +395,8 @@
"runs_review_loop": true,
"rebases_before_release": true,
"resolves_conflicts": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -440,7 +453,8 @@
"runs_review_loop": true,
"handles_review_failure": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -470,7 +484,8 @@
"no_package_install": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -501,7 +516,8 @@
"no_package_install": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -531,7 +547,8 @@
"no_package_install": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true,
Expand Down Expand Up @@ -566,7 +583,8 @@
"no_package_install": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down Expand Up @@ -597,7 +615,8 @@
"adds_dep_to_manifest": true,
"runs_review_loop": true,
"rebases_before_release": true,
"runs_simplify": true,
"runs_tighten": true,
"runs_ship_review": true,
"describes_changes": true,
"releases_done": true,
"sends_heartbeat": true
Expand Down
3 changes: 2 additions & 1 deletion evals/evaluators/rubrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
"weight": 0.20,
"checks": [
"Rebases onto main before releasing: `jj -R ... rebase -d main`",
"Runs /simplify to clean up code",
"Runs /tighten each review-loop iteration to clean up code",
"Runs `bacchus review <TASK_ID>` to validate changes",
"Fixes issues if review fails, then re-runs the loop",
"Runs /ship-review as a final gate before releasing as done",
"Does NOT release as done until review passes",
],
},
Expand Down
Loading
Loading