eforge
AGENTS.md72 starsChanged 6 months agoApache-2.0View on GitHub
Project overview and user-facing docs are in README.md at the repo root. See docs/llm-friendly-code.md for the full policy. Key rules for agents: Run pnpm maintainability:check to validate file sizes and marker balance before committing. When the user refers to project backlog items, use the eforge-plan extension contributions (eforge-plan:* actions such as search-items, get-item, get-epic, capture-item, and update-item). Do not use Schaake OS epics for this project's backlog: Schaake OS has an epics feature, but this project tracks backlog work through…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,736 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- eforge-daemon-restartSkill
- eforge-plugin-update-docsSkill
- eforge-releaseSkill
- eval-analysisSkill
The file
We split this AGENTS.md into the rules it gives an agent
8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
New implementation files: must be <= 600 lines. New test files must be <= 1,200 lines.
- Distinctive: line 25
Files over 1,000 lines: must be edited with bounded exact edits (smallest diff).
- Very specific: line 26
New/moved functions: must have Cognitive Complexity <= 30 (measured by eslint-plugin-sonarjs).
- Very specific: line 30
Run pnpm maintainability:check to validate file sizes and marker balance before committing.
- Distinctive: line 57
Use Mermaid diagrams instead of ASCII art in documentation.
- Very specific: line 66
No mocks: Test real code. For SDK types, hand-craft data objects cast through unknown.
- Distinctive: line 75
Read it: before proposing new features or architectural changes
- Distinctive: line 76
Future only: - remove items once they ship
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.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
AGENTS.md
Project overview and user-facing docs are in README.md at the repo root.
Commands
pnpm build # Bundle all workspace packages (tsup); CLI lands at packages/eforge/dist/cli.js
pnpm test # Run tests (vitest)
pnpm test:watch # Watch mode
pnpm type-check # Type check without emitting
pnpm docs:generate # Build the docs generator and regenerate all reference artifacts
pnpm docs:dev # Regenerate reference docs then start the Next.js dev server for the public docs site (http://localhost:3000).
pnpm docs:build # Regenerate reference docs then build the Next.js site
pnpm docs:check # Drift gate: fails if generated reference docs are out of date
pnpm maintainability:check # File-size ratchet and region-marker balance check (exits non-zero on violations)LLM-Friendly Code Policy
See docs/llm-friendly-code.md for the full policy. Key rules for agents:
- New implementation files must be <= 600 lines. New test files must be <= 1,200 lines.
- Legacy oversized files are listed in
scripts/agent-maintainability-baseline.jsonwith anoGrowthCeiling. They may shrink but not grow. - Files over 1,000 lines must be edited with bounded exact edits (smallest diff). Do not rewrite the full file.
- New/moved functions must have Cognitive Complexity <= 30 (measured by
eslint-plugin-sonarjs). Justify higher complexity inline. - Large files (> 300 lines) must use durable semantic
// --- eforge:region <slug> ---/// --- eforge:endregion <slug> ---markers. Temporaryplan-\d{2}-...build-coordination markers are stripped during cleanup. Every marker must be balanced. - Route constants and daemon wire shapes are owned by
@eforge-build/client. Do not inline/api/...path literals or re-declare wire-shape interfaces in monitor packages.
Run pnpm maintainability:check to validate file sizes and marker balance before committing.
Backlog
When the user refers to project backlog items, use the eforge-plan extension contributions (eforge-plan:* actions such as search-items, get-item, get-epic, capture-item, and update-item). Do not use Schaake OS epics for this project's backlog: Schaake OS has an epics feature, but this project tracks backlog work through eforge-plan private extension storage.
Key principles
- Engine emits, consumers render. The engine never writes to stdout - all communication flows through
EforgeEvents. - Engine vs plugin boundary. The engine runs without Claude Code. The plugin is a thin launcher/facilitator - requirement refinement, subprocess delegation, status rendering.
- Engine vs wrapper-app boundary. Scheduling, triggers, approvals, notifications, and richer workflow orchestration belong in wrapper apps built on stable eforge APIs, not in the engine. The build engine consumes normalized PRD/build source and emits typed events; reusable domain-neutral input-artifact protocols live outside the engine, playbook behavior lives in
eforge/extensions/eforge-playbooks, hosts invoke it through generic extension contributions, and scope/path lookup lives in@eforge-build/scopes. Wrapper apps may compose these packages directly or call the daemon HTTP client (@eforge-build/client). New scheduling or workflow features proposed for the engine or daemon should be challenged against this guardrail - if it belongs in a wrapper app, keep it there.
Conventions
- All engine commits use
forgeCommit()frompackages/engine/src/git.ts- this appends theCo-Authored-By: forged-by-eforgetrailer. The helper accepts(cwd, message, options?)whereoptionscarriespaths?: string[](stage-and-commit subset) andreuseMessage?: boolean(rewrites.git/MERGE_MSGto include the trailer, then runsgit commit --no-edit- used after merge-conflict resolution to preserve Git's preserved merge message). Do not use rawexec('git', ['commit', ...])in engine code outside ofgit.ts. - All engine commits produced during a build session also carry a
Models-Used: <model-id>, <model-id>trailer (sorted lexicographically, no backend prefix, placed before theCo-Authored-By: forged-by-eforgetrailer) when one or more agents were invoked. Emitted viacomposeCommitMessage(body, modelTracker)frompackages/engine/src/model-tracker.ts. When no models were recorded (e.g. admin commits like enqueue, cleanup, retry), the trailer is omitted. - Provider SDK imports (
@anthropic-ai/claude-agent-sdk,@earendil-works/pi-ai,@earendil-works/pi-agent-core) are restricted topackages/engine/src/harnesses/- agent code uses theAgentHarnessinterface. - Always bump the plugin version in
eforge-plugin/.claude-plugin/plugin.jsonwhen changing anything in the plugin. Plugin and npm package versions are independent. - Do not bump the Pi package version in
packages/pi-eforge/package.json. It will be versioned with the npm package at publish time. - Keep
eforge-plugin/(Claude Code) andpackages/pi-eforge/(Pi) in sync. These are the two consumer-facing integration packages. When adding or changing CLI commands, MCP tools, skills, or user-facing behavior, update both packages. Pi extensions are more capable than Claude Code plugins, sopackages/pi-eforge/may have additional features — but every capability exposed in one should be exposed in the other when technically feasible. Always check both directories before considering a consumer-facing change complete. Daemon HTTP client code is shared via@eforge-build/client(packages/client/) - do not inline it. - Daemon HTTP client, SSE subscriber, route contract, and response types live in
@eforge-build/client(packages/client/). Do not inline lockfile, daemon-request, or per-session SSE subscribe helpers in the CLI, MCP proxy, Pi extension, or anywhere else - import them from the shared package (subscribeToSessionfor single-session event streams). Do not inline/api/...path literals either: call the typed per-route helpers (apiEnqueue,apiCancel,apiHealth, etc.) frompackages/client/src/api/*, or - for SSE/EventSource and the browserfetchtransport inpackages/console-ui/src- referenceAPI_ROUTES+buildPath()or route-specific builders such asbuildProfileListPath()from@eforge-build/client(or@eforge-build/client/browserfor the console-ui browser bundle). The daemon itself (packages/monitor/src/server.ts) also dispatches offAPI_ROUTES, so a renamed route surfaces as a type error rather than silent drift. BumpDAEMON_API_VERSIONinpackages/client/src/api-version.tswhen making breaking changes to the HTTP API surface. packages/console-ui/is the active monitoring dashboard (shadcn/ui, header-shell layout, consolidated routes). Seepackages/console-ui/README.mdfor the route table and data flow.- Workspace layout: The repo uses pnpm workspaces with packages in
packages/(engine, eforge, monitor, console-ui, client, pi-eforge, scopes, input, docs-gen, extension-sdk), the public documentation site inweb/(@eforge-build/web), and the Claude Code plugin ineforge-plugin/. .eforge/is developer-facing: the daemon writes runtime state here (monitor.db,state.json,event-log.jsonl, lock files, session logs) and project-local config lives here too (config.yaml,profiles/). The directory is gitignored - do not commit it.- Event types and schemas are owned by
@eforge-build/client.packages/client/src/events.schemas.tsis the compatibility facade andpackages/client/src/events/contains the focused implementation modules.EforgeEventis derived fromEforgeEventSchemaviaStatic<typeof EforgeEventSchema>. Add or change discriminant variants in the event schema modules, keepEforgeEventVariantsSchemaas one flat TypeBox union of variant entries, and do not define event wire shapes outside the client event schema modules. To validate an event at runtime, callsafeParseEforgeEvent(value)from@eforge-build/client— do not call.safeParse()directly onEforgeEventSchema. - State mutation is single-entry-point. All engine code that mutates
plan.status,plan.error,state.completedPlans, orstate.mergeWorktreePathmust callmutateState(state, event)frompackages/engine/src/state.ts. Direct field assignments to those properties outside that file are forbidden — a grep gate enforces zero hits. Use the appropriate lifecycle event variant (plan:status:change,plan:error:set,plan:error:clear,merge:worktree:set,merge:worktree:clear). - Decision emission is single-entry-point. All engine code that emits
plan:build:decisionevents must callemitBuildDecision(ctx, decision)oremitBuildDecisionForPlan(planId, decision)frompackages/engine/src/decisions.ts. UseemitBuildDecisionwhen a fullBuildStageContextis available (e.g., in stage functions); useemitBuildDecisionForPlanwhen only aplanIdstring is available (e.g., inparallel-reviewer.ts,merge-conflict-resolver.ts, and the recovery flow ineforge.ts). Direct yields of{ type: 'plan:build:decision', ... }outside that file are forbidden — a grep gate attest/decision-helper-discipline.test.tsenforces zero hits. - Use Mermaid diagrams instead of ASCII art in documentation.
- Exclude
node_modules/anddist/from file searches. - Daemon wire shapes for runs, queue items, session metadata, and auto-build are owned by
@eforge-build/client. Daemon DB read paths must use named row-to-wire mapping helpers (e.g.rowToRunInfo) rather than inline SQL camelCase aliases. REST handlers and thestream:helloSSE snapshot must constructruns,queue,sessionMetadata, andautoBuildthrough the same projection functions — no parallel object-shaping in the snapshot constructor or local interface re-declarations in monitor packages.
Testing
Tests live in test/ (engine and integration tests) and web/__tests__/ (content loader and nav manifest tests), all run via vitest.
- Group by logical unit, not source file.
- No mocks. Test real code. For SDK types, hand-craft data objects cast through
unknown. - Fixtures for I/O tests only. Everything else constructs inputs inline.
- Agent wiring tests use
StubHarness(test/stub-harness.ts). Seetest/agent-wiring.test.ts. - Don't test harness implementations or infra.
ClaudeSDKHarness,EforgeEngineorchestration, worktree/git ops, and tracing are integration-level.
Roadmap
docs/roadmap.md captures direction (what and why), not implementation details (how).
- Read it before proposing new features or architectural changes
- Future only - remove items once they ship
- Delete PRDs after implementation -
docs/should reflect current state and planned work only
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.

