refacil-sdd-ai 5.2.2 → 5.3.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 (76) hide show
  1. package/NOTICE.md +46 -0
  2. package/README.md +209 -42
  3. package/agents/auditor.md +46 -0
  4. package/agents/debugger.md +41 -1
  5. package/agents/implementer.md +76 -10
  6. package/agents/investigator.md +36 -0
  7. package/agents/proposer.md +46 -2
  8. package/agents/tester.md +45 -8
  9. package/agents/validator.md +67 -13
  10. package/bin/cli.js +428 -83
  11. package/bin/postinstall.js +20 -0
  12. package/lib/bus/broker.js +121 -3
  13. package/lib/bus/spawn.js +189 -121
  14. package/lib/check-review.js +102 -0
  15. package/lib/codegraph-telemetry.js +135 -0
  16. package/lib/codegraph.js +273 -0
  17. package/lib/commands/autopilot.js +120 -0
  18. package/lib/commands/bus.js +29 -36
  19. package/lib/commands/compact.js +185 -46
  20. package/lib/commands/read-spec.js +352 -0
  21. package/lib/commands/sdd.js +429 -44
  22. package/lib/compact-guidance.js +122 -77
  23. package/lib/config.js +136 -0
  24. package/lib/global-paths.js +56 -20
  25. package/lib/hooks.js +32 -4
  26. package/lib/ide-detection.js +1 -1
  27. package/lib/ignore-files.js +5 -1
  28. package/lib/installer.js +202 -19
  29. package/lib/kapso.js +241 -0
  30. package/lib/methodology-migration-pending.js +13 -0
  31. package/lib/open-browser.js +32 -0
  32. package/lib/opencode-migrate.js +148 -0
  33. package/lib/opencode-plugin/index.js +84 -104
  34. package/lib/opencode-plugin/rules.js +236 -0
  35. package/lib/project-root.js +154 -0
  36. package/lib/repo-ide-sync.js +5 -0
  37. package/lib/spec-reader/lang.js +72 -0
  38. package/lib/spec-reader/md-parser.js +299 -0
  39. package/lib/spec-reader/session.js +139 -0
  40. package/lib/spec-reader/ui/app.js +685 -0
  41. package/lib/spec-reader/ui/index.html +59 -0
  42. package/lib/spec-reader/ui/mixed-lang.js +200 -0
  43. package/lib/spec-reader/ui/model-cache.js +117 -0
  44. package/lib/spec-reader/ui/style.css +294 -0
  45. package/lib/spec-reader/ui/supertonic-helper.js +565 -0
  46. package/lib/spec-sync.js +258 -0
  47. package/lib/test-scope.js +713 -0
  48. package/lib/testing-policy-sync.js +14 -2
  49. package/package.json +6 -3
  50. package/skills/apply/SKILL.md +39 -64
  51. package/skills/archive/SKILL.md +74 -48
  52. package/skills/ask/SKILL.md +43 -8
  53. package/skills/autopilot/SKILL.md +476 -0
  54. package/skills/bug/SKILL.md +52 -53
  55. package/skills/explore/SKILL.md +48 -1
  56. package/skills/guide/SKILL.md +31 -13
  57. package/skills/inbox/SKILL.md +9 -0
  58. package/skills/join/SKILL.md +1 -1
  59. package/skills/prereqs/BUS-CROSS-REPO.md +33 -16
  60. package/skills/prereqs/METHODOLOGY-CONTRACT.md +96 -17
  61. package/skills/prereqs/SKILL.md +1 -1
  62. package/skills/propose/SKILL.md +74 -19
  63. package/skills/read-spec/SKILL.md +76 -0
  64. package/skills/reply/SKILL.md +42 -9
  65. package/skills/review/SKILL.md +63 -25
  66. package/skills/review/checklist.md +2 -2
  67. package/skills/say/SKILL.md +40 -4
  68. package/skills/setup/SKILL.md +59 -5
  69. package/skills/setup/troubleshooting.md +11 -3
  70. package/skills/stats/SKILL.md +157 -0
  71. package/skills/test/SKILL.md +35 -10
  72. package/skills/up-code/SKILL.md +20 -13
  73. package/skills/update/SKILL.md +32 -1
  74. package/skills/verify/SKILL.md +78 -41
  75. package/templates/compact-guidance.md +10 -0
  76. package/templates/methodology-guide.md +5 -0
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: refacil:read-spec
3
+ description: Listen to SDD spec Markdown files in the browser with on-device TTS (Supertonic). Use after propose or on-demand for active changes and archived specs.
4
+ user-invocable: true
5
+ ---
6
+
7
+ # refacil:read-spec — Spec reader (TTS)
8
+
9
+ Play a Markdown spec aloud in the local browser using on-device TTS. The CLI parses the file(s), stores a short-lived session on the broker, and opens `/read-spec`.
10
+
11
+ **Prerequisites**: `sdd` profile from `refacil-prereqs/SKILL.md`.
12
+
13
+ ## CLI (always use this)
14
+
15
+ Single file mode:
16
+ ```bash
17
+ refacil-sdd-ai read-spec --file <path-relative-to-repo-root> [--lang es] [--voice M3] [--speed 1]
18
+ ```
19
+
20
+ Folder mode (all SDD artifacts for a change in one browser panel with sidebar):
21
+ ```bash
22
+ refacil-sdd-ai read-spec --change <changeName> [--select <file.md>] [--lang es] [--voice M3] [--speed 1]
23
+ ```
24
+
25
+ - `--change <changeName>`: loads all `.md` files from `refacil-sdd/changes/<changeName>/` in order: `proposal.md → design.md → tasks.md → specs.md → (others alphabetically)`. Opens a sidebar for navigation between files.
26
+ - `--select <file.md>`: pre-selects a specific file in the sidebar (default: `proposal.md`).
27
+ - `--file` and `--change` are mutually exclusive.
28
+
29
+ Defaults: `lang=es`, `voice=M3`, `speed=1`.
30
+
31
+ ## Post-propose flow (CA-24)
32
+
33
+ The listen option is presented as **option B** in the `/refacil:propose` Step 3 review menu — handled directly by that skill. When the user selects B, run:
34
+
35
+ ```bash
36
+ refacil-sdd-ai read-spec --change <changeName>
37
+ ```
38
+
39
+ Language is auto-detected from the artifact content (no `--lang` flag needed). After playback, re-present the Step 3 review menu so the user can approve or request adjustments.
40
+
41
+ ## On-demand — archived specs only (CA-25)
42
+
43
+ When there are **no** active folders under `refacil-sdd/changes/` (except `archive/`):
44
+
45
+ 1. Ask which archived spec folder under `refacil-sdd/specs/`.
46
+ 2. Run `read-spec --file refacil-sdd/specs/<name>/spec.md` (verify the folder exists first).
47
+
48
+ ## On-demand — active changes (CA-26)
49
+
50
+ When there are active folders under `refacil-sdd/changes/`:
51
+
52
+ 1. List the active change names.
53
+ 2. Ask the user which change to listen to (and optionally which file to start from).
54
+ 3. Run:
55
+
56
+ ```bash
57
+ refacil-sdd-ai read-spec --change <changeName> [--select <file.md>]
58
+ ```
59
+
60
+ If the user specifies a particular file (e.g. "I want to hear specs.md"), add `--select specs.md`.
61
+
62
+ ## On-demand — active changes and archived (CA-27)
63
+
64
+ When both active changes and `refacil-sdd/specs/` exist:
65
+
66
+ 1. Ask: open **change** or **archived spec**?
67
+ 2. List names from the chosen location.
68
+ 3. For a change: run `read-spec --change <changeName>` (with optional `--select`).
69
+ 4. For archived: `refacil-sdd/specs/<name>/spec.md` → run `read-spec --file <path>`.
70
+
71
+ ## Rules
72
+
73
+ - Never send spec content to remote TTS APIs; only the CLI + local browser run.
74
+ - If the path or change folder is missing, report clearly (CR-11, CR-12) — do not run the CLI silently.
75
+ - `--file` must stay inside the project root (the CLI enforces this).
76
+ - `--change` and `--file` are mutually exclusive — never pass both.
@@ -15,7 +15,7 @@ Sends a response to the last question directed to this session. **$ARGUMENTS** =
15
15
  Run via `Bash`:
16
16
 
17
17
  ```bash
18
- refacil-sdd-ai bus reply --text "<response>"
18
+ refacil-sdd-ai bus reply --text "[response]"
19
19
  ```
20
20
 
21
21
  The broker:
@@ -32,18 +32,51 @@ Report to the user that the response was sent.
32
32
  - **`reply`**: always when you are responding to something you were asked. This allows the other side in `ask --wait` to unblock automatically.
33
33
  - **`say`**: general announcement unrelated to a previous question.
34
34
 
35
+ ## Safe bus text delivery
36
+
37
+ **Use `--text` for simple messages** (no special characters, single-line):
38
+ ```bash
39
+ refacil-sdd-ai bus reply --text "Simple response here"
40
+ ```
41
+
42
+ **Do NOT use `<` or `>` inside `--text`** — shells may interpret them as redirection operators and truncate or discard the message.
43
+
44
+ For messages containing `<`, `>`, `|`, newlines, or other special characters, use `--from-env`:
45
+
46
+ **PowerShell (Windows)**:
47
+ ```powershell
48
+ $env:BUS_TEXT = "integrationPoint: POST /pay`noutputContract: {status<string>, id<uuid>}"
49
+ refacil-sdd-ai bus reply --from-env BUS_TEXT
50
+ Remove-Item Env:BUS_TEXT
51
+ ```
52
+
53
+ **bash (inline, preferred — automatic cleanup)**:
54
+ ```bash
55
+ BUS_TEXT="integrationPoint: POST /pay
56
+ outputContract: {status<string>, id<uuid>}" refacil-sdd-ai bus reply --from-env BUS_TEXT
57
+ ```
58
+
59
+ **bash (export + unset alternative)**:
60
+ ```bash
61
+ export BUS_TEXT="response with <special> chars"
62
+ refacil-sdd-ai bus reply --from-env BUS_TEXT
63
+ unset BUS_TEXT
64
+ ```
65
+
66
+ > Note: the CLI cannot perform cleanup itself — it runs as a child process and cannot modify the parent shell's environment. Cleanup (`Remove-Item` / `unset`) is the responsibility of the invoking script or shell.
67
+
35
68
  ## Contract-focused reply format (for integration questions)
36
69
 
37
70
  When replying to cross-repo integration clarifications, prefer this structure so the other side can continue without ambiguity:
38
71
 
39
72
  ```text
40
- integrationPoint: <confirmed endpoint/event/queue + direction>
41
- inputContract: <confirmed fields/validation>
42
- outputContract: <confirmed outputs/status/errors>
43
- compatibility: <version/constraints, or "unknown">
44
- sourceOfTruth: <file/path/symbol in this repo>
45
- confidence: <high|medium|low>
46
- openQuestions: <none | list of unresolved points>
73
+ integrationPoint: [confirmed endpoint/event/queue + direction]
74
+ inputContract: [confirmed fields/validation]
75
+ outputContract: [confirmed outputs/status/errors]
76
+ compatibility: [version/constraints, or "unknown"]
77
+ sourceOfTruth: [file/path/symbol in this repo]
78
+ confidence: [high|medium|low]
79
+ openQuestions: [none | list of unresolved points]
47
80
  ```
48
81
 
49
82
  If you cannot confirm a field, answer with `unknown` and include the missing evidence in `openQuestions`.
@@ -57,5 +90,5 @@ If you cannot confirm a field, answer with `unknown` and include the missing evi
57
90
  - If there is no pending question directed to you and you do not want to link it, use `/refacil:say` instead.
58
91
  - If you were asked multiple questions and want to respond to a specific older one, pass `--correlation <id>` explicitly:
59
92
  ```bash
60
- refacil-sdd-ai bus reply --text "..." --correlation <id>
93
+ refacil-sdd-ai bus reply --text "..." --correlation [id]
61
94
  ```
@@ -20,6 +20,8 @@ This skill is a **thin wrapper** that delegates the heavy review to the `refacil
20
20
  3) Uncommitted changes (`git diff`)
21
21
  - If there are multiple active changes in `refacil-sdd/changes/` and no `$ARGUMENTS`, **stop** and ask the user to explicitly select which change to review. **Do not invoke the sub-agent with ambiguous scope.**
22
22
 
23
+ **Autopilot mode detection**: once `changeName` is resolved (and not null), try to read `refacil-sdd/.autopilot-active`. If the file exists and its `changeName` field matches → `autopilotMode = true`. Otherwise `autopilotMode = false` (normal mode, ask user as usual).
24
+
23
25
  ### Step 0.3: Git working tree snapshot (run once)
24
26
 
25
27
  After scope is unambiguous (you are **not** stopping for multiple active changes), collect git state **exactly once** for this skill invocation:
@@ -55,18 +57,26 @@ If `changeName` is not null, check whether `refacil-sdd/changes/<changeName>/.re
55
57
 
56
58
  ### Step 0.5: Build briefing for the sub-agent (reduces auditor tool calls)
57
59
 
58
- Before invoking the sub-agent, extract the context that the auditor would otherwise calculate on its own:
60
+ Before invoking the sub-agent, extract the context that the auditor would otherwise calculate on its own.
61
+
62
+ **3C criterion reference**: the auditor applies the 3D framework per **`METHODOLOGY-CONTRACT.md §3C — 3C Criterion: Completeness, Correctness, Coherence`** — include `codegraphAvailable` in the briefing so the auditor can use CodeGraph for Dimension 3 (Coherence) analysis when available. If `codegraphAvailable: true` and the change touches modules with high fan-out, `codegraph_impact` is recommended before approving (the auditor decides based on the briefing).
63
+
64
+ **CodeGraph detection**: run `refacil-sdd-ai codegraph status --json` and extract:
65
+ - `codegraphAvailable = true` if `installed === true` AND `initialized === true`
66
+ - `codegraphAvailable = false` otherwise
59
67
 
60
68
  1. **Changed files** — use the scope resolved in Step 0.4 (`incrementalScope` if available, otherwise `changedFilesUnion`). Do not run `git diff` or `git status` again.
61
69
 
62
70
  2. **Project type** — read `package.json` (if it exists) and inspect the dependencies:
63
71
  - Backend indicators: `@nestjs/*`, `express`, `fastify`, `koa`, `typeorm`, `prisma`, `pg`, `mongoose`, `bullmq`, `amqplib`
64
72
  - Frontend indicators: `react`, `vue`, `angular`, `next`, `nuxt`, `svelte`, `vite`, `@tanstack/*`
65
- - If both → `fullstack`; if only backend → `backend`; if only frontend → `frontend`; if no `package.json` or none applies → read the first 20 lines of `AGENTS.md` to infer.
73
+ - If both → `fullstack`; if only backend → `backend`; if only frontend → `frontend`.
74
+ - If `package.json` exists but none of the above apply (CLI/methodology package, minimal deps, no web/API framework) → `library`.
75
+ - If no `package.json` or still unclear → read the first 20 lines of `AGENTS.md` to infer.
66
76
 
67
77
  3. **Change objective** (only if there is an active change in `refacil-sdd/changes/`) — read the first section of `proposal.md`. Extract the objective in 1-2 sentences. If the scope is `git-diff` without an active change → `null`.
68
78
 
69
- 4. **Cross-skill memory** — run `refacil-sdd-ai sdd get-memory <changeName> --json` and parse the JSON to extract `stackDetected` and `touchedFiles`. Include them in the briefing so the auditor skips re-discovery. If the command outputs `{}` or fails, omit — do not block (CR-04).
79
+ 4. **Cross-skill memory** — run `refacil-sdd-ai sdd get-memory <changeName> --json` and parse the JSON to extract `stackDetected`, `touchedFiles`, `commandsRun`, `criteriaRun`, and `lastStep`. Include them in the briefing so the auditor skips re-discovery and does **not** re-run the test suite (§3.2). If the command outputs `{}` or fails, omit — do not block (CR-04).
70
80
 
71
81
  5. **Mode** — default `concise`. If re-running after a prior `REQUIERE CORRECCIONES` (i.e., `.review-last-fails.json` was found with non-empty `failedFiles` in Step 0.4): set `mode: focused` — the auditor re-evaluates only the failing checklist items on the `failedFiles` (CR-05: focused mode still reads those files). Otherwise keep `concise`.
72
82
 
@@ -79,8 +89,13 @@ changedFiles: [path/file-1.ts, path/file-2.ts, ...]
79
89
  projectType: backend | frontend | fullstack | library
80
90
  changeObjective: <objective in 1-2 sentences, or null>
81
91
  mode: concise | detailed | focused
92
+ codegraphAvailable: true | false # from CodeGraph detection above
82
93
  stackDetected: <from memory.yaml, or omit>
83
94
  touchedFiles: [...] # from memory.yaml — omit if not present
95
+ commandsRun: [<command>, ...] # from memory.yaml — omit if not present
96
+ criteriaRun: [CA-01, ...] # from memory.yaml — omit if not present
97
+ lastStep: test | verify | apply | ... # from memory.yaml — omit if not present
98
+ testExecution: none # review never runs full suite by default (§3.2)
84
99
  ```
85
100
 
86
101
  ### Step 1: Delegate to the refacil-auditor sub-agent
@@ -95,6 +110,20 @@ The sub-agent:
95
110
  - Evaluates each item with PASS/FAIL/N/A + severity for each FAIL.
96
111
  - Returns ONE single message with the report + JSON block fenced as ` ```refacil-review-result `.
97
112
 
113
+ ### Step 1.5: Log CodeGraph telemetry (silent)
114
+
115
+ After the sub-agent completes, run **once** (do not mention it to the user unless it fails):
116
+
117
+ ```bash
118
+ refacil-sdd-ai compact log-codegraph-event --skill auditor --has-graph <true|false> --tool-calls <N> --tokens <N>
119
+ ```
120
+
121
+ - `--has-graph`: the `codegraphAvailable` value from Step 0.5 of this skill.
122
+ - `--tool-calls`: number of `codegraph_*` tool calls the sub-agent made (0 if it did not use the graph).
123
+ - `--tokens`: conservative estimate of tokens saved (~800–1500 per useful tool call; 0 if no graph or no calls).
124
+
125
+ Estimate `--tool-calls` and `--tokens` from the sub-agent's `<usage>` block using the same criteria as `explore/SKILL.md` Step 1.5. If the command fails, ignore it; it must not block the flow.
126
+
98
127
  ### Step 2: Process the sub-agent report
99
128
 
100
129
  Show the user the **concise report** (everything before the `refacil-review-result` block). Do not show the JSON block — it is internal metadata.
@@ -140,37 +169,46 @@ Where the values are extracted from the sub-agent's `refacil-review-result` bloc
140
169
 
141
170
  ### Step 3.5: Offer to apply corrections (only if REQUIERE CORRECCIONES)
142
171
 
143
- If `verdict` is `REQUIERE CORRECCIONES`, after showing the report present a numbered list of the findings (blockers first, then medium/low) and ask:
172
+ If `verdict` is `REQUIERE CORRECCIONES`:
144
173
 
145
- ```
146
- X corrections are needed. Do you want me to apply them?
147
- - "yes" / "all" apply all
148
- - "1, 3" (numbers) — apply only those items
149
- - "no" / "skip" you'll handle them manually
150
- ```
174
+ - `autopilotMode = false` (normal): show the report, present a numbered list of findings (blockers first, then medium/low) and ask:
175
+ ```
176
+ X corrections are needed. Do you want me to apply them?
177
+ - "yes" / "all" — apply all
178
+ - "1, 3" (numbers)apply only those items
179
+ - "no" / "skip" — you'll handle them manually
180
+ ```
181
+ Apply according to the user's response (yes/all → all; N,M → selected; no/skip → none).
151
182
 
152
- **According to the user's response:**
153
- - **"yes" / "all"**: apply every correction using Edit/Write/Bash tools directly in this skill. After each correction, note it as applied.
154
- - **"N, M" (specific items)**: apply only those numbered items.
155
- - **"no" / "skip" / no answer**: do not apply anything — continue to Step 4.
183
+ - `autopilotMode = true`: categorize findings automatically:
184
+ - **Auto-fixable** (formatting, naming, missing docstring, small refactor within scope): apply all in a single batch, then re-invoke `/refacil:review`. If pass 2 approves → continue to Step 4.
185
+ - **Requires human judgment** (architectural concern, scope question, business logic): abort — do not apply, return failure to the autopilot pipeline without asking the user. If pass 2 still does not approve → abort.
156
186
 
157
- After applying corrections (if any): summarize what was applied, then continue to Step 4.
187
+ After applying corrections (if any):
188
+ - **Do not** run the project's full or scoped test command from AGENTS.md §3.
189
+ - If production code or tests were touched, summarize what was applied and recommend **`/refacil:test`** before another verify/review cycle.
190
+ - Then continue to Step 4.
158
191
 
159
192
  ### Step 4: Recommend next step
160
193
 
161
- According to the parsed `verdict`, add at the end of your response:
194
+ According to the parsed `verdict`:
162
195
 
163
196
  **If APROBADO or APROBADO CON OBSERVACIONES:**
164
- ```
165
- The next step is to archive the change.
166
- Do you want me to continue with /refacil:archive?
167
- ```
197
+ - `autopilotMode = false` (normal): ask the user:
198
+ ```
199
+ The next step is to archive the change.
200
+ Do you want me to continue with /refacil:archive?
201
+ ```
202
+ - `autopilotMode = true`: proceed to `/refacil:archive` immediately without asking.
168
203
 
169
204
  **If REQUIERE CORRECCIONES** (after Step 3.5):
170
- ```
171
- The next step is to re-verify the implementation.
172
- Do you want me to continue with /refacil:verify?
173
- ```
205
+ - `autopilotMode = false` (normal): ask the user:
206
+ ```
207
+ The next step is to re-run tests for this change (/refacil:test), then re-verify.
208
+ Do you want me to continue with /refacil:test?
209
+ ```
210
+ (If the user prefers verify only without re-test, they may say so — default is test first per §3.2.)
211
+ - `autopilotMode = true`: this is an abort condition — Step 3.5 already returned failure to the autopilot pipeline.
174
212
 
175
213
  ## Rules
176
214
 
@@ -180,5 +218,5 @@ Do you want me to continue with /refacil:verify?
180
218
  - If the sub-agent returned something out of format (no parseable JSON block and not `SCOPE_ERROR`), inform the user: "The reviewer returned an unstructured report — no marker was created. Review the report manually."
181
219
  - **Flow continuity**:
182
220
  - If verdict is APROBADO/APROBADO CON OBSERVACIONES and user confirms → immediately invoke `skill: "refacil:archive"`.
183
- - If verdict is REQUIERE CORRECCIONES and user confirms verify (Step 4) → immediately invoke `skill: "refacil:verify"`.
221
+ - If verdict is REQUIERE CORRECCIONES and user confirms (Step 4) → immediately invoke `skill: "refacil:test"` (default per §3.2); invoke `refacil:verify` only if the user explicitly chose verify without re-test.
184
222
  - Do not describe the skill in text or wait for the user to type the command. (See `METHODOLOGY-CONTRACT.md §5`.)
@@ -74,8 +74,8 @@
74
74
  - Tests validate **behavior**, not implementation details (they do not break when refactoring)
75
75
  - Mocks are minimal and necessary — do not mock what can be tested directly
76
76
  - Tests are independent of each other (do not depend on execution order or shared state)
77
- - Coverage >= 80% on new files
78
- - Tests pass without errors (run the test command indicated in AGENTS.md)
77
+ - Coverage >= 80% on new files (rely on **`/refacil:test`** phase + `memory.commandsRun` / `criteriaRun` when present — **do not** run the AGENTS.md baseline test command via Bash unless the user explicitly requested re-execution)
78
+ - Tests pass: **PASS** if test phase succeeded per memory or static review of test files finds no obvious failures; **FAIL** only with evidence (missing tests, broken assertions visible in file, contradictions with spec)
79
79
 
80
80
  ## 7. Security
81
81
  - No hardcoded secrets (passwords, API keys, tokens, internal service URLs)
@@ -8,6 +8,8 @@ user-invocable: true
8
8
 
9
9
  Sends a message visible to all members of the room this session is in. **$ARGUMENTS** = message text.
10
10
 
11
+ > **WARNING**: `say` is ONLY for optional announcements with no expected response. It does NOT guarantee delivery to sessions that join the room after the message was sent, and `say` messages from other sessions do NOT appear in this session's inbox (or any other session's inbox). For actionable content, agreements, bug reports, or anything the recipient must act on, use `bus ask --to SESSION` instead.
12
+
11
13
  ## Instructions
12
14
 
13
15
  ### Step 1: Execute the broadcast
@@ -15,19 +17,51 @@ Sends a message visible to all members of the room this session is in. **$ARGUME
15
17
  Run via `Bash`:
16
18
 
17
19
  ```bash
18
- refacil-sdd-ai bus say --text "<text>"
20
+ refacil-sdd-ai bus say --text "[text]"
19
21
  ```
20
22
 
21
- Where `<text>` is $ARGUMENTS (or what the user asked you to announce). Correctly quote the text.
23
+ Where `[text]` is $ARGUMENTS (or what the user asked you to announce). Correctly quote the text.
22
24
 
23
25
  ### Step 2: Confirm
24
26
 
25
27
  Report to the user that the message was sent with its id.
26
28
 
29
+ ## Safe bus text delivery
30
+
31
+ **Use `--text` for simple messages** (no special characters, single-line):
32
+ ```bash
33
+ refacil-sdd-ai bus say --text "Simple announcement here"
34
+ ```
35
+
36
+ **Do NOT use `<` or `>` inside `--text`** — shells may interpret them as redirection operators and truncate or discard the message.
37
+
38
+ For messages containing `<`, `>`, `|`, newlines, or other special characters, use `--from-env`:
39
+
40
+ **PowerShell (Windows)**:
41
+ ```powershell
42
+ $env:BUS_TEXT = "Announcement with <special> chars"
43
+ refacil-sdd-ai bus say --from-env BUS_TEXT
44
+ Remove-Item Env:BUS_TEXT
45
+ ```
46
+
47
+ **bash (inline, preferred — automatic cleanup)**:
48
+ ```bash
49
+ BUS_TEXT="Announcement with <special> chars" refacil-sdd-ai bus say --from-env BUS_TEXT
50
+ ```
51
+
52
+ **bash (export + unset alternative)**:
53
+ ```bash
54
+ export BUS_TEXT="Announcement with <special> chars"
55
+ refacil-sdd-ai bus say --from-env BUS_TEXT
56
+ unset BUS_TEXT
57
+ ```
58
+
59
+ > Note: the CLI cannot perform cleanup itself — it runs as a child process and cannot modify the parent shell's environment. Cleanup (`Remove-Item` / `unset`) is the responsibility of the invoking script or shell.
60
+
27
61
  ## When to use `say` vs other bus commands
28
62
 
29
- - **`say`**: general announcement to the room — "I finished my part", "I changed the X contract", "I'm going to restart the service"
30
- - **`ask`**: directed question to another specific session (use `/refacil:ask`)
63
+ - **`say`**: general announcement to the room (optional, no response needed) — "I finished my part", "I'm going to restart the service". `say` does NOT guarantee delivery to sessions that join late and does NOT appear in other sessions' inboxes.
64
+ - **`ask`**: directed question or actionable content to another specific session (use `/refacil:ask`). Use this for contracts, bug reports, agreements, anything the recipient must act on.
31
65
  - **`reply`**: respond to a question you were asked (use `/refacil:reply`)
32
66
 
33
67
  ## Rules
@@ -35,4 +69,6 @@ Report to the user that the message was sent with its id.
35
69
  - The session must be joined to a room; if not, the CLI will return an error.
36
70
  - Short and useful message — avoid bus spam.
37
71
  - If the user asks "tell the team ...", use `say`. If they ask "ask X ...", use `ask`.
72
+ - **`say` is ONLY for optional announcements** — it does not guarantee delivery to late-joining sessions and does not appear in any session's inbox. Do not use `say` for contracts, bug reports, change requests, or any content that requires the recipient to act or confirm.
38
73
  - If a room thread **agrees on changes in this repo**, follow `refacil-prereqs/BUS-CROSS-REPO.md`: **`/refacil:propose`** and close via bus with whoever requested the work when done.
74
+ - Do not use `<` or `>` inside `--text` arguments. Use `--from-env` instead (see "Safe bus text delivery" above).
@@ -30,6 +30,58 @@ refacil-sdd-ai sdd 2>&1 || true
30
30
 
31
31
  Confirm that the subcommands `status`, `mark-reviewed`, `tasks-update`, and `archive` appear in the help.
32
32
 
33
+ ### Step 2b: CodeGraph early index (fire-and-forget)
34
+
35
+ Start CodeGraph indexing **now**, before AGENTS.md is generated, so the call-graph is available or building while the rest of setup proceeds.
36
+
37
+ Run:
38
+
39
+ ```bash
40
+ refacil-sdd-ai sdd config --json
41
+ ```
42
+
43
+ Parse the JSON. Check `codegraphMode` and its `sources.codegraphMode`:
44
+
45
+ - **`disabled`**: skip this step entirely. Do not mention CodeGraph.
46
+
47
+ - **`enabled`** (global or project setting):
48
+
49
+ - **CLI installed** (`installed: true`): fire indexing immediately in the background — **do not wait**:
50
+
51
+ ```bash
52
+ refacil-sdd-ai codegraph init
53
+ ```
54
+
55
+ Inform the user: "CodeGraph: indexing started in background. The `.codegraph/` directory will appear when complete (~30 s for small repos)."
56
+
57
+ - **CLI not installed** (`installed: false`): ask the user:
58
+
59
+ ```
60
+ CodeGraph is enabled but the CLI is not installed.
61
+ Do you want to install it now? This runs: npm install -g @colbymchenry/codegraph (~20 s)
62
+ (yes / no)
63
+ ```
64
+
65
+ - If **yes**: run `refacil-sdd-ai codegraph setup` and **show its full output**. This command installs the package and builds the index **synchronously** — it blocks until `.codegraph/` is fully ready. Wait for it to complete before continuing.
66
+ - If **no**: skip CodeGraph for now. Inform: "You can install it later by running `npm install -g @colbymchenry/codegraph` and then `/refacil:update`."
67
+
68
+ - **`per-repo`**: ask the user once:
69
+
70
+ ```
71
+ Do you want to enable CodeGraph for this repo?
72
+ It indexes the call graph so exploratory sub-agents can query symbols instead of reading files (~71% token savings).
73
+ (yes / no)
74
+ ```
75
+
76
+ - If **yes**:
77
+ - **CLI installed**: run `refacil-sdd-ai codegraph init` in background, then persist the per-repo preference:
78
+ ```bash
79
+ refacil-sdd-ai sdd write-config --codegraph enabled
80
+ ```
81
+ Inform: "CodeGraph indexing started in background."
82
+ - **CLI not installed**: ask to install first (same flow as the `enabled` / not-installed branch above). If user installs: persist preference and init. If user skips: do not persist the enabled preference.
83
+ - If **no**: skip silently (per-repo decision, no global effect).
84
+
33
85
  ### Step 3: Create changes directory
34
86
 
35
87
  If `refacil-sdd/changes/` does not exist, create it:
@@ -156,7 +208,9 @@ Produce neutral placeholders (e.g. “Stack: unknown — see README / add manife
156
208
  | `/refacil:verify` | Verify implementation against the specs |
157
209
  | `/refacil:review` | Quality audit of the implemented code |
158
210
  | `/refacil:archive` | Archive the change and sync specs to the historical record |
159
- | `/refacil:up-code` | Update existing code to current patterns |
211
+ | `/refacil:up-code` | Commit, push, and open PR for the current change |
212
+ | `/refacil:autopilot` | Autonomous pipeline after approved propose: apply → test → verify → review → archive → up-code |
213
+ | `/refacil:read-spec` | Listen to SDD spec Markdown in the browser with on-device TTS |
160
214
  | `/refacil:bug` | Create a fix proposal for a detected bug |
161
215
  | `/refacil:update` | Migrate documentation to the current methodology pattern |
162
216
  | `/refacil:join` | Join the cross-repo bus (first service setup) |
@@ -204,8 +258,8 @@ If the user wants extra exclusions beyond the base list, they may edit the ignor
204
258
 
205
259
  ### Step 6: Verify skills
206
260
 
207
- - Verify **`refacil-*`** folders under **global** IDE dirs (skills are installed per machine, not per repo): **`~/.claude/skills/`** when Claude is selected, **`~/.cursor/skills/`** when Cursor is selected (OpenCode / Codex: global dirs per upstream docs).
208
- If missing: run **`refacil-sdd-ai init`** and restart the IDE session.
261
+ - Verify **`refacil-*`** folders under **global** IDE dirs (skills are installed per machine, not per repo): **`~/.claude/skills/`**, **`~/.cursor/skills/`**, **`~/.config/opencode/skills/`** (or `OPENCODE_CONFIG_DIR`), **`~/.codex/skills/`** only for IDEs selected in **`refacil-sdd-ai init`**.
262
+ If missing: run **`refacil-sdd-ai init`** and restart your IDE session.
209
263
  - Verify `sdd` subcommand: `refacil-sdd-ai sdd 2>&1 || true` — must show subcommands `status`, `mark-reviewed`, `tasks-update`, `archive`.
210
264
 
211
265
  ### Step 7: Final summary
@@ -214,11 +268,11 @@ If the user wants extra exclusions beyond the base list, they may edit the ignor
214
268
  === refacil:setup completed ===
215
269
  Node.js / refacil-sdd-ai / refacil-sdd/changes/ / branch config / AGENTS.md / sync-repo-ide (selected IDEs) / skills OK
216
270
 
217
- Restart Claude Code or Cursor session if this is the first skills installation.
271
+ Restart your IDE session (Claude Code, Cursor, OpenCode, or Codex) if this is the first skills installation.
218
272
  The next step is to review the available flow.
219
273
  Do you want me to continue with /refacil:guide?
220
274
  ```
221
275
 
222
276
  ## Rules
223
277
 
224
- - **Flow continuity**: if the user confirms affirmatively ("yes", "ok", "go", "continue", etc.) the continuity question in Step 7, immediately invoke the **Skill tool** with `skill: "refacil:guide"`. Do not describe it in text or wait for the user to type `/refacil:guide`. (See `METHODOLOGY-CONTRACT.md §5`.)
278
+ - **Flow continuity**: if the user confirms affirmatively ("yes", "ok", "go", "continue", etc.) the continuity question in Step 7, immediately execute `/refacil:guide`. Do not describe it in text or wait for the user to type it. (See `METHODOLOGY-CONTRACT.md §5`.)
@@ -9,8 +9,16 @@ Consult this file **only** if a setup step fails. It is not part of the happy pa
9
9
 
10
10
  ## Skills `refacil-*` do not appear in the IDE
11
11
 
12
- - Run `refacil-sdd-ai init` at the repo root and **restart** the Claude Code or Cursor session.
13
- - If the skills are present in `.claude/skills/` but the IDE does not pick them up, restart the IDE (not just the session).
12
+ - Run `refacil-sdd-ai init` at the repo root and **restart** the IDE session.
13
+ - If the skills are present in the global IDE skills directory (e.g. `~/.claude/skills/`, `~/.cursor/skills/`, `~/.config/opencode/skills/`, `~/.codex/skills/`) but the IDE does not pick them up, restart the IDE (not just the session).
14
+
15
+ ## OpenCode hooks (global plugin)
16
+
17
+ - OpenCode uses a **global** plugin at `~/.config/opencode/plugins/refacil-hooks.js` (not project `.opencode/plugins/`). Reinstall with `refacil-sdd-ai init` or `refacil-sdd-ai update` when OpenCode is selected, then restart OpenCode.
18
+
19
+ ## Codex hooks
20
+
21
+ - Codex hooks merge into `~/.codex/config.toml` under `[hooks]` with `[features] codex_hooks = true`. Run `refacil-sdd-ai init` with Codex selected, then restart the Codex session.
14
22
 
15
23
  ## `refacil-sdd-ai init` creates files inside the wrong directory
16
24
 
@@ -43,7 +51,7 @@ Consult this file **only** if a setup step fails. It is not part of the happy pa
43
51
 
44
52
  ## Hook `check-update` not running at session start
45
53
 
46
- - Verify the hook is registered: check `.claude/settings.json` or `.cursor/settings.json` for a `hooks.SessionStart` entry that calls `refacil-sdd-ai check-update`.
54
+ - Verify the hook is registered: Claude → `~/.claude/settings.json` (`SessionStart`); Cursor → `~/.cursor/hooks.json` (`sessionStart` when starting Agent chat — not duplicated on `workspaceOpen`). Both call `refacil-sdd-ai check-update`.
47
55
  - If missing, run `refacil-sdd-ai init` again (it is idempotent).
48
56
 
49
57
  ## `refacil-sdd/` not created after using SDD commands