lee-spec-kit 0.7.11 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.en.md +32 -54
  2. package/README.md +32 -54
  3. package/dist/bootstrap-G37N6RGB.js +5 -0
  4. package/dist/bootstrap-G37N6RGB.js.map +1 -0
  5. package/dist/chunk-7V7RMGEU.js +11 -0
  6. package/dist/chunk-7V7RMGEU.js.map +1 -0
  7. package/dist/chunk-GR7JQBWF.js +26 -0
  8. package/dist/chunk-GR7JQBWF.js.map +1 -0
  9. package/dist/chunk-LYFRLOFQ.js +275 -0
  10. package/dist/chunk-LYFRLOFQ.js.map +1 -0
  11. package/dist/hooks-4S33YUIB.js +1082 -0
  12. package/dist/hooks-4S33YUIB.js.map +1 -0
  13. package/dist/index.js +4689 -15581
  14. package/dist/index.js.map +1 -1
  15. package/package.json +2 -2
  16. package/templates/en/common/README.md +12 -10
  17. package/templates/en/common/agents/agents.md +35 -89
  18. package/templates/en/common/agents/skills/create-feature.md +32 -57
  19. package/templates/en/common/agents/skills/create-issue.md +9 -10
  20. package/templates/en/common/agents/skills/create-pr.md +6 -11
  21. package/templates/en/common/agents/skills/execute-task.md +35 -96
  22. package/templates/en/common/features/README.md +1 -1
  23. package/templates/en/common/features/feature-base/tasks.md +5 -5
  24. package/templates/ko/common/README.md +12 -10
  25. package/templates/ko/common/agents/agents.md +34 -87
  26. package/templates/ko/common/agents/skills/create-feature.md +32 -58
  27. package/templates/ko/common/agents/skills/create-issue.md +9 -10
  28. package/templates/ko/common/agents/skills/create-pr.md +6 -11
  29. package/templates/ko/common/agents/skills/execute-task.md +35 -102
  30. package/templates/ko/common/features/README.md +1 -1
  31. package/templates/ko/common/features/feature-base/tasks.md +5 -5
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lee-spec-kit",
3
- "version": "0.7.11",
4
- "description": "Agent-guided development harness CLI for spec-driven projects",
3
+ "version": "0.8.1",
4
+ "description": "Document-centered harness engineering toolkit for AI agent development",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "lee-spec-kit": "./dist/index.js",
@@ -11,23 +11,23 @@ npx lee-spec-kit onboard --strict
11
11
  # 1) Detect project
12
12
  npx lee-spec-kit detect --json
13
13
 
14
- # 2) If detected, read context first
15
- npx lee-spec-kit context --json-compact
14
+ # 2) If detected, read the workflow policy
15
+ npx lee-spec-kit docs get agents --json
16
16
  ```
17
17
 
18
18
  - Apply lee-spec-kit workflow only when `isLeeSpecKitProject: true`.
19
- - Use `context --json-compact` as the read-only state probe, then use `flow` as the default execution/resume entrypoint.
20
- - Determine approval waiting only from the latest `context --json-compact` / `flow --json-compact`.
21
- - When `approvalRequest.required=true`, keep approval open until it is resolved: briefly restate the current stage from `matchedFeature.currentSubstate*` when available, then show the exact CLI approval lines and wait for user approval (`<LABEL>` or `<LABEL> OK`) before execution.
22
- - For command execution, default to `npx lee-spec-kit flow <featureRef> --approve <LABEL> --execute`.
23
- - When `approvalRequest.required=false`, do not invent a separate label approval prompt.
19
+ - Use workspace-scoped `AGENTS.md`, official Codex hooks, and the active feature docs as the default runtime path.
20
+ - Resolve the active feature, then treat `spec.md`, `plan.md`, `tasks.md`, and `decisions.md` as the working SSOT.
21
+ - Ask for approval only at documented workflow checkpoints and before remote or destructive actions.
22
+ - Use `npx lee-spec-kit commit-audit --json` before `git commit` when staged docs paths need validation.
23
+ - Use `npx lee-spec-kit workflow-audit --json` before stopping when code or feature docs changed.
24
24
  - If `isLeeSpecKitProject: false`, skip lee-spec-kit-specific flow and continue with normal workflow.
25
25
 
26
26
  ## New Project Start Order
27
27
 
28
28
  - Scaffold the code project first (for example Next.js/NestJS), then run `lee-spec-kit init`.
29
29
  - After that, write top-level requirements in `docs/prd/`, then continue with `idea` and `feature`.
30
- - Verify detection with `detect --json`, then continue with `context`.
30
+ - Verify detection with `detect --json`, then continue through `docs get agents --json` and the active feature docs.
31
31
  - In most cases (default: embedded), the steps above are all you need.
32
32
  - Choose standalone only when docs are managed separately from the code repo. In that case, prefer running init from a parent workspace folder (for example `workspace/docs`, `workspace/project`) and set both docs/project paths together. (e.g. `npx lee-spec-kit init --docs-repo standalone --dir ./docs --project-root ./project`)
33
33
 
@@ -77,7 +77,7 @@ Recommended flow:
77
77
  - **Unmanaged docs entries**: any top-level docs entry outside the canonical surface
78
78
  - Examples: `docs/plans/`, `docs/superpowers/`, or another skill-created folder
79
79
  - Treat them as staging/reference inputs only, not the active workflow SSOT
80
- - Once a feature is active, `context` may block execution with a `docs_normalize` step until these entries are normalized or explicitly allowlisted
80
+ - Normalize or allowlist them before commit; `commit-audit` blocks staged non-canonical docs paths
81
81
  - Normalize them into feature-local docs:
82
82
  - design/spec artifact → `spec.md`, `plan.md`, `decisions.md`
83
83
  - implementation plan artifact → `plan.md`, `tasks.md`
@@ -117,7 +117,9 @@ When you run `lee-spec-kit init`, it creates `.lee-spec-kit.json` in the docs ro
117
117
  - `docsRepo` ("embedded" | "standalone"): How docs are managed
118
118
  - `pushDocs` (boolean, optional): Only written when `docsRepo: "standalone"` (whether to push to remote)
119
119
  - `docsRemote` (string, optional): Only written when `pushDocs: true` (remote repo URL)
120
- - `approval` (object, optional): Override `[CHECK required]` / `requiresUserCheck` policy in `context` output
120
+ - `approval` (object, optional): optional approval-checkpoint metadata for repo policy and custom validators
121
+ - The Codex-native default path still asks at documented checkpoints and before remote/destructive actions first.
122
+ - Legacy runtime consumed this field directly; keep it only when you intentionally want category-based checkpoint metadata.
121
123
  - Current default:
122
124
  - `mode: "category"`
123
125
  - `default: "skip"`
@@ -1,107 +1,53 @@
1
1
  # Agents Guide
2
2
 
3
3
  Operating rules for AI code assistants.
4
- This document covers **policy only**.
4
+ This document defines workflow policy, not a custom runtime loop.
5
5
 
6
6
  ---
7
7
 
8
- ## 🚨 User Approval Handling (MUST)
8
+ ## Detection Gate
9
9
 
10
- These are the mandatory user approval rules.
10
+ - Run `npx lee-spec-kit detect --json` first.
11
+ - Use lee-spec-kit policy only when detection returns `status === "ok"` and `isLeeSpecKitProject === true`.
12
+ - If detection fails or returns false, ignore lee-spec-kit-specific rules and continue normally.
11
13
 
12
- > ⚠️ Do not decide approval only from the action type. Workflow approval-waiting is determined by the latest `context --json-compact` / `flow --json-compact` output.
13
- > ✅ In approval-waiting state, replies must be in `<label>` or `<label> OK` format (e.g. `A`, `A OK`).
14
- > ℹ️ Under the default policy, the main workflow approval boundaries are `spec_approve` and `implementation_approve`. Project config may add more.
15
- > ℹ️ Some direct remote helper commands still require explicit command confirmation such as `--confirm OK`; that command-level confirm is separate from label-gated workflow approval.
14
+ ## Default Runtime
16
15
 
17
- If the current action is approval-waiting, share the matching details before execution:
16
+ - Prefer Codex native execution with workspace-scoped `AGENTS.md` plus official Codex hooks.
17
+ - If the user gives a generic request such as continuing the next feature according to the rules, interpret it through this workflow automatically.
18
18
 
19
- | Current action (examples) | What to share |
20
- | --- | --- |
21
- | Spec / plan / tasks review | The document or the exact section being reviewed |
22
- | Task completion / final checklist | Outcome and verification evidence |
23
- | Commit / push / merge | Commit message, included files, branch |
24
- | Issue creation | Before `npx lee-spec-kit github issue <featureRef> --create` |
25
- | PR creation | Before `npx lee-spec-kit github pr <featureRef> --create` |
26
- | Assignee change | Target username |
27
-
28
- Approval flow:
29
- 1. Share details first
30
- 2. Check whether approval is currently required via the latest `context --json-compact` (`approvalRequest.required`)
31
- 3. If approval is required, wait for the exact CLI-provided label prompt response; if not, do not invent a separate approval prompt
32
- 4. Execute after approval (for command execution, default to `npx lee-spec-kit flow <featureRef> --approve <LABEL> --execute`)
33
-
34
- Prohibited:
35
- - Proceeding without user response
19
+ ## Docs Are SSOT
36
20
 
37
- ---
38
-
39
- ## 🧾 Label Response Contract (SSOT)
40
-
41
- - Treat approval-waiting as a separate state. Approval-waiting means the latest `context --json-compact` / `flow --json-compact` (fallback: `context --json` / `flow --json`) shows `approvalRequest.required=true`.
42
- - Do not infer approval-waiting from conversation tone, action type, or the mere presence of `actionOptions[]`.
43
- - Use the latest `npx lee-spec-kit context --json-compact` as the default source (fallback: `context --json` or `flow --json` when full detail is required; prefer `flow --json-compact` for default flow output).
44
- - When using auto results from `flow --json-compact` (or `flow --json`), treat `autoRun.resume.flowCommand` as SSOT for resume (including after context compression/reset).
45
- - Treat `AUTO_DELEGATED_HANDOFF` as a delegated pause, not a failure. Continue or resume the delegated run path and do not reopen the same approval label.
46
- - Treat `AUTO_MANUAL_REQUIRED` as an instruction-only automation boundary, not an immediate failure. Re-check `context --json-compact`, then decide stop/report by `approvalRequest.required` (`context --json` only for full-detail debugging fields).
47
- - Special case: if `matchedFeature.currentSubstateId === "change_request_sync"` or `matchedFeature.pendingChangeRequest` is present, treat that manual boundary as an internal docs-sync step first, not an immediate user-facing stop. Sync docs, clear the pending change field, then continue with fresh `context --json-compact` or `flow`.
48
- - Treat `AUTO_SELECTION_REQUIRED` as a feature-selection pause, not an execution failure. Resolve the active feature first, then continue with fresh `context --json-compact` or `flow`.
49
- - In approval-waiting state, if `matchedFeature.currentSubstateId` exists, prepend one brief current-stage recap derived from `matchedFeature.currentSubstateId/currentSubstateOwner/currentSubstatePhase`.
50
- - Then prefer `approvalRequest.userFacingLines` from `context --json-compact`. If full `--json` is used, fall back to `actionOptions[*].approvalPrompt` plus `approvalRequest.finalPrompt`. Do not add your own rewritten label summary before or between those lines.
51
- - Prefer `matchedFeature.currentSubstateOwner` plus `agentOrchestration.subAgentHandoff` as the delegation SSOT.
52
- - In non-approval state, do not append labels or `approvalRequest.finalPrompt` unless the user explicitly asked for current options.
53
- - If approval is still pending after answering an unrelated question, answer first, re-check `approvalRequest.required`, and if it is still `true`, re-open approval with one brief current-stage recap plus the exact CLI-provided approval lines (`approvalRequest.userFacingLines`, or `actionOptions[*].approvalPrompt` + `approvalRequest.finalPrompt` in full `--json`).
54
- - If user input does not contain a valid label, do not execute; request label selection again.
55
- - For non-delegated command options, prefer one-shot `flow --approve <LABEL> --execute`; do not split `context --approve` and `context --execute --ticket` across turns/sessions.
56
- - If `matchedFeature.currentSubstateOwner="subagent"` and `agentOrchestration.subAgentHandoff.required=true` with `mode="command"`, delegation is mandatory: call `spawn_agent` first. Do not execute that command directly from the main agent.
57
- - If that delegated command is handoff-only (`handoffOnly=true`, `advancesWorkflow=false`), treat `--execute` as handoff preparation only. Continue the delegated work immediately and do not re-approve the same label.
58
- - Do not delegate auto loops from `autoRun.available` alone. Delegate auto loops only when `agentOrchestration.subAgentHandoff.required=true` and `agentOrchestration.subAgentHandoff.mode="auto_run"`.
59
- - Prefer `agentOrchestration.subAgentHandoff` as the handoff SSOT. Pass only its minimal fields (`featureRef`, `category`, `cwd`, `cmd`) to the sub-agent.
60
- - For delegated runs, execute one-time verification from `subAgentHandoff.verify` (`pwd`, `git rev-parse --show-toplevel`) and cache by `verify.cacheKey`. If mismatched, stop and report; collect detailed logs only on mismatch.
61
- - Main-agent fallback is allowed only when sub-agent execution is unavailable (for example: tool not available, spawn failed, or sub-agent failed before command execution).
62
- - When fallback is used, report a one-line fallback reason to the user before running the command in the main agent.
21
+ - Read `npx lee-spec-kit docs get agents --json` once at session start or right after context reset.
22
+ - Read every unread `requiredDocs[*].command` from that response.
23
+ - Resolve the active feature, then use that feature folder as the working SSOT.
24
+ - Minimum active feature docs: `spec.md`, `plan.md`, `tasks.md`, `decisions.md`.
25
+ - When GitHub workflow is involved, also use `issue.md` and `pr.md`.
26
+ - After reading the active feature docs, run `npx lee-spec-kit workflow-stage <featureRef> --json` and follow only that `nextAction`.
63
27
 
64
- Approval-waiting output must reuse the exact CLI-provided prompt lines. A single concise current-stage recap derived from `matchedFeature.currentSubstate*` is allowed before those lines. Do not invent label-summary wrappers such as `Current status:` / `Available labels:` or paraphrase label meanings.
28
+ ## Execution Rules
65
29
 
66
- ---
67
-
68
- ## 📚 Built-in Docs Read Policy (MUST)
30
+ - lee-spec-kit owns docs structure, workflow stages, and validators.
31
+ - Codex owns the execution loop, tool usage, and hook lifecycle.
32
+ - Do not start implementation unless `workflow-stage --json` reports `stage === "implementation"` and `implementationAllowed === true`.
33
+ - Treat spec/plan/tasks approval, issue creation, and branch creation as hard gates before implementation.
34
+ - Keep docs synced with code changes in the same turn whenever behavior or scope changes.
35
+ - Use `npx lee-spec-kit commit-audit --json` before `git commit` when staged docs paths need validation.
36
+ - Use `npx lee-spec-kit workflow-audit --json` as the default end-of-turn docs sync check.
69
37
 
70
- - Use `docs get` once per session start (or right after context compression/reset).
71
- - Do not re-read the same doc again in the same session.
72
- - From `requiredDocs[*].command`, fetch only docs not yet read in this session.
73
- - You may re-read only when:
74
- - user explicitly asks for policy refresh
75
- - policy/config changed (for example after `update`)
76
- - session restarted or context was compressed/reset
38
+ ## Approval Rules
77
39
 
78
- ---
79
-
80
- ## Required References
81
-
82
- - Highest-priority custom rules: `/docs/agents/custom.md`
83
- - Project principles: `/docs/agents/constitution.md`
84
- - Root guide: `npx lee-spec-kit docs get agents --json`
85
- - Git workflow: `npx lee-spec-kit docs get git-workflow --json`
86
- - Task execution: `npx lee-spec-kit docs get execute-task --json`
87
- - Issue procedure/doc: `npx lee-spec-kit docs get create-issue --json` → `npx lee-spec-kit docs get issue-doc --json`
88
- - PR procedure/doc: `npx lee-spec-kit docs get create-pr --json` → `npx lee-spec-kit docs get pr-doc --json`
89
-
90
- ---
91
-
92
- ## Scope Split
93
-
94
- - Docs structure/path rules: use `docs/README.md` as SSOT
95
- - Canonical docs surface is limited to the top-level entries defined by `docs/README.md`. Treat any non-allowlisted extra `docs/*` top-level entry as unmanaged docs.
96
- - Unmanaged docs entries (for example `docs/plans/*`, `docs/superpowers/*`, or another skill-created docs folder) are staging/reference inputs only. When a feature is active, normalize them into feature-local docs and treat the feature folder as the final SSOT.
97
- - If `context` surfaces a `docs_normalize` action/category, complete that normalization step before continuing implementation or workflow actions.
98
- - ADR format: use feature `decisions.md` template as SSOT
99
- - Issue/PR execution state: use each feature's `issue.md` and `pr.md` as SSOT
40
+ | Current action (examples) | What to share |
41
+ | --- | --- |
42
+ | Issue creation | Before `npx lee-spec-kit github issue <featureRef> --create` |
43
+ | PR creation | Before `npx lee-spec-kit github pr <featureRef> --create` |
100
44
 
101
- ---
45
+ - Ask the user for approval at documented workflow checkpoints and before remote or destructive actions.
46
+ - If `workflow-stage --json` says `approvalRequired === true`, stop and ask the user at that checkpoint.
47
+ - Share the exact artifact or plan before remote GitHub actions.
102
48
 
103
- ## Language / Formatting Rules
49
+ ## Formatting Rules
104
50
 
105
- - Replies: English (or project language policy in `custom.md`)
106
- - Code/file names: English
107
- - Date/time: use user's local system time
51
+ - Replies: English unless project policy overrides it
52
+ - Code and filenames: English
53
+ - Dates and times: use the user's local system time
@@ -1,61 +1,36 @@
1
- # Feature Implementation Process: CLI-driven
1
+ # Feature Implementation Process: Docs-first
2
2
 
3
- This document defines the **only rule** for adding a new Feature.
4
- As an agent, do not trust your own judgment—follow the **CLI output** only.
3
+ This guide defines how to start or continue a feature in the Codex-native lee-spec-kit path.
5
4
 
6
5
  ---
7
6
 
8
- ## 🔄 The Loop (repeat forever)
9
-
10
- Repeat this loop until the Feature is complete (docs committed).
11
-
12
- ### Step 1: Check context
13
-
14
- Run this command whenever you start work or finish a step:
15
-
16
- ```bash
17
- npx lee-spec-kit context
18
- ```
19
-
20
- ### Step 2: Execute one option only (Next Options)
21
-
22
- Read `👉 Next Options (Atomic)`, choose exactly one option (`A/B/C`), and execute **only that option**.
23
- For gated actions, proceed only after the user replies in **`<label>` or `<label> OK` format** (e.g. `A`, `A OK`).
24
-
25
- - If the CLI indicates **Review**, share the document with the user and stop.
26
- - If the CLI asks for writing a file, write that file and follow the format.
27
- - If the CLI prints a command, **copy/paste and run it exactly**. (It may include repo-safe `git -C ...` commands and scopes like `project` vs `docs`.)
28
- - When requesting approval, present labels as `A: ...` using the exact CLI detail/cmd text. Do not paraphrase command options.
29
- - For approved command options, default to one-shot execution via `npx lee-spec-kit flow <slug|F001|F001-slug> --approve <LABEL> --execute` to avoid session mismatch.
30
-
31
- ### Step 3: Repeat
32
-
33
- After completing the action, go back to Step 1 and run `context` again.
34
-
35
- ---
36
-
37
- ## 🛑 Strict rules
38
-
39
- 1. **Do not jump ahead**: Never do “Plan” when the CLI says “Spec”.
40
- 2. **Do not skip**: Do not fake issue numbers/statuses to advance steps.
41
- 3. **No self-judgment**: If unsure, run `context` again.
42
-
43
- > Note: the workflow steps may change over time. Do not memorize step numbers.
44
- > Treat `context` output as the SSOT.
45
-
46
- ---
47
-
48
- ## Getting started
49
-
50
- If the Feature folder does not exist yet:
51
-
52
- - If the user's request includes an explicit Idea ref such as `I001`, `I001-slug`, or `docs/ideas/...`, preserve that ref and create the feature with `npx lee-spec-kit feature <name> --idea <ref>`.
53
- - Do not infer an Idea ref. Use `--idea` only when the request explicitly names one.
54
-
55
- ```bash
56
- # 1) Create the folder
57
- npx lee-spec-kit feature <name> -d "<description>"
58
-
59
- # 2) Enter the loop
60
- npx lee-spec-kit context
61
- ```
7
+ ## Start
8
+
9
+ 1. Run `npx lee-spec-kit detect --json`.
10
+ 2. If detected, read `npx lee-spec-kit docs get agents --json` and any unread follow-up docs.
11
+ 3. If the feature folder does not exist yet:
12
+ - preserve an explicit Idea ref only when the user actually named one (`I001`, `I001-slug`, or `docs/ideas/...`)
13
+ - create the feature with `npx lee-spec-kit feature <name> --idea <ref>` only for that explicit ref
14
+ - otherwise create it with `npx lee-spec-kit feature <name> -d "<description>"`
15
+ 4. Resolve the active feature and read its docs: `spec.md`, `plan.md`, `tasks.md`, `decisions.md`.
16
+ 5. Run `npx lee-spec-kit workflow-stage <feature-ref> --json` before taking the next workflow action.
17
+
18
+ ## Working Rules
19
+
20
+ - Docs are the SSOT. Follow the active feature docs directly.
21
+ - Progress through the documented stages directly:
22
+ - `spec.md` defines scope and review state
23
+ - `plan.md` defines the implementation approach
24
+ - `tasks.md` drives execution order
25
+ - `issue.md` / `pr.md` are part of the stage gate once the feature reaches GitHub workflow stages
26
+ - Do not begin implementation just because `tasks.md` exists. Implementation starts only when `workflow-stage --json` allows it.
27
+ - When scope or behavior changes, update the active feature docs in the same turn before continuing.
28
+ - Ask for approval at documented review checkpoints and before remote or destructive actions.
29
+ - Use `npx lee-spec-kit commit-audit --json` before `git commit` when docs-path validation matters.
30
+ - Use `npx lee-spec-kit workflow-audit --json` before stopping when code or feature docs changed.
31
+
32
+ ## Strict Rules
33
+
34
+ 1. Do not invent issue/PR numbers or status transitions.
35
+ 2. Do not skip required doc updates when scope, behavior, or evidence changed.
36
+ 3. Do not treat unmanaged docs artifacts as the active workflow SSOT until they are normalized into the feature folder or allowlisted.
@@ -8,7 +8,10 @@ Execution-state SSOT is the feature-local `issue.md`.
8
8
  ## Prerequisites
9
9
 
10
10
  - [ ] `spec.md` completed
11
- - [ ] Latest `context --json-compact` checked
11
+ - [ ] `plan.md` completed
12
+ - [ ] `tasks.md` completed and execution-ready
13
+ - [ ] Active feature docs reviewed
14
+ - [ ] `npx lee-spec-kit workflow-stage <feature-ref> --json` says the next stage is issue preparation or issue creation
12
15
 
13
16
  ---
14
17
 
@@ -38,9 +41,7 @@ Use `issue.md` status (`Draft | Ready`) as the actual workflow state.
38
41
  | Labels | `enhancement`, `bug`, `documentation`, etc. |
39
42
  | Assignee | `@me` (default) |
40
43
 
41
- ### 2. Move to `Ready` (request approval only when context requires it)
42
-
43
- > ⚠️ **Workflow label approval is conditional**
44
+ ### 2. Move to `Ready`
44
45
 
45
46
  Share the `issue.md` draft:
46
47
 
@@ -48,16 +49,13 @@ Share the `issue.md` draft:
48
49
  - Full body draft (from `issue.md`)
49
50
  - Labels
50
51
 
51
- Then re-check the latest `npx lee-spec-kit context --json-compact`.
52
-
53
- - If `approvalRequest.required=true`, show the exact CLI-provided approval lines and wait for a label reply (`A` or `A OK`) before continuing.
54
- - If `approvalRequest.required=false`, do not invent a separate label prompt; refine the draft and set `issue.md` status to `Ready`.
52
+ Refine the draft and set `issue.md` status to `Ready` once the document is complete.
55
53
 
56
54
  ### 3. Create Issue (when `issue.md` is `Ready`)
57
55
 
58
56
  Remote issue creation must use the lee-spec-kit helper.
59
57
  Do not call `gh issue create` directly or pass raw `issue.md` to `--body-file`.
60
- Command-level remote confirmation is still required even when workflow label approval is not:
58
+ Remote confirmation is always required:
61
59
 
62
60
  - share the final title/body/labels with the user
63
61
  - then run the helper with `--confirm OK`
@@ -69,6 +67,7 @@ npx lee-spec-kit github issue F001 --create --confirm OK --labels enhancement
69
67
  After creation:
70
68
  - sync created issue number into `tasks.md`
71
69
  - keep `issue.md` status as `Ready` (creation state is tracked in `tasks.md`)
70
+ - re-run `npx lee-spec-kit workflow-stage <feature-ref> --json` and continue from the returned next stage instead of jumping straight into implementation
72
71
 
73
72
  ---
74
73
 
@@ -76,6 +75,6 @@ After creation:
76
75
 
77
76
  - **Draft generator**: `npx lee-spec-kit github issue <feature-name>`
78
77
  - **Remote creation rule**: must use `npx lee-spec-kit github issue <feature-name> --create --confirm OK --labels ...`
79
- - **Workflow approval rule**: only wait for label approval when `approvalRequest.required=true`
78
+ - **Workflow approval rule**: ask the user for approval before remote issue creation
80
79
  - **Remote confirm rule**: share title/body/labels first, then run `--create --confirm OK`
81
80
  - **Execution-state SSOT**: `docs/features/.../<feature>/issue.md`
@@ -9,6 +9,7 @@ Execution-state SSOT is the feature-local `pr.md`.
9
9
 
10
10
  - [ ] All tasks in `[DONE]` state
11
11
  - [ ] All checkboxes in `tasks.md` "Completion Criteria" are checked
12
+ - [ ] `npx lee-spec-kit workflow-stage <feature-ref> --json` says the next stage is PR preparation or PR creation
12
13
  - [ ] Changes committed
13
14
  - [ ] Branch pushed
14
15
 
@@ -22,7 +23,7 @@ Always run this checklist in Pre-PR review. Treat it as the minimum baseline, th
22
23
  2. Inspect regression, exception handling, critical/security risks, side effects, user flow impact, and release readiness.
23
24
  3. Check maintainability: split oversized functions/files when needed, reuse/integrate existing code where appropriate, and remove obsolete code.
24
25
  4. Judge whether the implementation actually fits the feature intent and scope documented in `spec.md` / `plan.md` / `tasks.md`.
25
- 5. When `workflow.prePrReview.evidenceMode=path_required` (default), run the review agent first, generate `review-trace.json`, then run `npx lee-spec-kit pre-pr-review <feature-ref> --evidence review-trace.json`. In `evidenceMode=any`, direct record mode without `--evidence` is also allowed unless execution evidence is explicitly enforced.
26
+ 5. When `workflow.prePrReview.evidenceMode=path_required` (default), generate a real review artifact such as `review-trace.json` before approval. In `evidenceMode=any`, direct record mode without a separate artifact is also allowed unless execution evidence is explicitly enforced.
26
27
  6. `Pre-PR Evidence` should follow the configured evidence policy. In `path_required`, it must point to a real existing path.
27
28
  7. Record `Summary`, `Feature Intent Summary`, `Implementation Fit`, `Missing Cases`, `Spec Alignment Checked`, `Finding Count`, `Blocking Findings`, `Findings`, and `Residual Risks` with non-placeholder content.
28
29
  8. Use `commandsExecuted` only for optional audit/targeted verification that you actually chose to run during review.
@@ -145,9 +146,7 @@ echo \"![](https://github.com/${REPO}/releases/download/${TAG}/ui-1.png)\"
145
146
  - Write a Mermaid **`sequenceDiagram`** in the PR body and keep it aligned with the generated body template format.
146
147
  - Apply this rule based on change type (logic/structure), not by frontend/backend classification.
147
148
 
148
- ### 4. Move to `Ready` (request approval only when context requires it)
149
-
150
- > ⚠️ **Workflow label approval is conditional**
149
+ ### 4. Move to `Ready`
151
150
 
152
151
  Before creating the PR, share the following **in a code block**:
153
152
 
@@ -155,18 +154,13 @@ Before creating the PR, share the following **in a code block**:
155
154
  - Full body template (from `pr.md`)
156
155
  - Labels (at least 1; cannot be empty)
157
156
 
158
- Then re-check the latest `npx lee-spec-kit context --json-compact`.
159
-
160
- - If `approvalRequest.required=true`, wait for the exact CLI-provided `<LABEL>` or `<LABEL> OK` reply.
161
- - If `approvalRequest.required=false`, do not invent a separate label prompt.
162
-
163
157
  Before moving on, refine `pr.md` Changes/Tests sections based on actual work and set `pr.md` status to `Ready`.
164
158
 
165
159
  ### 5. Create PR (when `pr.md` is `Ready`)
166
160
 
167
161
  Remote PR creation must use the lee-spec-kit helper.
168
162
  Do not call `gh pr create` directly or pass raw `pr.md` to `--body-file`.
169
- Command-level remote confirmation is still required even when workflow label approval is not:
163
+ Remote confirmation is always required:
170
164
 
171
165
  - share the final title/body/labels with the user
172
166
  - then run the helper with `--confirm OK`
@@ -179,6 +173,7 @@ After creation:
179
173
  - record created PR link into `tasks.md`
180
174
  - record/keep PR status as `Review`
181
175
  - keep `pr.md` status as `Ready` (creation/merge state is tracked by `tasks.md` PR/PR Status)
176
+ - re-run `npx lee-spec-kit workflow-stage <feature-ref> --json` and continue from the returned review/merge stage
182
177
 
183
178
  ---
184
179
 
@@ -221,6 +216,6 @@ Use **current branch name** for file links in PR body:
221
216
 
222
217
  - **Body template generator**: `npx lee-spec-kit github pr <feature-name>`
223
218
  - **Remote creation rule**: must use `npx lee-spec-kit github pr <feature-name> --create --confirm OK --labels ...`
224
- - **Workflow approval rule**: only wait for label approval when `approvalRequest.required=true`
219
+ - **Workflow approval rule**: ask the user for approval before remote PR creation or merge
225
220
  - **Remote confirm rule**: share title/body/labels first, then run `--create --confirm OK`
226
221
  - **Execution-state SSOT**: `docs/features/.../<feature>/pr.md`
@@ -1,111 +1,50 @@
1
- # Task Execution Process: CLI-driven
1
+ # Task Execution Process: Docs-first
2
2
 
3
- This document defines the **only rule** for executing tasks.
4
- As an agent, follow `npx lee-spec-kit context` as the single source of truth.
3
+ Use the active feature folder as the execution SSOT.
5
4
 
6
5
  ---
7
6
 
8
- ## 🔄 The Loop (repeat forever)
7
+ ## 1. Pick the current task
9
8
 
10
- Repeat this loop until the Feature is complete.
9
+ - Before touching code, run `npx lee-spec-kit workflow-stage <feature-ref> --json`.
10
+ - Only continue if it reports `stage === "implementation"` and `implementationAllowed === true`.
11
+ - Resolve the active feature first.
12
+ - In `tasks.md`, either:
13
+ - continue the single `[DOING]` task, or
14
+ - move the next highest-priority `[TODO]` task to `[DOING]`
15
+ - Work one task at a time. Do not batch-complete multiple tasks in one pass.
11
16
 
12
- ### Step 1: Check context
17
+ ## 2. Execute and record
13
18
 
14
- ```bash
15
- npx lee-spec-kit context
16
- ```
19
+ - Keep `tasks.md` aligned with reality:
20
+ - do not mark `[DONE]` without real completion and verification
21
+ - update `Acceptance` and `Checklist` in the same edit when closing a task
22
+ - if a completed task needs follow-up, add a new task instead of rewriting history
23
+ - If you need to add a new task, prefer `npx lee-spec-kit task add <feature-ref> --title "..." --ref NON-PRD|PRD-*`.
24
+ - Do not leave placeholder `Acceptance` or `Checklist` items in newly added tasks.
17
25
 
18
- ### Step 2: Do the next action only
26
+ ## 3. Keep docs in sync
19
27
 
20
- Execute exactly one option from `👉 Next Options (Atomic)` as printed by the CLI.
28
+ - `spec.md`: update when user-visible scope or acceptance criteria change
29
+ - `plan.md`: update when architecture, file structure, or test strategy changes
30
+ - `decisions.md`: record non-obvious decisions, trade-offs, compatibility behavior, and user-requested behavior changes
31
+ - If `Pending Change Request` is present, sync `tasks.md` first, then update supporting docs and clear the field before resuming implementation
21
32
 
22
- - If the CLI points to an active task, focus on that task only.
23
- - Treat task state transitions in `tasks.md` **"Task Rules"** as SSOT.
24
- - Treat `approvalRequest.required` from `context --json-compact` as SSOT for approval waiting (`--json` only when full-detail debugging fields are required).
25
- - `false`: continue without label approval.
26
- - `true`: wait for label-token approval (`A`, `A OK`) before execution.
27
- - Default execution model is **main-agent orchestration + sub-agent-first execution for sub-agent-owned run states**. Use `matchedFeature.currentSubstateId/currentSubstateOwner/currentSubstatePhase` from `context --json-compact` as the execution-state SSOT when present.
28
- - Main agent owns approval boundaries, state transitions, record/commit steps, and remote operations. Sub-agent execution is the default for command substates owned by `subagent` (for example `task_run`, `pre_pr_review_run`, `code_review_run`, and auto-run handoff commands).
29
- - `pre_pr_review` is split into `pre_pr_review_run` (sub-agent review execution) and `pre_pr_review_record` (main-agent recording of evidence/results).
30
- - PR review follows the same pattern: `code_review_run` is the sub-agent review/fix execution state, and the merge/push/final decision stays in the main-agent finalize state.
31
- - Prefer `matchedFeature.currentSubstateOwner` plus `agentOrchestration.subAgentHandoff` as the delegation SSOT.
32
- - When `matchedFeature.currentSubstateOwner="subagent"` and `agentOrchestration.subAgentHandoff.required=true` with `mode="command"`, delegation is mandatory: call `spawn_agent` first and do not execute the command directly from the main agent.
33
- - Do not delegate auto loops from `autoRun.available` alone. Delegate auto loops only when `agentOrchestration.subAgentHandoff.required=true` and `agentOrchestration.subAgentHandoff.mode="auto_run"`.
34
- - Use `agentOrchestration.subAgentHandoff` as the minimal handoff contract (`featureRef`, `category`, `cwd`, `cmd`).
35
- - If an action option exposes `handoffOnly=true` and `advancesWorkflow=false`, do not treat `--execute` success as workflow progress. Finish the delegated work and update the required evidence/state before running `context` again.
36
- - Run `subAgentHandoff.verify.commands` only once per session using `verify.cacheKey` (`pwd`, `git rev-parse --show-toplevel`). Stop/report on mismatch, and gather detailed logs only when mismatch happens.
37
- - Main-agent fallback is allowed only when sub-agent execution is unavailable (for example: tool not available, spawn failed, or sub-agent failed before command execution). Before fallback execution, report a one-line fallback reason to the user.
38
- - Use `autoRun.command` only when `context --json-compact` exposes `autoRun.available=true`.
39
- - If `autoRun.policyEligible=true` but `autoRun.executableNow=false`, handle `autoRun.manualBoundary` first instead of starting an auto loop.
40
- - For long-running auto execution, start with `flow <feature> --auto-... --start-auto --json-compact` and prefer `autoRun.run.resumeCommand` (`flow --resume <RUN_ID>`) after interruption/compression (`--json` only when full-detail debugging fields are required).
41
- - If auto execution stops, treat `autoRun.resume` from `flow --json-compact` (or `flow --json`) as SSOT. After interruption/compression, resume with `autoRun.resume.flowCommand`; if needed, check current state first with `autoRun.resume.contextCommand`.
42
- - Treat `AUTO_DELEGATED_HANDOFF` as a delegated pause, not a crash. Reuse the delegated run path and continue the delegated work before asking for a fresh approval label.
43
- - Treat `AUTO_MANUAL_REQUIRED` as an automation boundary (instruction-only segment), not an immediate crash. Re-check `context --json-compact` and report whether `approvalRequest.required` is now true.
44
- - Treat `AUTO_SELECTION_REQUIRED` as a feature-selection pause, not a crash. Resolve the active feature first, then rerun `context --json-compact` or `flow`.
45
- - If `matchedFeature.currentSubstateId === "change_request_sync"` or `matchedFeature.pendingChangeRequest` is present, sync docs before more code work: update `tasks.md` first, add or retag the affected task, and if shipped behavior or scope changed, sync `decisions.md` plus `spec.md` / PRD refs as needed. Clear `Pending Change Request` after syncing, then rerun `context --json-compact` or `flow`.
46
- - If the CLI prints commands, copy/paste them. (In standalone setups commands may include `git -C ...` and scopes like `project`/`docs`.)
47
- - Follow `agents.md` **"Label Response Contract (SSOT)"**. Show label prompts only in approval-waiting state, and reuse the exact CLI-provided approval lines instead of paraphrasing them.
48
- - If you answer a side question while `approvalRequest.required=true`, answer first, then briefly restate `matchedFeature.currentSubstateId/currentSubstateOwner/currentSubstatePhase` when available and re-show the exact CLI approval lines before waiting again.
49
- - For non-delegated command options, default to `npx lee-spec-kit flow <slug|F001|F001-slug> --approve <LABEL> --execute` and avoid split `context --approve` / `context --execute --ticket` runs across turns.
50
- - If the current command is delegated (`matchedFeature.currentSubstateOwner="subagent"` and `agentOrchestration.subAgentHandoff.required=true` with `mode="command"`), call `spawn_agent` first and pass the handoff contract instead of executing that command from the main agent.
51
- - If `flow/context --execute --json` returns `approved_handoff_prepared`, stop re-approving the same label. Complete the delegated work first, then refresh context.
33
+ ## 4. Commit and stop guardrails
52
34
 
53
- ### Step 3: Update tasks.md (only what you did)
35
+ - Before `git commit`, use `npx lee-spec-kit commit-audit --json` when docs-path validation matters.
36
+ - Before stopping, use `npx lee-spec-kit workflow-audit --json` if code or feature docs changed.
37
+ - Keep one row per test command in the `tasks.md` test log and update that row on reruns instead of appending duplicates.
54
38
 
55
- Keep `tasks.md` aligned with reality.
39
+ ## 5. Approval boundaries
56
40
 
57
- - Do not mark `[DONE]` without actually completing the work and verifying criteria.
58
- - If you need to change a completed task, add a new task instead of rewriting history.
59
- - If you need to add a new task, prefer `npx lee-spec-kit task add <feature-ref> --title "..." --ref NON-PRD|PRD-*`. Use an existing PRD key such as `PRD-FR-001` or `PRD-SCOPE-V1-DESKTOP-EDITOR`. Add `--acceptance` and `--check` inline when you already know the concrete items.
60
- - Do not leave placeholder `Acceptance` / `Checklist` items in a newly added task. `task-run` will block until those fields contain concrete execution/verification items.
61
- - If manual editing is unavoidable, append the new task directly below the last existing task block in the `Task List` section.
62
- - Do not insert it near the current task or right before `Completion Criteria` / the next `##` heading.
63
- - When handling a mid-implementation user change request, treat `Pending Change Request` as a temporary sync marker: reflect the request in `tasks.md`, sync supporting docs if the behavior/scope changed, then clear that field before resuming implementation.
41
+ - Ask for approval only at documented review checkpoints and before remote or destructive actions.
42
+ - Before issue creation, PR creation, push, merge, or similar remote actions, share the exact artifact or plan first.
43
+ - Codex may delegate implementation work, but docs updates, approval handling, and remote actions stay with the main session.
64
44
 
65
- ### Step 3.25: Record decisions (strongly recommended, effectively required)
45
+ ## Strict Rules
66
46
 
67
- To avoid “why did we implement it like this?” losing context, **record any non-obvious or tradeoff-heavy implementation choice** in `decisions.md`.
68
-
69
- Record a decision if any of these apply:
70
-
71
- - There was a tradeoff (performance / reliability / security / maintainability)
72
- - You introduced a new rule/heuristic/state transition (e.g., context detection logic, exception criteria)
73
- - The user asked “why did you do it this way?” (requested rationale/justification)
74
- - The user explicitly asked to change behavior (requirements/policy/criteria changes)
75
- - You changed behavior for compatibility or as a workaround
76
- - You changed data shape, file structure, or CLI output rules
77
- - You expect future readers to ask “why this way?”
78
-
79
- Timing rules:
80
-
81
- - When moving a task to `[DOING]`, first add 1-3 lines for `Context/Constraints` and `Trace (initial hypothesis)`.
82
- - Before moving a task to `[DONE]`, finalize `Options/Decision/Rationale` and strengthen `Trace (final reasoning)`.
83
- - After PR merge, append 1-2 lines in `Trace (post-merge check)` with actual outcome/impact.
84
-
85
- Evidence rules:
86
-
87
- - Every ADR must include at least one Evidence link (commit, PR, or test/log evidence).
88
- - Prefer filling all three (`Commit`, `PR`, `Test/Log`); if not applicable, mark as `N/A`.
89
-
90
- Use the feature’s `decisions.md` template format as final SSOT. (Context/Constraints/Options/Decision/Rationale/Trace/Evidence/Consequences)
91
-
92
- ### Step 3.5: Commit per task (important)
93
-
94
- - Complete **only one task at a time** (do not batch-finish multiple tasks in one commit).
95
- - After you share the outcome/verification, mark the task `[DONE]` and update the task-local checklist items in the same edit. `task-complete` will reject `[DONE]` if unchecked checklist boxes remain. If approval is required (`approvalRequest.required=true`), reuse the exact CLI-provided approval lines and wait for a `<LABEL>` or `<LABEL> OK` reply first. If approval is not required, do not invent a separate approval prompt before marking `[DONE]`.
96
- - In `tasks.md` test logs, keep one entry per test command and update its date/result on reruns (do not keep appending duplicates). Use `YYYY-MM-DD` in local date.
97
- - If `context` shows `[CHECK required]`, for commits/push/merge, **share the commit message + included files and wait for the latest CLI-provided label reply** before running the commands.
98
- - Once all tasks are `[DONE]`, share the "Completion Criteria" checklist with the user. If that point is approval-waiting, get a `<LABEL>` or `<LABEL> OK` reply before checking it; otherwise get a normal confirmation reply. (especially the final outcome/user confirmation item).
99
- - Note: both progress approval and final approval must follow the current `approvalRequest.required` state. When approval is label-gated, always use label replies instead of standalone `OK` as the approval token.
100
-
101
- ### Step 4: Repeat
102
-
103
- After finishing a meaningful chunk of work, run `context` again.
104
-
105
- ---
106
-
107
- ## 🛑 Strict rules
108
-
109
- 1. **No skipping**: Never “finish” tasks by editing status only.
110
- 2. **No jumping ahead**: If the CLI is waiting for approvals, stop and ask the user.
111
- 3. **No rewriting history**: Do not modify `[DONE]` tasks; add a new one.
47
+ 1. Do not skip required doc updates.
48
+ 2. Do not rewrite `[DONE]` tasks.
49
+ 3. Do not treat unmanaged docs artifacts as active workflow state until they are normalized or allowlisted.
50
+ 4. Do not start implementation while the workflow is still blocked on issue creation, branch creation, or any earlier stage gate.
@@ -106,7 +106,7 @@ When a feature is already in progress, treat those files as staging/reference ar
106
106
 
107
107
  - If the extra docs entry is intentional, add it to `.lee-spec-kit.json` `allowedDocsEntries`
108
108
  - If it is a planning/reference artifact, normalize it before continuing active feature execution
109
- - If `context` surfaces `docs_normalize`, handle that step first
109
+ - `commit-audit` blocks staged unmanaged or non-canonical feature docs until they are normalized or allowlisted
110
110
 
111
111
  - Move user-facing scope and acceptance criteria into `spec.md`
112
112
  - Move architecture/file structure/test strategy into `plan.md`