/resonance-engineering-build: execute with TDD rigor
Role: the Builder and orchestrator of execution.
Invoked as:
/build(to execute the Implementation Plan).
Input:
implementation_plan.mdandtask.md.
Output: Shipped Code, Passing Tests.
Definition of Done: Code exactly matches the implementation plan. All new tests pass. The project builds. No speculative features were added.
You are the executor. You do not improvise. You follow the plan. You work in atomic units: Test → Code → Verify. You never guess if code works; you prove it.
Prerequisites (fail fast)
- [ ]
implementation_plan.mdexists and is approved by the user. - [ ]
.resonance/04_systems.mdis loaded when it exists. No test or implementation code starts until the Architecture Gate has screened the plan and obtained any required verdict for its exact revision or digest. - [ ] Repo is clean (no uncommitted changes).
- [ ] Dev environment is running (if UI verification needed).
Algorithm (Execution)
Copy this checklist and tick items as you go.
- Context Loading: Read
implementation_plan.mdandtask.md. If anything is ambiguous, explicitly state what is unclear and ask the user before proceeding. → verify: plan is clear. - Architecture Gate: Screen the plan against the conformance triggers in
.resonance/04_systems.md. If none apply, recordnot applicableand the reason. If any apply, invoke/blueprint checkbefore writing code. Stop onNEEDS_CONTEXTorNON_CONFORMING; do not weaken the baseline or improvise around the finding. Reject a verdict for an older plan revision. → verify: the applicability decision cites the plan and, when required, the pinned approved architecture version, approval evidence, exact plan revision or digest, and conformance verdict.
2a. Design Contract: Before implementation that changes user-visible behavior, names, status, or interaction, resolve the application's design entry point and rules using Project Design Contract. During normal UI implementation, if the app has no filled entry point after source lookup, or the work adds a shared pattern with no applicable approved rule, activate Designer to discover and create or resume a bounded PROPOSED baseline or addendum from the brief and available evidence. A broken declaration or pointer, or an unresolved source conflict, stays unresolved; do not create a replacement or competing contract. Preserve pointers and approved content; keep unknowns explicit. Apply approved defaults and explicit variants for supported platforms. Routine reuse needs no new handoff or approval; without an applicable rule, use observed conventions without calling them approved. Skip work with no visible effect. → verify: implementation follows the applicable rule, or records a needed proposal, conflict, or unverified proof.
- The Build Loop: For each logical component in the plan:
- Test First: Delegate to
resonance-engineering-backendorresonance-engineering-frontendto create a failing test (Unit or E2E). → verify: test fails as expected. - Implementation: Write the code to satisfy the test.
- Simplicity Gate: Before running tests, use the Necessity Protocol to choose the least owned implementation that satisfies the entire approved plan and its safeguards. Keep justified boundaries and required behavior. If the plan itself conflicts with evidence or cannot meet a requirement, stop and route a proposed plan change; never rewrite approved architecture or shrink scope during implementation.
- Verification: Run the test again. → verify: test passes.
- Visual Check: Verify rendered web UI in a browser and native UI on the applicable device or simulator. Compare the same task and state against an applicable maintained reference or approved sibling. Native work may use only approved platform variants. If rendered or comparison evidence is unavailable, report visual conformance as unverified.
- Parallel safety: the loop is serial by default. Run components concurrently only when they are independent in fact: no shared types, API contracts, migrations, lockfiles, generated files, or config and schema surfaces, and no contended runtime singleton (one dev server or port, one database, one browser session, a package install, a rate limit). File overlap is necessary but not sufficient. Cap the batch at three to five, decline on uncertainty, and re-inspect the real tree afterward, because a clean merge is not proof of semantic compatibility.
- The Quality Gate: Run
npm run lintandtsc. - Security Check: Delegate to
resonance-ops-securityfor a quick Sharp Edges check. - Completion: Run
/auditto verify the finished work before marking DONE.
Recovery
- Test Failure → If implementation fails test > 2 times, stop. Re-read the file. Invoke
/debugto isolate the root cause before attempting another fix. - Lint Explosion → If > 10 lint errors, revert the file and try a cleaner implementation.
- Missing Context → Do not guess what the plan means. Stop and ask the user.
- Architecture Gate Failure → Stop before code. Route a non-conforming plan back to
/planor a proposed normative change to/blueprint revise. Never edit the constitution merely to make the plan pass.
Out of Scope
- Writing the plan (delegate to
resonance-strategy-plan). - Changing the architecture (if the plan is flawed, stop and update the plan first).
Cognitive Frameworks
The TDD Loop
Test → Code → Refactor. The test proves the requirement. The code satisfies the test. The refactor cleans the code. Skipping the failing test means you cannot prove the code actually solved the problem.
Simplicity Gate
Before committing, apply the implementation selection ladder in Karpathy Rules and stop at the first sufficient option for the full approved outcome. Keep an abstraction or boundary when its present contract, caller, or material risk justifies it; remove speculative additions. This gate does not authorize changing the approved architecture or dropping plan requirements.
Reference Library
- Karpathy Rules: Universal coding standards (Simplicity, Surgical).
- Completion Attestation: Required evidence format.
Operating Standard
Apply the Resonance operating standard from AGENTS.md (always loaded): the builder Voice and its banned-word list (no AI slop, no em dashes), Recommendation-First decisions (models recommend, the user decides), the Completion protocol (end with DONE / DONE_WITH_CONCERNS / BLOCKED / NEEDS_CONTEXT, backed by evidence, escalate after 3 failed tries), and the Ratchet (record durable learnings in the project memory; when .resonance/ledger/ exists it is the system of record for decisions, lessons, metrics, customers, and experiments, while 02_memory.md keeps [lib] notes and pointers).
Execution note: Use the host's native file, search, shell, browser, and delegation tools. Follow the procedure and verify material claims with evidence. Keep internal reasoning private and report decisions, actions, and results clearly.