<< All versions

Skill v1.0.1

currentAutomated scan100/100
lutherwaves/builder/harness

+6 new

──Details
PublishedOctober 27, 2026 at 10:31 AM
Content Hashsha256:83da3dd5fdc525d3...
Git SHA1199f6420e65
Bump Typepatch
Compare with v1.0.0
──Files
Files (1 file, 7.8 KB)
SKILL.md7.8 KBactive
SKILL.md · 134 lines · 7.8 KB

name: harness description: Use when agents grep and read file after file to answer "where is X?", "what calls Y?" or "what is the architecture?", when the person asks to "harness this repo", "index this repo", "set up a code graph" or "make agents stop scanning", or when they ask which repositories need a re-index. metadata: version: "1.0.1"


harness — give agents a map of the repository, and keep it fresh

An agent with no map reads file after file. Each read costs tokens and attention. harness gives one repository a local code graph, routes every session to it, and keeps it fresh. It applies the improve-harness loop: baseline → provision → route → freshness → verify.

Doctrine source: Ryan Lopopolo's Harness Engineering (CC BY 4.0). builder adapts its concepts and copies no source prose.

The graph is codebase-memory-mcp. It runs on this machine. It needs no API key. No code leaves the machine. The binary makes one outbound call: a version check against GitHub. To trust no release binary, build it from source.

1. Baseline

Ask one structural question in a fresh session at the repository root. Example: "What calls charge_card?" Write down what the agent does: the number of files it reads, the greps, the time. This is the cost that the next steps must lower. Without a baseline, step 5 proves nothing. A repository that an agent reads in one pass gains little from a graph. Say so in the reply, then go on: the person asked for the harness.

2. Provision

bash "${CLAUDE_PLUGIN_ROOT}/skills/harness/setup.sh" "$PWD"

If you cannot run it (no permission, unattended run), give the person this exact command, and say why it has no --name. Then do steps 3 and 4: they do not need the graph. End with step 5 as a handover: the exact verify question and its pass rule. Never index with the MCP index_repository tool instead. It skips the .mcp.json wiring and the registry, so the watcher never sees the graph.

setup.sh does four things, and you can run it again safely:

  1. It finds the binary: CBM_BIN, then PATH, then ~/dev/codebase-memory-mcp/build/c/, then ~/.local/bin/.

No binary? It prints the build commands and exits 2. It never compiles for you: the build is large. The person opts in.

  1. It adds a codebase-memory server to the repository's .mcp.json. It keeps every other server in the file. It merges with jq or python3. With neither, it stops and changes nothing.
  2. It indexes the tree, under a project name made from the absolute path.
  3. It registers the repository in $BUILDER_HOME/code-graph/repos.txt (default ~/.config/builder/code-graph/repos.txt), with the HEAD at index time.

It still reads the old ~/.claude/code-graph/repos.txt once when the new file is missing. It writes only the new file.

Never pass `--name`. The path-based name keeps each clone and each worktree on its own graph. A forced name makes two checkouts share one graph. Then a query in one checkout returns code from the other branch.

After the run, the person approves the codebase-memory server once, in a Claude Code session at the repository root. .mcp.json holds an absolute path to the binary. Add it to .git/info/exclude, not to a commit.

3. Route

Add this snippet, as it is, to the repository's CLAUDE.md or AGENTS.md:

**Structural questions: ask the graph first.** For "where is X?", "what calls Y?" or "what is the
architecture?", use the `codebase-memory` graph tools (`search_graph`, `query_graph`, `trace_path`,
`get_architecture`, `get_code_snippet`) before grep, glob or a search subagent. If this checkout has no graph,
provision one first with the `harness` skill (local, no API key), then ask.

Every later session, in every checkout, then asks the graph first. A checkout with no graph provisions one first, so the snippet is safe before step 2 runs. This is the durable part. Commit it in the repository, with a Conventional Commit.

4. Freshness

A graph built on branch A gives old answers after a branch switch or new commits. drift.sh <repo-path> prints one line: VERDICT=<FRESH|STALE|NOT_INDEXED|NO_BINARY|BAD_PATH> ….

VerdictMeansFix
FRESHThe graph matches the treeNothing
STALE reason=commitsHEAD moved after the indexRe-index
STALE reason=editsA tracked file changed after the indexRe-index
NOT_INDEXEDRegistered, but no graph is readyRun step 2 again
NO_BINARYThe binary is goneInstall it, then run step 2 again

Re-index: <binary> cli index_repository --repo-path <path> --mode moderate. It is incremental.

Never re-index on your own. Give the command. The person runs it, or says yes. A re-index in the middle of another session's task changes the answers under it.

To watch every registered repository, schedule watcher-prompt.md (beside this file) when the person asks:

  1. List the scheduled jobs first. A job that runs drift.sh already exists? Stop. Offer to replace it. Never add a second.
  2. Schedule it at 22,52 * * * *. This stays clear of the budget watcher at 7,37. With no cron tool, schedule a check every 30 minutes (see your harness mapping).
  3. Most scheduled jobs live only as long as the session. Tell the person to schedule it again after a restart.

5. Verify

Open a fresh session at the repository root. Ask the baseline question again. Pass: the agent called a graph tool (search_graph, query_graph, trace_path, get_architecture) and gave a real answer. A run that never touched the graph proves nothing. Find out why (server not approved, snippet not read), fix it, and ask again. Report the baseline cost and the new cost side by side.

Honesty about savings

A token counter measures tokens spent. Nothing measures the tokens the graph saved: those reads never happened. Any savings figure is a model, not a measurement. Say "estimated" and show how you got it. Never put it on a badge or next to measured numbers.

After the work

End with the builder report from the builder skill. Its ✓ Proven line holds the baseline and the verify result.

Common mistakes

MistakeFix
--name to get a short project nameNever. The path-based name isolates each checkout.
Building the binary because it is missingGive the build commands. The person opts in.
Re-indexing every STALE repository at onceGive the command for each. The person decides.
A second drift watcherList the jobs first. Replace, never stack.
"Verified" after a run that only greppedThe verify run must call a graph tool. Retry until it does, or report why not.
No baseline, so no before and afterAsk the structural question before step 2. Write down its cost.
"The graph saves 60% of tokens" as a factSavings are counterfactual. Say "estimated" and show the model.
.mcp.json committed with an absolute binary pathAdd it to .git/info/exclude. Commit only the routing snippet.
index_repository through MCP when setup.sh is blockedGive the setup.sh command and why it has no --name. Do steps 3 and 4. Hand over step 5.

Self-check

Before you finish:

  • [ ] I recorded a baseline before I provisioned.
  • [ ] setup.sh ran with no --name, and I quoted its project line.
  • [ ] If I could not run setup.sh, I gave the command, the reason for no --name, and the verify question to ask after it.
  • [ ] I compiled nothing and re-indexed nothing without the person's yes.
  • [ ] The routing snippet is in CLAUDE.md or AGENTS.md.
  • [ ] I listed the scheduled jobs before I scheduled a drift watcher, and added no second one.
  • [ ] The verify run called a graph tool, and I compared it with the baseline.
  • [ ] Each savings figure says "estimated".
  • [ ] The reply ends with the builder report.
← v1.0.0All versions