Pipeline stages
The canonical stage → actor mapping, generated fromtools/eos-spec/src/lib/pipeline-map.ts:
Workflow Diagram
Linear sequence:ThePost-completion archive step (optional but recommended for done specs):║boundary marks wherespec-pipelinestops. Implementation (via thesuperpowers:executing-plansskill) is a separate step initiated by the user.
- Run
eos-spec archive --spec {CORE-##}(or bulk with--core --status complete) to move completed artifacts intospecs/{core}/archive/. - Archive filtering treats both
CompleteandImplementedas done-state statuses. - After archive, manually update discovery docs (
SPEC_STATUS_REGISTRY.mdandDEFERRED_DASHBOARD.mdwhen relevant).
eos-spec next --spec {CORE-##} to get the single next action at any time (no need to memorize the sequence).
Full-pipeline navigation:Beforeeos-spec next --spec {CORE-##}now covers the Claude-skill stages too (research → spec-review → AC draft → test generation → a11y), names the actor + exact invocation, and flags[human-gate]stops. Theusing-encoreskill is the session gateway; every Encore spec/test skill ends with a▶ Next:line pointing back toeos-spec next.
create-spec (hard stops — do not assign a new ID until both pass):
-
Active-spec overlap. Run
npm run spec -- precedent --core {core} --topic "{feature-name}"so archived and superseded specs inspecs/{core}/archive/andspecs/SPEC_STATUS_REGISTRY.mdfactor into scope decisions. If an active (non-archived) spec at the same conceptual scope exists, STOP. Author the work as an enhancement of that spec, or document explicit non-overlap. -
Migration-table collision. For each intended table, confirm it does not already exist in
supabase/migrations/:If any intended{core}_*table is already defined, STOP. Never re-define a table that already lives insupabase/migrations/.
spec-review enforces both gates via npm run spec -- precedent --spec {ID} --check-migrations and npm run spec:landscape-scan -- --spec {ID} and HALTS the review if either trips.
Early research seeding (optional, before the full MCP-backed run): Use npm run spec:research:seed -- --seed <seed-or-spec-path> --core {core} to get the applicable citation classes (which regulatory surfaces apply) without invoking an LLM or MCP. Pass --mock in CI/offline. This decouples cheap “which regs apply” classification from the more expensive citation-verification pass that runs after validated.
Deferred features: Use spec deferred --list, spec deferred --promote, spec deferred --sync for listing, promoting, and regenerating the deferred dashboard. See spec-deferred. The dashboard file specs/DEFERRED_DASHBOARD.md is auto-generated by spec deferred --sync (run the command to create/update it). The commands promote-deferred and sync-deferred-summary are deprecated (sunset: 2026-06-01); use spec deferred instead.
Canonical spec commands (use these): create-spec, clarify-spec, validate-spec, spec-pipeline, prepare-spec, create-plan, validate-plan, generate-tasks, review-ux (optional UI pass), spec-review (in-chat spec review), spec-complete, spec deferred (—list | —promote | —sync), pre-commit-check, session-status, pause-work, resume-work. Wizard UX one-shot: wizard-spec-pipeline. Navigation/status via the eos-spec CLI (next / status / list); the discuss/CONTEXT, implement, and verify steps are owned by superpowers skills (brainstorming, writing-plans/executing-plans, verification-before-completion). See SPEC_COMMAND_CHEATSHEET.md for the full tiered list.
Command tiers: SPEC_COMMAND_CHEATSHEET.md
Deprecated / do not use: promote-deferred, sync-deferred-summary → use spec deferred. audit-spec-completion, update-spec-status, complete-feature → use spec-complete with flags (see SPEC_COMPLETION_TRACKING.md).
Board and assignment tracking: For GitHub Project setup and when to update the board, see GITHUB_PROJECT_SPEC_TRACKING_PLAN.md.
Implementation in Lovable: Tasks are often implemented in Lovable AI (which does not have Cursor rules). Each TASKS file includes an “Implementation rules for Lovable / external AI” section so implementers have the necessary patterns. See AGENTS.md and specs/_templates/TASKS_TEMPLATE.md.
GitHub issues vs formal specs
Use GitHub issues (see.github/ISSUE_TEMPLATE/) for bugs, small enhancements, and feature ideas that are not yet spec-backed. Use the spec pipeline below when work is non-trivial per constitution and AI_GUIDE.md.
Escalate from an issue to a formal spec when any of the following is true:
Decision tree (canonical): See “Should I Create a Spec?” in
AI_GUIDE.md (Decision Trees).
CodeRabbit Issue Planner: Optional coding plans from GitHub issues (@coderabbitai plan or labels configured in .coderabbit.yaml) can inform implementation; they do not replace validate-spec, constitution checks, or regulatory sections in specs.
What Each Step Does
Context for CL/PM specs
When creating or reviewing a CL or PM spec, load EHR/PM context so requirements align with domain and implementation guidance. Load (1) docs/ehr_pm/ai-context/README.md and the domain file(s) that match the spec ID from the “Load when working on” table, and (2) docs/ehr_pm/research-20260216.md. This applies to create-spec (author should have this context when drafting) and spec-reviewer (agent loads it before review). Chunks (docs/ehr_pm/_artifacts/ai_ingest_ehr_pm_chunks/) are optional for migration or incumbent-system mapping only.Command Order by Phase
Phase 1: Spec Creation and Clarification
Decision: Use
SPEC_TEMPLATE.md for complex features (DB, multi-phase); use SPEC_TEMPLATE_LITE.md for simple UI-only features. See specs/_templates/TEMPLATE_INDEX.md and SPEC_GUIDE.md.
Simple spec (fast) path
For low-complexity specs (SPEC_TEMPLATE_LITE, or single-phase UI-only, no DB changes):- When: Spec uses SPEC_TEMPLATE_LITE or is known to be low-complexity (no database, single phase, UI-only).
- Path:
create-spec → validate-spec → generate-tasks - Optional: Run
clarify-specif the spec has placeholders; run the spec-review skill for critical or cross-cutting features. Skipcreate-plan/validate-planwhenscore <4(validate-spec will report “plan not needed”). - Effect: Fewer steps for small features; use the full pipeline (clarify → validate-spec → spec-reviewer → create-plan → validate-plan → generate-tasks) for complex or multi-phase specs.
Phase 2: Planning and Task Generation
Decision: Use a separate plan when complexity score ≥4 or multi-phase. Run
validate-spec in Phase 1; when it reports score ≥4, run create-plan then validate-plan. See specs/_templates/SPEC_GUIDE.md (“When to Use a Separate Plan Document”).
Phase 3: Implementation
Note:spec-pipelineends at Phase 2 (generate-tasks). Phase 3 is a separate step initiated by the user via thesuperpowers:executing-plansskill or manual implementation.
Decision: Run the verification step (
superpowers:verification-before-completion) after each task (or batch); run pre-commit-check before every commit. Complete documentation during implementation (documentation-as-you-go).
Atomic commits: One commit per task using conventional format feat(CORE-##-TN): description. See .cursor/rules/git-commit-patterns.md.
Session management: Use pause-work when stopping mid-task and resume-work to restore context. Use session-status to check current position. See .cursor/rules/session-state-patterns.md.
Long features (Document-and-Clear): After every 3–4 tasks, optionally write specs/{core}/specs/{CORE-##}-PROGRESS.md with: completed work, decisions made, blockers, next task. Clear context and resume with CLAUDE.md + spec + PROGRESS.md to preserve architectural decisions across long sessions.
Phase 4: Completion
Event registry sync (when spec adds new events): Keep three sources in sync: (1)
KnownEventName in src/platform/events/types.ts, (2) event contract sections in docs/architecture/integrations/EVENT_CONTRACTS.md, (3) fw_workflow_events seed/migration data. When completing a spec that introduced new events, verify all three are updated. A future check-event-registry-sync script may automate this.
Decision: Use eos-spec status --spec {CORE-##} --detailed for read-only status; use spec-complete for all completion and status-update operations.
Decision Points
Overlap and duplication
Use the right tool for the kind of overlap:
Do not run
validate-spec again when you meant an overlap scan—use spec-landscape (or the npm script) first, then spec-review if ambiguity remains.
Full Issue-Sync Loop
Run this sequence after registry updates:spec-complete --all --update-registrynpm run spec:reconcile-trackingnpm run bootstrap:spec-issues -- --sync --active-onlynpm run spec:close-stale-trackingnpm run spec:add-tracking-to-project -- --state opennpm run spec:sync-project-statusnpm run spec-tracking:verify -- --scope active
Related Commands
AC-coverage drift (shipped-but-unverified)
npm run spec:ac-drift reports specs whose code shipped (they have @verifies tests) but whose
ACs are still planned, bucketed by how cheap the fix is:
- promotable-now — an
@verifies AC-Ntag exists; runnpm run spec:verify-acs -- --spec <ID> --write. - backlink-recoverable — an FR-tagged test covers the AC; run
npm run spec:ac-backlink -- --spec <ID>to scaffold the AC tag (review it — an FR proof is not automatically an AC proof), then verify-acs —write. - needs-work — no test covers the AC’s FRs; author one.
ac-drift-sweep.yml upserts an “AC-coverage drift burndown” issue. Nothing auto-promotes.
Dogfood result
When a spec is exercised through a dogfood pass (its run record lives atevals/dogfood/{CORE-##}-run.md), record the outcome on the spec’s frontmatter as a
dogfood-result: field. This turns an anecdotal run record into a structured, checkable
signal that the completion audit reads and npm run dogfood:metrics rolls up
(scripts/dogfood/collect-dogfood-metrics.ts).
spec-complete (step 1c / 13a) warns — never blocks — when a UI-bearing or
dogfooded spec is missing this field. It is optional for backend/data-only specs that
were not dogfooded. The fields mirror what the metrics collector parses from the run
record, so a spec author can copy them straight from the record’s Summary block.
Related Documentation
- Constitution:
constitution.md– engineering guardrails; spec and plan validation align with §1–§6 - Templates:
specs/_templates/TEMPLATE_INDEX.md– template decision tree and list - Template design rationale:
docs/development/SPEC_TEMPLATE_DESIGN_RATIONALE.md– why each template constraint exists (failure modes + mitigations); read once before authoring your first spec - Spec process review (Spec Kit comparison):
SPEC_TEMPLATE_DESIGN_RATIONALE.md– contains the adopted recommendations (R1–R8) informed by the GitHub Spec Kit comparison - Spec usage:
specs/_templates/SPEC_GUIDE.md– when to use plan, data model decisions - Directory structure:
specs/_templates/SPEC_GUIDE.md– complete path conventions and directory layout - Checklists:
specs/_templates/SPEC_GUIDE.md– pre-flight, compliance, RLS - Auto-apply (optional guidance): AUTO_APPLY_SAFETY.md – optional: categories to consider for human review after auto-apply
- Lovable handoff:
AGENTS.md§ Lovable Cloud Integration – making specs/tasks self-contained for Lovable - Regulatory compliance:
docs/compliance/REGULATORY_COMPLIANCE_TRACKER.md– regulatory deadlines and interim procedures - AGENTS.md – Specification Protocol, completion tracking
- Regulatory Compliance Decision Tree –
.cursor/rules/regulatory-compliance.md - AI_GUIDE.md – Spec-first delivery, implementation log
- Wizard workflow:
docs/development/WIZARD_DEVELOPMENT_GUIDE.md,docs/development/WIZARD_UX_STANDARD.md - Session state: .cursor/rules/session-state-patterns.md – pause/resume and session state patterns
- Git commit patterns: .cursor/rules/git-commit-patterns.md – atomic commits per task
- EHR/PM context (CL/PM):
docs/ehr_pm/ai-context/README.md,docs/ehr_pm/research-20260216.md– load when creating or reviewing CL/PM specs
Recommended agents and skills
After implementation: Run verifier (run commands, show output) and code-reviewer (spec compliance then code quality) before PR/commit. For specs that touch RLS, PHI, multi-tenancy, or new migrations, run security-auditor pre-deploy or before merge. For architecture or refactors, architecture-validator can validate rules and patterns. Specs with external APIs or integrations (PDMP, FHIR, etc.): Before or during spec, use technical-researcher to gather API docs, SDKs, and best practices; use integration-contract-author when adding or changing event/API contracts. During implementation, use the api-integration-specialist skill (auth, retries, rate limits, error handling, no secrets in code).
Commands: validate-spec before spec-reviewer (fix issues manually, create plan via create-plan when score ≥4); validate-plan when a plan exists; verification (superpowers:verification-before-completion) after each task or batch; pre-commit-check before commit; spec-complete for completion; generate-test-suite for test scaffolding;
npm run check-rls-coverage when DB/RLS changed.
Skills: api-integration-specialist (third-party APIs), supabase-postgres-best-practices (Postgres/RLS), verification-before-completion (before claiming work complete), systematic-debugging (bugs/test failures), tdd-workflow (implementation when appropriate).
Quick Reference
Canonical order:spec-pipeline {CORE-##} or spec-pipeline --spec {CORE-##} for the full canonical one-shot flow (including clarify/spec-reviewer, compliance-reviewer for regulated cores, optional UX/discussion, and generate-tasks). Slash invocations with bare spec IDs are normalized first, so /spec-pipeline hr-42 is equivalent to spec-pipeline --spec HR-42. The pipeline does not implement — it stops at generate-tasks. Use prepare-spec --spec {CORE-##} for the narrower validate+plan(+tasks) shortcut. For wizard UX specs, use wizard-spec-pipeline --spec {CORE-UX-##}. See .cursor/commands/specs/spec-pipeline.md, .cursor/commands/specs/prepare-spec.md, and .cursor/commands/specs/wizard-spec-pipeline.md.
What’s next: Run eos-spec next --spec {CORE-##} anytime to get the next command. Deferred work: spec deferred --list, spec deferred --sync; dashboard: specs/DEFERRED_DASHBOARD.md.
Status only (no writes):