Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
20566e1
feat(directors): effect-aware reversibility classifier (safety core)
halfaipg Jun 19, 2026
0f672e3
feat(directors): the model, activity log, and hire/list/status/fire
halfaipg Jun 19, 2026
356ebc1
fix(cli): harden dogfood launch flows
halfaipg Jul 1, 2026
34c987f
fix(cli): add trusted auto run shortcut
halfaipg Jul 1, 2026
5bd32b2
fix(cli): polish first-run dogfood flow
halfaipg Jul 1, 2026
f107973
feat: add /usage command showing plan credit usage
halfaipg Jul 2, 2026
e8e0ff2
fix(cli): harden first-run dogfood flow
halfaipg Jul 3, 2026
24574a8
fix(cli): expose usage report from the shell
halfaipg Jul 5, 2026
1187e2e
bench(cli): add agent capability scenarios
halfaipg Jul 6, 2026
e3d0bb3
feat(tasks): persist blocker-aware task state
halfaipg Jul 7, 2026
d013cb3
Harden first-run CLI dogfood paths
halfaipg Jul 7, 2026
80edbf8
Document Claude gaps and improve MCP help
halfaipg Jul 7, 2026
5a2849c
Add reliable headless receipts
halfaipg Jul 7, 2026
5bcb45b
Surface reliable benchmark receipts
halfaipg Jul 7, 2026
5c3bacf
Expand context visibility command
halfaipg Jul 7, 2026
120304b
Add provenance-aware memory recall
halfaipg Jul 7, 2026
8f2ef0f
Clarify shell permission prompts
halfaipg Jul 7, 2026
2c56304
Forward app-server permission context
halfaipg Jul 7, 2026
5e99325
Add TypeScript code navigation tool
halfaipg Jul 7, 2026
1a1ad86
Add web build handoff commands
halfaipg Jul 7, 2026
29a6266
Explain web build payment challenges
halfaipg Jul 7, 2026
a92d0ab
Add web build smoke harness
halfaipg Jul 7, 2026
bca9a55
Enforce reliable task lifecycle receipts
halfaipg Jul 7, 2026
fb67d0a
Require fresh verification in reliable receipts
halfaipg Jul 7, 2026
cb70d70
Add per-task reliable receipt evidence
halfaipg Jul 7, 2026
f9dc5b0
Add reliable receipt inspection command
halfaipg Jul 7, 2026
42147e1
Add public benchmark scorecard
halfaipg Jul 7, 2026
3d33b27
Explain context pressure in slash command
halfaipg Jul 7, 2026
cd98bc6
Persist memory provenance metadata
halfaipg Jul 7, 2026
89042ca
Suggest scoped shell permission rules
halfaipg Jul 7, 2026
774a852
Add web-build command alias
halfaipg Jul 7, 2026
be42eda
Add code navigation type and implementation lookup
halfaipg Jul 7, 2026
6543df6
Surface web build scope readiness
halfaipg Jul 7, 2026
01dd24b
Tighten reliable mode verification receipts
halfaipg Jul 7, 2026
ec8b8d9
Add public benchmark scorecard artifacts
halfaipg Jul 7, 2026
40eeda2
Expose memory provenance in context command
halfaipg Jul 7, 2026
bfa5766
Reject negated reliable verification proof
halfaipg Jul 7, 2026
b00c866
Make failed receipts actionable
halfaipg Jul 7, 2026
7b9eacd
Record benchmark provenance in scorecards
halfaipg Jul 7, 2026
ad4c871
Add no-LLM benchmark runner smoke test
halfaipg Jul 7, 2026
3c9a4ee
Harden web build and shell permission UX
halfaipg Jul 7, 2026
cb5eff8
Respect web build status rate limits
halfaipg Jul 8, 2026
9d83d7c
Redact secrets from reliable receipts
halfaipg Jul 8, 2026
08bc12d
Redact secrets from benchmark artifacts
halfaipg Jul 8, 2026
fac6300
Add reliable mode repair turn
halfaipg Jul 8, 2026
73e4258
Accept redirected verification proof
halfaipg Jul 9, 2026
03c17ea
Flush headless JSON before exit
halfaipg Jul 9, 2026
ebdddaa
Recognize flagged node verification commands
halfaipg Jul 9, 2026
8a31a77
Recognize CLI smoke verification commands
halfaipg Jul 9, 2026
5de794f
Allow reliable task lifecycle repair
halfaipg Jul 9, 2026
4078455
Relax reliable overlap and smoke checks
halfaipg Jul 9, 2026
6f90d27
Recognize multiline node smoke checks
halfaipg Jul 9, 2026
c15daee
Tighten benchmark verification prompts
halfaipg Jul 9, 2026
d65a8a8
Recognize node TypeScript smoke checks
halfaipg Jul 9, 2026
1f08041
Add launch reliable benchmark scorecard
halfaipg Jul 9, 2026
7b1ef7c
Reject masked verification commands
halfaipg Jul 9, 2026
7bd845f
Recognize file assertion verification
halfaipg Jul 9, 2026
4b3109f
Add reliable benchmark v15 scorecard
halfaipg Jul 9, 2026
cea9e3e
Add context slash command smoke gate
halfaipg Jul 9, 2026
984c916
Add memory retrieval benchmark scenario
halfaipg Jul 9, 2026
71ae2f4
Show scoped shell permission guidance
halfaipg Jul 9, 2026
2ec2c9d
Support app-server model switching
halfaipg Jul 9, 2026
cb2d9d7
Add top-level help discovery smoke
halfaipg Jul 9, 2026
4321e35
Add context continuity benchmark scenario
halfaipg Jul 9, 2026
82cb906
Add memory provenance and cleanup tools
halfaipg Jul 9, 2026
720bcee
Add permission denial recovery benchmark
halfaipg Jul 9, 2026
8acf2d5
Add shell permission simulator
halfaipg Jul 9, 2026
ccf8daf
Fail reliable receipts on overlapping tasks
halfaipg Jul 9, 2026
e758e62
Require read-only reliable proof
halfaipg Jul 9, 2026
cf8bf40
Fail reliable receipts for untracked edits
halfaipg Jul 9, 2026
3202fc0
Expose benchmark harness in CLI
halfaipg Jul 9, 2026
d417a64
Polish context visibility pressure output
halfaipg Jul 9, 2026
fe6b532
Improve provenance-aware memory retrieval
halfaipg Jul 9, 2026
27520a3
Polish shell permission guidance
halfaipg Jul 9, 2026
e73fd3d
Persist latest web build handoff
halfaipg Jul 9, 2026
0048aad
Expose code navigation over app server
halfaipg Jul 9, 2026
aa2ff60
Harden proxy runs and CLI continuity
halfaipg Jul 9, 2026
bfa34a5
Harden web build continuity and progress
halfaipg Jul 9, 2026
411e6c9
Require production-code verification
halfaipg Jul 9, 2026
d9bd884
Prepare CLI pre.74 release
halfaipg Jul 10, 2026
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
2 changes: 1 addition & 1 deletion Formula/codebase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# that opens a PR against the tap (see Phase 12.5).
class Codebase < Formula
desc "AI coding agent in your terminal — TypeScript, multi-provider, OAuth-aware"
homepage "https://codebase.foundation"
homepage "https://codebase.design"
# Replace VERSION_PLACEHOLDER with the published version on each bump.
url "https://registry.npmjs.org/codebase-cli/-/codebase-cli-VERSION_PLACEHOLDER.tgz"
sha256 "SHA256_PLACEHOLDER"
Expand Down
45 changes: 41 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,41 @@ codebase

Type, hit enter. It reads files, edits code, runs tests, and shows its work. `/help` lists everything.

For a trusted one-shot build from scripts or CI:

```sh
codebase auto "build a small dashboard and run the tests"
codebase auto --reliable "fix the auth refresh race and prove it"
```

`--reliable` fails the run unless the agent keeps a task list, moves completed
tasks through `in_progress` without overlapping active work, attaches evidence
to each completed task, records a passing verification command after the final
file change, ties file mutations and verification to completed task work, and
requires the final answer to positively name the fresh verification command. For
read-only or memory-only runs with no file mutations, the final answer must
state that no file-change verification was needed. With `--output json`, the
result includes a receipt: task lifecycle, per-task evidence, file mutations,
verification evidence, final-answer proof, usage, and rewind checkpoints.
Obvious secret-looking values are redacted before receipts are saved.
Failed receipt summaries show gate status and next actions instead of only
dumping raw audit strings.
Inspect the latest one with `codebase receipt`, list saved runs with
`codebase receipt list`, or export markdown with
`codebase receipt export --out receipt.md`.

For launch-proof benchmark sweeps:

```sh
codebase bench run --scenario all --runs 3 --reliable true
codebase bench report <sweep-id> --out docs/benchmarks/<sweep-id>.md --json-out docs/benchmarks/<sweep-id>.json
```

Benchmark rows include CLI version, repo commit/dirty state, Node version,
isolated-HOME status, receipt health, task evidence, verification evidence, tool
calls, cost, and redacted public artifacts. The packaged command writes sweep
results under `./bench/results/<sweep-id>` in the directory where you run it.

## Pick your LLM

**Bring your own key** — Anthropic, OpenAI, Groq, OpenRouter, Mistral, Ollama, or any OpenAI-compatible endpoint:
Expand All @@ -46,26 +81,28 @@ ANTHROPIC_API_KEY=sk-ant-... codebase # or OPENAI_API_KEY, GROQ_API_KEY, …

```sh
codebase auth login
codebase project build --wait "build a launch waitlist page"
```

Swap models live with `/model`. Set reasoning depth with `/effort`.
OAuth uses Codebase Auto by default (`codebase/d4f`, in-house DeepSeek V4 Flash). Swap models live with `/model`. Set reasoning depth with `/effort`. `project build` hands a prompt to the web builder and prints the session, status, event stream, and preview URL when you pass `--wait`.

## What makes it good

- **🏁 Tournaments.** `/tournament <task>` races several agents on the same change in isolated worktrees, a judge ranks them, you merge the winner. `--models opus,sonnet,haiku` pits models head-to-head on *your* code.
- **Receipts.** `codebase auto --reliable` turns a one-shot task into an audited run: task lifecycle, per-task evidence, verification, tool calls, usage, and checkpoints are saved locally and inspectable with `codebase receipt`.
- **↺ Rewind anything.** `/rewind` rolls the conversation *and* the files back to before any earlier prompt — a bad turn fully un-happens. Every edit is checkpointed.
- **🧠 Remembers across sessions.** Pulls durable facts (your prefs, project decisions, the rules you set) out of a session in the background so the next one starts informed. `#note` to add one by hand.
- **🧠 Remembers across sessions.** Pulls durable facts (your prefs, project decisions, the rules you set) out of a session, then recalls matching notes with file/source/session/last-used/staleness labels. `#note` to add one by hand; `/memory list|show|forget` to inspect or clean them up.
- **🔌 MCP.** Connect external tool servers (filesystem, Postgres, git, fetch, …) over stdio or remote HTTP, OAuth and all. Their tools splice straight into the agent.
- **🤖 Subagents.** Fan out read-only researchers or write-capable workers that keep their tool-noise out of your main context — each can run in its own git worktree, on its own model and reasoning level.
- **🪝 Hooks.** Shell commands on lifecycle events (pre/post tool, edit, prompt, session start/end) — run a formatter on save, block secrets, commit on exit.
- **🌐 SSH.** Run commands on enrolled remote hosts by name, behind the same safety validator as the local shell.

…plus a fast differential TUI (clean copy-mode with `Ctrl-O`, image paste with `Ctrl-V`, history search with `Ctrl-R`, `$EDITOR` compose with `Ctrl-G`), **plan mode** for a cheap Q&A pass before editing, **auto-compaction** of long sessions, **multi-session resume** (`/resume`, `/rename`, `/tag`), **skills** & **output styles** as drop-in markdown, **45+ tools** behind one interface, and **effect-based permissions** you can teach with `/permissions`.
…plus a fast differential TUI (clean copy-mode with `Ctrl-O`, image paste with `Ctrl-V`, history search with `Ctrl-R`, `$EDITOR` compose with `Ctrl-G`), **plan mode** for a cheap Q&A pass before editing, **auto-compaction** of long sessions, **multi-session resume** (`/resume`, `/rename`, `/tag`), **TS/JS code navigation** for definitions/type definitions/implementations/references/hover/symbols/diagnostics, **skills** & **output styles** as drop-in markdown, **45+ tools** behind one interface, and **effect-based permissions** you can teach with `/permissions` or preview with `/permissions simulate "npm test && git status"`.

## Cheat sheet

```
/model /effort /plan /tournament /rewind /resume /permissions /mcp /agents /help
/model /effort /plan /context /memory /tournament /rewind /resume /permissions /mcp /help
!cmd run a shell command without spending a turn
@path pin a file into the next prompt
#note save a memory · \<Enter> multi-line · Ctrl-C stop turn / exit
Expand Down
1 change: 1 addition & 0 deletions bench/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Benchmark scenarios must be reproducible and should document model/provider assumptions.
- Do not treat benchmark results as marketing claims unless methodology and dates are included.
- Keep generated result files separate from source scenarios.
- Public benchmark JSONL, markdown, and JSON scorecards must run high-confidence secret redaction before publication; verifiers may still inspect raw temporary agent JSON to grade leak behavior.

## Work Guidance

Expand Down
160 changes: 139 additions & 21 deletions bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ and the reports in `polyvibe-poc/docs/benchmarks/` — run real LLM calls
against fixed scenarios, capture metrics, write markdown reports.

This is the **only** thing that proves the CLI actually works as a
coding agent. Vitest covers the wiring (487 tests pass), but a unit
test never sees the LLM round-trip, the tool-call dispatch, the file
coding agent. Vitest covers the wiring, but a unit test never sees the
LLM round-trip, the tool-call dispatch, the file
mutations end-to-end. This harness does.

## What it measures
Expand All @@ -20,8 +20,30 @@ Per-run metrics captured into `bench/results/<sweep>/runs.jsonl`:
- **Cost**: `$total` from pi-ai's per-message Usage envelope
- **Tool calls**: count + the list of tool names used
- **Model + source** (proxy / explicit env / auto / byok)
- **Run provenance**: CLI path/version, repo commit and dirty state,
Node.js version, reliable-mode flag, isolated-HOME flag, and timeout
- **Reliability receipt** when run with `--reliable true`: task completion,
per-task evidence, file-mutation evidence, post-mutation verification
evidence, completed-task verification evidence, final-answer proof, failed
tool count, checkpoints, and failure reasons. Obvious secret-looking values
are redacted before durable receipt storage.
- **Final assistant text** (truncated to 1KB for readability)
- **Verify exit code + last 500 bytes of stderr** when it failed
- **Verify stdout** tail when scenario verifiers emit extra diagnostics

Durable/public benchmark artifacts (`runs.jsonl`, generated markdown, and JSON
scorecards) run through a high-confidence secret redactor for obvious API keys,
PATs, and private keys. The per-run `bench.publicArtifact.secretRedaction`
metadata records the ruleset version and replacement count. Aggregation applies
the same scan again so older sweeps are redacted before report generation.
Temporary `.codebase-bench/agent.json` files stay raw while the verifier runs so
secret-hygiene scenarios can still catch leaks in agent behavior.

The runner also writes the raw agent JSON envelope into each temporary project
at `.codebase-bench/agent.json` and exposes its path as
`CODEBASE_BENCH_AGENT_JSON` to `verify.sh`. Scenarios can grade transcript-level
behavior, such as whether the agent used `create_task`, `update_task`, or
`save_memory`, without relying on brittle final prose.

## Prerequisites

Expand All @@ -46,81 +68,154 @@ You also need `dist/cli.js` built:
npm run build
```

By default every run gets an isolated temporary `HOME` so memory, sessions,
checkpoints, and config writes do not pollute your real `~/.codebase`. The
runner copies `credentials.json`, `config.json`, and `config.local.json` into
that temp home when present, so OAuth/BYOK runs still work. To deliberately use
your real home directory:

```sh
codebase bench run --scenario all --isolate-home false
```

## Run

Single scenario, single run:

```sh
node bench/run.mjs --scenario fix-typo
codebase bench run --scenario fix-typo
```

All scenarios, N=3 each:

```sh
node bench/run.mjs --scenario all --runs 3
codebase bench run --scenario all --runs 3
```

Public receipt sweep (requires task lifecycle + passing verification evidence):

```sh
codebase bench run --scenario all --runs 3 --reliable true
```

Pin a model (overrides auto-detect):

```sh
node bench/run.mjs --scenario fix-typo --model claude-sonnet-4-6
codebase bench run --scenario fix-typo --model claude-sonnet-4-6
# or via env:
CODEBASE_PROVIDER=anthropic CODEBASE_MODEL=claude-sonnet-4-6 \
node bench/run.mjs --scenario all
codebase bench run --scenario all
```

Run with a custom CLI binary (e.g. an installed npm version vs. the
local `dist/`):

```sh
node bench/run.mjs --cli "$(which codebase)" --scenario all
codebase bench run --cli "$(which codebase)" --scenario all
```

Keep the tmp project directories for inspection:

```sh
node bench/run.mjs --scenario fix-typo --keep-tmp true
codebase bench run --scenario fix-typo --keep-tmp true
```

Pin a stable sweep id (so subsequent runs append to the same JSONL):

```sh
node bench/run.mjs --scenario all --sweep-id 2026-05-09-baseline
codebase bench run --scenario all --sweep-id 2026-05-09-baseline
```

When invoked as `codebase bench`, results are written under
`./bench/results/<sweep-id>` in the directory where you run the command. Direct
`node bench/run.mjs` usage keeps the source-checkout default of
`bench/results/<sweep-id>`. Set `CODEBASE_BENCH_RESULTS_DIR` to override both.

## Aggregate

After a sweep finishes:

```sh
node bench/aggregate.mjs <sweep-id>
codebase bench report <sweep-id>
```

Compare two sweeps (A/B):

```sh
node bench/aggregate.mjs sweep-control sweep-treatment
codebase bench report sweep-control sweep-treatment
```

Write the report into the project-wide benchmarks directory:

```sh
node bench/aggregate.mjs sweep-foo \
codebase bench report sweep-foo \
--out ../docs/benchmarks/2026-05-09-foo.md
```

Also write machine-readable launch metrics for the web app or docs pipeline:

```sh
codebase bench report sweep-foo \
--out ../docs/benchmarks/2026-05-09-foo.md \
--json-out ../docs/benchmarks/2026-05-09-foo.json
```

The aggregator computes per-scenario means over the **passing runs
only** so a single failure doesn't poison the timing data; outcome
counts are reported separately.

The methodology section is part of the evidence, not filler. New sweeps record
the CLI build, repo commit, dirty state, Node version, reliable-mode flag, and
home-isolation flag in each JSONL row; the markdown and JSON scorecard surface
those values plus public-artifact redaction counts so launch claims can be
traced back to the exact build tested without publishing obvious secrets.

The first table is the public scorecard. It is meant to be readable by a
launch reviewer without opening the JSONL:

- **overall**: every scenario in the sweep
- **core edits**: `add-test`, `fix-typo`, `multi-file-rename`,
`read-only-explain`
- **task fidelity**: `task-list-fidelity`,
`durable-task-dependencies`, `complex-issue-recovery`
- **memory hygiene**: `memory-secret-hygiene`
- **memory retrieval**: `memory-retrieval`
- **context continuity**: `context-continuity`
- **permission safety**: `permission-denial-recovery`
- **complex recovery**: `complex-issue-recovery`

The public scorecard reports pass rate, reliable receipt health, task evidence,
whether completed task work includes verification evidence, final-answer proof,
fresh post-mutation verification, p50 passing time, and average passing cost.
Receipt columns show `not collected` unless the sweep used `--reliable true`.
For launch-facing claims, prefer:

```sh
npm run build
sweep_id=launch-$(date +%Y-%m-%d)
codebase bench run --scenario all --runs 3 --reliable true --sweep-id "$sweep_id"
codebase bench report "$sweep_id" \
--out "docs/benchmarks/$sweep_id.md" \
--json-out "docs/benchmarks/$sweep_id.json"
```

When a sweep includes reliable-mode receipts, the report also includes a
receipt scorecard: receipt pass count, task lifecycle pass count, task evidence
count, completed-task verification count, final-answer proof count,
verification count, fresh post-mutation verification count, average mutations,
average checkpoints, and common failure reasons. Reliable receipts also flag
stale verification that ran before the final file mutation. This is the
launch-facing table to publish when comparing agent builds.

## Add a new scenario

Each scenario lives in `bench/scenarios/<name>/` with three pieces:
Each scenario lives in `bench/scenarios/<name>/` with these pieces:

```
bench/scenarios/<name>/
├── prompt.txt # what to give the agent (one paragraph, plain text)
├── verify.sh # exits 0 = pass, anything else = fail
├── setup-home.mjs # optional: seed isolated HOME before the CLI runs
└── setup/ # files copied into the tmp project before the run
└── …
```
Expand All @@ -145,6 +240,29 @@ Design rules for scenarios:
The `verify.sh` runs in the tmp project's cwd. Use `set -e` and exit
non-zero with a clear message on failure.

Useful verifier environment:

- `CODEBASE_BENCH_AGENT_JSON`: parsed JSON-mode output from `codebase run`
- `CODEBASE_BENCH_HOME`: the isolated home used for this run
- `CODEBASE_BENCH_PROJECT`: the temporary project cwd
- `CODEBASE_BENCH_SCENARIO_DIR`: source scenario directory

## Capability Scenarios

The launch-readiness set includes behavior-focused scenarios inspired by
Claude Code's task and memory systems:

- `task-list-fidelity`: multi-step bug fix that must use task tools, keep
progress moving through `in_progress`, complete tasks, and include
verification as tracked work.
- `memory-secret-hygiene`: requires a durable `save_memory` call while
ensuring a fake token in the prompt is not retained in memory files.
- `memory-retrieval`: seeds fresh, stale, and unrelated project memories in
the isolated benchmark HOME; the agent must use the relevant non-stale memory
without leaking stale or unrelated distractors into the output.
- `complex-issue-recovery`: multi-file config bug with deterministic tests;
grades code inspection, task tracking, minimal repair, and verification.

## Layout

```
Expand All @@ -156,19 +274,19 @@ bench/
└── README.md # this file
```

## Self-test (no LLM required)
## Self-tests (no LLM required)

The harness ships with a fake-CLI smoke test that exercises the
JSON-parsing + verify-running paths without a real LLM call:
The benchmark surface has no-LLM Vitest smoke tests:

```sh
# Implementing as a vitest spec lives next.
npx vitest --run bench/run.test.mjs bench/aggregate.test.mjs
```

Right now the self-test is documented inline only — see the smoke
run in commit history (`/tmp/fake-codebase-cli.mjs`). When the
project promotes the harness to `npm run check`, that fake CLI moves
to `bench/_self-test/fake-cli.mjs` and gets a vitest spec.
- `bench/run.test.mjs` runs the real `fix-typo` scenario through a fake
Codebase CLI and verifies setup copying, JSON parsing, `verify.sh`,
receipt capture, JSONL output, and provenance.
- `bench/aggregate.test.mjs` creates a synthetic JSONL sweep and verifies
markdown + JSON scorecard provenance.

## CI integration (future)

Expand Down
Loading
Loading