dhnt kbAll pages

runbook · candidate

Lift an existing app or repo into shapeware: write its shapeware spec (reverse: source to spec)

WHEN you lift an existing app, tool or repository into shapeware (convert it to a shapeware folder, make a repo shapeable, reverse SDLC, source to spec) so agents can rebuild, repair or extend it from the spec: choose the surface, SKILL.md and the dag.md lifecycle with effects and bands, features with acceptance lines, a contract with rules first and assertions from real runs, rules that define their sets, examples per format, known issues and tbd features, then compile with conform spec check, certify with cert and mutate, and prove it by a rebuild

Verified 2026-11-26
2026-11-26: examples/desk/form lifted this way (spec v2.1); its reference certifies 17/17 with 117/117 mutants; agents of four vendors rebuilt it from the spec, 3 of 3 runs each at the start tier. Renamed to lift 2026-11-27 (operator). · Bashy revision 536fc71bf21457eaa21ab4bb35cd574788d12f97

Lift is the official word for this runbook’s job: lifting an app turns its source into a shapeware spec so it can be shaped (formerly shapeware-spec-from-app).

Goal: lift an existing app or repository, making it shapeable: give it a shapeware spec that is sound enough for another agent to rebuild, repair or extend the app from the spec alone. Format: the shapeware spec (a superset of an Agent Skill folder; only SKILL.md is required, missing parts take defaults). Worked example, lifted this way and then rebuilt from its spec by agents of four vendors: bashy examples/desk/form. Related: [[shapeware-spec-from-plan]] when there are only instructions, [[shapeware-source-from-spec]] for the builder’s side, [[shapeware-operate-from-dag]] to install and run a built folder, a rebuild test (a builder that has not seen the source rebuilds the app and the judge decides) to test the result.

Tools and format: the judge is bashy conform (spec check, run, cert, mutate). Where a step says conform ..., type bashy conform ...; on a machine without bashy use the standalone conform binary (github.com/dhnt/conform). The format on one page is examples/desk/form/references/shapeware.md in the bashy source, and the folder around it is the worked example, with a full CONTRACT.md, features.yaml and dag.md. bashy src fetch bashy puts the source under ${BASHY_HOME:-$HOME/.bashy}/src/bashy.

Before you start

Steps

  1. SKILL.md at the root: the type line, the standard run block, and a short behaviour summary that points at the contract. For a surface of a larger repository (shapeware/<surface>/), use the lifted-surface variant of the run block (the format §4.3a): the “what it is” line naming the surface, the repository and the certified commit (metadata.implementation, metadata.reference-commit), and Build changes the implementation in a work copy of the repository, never this folder. Put how this particular build is operated (its scripts, server, workarounds) in a separate section marked as not required of other implementations.
  2. dag.md, the lifecycle: the five steps source, build, test, install, run, plus serve and stop for an app with a page or a server. For a lifted surface, source is the two-way step of §4.3a: the containing repository when the folder sits in it, else a clone at the certified commit, recorded in .shapeware/impl; the other steps read ${IMPL:-$(cat .shapeware/impl)}. Each step is exact and non-interactive, with an Effects: line and a Band: line (none where no model is needed, unmeasured until a drill measures it, L1 to L5 once measured). A build step calls the toolchain itself (go build -tags ... -o ... ./cmd/...), never a repository build script: such a script carries its own host preflights (outpost’s scripts/build.sh demands GO_CACHE_VOLUME_MAX_BYTES under WSL and fails without it) and hides what the build needs. The lifecycle’s effect check only warns about a command it cannot classify; it does not stop it. A certified folder also carries the standard gate targets check, cert, mutate and alone (the format §5b), so every later run is bashy dag -f dag.md <target>, not a hand-built command.
  3. features.yaml: one feature per user-visible capability: id, intent, effort (Fibonacci points), status (verified only if you ran it; else tbd), critical: true for anything security-relevant, and acceptance lines of the form command => expected.
  4. CONTRACT.md, rules first:
    • how assertions are judged (placeholders, open marker, what plain text is checked);
    • the output envelope and always-present keys;
    • every flag that works on several commands, defined in words;
    • open versus closed outputs, with the reason where closed protects content;
    • errors: the stream, the prefix, the exit code;
    • input definitions: every format, every allowed value. A rule that names a set defines the set. Never “names such as a, b, …”: give the decision rule, then a boundary pair, one case that must be refused and one near miss that must be accepted.
  5. CONTRACT.md, assertions from real runs. Run each command on the reference and paste what it prints. Replace run-specific values with placeholders ({ID}, {PORT}, {TIME}, {KEY}). The judged output must be the command’s own output: do not redirect it to a file and judge a cat, jq or test pipeline instead, or mutants of that command survive. Put a cross-step comparison in its own assertion that reads what an earlier step saved. A probe that gives the reference a throwaway HOME must also set XDG_CONFIG_HOME, XDG_CACHE_HOME, XDG_STATE_HOME and XDG_DATA_HOME inside it: --fresh-home sets them, and a program that prefers them never reads the HOME the probe prepared. One assertion per behaviour, in dependency order. Give the first create step a fixed id where the app allows it, so one mismatch does not unbind every later step.
  6. UI as checkable rules: one control per field, a programmatic label, how required fields are marked, allowed control kinds, button names; a ui assertion on the page inventory; one page interaction (fill by label, submit, read back through the CLI).
  7. examples/: one worked file per input format, each used by an assertion, covering the syntax actually accepted.
  8. Known issues and unbuilt features, honestly: a real bug is a known-issue entry (status, the feature, symptom -> action, retry bound, expiry); something planned and not built is a tbd feature with acceptance lines.
  9. Compile the spec: conform spec check DIR until it reports nothing. It checks features without acceptance lines, example files nothing uses, flags never defined, outputs with no open/closed rule, rules given by example, and the lifecycle steps with their effects and bands.
  10. Certify the reference on the test host: conform cert (3 runs, every assertion passes, none noisy) and conform mutate (every mutant killed). A surviving mutant is a missing assertion: add it and repeat. A contract that asserts only refusals (every command against a missing app) certifies and kills every mutant while proving nothing the features claim: a reviewer reads the assertions, not only the cert and mutate summary, and a feature is verified only when an assertion exercises its success path. Also run the app’s own acceptance checks. Name the shimmed command with --bin: conform otherwise takes the first word of each assertion, so a contract that drives the app through a script (python3 probe.py ...) certifies the wrong program. Size mutation before starting it (mutants × one contract run ÷ shards) and record the estimate. Run long jobs in the foreground of a session that outlives them: a job left running on a remote host dies with its login session, and a worker’s background jobs die when its run reaches the runtime cap.
  11. State the venue a rebuilt app must run on: OS, interpreter and toolchain versions, network, what is absent.
  12. Prove it reproduces. Have a builder that has not seen the source rebuild the app from the spec (the rebuild test). Classify every failure. A failure caused by the spec goes back to step 4; expect one or two rounds.
  13. For a lifted surface, prove the folder stands alone. Copy only shapeware/<surface>/ somewhere outside any checkout, give it to an agent that has not seen the repository, and require a passing Check from the folder’s own text and lifecycle.
  14. Record what was measured: the lowest band that rebuilt it, per lifecycle step where measured, with the bindings and the date.

What the first conversion taught

What the second conversion taught (a service app; the spec written by an agent, the hidden cases by another vendor’s agent)

Sizing

One small app (about 2,000 to 3,000 lines, one service, one page): one working session for the spec and its certification, plus a rebuild round. Certification with mutants took about 35 minutes of test-host time per pass in the worked example. A product surface (Sprint 737): 20 to 80 minutes of agent time; the largest, 559 mutants at about 75 seconds per contract run, took about 90 minutes of test-host time over 8 shards.