harness
Skill1 starsChanged 7 months agoMITView on GitHub
Control surface for a harness-engineering Claude Code setup at user or project scope. Handles install, uninstall, update, doctor, adopt, snapshot, status, audit, and memoize. Installs CLAUDE.md, guardrail hooks, /verify, /plan, /critique, memory seeds, and settings patches; can also retrofit an existing project with scripts/harness-check.sh, report install state, snapshot ~/.claude/, and run deterministic memory hygiene. All sub-actions are idempotent. Use when asked to "set up my Claude Code", "install harness", "uninstall harness", "update harness", "diagnose my setup", "adopt harness", "retrofit", "snapshot my setup", "audit my setup", "harden my Claude", "memoize", "consolidate memory", or "prune memory".
21 other projects use a version of this.
Adopted by
Most recently taken up by
- Boxline-dev/examplestheir own version, first seen Oct 5, 2026
- hanzhangzzz/agent-skills-zhtheir own version, first seen Oct 4, 2026
- virgoC0der/awesome-claude-codetheir own version, first seen Sep 11, 2026
- skillsynchq/txcripttheir own version, first seen Sep 4, 2026
- bam-bam-2/solo-skillstheir own version, first seen Sep 3, 2026
- gutomec/nirvana-os-enginetheir own version, first seen Aug 12, 2026
Other versions21 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 21
- revfactory/harness★ 9.1ksame name
- stellarlinkco/myclaude★ 2.8ksame name
- BankrBot/skills★ 1.2ksame name
- bam-bam-2/solo-skills★ 366same name
- serejaris/personal-corp-os★ 228same name
- SensorsIot/Embedded-AI-Harness★ 185same name
- skillsynchq/txcript★ 149same name
- gutomec/nirvana-os-engine★ 79same name
- stellarlinkco/skills★ 27same name
- d-oit/rust-2026-template★ 11same name
11 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository11 other files it gives its agents.
- audit-ai-strategySkill
- audit-codebaseSkill
- audit-contextSkill
- audit-designSkill
- audit-docsSkill
- audit-jiraSkill
- audit-trelloSkill
- onepagerSkill
- plan-websiteSkill
- website-spec-pipelineSkill
- workflow-advisorSkill
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 3 are distinctive, and 9 are very specific to this project.
0
Common
Most of the 15 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 47
If <X> is $HOME, that's user scope.
- Very specific: line 49
If the skill is being run from a checkout (no .claude/ ancestor), the script errors with a clear message asking for --scope or --target.
- Distinctive: line 89
After install, walk the user through the hand-edits printed under "Next steps":
- Very specific: line 134
Run adopt.sh. Read its preflight to the user.
- Very specific: line 135
If the user is happy, run install.sh --scope=project (or with --include=hooks,commands for a minimum-viable retrofit that doesn't add a …
- Distinctive: line 163
Default behaviour is non-destructive: you'll see diffs but no customised file is overwritten without consent.
- Very specific: line 176
all 4 hooks exist, are executable, and are wired in settings.json
- Distinctive: line 193
If the user doesn't have a snapshot repo yet, prompt them to create one (PRIVATE — the snapshot has personal config):
- Very specific: line 218
Use status first when the user says /harness without an action word, when they say "what's installed?", when they say "is this still set …
- Very specific: line 226
Read $SKILL_DIR/scripts/audit-prompt.md — that's the prompt for the remote agent.
- Very specific: line 277
Never modify
settings.jsonoutsideenvandhooks: Don't touch permissions, marketplaces, statusLine, advisorModel, theme. - Very specific: line 278
Memory is sensitive: If MEMORY.md already exists with the user's entries, leave it alone unless they explicitly say otherwise.
“Common” is measured: kept by at least 6 in 10 of the 15 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Harness
Control surface for the user-scope Claude Code "harness" — feedforward guides (CLAUDE.md, memory), feedback sensors (hooks), and an optional drift-detection loop (snapshot + monthly audit).
The vocabulary follows OpenAI's Harness engineering (https://openai.com/index/harness-engineering/) and Martin Fowler's writeup (https://martinfowler.com/articles/harness-engineering.html). Day-to-day patterns are convergent picks from Boris Cherny, Simon Willison, Jesse Vincent (Superpowers), Geoffrey Huntley (Ralph loop), Hamel Husain (eval skills), and Steve Yegge (Gas Town). See README.md for citations.
Sub-action dispatch
The user invokes this skill, optionally with an action word. Detect intent and run the matching sub-action. If the user says /harness without context, run status first (it's read-only and informative), then ask which action they want.
| Said by user | Sub-action | Script |
| "install", "set up", "bootstrap" | install | scripts/install.sh |
| "uninstall", "remove", "undo" | uninstall | scripts/uninstall.sh |
| "update", "pull latest templates", "refresh" | update | scripts/update.sh |
| "doctor", "diagnose", "is it working" | doctor | scripts/doctor.sh |
| "adopt", "add to existing project", "retrofit" | adopt | scripts/adopt.sh |
| "snapshot", "backup", "mirror to git" | snapshot | scripts/snapshot.sh |
| "status", "what's installed", "audit local" | status | scripts/status.sh |
| "audit", "schedule audit", "monthly check" | audit | (prep work — see below) |
| "memoize", "consolidate memory", "prune memory" | memoize | scripts/memoize.sh |
Substitute the skill's absolute base directory for $SKILL_DIR in every command — it's announced at the top of this invocation.
install
Lays down the harness at the scope where the skill itself lives, derived from $SKILL_DIR:
- Skill at
<X>/.claude/skills/harness/(or under a plugin cache below<X>/.claude/) → install at<X>/.claude/. - If
<X>is$HOME, that's user scope; otherwise project scope. - Override with
--scope=user,--scope=project, or--target=PATH. - If the skill is being run from a checkout (no
.claude/ancestor), the script errors with a clear message asking for--scopeor--target.
What lands at user scope:
| Surface | Path |
| Operating contract | ~/.claude/CLAUDE.md |
| Hooks | ~/.claude/hooks/{block-force-push,format-on-edit,post-compact-reinject,verify-before-stop}.sh |
| Slash commands | ~/.claude/commands/{verify,plan,critique}.md |
| Auto-memory | ~/.claude/projects/<slug>/memory/{MEMORY.md, user_role, feedback_concise, feedback_plan_first, feedback_verification} |
| settings.json | Adds env.CLAUDE_CODE_AUTO_COMPACT_WINDOW=400000 + 4 hook entries (uses ~/.claude/hooks/... form) |
What lands at project scope (<project>/.claude/):
| Surface | Path |
| Operating contract | <project>/CLAUDE.md (skipped if it already exists — most projects have one. --force overrides) |
| Hooks | <project>/.claude/hooks/*.sh |
| Commands | <project>/.claude/commands/{verify,plan,critique}.md |
| settings.json | <project>/.claude/settings.json — 4 hook entries with .claude/hooks/... (project-relative) form. No env var, no memory at project scope. |
| Memory | (skipped — memory is per-user by design and lives under $HOME regardless of project scope) |
bash "$SKILL_DIR/scripts/install.sh"Common flags:
--dry-run— show the preflight + plan, change nothing.--force— overwrite existing files (including project CLAUDE.md).
Per-surface skip flags (escape hatch — pick & choose what to install):
--skip-claude-md,--skip-hooks,--skip-commands,--skip-memory,--skip-settings
Or a positive list (everything else is skipped):
--include=hooks,commands— install only those.--include=claude-md,settings— only the operating contract + settings patch.- Valid items:
claude-md,hooks,commands,memory,settings.
The script always prints a preflight banner showing scope, target, the per-surface plan (with SKIP markers reflecting the active flags), and a pointer to the uninstaller with --all warnings. Read it before proceeding.
After install, walk the user through the hand-edits printed under "Next steps":
- Fill in
## Stack signalsinCLAUDE.md(user scope:~/.claude/CLAUDE.md; project scope:<project>/CLAUDE.md). At install time the script tries to auto-fill this from manifests it finds — verify it picked up your stack correctly. If you need hints, look at~/.claude/projects/slugs andinstalled_plugins.json; ask if unclear. Don't auto-fill from guesswork. - (User scope only) Replace placeholders in
~/.claude/projects/<slug>/memory/user_role.mdwith the user's actual role / projects / stack. Ask, don't invent.
Tell them to restart Claude Code so hooks load.
uninstall
bash "$SKILL_DIR/scripts/uninstall.sh"Same scope auto-detection as install. Conservative defaults:
- Removes hooks + commands only if their sha256 still matches the installed template. User-modified files are kept and reported as
keep (modified). - Strips the 4 hook entries from
settings.json; drops empty hook event arrays. Leaves all other settings untouched. - Keeps by default:
CLAUDE.md, memory files, theCLAUDE_CODE_AUTO_COMPACT_WINDOWenv var.
Flags:
--dry-run,--force(skip content-match)- Broaden the sweep:
--remove-claude-md,--remove-memory,--remove-env,--all - Escape hatch — keep specific surfaces that default would remove:
--keep-hooks,--keep-commands,--keep-settings
The script prints a preflight banner showing scope, target, what will be removed vs kept, and which --keep-* / --remove-* flags are active. Always run --dry-run first if unsure.
Tell the user to restart Claude Code so hook deregistration takes effect.
adopt
Retrofit the harness into an existing project (project scope only). Use when the user says "I have a project, how do I add this?", "adopt", "retrofit", or any variant that implies this isn't a greenfield install.
bash "$SKILL_DIR/scripts/adopt.sh"What it does:
- Detects the project root (
$CLAUDE_PROJECT_DIRor$PWD; refuses to write into$HOME). - Reports what's already there:
CLAUDE.md,.claude/,settings.json,scripts/harness-check.sh, plus stack signals. - Writes a stack-aware starter file to
scripts/harness-check.sh— the project-side pass/fail gate thatverify-before-stop.shand/verifyinvoke. The starter runs lint / types / tests for whichever ecosystem files are present (package.json,composer.json,pyproject.toml,go.mod,Cargo.toml,Gemfile). Skipped ifharness-check.shalready exists (--forceto overwrite). Empty-sensor case is treated as PASS so the script never strandsStop. - Prints the next-step
install.sh --scope=projectcommand. Does not run install itself — the user reviews the preflight banner there separately.
Walk-through for the agent:
- Run
adopt.sh. Read its preflight to the user. - If the user is happy, run
install.sh --scope=project(or with--include=hooks,commandsfor a minimum-viable retrofit that doesn't add a CLAUDE.md). - Tell the user to edit
scripts/harness-check.shto match their project's commands (the starter is intentionally generous; comment out or delete blocks that don't apply). - Tell them to restart Claude Code so hooks load.
- Suggest they run
/verifyonce to smoke-test the gate end-to-end. - Mention
datashaman/harness-templatefor the deeper project-scope layer (policy YAMLs, grades,.skipledger) when they've outgrown the starter.
Flags:
--target=PATH— explicit project root.--dry-run— show plan, don't write.--force— overwrite an existingscripts/harness-check.sh(you'll lose edits).
update
bash "$SKILL_DIR/scripts/update.sh"Smarter than install --force. For each surface compares installed vs current template via sha256 and:
- identical → re-install (no-op cosmetically)
- missing → install
- modified → print diff and SKIP, unless
--mergeor--force
Flags:
--dry-run— show plan only.--force— overwrite ALL files including modified ones (loses customisations).--merge— for modified files, write the new template to<file>.newalongside the original. The user can diff/merge interactively.
Default behaviour is non-destructive: you'll see diffs but no customised file is overwritten without consent.
doctor
bash "$SKILL_DIR/scripts/doctor.sh"End-to-end diagnostic. Combines status with sanity checks:
- sha256 tool present
- target dir writable
settings.jsonis valid JSON- all 4 hooks exist, are executable, and are wired in
settings.json - hook entries don't point at unexpected paths (foreign installs)
- smoke-test: invoke
block-force-push.shwith a known-bad command and verify exit code 2 - memory dir populated (user scope)
CLAUDE.mdpresent and## Stack signalsnot still placeholder- snapshot repo (if
$SNAPSHOT_REPOset) — last commit recency
Exits non-zero if any FAIL, zero on warnings. Run doctor after install and after each Claude Code upgrade.
snapshot
SNAPSHOT_REPO=~/Projects/<them>/<repo> bash "$SKILL_DIR/scripts/snapshot.sh"Mirrors ~/.claude/ into a target git repo, scrubs caches and secret patterns, commits + pushes only on diff. Idempotent.
If the user doesn't have a snapshot repo yet, prompt them to create one (PRIVATE — the snapshot has personal config):
mkdir -p ~/Projects/<them>/claude-setup
cd ~/Projects/<them>/claude-setup
git init -b main
gh repo create <them>/claude-setup --private --source=. --remote=originThen run snapshot.sh against it. The first push lands; subsequent runs are no-ops if nothing changed.
Override sources via env: CLAUDE_DIR=..., USER_PROJECT_KEY=....
status
bash "$SKILL_DIR/scripts/status.sh"Read-only. Reports:
- For each hook + command + memory file + CLAUDE.md:
installed(matches template),modified(customised), ormissing. - For
settings.json: which of the 4 hook entries are wired, plus the env var. - For snapshot repo (if
SNAPSHOT_REPOenv is set): commits ahead of origin, last snapshot timestamp.
Use status first when the user says /harness without an action word, when they say "what's installed?", when they say "is this still set up?", or before any install to show the diff.
audit
The audit is a monthly remote routine — Claude Code's /schedule skill creates it. This skill prepares the prompt and suggests config; the user runs /schedule themselves.
Steps:
- Read
$SKILL_DIR/scripts/audit-prompt.md— that's the prompt for the remote agent. Confirm with the user that it covers what they want. - Suggested config:
- cron:
0 6 1 * *(1st of month, 06:00 UTC) - model:
claude-opus-4-7(audit quality matters) - tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, WebSearch, Agent
- sources: the user's snapshot repo URL (must exist — run
snapshotfirst)
- cron:
- Tell the user to invoke
/scheduleand paste the prompt + config. Or, if they haveRemoteTriggeravailable in their session, build the body and call it directly.
The remote agent clones the snapshot repo, researches the last ~30 days of Anthropic releases and canonical Claude Code voices, and PRs audits/YYYY-MM-DD-setup-audit.md with prioritised deltas. It never modifies tracked files outside audits/.
memoize
bash "$SKILL_DIR/scripts/memoize.sh"Proactive memory hygiene for ~/.claude/projects/<slug>/memory/. Memory is reactive — entries get written when the agent notices something worth saving, but nothing prunes or consolidates. memoize is the deterministic maintenance pass.
What it checks:
- Index sync — every
memory/*.mdis listed inMEMORY.md; everyMEMORY.mdentry points at a file that exists. - Frontmatter hygiene — every memory has the required
name,description,type. - Stale citations — path-shaped tokens (anything starting with
~/,/Users/,./, etc., or ending in a known source extension) that resolve nowhere across~/.claude/projects/and~/Projects/. Conservative on purpose — false positives cost more than misses. - Possible duplicates — pairs of memories of the same
typewhosenameordescriptionare lexically similar (Jaccard ≥ 0.5). Flag, don't merge.
Output: a single file at <memory>/_memoize-report.md. The leading underscore is the contract — MEMORY.md indexing rules and the remote routine both ignore _*.md, so the report itself never gets treated as a memory entry. The report is byte-stable on equal runs (two consecutive invocations produce an identical file).
Flags:
--dry-run— print the plan + report preview, write nothing.--target=PATH— explicit memory dir.
Env knobs (mirror snapshot.sh):
CLAUDE_DIR— root of the Claude Code config dir. Search-root defaults track this, so a customCLAUDE_DIRcascades correctly.USER_PROJECT_KEY— the slug under<CLAUDE_DIR>/projects/.MEMOIZE_SEARCH_ROOTS— colon-separated (PATH-style, supports paths with spaces) list of roots to resolve stale citations against. Defaults to<CLAUDE_DIR>/projects:$HOME/Projects.
Scheduled routine. For the conceptual drift the lexical script can't see (semantic duplicates, outdated facts, conflicting guidance), wire a weekly /schedule job using scripts/memoize-prompt.md. Suggested config:
- cron:
0 6 * * 0(Sunday 06:00 UTC) - model:
claude-opus-4-7 - tools: Bash, Read, Write, Edit, Glob, Grep, Agent
- source: the user's snapshot repo (run
harness snapshotfirst)
Scope: the snapshot repo doesn't mirror harness scripts or local search roots, so the remote agent does its own in-process structural pass (index sync, frontmatter) and adds the semantic checks. Stale-citation analysis stays local-only — the search roots aren't available remotely. The remote agent PRs audits/memory/YYYY-MM-DD.md with proposed edits and never modifies any memory entry.
PostToolUse critique hook — recommendation
We considered a hook that fires after N consecutive Edit/Write calls and runs an automatic critique pass (diff summary + advisor() check). Recommendation: don't ship it. The boundary critiques we already have (verify-before-stop.sh at Stop, advisor() calls bracketing non-trivial work, /critique available on demand mid-flow) cover the same gap with much better signal-to-noise. An always-on PostToolUse critique would (a) burn tokens and wall-clock on edits that don't need it, (b) train the agent to ignore the noise, and (c) duplicate what /critique already provides on user demand. Revisit if users report that mid-flow drift is escaping all three boundary surfaces — but the right next step there would be tuning when /critique gets suggested, not making it automatic.
Constraints
- Never auto-fill stack signals or user_role. Templates have placeholders; ask the user to fill them.
- Never modify
settings.jsonoutsideenvandhooks. Don't touch permissions, marketplaces, statusLine, advisorModel, theme. - Memory is sensitive. If
MEMORY.mdalready exists with the user's entries, leave it alone unless they explicitly say otherwise. - Snapshot repos must be private. They contain personal config.
- Hooks load on session start. Tell the user to restart Claude Code after install/uninstall.
Files in this skill
| File | Role |
SKILL.md | This file — agent instructions |
README.md | Human-facing overview (with sources / inspiration) |
assets/CLAUDE.md.tmpl | Operating-contract template |
assets/hooks/*.sh | Four hook scripts |
assets/commands/*.md | /verify, /plan, /critique |
assets/memory/*.tmpl | MEMORY.md index + 3 feedback memories + user_role template |
scripts/install.sh | Idempotent installer (--dry-run / --force / --skip-*) |
scripts/uninstall.sh | Symmetric uninstaller (content-match check; --all for full sweep) |
scripts/update.sh | Refresh installed files vs current templates (--merge / --force) |
scripts/doctor.sh | End-to-end diagnostic (perms, hook smoke-test, settings JSON, etc.) |
scripts/adopt.sh | Retrofit into existing project — writes scripts/harness-check.sh |
scripts/snapshot.sh | Sanitised mirror of ~/.claude/ → target git repo |
scripts/status.sh | Read-only — reports installed / modified / missing per surface |
scripts/_detect_stack.py | Stack-signal detector — auto-fills ## Stack signals at install time |
assets/harness-check.sh.tmpl | Starter project pass/fail gate written by adopt |
scripts/audit-prompt.md | Prompt template for the monthly remote-audit routine |
scripts/memoize.sh | Memory consolidation pass — deterministic; emits _memoize-report.md |
scripts/memoize-prompt.md | Prompt template for the weekly remote-memoize routine |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

