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.
- package/NOTICE.md +46 -0
- package/README.md +209 -42
- package/agents/auditor.md +46 -0
- package/agents/debugger.md +41 -1
- package/agents/implementer.md +76 -10
- package/agents/investigator.md +36 -0
- package/agents/proposer.md +46 -2
- package/agents/tester.md +45 -8
- package/agents/validator.md +67 -13
- package/bin/cli.js +428 -83
- package/bin/postinstall.js +20 -0
- package/lib/bus/broker.js +121 -3
- package/lib/bus/spawn.js +189 -121
- package/lib/check-review.js +102 -0
- package/lib/codegraph-telemetry.js +135 -0
- package/lib/codegraph.js +273 -0
- package/lib/commands/autopilot.js +120 -0
- package/lib/commands/bus.js +29 -36
- package/lib/commands/compact.js +185 -46
- package/lib/commands/read-spec.js +352 -0
- package/lib/commands/sdd.js +429 -44
- package/lib/compact-guidance.js +122 -77
- package/lib/config.js +136 -0
- package/lib/global-paths.js +56 -20
- package/lib/hooks.js +32 -4
- package/lib/ide-detection.js +1 -1
- package/lib/ignore-files.js +5 -1
- package/lib/installer.js +202 -19
- package/lib/kapso.js +241 -0
- package/lib/methodology-migration-pending.js +13 -0
- package/lib/open-browser.js +32 -0
- package/lib/opencode-migrate.js +148 -0
- package/lib/opencode-plugin/index.js +84 -104
- package/lib/opencode-plugin/rules.js +236 -0
- package/lib/project-root.js +154 -0
- package/lib/repo-ide-sync.js +5 -0
- package/lib/spec-reader/lang.js +72 -0
- package/lib/spec-reader/md-parser.js +299 -0
- package/lib/spec-reader/session.js +139 -0
- package/lib/spec-reader/ui/app.js +685 -0
- package/lib/spec-reader/ui/index.html +59 -0
- package/lib/spec-reader/ui/mixed-lang.js +200 -0
- package/lib/spec-reader/ui/model-cache.js +117 -0
- package/lib/spec-reader/ui/style.css +294 -0
- package/lib/spec-reader/ui/supertonic-helper.js +565 -0
- package/lib/spec-sync.js +258 -0
- package/lib/test-scope.js +713 -0
- package/lib/testing-policy-sync.js +14 -2
- package/package.json +6 -3
- package/skills/apply/SKILL.md +39 -64
- package/skills/archive/SKILL.md +74 -48
- package/skills/ask/SKILL.md +43 -8
- package/skills/autopilot/SKILL.md +476 -0
- package/skills/bug/SKILL.md +52 -53
- package/skills/explore/SKILL.md +48 -1
- package/skills/guide/SKILL.md +31 -13
- package/skills/inbox/SKILL.md +9 -0
- package/skills/join/SKILL.md +1 -1
- package/skills/prereqs/BUS-CROSS-REPO.md +33 -16
- package/skills/prereqs/METHODOLOGY-CONTRACT.md +96 -17
- package/skills/prereqs/SKILL.md +1 -1
- package/skills/propose/SKILL.md +74 -19
- package/skills/read-spec/SKILL.md +76 -0
- package/skills/reply/SKILL.md +42 -9
- package/skills/review/SKILL.md +63 -25
- package/skills/review/checklist.md +2 -2
- package/skills/say/SKILL.md +40 -4
- package/skills/setup/SKILL.md +59 -5
- package/skills/setup/troubleshooting.md +11 -3
- package/skills/stats/SKILL.md +157 -0
- package/skills/test/SKILL.md +35 -10
- package/skills/up-code/SKILL.md +20 -13
- package/skills/update/SKILL.md +32 -1
- package/skills/verify/SKILL.md +78 -41
- package/templates/compact-guidance.md +10 -0
- package/templates/methodology-guide.md +5 -0
package/skills/explore/SKILL.md
CHANGED
|
@@ -29,10 +29,42 @@ Before delegating, check the current session conversation context for a prior co
|
|
|
29
29
|
Wait for the user's answer before proceeding.
|
|
30
30
|
- **If there is no prior exploration** (or it is on a clearly different topic): continue to Step 1 without interruption.
|
|
31
31
|
|
|
32
|
+
### Step 0.2: CodeGraph availability check
|
|
33
|
+
|
|
34
|
+
Run `refacil-sdd-ai codegraph status --json` and parse the output. Set `codegraphAvailable`:
|
|
35
|
+
- `true` if `installed === true` AND `initialized === true`
|
|
36
|
+
- `false` otherwise
|
|
37
|
+
|
|
38
|
+
**If `mode` is `enabled` or `per-repo` but `codegraphAvailable` is `false`**:
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
**[GATE — STOP AND WAIT: CodeGraph not indexed]**
|
|
43
|
+
|
|
44
|
+
Do NOT proceed to Step 1. Do NOT delegate to the sub-agent. STOP and ask the user exactly this, then wait for their reply:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
CodeGraph is enabled for this repo but not yet indexed (~30s to build).
|
|
48
|
+
Without it, the exploration uses Grep/Read — slower and less precise for call-graph questions.
|
|
49
|
+
|
|
50
|
+
Do you want me to run /refacil:update first to build the index?
|
|
51
|
+
yes → run /refacil:update then continue with the exploration
|
|
52
|
+
no → continue with standard exploration now
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Only after the user replies:
|
|
56
|
+
- **"yes"** (or "si", "dale", "sí", "go", "ok"): immediately execute `/refacil:update`. Do not describe it in text.
|
|
57
|
+
- **"no"** (or "skip", "continue", "continúa", "así"): set `codegraphAvailable: false` and proceed to Step 1.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
**If `mode` is `disabled` or `null`**: set `codegraphAvailable: false` and continue to Step 1 without asking.
|
|
62
|
+
|
|
32
63
|
### Step 1: Delegate to the refacil-investigator sub-agent
|
|
33
64
|
|
|
34
65
|
Invoke the `refacil-investigator` sub-agent passing it:
|
|
35
66
|
- The user's question (`$ARGUMENTS`).
|
|
67
|
+
- `codegraphAvailable: true | false` (from Step 0.2).
|
|
36
68
|
- If the user explicitly requested detailed mode, indicate it (`mode: detailed`). Default: concise.
|
|
37
69
|
|
|
38
70
|
The sub-agent:
|
|
@@ -41,6 +73,20 @@ The sub-agent:
|
|
|
41
73
|
- Detects cross-repo dependencies and, if appropriate, consults the bus according to `refacil-prereqs/BUS-CROSS-REPO.md`.
|
|
42
74
|
- Returns a report with architecture, flows, dependencies, and next-step recommendations.
|
|
43
75
|
|
|
76
|
+
### Step 1.5: Log CodeGraph telemetry (silent)
|
|
77
|
+
|
|
78
|
+
After the sub-agent completes, run **once** (do not mention it to the user unless it fails):
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
refacil-sdd-ai compact log-codegraph-event --skill investigator --has-graph <true|false> --tool-calls <N> --tokens <N>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- `--has-graph`: the `codegraphAvailable` value from Step 0.2.
|
|
85
|
+
- `--tool-calls`: number of `codegraph_*` tool calls the sub-agent made (0 if it did not use the graph).
|
|
86
|
+
- `--tokens`: conservative estimate of tokens saved vs. reading whole files (~800–1500 per useful tool call; 0 if no graph or no calls).
|
|
87
|
+
|
|
88
|
+
If the command fails, ignore it; it must not block the flow.
|
|
89
|
+
|
|
44
90
|
### Step 2: Present the report
|
|
45
91
|
|
|
46
92
|
Show the user the full report returned by the sub-agent. There are no artifacts to write — exploration is purely analytical.
|
|
@@ -60,7 +106,8 @@ The sub-agent already includes recommendations at the end of its report. Apply t
|
|
|
60
106
|
- **Always delegate to the sub-agent**. Do not replicate the exploration logic here.
|
|
61
107
|
- **Do not invoke without a question**. If `$ARGUMENTS` is empty, ask for the question first.
|
|
62
108
|
- **Do not write files**. Exploration is read-only end-to-end.
|
|
63
|
-
- **
|
|
109
|
+
- **CodeGraph gate (Step 0.2)**: if `mode` is `enabled`/`per-repo` and `codegraphAvailable` is `false`, the GATE is **mandatory** — never skip it. If the user replies affirmatively ("yes", "si", "sí", "dale", "ok", "go"), immediately execute `/refacil:update` without any prior text. Do not describe it. Do not ask again. (See `METHODOLOGY-CONTRACT.md §5`.)
|
|
110
|
+
- **Flow continuity**: if the user confirms affirmatively ("yes", "ok", "go", "continue", etc.) the continuity question in Step 3, immediately execute the resolved `/refacil:<skill>` command. Deterministic resolution:
|
|
64
111
|
|
|
65
112
|
| Finding | Skill |
|
|
66
113
|
|---------|-------|
|
package/skills/guide/SKILL.md
CHANGED
|
@@ -20,7 +20,9 @@ You are a **brief** guide: you choose the next command; the detail of each flow
|
|
|
20
20
|
|
|
21
21
|
## Menu
|
|
22
22
|
|
|
23
|
-
1. New feature → `/refacil:propose` →
|
|
23
|
+
1. New feature → `/refacil:propose` → *(optional)* `/refacil:read-spec` → then choose implementation:
|
|
24
|
+
- **Step-by-step (A):** `/refacil:apply` → `/refacil:test` (suite + coverage) → `/refacil:verify` (CA/CR; no full re-test by default) → `/refacil:review` (checklist; no suite) → `/refacil:archive` → `/refacil:up-code`
|
|
25
|
+
- **Autonomous (B):** `/refacil:autopilot` — chains apply → test → verify → review → archive in one invocation; up-code (push + PR) is optional and configured in pre-flight (the user chooses whether to end at archive or continue with up-code); optional WhatsApp via `refacil-sdd-ai kapso setup`
|
|
24
26
|
2. Bug → `/refacil:bug` → `/refacil:review` → `/refacil:archive` → `/refacil:up-code`
|
|
25
27
|
3. Explore → `/refacil:explore`
|
|
26
28
|
4. Tests → `/refacil:test`
|
|
@@ -30,12 +32,23 @@ You are a **brief** guide: you choose the next command; the detail of each flow
|
|
|
30
32
|
8. Configure repo → `refacil-sdd-ai init` (global + per repo) and `/refacil:setup`
|
|
31
33
|
9. Migrate documentation to current pattern → `/refacil:update`
|
|
32
34
|
10. Coordinate with other repos (without manual copy/paste) → see **Bus between agents** block below
|
|
35
|
+
11. Autonomous pipeline (after approved propose) → `/refacil:autopilot` — same chain as option 1 path B; use when you want autonomous execution ("autopilot", "modo autónomo", "termina solo el flujo"). During pre-flight you define whether up-code (push + PR) is included — the cycle adapts and can end at archive or continue with up-code.
|
|
36
|
+
12. Listen to specs with voice (TTS) → `/refacil:read-spec` — on-device browser playback; post-propose option B in propose, or on-demand for active changes / archived specs (`refacil-sdd-ai read-spec --change <name>`)
|
|
37
|
+
13. Change progress and metrics → `/refacil:stats` — task completion, review gate, test commands from `memory.yaml` (`refacil-sdd-ai sdd stats <changeName>`)
|
|
33
38
|
|
|
34
39
|
> **Note**: `up-code` verifies `.review-passed` before push; see `METHODOLOGY-CONTRACT.md §5-6` for details.
|
|
35
40
|
|
|
41
|
+
> **Skill parity**: 21 user-invocable skills (`user-invocable: true`, excluding internal `prereqs`) must appear in `SKILLS[]`, this menu, and the README "Available IDE Skills" table — including `read-spec` and `stats`.
|
|
42
|
+
|
|
43
|
+
### After `/refacil:propose` is approved
|
|
44
|
+
|
|
45
|
+
- **`/refacil:read-spec`** (optional): opens the change folder in the browser and reads proposal, design, tasks, and specs aloud in order — useful before choosing implementation.
|
|
46
|
+
- **`/refacil:apply`** (path A): step-by-step; each phase pauses for confirmation.
|
|
47
|
+
- **`/refacil:autopilot`** (path B): fully autonomous; path B is independent — it runs review, archive, and optionally up-code internally. During pre-flight the user configures whether up-code is included (cycle ends at archive or at a PR). Does not merge into path A.
|
|
48
|
+
|
|
36
49
|
## Bus between agents (refacil-bus)
|
|
37
50
|
|
|
38
|
-
For when the dev has multiple
|
|
51
|
+
For when the dev has multiple IDE sessions open (one per repo) and needs agents to consult each other without the dev being the manual transcriber:
|
|
39
52
|
|
|
40
53
|
| Command | When to use |
|
|
41
54
|
|---------|-------------|
|
|
@@ -58,22 +71,27 @@ Full detail in the refacil-sdd-ai README (section `refacil-bus`).
|
|
|
58
71
|
|
|
59
72
|
## Tips (one line per tool)
|
|
60
73
|
|
|
61
|
-
- **
|
|
62
|
-
- **
|
|
74
|
+
- **IDE chat / composer:** `/refacil:*` commands in the chat or composer panel.
|
|
75
|
+
- **Listen to specs:** `/refacil:read-spec` or `refacil-sdd-ai read-spec --change <changeName>` — local TTS only, no remote APIs.
|
|
76
|
+
- **Hands-off implementation:** `/refacil:autopilot [changeName]` after propose is approved — in pre-flight you choose whether up-code (push + PR) is included. Configure Kapso once with `refacil-sdd-ai kapso setup` for WhatsApp notification on finish.
|
|
63
77
|
|
|
64
78
|
## Rules
|
|
65
79
|
|
|
66
|
-
- **Flow continuity**: if the user confirms affirmatively ("yes", "ok", "go", "continue", etc.) to the continuity question in step 4 of Instructions, immediately
|
|
67
|
-
- Option 1 (New feature) →
|
|
68
|
-
- Option 2 (Bug) →
|
|
69
|
-
- Option 3 (Explore) →
|
|
70
|
-
- Option 4 (Tests) →
|
|
71
|
-
- Option 5 (Validate implementation) →
|
|
72
|
-
- Option 6 (Quality review) →
|
|
73
|
-
- Option 7 (Push code and create PR) →
|
|
74
|
-
- Option 8 (Configure repo) →
|
|
80
|
+
- **Flow continuity**: if the user confirms affirmatively ("yes", "ok", "go", "continue", etc.) to the continuity question in step 4 of Instructions, immediately execute the resolved `/refacil:<skill>` command. Deterministic resolution by Menu option:
|
|
81
|
+
- Option 1 (New feature) → `/refacil:propose`
|
|
82
|
+
- Option 2 (Bug) → `/refacil:bug`
|
|
83
|
+
- Option 3 (Explore) → `/refacil:explore`
|
|
84
|
+
- Option 4 (Tests) → `/refacil:test`
|
|
85
|
+
- Option 5 (Validate implementation) → `/refacil:verify`
|
|
86
|
+
- Option 6 (Quality review) → `/refacil:review`
|
|
87
|
+
- Option 7 (Push code and create PR) → `/refacil:up-code`
|
|
88
|
+
- Option 8 (Configure repo) → `/refacil:setup`
|
|
75
89
|
- Option 9 (Migrate documentation) → `skill: "refacil:update"`
|
|
76
90
|
- Option 10 (Bus between agents) → `skill: "refacil:join"` (or another from the group `refacil:say`/`refacil:ask`/`refacil:reply`/`refacil:attend`/`refacil:inbox` depending on the expressed intent).
|
|
91
|
+
- Option 11 (Autonomous pipeline) → `/refacil:autopilot`
|
|
92
|
+
- Option 12 (Listen to specs) → `/refacil:read-spec`
|
|
93
|
+
- Option 13 (Change progress) → `/refacil:stats`
|
|
94
|
+
- Post-propose context with a single clear next step: if artifacts are approved and the user wants hands-off → `/refacil:autopilot`; if they want to hear specs first → `/refacil:read-spec`; if they want step-by-step → `/refacil:apply`.
|
|
77
95
|
- If the intent does not map exactly to an option, do NOT invoke — list numbered options to the user and ask for explicit selection.
|
|
78
96
|
|
|
79
97
|
Do not describe it in text or wait for the user to type the command. (See `METHODOLOGY-CONTRACT.md §5`.)
|
package/skills/inbox/SKILL.md
CHANGED
|
@@ -31,6 +31,15 @@ The CLI prints the new messages (if any) with `from`, `kind`, text, and timestam
|
|
|
31
31
|
|
|
32
32
|
Present the new messages clearly and, if applicable, propose the next step.
|
|
33
33
|
|
|
34
|
+
## What appears in the inbox
|
|
35
|
+
|
|
36
|
+
The inbox for this session shows **only**:
|
|
37
|
+
|
|
38
|
+
1. **`ask` messages directed to this session** — sent by another session with `bus ask --to [this-session]` or `bus ask --to all`.
|
|
39
|
+
2. **`reply` messages to your own `correlationId`** — responses to questions you sent with `bus ask`.
|
|
40
|
+
|
|
41
|
+
**`say` (broadcast) messages from other sessions do NOT appear in this session's inbox.** `say` is a real-time broadcast only; sessions that were not connected when the `say` was sent will never see it in the inbox. For content that must be received and acted on, use `bus ask --to SESSION` instead.
|
|
42
|
+
|
|
34
43
|
## When to use `/refacil:inbox`
|
|
35
44
|
|
|
36
45
|
- After a `/refacil:ask --wait N` expired without a response — to check if it arrived later.
|
package/skills/join/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: refacil:join
|
|
3
|
-
description: Join (or create) an agent bus room to communicate with Claude Code
|
|
3
|
+
description: Join (or create) an agent bus room to communicate with Claude Code, Cursor, OpenCode, or Codex sessions in other repos. Session name = repo folder name.
|
|
4
4
|
user-invocable: true
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -34,9 +34,9 @@ When the skill's trigger is met:
|
|
|
34
34
|
|
|
35
35
|
1. **Verify active rooms**: run `refacil-sdd-ai bus rooms` to see the rooms and their members.
|
|
36
36
|
2. **Evaluate preconditions**:
|
|
37
|
-
- **If there is an active room AND the repo you need to consult is already in it**: you can run `/refacil:ask
|
|
37
|
+
- **If there is an active room AND the repo you need to consult is already in it**: you can run `/refacil:ask @[repo-name] "..." --wait 180` directly. **Inform the user before sending** ("I'm going to ask @X in room Y: ..."). If the other repo is in `/refacil:attend` it responds automatically; if not, the dev goes to that window and runs `/refacil:inbox`.
|
|
38
38
|
- **If the `ask` is a change request** in the destination repo (not just an informational question), draft **concrete scope and criteria**; the destination session already operates under SDD-AI (joined with `/refacil:join`) and should channel the work with **`/refacil:propose`** there without you repeating the guide in the message. See `/refacil:ask` Step 1.5 and the "Room agreements" section below.
|
|
39
|
-
- **If there is no room, or the repo you need is not in any**: **do not create the room on your own**. Ask the user to run `/refacil:join
|
|
39
|
+
- **If there is no room, or the repo you need is not in any**: **do not create the room on your own**. Ask the user to run `/refacil:join [room-name]` in **this** session and also in the other repo's session (another IDE window). Both repos must be in the same room. Once confirmed, return to step 2.
|
|
40
40
|
|
|
41
41
|
If the user does not know the bus or does not know how to configure it, refer them to `/refacil:guide` (section "Bus between agents") before attempting the consultation.
|
|
42
42
|
|
|
@@ -53,24 +53,24 @@ Avoid vague requests like "check this integration". Prefer concrete contract que
|
|
|
53
53
|
Recommended ask template (integration clarification):
|
|
54
54
|
|
|
55
55
|
```text
|
|
56
|
-
integrationPoint:
|
|
57
|
-
inputContract:
|
|
58
|
-
outputContract:
|
|
59
|
-
compatibility:
|
|
60
|
-
sourceOfTruthRequest:
|
|
61
|
-
question:
|
|
56
|
+
integrationPoint: [endpoint/event/queue + direction]
|
|
57
|
+
inputContract: [fields + validations]
|
|
58
|
+
outputContract: [outputs/status/errors]
|
|
59
|
+
compatibility: [version/constraints or unknown]
|
|
60
|
+
sourceOfTruthRequest: [where to confirm in destination repo]
|
|
61
|
+
question: [concrete doubt]
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
Recommended reply template:
|
|
65
65
|
|
|
66
66
|
```text
|
|
67
|
-
integrationPoint:
|
|
68
|
-
inputContract:
|
|
69
|
-
outputContract:
|
|
70
|
-
compatibility:
|
|
71
|
-
sourceOfTruth:
|
|
72
|
-
confidence:
|
|
73
|
-
openQuestions:
|
|
67
|
+
integrationPoint: [confirmed value]
|
|
68
|
+
inputContract: [confirmed value]
|
|
69
|
+
outputContract: [confirmed value]
|
|
70
|
+
compatibility: [confirmed value or unknown]
|
|
71
|
+
sourceOfTruth: [file/path/symbol in destination repo]
|
|
72
|
+
confidence: [high|medium|low]
|
|
73
|
+
openQuestions: [none | unresolved items]
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
These templates support both first-pass clarification and retry loops.
|
|
@@ -97,10 +97,27 @@ If in the room (via `say` messages, `ask`/`reply` threads, or a mix) **agreement
|
|
|
97
97
|
**Closing with the requester**: whoever **implements** here, upon finishing the agreed change (or reaching a clear state: done, PR, blocked, delegated), **must notify via bus** whoever originated the request or the room as appropriate:
|
|
98
98
|
|
|
99
99
|
- If the work originated from an **`ask`** to this session and the context is still the same thread: **`/refacil:reply`** with the summary (the broker links `correlationId`).
|
|
100
|
-
- If the agreement was via **`say`**, there are multiple interlocutors, or the same `ask` no longer applies: **`/refacil:ask
|
|
100
|
+
- If the agreement was via **`say`**, there are multiple interlocutors, or the same `ask` no longer applies: **`/refacil:ask @[requesting-session] "..."`** with the closing, or **`/refacil:say`** if the closing should be visible to the **entire** room.
|
|
101
101
|
|
|
102
102
|
By default: **do not close silently** when another session was waiting for the result of the agreement.
|
|
103
103
|
|
|
104
|
+
## Hard rule: `ask` + `reply` for contracts and agreements (never `say`)
|
|
105
|
+
|
|
106
|
+
**Contract agreements, change requirements, bug reports, and any notification the recipient must process MUST be sent as `bus ask --to SESSION`, never as `bus say`.**
|
|
107
|
+
|
|
108
|
+
Reasons:
|
|
109
|
+
- `say` is a real-time broadcast. Sessions that join the room after the `say` was sent **will never see it** — it does not appear in the inbox.
|
|
110
|
+
- `say` provides no delivery confirmation per recipient and cannot be part of a `correlationId` thread.
|
|
111
|
+
- Only `ask` + `reply` guarantees that the message is stored in the recipient's inbox, linked by `correlationId`, and retrievable via `/refacil:inbox` at any time.
|
|
112
|
+
|
|
113
|
+
Apply this rule to:
|
|
114
|
+
- Any content the destination agent must act on (implement, review, confirm, fix)
|
|
115
|
+
- Contract agreements between services
|
|
116
|
+
- Close/done notifications for work items another session was waiting for
|
|
117
|
+
- Bug reports that require work in another repo
|
|
118
|
+
|
|
119
|
+
`say` remains valid for **optional real-time announcements** with no required response (e.g., "restarting the service", "finished my phase"). Do not use `say` as a substitute for `ask` when acknowledgment or action is required.
|
|
120
|
+
|
|
104
121
|
## What NOT to do
|
|
105
122
|
|
|
106
123
|
- Do not assume the other repo's behavior without consulting.
|
|
@@ -5,10 +5,10 @@ This file centralizes cross-cutting rules to avoid duplication and inconsistenci
|
|
|
5
5
|
## §1 — Flow states (Definition of Ready / Done)
|
|
6
6
|
|
|
7
7
|
- **READY_FOR_PROPOSE**: problem understood (objective, scope, constraints) and minimum repo context.
|
|
8
|
-
- **READY_FOR_APPLY**: complete SDD artifacts (`proposal.md`, `design.md`, `tasks.md`, specification in `specs.md` and/or `specs/**/*.md`) and explicit user approval.
|
|
9
|
-
- **READY_FOR_VERIFY**: implementation finished, no changes outside scope.
|
|
10
|
-
- **READY_FOR_REVIEW**: for regular changes (propose), verify executed and critical issues resolved or accepted by the user. For bug fixes, the implementation and regression tests are complete (bugs do not go through verify).
|
|
11
|
-
- **READY_FOR_ARCHIVE**: review approved (`.review-passed` exists), tasks complete or
|
|
8
|
+
- **READY_FOR_APPLY**: complete SDD artifacts (`proposal.md`, `design.md`, `tasks.md`, specification in `specs.md` and/or recursive `specs/**/*.md`) and explicit user approval. Empty `specs/` folders do not count as specs.
|
|
9
|
+
- **READY_FOR_VERIFY**: implementation finished, no changes outside scope; **`/refacil:test`** should have run (or user accepts running verify without test memory — see §3.2 CR-01).
|
|
10
|
+
- **READY_FOR_REVIEW**: for regular changes (propose), verify executed (CA/CR validation; tests delegated to test phase by default per §3.2) and critical issues resolved or accepted by the user. For bug fixes, the implementation and regression tests are complete (bugs do not go through verify).
|
|
11
|
+
- **READY_FOR_ARCHIVE**: review approved (`.review-passed` exists), tasks complete or approved `fix-*` exception, current `/refacil:test` evidence available unless explicitly accepted in normal mode, change functionally closed.
|
|
12
12
|
- **READY_FOR_MERGE**: review approved (`.review-passed` exists) and integration ready: PR created for the target branch. `/refacil:up-code` automatically verifies the review before push — if missing, it runs it.
|
|
13
13
|
- If multiple active changes exist without review, the target change must be explicitly selected before running review/push.
|
|
14
14
|
|
|
@@ -17,26 +17,30 @@ This file centralizes cross-cutting rules to avoid duplication and inconsistenci
|
|
|
17
17
|
- If a skill requires the `sdd` profile: `AGENTS.md` is mandatory (if missing, stop and redirect to `/refacil:setup`).
|
|
18
18
|
- If a skill requires the `agents` profile: if `AGENTS.md` is missing, continue with a generic baseline and report the limitation to the user.
|
|
19
19
|
|
|
20
|
-
## §3 — Test command resolution (multi-stack)
|
|
20
|
+
## §3 — Test command resolution (multi-stack, component-bounded)
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
**Component principle (language-agnostic)**: a *component* is the nearest independent unit with its own test setup — the closest ancestor directory (walking up from each changed file, bounded by the repo root) that contains a stack manifest (`package.json`, `go.mod`, `pyproject.toml`/`setup.py`/`pytest.ini`, `Cargo.toml`, `pom.xml`/`build.gradle`(.kts), `global.json`/`Directory.Build.props`, etc.). The `refacil-sdd-ai sdd test-scope` tool (`affectedComponents()`) exposes this automatically.
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
**All test execution is component-bounded**: no phase ever runs tests across the entire monorepo. `testScope: scoped` runs the narrowed tests of the affected component(s); `testScope: full` runs the full suite of each affected component (never all packages). The component root is the working directory for test commands in that component.
|
|
25
|
+
|
|
26
|
+
Do not hardcode any specific runner (e.g. `npm test`) unless it is genuinely the project's command. Resolve the command language-agnostically:
|
|
27
|
+
|
|
28
|
+
Detection order (applied at the **component root**, not the monorepo root):
|
|
29
|
+
1. If `AGENTS.md` defines the official test command for this component, use that.
|
|
30
|
+
2. If a package manager script exists at the component root (e.g. `npm test`, `pnpm test`, `yarn test`, `bun test`, `poetry run pytest`, etc.), use the corresponding one.
|
|
27
31
|
3. If Python: `pytest`.
|
|
28
32
|
4. If Go: `go test ./...`.
|
|
29
33
|
5. If Rust: `cargo test`.
|
|
30
34
|
6. If Java/Gradle: `./gradlew test` or `gradle test`.
|
|
31
35
|
7. If Java/Maven: `mvn test`.
|
|
32
36
|
|
|
33
|
-
Coverage (if applicable): detect the project command (`test:cov`, `coverage`, `pytest --cov`, etc.). If it does not exist, report N/A with justification.
|
|
37
|
+
Coverage (if applicable): detect the project command at the component root (`test:cov`, `coverage`, `pytest --cov`, etc.). If it does not exist, report N/A with justification.
|
|
34
38
|
|
|
35
|
-
### §3.1 — Scoped test execution (default for `/refacil:test`, `/refacil:
|
|
39
|
+
### §3.1 — Scoped test execution (default for `/refacil:test`, `/refacil:apply`, and debugger fix mode; optional in `/refacil:verify` per §3.2)
|
|
36
40
|
|
|
37
41
|
**Goal**: avoid high RAM/CPU from **full-repo** suites and **repo-wide** coverage on every SDD step. Defaults exercise **tests + coverage only for what the change touches**; full regression stays **on-demand** (explicit skill arguments or unavoidable fallback).
|
|
38
42
|
|
|
39
|
-
**Also applies**: `/refacil:apply` (implementer verification step) and `/refacil:bug` (debugger `mode=fix`) — wrappers pass `testScope`
|
|
43
|
+
**Also applies**: `/refacil:apply` (implementer verification step) and `/refacil:bug` (debugger `mode=fix`) — wrappers pass `testScope` plus the raw §3 baseline command. The write-capable sub-agent derives the scoped smoke after editing from the files it actually touched; the wrapper must not precompute a stale narrowed command.
|
|
40
44
|
|
|
41
45
|
| Briefing field | Values | Default |
|
|
42
46
|
|----------------|--------|---------|
|
|
@@ -46,12 +50,13 @@ Coverage (if applicable): detect the project command (`test:cov`, `coverage`, `p
|
|
|
46
50
|
**Rules**
|
|
47
51
|
|
|
48
52
|
1. **`testScope: scoped`** (default): sub-agents run tests **only** for artifacts tied to the current change — never invoke the §3 baseline in **full-repo / full-suite** form without narrowing (paths, packages, filters, patterns), except the explicit fallbacks below.
|
|
49
|
-
2. **`testScope: full`**: **on-demand only** — user explicitly requests whole-suite regression in **`/refacil:test`** (or `/refacil:verify`) arguments (e.g. `full`, `all tests`, `whole suite`, `suite completa`).
|
|
53
|
+
2. **`testScope: full`**: **on-demand only** — user explicitly requests whole-suite regression in **`/refacil:test`** (or `/refacil:verify`) arguments (e.g. `full`, `all tests`, `whole suite`, `suite completa`). Resolve the §3 baseline command language-agnostically at each **affected component root** and run it from that component dir (`cd <component> && <baseline>`). Never run all monorepo packages — only the component(s) whose files changed. If multiple components are affected, run each in sequence. Coverage = component-wide (not repo-wide).
|
|
50
54
|
3. **`runCoverage: true`** (default): after scoped tests pass, run coverage **narrowed to the change** — instrument/collect only for **`filesToTest`**, **`changedFiles`**, and companion test/spec paths tied to those modules (examples: `--cov=pkg/sub`, Jest `--collectCoverageFrom` globs limited to touched trees, Gradle/JaCoCo scoped modules). If the toolchain cannot narrow, report **N/A** plus a WARNING; do **not** silently widen to repo-wide coverage while `testScope` remains `scoped`.
|
|
51
55
|
4. **`runCoverage: false`**: skip coverage entirely — only when the user **explicitly** opts out (`no coverage`, `nocoverage`, `skip coverage`, `sin cobertura`, etc.) or the project defines **no** coverage command under §3.
|
|
52
56
|
5. **`runCoverage: true` + `testScope: full`**: run the project coverage command **after** the full suite passes, using the repo’s usual global/module coverage behavior (heavy — intended only when the user requested `full`).
|
|
53
|
-
6. **`/refacil:apply` / implementer**: the apply wrapper supplies `testScope` (default `scoped`) and **`
|
|
57
|
+
6. **`/refacil:apply` / implementer**: the apply wrapper supplies `testScope` (default `scoped`) and **`testBaselineCommand`**. After editing, the implementer runs `refacil-sdd-ai sdd test-scope --files <touched-files-csv> --baseline "<testBaselineCommand>"` and executes the returned smoke command. The implementer **NEVER runs the full repo/package baseline** as the apply verification step — the "unreliable scope → run baseline once" escape hatch in §3.1 Scoped command patterns does NOT apply here. Fallback behaviour: if `test-scope` returns `fallback: true`, fails, or there are no touched files, run only the touched files that are themselves test files; if none exist, **SKIP verification** and add a LOW `issues` entry deferring to `/refacil:test`. Also applies: the wrapper must not precompute a stale narrowed command. Coverage is optional in that step unless the briefing adds an explicit coverage command (unusual; defer to `/refacil:test`).
|
|
54
58
|
7. **`/refacil:bug` / debugger `mode=fix`**: debugger defaults to **`scoped`**, narrows §3 baseline to **`filesModified` ∪ new/updated regression test files** unless the wrapper passed **`testScope: full`**.
|
|
59
|
+
8. **Re-run / fix-loop (pass-2)**: when iterating on failing tests, run **only the previously-failing test files** — not the entire component suite. This keeps fix loops fast and bounded.
|
|
55
60
|
|
|
56
61
|
**Scoped command patterns** (language-agnostic — sub-agent reads `AGENTS.md`, build config, and tool docs; run from the correct module/root):
|
|
57
62
|
|
|
@@ -60,7 +65,78 @@ Coverage (if applicable): detect the project command (`test:cov`, `coverage`, `p
|
|
|
60
65
|
- **Scoped coverage**: combine the same narrowing with coverage flags/includes that limit **report collection** to touched sources (runner-specific); exclude unrelated packages by default when `testScope: scoped`.
|
|
61
66
|
- **Unreliable scope**: if narrowing cannot be done safely, run the baseline §3 command **once**, report a brief WARNING that the run may be heavy, and suggest CI or **`/refacil:test ... full`** for full regression.
|
|
62
67
|
|
|
63
|
-
**Verify**: Prefer `commandsRun` from `get-memory`
|
|
68
|
+
**Verify (when `testExecution: full`)**: Prefer `commandsRun` from `get-memory` as reference only when re-running; else derive scoped targets from `changedFiles` and/or `git diff --name-only`, using **project test naming and layout** (`AGENTS.md`, test config): e.g. co-located `*Spec.*` / `*Test.*`, `tests/`, language-specific suffices — not a fixed extension.
|
|
69
|
+
|
|
70
|
+
### §3.2 — Phase ownership (test execution)
|
|
71
|
+
|
|
72
|
+
**Goal**: run the **full** scoped (or full-suite) test + coverage pipeline **once per cycle** in `/refacil:test`. Later phases validate specs and quality **without** repeating that pipeline unless the user explicitly requests it or test memory is missing.
|
|
73
|
+
|
|
74
|
+
| Phase | Runs tests? | Coverage? | Writes `memory.commandsRun`? |
|
|
75
|
+
|-------|-------------|-----------|--------------------------------|
|
|
76
|
+
| `/refacil:apply` | Scoped post-implementation check only (pre-test) | Unusual; defer to test | No |
|
|
77
|
+
| `/refacil:test` | **Yes** — canonical suite for the change | **Yes** (scoped by default) | **Yes** |
|
|
78
|
+
| `/refacil:verify` | **No by default** (`testExecution: none`) | No | No (reads memory) |
|
|
79
|
+
| `/refacil:review` | **No** (checklist + file reads) | No | No |
|
|
80
|
+
| Corrections after verify/review | **Smoke only** or defer to `/refacil:test` | No | No |
|
|
81
|
+
|
|
82
|
+
**Briefing field `testExecution`** (verify wrapper → validator):
|
|
83
|
+
|
|
84
|
+
| Value | When | Validator behavior |
|
|
85
|
+
|-------|------|-------------------|
|
|
86
|
+
| `none` | Default if `memory.lastStep` is `test` (or later) and `commandsRun` is non-empty; user did not force re-run | **Do not** run `testCommand` or `coverageCommand`. Tests section = **delegated to test phase**; cite last `commandsRun`. |
|
|
87
|
+
| `smoke` | After surgical corrections in verify Step 5 (or rare review fix) | Run **only** companion test files for `correctionTouchedFiles`. **No** `coverageCommand`. |
|
|
88
|
+
| `full` | User tokens (`full`, `re-run tests`, `run tests`, …) **or** CR-01 (no test memory) | Same as §3.1: `testCommand` + optional narrowed/full coverage per `testScope` / `runCoverage`. |
|
|
89
|
+
|
|
90
|
+
**Smoke definition**: the smallest test invocation that exercises files touched by a **correction** (not the whole change). Derive companion paths from project layout (`*Spec*`, `*Test*`, `tests/`, etc.). Smoke **does not** satisfy coverage gates or replace `/refacil:test`.
|
|
91
|
+
|
|
92
|
+
**After corrections** (verify Step 5 or review Step 3.5): prefer `testExecution: none` + tell the user to run **`/refacil:test`** before the next full verify; or `smoke` once on correction files. **Never** use `full` in autofix re-verify unless the user explicitly requested it in the same invocation.
|
|
93
|
+
|
|
94
|
+
**Review checklist “tests pass”**: PASS when test files exist for the diff, `memory.criteriaRun` covers relevant CA/CR, and static review finds no obvious breakage — **without** running the §3 baseline via Bash unless the user explicitly asked.
|
|
95
|
+
|
|
96
|
+
## §3C — 3C Criterion: Completeness, Correctness, Coherence
|
|
97
|
+
|
|
98
|
+
The **3C criterion** is the authoritative framework for evaluating implementations. It is applied by the `refacil-validator` sub-agent during `/refacil:verify` and referenced by the `refacil-auditor` during `/refacil:review`. All three dimensions must be assessed; missing one dimension is itself a WARNING.
|
|
99
|
+
|
|
100
|
+
### Dimension 1 — Completeness (is everything implemented?)
|
|
101
|
+
|
|
102
|
+
**Question**: Does the implementation cover all tasks and all scope files listed in the briefing?
|
|
103
|
+
|
|
104
|
+
Operational checks:
|
|
105
|
+
- Every task in `tasks.md` (or the briefing's task list) has a corresponding code artifact.
|
|
106
|
+
- Every file in `scope.create` exists and has substantive content coherent with the objective.
|
|
107
|
+
- Every file in `scope.modify` was actually modified with changes relevant to the task.
|
|
108
|
+
- No mandatory scope file is missing or is an empty scaffold.
|
|
109
|
+
|
|
110
|
+
### Dimension 2 — Correctness (is it correctly implemented?)
|
|
111
|
+
|
|
112
|
+
**Question**: Does each implemented artifact satisfy the CA/CR criteria from the specs?
|
|
113
|
+
|
|
114
|
+
Operational checks:
|
|
115
|
+
- For each CA-XX: verify the implementation satisfies the criterion by reading the relevant scope files.
|
|
116
|
+
- For each CR-XX: verify that edge cases and rejection conditions are handled.
|
|
117
|
+
- Behavior matches the spec intent — not just surface text.
|
|
118
|
+
|
|
119
|
+
### Dimension 3 — Coherence (is it consistent with the architecture?)
|
|
120
|
+
|
|
121
|
+
**Question**: Do the new or modified files fit the established patterns without introducing inconsistencies?
|
|
122
|
+
|
|
123
|
+
Operational checks:
|
|
124
|
+
- New files follow naming, structure, and module conventions from `architectureContext` (or `AGENTS.md`).
|
|
125
|
+
- No files outside `scope.doNotTouch` were modified.
|
|
126
|
+
- Patterns introduced are consistent with existing ones in the same module or layer.
|
|
127
|
+
- If `codegraphAvailable: true` in the briefing: use `codegraph_context` or `codegraph_search` on `changedFiles` to verify architectural coherence. If not available, continue with direct file reading.
|
|
128
|
+
|
|
129
|
+
### Severity table
|
|
130
|
+
|
|
131
|
+
| Severity | Completeness | Correctness | Coherence |
|
|
132
|
+
|----------|-------------|-------------|-----------|
|
|
133
|
+
| CRITICAL | Mandatory task or `scope.create` file missing entirely | Mandatory CA not met; spec contract broken | Files in `scope.doNotTouch` modified |
|
|
134
|
+
| WARNING | Partial implementation of a task; `scope.modify` file unchanged | Regression risk; CR edge case not handled | Pattern deviation; naming inconsistency |
|
|
135
|
+
| SUGGESTION | Optional improvement not covered | Improvable edge case handling | Better alignment opportunity |
|
|
136
|
+
|
|
137
|
+
### Graceful degradation rule
|
|
138
|
+
|
|
139
|
+
If the briefing does not include `criteria` (CA/CR list), infer the criteria by reading `refacil-sdd/changes/<changeName>/specs.md` or `specs/**/*.md`. If there are no specs either, apply **only Dimension 1 (Completeness)** and document the limitation as a WARNING in the report. Never block verification entirely due to missing specs — degrade gracefully.
|
|
64
140
|
|
|
65
141
|
## §4 — Protected branch policy and branch creation
|
|
66
142
|
|
|
@@ -149,7 +225,7 @@ If the user does not request detail, use concise mode.
|
|
|
149
225
|
- When there are **multiple valid next steps** (real branching), list numbered options and ask for explicit selection.
|
|
150
226
|
- If the current step is **terminal** (end of flow, e.g. PR created), close without asking for the next skill.
|
|
151
227
|
|
|
152
|
-
**Operative rule (mandatory)**: if the user confirms affirmatively ("yes", "ok", "go", "continue", "sure", etc.) to the continuity question, **directly
|
|
228
|
+
**Operative rule (mandatory)**: if the user confirms affirmatively ("yes", "ok", "go", "continue", "sure", etc.) to the continuity question, **directly execute the next `/refacil:<skill>` command** in the same turn. Do not ask the user to type it or repeat the context — the session must continue without friction.
|
|
153
229
|
|
|
154
230
|
## §6 — Review and push scope
|
|
155
231
|
|
|
@@ -160,6 +236,9 @@ If the user does not request detail, use concise mode.
|
|
|
160
236
|
## §7 — Review evidence persistence
|
|
161
237
|
|
|
162
238
|
- `archive` requires `.review-passed` as a blocking precondition (verify existence according to **§8**).
|
|
239
|
+
- Regular changes require the proposal artifact set before apply/archive readiness: `proposal.md`, `design.md`, `tasks.md`, and specs from non-empty `specs.md` and/or recursive non-empty `specs/**/*.md`. The same source set must be used by `sdd status`, `sync-spec`, test/verify criteria extraction, and archive.
|
|
240
|
+
- Operational bug fixes created by `/refacil:bug` are the exception: `fix-*` changes may archive without proposal artifacts when they include `summary.md`, regression test evidence, and `.review-passed`. Archive must document the resulting behavior under `refacil-sdd/specs/` with `review.yaml`.
|
|
241
|
+
- Archive must use current `/refacil:test` evidence from `memory.yaml` instead of re-running tests by default. If evidence is missing or stale, normal mode asks the user to run `/refacil:test` or explicitly continue; autopilot mode aborts to preserve the contract without hidden broad test execution.
|
|
163
242
|
- When archiving regular changes (proposal-driven flow), the `.review-passed` metadata must be persisted in `refacil-sdd/specs/`.
|
|
164
243
|
- `archive` must request and persist at least one task reference for traceability. Accepted formats: URL, ticket/issue identifier, or short task name.
|
|
165
244
|
- The recommended field in `review.yaml` is `taskReferences` (YAML list). Do not enforce provider-specific fields such as `jiraTasks`.
|
|
@@ -174,7 +253,7 @@ If the user does not request detail, use concise mode.
|
|
|
174
253
|
|
|
175
254
|
## §9 — Folder identifier under `refacil-sdd/changes/<change>/`
|
|
176
255
|
|
|
177
|
-
- The **folder name** of the active change is the identifier used by the refacil-sdd CLI (`refacil-sdd status
|
|
256
|
+
- The **folder name** of the active change is the identifier used by the refacil-sdd CLI (`refacil-sdd-ai sdd status <change>`, archive flows, etc.).
|
|
178
257
|
- **Must start with an ASCII letter** `[a-zA-Z]`. If the first character is a digit or other symbol, the CLI rejects the name (e.g. `Invalid change name: Change name must start with a letter`).
|
|
179
258
|
|
|
180
259
|
## §10 — Language policy
|
package/skills/prereqs/SKILL.md
CHANGED
|
@@ -6,7 +6,7 @@ user-invocable: false
|
|
|
6
6
|
|
|
7
7
|
# SDD-AI Prerequisites
|
|
8
8
|
|
|
9
|
-
Identical methodology in Claude Code (
|
|
9
|
+
Identical methodology in all four supported IDEs: Claude Code (`~/.claude/skills/refacil-*`), Cursor (`~/.cursor/skills/refacil-*`), OpenCode (`~/.config/opencode/skills/refacil-*`), and Codex (`~/.codex/skills/refacil-*`). Skills install globally — not into the project repo. Use the path of the open IDE.
|
|
10
10
|
|
|
11
11
|
Cross-cutting rules (states, branches, tests, output): `METHODOLOGY-CONTRACT.md` in this same folder.
|
|
12
12
|
|
package/skills/propose/SKILL.md
CHANGED
|
@@ -45,14 +45,42 @@ Communicate the final agreed slug to the user before generating.
|
|
|
45
45
|
|
|
46
46
|
### Step 2: Delegate to the refacil-proposer sub-agent
|
|
47
47
|
|
|
48
|
-
Before delegating, resolve
|
|
48
|
+
Before delegating, resolve language and CodeGraph availability in a single call:
|
|
49
49
|
|
|
50
|
-
Run `refacil-sdd-ai sdd config --json` and read
|
|
50
|
+
Run `refacil-sdd-ai sdd config --json` and read `artifactLanguage`. If the command fails or the field is missing/unknown, use `english`.
|
|
51
|
+
|
|
52
|
+
Run `refacil-sdd-ai codegraph status --json` and set `codegraphAvailable`:
|
|
53
|
+
- `true` if `installed === true` AND `initialized === true`
|
|
54
|
+
- `false` otherwise
|
|
55
|
+
|
|
56
|
+
**If `mode` is `enabled` or `per-repo` but `codegraphAvailable` is `false`**:
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
**[GATE — STOP AND WAIT: CodeGraph not indexed]**
|
|
61
|
+
|
|
62
|
+
Do NOT continue. Do NOT delegate to the sub-agent. STOP and ask the user exactly this, then wait for their reply:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
CodeGraph is enabled for this repo but not yet indexed (~30s to build).
|
|
66
|
+
The proposer sub-agent will explore the codebase less efficiently without it.
|
|
67
|
+
|
|
68
|
+
Do you want me to run /refacil:update first to build the index?
|
|
69
|
+
yes → run /refacil:update then continue with the proposal
|
|
70
|
+
no → continue with standard exploration now
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Only after the user replies:
|
|
74
|
+
- **"yes"** (or "si", "dale", "sí", "go", "ok"): immediately execute `/refacil:update`.
|
|
75
|
+
- **"no"** (or "skip", "continue", "continúa"): set `codegraphAvailable: false` and continue.
|
|
76
|
+
|
|
77
|
+
---
|
|
51
78
|
|
|
52
79
|
Invoke the `refacil-proposer` sub-agent passing it:
|
|
53
80
|
- `changeName`: the valid slug agreed in Step 1.5.
|
|
54
81
|
- `description`: complete description of the change (from Step 1 or from `$ARGUMENTS`).
|
|
55
82
|
- `artifactLanguage`: the resolved language (e.g. `english` or `spanish`). Pass it explicitly so the sub-agent uses it immediately, before it reads AGENTS.md.
|
|
83
|
+
- `codegraphAvailable: true | false` (from above).
|
|
56
84
|
|
|
57
85
|
The sub-agent:
|
|
58
86
|
- Explores the codebase (reads `AGENTS.md`, detects relevant files and conventions) before generating.
|
|
@@ -62,6 +90,14 @@ The sub-agent:
|
|
|
62
90
|
|
|
63
91
|
If the change arises from a **bus room agreement** (`refacil-bus`), indicate it to the sub-agent in the description so it takes it into account when generating the artifacts. Do not shorten the methodology flow. See `refacil-prereqs/BUS-CROSS-REPO.md` (room agreements section).
|
|
64
92
|
|
|
93
|
+
After the sub-agent completes, log telemetry silently (must not block the flow):
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
refacil-sdd-ai compact log-codegraph-event --skill proposer --has-graph <true|false> --tool-calls <N> --tokens <N>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Use the same estimation criteria as `explore/SKILL.md` Step 1.5.
|
|
100
|
+
|
|
65
101
|
### Step 3: Developer review (Human-in-the-Loop — MANDATORY)
|
|
66
102
|
|
|
67
103
|
Parse the `refacil-propose-result` block from the sub-agent to get the real artifact paths. Present a clear summary to the user for their review:
|
|
@@ -71,34 +107,46 @@ Parse the `refacil-propose-result` block from the sub-agent to get the real arti
|
|
|
71
107
|
3. **Design**: files to create/modify and patterns to use.
|
|
72
108
|
4. **Tasks**: task list — verify the breakdown is correct and complete.
|
|
73
109
|
|
|
74
|
-
|
|
110
|
+
**Immediately after the summary, show this menu and WAIT for the user's reply — do NOT continue automatically:**
|
|
75
111
|
|
|
76
112
|
```
|
|
77
113
|
=== Review required ===
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
Please review the artifacts and confirm:
|
|
85
|
-
1. Are the acceptance criteria correct?
|
|
86
|
-
2. Does the design align with the project architecture?
|
|
87
|
-
3. Do the tasks cover the full scope?
|
|
88
|
-
|
|
89
|
-
Reply "OK" to continue, or indicate what adjustments you need.
|
|
114
|
+
Artifacts are ready at refacil-sdd/changes/[changeName]/
|
|
115
|
+
|
|
116
|
+
A) Approve — proceed to implementation
|
|
117
|
+
B) Listen to the spec aloud (opens all artifacts in the browser, auto-advancing)
|
|
118
|
+
C) Adjustments — describe what you want to change
|
|
90
119
|
```
|
|
91
120
|
|
|
92
121
|
**DO NOT continue to Step 4 until the user explicitly approves.**
|
|
93
122
|
|
|
123
|
+
- **"A"** (or "ok", "approve", "listo", "aprobado", "looks good", unambiguous approval): go to Step 4.
|
|
124
|
+
- **"B"** (or "listen", "audio", "voice", "read", "escuchar", "voz"): run the following CLI command exactly as written — **do NOT use `--file`, do NOT open a single spec file**:
|
|
125
|
+
```bash
|
|
126
|
+
refacil-sdd-ai read-spec --change <changeName>
|
|
127
|
+
```
|
|
128
|
+
Where `<changeName>` is the slug agreed in Step 1.5 (e.g. `feat-my-feature`). This opens the **full change folder** in the browser (proposal → design → tasks → specs, auto-advancing between files). After running it, re-present the review menu so the user can approve or request adjustments.
|
|
129
|
+
- **"C"** or any adjustment request: apply limited changes directly to the files or re-invoke the sub-agent if the scope changed, then re-present the review menu.
|
|
130
|
+
|
|
94
131
|
If the user requests limited adjustments (change a criterion, fix a path, adjust a task), apply them directly to the corresponding files and present the summary again. If the adjustments are broad (changing the objective or the full scope), re-invoke the sub-agent with the updated description.
|
|
95
132
|
|
|
96
133
|
### Step 4: Next step
|
|
97
134
|
|
|
135
|
+
**Always present this menu as a new message** immediately after Step 3 confirms approval. Never skip it or reuse the "OK" from Step 3 as a selection here — that "OK" means "the artifacts are approved", not "choose option A".
|
|
136
|
+
|
|
137
|
+
Before presenting the menu, run `refacil-sdd-ai kapso preflight` (exits 0, prints JSON) and read `kapsoEnabled` from the output. If `kapsoEnabled = true`, append the WhatsApp note to option B. If `kapsoEnabled = false`, omit it.
|
|
138
|
+
|
|
98
139
|
```
|
|
99
|
-
Proposal approved
|
|
100
|
-
|
|
101
|
-
|
|
140
|
+
Proposal approved: refacil-sdd/changes/[name]/
|
|
141
|
+
|
|
142
|
+
How do you want to continue? Reply A or B:
|
|
143
|
+
|
|
144
|
+
A) /refacil:apply — step-by-step (pauses for confirmation at each phase)
|
|
145
|
+
B) /refacil:autopilot — run the full cycle autonomously
|
|
146
|
+
(apply → test → verify → review → archive → up-code)
|
|
147
|
+
and notify you when done (recommended if you are stepping away)
|
|
148
|
+
[if kapsoEnabled = true: ⚠️ WhatsApp 24h window: make sure you have sent a message
|
|
149
|
+
to your notification number in the last 24h, otherwise the final alert may not arrive.]
|
|
102
150
|
```
|
|
103
151
|
|
|
104
152
|
## Rules
|
|
@@ -106,4 +154,11 @@ Do you want me to continue with /refacil:apply?
|
|
|
106
154
|
- **Change folder name**: always validate with `refacil-sdd-ai sdd validate-name <slug>` before delegating. Do not proceed if it exits 1.
|
|
107
155
|
- **Always delegate generation to the sub-agent**. Do not replicate the codebase exploration or artifact generation logic here.
|
|
108
156
|
- `artifactLanguage` affects **only SDD artifacts**. Any code snippets, file/folder names, identifiers, and technical comments that may appear during proposal work must stay in **English**.
|
|
109
|
-
- **
|
|
157
|
+
- **CodeGraph gate (Step 2)**: if `mode` is `enabled`/`per-repo` and `codegraphAvailable` is `false`, the GATE is **mandatory** — never skip it. If the user replies affirmatively ("yes", "si", "sí", "dale", "ok", "go"), immediately execute `/refacil:update` without any prior text. Do not describe it. Do not ask again. (See `METHODOLOGY-CONTRACT.md §5`.)
|
|
158
|
+
- **Flow continuity (Step 4)**:
|
|
159
|
+
- **Always show the A/B menu first.** An "OK", "yes", "go", or "continue" from Step 3 (artifact approval) is NOT a valid selection for Step 4 — show the menu and wait for the user's reply.
|
|
160
|
+
- Only execute after the user explicitly replies to the Step 4 menu:
|
|
161
|
+
- "apply" or "A" → immediately execute `/refacil:apply`. Do not describe it in text.
|
|
162
|
+
- "autopilot", "B", "auto", or "modo autónomo" → immediately execute `/refacil:autopilot`. Do not describe it in text.
|
|
163
|
+
- An ambiguous affirmative ("ok", "yes", "go", "continue") received **after the menu has been shown** → execute `/refacil:apply`.
|
|
164
|
+
- (See `METHODOLOGY-CONTRACT.md §5`.)
|