Skip to content
ƒtsforgev0.52.0
19

Spec format

3 min read

Specs are markdown files that break work into ordered steps. Each step has an accept: command that must pass before the next step runs.

Normal users drive tsforge interactively with tsforge. Specs are for benchmark and regression scripts (bun run eval:spec, bun run eval:sweep). See Spec runner.

---
id: hello
title: Hello sum
verify: bun test
mode: scratch
---
## Acceptance criteria
A1. sum adds two numbers correctly.
## Tasks
1. [logic] implement sum
accept: bun test sum.test.ts
files: sum.ts
context: sum.test.ts
fix: bun eslint --fix sum.ts
KeyRequiredMeaning
idyesstable spec identifier
titleyeshuman title
verifyyeswhole-spec gate after all tasks green
modenoscratch (default) or existing
ModeBehavior
scratchharness deletes editable files to start RED; model regenerates
existingproject kept; RED from failing tests or stated goal; edits in place

Prose under ## Acceptance criteria is attached to every task as intent. The model works from stated goals instead of reverse-engineering from test calls alone.

Numbered list under ## Tasks. Each task supports indented fields:

FieldMeaning
accept:shell command that must exit 0 to close the chunk
files:editable scope (comma-separated globs); edits outside are rejected
context:read-only files shown for context (e.g. tests)
fix:optional auto-fix before re-validation (e.g. eslint --fix)

Task numbers become stable ids (1, 2, …).

Specs are consumed by the loop’s runSpec(): used in eval scripts and benchmarks.

Terminal window
# Example: eval script against a seed spec
bun run eval:spec
# Multi-seed sweep (benchmark harness)
TSFORGE_SEED=math bun run eval:sweep

Benchmark seeds ship as <seed>.spec.md under evals/corpus/ (e.g. evals/corpus/math/, evals/corpus/auth/); the harness copies a seed into a fresh run directory under evals/ for each run. See Spec runner and A/B testing.

ScriptRole
gen-tests.tsgenerate test suite from an untested spec
eval-spec.tsrun one spec against the model
sweep.tscartesian feature-variant sweeps

Spec runner · When the gate fails