ai-spector 0.8.30 → 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.30",
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",
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: ai-spector-resolve-task
3
+ description: >-
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
+ ---
9
+
10
+ # AI Spector — Resolve Task
11
+
12
+ ## Plan-first mode
13
+
14
+ **Forbidden before user approves the plan:** `graph_impact`, `index`, `graph_merge`, `resolve_task`, Edit/Write.
15
+
16
+ **Allowed for discovery only:** `docs_search`, `graph_query_fuzzy`, `graph_query`, Read (structure).
17
+
18
+ ## Workflow
19
+
20
+ ```
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
27
+ ```
28
+
29
+ ## Routing
30
+
31
+ | "I want to add login with Google" | **this skill** |
32
+ | "generate SRS" / "write chapter 4" | `ai-spector-generate-srs` |
33
+
34
+ Runbook: `.cursor/skills/ai-spector-resolve-task/references/runbook.md`
@@ -90,6 +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
+ | 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` |
93
95
 
94
96
  ## Quick reference
95
97
 
@@ -111,6 +113,7 @@ Skip impact/index only when the user explicitly says it was a typo-only fix with
111
113
  | `cocoindex_index({})` | Rebuild semantic embeddings |
112
114
  | `docs_search({ query })` | Semantic doc search (CocoIndex) |
113
115
  | `graph_query_fuzzy({ query })` | Natural language graph lookup (CocoIndex) |
116
+ | `resolve_task({ intent, goalSpec, plan })` | Execute an approved task plan (index, graph_merge, etc.) |
114
117
 
115
118
  ### CLI (fallback / MCP-unavailable or no tool equivalent)
116
119
 
@@ -124,6 +127,7 @@ npx ai-spector template list # list installed packs + active
124
127
  npx ai-spector template scan <path> # scan a template folder → scan-result.json
125
128
  npx ai-spector template install # install pack from staging (AI writes manifest first)
126
129
  npx ai-spector template use <name> # switch active pack (use "builtin" to revert)
130
+ npx ai-spector resolve-task plan.json # execute approved task plan
127
131
 
128
132
  # CocoIndex (opt-in — requires Python 3.11+)
129
133
  npx ai-spector cocoindex setup # scaffold pipeline into project
@@ -38,6 +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
+ | 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) |
41
42
  | Explore graph | “show the graph” | `ai-spector-graph` | `npx ai-spector graph visualize --open` (no MCP equivalent) |
42
43
 
43
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,6 +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
+ | Add/update feature or section (“I want to add…”) | `ai-spector-resolve-task` (plan-first) |
20
21
  | Translation status (read-only) | `ai-spector-lang-status` |
21
22
  | Resolve / sync translations | `ai-spector-resolve-translation` |
22
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,10 +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` |
34
+ | create task, new task, resolve task, change prototype | `ai-spector-resolve-task` | `references/runbook.md` |
31
35
  | review comments, C-001, inbox | `ai-spector-resolve-comments` | `references/runbook.md` |
32
36
  | translation status, stale langs | `ai-spector-lang-status` | `SKILL.md` |
33
37
  | resolve translations, sync JP/VI | `ai-spector-resolve-translation` | `references/runbook.md` |
@@ -5,7 +5,8 @@ description: >-
5
5
  and routing to task skills. Use when the user mentions ai-spector, docflow, or .npx ai-spector but the
6
6
  task is unclear, or for init and project layout. Do not use when the user clearly wants SRS,
7
7
  basic design, HTML prototype, graph operations, or comment resolution — use the
8
- matching task skill instead.
8
+ matching task skill instead. For open-ended doc/graph changes or "create task",
9
+ use ai-spector-resolve-task.
9
10
  ---
10
11
 
11
12
  # AI Spector (core)
@@ -33,6 +34,7 @@ When the `ai-spector` MCP server is enabled (`.cursor/mcp.json` or `.mcp.json` l
33
34
  | Rebuild semantic embeddings | `cocoindex_index({})` | `npx ai-spector cocoindex index` |
34
35
  | Semantic doc search | `docs_search({ query })` | `npx ai-spector cocoindex search --query …` |
35
36
  | Natural language graph lookup | `graph_query_fuzzy({ query })` | *(no CLI equivalent)* |
37
+ | Execute approved task plan | `resolve_task({ intent, goalSpec, plan })` | `npx ai-spector resolve-task plan.json` |
36
38
  | **Visualize graph** | *(no MCP tool)* | `npx ai-spector graph visualize --open` |
37
39
 
38
40
  Use CLI **only** when: MCP server is not configured, the tool errors, or no MCP equivalent exists (visualize, `lang add`, template mutations).
@@ -78,12 +80,14 @@ When `npx ai-spector` exits non-zero, required `--json` is invalid, or a require
78
80
  |--------|-------|
79
81
  | Setup / bootstrap project | `ai-spector-setup` |
80
82
  | Analyze, index, validate, impact, visualize | `ai-spector-graph` |
81
- | SRS | `ai-spector-generate-srs` |
82
- | 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` |
83
86
  | Prototype | `ai-spector-generate-prototype` |
84
87
  | Comments | `ai-spector-resolve-comments` |
85
88
  | Translation status / stale languages | `ai-spector-lang-status` |
86
89
  | Resolve / sync translations | `ai-spector-resolve-translation` |
90
+ | Create task, open-ended doc/graph change | `ai-spector-resolve-task` |
87
91
  | “Generate docs” (vague) | `ai-spector-generate` |
88
92
 
89
93
  When a task skill applies, read its `references/` runbook fully before acting.
@@ -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).
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: ai-spector-resolve-task
3
+ description: >-
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
+ paths:
10
+ - "docs/**"
11
+ - "prototype/**"
12
+ - ".ai-spector/**"
13
+ ---
14
+
15
+ # AI Spector — Resolve Task
16
+
17
+ **Read first:** [references/runbook.md](references/runbook.md) — follow every phase in order.
18
+
19
+ ## You are in plan-first mode
20
+
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
+
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)
37
+
38
+ ```
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
46
+ ```
47
+
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. …
60
+
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
+ ```
@@ -0,0 +1,214 @@
1
+ # Resolve Task — conversational runbook
2
+
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.
17
+
18
+ ---
19
+
20
+ ## Phase 1 — Receive intent
21
+
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.
27
+
28
+ **Then:** Go to Phase 2. Do not skip.
29
+
30
+ ---
31
+
32
+ ## Phase 2 — Clarify (mandatory)
33
+
34
+ Ask what you need to fill **all four** `GoalSpec` fields. Batch ≤3 questions in one message.
35
+
36
+ | Field | What to clarify |
37
+ |-------|----------------|
38
+ | `domain` | docs / prototype / graph / template / lang / comments? |
39
+ | `scope` | Which file(s) or section(s)? |
40
+ | `criteria` | What does "done" look like? |
41
+ | `notes` | Constraints, related features, languages? |
42
+
43
+ **Rules:**
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 |
69
+
70
+ Stop when you can name concrete `scope` paths. Go to Phase 4.
71
+
72
+ ---
73
+
74
+ ## Phase 4 — Build and show the plan
75
+
76
+ Construct `GoalSpec` + `TaskPlan`. **Show both in chat.** Do not execute.
77
+
78
+ ### GoalSpec (show this)
79
+
80
+ ```
81
+ Domain : docs
82
+ Scope : docs/srs/en/04-features/f-12-google-login.md (example)
83
+ Criteria:
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
88
+ ```
89
+
90
+ ### TaskPlan (show this)
91
+
92
+ | # | Step | Tool |
93
+ |---|------|------|
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` |
98
+
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.
100
+
101
+ ### Approval gate
102
+
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.
116
+
117
+ ---
118
+
119
+ ## Phase 6 — Execute
120
+
121
+ Run **only** approved steps, in order.
122
+
123
+ ### Direct edit steps
124
+ Use Edit / Write. Report each file changed.
125
+
126
+ ### MCP / CLI steps
127
+ Use `resolve_task` for batched index/graph steps, or call MCP tools individually per the plan:
128
+
129
+ ```json
130
+ {
131
+ "intent": "I want to add login with Google feature",
132
+ "goalSpec": {
133
+ "trigger": "I want to add login with Google feature",
134
+ "domain": "docs",
135
+ "scope": ["docs/srs/en/04-features/f-12-google-login.md"],
136
+ "criteria": ["Google OAuth requirements documented", "graph reindexed"]
137
+ },
138
+ "plan": {
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
+ },
145
+ "steps": [
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": {} }
149
+ ]
150
+ }
151
+ }
152
+ ```
153
+
154
+ CLI fallback: `npx ai-spector resolve-task plan.json`
155
+
156
+ **Note:** Edit steps (s1) are done outside `resolve_task` — the tool only runs registered executors (`index`, `graph_merge`, `graph_impact`, `graph_report`).
157
+
158
+ ### If a step is blocked
159
+ Report the blocker. Ask: skip, retry, or stop?
160
+
161
+ ---
162
+
163
+ ## Phase 7 — Report state update
164
+
165
+ ```
166
+ ✓ Task task-abc123 — COMPLETE
167
+ domain: docs risk: low
168
+
169
+ Steps:
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
174
+
175
+ State update:
176
+ 1 file(s) changed
177
+ graph reindexed
178
+ ```
179
+
180
+ Ask if anything else needs adjustment.
181
+
182
+ ---
183
+
184
+ ## Guardrails (non-negotiable)
185
+
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.
191
+
192
+ ---
193
+
194
+ ## CLI reference
195
+
196
+ | Command | Purpose |
197
+ |---------|---------|
198
+ | `npx ai-spector resolve-task plan.json` | Execute approved plan JSON |
199
+ | `npx ai-spector resolve-task plan.json --dry-run` | Validate without writing |
200
+ | `npx ai-spector resolve-task plan.json --json` | Machine-readable output |
201
+
202
+ MCP: `resolve_task` (schema: `ResolveTaskSchema`)
203
+
204
+ ---
205
+
206
+ ## If blocked
207
+
208
+ See [cli-failures.md](../../ai-spector/references/cli-failures.md).
209
+
210
+ | Issue | Fix |
211
+ |-------|-----|
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` |