Files
ss-tools/.opencode/command/speckit.implement.md
busya d874a4dca6 feat(speckit): workflow architecture upgrades + rework 038 spec per new flow
Add prototype/openapi/validate/resume commands, wire edge-failure matrix into UX,
enforce traceability + validation gates, mandate C4/C5 belief-runtime verification.
Rework 038-dashboard-scenario-model artifacts: applicability, structured edge cases,
24-class UX state matrix, interactive HTML prototype, standardized OpenAPI 3.1 (7 ops),
full RTM with coverage gate, 56-task backlog, and PASS validation report.
2026-07-31 11:25:43 +03:00

105 lines
6.5 KiB
Markdown

---
description: Execute the implementation plan by processing the active tasks.md for the superset-tools repository (Python backend + Svelte frontend).
handoffs:
- label: Audit & Verify (Tester)
agent: qa-tester
prompt: Perform semantic audit, executable verification, and contract checks for the completed task batch.
send: true
- label: Orchestration Control
agent: swarm-master
prompt: Review tester feedback and coordinate next steps.
send: true
---
## User Input
```text
$ARGUMENTS
```
You **MUST** consider the user input before proceeding (if not empty).
## Outline
1. **Preflight Gate — `/speckit.validate` must PASS and be current**: Before any implementation work, run `.specify/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks` and locate `FEATURE_DIR/validation.md`. Abort if it does not exist, has status `BLOCKED`, or is older than any validated input (`spec.md`, `plan.md`, `tasks.md`, `traceability.md`, `contracts/modules.md`, `contracts/openapi.yaml`, or applicable UX/prototype artifacts). Report: "Validation gate missing, blocked, or stale. Run `/speckit.validate` and resolve all blocking findings before `/speckit.implement`." Proceed only when the report says `PASS` and records fingerprints or timestamps matching the current artifacts.
2. If `checklists/` exists, evaluate checklist completion status before implementation proceeds.
3. Load implementation context from:
- `tasks.md`
- `plan.md`
- `spec.md`
- `ux_reference.md`
- `validation.md` — preflight gate report (must show PASS)
- `contracts/modules.md` when present
- `contracts/openapi.yaml` when present
- `research.md`, `data-model.md`, `quickstart.md` when present
- `traceability.md` — for story → task → test mapping
- `.specify/memory/constitution.md`
- `README.md`
- relevant `docs/adr/*.md`
4. Parse tasks by phase, dependencies, story ownership, and guardrails.
5. Execute implementation phase-by-phase with strict semantic and verification discipline.
## Repository Reality Rules
- Source paths: `backend/src/**/*.py` and `frontend/src/**/*.svelte`.
- Active feature docs always live under `specs/<feature>/...` and are discovered via the `.specify/scripts/bash/*` helpers.
- Default verification stack (all timeout-protected via root Makefile):
- `make test-unit` — backend unit tests (SQLite, <120s)
- `make test-frontend` frontend vitest tests
- `make lint` ruff + eslint
- `cd frontend && npm run build` production build check
- `make coverage` coverage reports (optional, run after tests pass)
- `make test-related F=path/to/changed_file.py` smart selection for narrow scopes
- Do not fall back to Rust `cargo`/`src/server/` conventions this is a Python/Svelte project.
## Semantic Execution Rules
- Preserve and extend canonical anchor regions.
- Match contract density to effective complexity.
- Keep accepted-path and rejected-path memory intact.
- Do not silently restore an ADR- or contract-rejected branch.
- For C4/C5 Python orchestration flows, account for the belief runtime (JSON structured logging via `reason()`, `reflect()`, `explore()`).
- For C4/C5 Svelte components, account for belief runtime (console markers `[ComponentID][MARKER]`).
- Treat pseudo-semantic markup as invalid.
### C4/C5 Belief Runtime Verification (MANDATORY)
After implementing any C4 or C5 contract, run BOTH static marker checks AND Axiom belief runtime audit:
1. **Static marker check** (per-file):
- Every C4/C5 `#region` contract MUST have `@RATIONALE` and `@REJECTED` tags. Missing tags **BLOCKING** do not proceed.
- For Python C4/C5 functions: verify `reason("...")` is called before mutation, `reflect("...")` is called after mutation, and `belief_scope(anchor_id)` context manager wraps stateful operations.
- For Svelte C4/C5 components: verify `[ComponentID][REASON]`, `[ComponentID][REFLECT]` console markers appear before and after state transitions respectively.
2. **Axiom belief runtime audit** (per phase):
- Invoke `axiom_audit({operation="audit_belief_runtime", workspace_path="/root/ss-tools", selection_mode="all"})` after implementing C4/C5 contracts.
- Invoke `axiom_audit({operation="audit_belief_protocol", workspace_path="/root/ss-tools", selection_mode="all"})` for decision-memory completeness.
- `audit_belief_runtime`: detects C4/C5 contracts that lack REASON/REFLECT/EXPLORE runtime markers.
- `audit_belief_protocol`: detects C4/C5 contracts missing `@RATIONALE`/`@REJECTED` decision memory.
- If either audit returns findings for contracts touched in the current phase **BLOCKING** reject missing instrumentation. Do NOT silently lower complexity to C3 to bypass.
- Run these audits BEFORE marking C4/C5 tasks complete.
3. **Rejection rule**: If a contract is structured at C4/C5 complexity but lacks runtime belief markers, it is incomplete. Do not mark the task complete. Add the missing instrumentation. Never silently downgrade complexity the complexity tier describes what the contract IS, not what is convenient to implement.
4. **Test verification**: Tests for C4/C5 contracts MUST assert that belief markers are emitted. For Python: mock the logger and verify `reason()`, `reflect()` calls. For Svelte: spy on `console.debug` and verify marker format `[ComponentID][MARKER]`.
## Progress and Acceptance
- Preflight validation gate (`/speckit.validate`) must have PASS status before any implementation begins.
- Mark tasks complete only after local verification succeeds AND (for C4/C5) belief runtime audit passes.
- Handoff to the tester must include touched files, declared complexity, contract expectations, ADR guardrails, belief runtime audit results, and executed verifiers.
- Final acceptance requires explicit evidence that verification was executed.
- `.kilo/plans/*` may exist as internal assistant scratch context, but it is not part of the speckit feature output surface and must not replace `specs/<feature>/...` artifacts.
## Completion Gate
No task batch is complete if any of the following remain in the touched scope:
- broken or unclosed anchors
- missing complexity-required metadata
- unresolved critical contract gaps
- rejected-path regression
- required verification not executed
- **C4/C5 contracts lacking `@RATIONALE`/`@REJECTED` tags (belief protocol audit must PASS)**
- **C4/C5 contracts lacking REASON/REFLECT/EXPLORE runtime markers (belief runtime audit must PASS)**
- **Silent complexity downgrade to bypass instrumentation requirements**