Context and Problem Statement
Current agent workflow execution requires selecting command-specific entrypoints (for example agent workflow implement and agent workflow review). This increases agent-side branching logic and creates inconsistent next-step behavior.
The product direction requires that agents repeatedly call one command (next) and receive complete prompt + context for the next action.
Decision Drivers
- Deterministic execution loop for LLM agents.
- Reduced command-selection cognitive load.
- Unified behavior across missions and runtimes.
- Compatibility with local-first operation.
Considered Options
- Keep command-specific entrypoints only.
- Add
spec-kitty nextas canonical loop command (chosen). - Delegate step selection to SaaS only.
Decision Outcome
Chosen option: Add top-level spec-kitty next --agent <name> as the canonical mission loop command.
Command Contract
--agentis required.- Default behavior auto-completes previously issued step as success unless
--resultoverride is supplied. - Output includes both machine JSON decision payload and human-readable prompt text.
- Decision kinds:
step,decision_required,blocked,terminal. nextplanning for an active run uses the frozen mission template captured at run start (not live mission file edits).- If template drift is detected during active run,
nextMUST returnblockedwith migration-required reason.
Consequences
Positive
- Single command for agent execution loop.
- Deterministic UX across mission types.
- Easier integration with diverse agent runtimes.
Negative
- Migration effort from legacy
agent workflowcommand family. - Need compatibility bridge and deprecation messaging.
Neutral
- Legacy commands remain available during migration window.
Rollout Notes
- Runtime integration is gated on
spec-kitty-eventsmission-next contract publication. - Do not ship CLI-side local-only mission-next event names.
- Implement compatibility bridge from
agent workflowto runtime-backed planning semantics. - Emit telemetry during migration to quantify legacy command usage.
- Deprecate legacy flow after adoption threshold is met.
Amendment (2026-02-18)
The initial implementation left three contract gaps that are now explicitly closed:
nextresult handling (failed/blocked) is runtime-driven. CLI no longer short-circuits these outcomes before runtime execution.- Runtime template resolution for
nexthonors deterministic discovery precedence tiers formission-runtime.yaml, instead of selecting built-in templates first. - Integration tests include a real successful decision-answer path and replay parity against canonical mission-next conformance fixtures from
spec-kitty-events.
Known Limitations (Locked In)
As of 2026-02-17, some mission mappings/templates for spec-kitty next are intentionally incomplete and may return blocked or terminal before a full loop.
planmission initial state/action mapping gap.documentationmission state-machine/template parity gap fornext.
These are accepted short-term constraints and MUST remain explicitly tracked via:
- Per-mission tracking docs:
architecture/2.x/initiatives/next-mission-mappings/issue-plan-mission-next-mapping.mdarchitecture/2.x/initiatives/next-mission-mappings/issue-documentation-mission-next-mapping.md xfail(strict=True)integration tests that express desired behavior and fail loudly on accidental drift/partial fixes.
When either mission is implemented end-to-end, the corresponding tracking doc MUST be updated to closed and the xfail test MUST be converted to a normal passing test in the same PR.