Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Goal
Build a reproducible test harness so we can answer "is the crawler actually hitting?" with numbers, both standalone and inside the two agent harnesses (Claude Code, Codex). Today's measurements (codex 0% → 80% post-#9; Claude ~100% via hook; global 35.4%) were ad-hoc; we need them as a re-runnable artifact.
Three tiers, each measurable
Tier 1 — standalone binary microbench
- Cargo integration test (
tests/harness_standalone.rs) - Per-invocation isolation:
RTK_DB_PATH=/tmp/cc-bench-{nonce}.db, temp log dir - Battery against
tests/fixtures/bench/(curated real inputs: git log, .xcstrings, large unknown-ext, grep over Rust src) - Reports: per-filter tokens in/out, savings %, exec time + aggregate
- Output:
bench/results-{git-sha}.json+ matching.md - Reproducible, CI-runnable, bisectable. Catches binary regressions immediately.
Tier 2 — Claude Code harness (scripts/bench-claude.sh)
- Drives
claude --print --output-format=jsonwith a fixed prompt battery ("read this file", "find usages", "show commits") - Parses tool-call trace; computes hook-driven compliance (% Bash calls auto-wrapped by
contextcrawler hook claude) — should be ~100% - Captures gain delta on isolated DB
- Catches hook breakage, settings.json drift
Tier 3 — Codex harness (scripts/bench-codex.sh)
- Drives
codex execwith the same prompt battery - Parses codex job logs (same methodology as today's 80% number)
- Computes compliance + lists unwrapped patterns
- Subsumes perf(codex): lift codex compliance from 80% → 95%+ — add missing patterns to AGENTS.md template + ship a compliance measurement #28 — this script IS the
codex-compliancedeliverable
Wrapper (scripts/bench-all.sh)
- Runs all three; writes a single dated report. Pre/post compare-friendly.
Build order
- Tier 1 — pure Rust, no external calls, lowest cost. Probably 1 PR. Start here.
- Tier 3 — fold perf(codex): lift codex compliance from 80% → 95%+ — add missing patterns to AGENTS.md template + ship a compliance measurement #28 into this issue's PR sequence.
- Tier 2 — last, gated behind a flag in CI (Claude Code API calls cost money).
Design choices (documented for future me)
- Fixtures live at
tests/fixtures/bench/(sibling to existingtests/fixtures/) - Scripts in
scripts/initially. Promote tocontextcrawler bench/compliancesubcommands only if usage justifies the binary surface. - Tier 1 runs on every PR. Tier 2/3 run weekly via a separate CI workflow or on-demand via a label.
- Each tier gets a fresh DB so traffic from one tier doesn't pollute another's measurement.
Success criterion
After this issue lands:
cargo test --test harness_standaloneproduces a deterministic numeric report comparable across PRsscripts/bench-codex.shreports compliance % matching what we manually computed today (currently ~80%)- A simple before/after workflow exists for any future template or filter change: run wrapper, compare numbers, gate merge on improvement
Open backlog impact
- perf(codex): lift codex compliance from 80% → 95%+ — add missing patterns to AGENTS.md template + ship a compliance measurement #28 (codex compliance lift): the measurement portion gets implemented HERE; the template-update portion stays in perf(codex): lift codex compliance from 80% → 95%+ — add missing patterns to AGENTS.md template + ship a compliance measurement #28 as a follow-up
- ux/safety: uninstall_codex_at deletes RTK.md before patching AGENTS.md — half-mutated state on second-step failure #26 / defence-in-depth: $CODEX_HOME from env is trusted verbatim — no canonicalization or outside-$HOME check #27: unaffected
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
test(bench): Tier 1 standalone binary harness with isolated DB + JSON…
review: address codex feedback on bench harness (#29)
chore(gitignore): exclude bench/claude-code-*.{json,md} (Tier 2 harne…
Merge pull request #70 from thehoff/test/harness-tier2-claude-29
chore(release): v0.1.7 — version bump + release-engineering rebrand +…
test(harness): Tier 2 Claude Code hook end-to-end bench (thehoff#29)