agentleFS
modeled-information-formatmodeled-information-format/research-harness-template/CLAUDE.md

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

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
  1. Very specific:

    Every optional capability is a Claude Code plugin, one skill per plugin, under packs/<family>/<skill>/ (.claude-plugin/plugin.json …

    line 134
  2. Very specific:

    Only tracked data artifacts (findings, knowledge-graph.json, concordance.json, maps) belong in reports/.

    line 266
  3. Very specific:

    Run it after any pack enable/binding or copier update: a stale catalog missing an extends target makes the fail-closed resolver mark the …

    line 271
  4. Very specific:

    Supply chain is fail-closed: Every downloaded tool is verified (build-provenance attestation → pinned-SHA-256 checksum waterfall).

    line 279
  5. Very specific:

    Start with docs/explanation/architecture.md, pack-structure.md, ontological-spine.md, and docs/reference/scripts.md.

    line 291

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

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.

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 _tasks and CI vendors them before verify.sh, but a raw git clone does not: run bash scripts/fetch-ontology.sh --all-enabled once before verify.sh / ontology-review.sh (set MIF_ONTOLOGY_SOURCE=<dir> to vendor from a local mirror offline). Without it gate_ontology_lock reports NOT 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 errors
  • verify.sh runs all gates as a fixed array (GATES=(...), one gate_mN function per milestone plus gate_ontology_lock/gate_versions — grep ^gate_m[0-9]*() { in verify.sh or read the GATES=(...) line directly for the current count/names; don't hardcode a number here, it grows with every milestone); to iterate on specific gates run bash 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), and VERIFY_PROFILE=1 prints per-gate wall time plus the slowest five. It prints verify.sh: N passed, 0 failed on success and is the authoritative gate.
  • A single eval: python3 evals/test_models.py, bash evals/smoke-test.sh, etc. (see the run "<name>" <cmd> lines in evals/run-evals.sh).
  • verify.sh gates fixtures, not an instance's imported reports/ corpus — in a clone it can pass green while real findings fail to resolve. The corpus-level gate is scripts/ontology-review.sh [--strict] (delegates to the mif-rh-cli engine per finding, ADR-0016 — run it in the background). Never run ontology-review/verify concurrently: they race on shared temp/catalog state and produce spurious failures. After any ontology, pack-binding, or copier update change, run both.
  • Toolchain: jq, yq, ajv-cli + ajv-formats, markdownlint-cli2, copier, python3, mif-rh-cli (the ontology engine, installed by scripts/fetch-engine.sh; CI installs it before verify.sh, ADR-0016). The harness gates have no make/pyproject build — scripts are invoked directly — but the repo does carry an npm surface: package.json's postinstall (patch-package + scripts/install-hooks.sh) is how git hooks get installed, and the reports site (below) builds with npm 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 through mif-docs-plugin's mif-frontmatter/mif-validate/mif-provenance skills (pinned in harness.config.json marketplaces[], mif-mcp wired in .mcp.json) — see docs/reference/dependencies.md. This is separate from the harness-local ajv schema conformance gate for findings/knowledge-graph data (ADR-0002), which is unchanged. Provenance capture is enabled by default via .claude/settings.json's mifProvenance key.

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

  1. 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.json also wires an optional mif-rh MCP server over this same engine. (.claude/commands/research.md and the .claude/workflows/ scripts it drives are a retired experiment — unsupported, slated for removal; do not build on or document against them. /start is the engine entry point.)
  2. Contracts — schemas/: findings, goal, artifact, concordance, knowledge-graph, pack, session-state, diataxis-doc, mif-container, the three monitoring-* schemas, plus schemas/mif/ and harness.config.schema.json.
  3. Harness services — flat skills in .claude/skills/ (search, discover, lab, graph, topics, …) operating directly on the MIF substrate.
  4. Outputs — the report channel is the canonical MIF Level-3 source of truth (reports/<topic>/<slug>.md); blog is 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 plugin

sync-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.yml via npm ci && npm run build, served locally with npm run dev. scripts/site-toggle.sh primary|plugin switches the rendering mode.
  • Monitoring (ADR-0019) ships as packs/monitoring/ with its own workflows (.github/workflows/{monitor,monitor-gate}.yml, installed into an instance by scripts/install-monitoring-workflows.sh), the three schemas/monitoring-*.schema.json contracts, and a gate_monitoring_workflow_sync verify 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 .version is the single always-bumps release pointer and .claude-plugin/marketplace.json .metadata.version tracks it. Run bash scripts/bump-version.sh <patch|minor|major|X.Y.Z> — it bumps the pointer, the catalog, and inserts the dated CHANGELOG.md section, and nothing else. For each pack whose files changed, add --pack <component> (repeatable) to also bump that pack's plugin.json, its SKILL.md, and its **Version:** row in the family doc. Use --check for 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.md and packs/ontologies/** carry their own versions) — do not force them to match the release. Two gates back this: gate_versions in scripts/verify.sh enforces the consistency invariants (catalog == template; every stamp is well-formed semver; no uniformity required), and the PR-only version-bump CI 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-DD header 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-version inserts 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 -V is GNU-only and absent on macOS/BSD, so use scripts/update.sh's own portable probe-then-fallback pattern rather than a bare sort -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 by scripts/verify.sh's gate_changelog_links (#397) — not by markdownlint: 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 on main after every ordinary version bump.
  • Releases are TAG-driven, not GitHub-Release-driven (#537). release.yml triggers on a vX.Y.Z tag push (+ workflow_dispatch for 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 same gh release create call — never a separate post-publish upload, which GitHub immutable releases reject outright (this was the pre-#537 failure mode: gh release upload after the release already existed 422'd, and deleting the immutable release to retry burned the tag). Land the bump on main first, 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 mktemp outside the tree, never into reports/. Only tracked data artifacts (findings, knowledge-graph.json, concordance.json, maps) belong in reports/. Writing derived output in-repo dirties the tree and blocks copier update. See docs/reference/scripts.md.
  • The ontology catalog .claude/enabled-packs.json is derived and gitignored. sync-packs.sh rebuilds it from schemas/ontologies/* plus the enabled packs. Run it after any pack enable/binding or copier update: a stale catalog missing an extends target 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_type block, 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 --enrich is 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 (the pin-check CI 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 markdown md_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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.