Work (WK)
Intent
Ship one bead end-to-end with proof (≥1 validation signal). Shipping protocol: constrain scope, define "done," require evidence.
Definition of Done (WK)
Done when:
- •Bead criteria met.
- •Formatter/lint-typecheck/build/tests run (or N/A).
- •≥1 validation signal recorded (see "Proof").
- •PR opened (do not merge).
Workflow
0) Preflight (don't skip)
- •Confirm beads repo + explicit
workinvocation; if blocked (missing requirements/no bead), stop.
1) Identify the active bead (source of truth)
- •Anchor on
bd. - •Find the in-progress bead; if none, invoke
$selectand mark it in progress. - •Restate "done" for this bead (1 sentence + acceptance criteria).
2) Clarify until requirements are implementable
- •Ask only judgment calls; everything else is in repo/bead.
- •If ambiguity appears mid-implementation, stop and re-clarify.
3) Audit the working tree (scope containment)
- •Audit early/often; keep bead changes surgical.
4) Do the work (how the work is accomplished)
4.1) Mandatory TRACE mini-pass
Before first incision, run a small $fix pass:
- •Heat map: hotspots + surprises.
- •Failure triage: crash > corruption > logic.
- •Invariant: what must remain true after the change?
- •Footgun scan: any misuse-prone surface?
- •Incidental complexity: flatten/rename/extract only if risk drops.
4.2) Complexity gate (pause and invoke CPS)
If complex (multi-constraint, cross-subsystem, high uncertainty, multiple viable designs), stop and invoke $creative-problem-solver: produce a five-tier portfolio (signals + escape hatches), ask for selection, resume after choice.
4.3) Surgeon loop (execution)
Tight loop:
- •Hypothesis: what change likely satisfies the bead?
- •Smallest incision: smallest change that could be correct.
- •Observable: test/invariant/log.
- •Implement: minimal collateral.
- •Re-check: rerun closest fast signal.
- •Repeat until acceptance criteria pass.
Autonomy gate (borrowed from $fix): proceed without further clarification only when all are true:
- •Local repro (or a tight, credible signal).
- •Invariant stated.
- •Minimal diff.
- •At least one validation signal passes.
Otherwise, clarify before widening scope.
Heuristics by bead type:
- •Bug: reproduce if possible; otherwise add a characterization test or diagnostic signal, then fix.
- •Feature: smallest end-to-end slice (vertical slice > layered scaffolding).
- •Refactor: preserve behavior; add a characterization test/invariant first.
Refactor hygiene (within bead scope):
- •Limit simplification to bead-touched code unless explicitly asked.
- •Cleanup must preserve behavior beyond bead changes.
- •Prefer explicit, readable code; avoid nested ternaries (use if/else/switch).
- •Remove redundant comments; keep clarifying ones.
- •Keep helpful abstractions; don't flatten at the cost of clarity.
5) Validation (all musts)
Run all: Formatter, Lint/typecheck, Build, Tests (unit/integration).
Order: formatter + lint/typecheck + focused tests, then build + full suites. PR is blocked until all categories run.
Entry points: prefer canonical (make, just, task, npm run, cargo, go test, etc.); if multiple, run all or justify the skip.
If a category doesn't exist: record N/A with a 1-line reason and run the nearest substitute.
6) Invoke $close-the-loop (minimum one signal)
$close-the-loop is the forcing function: record ≥1 signal (see "Proof") after changes + validations.
7) Record proof (make results auditable)
Record proof in:
- •PR description (recommended): full command list + outcomes.
- •Bead comment (when feasible): short proof summary + PR link.
"Feasible" = no extra auth friction and no secret leakage. Include: Signals, Decision (if CPS ran), Notes (N/A validations, limits, follow-ups), Simplification (only significant refactors). Signal strength (prefer higher): tests > build > lint/typecheck > formatter > runtime log/manual repro.
8) Open a PR (do not merge)
- •Open a single PR.
- •Do not merge.
- •Do not split into multiple PRs unless explicitly asked.
Principles
- •Source of truth:
bdwins. - •Safety nets: compile/construction-time invariants > focused test > minimal guard/log.
- •Surgeon's principle: smallest correct change.
Failure Paths
- •No in-progress bead: invoke
$select, mark it in progress, proceed. - •Unclear requirements: stop and ask; don't guess.
- •Unrelated diffs: ignore; don't touch or stage; continue. If the task would touch the same lines/hunks, stop and ask.
- •Validation fails: fix and rerun before opening the PR.
- •Bug can't be reproduced: add instrumentation or a characterization test; state limits in proof.
Deliverable
- •PR-ready changes (formatted, linted/typechecked, built, tested).
- •Handoff includes: assumptions, proof (signals), and deliberate non-scope.
Examples (calibration)
Bug bead
- •
bdshows beadX; restate done + acceptance criteria. - •TRACE mini-pass (heat map, failure modes, invariant).
- •Reproduce or characterize.
- •Smallest fix.
- •Fast checks (format + lint/typecheck + focused tests).
- •Slow checks (build + full suites).
- •Record proof (PR body + bead comment w/ link).
- •Open PR; do not merge.
Feature bead
- •
bdshows beadY; restate done + acceptance criteria. - •TRACE mini-pass (heat map, failure modes, invariant).
- •If complex, invoke
$creative-problem-solver; pause for selection. - •Smallest vertical slice users can exercise.
- •Add/extend tests.
- •Fast checks (format + lint/typecheck + focused tests).
- •Slow checks (build + full suites).
- •Record proof (PR body + bead comment w/ link).
- •Open PR; do not merge.
Guardrails
- •Explicit-only; never auto-trigger.
- •Don't split into multiple PRs unless asked.
- •Don't merge.