name: hapo:develop description: "Code execution engine: Reads specs and implements code end-to-end with automatic code review, self-healing, and visual implementation notes." user-invocable: true when_to_use: "Invoke to implement specs and tasks end-to-end after scope is clear." category: utilities keywords: [implementation, specs, build, orchestration] argument-hint: "[feature-name|specs-directory-path] [task-file] [--flash] [--no-notes]" metadata: author: haposoft version: "1.0.0"
Develop — Feature Implementation (Task-Orchestrated Build)
Reads the project specification (hapo:specs) and implements code through a disciplined task loop. In specific-task mode it behaves like a surgical executor. In full-spec mode it behaves like a sequential orchestrator, processing one unblocked task at a time and syncing state after every verified task.
Principles: YAGNI, KISS, DRY | Continuous execution | Smart self-healing
Usage
/hapo:develop <feature name>
/hapo:develop specs/<feature-name>
/hapo:develop <feature name> <specific-task-file.md>
/hapo:develop <feature name> --flash
/hapo:develop <feature name> <specific-task-file.md> --flash
/hapo:develop <feature name> --no-notes
Execution Modes
1. Specific-Task Mode
Triggered by /hapo:develop <feature> <task-file>.
- Load exactly one task file.
- Implement only that task packet.
- STOP immediately after the task is verified and synchronized, or flash-synchronized when
--flashis active. - Never auto-chain into the next task.
2. Full-Spec Mode
Triggered by /hapo:develop <feature> or /hapo:develop specs/<feature>.
- Build a queue from
spec.json.task_registry. - Select the next
pending+ unblocked task only. - Run the full implementation cycle for that single task.
- Sync state.
- Recompute the queue and continue.
- STOP the overall run on the first blocked task, unresolved gate failure, or missing proof.
- In
--flashmode, missing full test proof does not stop the loop; recordFLASH_UNVERIFIEDand continue to the next unblocked task.
3. Flash Mode
Triggered by adding --flash to either specific-task or full-spec mode.
- Optimize for fast implementation, not full verification.
- Still load the approved spec, scout every task, obey scope, and implement real code.
- Skip dedicated test suites, E2E/browser/manual QA loops, full task evidence execution, and code-review retry loops.
- Run only cheap preflight checks when available and fast: syntax, typecheck, or build commands that do not require installing dependencies or starting external services.
- Never weaken, delete, or rewrite tests to avoid running them.
- Sync completed implementation with an explicit
FLASH_UNVERIFIEDreceipt; do not claim production-ready quality. - Final output MUST recommend
/hapo:test <feature>before merge, release, or publish.
4. Implementation Notes
Enabled by default for all develop modes. Disable only with --no-notes.
- Maintain
specs/<feature-name>/implementation-notes.html. - Use
references/implementation-notes-template.htmlwhen the file does not exist. - Keep the file self-contained: inline CSS, no JS, no external fonts, no network assets.
- Style notes as readable Claude Code-like blocks: compact cards, left accent bars, category badges, monospace file paths, and a task timeline.
- Record decisions and caveats while implementing, not only at the end.
- Do not use notes to justify scope changes that alter the approved contract. If the contract changes, stop and route back to
/hapo:specs update.
Anti-Rationalization Protocol
| Thought (Excuse) | Reality (Rule) |
|---|---|
| "No need to scout first" | Coding without knowing the architecture is blind. ALWAYS call the inspector agent to scan files. |
| "Review process is too tedious, let me just finish it myself" | The system needs an audit trail through agents. ALWAYS delegate via Task tool. |
Absolute Workflow
flowchart TD
A["/hapo:develop \u003cfeature\u003e"] --> B[Step 1: Load Spec]
B -->|Missing| Z[Stop: Run /hapo:specs]
B -->|Ready| C[Step 2: Task-Aware Scout (inspector)]
C --> D[Step 3: Implement Code (god-developer)]
D --> E{Flash Mode?}
E -->|No| Q[Step 4: Quality Gate: Test + Spec Review + Code Review + Evidence]
E -->|Yes| R[Step 4F: Flash Gate: Minimal Preflight + Scope Sanity]
Q -->|Fail| D
Q -->|Pass| F[Step 5: State Sync + Incremental Docs Sync]
R -->|Syntax/compile fail| D
R -->|Flash closeout| F
F --> H{More tasks?}
H -->|Yes| B
H -->|No| G[Final Integration Scout + Report Completion]
Step 1: Initialize & Load Spec
- Identify input: Open
specs/<feature-name>/spec.json. - Check
ready_for_implementationstatus. If not ready, notify user. - Load
task_registryand verify it matches the requested task file(s). If registry is missing or stale, route to/hapo:sync audit <feature>before coding. - Unless
--no-notesis present, initialize or updatespecs/<feature-name>/implementation-notes.html:- If missing, create it from
references/implementation-notes-template.html. - Replace template placeholders for feature name, spec path, creation timestamp, and current mode.
- If present, preserve existing note cards and update the summary/timeline/status fields.
- If missing, create it from
- Task Scoping (CRITICAL):
- If the user specifies a particular task file (e.g.,
task-R0-02...md), load ONLY that specific file into working memory. - If no specific task is mentioned, DO NOT load all tasks into working memory. Resolve the next single unblocked
pendingtask fromtask_registryand load only that task packet.
- If the user specifies a particular task file (e.g.,
- Task Packet Extraction (MANDATORY): Before coding, extract from the active task file(s):
- Objective + Constraints
- Related Files
- Completion Criteria
- Evidence (or
Task Test Plan & Verification Evidence/ legacyVerification & Evidence) - Exact executable verification commands named in the task
- Requirement IDs referenced by the task
- Named technologies, frameworks, protocols, and data stores that the task/spec explicitly requires
- Relevant
Canonical Contracts & Invariantsfromdesign.md
- If the task file is missing actionable completion or verification detail, STOP and route back to spec correction. Do not guess.
- Before coding, set the active task(s) to
in_progressin both markdown andspec.json.task_registry, or route through/hapo:syncif the runtime expects the sync protocol.
Step 2: Scout (Codebase Inspection)
- Mandatory per task: Call agent
Agent(subagent_type="inspector", ...)before implementing EVERY active task. This is task-aware scouting, not a one-time global scan. - The inspector prompt MUST include:
- Active task file path and extracted task packet
- Requirement IDs and
scope_lock - Relevant
design.mdcontracts/invariants - Prior completed task outputs from
spec.json.task_registry - Related Files from the active task
- Inspector MUST report:
- Real runtime entrypoints/callers affected by the task (
App.tsx, routes, CLI command, worker registration, manifest, API consumer, etc.) - Existing integration points and adjacent code patterns to follow
- Prior task outputs this task must consume or preserve
- Blast-radius touchpoints and dependent files that can regress
- Reachability risks: orphan components, unmounted UI, unregistered routes, uncalled services/loaders, unused providers, disconnected reducers/actions
- Exact files likely safe to modify and any files outside
Related Filesthat require a justified scope escape
- Real runtime entrypoints/callers affected by the task (
- If the inspector cannot identify the entrypoint/caller for a runtime-facing task, STOP and route back to spec correction or ask the user. Do not guess.
Step 3: Implement Code
- Act as
god-developerOR directly write code, executing tasks specified in the loaded Markdown file(s) sequentially. - Important: You may create and modify files directly, but must faithfully follow the design from the Spec.
- You MUST use the Step 2 scout report as implementation context. If code reality contradicts the task packet, stop and reconcile the spec before coding.
- Unless
--no-notesis present, append a note card toimplementation-notes.htmlwhenever any of these occurs:decision: a necessary implementation choice not specified by the specspec-gap: missing or ambiguous spec detail discovered during implementationcodebase-reality: existing code requires a different integration path than the task impliedtradeoff: a conscious simplicity, performance, UX, or maintainability tradeoffscope-escape: a file or behavior outside Related Files must be touched for reachability/compile/integrationrisk: known residual risk, edge case, or deferred follow-upverification: command result, skipped check, manual proof, or evidence caveat
- Progress tracking: Temporarily change
[ ]to[/]in Spec files while coding is in progress. Do NOT mark[x]before Step 4 passes. - Task Boundary Protocol (CRITICAL):
- Default editable scope is
Related Filesfrom the task packet. - You may additionally touch direct test files plus minimal support files required to make the current task executable (shared types, exports, config glue, generated migration wiring).
- If you must edit a file outside this scope, explicitly treat it as a
scope escapeand justify why it is required for the current task. - If the out-of-scope change would deliver functionality clearly assigned to a later task, STOP instead of implementing it early.
- Default editable scope is
- Hard Stop Protocol: If you were asked to implement a specific task file, you MUST STOP completely after that task is verified. DO NOT auto-chain or jump to "Next Task" simply because you see it in the spec. Wait for the user's next command.
- Full-Spec Loop Protocol: If you were asked to implement the whole feature, you MUST still work one task at a time. Finish Step 4 and Step 5 for the current task before selecting the next unblocked task from
task_registry. - Test Integrity Protocol: You MUST NOT delete, replace, or reduce the scope of existing test cases to make tests pass. If a test fails, you must fix the implementation code or fix the test setup/mock, NOT remove the assertion. Reducing test count or weakening assertions (e.g., removing
toHaveBeenCalledWithand replacing withtoEqual(expect.any(...))) is a Critical violation. - Contract Integrity Protocol: If implementation appears to require changing auth/session, transport, persistence, entrypoint wiring, or generated artifact behavior beyond what
design.mdstates, STOP and route back to spec correction instead of inventing a new contract in code. - Named Technology Rule: If the task/spec explicitly requires a named dependency or runtime choice (for example Better Auth, Hono, Next.js proxy routes, Redis, Drizzle, S3), you MUST implement that choice or stop. Do not swap it for a custom/in-memory/local substitute and still call the task complete.
- Cross-Service Reality Rule: If a task spans multiple processes or runtimes (web ↔ API, worker ↔ DB, extension ↔ backend), you MUST prove the integration uses shared real state or a real contract boundary. Process-local placeholders on both sides do not count as completion.
- Placeholder Completion Rule: You MAY scaffold future files only when the active task truly needs them to compile, but placeholder route handlers, in-memory stores, or fake adapters MUST NOT be used as evidence that the current task's behavior works end-to-end.
- Reachability Rule: Runtime-facing work is incomplete until it is reachable from the real entrypoint/caller named in the task evidence or Step 2 scout report. Creating a component/service/route/provider/reducer without importing, mounting, registering, or invoking it is not implementation.
- Prior Output Consumption Rule: If this task depends on previous task outputs, verify those outputs are consumed through real code paths. If a prior output is unused and this task is responsible for wiring it, wire it now; if a later task owns the wiring, keep the current task pending unless that deferral is named in the active task evidence.
Step 4: Self-Healing (Quality Gate Auto-Fix)
The moment you finish coding, DO NOT proceed further. Switch to references/quality-gate.md and run the automatic review loop.
Mantra: Scope/spec compliance first, code quality second. All feedback from code-auditor must be addressed thoroughly: Score >= 9.5 & Zero Critical issues.
If --flash is active, use Step 4F: Flash Gate instead of the full automatic review loop.
- Passing Step 4 requires ALL of the following:
- Automated verification passes, including preflight compile/typecheck/build health and every exact command named in the task's
Evidencesection (orTask Test Plan & Verification Evidence/ legacyVerification & Evidence) - Spec compliance review passes: every scoped requirement and active task criterion is implemented, with no extras and no omissions
- Code quality review passes
- Task evidence passes (artifacts/runtime surfaces/reachability/negative-path checks from the task file are proven)
- Automated verification passes, including preflight compile/typecheck/build health and every exact command named in the task's
PRECHECK_FAILoutranksNO_TESTS. If compile/typecheck/build fails, the task is FAIL even when no test suite exists yet.NO_TESTSis NOT equivalent to PASS. If the task explicitly requires a test command or automated test proof,NO_TESTSis a FAIL or BLOCKED outcome until the requirement is satisfied or the spec is corrected.- If build/test passes but task evidence is missing, the task is still FAIL.
- If runtime-facing work is orphaned, unmounted, unregistered, uncalled, or unreachable from the declared entrypoint/caller, the task is still FAIL.
- If the implementation silently replaced a named contract choice or relies on cross-service process-local stand-ins, the task is still FAIL.
- Only escalate to the user after 3 consecutive failed review rounds.
Step 4F: Flash Gate (--flash only)
Flash mode is an explicit speed trade-off requested by the user.
- Skip:
- dedicated test commands from task Evidence
- full test-runner delegation
- E2E/browser/manual QA loops
- full code-auditor retry loop
- screenshot, accessibility, performance, and visual verification unless the active task is purely visual and can be checked cheaply
- Still perform:
- task-aware scout from Step 2
- active task scope sanity check against Completion Criteria
- reachability sanity check for runtime-facing files: imported, mounted, registered, routed, or invoked where applicable
- cheap compile/syntax/typecheck/build command when it is already available and expected to run quickly
- If the cheap preflight fails, return to Step 3 and fix before syncing.
- If no cheap preflight exists or it would require slow setup/external services, record
Preflight: skipped in --flash mode. - Flash output MUST log:
⚡ Step 4 Flash Gate: tests skipped by --flash; preflight=<pass|skipped>; evidence=FLASH_UNVERIFIED. - Flash output MUST NOT say
Test PASS,Evidence PASS,Auto-Approved, orproduction-ready.
Step 5: State Sync + Task-Level Docs Sync
- Only after Step 4 passes may you mark task checkboxes completed and sync
spec.jsonprogress/timestamps/task_registry. - In
--flashmode, Step 4F may sync the task only as a fast implementation closeout with an explicitFLASH_UNVERIFIEDreceipt. - If verification is partial or blocked by environment, keep the task in
pendingorin_progressand record the blocker instead of pretending completion. - A completed task MUST leave behind:
- markdown
**Status:** done spec.json.task_registry[path].status = "done"completed_at+last_updated_at- synchronized top-level
updated_at - a human-readable verification receipt inside the task's
Evidencesection showing which commands ran, their outcomes, and what proof was observed
- markdown
- In
--flashmode, the receipt MUST includeMode: --flash,Tests: skipped by user request,Evidence: FLASH_UNVERIFIED, andNext verification: /hapo:test <feature>. - Verification receipts with
PRECHECK_FAIL,FAIL,UNVERIFIED, or an explicit note that the implementation intentionally simplified a named contract MUST NOT be synchronized asdone. - Exception:
FLASH_UNVERIFIEDis allowed only when--flashis explicitly present. It records fast implementation completion, not full verification completion. - Unless
--no-notesis present, updateimplementation-notes.htmlbefore reporting the task:- Mark the task block as
done,blocked, orflash_unverified. - Add a
verificationnote with exact commands run orTests skipped by --flash. - If no implementation note was needed for the task, add a compact
decisionnote:No spec gaps, tradeoffs, scope escapes, or deferred risks recorded for this task. - Add
Next verification: /hapo:test <feature>when any evidence is skipped, partial, orFLASH_UNVERIFIED.
- Mark the task block as
- After syncing the active task, run a Task Closeout Docs Checkpoint
- Task Closeout Docs Checkpoint:
- Evaluate
Docs impact: none | minor | majorbased on real behavior changes from the just-completed task - If
none: record that explicitly in the completion report and stop - If
minorormajor: triggerdocs-keeperto surgically update affected existing docs under./docs - Default to lightweight docs sync: update only the docs touched by this task and its verified behavior; do NOT run
repomixunlessdocs-keepertruly cannot verify the required architecture/context from the code, spec, and current docs
- Evaluate
- CWD Protocol (CRITICAL): When spawning
docs-keeper, you MUST ensure the agent's Current Working Directory (CWD context) is explicitly set to the Workspace Root, NOT the inner package directory you were just coding in. Otherwise,docs-keeperwill search for the rootdocs/folder in the wrong place and crash. - Task-level docs sync happens after every verified completed task, but actual edits still depend on
Docs impact. - In Specific-Task Mode, STOP after sync and report the result.
- In Full-Spec Mode, only after sync may you re-read
task_registry, pick the next unblocked pending task, and repeat from Step 1 for that task. - When no pending tasks remain, run a Final Integration Scout before reporting completion:
- Trace runtime entrypoints from
main/route/CLI/worker/manifest/API consumer through the scoped feature surfaces. - Compare reachable behavior against
scope_lock,requirements.md,design.md, and all task Completion Criteria. - FAIL completion if any scoped surface is missing, any created runtime-facing artifact is orphaned, or spec progress/registry says done while evidence is missing.
- Only then set top-level progress to
code_done/ next phase.
- Trace runtime entrypoints from
Attached References
references/quality-gate.md- Rules for the Code Review loop.references/subagent-patterns.md- Standard prompts for calling subagents.references/implementation-notes-template.html- Self-contained visual implementation notes template.