lee-spec-kit 0.7.10 → 0.8.0

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 (37) hide show
  1. package/README.en.md +32 -53
  2. package/README.md +32 -53
  3. package/dist/bootstrap-ZIJP7O72.js +5 -0
  4. package/dist/bootstrap-ZIJP7O72.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-RYSDBL6X.js +250 -0
  10. package/dist/chunk-RYSDBL6X.js.map +1 -0
  11. package/dist/hooks-IP6FICAV.js +1004 -0
  12. package/dist/hooks-IP6FICAV.js.map +1 -0
  13. package/dist/index.js +4133 -15418
  14. package/dist/index.js.map +1 -1
  15. package/package.json +2 -2
  16. package/templates/en/common/README.md +15 -11
  17. package/templates/en/common/agents/agents.md +31 -85
  18. package/templates/en/common/agents/skills/create-feature.md +30 -57
  19. package/templates/en/common/agents/skills/create-issue.md +5 -10
  20. package/templates/en/common/agents/skills/create-pr.md +4 -11
  21. package/templates/en/common/agents/skills/execute-task.md +32 -92
  22. package/templates/en/common/features/README.md +4 -3
  23. package/templates/en/common/features/feature-base/spec.md +1 -1
  24. package/templates/en/common/features/feature-base/tasks.md +11 -8
  25. package/templates/en/common/ideas/README.md +2 -2
  26. package/templates/en/common/prd/README.md +2 -2
  27. package/templates/ko/common/README.md +15 -11
  28. package/templates/ko/common/agents/agents.md +30 -83
  29. package/templates/ko/common/agents/skills/create-feature.md +30 -58
  30. package/templates/ko/common/agents/skills/create-issue.md +5 -10
  31. package/templates/ko/common/agents/skills/create-pr.md +4 -11
  32. package/templates/ko/common/agents/skills/execute-task.md +32 -98
  33. package/templates/ko/common/features/README.md +4 -3
  34. package/templates/ko/common/features/feature-base/spec.md +1 -1
  35. package/templates/ko/common/features/feature-base/tasks.md +11 -8
  36. package/templates/ko/common/ideas/README.md +2 -2
  37. package/templates/ko/common/prd/README.md +2 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lee-spec-kit",
3
- "version": "0.7.10",
4
- "description": "Agent-guided development harness CLI for spec-driven projects",
3
+ "version": "0.8.0",
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,21 +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
- - Determine approval waiting only from the latest `context --json-compact` / `flow --json-compact`.
20
- - When `approvalRequest.required=true`, show `approvalPrompt`/`finalPrompt` exactly as provided and wait for user approval (`<LABEL>` or `<LABEL> OK`) before execution.
21
- - 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.
22
24
  - If `isLeeSpecKitProject: false`, skip lee-spec-kit-specific flow and continue with normal workflow.
23
25
 
24
26
  ## New Project Start Order
25
27
 
26
28
  - Scaffold the code project first (for example Next.js/NestJS), then run `lee-spec-kit init`.
27
29
  - After that, write top-level requirements in `docs/prd/`, then continue with `idea` and `feature`.
28
- - 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.
29
31
  - In most cases (default: embedded), the steps above are all you need.
30
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`)
31
33
 
@@ -53,17 +55,17 @@ Recommended flow:
53
55
 
54
56
  - **PRD (`docs/prd/`)**: requirements SSOT
55
57
  - This top-level space is created by `init`; PRD is edited directly here rather than generated by a separate CLI step.
56
- - Assign stable IDs per requirement: `PRD-FR-001`, `PRD-US-002`, `PRD-NFR-003`
58
+ - Assign stable `PRD-*` IDs per requirement: numeric IDs like `PRD-FR-001`, `PRD-US-002`, `PRD-NFR-003` or semantic keys like `PRD-SCOPE-V1-DESKTOP-EDITOR`
57
59
  - Keep IDs stable (prefer marking as Deprecated over deleting; do not renumber).
58
60
  - Define PRD IDs in the PRD source first. Do not invent them inside feature docs.
59
61
  - **Ideas (`docs/ideas/`)**: pre-Feature SSOT (hypotheses/experiments/candidates)
60
62
  - Ideas usually start from PRD requirements and should keep `PRD Refs` when applicable.
61
- - Put `PRD Refs:` at the top (example: `PRD-FR-001, PRD-US-002`).
63
+ - Put `PRD Refs:` at the top (example: `PRD-FR-001, PRD-US-002` or `PRD-SCOPE-V1-DESKTOP-EDITOR`).
62
64
  - Once promoted, the SSOT moves to `docs/features/` and the idea should be archived.
63
65
  - **Features (`docs/features/`)**: implementation scope/progress SSOT
64
66
  - Features are the executable units that come after PRD and idea refinement.
65
67
  - `spec.md`: scope + `PRD Refs` (the PRD IDs this feature covers)
66
- - `tasks.md`: map each task line to PRD IDs via bracket tags like `[PRD-FR-001]`, or tag non-PRD tasks as `[NON-PRD]`
68
+ - `tasks.md`: map each task line to PRD IDs via bracket tags like `[PRD-FR-001]` or `[PRD-SCOPE-V1-DESKTOP-EDITOR]`, or tag non-PRD tasks as `[NON-PRD]`
67
69
  - Use `[NON-PRD]` only for internal work such as refactors, renames, tooling, tests, and cleanup.
68
70
  - If a task changes user-facing behavior, acceptance criteria, or feature scope, backfill PRD first and tag the task as `[PRD-...]` instead of leaving it as `[NON-PRD]`.
69
71
  - For legacy docs without PRD IDs yet, backfill the source requirements doc first, then link the feature docs.
@@ -75,7 +77,7 @@ Recommended flow:
75
77
  - **Unmanaged docs entries**: any top-level docs entry outside the canonical surface
76
78
  - Examples: `docs/plans/`, `docs/superpowers/`, or another skill-created folder
77
79
  - Treat them as staging/reference inputs only, not the active workflow SSOT
78
- - 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
79
81
  - Normalize them into feature-local docs:
80
82
  - design/spec artifact → `spec.md`, `plan.md`, `decisions.md`
81
83
  - implementation plan artifact → `plan.md`, `tasks.md`
@@ -115,7 +117,9 @@ When you run `lee-spec-kit init`, it creates `.lee-spec-kit.json` in the docs ro
115
117
  - `docsRepo` ("embedded" | "standalone"): How docs are managed
116
118
  - `pushDocs` (boolean, optional): Only written when `docsRepo: "standalone"` (whether to push to remote)
117
119
  - `docsRemote` (string, optional): Only written when `pushDocs: true` (remote repo URL)
118
- - `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.
119
123
  - Current default:
120
124
  - `mode: "category"`
121
125
  - `default: "skip"`
@@ -1,103 +1,49 @@
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 `context --json-compact` (or `context --json`) exposes executable `actionOptions[]` and you are explicitly waiting for user approval.
42
- - 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).
43
- - When using auto results from `flow --json-compact` (or `flow --json`), treat `autoRun.resume.flowCommand` as SSOT for resume (including after context compression/reset).
44
- - 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.
45
- - 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).
46
- - In approval-waiting state, 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.
47
- - Prefer `matchedFeature.currentSubstateOwner` plus `agentOrchestration.subAgentHandoff` as the delegation SSOT.
48
- - In non-approval state, do not append labels or `approvalRequest.finalPrompt` unless the user explicitly asked for current options.
49
- - If approval is still pending after answering an unrelated question, answer first, then re-open approval with the exact CLI-provided approval lines (`approvalRequest.userFacingLines`, or `actionOptions[*].approvalPrompt` + `approvalRequest.finalPrompt` in full `--json`).
50
- - If user input does not contain a valid label, do not execute; request label selection again.
51
- - For non-delegated command options, prefer one-shot `flow --approve <LABEL> --execute`; do not split `context --approve` and `context --execute --ticket` across turns/sessions.
52
- - 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.
53
- - 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.
54
- - Do not delegate auto loops from `autoRun.available` alone. Delegate auto loops only when `agentOrchestration.subAgentHandoff.required=true` and `agentOrchestration.subAgentHandoff.mode="auto_run"`.
55
- - Prefer `agentOrchestration.subAgentHandoff` as the handoff SSOT. Pass only its minimal fields (`featureRef`, `category`, `cwd`, `cmd`) to the sub-agent.
56
- - 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.
57
- - 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).
58
- - 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`.
59
26
 
60
- Approval-waiting output must reuse the exact CLI-provided prompt lines. Do not invent a custom wrapper such as `Current status:` / `Available labels:` if the CLI did not provide those lines.
27
+ ## Execution Rules
61
28
 
62
- ---
63
-
64
- ## 📚 Built-in Docs Read Policy (MUST)
29
+ - lee-spec-kit owns docs structure, workflow stages, and validators.
30
+ - Codex owns the execution loop, tool usage, and hook lifecycle.
31
+ - Keep docs synced with code changes in the same turn whenever behavior or scope changes.
32
+ - Use `npx lee-spec-kit commit-audit --json` before `git commit` when staged docs paths need validation.
33
+ - Use `npx lee-spec-kit workflow-audit --json` as the default end-of-turn docs sync check.
65
34
 
66
- - Use `docs get` once per session start (or right after context compression/reset).
67
- - Do not re-read the same doc again in the same session.
68
- - From `requiredDocs[*].command`, fetch only docs not yet read in this session.
69
- - You may re-read only when:
70
- - user explicitly asks for policy refresh
71
- - policy/config changed (for example after `update`)
72
- - session restarted or context was compressed/reset
35
+ ## Approval Rules
73
36
 
74
- ---
75
-
76
- ## Required References
77
-
78
- - Highest-priority custom rules: `/docs/agents/custom.md`
79
- - Project principles: `/docs/agents/constitution.md`
80
- - Root guide: `npx lee-spec-kit docs get agents --json`
81
- - Git workflow: `npx lee-spec-kit docs get git-workflow --json`
82
- - Task execution: `npx lee-spec-kit docs get execute-task --json`
83
- - Issue procedure/doc: `npx lee-spec-kit docs get create-issue --json` → `npx lee-spec-kit docs get issue-doc --json`
84
- - PR procedure/doc: `npx lee-spec-kit docs get create-pr --json` → `npx lee-spec-kit docs get pr-doc --json`
85
-
86
- ---
87
-
88
- ## Scope Split
89
-
90
- - Docs structure/path rules: use `docs/README.md` as SSOT
91
- - 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.
92
- - 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.
93
- - If `context` surfaces a `docs_normalize` action/category, complete that normalization step before continuing implementation or workflow actions.
94
- - ADR format: use feature `decisions.md` template as SSOT
95
- - Issue/PR execution state: use each feature's `issue.md` and `pr.md` as SSOT
37
+ | Current action (examples) | What to share |
38
+ | --- | --- |
39
+ | Issue creation | Before `npx lee-spec-kit github issue <featureRef> --create` |
40
+ | PR creation | Before `npx lee-spec-kit github pr <featureRef> --create` |
96
41
 
97
- ---
42
+ - Ask the user for approval at documented workflow checkpoints and before remote or destructive actions.
43
+ - Share the exact artifact or plan before remote GitHub actions.
98
44
 
99
- ## Language / Formatting Rules
45
+ ## Formatting Rules
100
46
 
101
- - Replies: English (or project language policy in `custom.md`)
102
- - Code/file names: English
103
- - Date/time: use user's local system time
47
+ - Replies: English unless project policy overrides it
48
+ - Code and filenames: English
49
+ - Dates and times: use the user's local system time
@@ -1,61 +1,34 @@
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
+
17
+ ## Working Rules
18
+
19
+ - Docs are the SSOT. Follow the active feature docs directly.
20
+ - Progress through the documented stages directly:
21
+ - `spec.md` defines scope and review state
22
+ - `plan.md` defines the implementation approach
23
+ - `tasks.md` drives execution order
24
+ - `issue.md` / `pr.md` are used only when the feature reaches GitHub workflow stages
25
+ - When scope or behavior changes, update the active feature docs in the same turn before continuing.
26
+ - Ask for approval at documented review checkpoints and before remote or destructive actions.
27
+ - Use `npx lee-spec-kit commit-audit --json` before `git commit` when docs-path validation matters.
28
+ - Use `npx lee-spec-kit workflow-audit --json` before stopping when code or feature docs changed.
29
+
30
+ ## Strict Rules
31
+
32
+ 1. Do not invent issue/PR numbers or status transitions.
33
+ 2. Do not skip required doc updates when scope, behavior, or evidence changed.
34
+ 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,7 @@ 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
+ - [ ] Active feature docs reviewed
12
12
 
13
13
  ---
14
14
 
@@ -38,9 +38,7 @@ Use `issue.md` status (`Draft | Ready`) as the actual workflow state.
38
38
  | Labels | `enhancement`, `bug`, `documentation`, etc. |
39
39
  | Assignee | `@me` (default) |
40
40
 
41
- ### 2. Move to `Ready` (request approval only when context requires it)
42
-
43
- > ⚠️ **Workflow label approval is conditional**
41
+ ### 2. Move to `Ready`
44
42
 
45
43
  Share the `issue.md` draft:
46
44
 
@@ -48,16 +46,13 @@ Share the `issue.md` draft:
48
46
  - Full body draft (from `issue.md`)
49
47
  - Labels
50
48
 
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`.
49
+ Refine the draft and set `issue.md` status to `Ready` once the document is complete.
55
50
 
56
51
  ### 3. Create Issue (when `issue.md` is `Ready`)
57
52
 
58
53
  Remote issue creation must use the lee-spec-kit helper.
59
54
  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:
55
+ Remote confirmation is always required:
61
56
 
62
57
  - share the final title/body/labels with the user
63
58
  - then run the helper with `--confirm OK`
@@ -76,6 +71,6 @@ After creation:
76
71
 
77
72
  - **Draft generator**: `npx lee-spec-kit github issue <feature-name>`
78
73
  - **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`
74
+ - **Workflow approval rule**: ask the user for approval before remote issue creation
80
75
  - **Remote confirm rule**: share title/body/labels first, then run `--create --confirm OK`
81
76
  - **Execution-state SSOT**: `docs/features/.../<feature>/issue.md`
@@ -22,7 +22,7 @@ Always run this checklist in Pre-PR review. Treat it as the minimum baseline, th
22
22
  2. Inspect regression, exception handling, critical/security risks, side effects, user flow impact, and release readiness.
23
23
  3. Check maintainability: split oversized functions/files when needed, reuse/integrate existing code where appropriate, and remove obsolete code.
24
24
  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.
25
+ 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
26
  6. `Pre-PR Evidence` should follow the configured evidence policy. In `path_required`, it must point to a real existing path.
27
27
  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
28
  8. Use `commandsExecuted` only for optional audit/targeted verification that you actually chose to run during review.
@@ -145,9 +145,7 @@ echo \"![](https://github.com/${REPO}/releases/download/${TAG}/ui-1.png)\"
145
145
  - Write a Mermaid **`sequenceDiagram`** in the PR body and keep it aligned with the generated body template format.
146
146
  - Apply this rule based on change type (logic/structure), not by frontend/backend classification.
147
147
 
148
- ### 4. Move to `Ready` (request approval only when context requires it)
149
-
150
- > ⚠️ **Workflow label approval is conditional**
148
+ ### 4. Move to `Ready`
151
149
 
152
150
  Before creating the PR, share the following **in a code block**:
153
151
 
@@ -155,18 +153,13 @@ Before creating the PR, share the following **in a code block**:
155
153
  - Full body template (from `pr.md`)
156
154
  - Labels (at least 1; cannot be empty)
157
155
 
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
156
  Before moving on, refine `pr.md` Changes/Tests sections based on actual work and set `pr.md` status to `Ready`.
164
157
 
165
158
  ### 5. Create PR (when `pr.md` is `Ready`)
166
159
 
167
160
  Remote PR creation must use the lee-spec-kit helper.
168
161
  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:
162
+ Remote confirmation is always required:
170
163
 
171
164
  - share the final title/body/labels with the user
172
165
  - then run the helper with `--confirm OK`
@@ -221,6 +214,6 @@ Use **current branch name** for file links in PR body:
221
214
 
222
215
  - **Body template generator**: `npx lee-spec-kit github pr <feature-name>`
223
216
  - **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`
217
+ - **Workflow approval rule**: ask the user for approval before remote PR creation or merge
225
218
  - **Remote confirm rule**: share title/body/labels first, then run `--create --confirm OK`
226
219
  - **Execution-state SSOT**: `docs/features/.../<feature>/pr.md`
@@ -1,107 +1,47 @@
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
+ - Resolve the active feature first.
10
+ - In `tasks.md`, either:
11
+ - continue the single `[DOING]` task, or
12
+ - move the next highest-priority `[TODO]` task to `[DOING]`
13
+ - Work one task at a time. Do not batch-complete multiple tasks in one pass.
11
14
 
12
- ### Step 1: Check context
15
+ ## 2. Execute and record
13
16
 
14
- ```bash
15
- npx lee-spec-kit context
16
- ```
17
+ - Keep `tasks.md` aligned with reality:
18
+ - do not mark `[DONE]` without real completion and verification
19
+ - update `Acceptance` and `Checklist` in the same edit when closing a task
20
+ - if a completed task needs follow-up, add a new task instead of rewriting history
21
+ - If you need to add a new task, prefer `npx lee-spec-kit task add <feature-ref> --title "..." --ref NON-PRD|PRD-*`.
22
+ - Do not leave placeholder `Acceptance` or `Checklist` items in newly added tasks.
17
23
 
18
- ### Step 2: Do the next action only
24
+ ## 3. Keep docs in sync
19
25
 
20
- Execute exactly one option from `👉 Next Options (Atomic)` as printed by the CLI.
26
+ - `spec.md`: update when user-visible scope or acceptance criteria change
27
+ - `plan.md`: update when architecture, file structure, or test strategy changes
28
+ - `decisions.md`: record non-obvious decisions, trade-offs, compatibility behavior, and user-requested behavior changes
29
+ - If `Pending Change Request` is present, sync `tasks.md` first, then update supporting docs and clear the field before resuming implementation
21
30
 
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
- - If the CLI prints commands, copy/paste them. (In standalone setups commands may include `git -C ...` and scopes like `project`/`docs`.)
45
- - 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.
46
- - 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.
47
- - 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.
48
- - If `flow/context --execute --json` returns `approved_handoff_prepared`, stop re-approving the same label. Complete the delegated work first, then refresh context.
31
+ ## 4. Commit and stop guardrails
49
32
 
50
- ### Step 3: Update tasks.md (only what you did)
33
+ - Before `git commit`, use `npx lee-spec-kit commit-audit --json` when docs-path validation matters.
34
+ - Before stopping, use `npx lee-spec-kit workflow-audit --json` if code or feature docs changed.
35
+ - Keep one row per test command in the `tasks.md` test log and update that row on reruns instead of appending duplicates.
51
36
 
52
- Keep `tasks.md` aligned with reality.
37
+ ## 5. Approval boundaries
53
38
 
54
- - Do not mark `[DONE]` without actually completing the work and verifying criteria.
55
- - If you need to change a completed task, add a new task instead of rewriting history.
56
- - If you need to add a new task, prefer `npx lee-spec-kit task add <feature-ref> --title "..." --ref NON-PRD|PRD-FR-001`. Add `--acceptance` and `--check` inline when you already know the concrete items.
57
- - Do not leave placeholder `Acceptance` / `Checklist` items in a newly added task. `task-run` will block until those fields contain concrete execution/verification items.
58
- - If manual editing is unavoidable, append the new task directly below the last existing task block in the `Task List` section.
59
- - Do not insert it near the current task or right before `Completion Criteria` / the next `##` heading.
39
+ - Ask for approval only at documented review checkpoints and before remote or destructive actions.
40
+ - Before issue creation, PR creation, push, merge, or similar remote actions, share the exact artifact or plan first.
41
+ - Codex may delegate implementation work, but docs updates, approval handling, and remote actions stay with the main session.
60
42
 
61
- ### Step 3.25: Record decisions (strongly recommended, effectively required)
43
+ ## Strict Rules
62
44
 
63
- To avoid “why did we implement it like this?” losing context, **record any non-obvious or tradeoff-heavy implementation choice** in `decisions.md`.
64
-
65
- Record a decision if any of these apply:
66
-
67
- - There was a tradeoff (performance / reliability / security / maintainability)
68
- - You introduced a new rule/heuristic/state transition (e.g., context detection logic, exception criteria)
69
- - The user asked “why did you do it this way?” (requested rationale/justification)
70
- - The user explicitly asked to change behavior (requirements/policy/criteria changes)
71
- - You changed behavior for compatibility or as a workaround
72
- - You changed data shape, file structure, or CLI output rules
73
- - You expect future readers to ask “why this way?”
74
-
75
- Timing rules:
76
-
77
- - When moving a task to `[DOING]`, first add 1-3 lines for `Context/Constraints` and `Trace (initial hypothesis)`.
78
- - Before moving a task to `[DONE]`, finalize `Options/Decision/Rationale` and strengthen `Trace (final reasoning)`.
79
- - After PR merge, append 1-2 lines in `Trace (post-merge check)` with actual outcome/impact.
80
-
81
- Evidence rules:
82
-
83
- - Every ADR must include at least one Evidence link (commit, PR, or test/log evidence).
84
- - Prefer filling all three (`Commit`, `PR`, `Test/Log`); if not applicable, mark as `N/A`.
85
-
86
- Use the feature’s `decisions.md` template format as final SSOT. (Context/Constraints/Options/Decision/Rationale/Trace/Evidence/Consequences)
87
-
88
- ### Step 3.5: Commit per task (important)
89
-
90
- - Complete **only one task at a time** (do not batch-finish multiple tasks in one commit).
91
- - 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]`.
92
- - 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.
93
- - 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.
94
- - 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).
95
- - 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.
96
-
97
- ### Step 4: Repeat
98
-
99
- After finishing a meaningful chunk of work, run `context` again.
100
-
101
- ---
102
-
103
- ## 🛑 Strict rules
104
-
105
- 1. **No skipping**: Never “finish” tasks by editing status only.
106
- 2. **No jumping ahead**: If the CLI is waiting for approvals, stop and ask the user.
107
- 3. **No rewriting history**: Do not modify `[DONE]` tasks; add a new one.
45
+ 1. Do not skip required doc updates.
46
+ 2. Do not rewrite `[DONE]` tasks.
47
+ 3. Do not treat unmanaged docs artifacts as active workflow state until they are normalized or allowlisted.
@@ -65,8 +65,8 @@ npx lee-spec-kit status --write
65
65
 
66
66
  ## PRD Requirement Traceability (Recommended)
67
67
 
68
- - Assign stable requirement IDs in PRD docs (`docs/prd/*.md`) like `PRD-FR-001`.
69
- - Link each task line in `tasks.md` with a tag like `[PRD-FR-001]`. For non-PRD tasks, use `[NON-PRD]`.
68
+ - Assign stable `PRD-*` requirement IDs in PRD docs (`docs/prd/*.md`) like `PRD-FR-001` or `PRD-SCOPE-V1-DESKTOP-EDITOR`.
69
+ - Link each task line in `tasks.md` with a tag like `[PRD-FR-001]` or `[PRD-SCOPE-V1-DESKTOP-EDITOR]`. For non-PRD tasks, use `[NON-PRD]`.
70
70
  - Use `[NON-PRD]` only for internal implementation work such as refactors, test-only work, tooling, renames, and cleanup.
71
71
  - If a change affects user-facing behavior, acceptance criteria, or scope, update PRD first and retag the task as `[PRD-...]`.
72
72
  - Do not invent PRD IDs inside feature docs. Define them in the PRD source first, and backfill legacy docs before linking tasks.
@@ -79,6 +79,7 @@ npx lee-spec-kit status --write
79
79
  When things change mid-work, it must be explicit what was updated.
80
80
 
81
81
  - Record changes as **new tasks** (do not edit `[DONE]` tasks; create a new task instead).
82
+ - During that sync, `tasks.md` may temporarily carry `Pending Change Request` as an internal marker. Clear it after the request is reflected in the new task(s) and related docs.
82
83
  - Every change task must be tagged as `[PRD-...]` or `[NON-PRD]`. (Recommended: also add `[CHANGE]`.)
83
84
  - If a change starts as internal exploration but ends up changing user-visible behavior, do not leave it as `[NON-PRD]`.
84
85
  - Backfill/update `docs/prd/*.md`
@@ -105,7 +106,7 @@ When a feature is already in progress, treat those files as staging/reference ar
105
106
 
106
107
  - If the extra docs entry is intentional, add it to `.lee-spec-kit.json` `allowedDocsEntries`
107
108
  - If it is a planning/reference artifact, normalize it before continuing active feature execution
108
- - 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
109
110
 
110
111
  - Move user-facing scope and acceptance criteria into `spec.md`
111
112
  - Move architecture/file structure/test strategy into `plan.md`
@@ -55,7 +55,7 @@
55
55
  ## Related Documents
56
56
 
57
57
  - PRD: `../../prd/`
58
- - PRD Refs: - (e.g. `PRD-FR-001`, `PRD-US-002`)
58
+ - PRD Refs: - (e.g. `PRD-FR-001`, `PRD-US-002`, `PRD-SCOPE-V1-DESKTOP-EDITOR`)
59
59
  - Only list IDs that already exist in the source requirements doc. Do not invent PRD IDs in `spec.md` or `tasks.md`.
60
60
  - If this is a legacy requirements doc without PRD IDs yet, backfill IDs in the source first, then update this field and the `tasks.md` task tags together.
61
61
  - When requirements/scope change, update PRD docs + this field + `tasks.md` task tags together.