research-harness-template
CLAUDE.md2 starsChanged 4 months agoMITView on GitHub
Instance owners: this CLAUDE.md is template-managed (re-applied by bash scripts/update.sh). Put your clone's own guidance — active topics, house style, local paths — in a CLAUDE.local.md beside it; Claude Code loads both, and the template never touches CLAUDE.local.md. See docs/how-to/instantiate-the-harness.md. A single Copier-distributable template repository that a user clones (or instantiates) to get a complete, self-contained AI research harness. There is no application build step and no runtime package: the "product" is the orchestration engine (Claude Code agents/commands/skills), the MIF-backed…
- Commits and pushes
In this repository10 other files it gives its agents.
- discoverSkill
- graphSkill
- labSkill
- md-fixSkill
- ontology-managerSkill
- publish-blogSkill
- publish-reportSkill
- readmeSkill
- searchSkill
- topicsSkill
The file
We split this CLAUDE.md into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 134
Every optional capability is a Claude Code plugin, one skill per plugin, under packs/<family>/<skill>/ (.claude-plugin/plugin.json …
- Very specific: line 266
Only tracked data artifacts (findings, knowledge-graph.json, concordance.json, maps) belong in reports/.
- Very specific: line 271
Run it after any pack enable/binding or copier update: a stale catalog missing an extends target makes the fail-closed resolver mark the …
- Very specific: line 279
Supply chain is fail-closed: Every downloaded tool is verified (build-provenance attestation → pinned-SHA-256 checksum waterfall).
- Very specific: line 291
Start with docs/explanation/architecture.md, pack-structure.md, ontological-spine.md, and docs/reference/scripts.md.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Instance owners: this
CLAUDE.mdis template-managed (re-applied bybash scripts/update.sh). Put your clone's own guidance — active topics, house style, local paths — in aCLAUDE.local.mdbeside it; Claude Code loads both, and the template never touchesCLAUDE.local.md. See docs/how-to/instantiate-the-harness.md.
What this repo is
A single Copier-distributable template repository that a user clones (or
instantiates) to get a complete, self-contained AI research harness. There is no
application build step and no runtime package: the "product" is the orchestration
engine (Claude Code agents/commands/skills), the MIF-backed contracts (schemas/),
the shell tooling (scripts/), and the bundled packs — all shipped on clone.
Everything in and out of the harness is MIF
(Modeled Information Format). A finding is a MIF memory unit; the knowledge graph
is MIF EntityReferences + typed relationships; citations and provenance are MIF
objects. Patterns MIF core lacks (falsification lifecycle, quarantine, session
lineage) are closed locally under extensions.harness — never by forking MIF.
Quality gates (run before reporting any change complete)
CI (.github/workflows/ci.yml, on push/PR to main) runs these — plus
setup fetches before them (fetch-engine.sh,
fetch-ontology.sh --all-enabled, fetch-mif-docs-plugin.sh) and separate
version-bump, pin-check, and adr-smadr jobs. Run the same locally.
Vendor first (ADR-0012/#224). Domain ontology packs are NOT bundled — they are vendored on demand. A Copier-instantiated clone vendors them in
_tasksand CI vendors them beforeverify.sh, but a rawgit clonedoes not: runbash scripts/fetch-ontology.sh --all-enabledonce beforeverify.sh/ontology-review.sh(setMIF_ONTOLOGY_SOURCE=<dir>to vendor from a local mirror offline). Without itgate_ontology_lockreportsNOT VENDORED.
bash scripts/verify.sh # full build gate: schema validation,
# citation-integrity, per-milestone gates
# (see GATES=(...) array in verify.sh for
# the current count/names, not a hardcoded number)
CHECK=1 bash scripts/codegen/gen-models.sh # fail if generated models drift from schemas
bash evals/run-evals.sh # eval suite (engine smoke, model authoring, lint teeth, …)
bash evals/copier-update.sh # copier-update propagation
markdownlint-cli2 --config .markdownlint-cli2.jsonc "**/*.md" # must be 0 errorsverify.shruns all gates as a fixed array (GATES=(...), onegate_mNfunction per milestone plusgate_ontology_lock/gate_versions— grep^gate_m[0-9]*() {inverify.shor read theGATES=(...)line directly for the current count/names; don't hardcode a number here, it grows with every milestone); to iterate on specific gates runbash scripts/verify.sh --gates <ERE>(matches gate NAMES, e.g.--gates 'gate_m3$'or--gates monitoring— the summary line flags a scoped run so it can't masquerade as the full suite, #531), andVERIFY_PROFILE=1prints per-gate wall time plus the slowest five. It printsverify.sh: N passed, 0 failedon success and is the authoritative gate.- A single eval:
python3 evals/test_models.py,bash evals/smoke-test.sh, etc. (see therun "<name>" <cmd>lines inevals/run-evals.sh). verify.shgates fixtures, not an instance's importedreports/corpus — in a clone it can pass green while real findings fail to resolve. The corpus-level gate isscripts/ontology-review.sh [--strict](delegates to themif-rh-cliengine per finding, ADR-0016 — run it in the background). Never runontology-review/verifyconcurrently: they race on shared temp/catalog state and produce spurious failures. After any ontology, pack-binding, orcopier updatechange, run both.- Toolchain:
jq,yq,ajv-cli+ajv-formats,markdownlint-cli2,copier,python3,mif-rh-cli(the ontology engine, installed byscripts/fetch-engine.sh; CI installs it beforeverify.sh, ADR-0016). The harness gates have nomake/pyprojectbuild — scripts are invoked directly — but the repo does carry an npm surface:package.json'spostinstall(patch-package+scripts/install-hooks.sh) is how git hooks get installed, and the reports site (below) builds withnpm run build. - Document tooling is
mif-docs-plugin, not a harness-local mechanism. Frontmatter authoring, MIF conformance validation, and provenance for document-shaped deliverables route throughmif-docs-plugin'smif-frontmatter/mif-validate/mif-provenanceskills (pinned inharness.config.jsonmarketplaces[],mif-mcpwired in.mcp.json) — seedocs/reference/dependencies.md. This is separate from the harness-localajvschema conformance gate for findings/knowledge-graph data (ADR-0002), which is unchanged. Provenance capture is enabled by default via.claude/settings.json'smifProvenancekey.
Generated code — do not hand-edit
lib/harness_models/*.py are stdlib TypedDict authoring models generated from
schemas/*.schema.json by scripts/codegen/gen-models.sh (datamodel-code-generator
with black, both pinned, run in a gitignored .venv-codegen). The generated modules
are committed, and CI enforces byte-identity (CHECK=1). If you change a
schema, regenerate (bash scripts/codegen/gen-models.sh) and commit the result.
Runtime stays pure stdlib; the codegen toolchain is dev/build-time only.
Architecture: four layers, one repo
- Engine —
.claude/agents/(orchestrator,dimension-analyst,falsification-analyst,source-chunker,report-synthesizer,harness-configurator,corpus-synthesizer) and the.claude/commands/(start,falsify,goal-writer,resume,status,topics,ontology-review,configure,synthesize-corpus,export,import) that delegate to them..mcp.jsonalso wires an optionalmif-rhMCP server over this same engine. (.claude/commands/research.mdand the.claude/workflows/scripts it drives are a retired experiment — unsupported, slated for removal; do not build on or document against them./startis the engine entry point.) - Contracts —
schemas/: findings, goal, artifact, concordance, knowledge-graph, pack, session-state, diataxis-doc, mif-container, the threemonitoring-*schemas, plusschemas/mif/andharness.config.schema.json. - Harness services — flat skills in
.claude/skills/(search,discover,lab,graph,topics, …) operating directly on the MIF substrate. - Outputs — the
reportchannel is the canonical MIF Level-3 source of truth (reports/<topic>/<slug>.md);blogis the first-class published projection; book/other channels and all deliverable genres are optional packs.
The engine↔services boundary is a module boundary inside one repo, not a repo
boundary. The research flow is goal-driven: /start ensures a goal.json
(schemas/goal.schema.json) exists, then the orchestrator loops fan-out
dimension-analysts → single adversarial falsification gate → report-synthesizer
until the goal's completion_condition.checks hold or its bound is hit. The
falsification gate is deliberately the single adversarial gate (see
docs/adr/0004-…).
harness.config.json is the one file users edit
It is the deploy contract (validated by harness.config.schema.json): topics,
research dimensions, outputs, enabled packs[], and ontologies[]. The
canonical version string also lives here.
Packs are the only extension surface
Every optional capability is a Claude Code plugin, one skill per plugin, under
packs/<family>/<skill>/ (.claude-plugin/plugin.json validated against
schemas/pack.schema.json + skills/<skill>/SKILL.md). The core hardwires none.
harness.config.json packs[] is the control plane:
bash scripts/sync-packs.sh # materialize enabled packs into the native enabledPlugins map
bash scripts/pack-toggle.sh <skill> on|off # flip one pluginsync-packs.sh writes the resolved set into the gitignored, instance-local
.claude/settings.local.json (deep-merged with the template-managed
.claude/settings.json). enabledPlugins must never go in settings.json
(gate_m5 enforces this; settings.json is byte-identical template-and-instance
so copier update never conflicts on it).
Ontology packs (packs/ontologies/*, schemas/ontologies/*) type findings: an
always-on generic core + optional domain ontologies, layered via extends,
enforced fail-closed by resolve-ontology.sh / validate-concordance.sh. Types
compose into the cross-topic concordance (reports/concordance.json).
Domain ontologies are vendored on demand (ADR-0012). Base layers
(schemas/ontologies/*) ship committed; domain packs are fetched from the
canonical registry (ontologies repo → mif-spec.dev/ontologies/) by
scripts/fetch-ontology.sh <id>, sha256-verified fail-closed against the
registry index.json and pinned in ontologies.lock.json
(scripts/check-ontology-lock.sh proves no drift — never hand-edit a vendored
pack; fix it upstream and re-fetch). When no ontology covers a domain,
scripts/author-ontology.sh <id> <topic> scaffolds one from the corpus and
concierges a PR upstream. NOTE: the mechanism is shipped; flipping the bundled
domain packs to a gitignored cache + re-syncing to canonical is a staged
follow-up (it requires re-enriching the bundled corpus, since canonical migrated
some entity-type names).
MIF Container export/import (ADR-0017)
/export and /import move a topic between harness instances as a single
MIF Container (schemas/mif-container.schema.json), driven by the
scripts/mif-container-*.sh family. Export packages a topic's findings,
graph, and provenance into one instance-scoped artifact; import unpacks it
into a fresh topic. Neither ever modifies an existing reports/<topic>/
in place — that invariant is what makes the format safe to exchange.
Locking behavior is covered by evals/container-lock-test.sh.
Reports site + monitoring pack
- The reports site is the primary consumption surface for an
instantiated clone (ADR-0009/0013): Astro/Starlight rendering
reports/(astro.config.mjs,src/), built by.github/workflows/docs.ymlvianpm ci && npm run build, served locally withnpm run dev.scripts/site-toggle.sh primary|pluginswitches the rendering mode. - Monitoring (ADR-0019) ships as
packs/monitoring/with its own workflows (.github/workflows/{monitor,monitor-gate}.yml, installed into an instance byscripts/install-monitoring-workflows.sh), the threeschemas/monitoring-*.schema.jsoncontracts, and agate_monitoring_workflow_syncverify gate that keeps installed workflows in sync with the pack's shipped copies.
Template vs instance
The distributable template carries copier.yml; an instantiated clone does not.
verify.sh is byte-identical in both and detects context — template-only gates
(e.g. distribution, in-place corpus import) skip in an instance, but all
capability gates run everywhere. Never special-case files that copier update
must merge cleanly.
Conventions that bite if missed
- Versioning is change-driven, via
scripts/bump-version.sh(ADR-0010). A component's version moves only when its own files change;harness.config.json.versionis the single always-bumps release pointer and.claude-plugin/marketplace.json.metadata.versiontracks it. Runbash scripts/bump-version.sh <patch|minor|major|X.Y.Z>— it bumps the pointer, the catalog, and inserts the datedCHANGELOG.mdsection, and nothing else. For each pack whose files changed, add--pack <component>(repeatable) to also bump that pack'splugin.json, itsSKILL.md, and its**Version:**row in the family doc. Use--checkfor a dry run. The tool self-verifies; after it runs,git grep <old-version>must show only the CHANGELOG history line — that grep is the completeness proof. Component versions are therefore heterogeneous by design (e.g..claude/skills/readme/SKILL.mdandpacks/ontologies/**carry their ownversions) — do not force them to match the release. Two gates back this:gate_versionsinscripts/verify.shenforces the consistency invariants (catalog == template; every stamp is well-formed semver; no uniformity required), and the PR-onlyversion-bumpCI job (scripts/check-version-bump.sh) enforces two rules: a changed pack/core-skill must move its own version (per-PR — CI fails naming the un-bumped component), and the release pointer must stay strictly ahead of the last actual git tag release (a per-release invariant, not a per-PR one — a PR that changes files without touching the pointer is fine as long as the pointer is already ahead of the last release; something just has to bump it before the next release is cut, closing the exact race where two PRs off the same base used to collide over who moved it — ADR-0010's 2026-07-01 amendment;[skip-version-check]is retired along with the per-PR pointer obligation it used to waive). CHANGELOG follows Keep a Changelog: a new## [X.Y.Z] - YYYY-MM-DDheader is inserted under## [Unreleased](the script does this); leave prior dated sections and CHANGELOG history lines alone except for the footer-compare-link reconciliation the next bullet describes — that is the one sanctioned exception to "leave history alone," scoped exactly to stripping brackets from/adding links for never-tagged sections. Then author the new section's Added/Changed bullets by hand. - A footer compare-link is hand-authored and only added once a real git tag exists
for that version (#393). The engine's
bump-versioninserts a bracketed dated header for every pointer bump, but under ADR-0010's change-driven model an intermediate pointer value can get folded into a later release without ever getting its own Release/tag — do not add a footer[X.Y.Z]: .../compare/...link for one of those. When the next version that genuinely does get tagged is released, add its footer link comparing against the previous actual tag (git tag --list 'v*', sorted by version —sort -Vis GNU-only and absent on macOS/BSD, so usescripts/update.sh's own portable probe-then-fallback pattern rather than a baresort -V), never against the immediately preceding dated section's version string — and strip the brackets from any of that gap's never-tagged section headings (## X.Y.Z - DATE, no[]) so they don't read as dead reference links. This is a convention enforced byscripts/verify.sh'sgate_changelog_links(#397) — not bymarkdownlint: MD052 does not flag a bracketed## [X.Y.Z]heading with no matching footer definition (verified empirically, 0 errors), since headings aren't parsed as link references. The gate is deliberately narrow — it only fails if an existing footer link's compare target isn't a real tag (#393's actual defect class), never merely because a bumped-but-not-yet-tagged section has no link yet (CHANGELOG.md's normal resting state between releases) — so it can run as a required check without going red onmainafter every ordinary version bump. - Releases are TAG-driven, not GitHub-Release-driven (#537).
release.ymltriggers on avX.Y.Ztag push (+workflow_dispatchfor a dry run): it builds and attests the tarball, fail-closed re-verifies the attestation, and only then creates the GitHub Release with the attested tarball attached in the samegh release createcall — never a separate post-publish upload, which GitHub immutable releases reject outright (this was the pre-#537 failure mode:gh release uploadafter the release already existed 422'd, and deleting the immutable release to retry burned the tag). Land the bump onmainfirst, then push the tag (git tag vX.Y.Z && git push origin vX.Y.Z) — the workflow creates the Release itself, do not create it by hand first. - Ephemeral artifacts go to
mktempoutside the tree, never intoreports/. Only tracked data artifacts (findings,knowledge-graph.json,concordance.json, maps) belong inreports/. Writing derived output in-repo dirties the tree and blockscopier update. Seedocs/reference/scripts.md. - The ontology catalog
.claude/enabled-packs.jsonis derived and gitignored.sync-packs.shrebuilds it fromschemas/ontologies/*plus the enabled packs. Run it after any pack enable/binding orcopier update: a stale catalog missing anextendstarget makes the fail-closed resolver mark the entire bound corpus invalid (it aborts resolution, it does not skip). - Relocating an entity type between ontologies is a migration. A finding pins
its type in a top-level
ontology.id+entity.entity_typeblock, enforced strictly: a type that resolves under a different ontology than its pin names is a hard fail, not a fallback. Re-pin or drop the pin on every affected finding (/ontology-review --enrichis that pass). - Supply chain is fail-closed. Every downloaded tool is verified
(build-provenance attestation → pinned-SHA-256 checksum waterfall); every GitHub
Action
uses:is pinned to a 40-char SHA (thepin-checkCI job enforces it). - Enforcement hooks travel with the engine (
.claude/hooks/, wired in.claude/settings.json): citation-leak gate, research-pipeline reminder, voice check, output-conformance check, README-reindex check, the falsify gate guard, and the markdownmd_guard(which never suppresses a diagnostic).
Docs
docs/ is a merged Diátaxis set (tutorials / how-to / reference / explanation).
Start with docs/explanation/architecture.md, pack-structure.md,
ontological-spine.md, and docs/reference/scripts.md. COMPLETION-CRITERIA.md
and IMPLEMENTATION-PLAN.md define the build milestones the gate_mN gates map to.
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.

