Skill v1.0.2
currentAutomated scan100/1003 files
name: kn-flow description: Use when orchestrating a full Knowns spec or task wave through planning, implementation, review, integration, and verification, optionally using sub-agents when scopes are parallel-safe. metadata: version: "1.0.2"
Spec Flow Orchestration
Coordinate an approved spec, linked task set, or explicit task wave from planning through implementation, review, and verification.
Announce: "Using kn-flow for spec/task wave [ref]."
Core principle: APPROVED SPEC/TASK WAVE -> SCHEDULE -> PLAN -> IMPLEMENT -> REVIEW -> VERIFY.
When to Use
- After
/kn-specapproves a spec and the user wants the work completed end to end - When the user says "do all tasks", "complete this spec", "orchestrate sub-agents", "run the whole flow", or similar
- When multiple linked tasks need dependency ordering, ownership boundaries, review, and combined verification
When NOT to Use
- Draft specs or unresolved product questions -> use
/kn-spec - A single task with an existing plan -> use
/kn-implement <id> - Creating tasks only, without execution -> use
/kn-plan --from @doc/<spec-path> - Tiny standalone work -> use
/kn-plan --new "<summary>"
Inputs
- Spec ref:
@doc/<spec-path>preferred - Task IDs: one or more explicit tasks for a task wave
- Optional:
--sequentialto force single-threaded execution - Optional:
--plan-onlyto stop after plans and schedule
Startup
- Start with Knowns MCP
initial. - Read
kn-plan,kn-implement, andkn-reviewbefore using their procedures. - Read the spec or each explicit task.
- For every linked spec, read the complete canonical
Locked Decisionssection and keep its stable D-IDs as execution gates. - Retrieve relevant accepted/current System Decisions with a feature/task query,
sourceTypes:["decision"],status:"accepted",includeHistorical:false, and a bounded limit. - Search first, then follow explicit refs and retrieve only relevant context.
- Do not manually edit Knowns-managed task or doc markdown.
Task Discovery
For a spec ref:
- Read the spec.
- List tasks linked to the spec.
- Read the spec's optional
Task Generation→Task Prefix; when tasks must be
generated, pass it as prefix on each create call without changing project config.
- Sort by
order, then title. Generated IDs are identity, not workflow ordering. - If no tasks exist, use
/kn-plan --from @doc/<spec-path>behavior to preview tasks. Ask before creating tasks unless the user explicitly approved task creation.
For explicit task IDs:
- Read every task.
- Follow refs needed to understand dependencies and verification.
- Sort by dependency order when visible; otherwise preserve user order.
Carry each ID verbatim into worker prompts and back out of worker reports. Projects that set settings.defaultTaskIdPrefix produce IDs like KN-4F7Q2M, and a worker receives that string with none of your project context to repair it, so a stripped prefix becomes a task the worker cannot open.
Parallel Gate
Before spawning workers or implementing in waves, decide what can safely run together.
Read declared dependency edges before judging dependencies from prose:
mcp_knowns_search({ "action": "resolve", "ref": "@task-<id>{blocked-by}","direction": "both", "relationTypes": "blocked-by,depends", "entityTypes": "task" })
For each task, note:
- declared dependency edges, plus any dependency visible in the task text but never declared
- owned write scope
- expected verification
- shared API/schema/config/generated artifact/runtime contract risk
- parallel-safe: yes/no
A task is runnable only when every task it declares blocked-by is done. Two tasks with no edge between them are candidates for the same wave: order is display sequence, so it never on its own justifies serialising them and never on its own justifies parallelising them.
When a real dependency exists but was never declared as an edge, say so and record it on the task, so the next run reads the edge instead of re-deriving it.
Only run tasks in parallel when dependencies and write scopes are disjoint and no shared runtime contract is touched. Default to sequential execution when safety is unclear.
Report the schedule before implementation, naming which pairs are unordered because no edge exists and which are ordered by a declared edge.
Execution Loop
For each task or parallel-safe wave:
- Run
/kn-plan <task-id>behavior if no saved plan exists or if the plan is stale. - Run
/kn-implement <task-id>behavior to complete the saved plan. - Run
/kn-test <task-id>behavior when the task changed behavior, so the reviewer sees the implementation and its tests together. Report any criterion left unproven rather than omitting it. Skip this step for work that changes no behavior, such as documentation or configuration, and say that it was skipped. - Run
/kn-review <task-id>behavior against the real diff. - Fix P1 findings. Fix P2 findings when practical, or explicitly defer them with a follow-up task.
- Validate the task before marking the wave complete.
- Run the System Decision Impact checkpoint before completion:
- no durable guidance change → append
System Decision Impact: none — <reason>and create no candidate - durable guidance added, changed, or removed → create a first-class draft Decision linked to the task, spec/doc, and readable sources; append
System Decision Impact: candidate @decision/<id> (added|changed|removed) — <summary> - never auto-accept the candidate; unresolved evidence/conflicts stay in Review Inbox
- retire what the work replaced in the same change: delete a fully superseded spec/doc rather than leaving it resident under a
Supersededbanner; for a partially superseded one, keep it and name the void parts
- Append one structured task note before completion:
Spec Decision Compliance: D1=pass, D2=pass. UseD<N>=conflict: <reason>for any conflict and do not mark the task done.
Spec Decisions remain canonical execution rules in the spec's Locked Decisions section. Do not create System Decision ledger rows merely to mirror D-IDs. Never create Memory category decision; redirect legacy Decision Memory capture requests to the first-class Decision candidate flow.
If delegation capabilities are available, use them only after the parallel gate marks tasks safe. Inspect or discover the current runtime's delegation capabilities before declaring them unavailable. If --sequential is set, delegation is unavailable, or the parallel gate is unsafe, execute the same schedule sequentially in the main context and state why workers were not spawned.
Worker Prompt
Use this shape when spawning an implementation worker:
Worker for <TASK_ID> in <SPEC_REF>. Use kn-implement.Owned scope: <OWNERSHIP_SCOPE>.Do not revert unrelated changes.Implement the saved plan, verify it, and validate the task.End your report with a single JSON object in exactly this shape:{"task_id": "<TASK_ID>","changed_files": ["<path>"],"commands_run": ["<exact command as run>"],"tests_passed": true,"test_evidence": "<verbatim result line from the test run>","acs_checked": [1, 2],"decision_compliance": ["D1=pass"],"out_of_scope_edits": [],"blockers": [],"unknowns": []}
Worker Report Contract
A worker report is evidence, not a status claim. Send the report back rather than integrating it when:
tests_passedis true whilecommands_runortest_evidenceis empty, because nothing shows the tests ranacs_checkednames a criterion that no listed file or command could satisfychanged_filesdisagrees with the real diff- prose replaces the object, or fields are silently dropped
Integrate because the evidence holds, never because a worker reported completion. A non-empty unknowns is an honest report; an empty unknowns on a task that plainly had open questions is the suspicious case.
Reviewer Prompt
Use this shape when spawning a review worker:
Reviewer for <TASK_ID> in <SPEC_REF>. Use kn-review.Review the real diff and report verdict, P1/P2/P3 findings with file:line refs, wiring status, fixes, and verification gaps.Check the worker's report against that diff and report every field the diff contradicts.
After Each Wave
- Inspect worker output directly, and check each report field against the real diff before trusting it.
- Integrate or reject worker changes in the main context.
- Run combined verification for touched areas.
- Re-run review if integration changed reviewed code.
- Close sub-agents after their work has been integrated or rejected.
Final Verification
Before calling the flow done:
- all linked spec tasks are done or explicitly blocked
- task ACs are checked only after implementation
- SDD validation passes for the spec/task set
- every done/in-review linked task has a complete Spec Decision Compliance marker with no conflicts
- every done/in-review linked task declares
System Decision Impact: noneor a persistedcandidate @decision/<id> - every positive impact candidate is linked to originating work and remains non-current until explicit verified human resolution
- broad verification ran across the integrated diff
- useful durable memory is captured
- sub-agents are closed
Shared Output Contract
Required order for the final user-facing response:
- Goal/result - state what spec/task wave completed, partially completed, or blocked.
- Key details - tasks completed, review results, verification, validation, blockers, and important files.
- Next action - usually
/kn-commitwhen the flow is clean, or the exact unblock command/context when blocked.
Related Skills
/kn-spec- create and approve a spec before flow orchestration/kn-plan --from @doc/<spec-path>- generate tasks from a spec without executing them/kn-plan <id>- plan one task inside the flow/kn-implement <id>- implement one task inside the flow/kn-test <id>- derive tests from the spec's criteria and report what remains unproven/kn-review <id>- review one task or integrated wave/kn-verify- final SDD verification/kn-handoff contract- publish the settled API contract when another repository is waiting on this work/kn-commit- commit after the flow is complete and reviewed
Checklist
- [ ] Spec/tasks read
- [ ] Linked tasks discovered and sorted
- [ ] Declared dependency edges read before scheduling
- [ ] Parallel gate reported
- [ ] Plans exist for all runnable tasks
- [ ] Implementation completed per task
- [ ] Tests derived and run for behavior changes, or the step explicitly skipped
- [ ] Worker reports carried evidence and matched the real diff
- [ ] Reviews completed and P1 fixed
- [ ] Combined verification passed
- [ ] SDD validation passed
- [ ] Spec Decision compliance and per-task System Decision impact markers passed
- [ ] Positive impacts persisted draft candidates with task/spec/source provenance
- [ ] Durable memory captured when useful
- [ ] Sub-agents closed
- [ ] Next action suggested
Red Flags
- Running on a draft spec
- Creating tasks without approval
- Parallelizing tasks with shared APIs, schema, config, generated files, migrations, or runtime contracts
- Trusting worker output without inspecting the real diff
- Accepting a worker report that claims passing tests with no command or result evidence
- Ordering or parallelising tasks from
orderwhen no dependency edge was declared - Skipping review before final verification
- Marking the spec done while linked tasks remain unhandled
- Marking work done without an explicit
System Decision Impactmarker - Leaving a fully superseded spec or doc resident under a
Supersededbanner instead of deleting it - Creating legacy Decision Memory instead of a first-class Decision candidate
- Duplicating Spec Locked Decisions into the System Decision ledger
- Committing or pushing without explicit user request
- Closing a flow that another repository is waiting on without publishing a
/kn-handoff contract