agentleFS
berth-devberth-dev/berth/skill/SKILL.md

factory

Skill1 starsChanged 5 months agoMITView on GitHub

Plan→execute→review factory for feature/phase work. The orchestrator writes self-contained SHA-stamped plan files; cheap executors (headless Sonnet workers / builders) implement them; review happens in a fresh session. Triggers - "factory", "plan the phase into the factory", "run the factory", "factory review".

26 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use status, implement and 4 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • AnthropicSkill

    status

    Case status summary by audience — client-facing (plain language), internal (for the professor), or court-ready (formal caption format per local rules). Same facts, different framing and depth. Use when a student needs to update the client, brief the professor, or prepare a court status report.

    Also in 3 projects that use this

  • Hugging FaceSkill

    implement

    Make tests pass. Invoke after /write-tests produces failing tests.

    Also in 4 projects that use this

  • Google CloudSkill

    triage

    Gather context on a change or bug and plan the implementation.

    Also in 3 projects that use this

  • MicrosoftSkill

    grill-with-docs

    Grilling session that challenges your plan against the existing domain model, sharpens terminology, and updates documentation (CONTEXT.md, ADRs) inline as decisions crystallise. Use when user wants to stress-test a plan against their project's language and documented decisions.

    Also in 3 projects that use this

  • SentrySkill

    review

    Fixture review skill.

    Also in 3 projects that use this

  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 4 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 24 edited versions we read keep these.

  • 4

    Distinctive

    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. Distinctive:

    Massive build / brain-dump: never one-shot it. Owner's dump goes to a FILE (dictation etc.).

    line 19
  2. Very specific:

    Every plan follows this repo's templates/plan-template.md (resolve via $FACTORY_HOME/templates/plan-template.md) — READ IT BY PATH (steps …

    line 25
  3. Very specific:

    Goal artifact: every phase names ONE verifiable end-state artifact in plans/README.md (a mockup, golden transcript, runnable eval, curl …

    line 32
  4. Very specific:

    Default for a whole phase: factory-run.sh --drive <repo-root> — unattended: runs each wave, closes it (below), runs REVISE rounds (≤2), …

    line 74
  5. Distinctive:

    Never stack on a wave still in REVISE — its base is moving.

    line 99
  6. Distinctive:

    Every REVISE delta brief restates: "foundation-first — confirm the artifact EXISTS and the environment is CAPABLE before fixing symptoms.

    line 127
  7. Very specific:

    Start review from the wave's _gates ledger + any *.diag.txt one-line diagnoses — the script already ran the mechanical gates.

    line 130
  8. Distinctive:

    After a wave is judged and merged (owner sign-off per merge):

    line 137
  9. Very specific:

    Update plans/README.md status.

    line 161

“Common” is measured: kept by at least 6 in 10 of the 24 edited versions of this file we could read. “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
SKILL.md

The factory — expensive model plans, cheap models execute, expensive model judges

Three modes; the arguments say which. Never run more than one mode in a session.

Right-sizing (the factory is for feature/phase work, not everything)

  • Fix lane (small tweak, "X is broken"): NO factory — one builder brief, one gate, done. Ceremony would cost more than the work.
  • Small feature: ONE plan file; planning and its review may share a session if the window stays under ~100k. The fresh-session rule is for waves.
  • Product phase = one independently-shippable slice of a roadmap (e.g. a storefront app's "checkout redesign"), sized so PLAN fits one planning session with the strongest model you have: ≤ ~8 plan files / 1–2 waves, ships behind its own review + deploy.
  • Massive build / brain-dump: never one-shot it. Owner's dump goes to a FILE (dictation etc.); grill; split into phases; each phase gets its own PLAN session later — planning wave N+1 after wave N's review is a feature, not a delay: it folds in what execution taught you.

1. PLAN (a planning session with the strongest model you have, plan-mode; no source edits)

Every plan follows this repo's templates/plan-template.md (resolve via $FACTORY_HOME/templates/plan-template.md) — READ IT BY PATH (steps with per-step Verify lines, Files-touched scope, STOP conditions, drift check, done criteria). Maintain plans/README.md: priority order, dependency DAG as waves (wave-1 no deps; wave-2 depends only on wave-1...), status table TODO/RUNNING/REVIEW/DONE/BLOCKED/REJECTED, and a "considered and rejected" ledger so dead ideas aren't re-litigated next session.

  • Goal artifact: every phase names ONE verifiable end-state artifact in plans/README.md (a mockup, golden transcript, runnable eval, curl script) — the thing loops and reviewers check work against. Per-plan Gate-commands anchor to it wherever possible. "Done" is a comparison, never a vibe.
  • Partition test: two plans share a wave ONLY if their Files-touched lists are disjoint. Overlap → same lane (sequential, stacked via FACTORY_BASE) or merge into one plan.
  • Size bar: one plan = one reviewable PR — single concern, ~≤400-line diff. More than ~8 steps or 3+ subsystems = a phase pretending to be a task; split it.
  • Drafting is delegated (the orchestrator window never holds bulk source): the orchestrator emits decision skeletons — goal, scope, executor, wave, step outline; a Sonnet builder expands each into the full template (reads the code, fills Current-state excerpts and Files-touched); the orchestrator spot-checks scope + steps, not every excerpt.
  • Big/ambiguous phases: spawn 3 BLIND Sonnet drafts (same brief, nothing else, fresh contexts — divergence is the point); a Sonnet synthesizer merges them into ONE candidate plus a ≤1k diff-of-disagreements; the orchestrator adjudicates only the disagreements — it never reads three full drafts.
  • Contract lines (machine-parsed, one line each in the Status block): Produces: / Consumes: (comma-separated path[#export]) and Scope: (globs). factory-run.sh --lint <repo> checks the whole set — every Consumes needs a Produces in a STRICTLY earlier wave — and --drive runs the lint automatically, refusing to start on errors. The driver also refuses to dispatch a wave whose Consumes aren't on the integration branch, and the closer REVISEs any merged plan whose Produces didn't materialize. Evidence: one undeclared cross-wave contract cost 46% of a phase's spend (2026-07-05).
  • Plan critique (MANDATORY before every --drive, any phase size): one fresh-eyes reviewer pass attacking the plan set before execution — wave partitions probed for hidden coupling; Produces/Consumes completeness checked against each plan's Steps (an artifact a later plan needs but no one declares is exactly what the lint can't see); stubs/scaffolds that wave-1 must pre-create; a missing Files-touched list is blocking; every env/secret/live gate must carry the REVIEW-STEP tag or the plan fails critique. This pass caught 8 blocking integration gaps pre-build on 2026-07-05 — the single best-evidenced quality mechanism in the factory.
  • Dependent-wave plans name their dependencies' expected files in the drift check — diff-vs-Planned-at legitimately includes the base wave's work once stacked.

2. EXECUTE (zero orchestrator-model tokens)

  • Default for a whole phase: factory-run.sh --drive <repo-root> — unattended: runs each wave, closes it (below), runs REVISE rounds (≤2), advances waves, stops + pings only on BLOCKED/NEEDS-OWNER. Single waves: factory-run.sh <repo-root> plans/00X-*.md ... then --close.
  • Workers are headless Sonnet, one worktree+branch per plan, repo CLAUDE.md loaded (NOT --bare — plans may lean on repo conventions), logs in .factory/results/. No working turn cap (FACTORY_MAX_TURNS=300 is a runaway backstop; the 45m wall-clock timeout is the floor). A gate failure triggers a WARM RESUME of the same session (≤3 sessions total, identical gate output twice = stop); a driver watchdog polls each worker's stream every 2 min with free tripwires — stall, verify-loop, out-of-scope edit (judged plan-gap vs drift, never auto-punished) — and in FACTORY_WATCHDOG=enforce mode kills + warm-resumes with guidance (default observe = log+ping only; run enforce in dry-runs first). Closer transcripts are per-wave (_closer-wave<N>.jsonl) — never overwritten; the driver appends every event to plans/LOG.md. /goal is available as a primitive for standalone polish loops ("keep going until X matches the goal artifact") — but its Haiku evaluator judges the transcript only and never runs tools: it nags, the Gate-command decides. Taste-phase interactive builders may launch with a strongest-available-model advisor (--advisor) for surgical judgment calls.
  • builder plans (interdependent cores) → one long-lived builder subagent.
  • Executor drift check before dispatch: if git diff --stat <Plan-SHA>..HEAD touches the plan's files, re-verify the plan first — don't hand over a stale plan.
  • A dependent wave launches ONLY after its base wave is APPROVED and merged (or explicitly stacked on the approved integration branch via FACTORY_BASE). Never stack on a wave still in REVISE — its base is moving.
  • Base stacking is automatic: the wave-closer records the integration branch in .factory/state/_integration; the runner/driver stacks later waves on it (explicit FACTORY_BASE still overrides).
  • New factory machinery (script/template changes) gets a one-plan dry-run in a throwaway repo before its first production phase.

3. CLOSE (autonomous — the wave-closer, factory-run.sh --close)

An EPHEMERAL headless opus with fresh context per wave (brief: this repo's templates/wave-closer.md, resolved via $FACTORY_HOME/templates/wave-closer.md): reads the gate ledger + diagnoses, scope-checks each PASS branch, merges them SEQUENTIALLY into the phase's integration branch running the Repo-gate after EACH merge (failure attributes to one branch; that merge alone is reverted), writes REVISE delta plans (max 2 rounds → BLOCKED), stamps .factory/state/<slug>.status, updates the DAG, mirrors status to Linear (optional), and opens the ONE phase→main PR when everything is DONE. Dangerous-tier diffs are never auto-merged — NEEDS-OWNER. No resident orchestrator exists: state lives on disk, crash-proof, each closer run starts clean.

3b. HUMAN + TASTE REVIEW (interactive, shrunk to what machines can't do)

Owner/orchestrator taste passes on goal-artifact phases (screens vs mockup); NEEDS-OWNER and BLOCKED items; secrets/live-service gates via runner. Secrets/live-service gates the executor couldn't run happen HERE via runner. Verdict: APPROVE (merge on owner go-ahead) / REVISE (max 2 rounds; builder executors get the delta brief directly; for factory-run plans the headless worker is gone — a builder subagent applies the delta on the existing factory/<slug> branch) / BLOCK (kill the branch, replan). Every REVISE delta brief restates: "foundation-first — confirm the artifact EXISTS and the environment is CAPABLE before fixing symptoms; two failed fixes on the same issue → stop and re-verify the foundational assumption." Start review from the wave's _gates ledger + any *.diag.txt one-line diagnoses — the script already ran the mechanical gates. Documented in-scope deviations pass on merit; undocumented deviations fail. Merge in DAG order; a branch that no longer merges clean gets a rebase delta brief, not a hand-fix.

4. Lifecycle — what happens to finished work

After a wave is judged and merged (owner sign-off per merge):

  • factory-run.sh --clean <repo> — prunes worktrees, deletes MERGED factory/* branches, wipes .factory/results/ logs (read them BEFORE cleaning). BLOCKed branches are deleted by hand (git branch -D).
  • DONE plans move to plans/done/ (content survives in git history); plans/README.md keeps the status row. Stale TODO plans older than the current phase get re-verified against HEAD or deleted — a plan is a snapshot, not gospel.
  • .factory/ belongs in the repo's .gitignore; plans/ is committed (including plans/LOG.md — the append-only narrative the driver/closer write, one line per event: any fresh session reconstructs a phase from it without transcripts or the console — and plans/LESSONS.md — closer- nominated, owner-curated, every lesson cited or it doesn't exist).
  • Workers are NOT --bare — they load the repo's CLAUDE.md so plans can lean on repo conventions (factory-run.sh header note). Interactive builders load them too.

5. RECONCILE (cheap session, any model — run when returning to a repo,

or whenever ANOTHER session may have touched it since you last read;

minimum form: git log -3 before acting on any remembered repo state)

Spot-check DONE plans still hold (grep the old pattern, run one gate); investigate BLOCKED ones; flag stale RUNNING; re-verify TODO plans against HEAD via their drift check — refresh or mark REJECTED. Keeps plans/README.md truthful across sessions without re-auditing anything. Update plans/README.md status; /clear when the wave is judged.

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.