agentleFS
emb715emb715/neurodiveragents/CLAUDE.md

neurodiveragents

CLAUDE.md2 starsChanged 2 months agoMITView on GitHub

This project uses the neurodiveragents fleet. When a task matches an agent domain, use the Task tool with the matching subagent_type. Pass full context in the prompt — subagents have no prior conversation history. Apply without being asked when the signal is clear:

  • Reads credentials

The file

We split this CLAUDE.md into the rules it gives an agent

9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Add logging or observability → apply ndv-telemetry

    line 42
  2. Very specific:

    If still ambiguous: diagnose first with ndv-diagnose, then hand off

    line 54
  3. Very specific:

    Use the Task tool with subagent_type: ndv-<specialist>

    line 63
  4. Distinctive:

    All agents default to parallel execution for 4-8 independent files/items.

    line 69
  5. Very specific:

    Run this before merging a release PR.

    line 111
  6. Distinctive:

    Treat INCONCLUSIVE as "not checked", never as a pass.

    line 125
  7. Very specific:

    Update routing in CLAUDE.md, agents/ndv-flow.md, bin/ndv.js (NDV_BLOCK + Copilot header), commands/opencode/ndv-help.md, …

    line 194
  8. Very specific:

    Run npm run validate. The pre-commit hook and CI (Node 20, ubuntu-latest) run the same command.

    line 196
  9. Very specific:

    If routing changed, run npm run eval:gate before the next release.

    line 197

≈ “Common” is an estimate: at least 1 in 5 of the 26,980 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
<!-- ndv:start -->

neurodiveragents

This project uses the neurodiveragents fleet. When a task matches an agent domain, use the Task tool with the matching subagent_type. Pass full context in the prompt — subagents have no prior conversation history.

Routing Table

When the task involves...Use agent
PRD, epic, multi-task workload, fleet orchestrationndv-flow
Code review, PR, code smells, qualityndv-review
Bug, stack trace, root cause unknown — investigatendv-diagnose
Root cause confirmed, fix known — implement itndv-build
Rename, extract, restructure, modernize syntaxndv-refactor
Generate tests, improve coverage, ATDD, acceptance tests first, red tests before implementationndv-tester
Security vulnerabilities, OWASP, auth issuesndv-secure
Slow code, N+1 queries, bundle size, latencyndv-optimize
Add logging, metrics, traces, health checksndv-telemetry
Framework or library upgrade, version bump, breaking changes in a dependency, codemods, deprecated API removalndv-upgrade
System design, SOLID violations, architecture reviewndv-architect
Implement a spec with schemas, acceptance criteria, file targets, and architecture decided (behavioral specs additionally require scale simulation at N=1/N=10/N=100)ndv-build
Scope creep, "while we're at it", PRD boundary review, overloaded ticketsndv-scope
Estimate review, sprint plan calibration, roadmap sanity checkndv-forecast
KPI audit, metrics review, coverage targets, DORA metrics, OKRsndv-signal
Technical docs, API docs, session notesndv-explain
UI structure, layout decisions, visual hierarchy, design judgmentndv-design → then ndv-build
WCAG auditing, ARIA violations, contrast ratios, keyboard nav, screen reader compatibility, a11y, accessibility auditndv-accessibility
Codebase lookup, cross-file tracing, "where is X", "how does Y work", "does X exist", "find any reference to Z", feature flow summaries, pipeline investigationndv-research
No specialist match / no clear owner / tradeoffs / direct answer / command executionndv-honest

Proactive Application

Apply without being asked when the signal is clear:

  • Stack trace shared → apply ndv-diagnose
  • PR or files to review → apply ndv-review
  • "it's slow" or slow query → apply ndv-optimize
  • "clean this up" or rename → apply ndv-refactor
  • Code with no tests → suggest ndv-tester
  • Story has schemas + criteria + file targets + architecture settled → apply ndv-build
  • Add logging or observability → apply ndv-telemetry
  • Version bump or "upgrade to vN" → apply ndv-upgrade
  • UI code, components, or design decisions → apply ndv-design
  • UI code with interactive elements, form inputs, or color usage → apply ndv-accessibility
  • Accessibility remediation work: classify as a11y-only vs a11y+visual-risk; route implementation to ndv-build, and for visual-risking changes hand off to ndv-design before implementation
  • "where is", "how does", "trace this", "what files", "show me" about existing code → apply ndv-research

Conflict Resolution (use highest-priority match)

  1. Stack trace / exception / failing test / "debug" language → ndv-diagnose (even if the code is auth/payment)
  2. Explicit vulnerability/audit/exploit language → ndv-secure
  3. Explicit performance/latency/slow language → ndv-optimize
  4. If still ambiguous: diagnose first with ndv-diagnose, then hand off
  5. ndv-honest handles anything — it is a pure communication layer, not a router.
  6. Layout/structure changes without a spec → ndv-design first. ndv-build executes specs, not decisions — but a human instruction that fully specifies the outcome is the spec. "Centre the row, two lines" is a decision already made; routing it through design re-opens a closed question. Route to design when the decision is open, not when the change is merely visual.

Example: "500 error + NullPointerException stack trace in login endpoint" → ndv-diagnose Example: "Should we switch to pnpm?" → ndv-honest

How to Apply

  1. Use the Task tool with subagent_type: ndv-<specialist>
  2. Pass full context in the prompt (task description, relevant files, error messages, goals) — subagents have no prior conversation history
  3. For parallel work: spawn multiple Task calls in a single message

Parallelism Default

All agents default to parallel execution for 4-8 independent files/items.

<!-- ndv:end -->

Stack

  • Runtime: Node.js ≥ 18, ESM ("type": "module")
  • Test runner: node --test (built-in, no Jest/Vitest)
  • Dependencies: @clack/prompts, picocolors — no build step for the fleet itself
  • CSS build: Tailwind CLI (npm run css:build) — only needed for the website, not the fleet

Key directories

PathWhat lives here
agents/Agent model files (source of truth)
humans/Human-readable character profiles
bin/ndv.jsCLI installer — ndv install, ndv list, ndv install-skills
test/Test suite (14 files — see below)
docs/Authoring guide, ADRs, manifesto
skills/Cognitive module skills
commands/Slash commands (OpenCode)

Validation

npm run validate

That is the whole merge gate, and the pre-commit hook and CI (.github/workflows/validate.yml) run exactly that command. It runs the full test suite (npm test, 14 files) and then the CSS staleness check. Authoring-guide checks are scoped to the agents changed on the branch: scripts/validate.sh compares against origin/main, or you can set CHANGED_AGENTS="ndv-foo,ndv-bar" yourself.

Narrower commands for iterating:

npm run validate:agents   # the 6 static agent/fixture checks — fast, no installs
npm run test:install      # install simulation only
npm run css:check         # CSS staleness only

Routing eval gate (local, before every release)

Run this before merging a release PR. It calls models, costs tokens, and is not part of validate:

npm run eval:gate

It re-scores each model recorded in test/fixtures/routing-baseline.json against test/fixtures/routing-cases.json:

VerdictMeaningExit code
PASSCanonical accuracy is at or above the baseline floor, and escalation is at or below the baseline ceiling0
DEGRADEDEither limit is broken; the output names the new misses and escalations1
INCONCLUSIVEThe model provider returned errors (quota, rate limit), or the fixture changed after the baseline was recorded2

Treat INCONCLUSIVE as "not checked", never as a pass.

Recording a baseline:

npm run eval:baseline                                             # 3 runs each: Opus 5, Sonnet 5, Haiku 4.5
npm run eval:baseline -- --models glm-5.3-flash                   # add a model (Ollama, needs OLLAMA_API_KEY)
  • The floor is the worst result across the baseline runs. Misses are asked again (--retries 2, majority vote), so one unlucky answer doesn't fail a release.
  • Editing the fixture makes the baseline stale. validate then fails until you re-run eval:baseline and commit the new baseline file.
  • Models are reached through scripts/eval-providers/:
    • claude.sh (default for Claude models) runs the Claude CLI from an empty temp directory with no tools, no MCP servers, and a minimal system prompt. With ANTHROPIC_API_KEY set it also adds --bare, which skips hooks, plugins and your personal CLAUDE.md. Without it, your user-level CLAUDE.md still loads into every scoring call.
    • anthropic.mjs calls the Messages API directly: the clean-room number. Select it with --provider anthropic. Key from NDV_ANTHROPIC_API_KEY or ANTHROPIC_API_KEY; base URL from NDV_ANTHROPIC_BASE_URL to score through an Anthropic-compatible gateway. Some gateways resolve a bare alias such as claude-opus-5 to a different snapshot than Anthropic does; NDV_ANTHROPIC_MODEL_ALIASES=label=served-id,... maps the label to the id the gateway must receive, so the row measures the model its label names. Rate limits are retried with backoff; through a gateway pass --concurrency 2, since the default 4 trips a per-minute quota.
    • ollama.mjs calls Ollama's cloud API when OLLAMA_API_KEY is set, or a local Ollama server otherwise.
  • Each baseline row records its provider, and eval:gate scores through the same one. Recording with --provider anthropic and gating through the CLI would compare two transports, not two releases.
  • Keys and gateway settings live in .env at the repo root, gitignored. .env.example is the contract; copy it and fill it in. The eval scripts load it when present and shell variables take precedence. Never put a key or a gateway URL in a tracked file.

The eval measures the routing text that ships. The ndv:start/ndv:end block at the top of this file must be byte-identical to NDV_BLOCK in bin/ndv.js, and validate enforces that. Change the routing table in both places together, or the eval scores a table users never receive.

Ground truth: 56 cases covering all 19 agents, at least half of them conflict or residual cases. Each case has a basis:

  • canonical (50): forced by an anchor, a verbatim phrase on a routing line that names the expected agent. scripts/routing-context.mjs supplies the same text to the validator and to the model. A canonical miss means the routing table needs fixing, or the model can't follow it.
  • judgment (6, capped at 25%): the fixture author's own reading, with the contested alternative named. A judgment miss means review the case first.

To score a single model ad hoc, without the gate: NDV_EVAL_CMD='<command that reads stdin>' npm run eval:routing (supports --tag, --limit, --retries, --out).

Behavior eval (local, before a release that changes agent text)

The routing eval proves a task reaches the right agent. The behavior eval checks that the agent does the job once it's there. It also calls models, costs tokens, and is not part of validate:

npm run eval:behavior                                    # one run, Sonnet 5 via claude.sh
npm run eval:behavior -- --agent ndv-secure --kind lane  # narrow it while iterating
npm run eval:behavior:baseline                           # record floors: 3 runs each, same models as the routing gate
npm run eval:behavior:gate                               # PASS / DEGRADED / INCONCLUSIVE, same exit codes as eval:gate
npm run eval:behavior:compare -- --agent ndv-x --record  # agent file vs a plain model on the same cases

Each case in test/fixtures/behavior-cases.json runs with the agent's own model file as the system prompt, and has one of three kinds:

  • finds: a defect planted inside the agent's domain. Pass means the output names it.
  • lane: a defect planted outside the domain. Pass means the output hands it to the agent named in the case, which must be one the agent's Out of Scope declares.
  • brief: a Flow brief with one Brief Contract field missing. Pass means BRIEF_REJECTED. Only Tier 1 and Tier 2 agents get one.

Scoring is deterministic: every check is a pattern on the output (scripts/behavior-checks.mjs, shared with the static test), with no model judge, so any score can be argued with line by line from the saved report (--out). The gate fails on a run below the baseline floor, and names each case that passed in every baseline run and now fails. Editing the fixture makes the baseline stale, and validate fails until it is re-recorded. Providers read the agent prompt from NDV_EVAL_SYSTEM_FILE; without it they keep the routing instruction.

Every new agent must beat the plain model. --compare runs each case twice: once with the agent file, once with a control prompt that knows the agent's lane, the routing table, the handoff format and BRIEF_REJECTED, but not the neurotype, primordial rule or domain protocols. The verdict per agent is EARNS (more checks passed than the control, and no fewer finds), NO GAIN or WORSE. --record writes it to test/fixtures/agent-evidence.json, pinned to the agent file and its cases. validate fails for any agent added after the original 18 without current EARNS evidence on at least two models (authoring guide, step 7).

Test files

FileWhat it tests
test/validate-schema.test.jsStructural schema for agent/human files — format contracts; runs unconditionally, no CHANGED_AGENTS dependency
test/validate-authoring.test.jsAuthoring-guide compliance; scoped to CHANGED_AGENTS env var when set, else describe blocks register but produce no tests
test/validate-contracts.test.jsArchitectural contract tests (ADR-008 Domain Contracts, O(n) behavioral spec regression); runs unconditionally
test/validate-coherence.test.jsSemantic coherence across agent sections — handoff targets, Mandatory Pipeline, Brief Contract all resolve to real slugs; no agent instructs reacting to elapsed wall-clock time, asking the user what to do next, or sizing work in calendar units; static, no LLM calls
test/validate-routing.test.jsIntegrity of the behavioral routing fixture — every expect resolves, every agent is covered, the case mix stays hard enough to discriminate, canonical anchors exist in the routing text, and the committed eval baseline was recorded against this exact fixture; static, no LLM calls
test/validate-flow-protocol.test.jsStructural gates on the orchestration protocol in ndv-flow.md — routing-table coverage, sentinel token consistency, handoff emit/parse grammar agreement, ledger status vocabulary, bounded BRIEF_REJECTED retry, router parity with every CLAUDE.md routing table (agent coverage + a declared signal list), and shipped-text parity (CLAUDE.md's ndv block byte-identical to NDV_BLOCK; Copilot header has the same routing rows); static, no LLM calls
test/validate-behavior.test.jsIntegrity of the behavioral output fixture — every case names a real agent and kind, every check compiles through the scorer's own helper, every agent but ndv-honest has a finds case, every agent with handoffs has a lane case whose target its Out of Scope declares, Tier 1/2 agents have a brief case, and a committed behavior baseline matches the fixture; static, no LLM calls
test/install.test.jsbin/ndv.js install commands — simulates claude/opencode/cursor installs in a temp dir
test/install-router-skills.test.jsAcceptance tests for router-skill auto-install behavior in bin/ndv.js (claude auto-install, opencode skip, cursor/copilot no skills dir)
test/transform-skill.test.jsAdversarial unit tests for transformAgentToSkill() purity, determinism, boundary, and degradation behavior
test/transform-opencode.test.jsUnit tests for transformForOpenCode() — the ndv-flow path-hint injection is gated on the exact bare filename, fails closed, and always injects the literal <name> placeholder
test/entry-guard.test.jsRegression test for the entry-point symlink guard — invoking bin/ndv.js via a symlink still runs the command dispatcher

Adding or changing an agent

  1. Edit agents/ndv-[name].md (model file — source of truth)
  2. Update routing in CLAUDE.md, agents/ndv-flow.md, bin/ndv.js (NDV_BLOCK + Copilot header), commands/opencode/ndv-help.md, humans/ndv-agents.md. The ndv block in CLAUDE.md and NDV_BLOCK must stay byte-identical.
  3. Edit humans/ndv-[name].human.md (human file — written after model file is stable)
  4. Run npm run validate. The pre-commit hook and CI (Node 20, ubuntu-latest) run the same command.
  5. If routing changed, run npm run eval:gate before the next release.
  6. For a new agent, or an edit to one added after the original 18: re-run npm run eval:behavior:compare -- --agent ndv-[name] --record on two models. It must say EARNS on both.

Pre-commit hook

Husky runs npm run validate on every commit. Fix failures before committing — do not skip the hook.

Running from a git worktree: husky's generated .husky/_ directory is untracked, so the hook doesn't fire there. Run npm run validate by hand before pushing.

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.