ai-spector 0.8.32 → 0.8.33

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-spector",
3
- "version": "0.8.32",
3
+ "version": "0.8.33",
4
4
  "description": "Cursor-first documentation workflow: traceability graph, SRS/basic/detail design templates, and ai-spector CLI",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,43 +1,34 @@
1
1
  ---
2
2
  name: ai-spector-resolve-task
3
3
  description: >-
4
- Conversational task workflow (create task, resolve task): clarify intent, build
5
- GoalSpec + TaskPlan, get approval, then execute via resolve_task MCP or CLI.
6
- Use for create task, add/update requirements, doc edits, prototype changes, or
7
- any multi-step change described in natural language.
4
+ FIRST CHOICE for incremental changes: add feature, add requirement, update section,
5
+ "I want to…", create task. Mandatory: clarify plan explicit yes → execute.
6
+ No graph_impact or edits before approval. Not for full SRS generation — use
7
+ ai-spector-generate-srs for DAG waves.
8
8
  ---
9
9
 
10
10
  # AI Spector — Resolve Task
11
11
 
12
- ## When to use
12
+ ## Plan-first mode
13
13
 
14
- - "create task", "create a task", "new task", "resolve task"
15
- - "add requirement", "update docs", "change prototype", "I want to…", "we need to…"
16
- - Any open-ended doc/graph change that is not a full generate-from-scratch workflow
14
+ **Forbidden before user approves the plan:** `graph_impact`, `index`, `graph_merge`, `resolve_task`, Edit/Write.
17
15
 
18
- ## Workflow
19
-
20
- ```
21
- 1. Receive user intent (do not act yet)
22
- 2. Ask ≤3 clarifying questions → build GoalSpec
23
- 3. Show GoalSpec + TaskPlan → wait for approval
24
- 4. Execute: direct edits + resolve_task MCP (or CLI)
25
- 5. Report state update
26
- ```
27
-
28
- Full runbook: `.cursor/skills/ai-spector-resolve-task/references/runbook.md` (same content after init/sync-cursor).
16
+ **Allowed for discovery only:** `docs_search`, `graph_query_fuzzy`, `graph_query`, Read (structure).
29
17
 
30
- ## Checklist
18
+ ## Workflow
31
19
 
32
20
  ```
33
- - [ ] Clarified intent → GoalSpec (domain, scope, criteria)
34
- - [ ] Showed plan and got user approval
35
- - [ ] Executed steps (edits + resolve_task for index/graph steps)
36
- - [ ] Reported results + state update
21
+ 1. Acknowledge resolve-task workflow
22
+ 2. Clarify (≤3 questions) GoalSpec
23
+ 3. Discover scope (read-only, optional)
24
+ 4. Show GoalSpec + TaskPlan wait for yes
25
+ 5. Execute approved steps (edits + resolve_task)
26
+ 6. Report state update
37
27
  ```
38
28
 
39
- ## MCP
29
+ ## Routing
40
30
 
41
- `resolve_task({ intent, goalSpec, plan, dryRun? })` only after user approves the plan.
31
+ | "I want to add login with Google" | **this skill** |
32
+ | "generate SRS" / "write chapter 4" | `ai-spector-generate-srs` |
42
33
 
43
- CLI fallback: `npx ai-spector resolve-task plan.json`
34
+ Runbook: `.cursor/skills/ai-spector-resolve-task/references/runbook.md`
@@ -90,7 +90,8 @@ Skip impact/index only when the user explicitly says it was a typo-only fix with
90
90
  | Translation status | `ai-spector-lang-status` |
91
91
  | Resolve translations | `ai-spector-resolve-translation` |
92
92
  | Resolve comments | `ai-spector-resolve-comments` |
93
- | Create task / open-ended doc change | `ai-spector-resolve-task` |
93
+ | Add/update feature or section ("I want to add…") | `ai-spector-resolve-task` (plan-first — no impact/edits before approval) |
94
+ | Generate SRS / basic design (full chapter) | `ai-spector-generate-srs` / `ai-spector-generate-basic-design` |
94
95
 
95
96
  ## Quick reference
96
97
 
@@ -38,7 +38,7 @@ Then: add files under `docs/data-source/`, enable **all** skills under `.cursor/
38
38
  | Translation status | “what’s stale in JP”, “pending translations” | `ai-spector-lang-status` | `lang_queue({})` MCP |
39
39
  | Sync translations | “resolve translations”, “update JP from EN” | `ai-spector-resolve-translation` | read queue → translate → `index({ cocoindexSync: true })` |
40
40
  | Review comments | “resolve comments”, “fix C-001” | `ai-spector-resolve-comments` | inbox → plan → edit → commit |
41
- | Create task / change docs | “create a task”, “add requirement”, “update SRS section”, “I want to…” | `ai-spector-resolve-task` | clarify → show GoalSpec + TaskPlanapprove `resolve_task` MCP or direct edits |
41
+ | Add/update one feature or section | “I want to add login with Google”, “add requirement”, “update auth section | `ai-spector-resolve-task` | clarify → plan **explicit yes**then edit + impact + index (never impact before approval) |
42
42
  | Explore graph | “show the graph” | `ai-spector-graph` | `npx ai-spector graph visualize --open` (no MCP equivalent) |
43
43
 
44
44
  Unsure? The agent uses [skills/_skill-router.md](./skills/_skill-router.md) or asks one clarifying question.
@@ -6,6 +6,8 @@ alwaysApply: false
6
6
 
7
7
  # After doc edits — impact + queue
8
8
 
9
+ When following **ai-spector-resolve-task**, run impact and index only **after plan approval**, as steps in the approved TaskPlan — not during planning.
10
+
9
11
  When you **finish editing** any file under `docs/srs/`, `docs/basic-design/`, or `docs/detail-design/`:
10
12
 
11
13
  ## 1. Check traceability impact
@@ -0,0 +1,29 @@
1
+ ---
2
+ description: >-
3
+ Incremental doc changes (add feature, update section, I want to…) must use
4
+ resolve-task workflow: clarify → plan → explicit approval → then edit/impact/index.
5
+ Never run graph_impact or edit docs before the user approves the plan.
6
+ alwaysApply: true
7
+ ---
8
+
9
+ # Resolve-task gate for incremental changes
10
+
11
+ When the user asks to **add**, **update**, or **change** a feature, requirement, section, or prototype element (e.g. "I want to add login with Google"):
12
+
13
+ 1. **Activate** `ai-spector-resolve-task` — not `ai-spector-generate-srs` or `ai-spector-generate-basic-design`.
14
+ 2. **Read** `.cursor/skills/ai-spector-resolve-task/references/runbook.md`.
15
+ 3. **Clarify** → **show GoalSpec + TaskPlan** → **wait for explicit yes**.
16
+ 4. **Only then** edit files and run `graph_impact` / `index` / `resolve_task`.
17
+
18
+ ## Forbidden before plan approval
19
+
20
+ - `graph_impact`, `index`, `graph_merge`, `resolve_task`
21
+ - Edit / Write under `docs/` or `prototype/`
22
+ - "Quick check" impact or draft edits
23
+
24
+ ## Full generate vs incremental
25
+
26
+ | Request | Skill |
27
+ |---------|-------|
28
+ | "generate SRS", "write chapter 4", DAG wave | `ai-spector-generate-srs` |
29
+ | "add login with Google", "update auth section" | `ai-spector-resolve-task` |
@@ -17,7 +17,7 @@ Enable **every** folder under `.cursor/skills/` in Cursor (Settings → Rules
17
17
  | Screens, APIs, DB basic design | `ai-spector-generate-basic-design` |
18
18
  | HTML prototype | `ai-spector-generate-prototype` |
19
19
  | Review comments | `ai-spector-resolve-comments` |
20
- | Create task / open-ended doc change | `ai-spector-resolve-task` |
20
+ | Add/update feature or section (“I want to add…”) | `ai-spector-resolve-task` (plan-first) |
21
21
  | Translation status (read-only) | `ai-spector-lang-status` |
22
22
  | Resolve / sync translations | `ai-spector-resolve-translation` |
23
23
  | Unsure | `ai-spector` (core) |
@@ -4,9 +4,11 @@ Agents use this when intent is ambiguous.
4
4
 
5
5
  ## Priority
6
6
 
7
- 1. **File context** — `paths` in skill frontmatter (e.g. `prototype/**`prototype skill).
8
- 2. **Natural language** — match skill `description`; then read that skill’s `references/` runbook.
9
- 3. **Still unclear** — `ai-spector` core + one question (graph vs SRS vs basic design vs prototype vs comments).
7
+ 1. **Incremental change (plan-first)** — verbs *add*, *update*, *change*, *modify*, *extend*, or phrases *"I want to"*, *"we need to"*, *create task* **`ai-spector-resolve-task`** before any generate-* skill. Example: "add login with Google" → resolve-task, **not** generate-srs.
8
+ 2. **Full generation** — *generate*, *write chapter*, *DAG wave*, *from graph* `ai-spector-generate` or layer skill.
9
+ 3. **File context** — `paths` in skill frontmatter (e.g. `prototype/**` prototype skill) when intent is still ambiguous.
10
+ 4. **Natural language** — match skill `description`; then read that skill’s `references/` runbook.
11
+ 5. **Still unclear** — `ai-spector` core + one question (incremental change vs full generate vs graph vs comments).
10
12
 
11
13
  ## Task → skill → runbook
12
14
 
@@ -24,11 +26,12 @@ Agents use this when intent is ambiguous.
24
26
  | link graph, semantic edges | `ai-spector-graph` | `references/link-graph.md` |
25
27
  | sync graph | `ai-spector-graph` | `references/sync-graph.md` |
26
28
  | doc summaries | `ai-spector-graph` | `references/summary.md` |
27
- | generate docs, write SRS, requirements, use cases, features | `ai-spector-generate` | `SKILL.md` (checks `packs.srs`, then routes) |
29
+ | generate docs, write SRS (full chapter/DAG), generate use cases from graph | `ai-spector-generate` | `SKILL.md` (checks `packs.srs`, then routes) |
30
+ | add feature, add requirement, update section, "I want to add…", "we need…" | `ai-spector-resolve-task` | `references/runbook.md` |
28
31
  | screens, APIs, wireframes, basic design | `ai-spector-generate` | `SKILL.md` (checks `packs.basicDesign`, then routes) |
29
32
  | HTML prototype | `ai-spector-generate-prototype` | `references/runbook.md` |
30
33
  | set up template pack, import template, custom template, install template | `ai-spector-template-import` | `references/runbook.md` |
31
- | create task, new task, resolve task, add requirement, update docs, change prototype, new section, "I want to…", "we need to…" | `ai-spector-resolve-task` | `references/runbook.md` |
34
+ | create task, new task, resolve task, change prototype | `ai-spector-resolve-task` | `references/runbook.md` |
32
35
  | review comments, C-001, inbox | `ai-spector-resolve-comments` | `references/runbook.md` |
33
36
  | translation status, stale langs | `ai-spector-lang-status` | `SKILL.md` |
34
37
  | resolve translations, sync JP/VI | `ai-spector-resolve-translation` | `references/runbook.md` |
@@ -80,8 +80,9 @@ When `npx ai-spector` exits non-zero, required `--json` is invalid, or a require
80
80
  |--------|-------|
81
81
  | Setup / bootstrap project | `ai-spector-setup` |
82
82
  | Analyze, index, validate, impact, visualize | `ai-spector-graph` |
83
- | SRS | `ai-spector-generate-srs` |
84
- | Basic design | `ai-spector-generate-basic-design` |
83
+ | Add/update one feature or section ("I want to add…") | `ai-spector-resolve-task` |
84
+ | Generate SRS (full chapter / DAG) | `ai-spector-generate-srs` |
85
+ | Generate basic design (full wave) | `ai-spector-generate-basic-design` |
85
86
  | Prototype | `ai-spector-generate-prototype` |
86
87
  | Comments | `ai-spector-resolve-comments` |
87
88
  | Translation status / stale languages | `ai-spector-lang-status` |
@@ -1,14 +1,22 @@
1
1
  ---
2
2
  name: ai-spector-generate
3
3
  description: >-
4
- Routes document-generation requests to the correct skill based on the active template packs.
5
- Use when the user says "generate docs", "generate requirements", "write SRS", or names a
6
- document type without specifying a layer. Always checks packs.srs and packs.basicDesign before routing.
4
+ Routes full document-generation requests to the correct skill based on active template packs.
5
+ Use for "generate docs", "generate SRS", "write chapter N" (DAG waves from graph). If the user
6
+ wants to add/update a single feature or section ("I want to add…"), route to ai-spector-resolve-task
7
+ instead. Always checks packs.srs and packs.basicDesign before routing.
7
8
  ---
8
9
 
9
10
  # AI Spector — Generate (router)
10
11
 
11
- ## Step 0 — Check active packs (always first)
12
+ ## Step 0 — Incremental vs full generate
13
+
14
+ | User intent | Route to |
15
+ |-------------|----------|
16
+ | add / update / change one feature, section, API, screen | `ai-spector-resolve-task` |
17
+ | generate SRS / basic design / full chapter from graph | continue below |
18
+
19
+ ## Step 1 — Check active packs (always first)
12
20
 
13
21
  Read `.ai-spector/docflow.config.json`. Check `packs.srs` and `packs.basicDesign` independently.
14
22
 
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: ai-spector-generate-basic-design
3
3
  description: >-
4
- Generates or updates basic design documents from the traceability graph and SRS: screen list and
5
- screen details, API list and endpoint details, database design under docs/basic-design/. Use when
6
- the user asks for basic design, wireframes, screen map, API design, ERD, or list-screens.md. Do not
7
- use for SRS-only work, HTML prototype, or graph analyze/index without doc generation.
4
+ Generates basic design chapters from the traceability graph in DAG order (screen list, API list,
5
+ wireframes wave). Do NOT use for incremental adds like "add an API endpoint" or "update screen X"
6
+ use ai-spector-resolve-task instead. Do not use for SRS-only work, HTML prototype, or graph-only
7
+ analyze/index tasks.
8
8
  paths:
9
9
  - "docs/basic-design/**"
10
10
  - ".ai-spector/templates/basic_design/**"
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: ai-spector-generate-srs
3
3
  description: >-
4
- Generates or updates the System Requirements Specification from the traceability graph and
5
- docs/data-source context. Use when the user asks to generate or update SRS, requirements, use cases
6
- (UC-xx), features (F-xx), or files under docs/srs/. Do not use for basic design screens/APIs,
4
+ Generates SRS chapters from the traceability graph in DAG order (full waves, "generate SRS",
5
+ "write chapter 4", use case list from graph). Do NOT use for incremental adds like "add a feature",
6
+ "I want to add login" use ai-spector-resolve-task instead. Do not use for basic design,
7
7
  HTML prototype, or graph-only analyze/index tasks.
8
8
  paths:
9
9
  - "docs/srs/**"
@@ -35,4 +35,6 @@ paths:
35
35
  ## On CLI failure
36
36
  Pause. Report full output. Offer fix + retry. Details in cli-failures.md.
37
37
 
38
- "generate SRS", "write requirements", "use case chapter", "feature list" → this skill.
38
+ "generate SRS", "write chapter 3", "feature list from graph", "all UC details" → this skill.
39
+
40
+ "add feature", "I want to add …", "update auth section" → **ai-spector-resolve-task** (plan-first).
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: ai-spector-resolve-task
3
3
  description: >-
4
- Conversational task workflow (create task, resolve task): agent clarifies user
5
- intent, builds a GoalSpec + TaskPlan, shows it for approval, then executes via
6
- the resolve_task MCP tool or CLI. Use when the user wants to create a task,
7
- add/update a requirement, change a prototype, update docs, regenerate
8
- sections, or any multi-step doc/graph change described in natural language.
4
+ FIRST CHOICE for incremental doc/graph changes: add feature, add requirement, update
5
+ section, change prototype, "I want to…", "we need to…", create task. Mandatory
6
+ workflow: clarify show GoalSpec + TaskPlan wait for explicit yes then execute.
7
+ Do NOT jump to edits or graph_impact before approval. Do NOT use generate-srs or
8
+ generate-basic-design for single-feature additions use this skill instead.
9
9
  paths:
10
10
  - "docs/**"
11
11
  - "prototype/**"
@@ -14,25 +14,69 @@ paths:
14
14
 
15
15
  # AI Spector — Resolve Task
16
16
 
17
- **Core:** [../ai-spector/SKILL.md](../ai-spector/SKILL.md)
17
+ **Read first:** [references/runbook.md](references/runbook.md) — follow every phase in order.
18
18
 
19
- ## Required reading
19
+ ## You are in plan-first mode
20
20
 
21
- [references/runbook.md](references/runbook.md) follow phases in order.
21
+ The user described a **change**, not a full generate-from-scratch run. Your job is to **plan and get approval before any write or impact tool**.
22
22
 
23
- ## Checklist
23
+ ### Forbidden until the user replies **yes** to the plan
24
+
25
+ | Do NOT call | Do NOT do |
26
+ |-------------|-----------|
27
+ | `graph_impact` | Edit or Write any file |
28
+ | `index`, `graph_merge`, `resolve_task` | Generate SRS/basic-design chapters |
29
+ | `graph_validate`, `graph_report` | "Quick preview" edits |
30
+ | Bulk reads of `docs/**` for writing | Run impact "to check scope" |
31
+
32
+ ### Allowed before approval (discover only)
33
+
34
+ `docs_search`, `graph_query_fuzzy`, `graph_query` — to find **where** a change belongs. No impact, no edits.
35
+
36
+ ## Workflow (strict)
24
37
 
25
38
  ```
26
- - [ ] Receive user intent (free-form)
27
- - [ ] Ask ≤3 clarifying questions → build GoalSpec
28
- - [ ] Show GoalSpec + TaskPlan → wait for approval
29
- - [ ] Execute via resolve_task MCP tool (or CLI)
30
- - [ ] Report results + state update
39
+ Phase 1 Receive intent → acknowledge, no tools
40
+ Phase 2 Clarify (≤3 questions)fill GoalSpec fields
41
+ Phase 3 Discover (optional) → read-only lookup for scope
42
+ Phase 4 Show plan → GoalSpec + TaskPlan table
43
+ Phase 5 Wait for approval → user must say yes / approve / go ahead
44
+ Phase 6 Execute → edits + resolve_task for index/graph steps
45
+ Phase 7 Report → state update summary
31
46
  ```
32
47
 
33
- ## Natural language triggers this skill
48
+ **Never skip Phase 2–5.** "Add login with Google" is not specific enough — you still clarify domain, target file/section, and done criteria.
49
+
50
+ ## First response template
51
+
52
+ When this skill activates, start like this (adapt to the user's message):
53
+
54
+ > I'll handle this through the **resolve-task** workflow — plan first, execute after you approve.
55
+ >
56
+ > To build the right plan:
57
+ > 1. …
58
+ > 2. …
59
+ > 3. …
34
60
 
35
- "create task", "create a task", "new task", "resolve task", "run a task",
36
- "add requirement", "update docs", "change prototype", "new feature section",
37
- "update SRS", "regenerate screens", "I want to…", "we need to…",
38
- any open-ended change request that is not a full generate-from-scratch workflow.
61
+ Do not run tools in this first message unless the user already named exact file paths.
62
+
63
+ ## Triggers this skill (not generate-*)
64
+
65
+ | User says | Route here |
66
+ |-----------|------------|
67
+ | "I want to add login with Google" | **this skill** |
68
+ | "add a requirement for …" | **this skill** |
69
+ | "update the SRS section on …" | **this skill** |
70
+ | "change prototype theme" | **this skill** |
71
+ | "generate SRS" / "write chapter 4" | `ai-spector-generate-srs` |
72
+ | "generate basic design" / "screen list" | `ai-spector-generate-basic-design` |
73
+
74
+ ## Checklist
75
+
76
+ ```
77
+ - [ ] Announced resolve-task workflow (plan-first)
78
+ - [ ] Asked clarifying questions → GoalSpec complete
79
+ - [ ] Showed GoalSpec + TaskPlan → got explicit yes
80
+ - [ ] Executed approved steps only
81
+ - [ ] Reported state update
82
+ ```
@@ -1,156 +1,193 @@
1
1
  # Resolve Task — conversational runbook
2
2
 
3
- Chat-first workflow for any multi-step doc/graph change. User describes intent in plain language; agent clarifies, plans, gets approval, then executes.
3
+ Plan-first workflow for incremental doc/graph changes. The agent **never edits or runs impact** until the user approves a written plan.
4
+
5
+ ---
6
+
7
+ ## Routing — when this runbook applies
8
+
9
+ | User intent | Skill |
10
+ |-------------|-------|
11
+ | Add / update / change one feature, section, or requirement | **resolve-task** (this runbook) |
12
+ | "I want to…", "we need to…", "create a task" | **resolve-task** |
13
+ | Generate full SRS chapter or DAG wave from graph | `ai-spector-generate-srs` |
14
+ | Generate screen list, API list, basic design wave | `ai-spector-generate-basic-design` |
15
+
16
+ **Example:** "I want to add login with Google feature" → **resolve-task**, not generate-srs.
4
17
 
5
18
  ---
6
19
 
7
20
  ## Phase 1 — Receive intent
8
21
 
9
- User sends a free-form message. **Do not act yet.** Just read and move to Phase 2.
22
+ User sends a free-form message.
23
+
24
+ **Actions:** Read the message. Acknowledge you will use the resolve-task workflow.
25
+
26
+ **Forbidden:** Every tool — no `graph_impact`, no `index`, no file edits, no bulk `docs/**` reads.
10
27
 
11
- Examples:
12
- - "create a task to add authentication to the SRS"
13
- - "add an authentication requirement to the SRS"
14
- - "change the prototype theme to dark"
15
- - "we need a new API section in basic design"
28
+ **Then:** Go to Phase 2. Do not skip.
16
29
 
17
30
  ---
18
31
 
19
- ## Phase 2 — Clarify (≤ 3 questions)
32
+ ## Phase 2 — Clarify (mandatory)
20
33
 
21
- Ask only what is needed to fill `GoalSpec`. Stop when you can answer all four fields.
34
+ Ask what you need to fill **all four** `GoalSpec` fields. Batch ≤3 questions in one message.
22
35
 
23
36
  | Field | What to clarify |
24
37
  |-------|----------------|
25
- | `domain` | Which area: docs / prototype / graph / template / lang? |
26
- | `scope` | Which specific files or sections change? |
38
+ | `domain` | docs / prototype / graph / template / lang / comments? |
39
+ | `scope` | Which file(s) or section(s)? |
27
40
  | `criteria` | What does "done" look like? |
28
- | `notes` | Any constraints, tone, related nodes? |
41
+ | `notes` | Constraints, related features, languages? |
29
42
 
30
43
  **Rules:**
31
- - Ask at most 3 questions per round; batch them in one message.
32
- - If the intent is already specific enough, skip to Phase 3.
33
- - Do not propose edits or generate content yet.
44
+ - **Always ask at least one question** unless the user already gave domain + exact file path(s) + acceptance criteria in the same message.
45
+ - "Add login with Google" is **not** enough — clarify SRS vs prototype, which section, and done criteria.
46
+ - Do not propose file content yet. Do not run impact.
47
+
48
+ **Example (login with Google):**
49
+
50
+ > I'll handle this through the **resolve-task** workflow — plan first, execute after you approve.
51
+ >
52
+ > To build the right plan:
53
+ > 1. Should this go in **SRS** (e.g. features / external interfaces) or also **basic design / prototype**?
54
+ > 2. Is there an existing auth section to extend, or a new feature id (e.g. F-xx)?
55
+ > 3. What does done look like — e.g. requirements written + graph reindexed?
56
+
57
+ ---
58
+
59
+ ## Phase 3 — Discover (optional, read-only)
60
+
61
+ Use **only** when you need to find where content belongs.
62
+
63
+ | Allowed | Forbidden |
64
+ |---------|-----------|
65
+ | `docs_search({ query })` | `graph_impact` |
66
+ | `graph_query_fuzzy({ query })` | `index`, `graph_merge` |
67
+ | `graph_query({ seedId })` | Edit, Write |
68
+ | `Read` a single file for structure (headings) | Bulk-read docs for drafting |
34
69
 
35
- **Example clarification message:**
36
- > To make sure I plan this correctly:
37
- > 1. Should this go in the main SRS (`docs/srs/`) or a language variant?
38
- > 2. Is there an existing section to extend, or does this need a new one?
39
- > 3. What does "done" look like — e.g. the section exists + graph reindexed?
70
+ Stop when you can name concrete `scope` paths. Go to Phase 4.
40
71
 
41
72
  ---
42
73
 
43
- ## Phase 3 — Build and show the plan
74
+ ## Phase 4 — Build and show the plan
44
75
 
45
- Once you have enough to fill `GoalSpec`, construct the plan and **show it in chat** before doing anything.
76
+ Construct `GoalSpec` + `TaskPlan`. **Show both in chat.** Do not execute.
46
77
 
47
- ### GoalSpec format (show this)
78
+ ### GoalSpec (show this)
48
79
 
49
80
  ```
50
81
  Domain : docs
51
- Scope : docs/srs/02-features.md
82
+ Scope : docs/srs/en/04-features/f-12-google-login.md (example)
52
83
  Criteria:
53
- - FR-AUTH section present with at least 3 requirements
54
- - graph reindexed successfully
55
- Notes : keep consistent with existing FR-PAY section style
84
+ - Google OAuth login requirements documented
85
+ - Linked to existing auth use case if applicable
86
+ - graph reindexed after edit
87
+ Notes : match style of existing F-xx feature files
56
88
  ```
57
89
 
58
- ### TaskPlan format (show this)
90
+ ### TaskPlan (show this)
59
91
 
60
92
  | # | Step | Tool |
61
93
  |---|------|------|
62
- | s1 | Edit docs/srs/02-features.md add FR-AUTH section | (direct edit) |
63
- | s2 | Re-index project | `index` |
64
- | s3 | Merge knowledge | `graph_merge` |
94
+ | s1 | Add F-xx Google login feature doc (or extend existing section) | direct edit |
95
+ | s2 | Check traceability impact | `graph_impact` |
96
+ | s3 | Re-index project | `index` |
97
+ | s4 | Merge knowledge → graph | `graph_merge` |
65
98
 
66
- **Risk level:** low / medium / high / critical (from impact analysis)
99
+ **Risk:** show `low` / `medium` / `high` as an **estimate** from scope size, or write "computed at step s2 after approval". Do **not** call `graph_impact` during planning.
67
100
 
68
- **Then ask:** "Does this plan look right? Reply **yes** to execute, or tell me what to change."
101
+ ### Approval gate
69
102
 
70
- Do not proceed until the user confirms.
103
+ End with:
104
+
105
+ > **Approve this plan?** Reply **yes** to execute, or tell me what to change.
106
+
107
+ **Forbidden:** Any step in the table until the user confirms.
108
+
109
+ ---
110
+
111
+ ## Phase 5 — Wait for approval
112
+
113
+ Proceed only on explicit approval: "yes", "approve", "go ahead", "looks good", "execute".
114
+
115
+ If the user changes the plan → update GoalSpec/TaskPlan → show again → wait again.
71
116
 
72
117
  ---
73
118
 
74
- ## Phase 4 — Execute
119
+ ## Phase 6 — Execute
75
120
 
76
- After approval, run each step in order.
121
+ Run **only** approved steps, in order.
77
122
 
78
- ### Steps that are direct edits
79
- Use the Edit / Write tools directly. Report each file changed.
123
+ ### Direct edit steps
124
+ Use Edit / Write. Report each file changed.
80
125
 
81
- ### Steps that call MCP tools
82
- Use the `resolve_task` MCP tool with the approved plan:
126
+ ### MCP / CLI steps
127
+ Use `resolve_task` for batched index/graph steps, or call MCP tools individually per the plan:
83
128
 
84
129
  ```json
85
130
  {
86
- "intent": "<original user message>",
131
+ "intent": "I want to add login with Google feature",
87
132
  "goalSpec": {
88
- "trigger": "<original user message>",
133
+ "trigger": "I want to add login with Google feature",
89
134
  "domain": "docs",
90
- "scope": ["docs/srs/02-features.md"],
91
- "criteria": ["FR-AUTH section present", "graph reindexed"]
135
+ "scope": ["docs/srs/en/04-features/f-12-google-login.md"],
136
+ "criteria": ["Google OAuth requirements documented", "graph reindexed"]
92
137
  },
93
138
  "plan": {
94
- "goal": { "...same as goalSpec..." },
139
+ "goal": {
140
+ "trigger": "I want to add login with Google feature",
141
+ "domain": "docs",
142
+ "scope": ["docs/srs/en/04-features/f-12-google-login.md"],
143
+ "criteria": ["Google OAuth requirements documented", "graph reindexed"]
144
+ },
95
145
  "steps": [
96
- { "id": "s2", "description": "Re-index project", "tool": "index", "args": {} },
97
- { "id": "s3", "description": "Merge knowledge", "tool": "graph_merge", "args": {} }
146
+ { "id": "s2", "description": "Check traceability impact", "tool": "graph_impact", "args": { "change": "content_change" } },
147
+ { "id": "s3", "description": "Re-index project", "tool": "index", "args": {} },
148
+ { "id": "s4", "description": "Merge knowledge", "tool": "graph_merge", "args": {} }
98
149
  ]
99
150
  }
100
151
  }
101
152
  ```
102
153
 
103
- Or via CLI if MCP is unavailable:
154
+ CLI fallback: `npx ai-spector resolve-task plan.json`
104
155
 
105
- ```bash
106
- # write plan.json, then:
107
- npx ai-spector resolve-task plan.json
108
- ```
156
+ **Note:** Edit steps (s1) are done outside `resolve_task` — the tool only runs registered executors (`index`, `graph_merge`, `graph_impact`, `graph_report`).
109
157
 
110
158
  ### If a step is blocked
111
- Report the blocker in chat. Ask the user: "Step **sN** is blocked: `<reason>`. Should I skip it, retry, or stop?"
159
+ Report the blocker. Ask: skip, retry, or stop?
112
160
 
113
161
  ---
114
162
 
115
- ## Phase 5 — Report state update
116
-
117
- After execution, show a summary:
163
+ ## Phase 7 — Report state update
118
164
 
119
165
  ```
120
166
  ✓ Task task-abc123 — COMPLETE
121
167
  domain: docs risk: low
122
168
 
123
169
  Steps:
124
- ✓ [s1] Edit docs/srs/02-features.md
125
- ✓ [s2] Re-index project
126
- ✓ [s3] Merge knowledge
170
+ ✓ [s1] Added docs/srs/en/04-features/f-12-google-login.md
171
+ ✓ [s2] graph_impact — 2 review, 0 regenerate
172
+ ✓ [s3] Re-index project
173
+ ✓ [s4] Merge knowledge
127
174
 
128
175
  State update:
129
- reindexed: 1 file(s)
130
- graph diff: +2 -0 ~1
131
- 3 file(s) changed across 3 steps
176
+ 1 file(s) changed
177
+ graph reindexed
132
178
  ```
133
179
 
134
- Then ask if there is anything else to adjust.
135
-
136
- ---
137
-
138
- ## Replanning
139
-
140
- If the user changes their mind after seeing the plan (Phase 3), go back to Phase 2 — update `GoalSpec` + `TaskPlan` and show the revised plan again.
141
-
142
- If a step fails mid-execution, either:
143
- - Replan without that step and continue, or
144
- - Stop and report the full blocker to the user
180
+ Ask if anything else needs adjustment.
145
181
 
146
182
  ---
147
183
 
148
- ## Guardrails
184
+ ## Guardrails (non-negotiable)
149
185
 
150
- - **Never start editing** before the user approves the plan.
151
- - **Never skip the clarify phase** — even one ambiguous word can target the wrong file.
152
- - **Never run `resolve_task` with an unapproved plan.**
153
- - Ask for approval once, clearly. Don't loop approval prompts.
186
+ 1. **No edits before approval** including "let me draft it for you to review".
187
+ 2. **No `graph_impact` before approval** — impact is an execute-step, not a planning shortcut.
188
+ 3. **No `index` / `graph_merge` / `resolve_task` before approval**.
189
+ 4. **Do not route to generate-srs** for single-feature adds stay in this workflow.
190
+ 5. **One approval gate** — clear yes, then execute all steps.
154
191
 
155
192
  ---
156
193
 
@@ -158,11 +195,11 @@ If a step fails mid-execution, either:
158
195
 
159
196
  | Command | Purpose |
160
197
  |---------|---------|
161
- | `npx ai-spector resolve-task plan.json` | Execute a pre-built plan JSON |
198
+ | `npx ai-spector resolve-task plan.json` | Execute approved plan JSON |
162
199
  | `npx ai-spector resolve-task plan.json --dry-run` | Validate without writing |
163
200
  | `npx ai-spector resolve-task plan.json --json` | Machine-readable output |
164
201
 
165
- MCP tool: `resolve_task` (schema: `ResolveTaskSchema`)
202
+ MCP: `resolve_task` (schema: `ResolveTaskSchema`)
166
203
 
167
204
  ---
168
205
 
@@ -172,6 +209,6 @@ See [cli-failures.md](../../ai-spector/references/cli-failures.md).
172
209
 
173
210
  | Issue | Fix |
174
211
  |-------|-----|
175
- | `No executor registered for tool "X"` | Use a supported tool: `index`, `graph_merge`, `graph_report`, `graph_impact` |
176
- | Plan JSON parse error | Validate JSON with `node -e "JSON.parse(require('fs').readFileSync('plan.json','utf8'))"` |
177
- | Reindex fails | Check `npx ai-spector setup --check` first |
212
+ | `No executor registered for tool "X"` | Use: `index`, `graph_merge`, `graph_report`, `graph_impact` |
213
+ | Plan JSON parse error | Validate JSON before running |
214
+ | Reindex fails | `npx ai-spector setup --check` |