15 KiB
Tasks: Implementation Convergence Command (/speckit.converge)
Input: Design documents from /specs/001-converge-command/
Prerequisites: plan.md (required), spec.md (user stories), research.md, data-model.md, contracts/
Tests: This feature's deliverable is a prompt-template command plus registry edits; it has no unit-testable application logic, so no TDD test tasks are generated. The required updates to the integration COMMAND_STEMS lists and the existing test_agent_config_consistency.py are treated as implementation/verification tasks. End-to-end validation is the quickstart.md scenarios in the Polish phase.
Organization: Tasks are grouped by user story. The single command template (templates/commands/converge.md) is built incrementally — each user story adds the prompt logic for its behavior to that file.
Format: [ID] [P?] [Story] Description
- [P]: Can run in parallel (different files, no dependencies)
- [Story]: Which user story this task belongs to (US1, US2, US3)
- All paths are relative to the
spec-kitrepository root
Path Conventions
This feature edits an existing Python CLI project at the spec-kit repo root: command
templates in templates/commands/, CLI code in src/specify_cli/, tests in tests/, docs
in docs/.
Phase 1: Setup (Shared Infrastructure)
Purpose: Establish the command template file and its invocation plumbing.
- T001 Create the command template skeleton at
templates/commands/converge.mdmodeled ontemplates/commands/analyze.md: YAML frontmatter with adescriptionand ascripts:block (sh: scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks,ps: scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks), a## User Inputsection echoing$ARGUMENTS, and empty section placeholders for the workflow. - T002 In
templates/commands/converge.md, add the## Execution Stepsinitialization step that runs{SCRIPT}once, parses JSON forFEATURE_DIR/AVAILABLE_DOCS, derivesSPEC/PLAN/TASKS/constitution paths, and aborts with a prerequisite message ifplan.mdortasks.mdis missing (per contracts/command-interface.md).
Phase 2: Foundational (Blocking Prerequisites)
Purpose: Register converge as a core command everywhere the canonical command set is enumerated, so the template is installed, discoverable, and invocable across every integration. Per Constitution Principle III, all enumerations must change together.
⚠️ CRITICAL: Until registration is complete, the command cannot be installed or tested under any agent, and the integration test suite will fail.
- T003 [P] Add
"converge"with a one-line description toSKILL_DESCRIPTIONSinsrc/specify_cli/__init__.py. - T004 [P] Add
"converge"to the_FALLBACK_CORE_COMMAND_NAMESfrozenset insrc/specify_cli/extensions.py(~L31; it is a frozenset, so simply append the entry — ordering is not significant). - T005 [P] Add a
"converge"argument-hint entry toARGUMENT_HINTSinsrc/specify_cli/integrations/claude/__init__.py. - T006 [P] Add
"converge"to theCOMMAND_STEMSlist intests/integrations/test_integration_base_yaml.py. - T007 [P] Add
"converge"to theCOMMAND_STEMSlist intests/integrations/test_integration_base_toml.py. - T008 [P] Add
"converge"to the expected command-stems list intests/integrations/test_integration_base_markdown.py. - T009 [P] Add
"converge"to both command enumerations intests/integrations/test_integration_base_skills.py: theexpected_commandsset (~L102) and the_SKILL_COMMANDSlist (~L395). - T010 [P] Add
"converge"to both command enumerations intests/integrations/test_integration_copilot.py: the hardcodedexpected_commandsset (~L129) and the_SKILL_COMMANDSlist (~L323). - T010a [P] Add
"converge"to thecommand_stemparametrize list oftest_command_loads_constitution_contextintests/integrations/test_integration_generic.py(~L211–L223) — converge reads the constitution, so it must referenceconstitution.mdlike its peer commands (Constitution III; the generic test enforces this). - T011 Run
uv run python -m pytest tests/test_agent_config_consistency.py tests/integrations -qand confirm the newconvergeentries resolve and all command-set assertions pass (fix any enumeration missed in T003–T010a).
Checkpoint: converge is a recognized core command; the template installs across integrations and the suite is green. User-story behavior can now be added to the template.
Phase 3: User Story 1 - Surface remaining work as new tasks (Priority: P1) 🎯 MVP
Goal: Reading spec/plan/tasks + constitution, assess the current codebase and append the remaining work as new, traceable tasks to tasks.md so /speckit.implement can complete it.
Independent Test: In a feature whose code omits one specified requirement, run the command and confirm a new task describing exactly that requirement is appended to tasks.md, with no other file changed (quickstart Scenario 1).
- T012 [US1] In
templates/commands/converge.md, add the artifact-loading step that readsspec.md(requirements FR-/SC-, acceptance scenarios),plan.md(decisions/constraints),tasks.md(existing tasks + referenced files), and.specify/memory/constitution.md— skipping constitution checks gracefully if it is an unfilled template (per data-model.md and FR-001, FR-002). - T013 [US1] Add the assessment step that scans the code paths named by the artifacts and produces
Findingrecords classified asmissing/partial/contradicts/unrequestedwith a severity, bounding scope to the feature artifacts only (FR-003, FR-004; data-model.md Finding entity). - T014 [US1] Add the task-append step implementing the contracts/tasks-output.md format: compute the next phase number and next task IDs from the current max, write a
## Phase N — Convergencesection at the end oftasks.md, one checklist item per actionable finding (FR-005, FR-006). - T015 [US1] Add explicit read-only guardrail instructions to the template: MUST NOT modify
spec.mdorplan.md, MUST NOT rewrite/delete existing tasks, MUST NOT modify application code — the only write is the appended Convergence phase (FR-008, FR-009, FR-010). - T016 [US1] Add the in-session findings summary output (severity-graded list/table of what was checked and what remains) ahead of the append (FR-012).
Checkpoint: Running the command on a feature with a gap appends a correct, traceable Convergence task and touches nothing else — MVP is functional.
Phase 4: User Story 2 - Confirm convergence is complete (Priority: P2)
Goal: When the code already satisfies everything, report a clean "converged" result with summary counts and leave tasks.md unchanged.
Independent Test: Run against a feature whose code fully satisfies its artifacts and confirm a clean result is reported and tasks.md is unchanged (quickstart Scenario 3).
- T017 [US2] In
templates/commands/converge.md, add the converged-state branch: when there are no actionable findings, emit a clean "converged" summary with counts of requirements, acceptance criteria, and plan decisions checked, and explicitly do NOT modifytasks.md(no empty phase header) (FR-011; contracts/tasks-output.md clean case). - T018 [US2] Add the next-step handoff guidance to the template: on
convergedsuggest proceeding to review/PR; ontasks_appendedsuggest running/speckit.implementto continue (FR-014).
Checkpoint: Both the gap path and the clean path produce correct, distinct outcomes.
Phase 5: User Story 3 - Trace each remaining task to its source (Priority: P3)
Goal: Every appended task names the requirement/criterion/decision/constraint it satisfies and its gap type.
Independent Test: Run against a feature with several distinct gaps and confirm each appended task names its originating reference and gap-type label (quickstart Scenario 1 trace assertions).
- T019 [US3] In
templates/commands/converge.md, refine the append step so each task line carries itssource-ref(e.g.FR-003,SC-002,US1/AC2,plan: …,Constitution II) and a(gap-type)label, and so constitution violations are emitted asCRITICAL(FR-007; data-model.md Convergence Task entity).
Checkpoint: Appended tasks are fully traceable and prioritized.
Phase 6: Polish & Cross-Cutting Concerns
Purpose: Hooks, cross-integration discoverability, docs, and full validation.
- T020 [P] In
templates/commands/converge.md, add thebefore_convergepre-execution hook block and theafter_convergepost-execution hook block (copied from theanalyze.mdpattern, keys renamed), ensuringafter_convergereceives theconvergedvstasks_appendedoutcome (FR-015; contracts/hooks.md). - T021 [P] Add
convergeto the post-init guidance insrc/specify_cli/commands/init.py(the "Next Steps" panel, ~L576–L582) as a step shown afterimplement(~L580) — using the existing_display_cmd('converge')helper so it renders correctly across skill/slash modes (FR-017). - T022 [P] Add a
/speckit.convergerow to the README Core Commands table inREADME.md(~L158–L165) — the only canonical slash-command enumeration in the repo — describing purpose, scope (code → spec), and append-only behavior (Constitution Principles III & V). Note:docs/reference/core.mdis thespecifyCLI reference anddocs/reference/workflows.mdonly defines the Full SDD Cycle workflow (which converge is not part of), so neither requires edits. - T023 Mentally apply
process_templatetotemplates/commands/converge.mdand confirm no leftover{SCRIPT},$ARGUMENTS, or__SPECKIT_COMMAND_*__tokens remain unresolvable and that the frontmatter is valid (FR-016). - T024 Run
uv run python -m pytest tests/test_agent_config_consistency.py tests/integrations -qagain to confirm the full suite passes after all edits. - T025 Execute the quickstart.md scenarios 1–6 manually through a coding agent and capture agent/OS/shell + pass/fail per scenario for the PR (Constitution Principle IV — manual slash-command validation). Validated 2026-06-10 — GitHub Copilot agent, macOS/zsh: S1 PASS (gap→appended traceable
(missing)task tracing FR-003); S2 PASS (implement completed T004, re-converge found 0 new); S3 PASS (converged →tasks.mdbyte-identical hash); S4 PASS (spec.md/plan.md/source unchanged,tasks.mdappend-only); S5 PASS (notasks.md→ non-zero exit with prerequisite message, nothing written); S6 PASS (installed + tokens resolved + post-init guidance for copilot.agent.mdand windsurf.md). Automated: 2343 passed. Re-verified 2026-06-16 — GitHub Copilot + Gemini, macOS/zsh: Automated 2343 passed; template tokens resolve for copilot+gemini × sh+ps (no leftover{SCRIPT}/__SPECKIT_COMMAND_*__); S1 PASS (FR-002 gap →## Phase 2 — ConvergenceT003(missing)appended); S2 PASS (implement closed gap, re-converge found 0); S3 PASS (converged →tasks.mdhash unchanged); S4 PASS (spec/plan/code hashes byte-identical on append); S5 PASS (notasks.md→ exit 1 "Run /speckit.tasks first"); S6 PASS (converge installed for copilot.github/prompts+.github/agentsand gemini.gemini/commands/*.toml, post-init guidance step 2.6 after implement).
Dependencies & Execution Order
Phase Dependencies
- Setup (Phase 1): No dependencies — start immediately. T002 depends on T001 (same file).
- Foundational (Phase 2): Depends on Setup. T003–T010a are parallelizable; T011 depends on T003–T010a. BLOCKS all user stories (command must be registered to be testable).
- User Stories (Phase 3–5): All depend on Foundational completion. They edit the same template file, so within the template they are sequential, but each story is independently testable once present.
- Polish (Phase 6): Depends on the desired user stories being complete.
User Story Dependencies
- US1 (P1): Depends only on Foundational. The MVP.
- US2 (P2): Depends on Foundational; logically builds on the assessment from US1 (the converged state is "US1 found nothing"), so implement after US1.
- US3 (P3): Depends on Foundational; refines the US1 append step, so implement after US1.
Within the command template
- T012 (load) → T013 (assess) → T014 (append) → T015 (guardrails) → T016 (summary).
- T017/T018 (US2) and T019 (US3) modify the same file after US1 — apply sequentially.
Parallel Opportunities
- Phase 2: T003, T004, T005, T006, T007, T008, T009, T010, T010a all touch different files → run in parallel; then T011.
- Phase 6: T020 (template), T021 (init.py), T022 (docs) touch different files → run in parallel; then T023/T024/T025.
- The template-body tasks (T001–T002, T012–T019) all edit
templates/commands/converge.mdand must be sequential.
Parallel Example: Phase 2 Foundational
# These edit different files and can be done together:
Task: T003 Add "converge" to SKILL_DESCRIPTIONS in src/specify_cli/__init__.py
Task: T004 Add "converge" to _FALLBACK_CORE_COMMAND_NAMES in src/specify_cli/extensions.py
Task: T005 Add "converge" hint in src/specify_cli/integrations/claude/__init__.py
Task: T006 Add "converge" to COMMAND_STEMS in tests/integrations/test_integration_base_yaml.py
Task: T007 Add "converge" to COMMAND_STEMS in tests/integrations/test_integration_base_toml.py
Task: T008 Add "converge" to tests/integrations/test_integration_base_markdown.py
Task: T009 Add "converge" to tests/integrations/test_integration_base_skills.py
Task: T010 Add "converge" to tests/integrations/test_integration_copilot.py
Task: T010a Add "converge" to tests/integrations/test_integration_generic.py
# Then:
Task: T011 Run the integration + agent-config test suite
Implementation Strategy
MVP First (User Story 1 only)
- Complete Phase 1: Setup (T001–T002).
- Complete Phase 2: Foundational registration (T003–T011) — CRITICAL, blocks everything. (Includes T010a.)
- Complete Phase 3: User Story 1 (T012–T016).
- STOP and VALIDATE: Run quickstart Scenario 1 — confirm a gap becomes a traceable appended task and nothing else changes. This is a usable, shippable increment.
Incremental Delivery
- Add US2 (T017–T018) for the clean-converged experience and handoffs.
- Add US3 (T019) for full traceability.
- Finish with Polish (T020–T025): hooks, discoverability, docs, and full validation.