Skip to main content

Software Factory

@swamp/software-factoryv2026.06.16.1· 1d agoMODELSREPORTSSKILLS
01README

A fully generic, model-driven state machine for guiding agents through a software development lifecycle. The entire machine — stages, transitions, gates, required artifacts, review skills, agent commands, system prompts — lives in the model definition's globalArguments as data. The engine ships no lifecycle concepts: adversarial review, comprehensive testing, release, and UAT stages are expressible (see examples/), never assumed.

How it works

An instance is a factory serving many work items concurrently — every method takes workItem, and all run data is namespaced per work item:

swamp model create @swamp/software-factory my-factory
swamp model edit my-factory      # fill globalArguments: stages
swamp model method run my-factory start --input workItem=ISSUE-42

The driver loop is the same for every factory: status returns a self-describing packet (current stage, work spec with run-data bindings resolved, per-gate transition readiness, context manifest); the driver does the stage's work, records products, and advances. Gates are hard enforcement — evaluated in pre-flight checks and re-validated inside advance.

Methods

  • start — validate the graph and start a work item at the initial stage (refuses to restart; resume with status)
  • status — the driver's entrypoint: what a work item requires right now, or a factory-wide overview of all runs
  • record_artifact / record_evidence — versioned, schema-validated work products; opaque external facts
  • resolve_findings — resolution notes on kind: findings artifacts
  • approve / reject — human gate decisions, cycle-scoped
  • advance — move along a gated transition
  • summary — full implementation history of a work item as markdown, rendered statically from the run data (no LLM); also persisted via the @swamp/software-factory/work-item-summary report
  • validate / describe — definition lint; Mermaid + tables
  • reset — destructive restart, requires confirm=reset

Gates

artifact-exists, artifact-fresh (subject-version + recordedThisCycle), findings-clear, human-approval, evidence-recorded (cycle-scoped, field matching), cooldown, max-cycles (routing), cel (CEL predicates over run data), workflow-succeeded (verified against swamp's own workflow run records, not driver attestation).

Every stage carries maxCycles (default 5): entries past the limit park the run for an explicit human cycle-override approval.

Run data

All resources are versioned, immutable, and namespaced per work item: state-<workItem>, artifact-<workItem>-<name>, evidence-<workItem>-<name>, approval-<workItem>-<gateId>, and an append-only journal-<workItem>.

02Models1
@swamp/software-factoryv2026.06.16.1software_factory.ts
fn start()
Validate the definition and start a run for a work item at the initial stage. Fails if that work item already has a run (resume with 'status').
fn reset(confirm: string)
Destroy a work item's run progress and re-enter the initial stage. Requires confirm=reset.
ArgumentTypeDescription
confirmstringMust be the literal string 'reset'
fn record_artifact(name: string, payload: union, note?: string)
Record (or re-record) an artifact declared on the work item's current stage. Payload is validated against the declared schema.
ArgumentTypeDescription
namestringArtifact name declared on the current stage
payloadunionJSON object payload (or a JSON string)
note?string
fn record_evidence(name: string, payload: union)
Record opaque external evidence declared on the work item's current stage (PR URL, CI outcome, release link).
ArgumentTypeDescription
namestringEvidence name declared on the current stage
payloadunionJSON object payload (or a JSON string)
fn resolve_findings(artifact: string, resolutions: array)
Mark findings on a kind: findings artifact as resolved, with notes.
ArgumentTypeDescription
artifactstring
resolutionsarray
fn approve(gateId: string, actor: string, note?: string)
Record a human approval for a human-approval gate or a cycle-override. Only call on explicit human instruction.
ArgumentTypeDescription
gateIdstring
actorstringWho approved (a human identity)
note?string
fn reject(gateId: string, actor: string, note: string)
Record a human rejection for a human-approval gate, with a reason.
ArgumentTypeDescription
gateIdstring
actorstring
notestringWhy this was rejected
fn advance(transition: string)
Move a work item along a named transition. Gates are evaluated in pre-flight checks and re-validated here.
ArgumentTypeDescription
transitionstring
fn status()
What is required right now for a work item — or, without workItem, an overview of every run on this factory.
fn summary()
Render the full implementation history of a work item — every stage visit, artifact version, finding, approval, and transition — as a markdown report built statically from the recorded run data.
fn validate()
Lint the definition: meta-schema + graph rules. Fails when errors exist.
fn describe()
Render the state machine (Mermaid) plus stage/transition tables.

Resources

state(infinite)— Per-work-item stage, cycle counts, and run status (instances: state-<workItem>)
artifact(infinite)— Versioned, schema-validated data products (instances: artifact-<workItem>-<name>)
evidence(infinite)— Opaque external facts recorded by the driver (instances: evidence-<workItem>-<name>)
approval(infinite)— Human gate decisions, cycle-scoped (instances: approval-<workItem>-<gateId>)
journal(infinite)— Append-only audit trail per work item (instances: journal-<workItem>)
03Reports1
@swamp/software-factory/work-item-summarymethod
work_item_summary_report.ts

Linear implementation history of a factory work item, rendered statically from its recorded run data

software-factory
04Skills1
software-factory6 files
05Stats
A
100 / 100
Downloads
2
Archive size
94.8 KB
Verified by Swamp
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository2/2earned
06Platforms
07Labels