agentleFS
skyf0xxskyf0xx/hedgehog/CLAUDE.md

hedgehog

CLAUDE.md50 starsChanged 4 months agoMITView on GitHub

Hedgehog is a build discipline for AI-guided software projects. This repo holds the discipline itself as a package of Claude Code agents and skills — the executable payload a consuming project copies in to work Hedgehog-style, and is the source of the method. See README.md for the discipline's stance and rationale. This repo is the engine: the CLI, the build graph, the host adapters, the core registry, and the agents and skills every core shares. Each core — full-stack-app, pwa-app,…

  • Commits and pushes

The file

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

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every file states current state only — no negation of alternatives, no changelog-style narration, no "we used to do X." If a file needs to …

    line 283
  2. Very specific:

    Every rule an agent or skill depends on lives inside that agent or skill file, or in README.md — not in a separate reference document.

    line 286

≈ “Common” is an estimate: at least 1 in 5 of the 29,248 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

Hedgehog (this repo)

Hedgehog is a build discipline for AI-guided software projects. This repo holds the discipline itself as a package of Claude Code agents and skills — the executable payload a consuming project copies in to work Hedgehog-style, and is the source of the method. See README.md for the discipline's stance and rationale.

This repo is the engine: the CLI, the build graph, the host adapters, the core registry, and the agents and skills every core shares. Each core — full-stack-app, pwa-app, landing-page, copywriting, deepseek-harness, authored (a from-scratch design), and adopted (brownfield adoption) — ships as its own npm package holding that core's workspace, agents, skills, and CLAUDE.md section. src/registry/cores.json names them; init fetches the one a project asks for.

Layout

  • src/agents/ — the subagent roles every core shares, copied into a consuming project's own .claude/agents/: planner (planning intake, core selection, module scoping), bootstrap (Bootstrap step sequencing), reviewer (phase and layer transition checks, Correction Protocol review), and tweaker (change requests on a project with nothing in flight, sized through hedgehog-daily, and friction-log-driven Hedgehog issue suggestions). A core's own build agents ship in that core's package and install alongside these.
  • src/skills/ — the packaged procedures every core shares, copied into a consuming project's own .claude/skills/. A core's own loop, bootstrap, and reference skills ship in that core's package and install alongside these.
    • hedgehog-planning-intake — runs the vendored BMAD-METHOD planning shelf (vendor-skills/BMAD/), shared by every core, and mines its output into scope boundary, domain modules, and the Add-ons decision on full-stack-app. Invoked by planner; landing-page runs this skill's shelf too, then mines the same archive through hedgehog-landing-loop's own planning-intake section instead.
    • hedgehog-orchestrating — the core-neutral build loop, read at the start of every session on a project with a build graph: the claim → dispatch → verify cycle, the intent check, debt and decisions, the test-depth and review rule, the Friction log, the Correction Protocol and its Post-build entry, the Stop Condition, the graph exits, and when to clear context. A core's own loop skill supplies only what is core-specific (which agent builds which layer, in-layer conventions, the review checklist) and names these sections rather than restating them.
    • hedgehog-daily — the shared triage gate for a change request on a project that already has a build graph and nothing in flight. Reads the installed core's layer sequence, scope globs and verify commands from .hedgehog/core.yaml and routes to one of three exits: a tweak made and committed on the spot (one layer, existing files, and the default under ambiguity), change-work through hedgehog intent add and the core's own loop, or a re-plan. tweaker runs it for job 1's sizing call.
    • conventional-commits — reconstructs step-shaped, conventional commit history when work didn't land cleanly as it went (mainly Correction Protocol cleanups).
    • no-history-in-output — keeps project-facing documents (root CLAUDE.md, .hedgehog/core-design.md, specs, READMEs) written as a current, as-is snapshot rather than a log of edits or decisions, on first generation and every later revision.
    • hedgehog-contributing — forking, branching, and PR-opening procedure for contributing a fix or roadmap issue back to the Hedgehog project itself, as opposed to a consuming project's own code.
    • pr-writing — writing style (brief, info-dense, Simplified Technical English, only verified claims) and the pre-open checklist (CI passing, one change per PR) for a PR, commit message, or review comment in any repo. hedgehog-contributing uses it for Hedgehog's own PRs.
    • filing-issues — the mechanics of getting planned work into GitHub issues: which repo an issue belongs in, when to split a plan into a tracking issue plus sub-issues, which account files it, labels, and acceptance criteria. Defers to pr-writing for how an issue is worded.
    • code-comment-discipline — governs commenting in every core's build agents: no comment by default, one only for the non-obvious (a hidden constraint, an invariant, a workaround, surprising behavior), and never history or a restatement of what the code already says.
  • src/registry/ — the core table and the fetcher that acts on it. cores.json names every core, the npm package that ships it, its version range, its install flag (absent on authored and adopted, which are chosen during planning rather than at install time), and the prose planner reads in Phase 0 to pick one; index.mjs loads and resolves it by name or flag. manifest.mjs owns the shape of the hedgehog-core.yaml every core package carries at its root — which agents, skills, vendored shelves, workspace, and CLAUDE.md section that core contributes. fetch.mjs resolves a core package with npm pack, extracts it, and caches the extraction at ~/.hedgehog/cores/<name>/<version>/ so a repeat install needs no network; installed.mjs records which core a project installed, so update refreshes that core's agents and skills from the same package.
  • vendor-skills/BMAD/ — BMAD-METHOD (bmad-code-org/BMAD-METHOD, MIT-licensed), vendored in full: the planning shelf hedgehog-planning-intake runs. See vendor-skills/BMAD/ATTRIBUTION.md for the pinned source commit; re-vendoring is a deliberate act via the bmad-revendor skill, not automatic.
  • src/templates/ — files a consuming project copies (and then edits or deletes) rather than running as-is: CLAUDE.md, the project-root guide the installer drops in (project-context placeholders the planner fills at planning intake, plus the Hedgehog constants — stack, layout, rules, skill/agent pointers, and context-management guidance). Each core package's own CLAUDE.core.md fills that shell's {{CORE_SECTION}} — at install time when init names a core, or by hedgehog core install when init ran naming none and the shell landed with that placeholder still unfilled. {{HOST_DISPATCH}} is filled at install time from the chosen host's DISPATCH.md.
  • src/db/ — the SQLite build graph a consuming project's Bootstrap initializes at .hedgehog/hedgehog.db: schema, intents/tasks, plan (compiles intents into the task graph), next/ready/status/claim (what to work on and lease it), verify/gate (close a layer, check a phase transition), friction, debt, decision (inherited context for dependent tasks — a limitation or a design choice, respectively), drift, boundary, why, overrides, reconcile (absorbs work that landed outside the loop, on the user's per-task confirmation, recorded in committed .hedgehog/reconciled/*.json so db rebuild replays it), conflict, commitLock, core, rebuild, graph-server (serves src/templates/graph.html's visualization), and community (the star prompt raised at the first completed intent). Schema changes are versioned: schema.mjs's runMigrations tracks a graph's PRAGMA user_version against CURRENT_SCHEMA_VERSION, applying only the migrations it hasn't seen yet on every writable open, and failing loudly if the graph is newer than this installed CLI knows about; hedgehog db migrate runs the same check on demand and reports what moved. This is the live source of truth every loop skill and its agents query and mutate for what's next and what's done.
  • bin/cli.mjs — the hedgehog CLI installed by npx @skyf0xx/hedgehog: init (installer); core install <name> (lands a core into a project whose init named none — agents, skills, vendored shelves and workspace for every installed host, the core's section in each host's instructions file, and the record update reads; bootstrap runs it first, and core record-adopted is its alias for adopted); core check [path] (loads and lints a core.yaml); core show [--json] (prints the resolved core's layers, whether it lives at core.yaml or .hedgehog/core.yaml — what a skill cites instead of a path); and the subcommands (status, next, verify, claim, intent add, plan, friction add/list, …) that read and write src/db/'s build graph.
  • src/hosts/ — one entry per coding agent Hedgehog installs into (Claude Code, Cursor, Gemini CLI, OpenCode, Windsurf, GitHub Copilot): where the payload lands, which instructions file that agent loads, and how to emit the agent files when its format differs from the canonical one. capabilities.mjs derives each agent's tool grant from its own tools: frontmatter for hosts that can't register a per-agent grant; routing.mjs generates the root AGENTS.md index from the engine's and the installed core's agent and skill frontmatter; claude-md-merge.mjs safely merges a core's CLAUDE.md section into a repo's hand-written root instructions file (adoption case), run by core install. version.mjs owns payload-staleness detection: init and update stamp the version they wrote into .hedgehog/version.json, and that stamp is compared against the newest published release. See ARCHITECTURE.md for the host table and AUTHORING-CORES.md for the package contract a new core must satisfy.
  • hooks/ — the Claude Code plugin's SessionStart hook, which injects the offer gate (when to raise Hedgehog, when to stay silent, how to ask) into context at session start rather than leaving that to skill-description matching. session-start checks for .hedgehog/ and emits no offer gate when it exists, so an already-installed project's own payload owns the session; that check is the one place the silence rule is enforced. It also reports a stale plugin — the version recorded in the install path against the marketplace clone's origin/<branch> manifest, read locally with no network wait — which is independent of that gate and so is the one thing it emits into an already-installed project. Updating a plugin takes two commands (claude plugin marketplace update <marketplace>, then claude plugin update hedgehog@<marketplace>): the first fetches the new version, the second installs it, and update resolves only the qualified plugin@marketplace id — a bare plugin name fails. The notice reads the marketplace name from the install path so a fork's own name comes through. hooks.json (Claude Code) and hooks-cursor.json (Cursor) register it; run-hook.cmd is a cmd/bash polyglot so the hook runs on Windows, and hook scripts stay extensionless because Claude Code prepends bash to any command containing .sh. Part of the plugin payload, not the npm package — a consuming project installs real agents instead.

Releasing

This repo ships one version number, carried in six files that always agree: package.json (and package-lock.json, via npm version), src/hosts/gemini/gemini-extension.json (per-project template content a consuming project's Gemini CLI install carries), .claude-plugin/plugin.json, .claude-plugin/marketplace.json's plugins[0].version, .cursor-plugin/plugin.json, and root gemini-extension.json (the Claude Code plugin, its marketplace listing, the Cursor packaging, and the Gemini CLI extension — all three built from the same skills/ + hooks/ payload).

npm run release (scripts/bump-package-version.mjs) is the only way to change it: it runs npm version (defaults to a patch bump; pass -- minor, -- major, or -- x.y.z for anything else) and then writes the same version into the other five files in one step — never hand-edit any of these version fields. scripts/check.mjs gates on all six agreeing, so a bump that misses one fails npm run check. Commit the bump on the feature branch and let the PR merge it into master — do not tag or push the tag yourself.

.github/workflows/publish.yml watches every push to master that changes package.json, diffs the version from before the push (however many commits it carries) against after, and when it changed: fails early if v<version> already exists on origin, runs npm run check, then tags v<version>, runs npm publish, and creates the GitHub release, all on the runner's own token. A failed check leaves no tag. It also carries a workflow_dispatch trigger for a manual run — there, with no push to read a prior state from, "before" is whatever version is currently live on npm, so a manual run still only acts when the committed version and the published version actually differ. A tag pushed by hand ahead of the merge collides with that workflow's existing-tag guard and fails the release (see git history around 2026-08-14 for the incident this rule comes from). If a tag was pushed by mistake, delete it (git push origin --delete v<version>) before the PR merges so the workflow can create it fresh, pointing at the actual merge commit.

The Claude Code plugin, Cursor packaging, and Gemini CLI extension ship by the marketplace or extension registry re-reading this repo at whatever commit master is on — no CI publishes them. Because the version is unified, any release also moves that number even when nothing under skills/, hooks/, .claude-plugin/, .cursor-plugin/, or root gemini-extension.json changed; that's the intended trade against the alternative of two numbers that can silently drift apart.

Each core package carries a separate version, in its own repo and released from there — a change to a core's workspace, agents, or skills is a release of that package, not of this one. src/registry/cores.json names the version range init resolves for each, so widening a core's range is the one edit here that a core release calls for — and a core's version bump within its major line needs no edit here: every entry uses the major-line form ("1.x", "0.x"), which resolves to the newest release on that line. A core crossing a major boundary needs its range moved to the new line and a new hedgehog release cut, or every consumer stays pinned to the old line with no error anywhere (npm run check catches this — it queries each core's actual latest published version against its pinned range and fails on a mismatch — but the range still has to be moved by hand, not just left for the next check run to complain about). Each core repo carries its own .github/workflows/publish.yml, structured the same way as this repo's: a version bump to that core's own package.json, committed and merged to that repo's own main, is the trigger — the workflow diffs the version before and after the push, and when it changed, tags, publishes to npm via OIDC trusted publishing, and creates the GitHub release, all in one job on the runner's own token, exactly as this repo's own bump-and-merge triggers its own release.

Adding or changing a core in src/registry/cores.json also touches a set of places that enumerate cores by hand rather than reading the registry, and each one drifts silently if skipped — no error surfaces, the text just goes stale. Sweep all of them in the same PR as the registry change: skills/hedgehog/SKILL.md, hooks/session-start's gate text, CLAUDE.md, SECURITY.md, ARCHITECTURE.md, AUTHORING-CORES.md, CONTRIBUTING.md, src/agents/planner.md, src/agents/bootstrap.md, src/agents/tweaker.md, src/skills/hedgehog-planning-intake/SKILL.md, and the code comments in src/registry/ and src/db/. npm run check fails when CLAUDE.md, SECURITY.md, ARCHITECTURE.md, AUTHORING-CORES.md, or hooks/session-start omits a registered core name. hooks/session-start is easy to miss because it isn't under skills/, but it ships as part of the plugin payload and needs the same release as everything else in this list.

The star prompt

src/db/community.mjs owns the one thing Hedgehog ever asks of the person using it: a prompt to star and watch the repo, raised by hedgehog verify at the first intent to close every one of its layers — the first point the user has watched planned work go through the graph and come out verified.

  • Blocking, not advisory. The prompt is an instruction to the agent, not a line of output — the agent running the Loop holds until the user answers. Every other notice this CLI prints is advisory; this one isn't.
  • Fires once. starred and dismissed are terminal; later and an unanswered display both re-arm after a cooldown rather than repeating. hedgehog community star --answer <a> records the answer.
  • WIIFM-framed. Watching releases is how a user learns their installed payload is behind; starring helps the project. Both stated plainly.

State lives in .hedgehog/community.json, per project rather than global.

Working in this repo

This repo's own content is the product. Changes here are edits to the discipline itself: agent and skill content under src/, README.md, and any shared config or generators the discipline references.

  • Every file states current state only — no negation of alternatives, no changelog-style narration, no "we used to do X." If a file needs to change, edit it to say what's true now.
  • Every rule an agent or skill depends on lives inside that agent or skill file, or in README.md — not in a separate reference document. A consuming project copies agents/ and skills/ verbatim, so nothing load-bearing may live outside them.
  • A fact restated across multiple agents/skills (e.g. the commit-message format, the domain module shape) has exactly one owning file; others reference it by name rather than restating the substance.
  • Where a deterministic generator (e.g. an Nx generator or template) can produce a piece of code — tests, modules, boilerplate — prefer it over having an agent write that code freehand, in cores and elsewhere. Generated output is cheaper, faster, and more consistent than LLM-authored equivalents; reach for an agent only for the parts a generator can't cover. Building the generator costs more up front than writing the one-off by hand, but pays that back many times over across every future use — treat that up-front cost as worth paying, not a reason to skip the generator. When work reveals a repeatable shape that has no generator yet, propose building one rather than writing the code by hand again.

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.