The factory: a Claude Code plugin for governed, spec-driven delivery — frozen acceptance contracts and a merge floor that refuses a red seam.
A harness extension for spec-first agentic software delivery — as a Claude Code plugin.
Claude Code is an agent harness: the loop, tools, context, state, permissions, guardrails and verification around the model. Foundry extends that harness with a governed delivery path: a reviewed spec, a Definition of Ready, isolated builds, required checks, acceptance tests against the running app, and your sign-off.
Philosophy in one line: gates make problems visible, not impossible — and every gate has to earn its keep. A gate ships only if it names the observed failure it prevents; the operator's own judgment is what the automation serves, never what it replaces.
Status: v1.22.0. Built solo, dogfooded daily — Foundry is built with Foundry: every release you can install was itself specced, Ready-gated, floor-gated, and acceptance-tested through it.
/foundry:intake turns a fuzzy ask into an atomic spec with stable
acceptance-criteria IDs (AC-IDs) and an acceptance contract with observable checkpoints./foundry:spec-review runs fresh-context reviewers over it. You fix what
they find.atom in identifiers) in isolated worktrees. Required checks + branch protection (the merge
floor) decide the merge. Acceptance tests run against the running app. You sign off last.Foundry is spec-first in the terms of Böckeler's three levels of spec-driven development: the spec comes before the build. It is not spec-anchored and not spec-as-source.
intake ─▶ spec-review ─▶ READY ─▶ build ─▶ review ─▶ done ─▶ merge ─▶ acceptance ─▶ sign-off
(spec) (evaluators) (gate) (workers) (evaluators) (sensor) (floor) (outcome evals) (you)
| Stage | Command | Agentic pattern | Control type |
|---|---|---|---|
| intake | /foundry:intake | Routing to a planner (spec-author subagent) | Guide (feedforward) |
| spec-review | /foundry:spec-review | Evaluator-optimizer; LLM-as-judge in separate contexts | Inferential — advises |
| Ready | commit the reviewed spec + contract | Approval gate (Definition of Ready) | Deterministic — WorktreeCreate and TaskCreated hooks refuse a Story that is not Ready |
| build | /foundry:dispatch, /foundry:command-deck | Orchestrator-workers; worktree isolation | Deterministic guardrails — PreToolUse hooks |
| review | pr-reviewer, security-reviewer subagents | Evaluator (LLM-as-judge, separate context) | Inferential — advises |
| done | TaskCompleted hook, /foundry:verify | Verification loop | Deterministic sensor — done_when evidence |
| merge | /foundry:merge-when-green | Approval gate | Deterministic — required checks + branch protection |
| acceptance | /foundry:certify-local, /foundry:certify-staging | Acceptance testing (outcome evals against the running app) | Deterministic sensor — the test runner's own output |
| sign-off | /foundry:release accept | Human approval gate | Your judgement — a practice, not a machine gate |
Two hard gates — Ready (the Definition of Ready) and the merge floor (your platform's) — then acceptance testing produces machine evidence, and the final sign-off is yours. The agent does the work between the gates.
The core loop, as you would type it:
> /foundry:intake "rate-limit the public API"
… interactive discovery → writes specs/features/<product>/api/rate-limit/feat-api-rate-limit.md
+ acceptance-contract.yaml (stable AC-IDs, observable checkpoints)
> /foundry:spec-review specs/features/<product>/api/rate-limit/feat-api-rate-limit.md
… deterministic pre-lints → 3 fresh-context reviewer questions (prior-art,
steel-man+adversarial, per-AC rubric) → at most two remediation rounds → review recorded
> git commit specs/features/<product>/api/rate-limit/ # the committed, reviewed spec + contract is Ready
… the Definition of Ready passes: every AC has a checkpoint, done_when is well-formed,
spec and contract are committed
> /foundry:dispatch feat-api-rate-limit
… implementer persona builds it in an isolated worktree → opens a PR
… your CI + branch protection decide the merge (the plugin's git-discipline hook
refuses --admin bypasses and merges ahead of green checks — fail-closed)
> /foundry:certify-local api-v2
… deploys the release ONCE locally, runs every Story's tagged Playwright journeys
against that one instance → per-Story pass/fail from the runner's own output
> /foundry:release accept api-v2 --operator you --verdict accepted
… records YOUR sign-off — a practice note, never a machine gate
The artifact the whole loop pivots on is an acceptance contract you can read:
spec_ref: specs/features/<product>/api/rate-limit/feat-api-rate-limit.md
scope:
allowed_paths: ["src/api/**"]
checkpoints:
- ac_id: AC-RATE-1
surface: "api:/v1/*"
locator: "GET /v1/anything x101 within 60s"
expect: { op: equals, value: "HTTP 429 on request 101" }
Foundry maps each part of the harness to a standard agentic pattern:
| Pattern | Foundry implementation |
|---|---|
| Agent harness (extension) | The foundry plugin: subagents, skills, hooks, workflow scripts, an MCP server, a statusline |
| System of record | The workspace repo: specs, operator registry, repo manifest |
| Orchestrator-workers (long-running) | /foundry:command-deck: a scheduled task wakes the session; each tick re-reads state |
gv-19: governance dogfood on the plugin's own tree
https://github.com/lukasrepublic/agentic-foundry/issues/308
Labels: 없음
Updater: retire the Amendments-backfill and release.yaml true-up phases (no consumer after v2.0.0)
https://github.com/lukasrepublic/agentic-foundry/issues/272
Labels: 없음
Ticket-first default: a ticket with a runnable 'Done means' replaces the spec/contract/authorize path
https://github.com/lukasrepublic/agentic-foundry/issues/269
Labels: 없음
git-discipline guard: two pre-existing fail-open shapes (paren-bearing sink path; non-literal branch -D target)
https://github.com/lukasrepublic/agentic-foundry/issues/213
Labels: enhancement
cut-release: the emitted publish plan still teaches the superseded R2 staging
https://github.com/lukasrepublic/agentic-foundry/issues/147
Labels: 없음
Saved-plan slots create a durable secret-bearing artifact, warned about only in a YAML comment
https://github.com/lukasrepublic/agentic-foundry/issues/143
Labels: enhancement-request
G-4 reference-closure reads quoted link SYNTAX as a corpus citation, so a spec that documents wikilinks fails CLOSED on its own prose
https://github.com/lukasrepublic/agentic-foundry/issues/126
Labels: enhancement-request
acceptance-contract.schema.json description cites a walk + merge gate that were removed, and two DESIGN.md sections that do not exist
https://github.com/lukasrepublic/agentic-foundry/issues/87
Labels: 없음
Thanks for helping build a trustworthy LLM code factory. Contributions are welcome — issues, discussions, and PRs.
These invariants are what make Foundry trustworthy; a PR that weakens them will not be merged without a design change that justifies it:
tests/) carries the
behavioral assertions; scripts/foundry-doctor.py is a thin probe (manifest/hooks/
skills-frontmatter/stack-profile-lock/operator-registry) and is never the place a new
assertion goes. Run before you push:
pip install -r requirements-dev.txt
python3 -m pytest tests/ -q
python3 scripts/foundry-acceptance-contract-validate.py --selftest
python3 scripts/foundry-build-citation-graph.py --selftest
python3 scripts/foundry-graph-mcp.py --selftest
python3 scripts/foundry-doctor.py # DOCTOR-GREEN
node --check workflows/*.js
See "Testing" below for where a new behavioral test belongs.[foundry] primitive, check whether a
native Claude Code primitive already does it — adopt it with a thin seam; don't
reinvent. New skills carry a Prompt grammar section and a frontmatter name +
description.Real tests live in tests/ (pytest, pinned in requirements-dev.txt). A new atom that ships
load-bearing behavior in a scripts/foundry_*.py module gets a tests/test_<module>.py (or a
test class added to the closest existing one) that imports the module directly and asserts on
its computed output over tmp_path fixtures — never a standalone --selftest CLI dropped
elsewhere (one hand-rolled test harness per atom, re-discovered by a registry, is the
anti-pattern this rule exists to keep out).
scripts/foundry-doctor.py stays a thin, fixed-checklist probe; it is never the place a new
behavioral assertion goes. A shipped script that already carries its own hermetic --selftest
(e.g. foundry-decommission.py, foundry-bootstrap.sh, the hooks/*.sh selftests)
keeps it — tests/ may wrap it with a subprocess call rather than re-implementing it.
Spec:
trailer naming the authorizing spec. CI runs the floor.claude plugin update is version-keyed: adopters receive a change only when the
version in .claude-plugin/plugin.json is bumped. A fix left under a perpetual
"Unreleased" is invisible to every existing install — they stay pinned to whatever
snapshot they first installed (this is how a fresh adopter once came up DOCTOR-RED on a
pre-fix snapshot). So:
.claude-plugin/plugin.json version (SemVer) on every meaningful change, and
land the notes under a dated ## vX.Y.Z section in CHANGELOG.md (not a standing
"Unreleased"). Patch for fixes, minor for additive features.claude plugin update foundry@<marketplace> (or
uninstall + reinstall if the cache is wedged).Skill/agent prose carries parenthetical anchors like (feat-foundry-…, AC-XXX-n) — the spec
atom + acceptance-criteria ids that authorized that behavior. Foundry is self-hosted, so the
plugin's own authorizing specs live in the maintainer's private workspace and do not ship
here; the ids are provenance stamps, not resolvable links (see docs/glossary.md). Keep them
when editing — they are how a change is traced back to its authorization.
Foundry is the generic framework; your project is the example. Never bake a
project-specific name into a primitive — Foundry owns the FOUNDRY_* env namespace and
adopters map their own vars onto it.
This project follows the Contributor Covenant. Be excellent to each other.