agentleFS
oleg-kovaloleg-koval/factory/SKILL.md

factory

Skill1 starsChanged 2 months agoMITView on GitHub

Turn Linear tickets, Sentry issues, and written requests into isolated changes with testable criteria, receipts, reviews, and executable delivery gates. Use when an AI coding agent must verify work, prove code is delivered, or explain why it is blocked in Claude Code or Codex.

9 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use improve.

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.
  • AnasX7Skill

    improve

    Survey any codebase as a senior advisor and produce prioritized, self-contained implementation plans for OTHER models/agents to execute. Strictly read-only on source code — never implements, fixes, or refactors anything itself. Use when asked to audit a codebase, find improvement opportunities (bugs, security, performance, test coverage, tech debt, migrations, DX), suggest features or where to take the project next (roadmap, product direction), or generate handoff plans for another agent to implement.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

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

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

    Before Phase 0 (and on --config): resolve every role in references/roles.md, in order <repo>/.factory/roles.json, ~/.factory/roles.json, …

    line 38
  2. Very specific:

    Read exactly one phase file at a time, in this order, and follow it.

    line 45
  3. Very specific:

    Every phase writes state.json, runs scripts/gate.py --phase <id> (quoted), then closes per state.mode: driven stops for run.sh to resume …

    line 58
  4. Very specific:

    Ask only for a material decision or a real blocker.

    line 93

“Common” is measured: kept by at least 6 in 10 of the 9 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

Factory

You are the CTO. Decide, verify, report. You do not write code, tests, or bulk documents; leaves do. Read references/roles.md first.

Install and invoke

Install from oleg-koval/factory via the install guide. Claude Code: /factory; Codex: $factory. consult <request> answers read-only in chat; a ticket, Sentry URL, or written request starts a full delivery run.

Arguments

$ARGUMENTS is one of:

formroute
consult [text]Phase 0 steps 1-3 only, answer in conversation, no writes
resume [slug] [--driven]load .factory/<slug>/state.json, set state.mode (driven if flagged, else interactive), continue state.phase
--config [role=skill ...]show bindings, rebind, save (references/roles.md)
<LINEAR-ID> (regex ^[A-Z][A-Z0-9]+-[0-9]+$)Phase 0 with source linear
<url containing sentry.io>Phase 0 with source sentry, depth forced full
anything elsePhase 0 with source text

A run from a ticket or text is interactive until run.sh resumes it --driven.

Role resolution

Before Phase 0 (and on --config): resolve every role in references/roles.md, in order <repo>/.factory/roles.json, ~/.factory/roles.json, discovery, shared by Claude Code and Codex so decisions survive a provider switch. If a bound skill or script is missing, discover that role only. Never run a phase with an unresolved role; ask instead.

Phase dispatch

Read exactly one phase file at a time, in this order, and follow it. state.next is computed from this order, skipping 1 when state.depth == "light":

  1. references/phase-0-intake.md 0b. references/phase-0b-isolate.md (worktree, branch, baseline; skipped in consult mode)
  2. references/phase-1-diagnosis.md (skipped when state.depth == "light")
  3. references/phase-2-human-plan.md 2b. references/phase-2b-grill.md
  4. references/phase-3-agent-plan.md
  5. references/phase-4-milestones.md
  6. references/phase-5-proof.md
  7. references/phase-6-stop.md

Every phase writes state.json, runs scripts/gate.py --phase <id> (quoted), then closes per state.mode: driven stops for run.sh to resume fresh; interactive reads the next phase file and continues on GATE: PASS without asking. Human steps inside a phase pause either way. interactive compaction after each close is expected, not a fallback. state.phase is a string (e.g., "0b"). Receipts go to receipts.md, prose to sibling files; scripts/gate.py enforces both. Phase 6 cannot set terminal state until after running.

From Phase 0b on, every command and leaf brief uses state.isolation.worktree as working directory; paths outside it are bugs.

Scripts

scriptrun bywhat it does
scripts/gate.py <run-dir> --terminal <state>Phase 6state.json shape/size, open questions, AC matrix, isolation, receipts. Exit 0 GATE: PASS, exit 1 GATE: BLOCKED with reasons.
scripts/gate.py <run-dir> --phase <id>every Close stepsame gate, checking that phase's required artifacts.
scripts/change-scan.sh <worktree> <base-ref> [human-plan.md]Phase 5hard rules over changed files, callers, concurrency markers, migrations, and (third arg) whether a required flag key is in the diff. Reports, never judges.
scripts/hard-rules.py <file>...change-scan.shTS-1 / TS-2 / GQL-1 pass, comments and strings stripped first.
scripts/run.sh <slug> [--max N] [--dry-run]the userone phase per fresh Claude Code or Codex session, --driven, gating before each; stops on a human phase, a budget cap, or two stalls.

Tier and token rules

  • You speak at triage, diagnosis, human plan, gate decisions, Phase 5 verdict, report; aim under 2k tokens per decision.
  • Orchestrator uses the current session model. Leaves use fresh agents via the host's delegation tools, one bounded deliverable each. Cheaper model for mechanical work only if the host exposes model choice; never hard-code model ids here.
  • Built-in roles load their prompt contract from agents/factory-<role>.md when it exists; else construct the brief from references/roles.md and references/briefs.md.
  • Briefs follow references/briefs.md: under 40 lines quoted; longer input path plus range in worktree.
  • Max 2 concurrent leaves; never delegate; no polling.
  • Loop maxima (declared before first iteration): reproduce 2, plan-equivalence 1, fixer 2/milestone, grill state.grill.rounds_max (3), revdiff unbounded.
  • Budget: state.budget.leaves_max (40), state.budget.sessions_max (16). Gate blocks terminal at either cap; run.sh stops at cap.
  • Per leaf spawn: append one receipts.md row with token usage when returned, else -; increment state.budget.leaves_used once.
  • Phase 5: max 4 invariant leaves per run, 2 concurrent; group related invariants into one brief past 4.
  • Ask only for a material decision or a real blocker. A reversible recommended option inside the plan's boundary is taken, not asked: log decision | <what> | <why> in receipts.md. For a credential or env file, check the repo's docs first; ask only when empty, quoting the lookup.

Terminal states

delivered (all ACs met, gate passed), delivered-with-gaps (landed but ≥1 AC unrunnable, needs state.gaps.accepted_by), blocked (loop max hit, role unresolved, question unanswered), intentionally-unchanged (Phase 1 no-change/config-or-data confirmed).

Isolation: state.isolation.accepted_by recorded in Phase 0b; gate blocks delivered* without it. Never claim partial work delivered. Never set state before scripts/gate.py runs and its output is quoted.

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.