refacil-sdd-ai 4.2.3 → 4.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/README.md +239 -214
- package/agents/auditor.md +182 -184
- package/agents/debugger.md +201 -204
- package/agents/implementer.md +150 -149
- package/agents/investigator.md +80 -89
- package/agents/proposer.md +219 -124
- package/agents/tester.md +140 -144
- package/agents/validator.md +153 -145
- package/bin/cli.js +158 -116
- package/lib/bus/askFulfillment.js +17 -17
- package/lib/bus/broker.js +599 -599
- package/lib/bus/ui/app.js +318 -318
- package/lib/commands/sdd.js +433 -0
- package/lib/hooks.js +236 -236
- package/lib/installer.js +55 -1
- package/lib/methodology-migration-pending.js +101 -136
- package/package.json +4 -6
- package/skills/apply/SKILL.md +122 -120
- package/skills/archive/SKILL.md +101 -107
- package/skills/ask/SKILL.md +78 -78
- package/skills/attend/SKILL.md +70 -70
- package/skills/bug/SKILL.md +121 -117
- package/skills/explore/SKILL.md +61 -63
- package/skills/guide/SKILL.md +79 -79
- package/skills/inbox/SKILL.md +43 -43
- package/skills/join/SKILL.md +82 -82
- package/skills/prereqs/BUS-CROSS-REPO.md +55 -55
- package/skills/prereqs/METHODOLOGY-CONTRACT.md +122 -115
- package/skills/prereqs/SKILL.md +30 -37
- package/skills/propose/SKILL.md +91 -102
- package/skills/reply/SKILL.md +44 -44
- package/skills/review/SKILL.md +135 -126
- package/skills/review/checklist-back.md +92 -92
- package/skills/review/checklist-front.md +72 -72
- package/skills/review/checklist.md +114 -114
- package/skills/say/SKILL.md +38 -38
- package/skills/setup/SKILL.md +85 -141
- package/skills/setup/troubleshooting.md +38 -35
- package/skills/test/SKILL.md +86 -94
- package/skills/test/testing-patterns.md +63 -63
- package/skills/up-code/SKILL.md +108 -108
- package/skills/update/SKILL.md +109 -132
- package/skills/verify/SKILL.md +128 -132
- package/templates/compact-guidance.md +45 -45
- package/templates/methodology-guide.md +46 -42
- package/config/openspec-config.yaml +0 -8
- package/skills/prereqs/OPENSPEC-DELTAS.md +0 -51
package/README.md
CHANGED
|
@@ -1,196 +1,218 @@
|
|
|
1
1
|
# refacil-sdd-ai
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**SDD-AI** (Specification-Driven Development with AI) packaged as a CLI.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Installs **skills** and **sub-agents** for **Claude Code** and **Cursor** that guide the developer through a structured AI-assisted development workflow, using **`refacil-sdd/`** as the specification store, plus a **local bus** so agents across different repos can communicate with each other.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Requirements
|
|
10
10
|
|
|
11
|
-
- **Node.js >= 20.
|
|
12
|
-
- **Claude Code >= 2.1.89** (
|
|
11
|
+
- **Node.js >= 20.0.0**
|
|
12
|
+
- **Claude Code >= 2.1.89** (required by the `compact-bash` hook for silent rewrite via `updatedInput`) or **Cursor**
|
|
13
13
|
|
|
14
|
-
`refacil-sdd-ai init`
|
|
14
|
+
`refacil-sdd-ai init` checks the Claude Code version and warns if it is below 2.1.89. With an older version the rest of the methodology works, but `compact-bash` will have no effect.
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Installation
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Recommended: install globally once, then run `init` per repo.
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
# 1. Global (
|
|
23
|
+
# 1. Global (once)
|
|
24
24
|
npm install -g refacil-sdd-ai
|
|
25
25
|
|
|
26
|
-
# 2.
|
|
26
|
+
# 2. In the repo root
|
|
27
27
|
refacil-sdd-ai init
|
|
28
|
-
#
|
|
29
|
-
#
|
|
28
|
+
# Copies skills to .claude/ and .cursor/, creates CLAUDE.md + .cursorrules, configures hooks
|
|
29
|
+
# Creates/updates .claudeignore and .cursorignore with base exclusions
|
|
30
30
|
|
|
31
|
-
# 3.
|
|
32
|
-
# (
|
|
31
|
+
# 3. Restart your Claude Code or Cursor session
|
|
32
|
+
# (new skills are not detected until you restart)
|
|
33
33
|
|
|
34
|
-
# 4.
|
|
34
|
+
# 4. In the IDE
|
|
35
35
|
/refacil:setup
|
|
36
|
-
#
|
|
36
|
+
# Generates AGENTS.md and the .agents/ directory for the project
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
###
|
|
39
|
+
### Update
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
42
|
npm update -g refacil-sdd-ai
|
|
43
|
-
refacil-sdd-ai update #
|
|
43
|
+
refacil-sdd-ai update # in each repo where it is used
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
In Claude Code / Cursor the `check-update` hook (every session) syncs skills and `compact-guidance`. Only if the automatic detection (`lib/methodology-migration-pending.js`) finds a pending methodology migration does it write the flag and allow `notify-update` to prompt `/refacil:update`. If there is no migration, the user is not interrupted. The `/refacil:update` skill uses `refacil-sdd-ai migration-pending` as the same criterion.
|
|
47
47
|
|
|
48
|
-
###
|
|
48
|
+
### Uninstall
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
|
-
refacil-sdd-ai clean #
|
|
51
|
+
refacil-sdd-ai clean # in the repo (removes skills + SDD-AI hooks)
|
|
52
52
|
npm uninstall -g refacil-sdd-ai
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
### Legacy `openspec/` directory
|
|
56
|
+
|
|
57
|
+
Older repos may still have **`openspec/changes/`**. The package **migrates automatically** to **`refacil-sdd/`** the first time you run any **`refacil-sdd-ai sdd …`** subcommand or when **`check-update`** runs at session start. After you confirm the tree under **`refacil-sdd/`**, you can remove the leftover **`openspec/`** folder.
|
|
58
|
+
|
|
59
|
+
Some teams still install the **OpenSpec CLI** for **`opsx:*`** commands; those can coexist with SDD-AI. The **supported** path for changes, review markers, and archiving is **`refacil-sdd/`** plus **`refacil-sdd-ai sdd`** and **`/refacil:*`** skills.
|
|
56
60
|
|
|
57
61
|
---
|
|
58
62
|
|
|
59
|
-
##
|
|
63
|
+
## CLI Commands
|
|
64
|
+
|
|
65
|
+
### Package management
|
|
66
|
+
|
|
67
|
+
| Command | Description |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `refacil-sdd-ai init` | Install skills and hooks in the current repo |
|
|
70
|
+
| `refacil-sdd-ai update` | Re-copy skills and hooks to the latest version |
|
|
71
|
+
| `refacil-sdd-ai migration-pending [--json]` | Same detection as hooks/`notify-update`; exit 1 if migration is pending; on exit 0 also deletes obsolete `.refacil-pending-update` (same as at the start of `check-update`) |
|
|
72
|
+
| `refacil-sdd-ai clean` | Remove SDD-AI skills and hooks from the repo |
|
|
73
|
+
| `refacil-sdd-ai help` | Show help |
|
|
60
74
|
|
|
61
|
-
###
|
|
75
|
+
### Internal hooks (invoked automatically — not for manual use)
|
|
62
76
|
|
|
63
|
-
|
|
|
77
|
+
| Command | Description |
|
|
64
78
|
|---|---|
|
|
65
|
-
| `refacil-sdd-ai
|
|
66
|
-
| `refacil-sdd-ai update` |
|
|
67
|
-
| `refacil-sdd-ai
|
|
68
|
-
| `refacil-sdd-ai
|
|
69
|
-
|
|
79
|
+
| `refacil-sdd-ai check-update` | (`SessionStart`) Clears obsolete update flag if no migration; npm optional; syncs skills and `compact-guidance` in AGENTS.md |
|
|
80
|
+
| `refacil-sdd-ai notify-update` | (`UserPromptSubmit` / `beforeSubmitPrompt`) Only acts if a methodology migration is pending (same logic as `/refacil:update`); otherwise does not interrupt |
|
|
81
|
+
| `refacil-sdd-ai check-review` | (`PreToolUse`) Blocks `git push` if `.review-passed` is missing in any active change |
|
|
82
|
+
| `refacil-sdd-ai compact-bash` | (`PreToolUse`) Silently rewrites bare Bash commands via `updatedInput` |
|
|
83
|
+
|
|
84
|
+
### SDD artifacts (`sdd`)
|
|
70
85
|
|
|
71
|
-
|
|
86
|
+
Native CLI for **`refacil-sdd/`** (no separate OpenSpec skill layer). Used by skills and hooks; you can also run it from scripts.
|
|
72
87
|
|
|
73
|
-
|
|
|
88
|
+
| Command | Description |
|
|
74
89
|
|---|---|
|
|
75
|
-
| `refacil-sdd-ai
|
|
76
|
-
| `refacil-sdd-ai
|
|
77
|
-
| `refacil-sdd-ai
|
|
78
|
-
| `refacil-sdd-ai
|
|
90
|
+
| `refacil-sdd-ai sdd new-change <name>` | Scaffold `proposal.md`, `design.md`, `tasks.md`, and specs under `refacil-sdd/changes/<name>/` |
|
|
91
|
+
| `refacil-sdd-ai sdd list [--json]` | List active changes and review status |
|
|
92
|
+
| `refacil-sdd-ai sdd status <name> [--json]` | Artifact and task status for one change |
|
|
93
|
+
| `refacil-sdd-ai sdd mark-reviewed <name>` | Write `.review-passed` (requires `--verdict`, `--summary`, counts) |
|
|
94
|
+
| `refacil-sdd-ai sdd tasks-update <name>` | Mark a task done (`--task N --done`) |
|
|
95
|
+
| `refacil-sdd-ai sdd archive <name>` | Move a regular change to `refacil-sdd/changes/archive/` |
|
|
96
|
+
| `refacil-sdd-ai sdd validate-name <name>` | Validate change folder name (must start with a letter) |
|
|
79
97
|
|
|
80
|
-
|
|
98
|
+
Run **`refacil-sdd-ai help`** for the full list including `bus` and `compact` subcommands.
|
|
81
99
|
|
|
82
|
-
|
|
100
|
+
### Command rewrite control (`compact-bash`)
|
|
101
|
+
|
|
102
|
+
| Command | Description |
|
|
83
103
|
|---|---|
|
|
84
|
-
| `refacil-sdd-ai compact stats` |
|
|
85
|
-
| `refacil-sdd-ai compact enable` |
|
|
86
|
-
| `refacil-sdd-ai compact disable` |
|
|
87
|
-
| `refacil-sdd-ai compact clear-log` |
|
|
104
|
+
| `refacil-sdd-ai compact stats` | Statistics (hook + already-compact) + estimated tokens and USD |
|
|
105
|
+
| `refacil-sdd-ai compact enable` | Re-enable rewriting |
|
|
106
|
+
| `refacil-sdd-ai compact disable` | Disable rewriting without uninstalling |
|
|
107
|
+
| `refacil-sdd-ai compact clear-log` | Clear `~/.refacil-sdd-ai/compact.log` |
|
|
88
108
|
|
|
89
|
-
###
|
|
109
|
+
### Agent bus (`bus`)
|
|
90
110
|
|
|
91
|
-
|
|
|
111
|
+
| Command | Description |
|
|
92
112
|
|---|---|
|
|
93
|
-
| `refacil-sdd-ai bus start` |
|
|
94
|
-
| `refacil-sdd-ai bus stop` |
|
|
95
|
-
| `refacil-sdd-ai bus status` |
|
|
96
|
-
| `refacil-sdd-ai bus rooms` |
|
|
97
|
-
| `refacil-sdd-ai bus view` |
|
|
98
|
-
| `refacil-sdd-ai bus watch <session> [--room <
|
|
99
|
-
| `refacil-sdd-ai bus history [--n N] [--session <s>]` |
|
|
100
|
-
| `refacil-sdd-ai bus join --room <
|
|
101
|
-
| `refacil-sdd-ai bus leave [--session <s>]` |
|
|
102
|
-
| `refacil-sdd-ai bus say --text "..." [--session <s>]` | Broadcast (
|
|
103
|
-
| `refacil-sdd-ai bus ask --to <
|
|
104
|
-
| `refacil-sdd-ai bus reply --text "..." [--correlation <id>]` |
|
|
105
|
-
| `refacil-sdd-ai bus attend [--timeout N]` |
|
|
106
|
-
| `refacil-sdd-ai bus inbox [--session <s>]` |
|
|
107
|
-
|
|
108
|
-
>
|
|
113
|
+
| `refacil-sdd-ai bus start` | Start the local broker (auto-spawn detached) |
|
|
114
|
+
| `refacil-sdd-ai bus stop` | Stop the broker |
|
|
115
|
+
| `refacil-sdd-ai bus status` | Show port, pid, uptime |
|
|
116
|
+
| `refacil-sdd-ai bus rooms` | Active rooms + members |
|
|
117
|
+
| `refacil-sdd-ai bus view` | Open the web UI in the browser |
|
|
118
|
+
| `refacil-sdd-ai bus watch <session> [--room <room>]` | Live terminal panel (0 tokens) |
|
|
119
|
+
| `refacil-sdd-ai bus history [--n N] [--session <s>]` | Last N messages |
|
|
120
|
+
| `refacil-sdd-ai bus join --room <room> [--session <s>] [--intro "..."]` | Join a room (skills do this automatically) |
|
|
121
|
+
| `refacil-sdd-ai bus leave [--session <s>]` | Leave the room |
|
|
122
|
+
| `refacil-sdd-ai bus say --text "..." [--session <s>]` | Broadcast (skills do this automatically) |
|
|
123
|
+
| `refacil-sdd-ai bus ask --to <session> --text "..." [--wait N]` | Directed question; `--to all` (also `*` or `everyone`) sends to every room member except you |
|
|
124
|
+
| `refacil-sdd-ai bus reply --text "..." [--correlation <id>]` | Reply (skills do this automatically) |
|
|
125
|
+
| `refacil-sdd-ai bus attend [--timeout N]` | Listen for directed questions (skills do this automatically) |
|
|
126
|
+
| `refacil-sdd-ai bus inbox [--session <s>]` | View new messages |
|
|
127
|
+
|
|
128
|
+
> The `join/leave/say/ask/reply/attend/inbox` subcommands also exist as **IDE skills** (`/refacil:join`, etc.). In most cases use the skills; the CLI commands are for scripting or debugging.
|
|
109
129
|
>
|
|
110
|
-
> **
|
|
130
|
+
> **Cross-repo coordination** (ask requests, room agreements, `/refacil:propose`, closing to the requester): after `init`, the file **`BUS-CROSS-REPO.md`** is available in `.claude/skills/refacil-prereqs/` and `.cursor/skills/refacil-prereqs/`.
|
|
111
131
|
|
|
112
132
|
---
|
|
113
133
|
|
|
114
|
-
##
|
|
134
|
+
## Available IDE Skills
|
|
115
135
|
|
|
116
|
-
|
|
136
|
+
All invoked as `/refacil:<name>` in Claude Code or Cursor.
|
|
117
137
|
|
|
118
|
-
###
|
|
138
|
+
### SDD cycle
|
|
119
139
|
|
|
120
|
-
| Skill |
|
|
140
|
+
| Skill | Usage |
|
|
121
141
|
|---|---|
|
|
122
|
-
| `/refacil:setup` |
|
|
123
|
-
| `/refacil:guide` |
|
|
124
|
-
| `/refacil:explore` |
|
|
125
|
-
| `/refacil:propose` |
|
|
126
|
-
| `/refacil:apply` |
|
|
127
|
-
| `/refacil:test` |
|
|
128
|
-
| `/refacil:verify` |
|
|
129
|
-
| `/refacil:review` |
|
|
130
|
-
| `/refacil:archive` |
|
|
131
|
-
| `/refacil:up-code` | Commit + push + PR (
|
|
132
|
-
| `/refacil:bug` |
|
|
133
|
-
| `/refacil:update` |
|
|
134
|
-
|
|
135
|
-
###
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
| Skill | Sub-
|
|
142
|
+
| `/refacil:setup` | Generate AGENTS.md and the `.agents/` project index |
|
|
143
|
+
| `/refacil:guide` | Interactive guide on which command to use |
|
|
144
|
+
| `/refacil:explore` | Explore the codebase without modifying anything |
|
|
145
|
+
| `/refacil:propose` | Create a change proposal: proposal + specs + design + tasks |
|
|
146
|
+
| `/refacil:apply` | Implement the change tasks |
|
|
147
|
+
| `/refacil:test` | Generate unit tests from the artifacts |
|
|
148
|
+
| `/refacil:verify` | Validate implementation vs specs (with optional autofix) |
|
|
149
|
+
| `/refacil:review` | Quality checklist, emits `.review-passed` if approved |
|
|
150
|
+
| `/refacil:archive` | Archive the completed change + sync specs (requests Jira links) |
|
|
151
|
+
| `/refacil:up-code` | Commit + push + PR (runs review if missing) |
|
|
152
|
+
| `/refacil:bug` | Full bugfix flow with regression tests |
|
|
153
|
+
| `/refacil:update` | Detect and apply pending methodology migrations to the current repo |
|
|
154
|
+
|
|
155
|
+
### Automatic sub-agents (v3.0.0+)
|
|
156
|
+
|
|
157
|
+
Some skills delegate their heavy work to **sub-agents** that run in isolated context (they do not saturate the main session with mass reads). They are invoked automatically by the corresponding skill — do not call them directly.
|
|
158
|
+
|
|
159
|
+
| Skill | Sub-agent | Role | Can write |
|
|
140
160
|
|---|---|---|---|
|
|
141
|
-
| `/refacil:explore` | `refacil-investigator` |
|
|
142
|
-
| `/refacil:verify` | `refacil-validator` |
|
|
143
|
-
| `/refacil:review` | `refacil-auditor` |
|
|
144
|
-
| `/refacil:test` | `refacil-tester` |
|
|
145
|
-
| `/refacil:apply` | `refacil-implementer` |
|
|
146
|
-
| `/refacil:bug` | `refacil-debugger` |
|
|
147
|
-
| `/refacil:propose` | `refacil-proposer` |
|
|
161
|
+
| `/refacil:explore` | `refacil-investigator` | Reads codebase, enriches with AGENTS.md, queries cross-repo bus | No |
|
|
162
|
+
| `/refacil:verify` | `refacil-validator` | Runs tests + compares against spec, returns prioritized issues | No |
|
|
163
|
+
| `/refacil:review` | `refacil-auditor` | Evaluates changes against the quality checklist | No |
|
|
164
|
+
| `/refacil:test` | `refacil-tester` | Detects stack, generates tests covering CA/CR, runs and fixes | Yes (test files) |
|
|
165
|
+
| `/refacil:apply` | `refacil-implementer` | Reads SDD artifacts and implements all change tasks | Yes (source code) |
|
|
166
|
+
| `/refacil:bug` | `refacil-debugger` | `investigation` mode: analyzes root cause without modifying anything. `fix` mode: implements the fix, generates regression tests, creates `summary.md` | Only in fix mode |
|
|
167
|
+
| `/refacil:propose` | `refacil-proposer` | Explores the codebase and generates proposal, specs, design, and tasks | Yes (SDD artifacts) |
|
|
168
|
+
|
|
169
|
+
**Common properties**: specialized system prompt, direct-invocation guardrail, output contract with a fenced JSON block per skill. Read-only sub-agents (`investigator`, `validator`, `auditor`) do not have `Edit`/`Write`. Write sub-agents (`tester`, `implementer`, `debugger`, `proposer`) do.
|
|
148
170
|
|
|
149
|
-
**
|
|
171
|
+
**Model**: `refacil-proposer` runs with `model: opusplan` (uses Opus during plan mode for highest-stakes planning, then switches to Sonnet for execution). Other sub-agents use `model: sonnet` by default.
|
|
150
172
|
|
|
151
|
-
**Dual-platform**: `.claude/agents/refacil-*.md`
|
|
173
|
+
**Dual-platform**: `.claude/agents/refacil-*.md` uses `tools:` (granular allowlist). `.cursor/agents/refacil-*.md` is auto-generated: `readonly: true` for agents without `Edit`/`Write`, `readonly: false` for those that have them; always `model: inherit`. The installer transforms the frontmatter automatically.
|
|
152
174
|
|
|
153
|
-
**
|
|
175
|
+
**Two-pass `refacil:bug` flow**: the wrapper first invokes the sub-agent in `investigation` mode (writes nothing) → the user confirms the hypothesis and approves the fix → the wrapper validates the working branch → invokes the sub-agent in `fix` mode to implement.
|
|
154
176
|
|
|
155
|
-
###
|
|
177
|
+
### Agent bus
|
|
156
178
|
|
|
157
|
-
| Skill |
|
|
179
|
+
| Skill | Usage |
|
|
158
180
|
|---|---|
|
|
159
|
-
| `/refacil:join <
|
|
181
|
+
| `/refacil:join <room>` | Join or create a room |
|
|
160
182
|
| `/refacil:say "..."` | Broadcast |
|
|
161
|
-
| `/refacil:ask @
|
|
162
|
-
| `/refacil:reply "..."` |
|
|
163
|
-
| `/refacil:attend` |
|
|
164
|
-
| `/refacil:inbox` |
|
|
183
|
+
| `/refacil:ask @name "..." [--wait N]` | Directed question; `@all` asks everyone in the room (blocks with `--wait` until the **first** response) |
|
|
184
|
+
| `/refacil:reply "..."` | Reply to the last question (auto-fills `correlationId`) |
|
|
185
|
+
| `/refacil:attend` | Active listen mode |
|
|
186
|
+
| `/refacil:inbox` | New messages since last read |
|
|
165
187
|
|
|
166
188
|
---
|
|
167
189
|
|
|
168
|
-
##
|
|
190
|
+
## Recommended Flow
|
|
169
191
|
|
|
170
|
-
|
|
192
|
+
Quick rule for choosing the entry command:
|
|
171
193
|
|
|
172
|
-
-
|
|
173
|
-
-
|
|
174
|
-
-
|
|
194
|
+
- Understand the system without touching code → `/refacil:explore`
|
|
195
|
+
- New feature or behavior change → `/refacil:propose`
|
|
196
|
+
- Functional bug or production error → `/refacil:bug`
|
|
175
197
|
|
|
176
|
-
|
|
198
|
+
From there, the full cycle is:
|
|
177
199
|
|
|
178
200
|
```
|
|
179
201
|
┌───────────────────────────┐
|
|
180
|
-
│
|
|
202
|
+
│ Change needed │
|
|
181
203
|
└──────────────┬────────────┘
|
|
182
204
|
▼
|
|
183
205
|
┌─────────────────┐
|
|
184
|
-
│
|
|
206
|
+
│ Type of task? │
|
|
185
207
|
└──┬───────┬──────┘
|
|
186
208
|
│ │
|
|
187
209
|
FEATURE│ │BUG
|
|
188
210
|
▼ ▼
|
|
189
211
|
/refacil: /refacil:
|
|
190
212
|
propose bug
|
|
191
|
-
(proposal + (fix +
|
|
192
|
-
specs +
|
|
193
|
-
design +
|
|
213
|
+
(proposal + (fix + regression
|
|
214
|
+
specs + tests +
|
|
215
|
+
design + summary.md)
|
|
194
216
|
tasks) │
|
|
195
217
|
│ │
|
|
196
218
|
▼ │
|
|
@@ -204,105 +226,105 @@ A partir de ahi, el ciclo completo es:
|
|
|
204
226
|
▼ │
|
|
205
227
|
/refacil: │
|
|
206
228
|
verify │
|
|
207
|
-
(max 2
|
|
229
|
+
(max 2 rounds │
|
|
208
230
|
autofix) │
|
|
209
231
|
│ │
|
|
210
232
|
└───┬───┘
|
|
211
233
|
▼
|
|
212
234
|
/refacil:review
|
|
213
|
-
(
|
|
235
|
+
(generates .review-passed)
|
|
214
236
|
▼
|
|
215
237
|
/refacil:archive
|
|
216
|
-
(feature:
|
|
217
|
-
bug: fix-*/spec.md +
|
|
218
|
-
review.yaml)
|
|
238
|
+
(feature: moves to archive/ + syncs specs
|
|
239
|
+
bug: fix-*/spec.md + review.yaml)
|
|
219
240
|
▼
|
|
220
241
|
/refacil:up-code
|
|
221
|
-
(
|
|
242
|
+
(checks review +
|
|
222
243
|
commit + push + PR)
|
|
223
244
|
▼
|
|
224
|
-
PR
|
|
245
|
+
PR created
|
|
225
246
|
```
|
|
226
247
|
|
|
227
|
-
**
|
|
228
|
-
- `/refacil:up-code`
|
|
229
|
-
-
|
|
248
|
+
**Two-layer review gate**:
|
|
249
|
+
- `/refacil:up-code` detects a missing `.review-passed` and **automatically runs `/refacil:review`** before pushing.
|
|
250
|
+
- The `check-review` hook also intercepts manual `git push` commands and **blocks** the operation if it is missing. The hook does not invoke skills — it only blocks and instructs.
|
|
230
251
|
|
|
231
252
|
**Archive**:
|
|
232
|
-
-
|
|
233
|
-
-
|
|
234
|
-
-
|
|
235
|
-
- `/refacil:archive`
|
|
253
|
+
- For features/improvements: the CLI moves artifacts to `archive/` and extracts `.review-passed` fields to `review.yaml` inside each affected spec.
|
|
254
|
+
- For bugs: manual archiving, creates `refacil-sdd/specs/fix-*/spec.md` in standard format + `review.yaml`.
|
|
255
|
+
- A single branch can accumulate multiple bugs, each in its own independent `fix-*/` folder.
|
|
256
|
+
- `/refacil:archive` always requests one or more **Jira links** associated with the change before proceeding. Links are stored in `review.yaml` under the `jiraTasks` field (YAML list). This field is mandatory — archiving does not proceed until the user provides at least one link.
|
|
236
257
|
|
|
237
258
|
---
|
|
238
259
|
|
|
239
|
-
## Hooks
|
|
260
|
+
## Automatic Hooks
|
|
240
261
|
|
|
241
|
-
|
|
262
|
+
Installed in `.claude/settings.json` **and** `.cursor/settings.json` during `init` / `update`. Apply to both **Claude Code** and **Cursor**.
|
|
242
263
|
|
|
243
|
-
| Hook |
|
|
264
|
+
| Hook | Event | What it does |
|
|
244
265
|
|---|---|---|
|
|
245
|
-
| `check-update` | `SessionStart` |
|
|
246
|
-
| `notify-update` | `UserPromptSubmit` (Claude Code) / `beforeSubmitPrompt` (Cursor) |
|
|
247
|
-
| `compact-bash` | `PreToolUse` (Bash) |
|
|
248
|
-
| `check-review` | `PreToolUse` (Bash) |
|
|
266
|
+
| `check-update` | `SessionStart` | On startup deletes `.refacil-pending-update` if no migration is pending (stale flags). Then: npm check, sync skills, **compact-guidance**. If skills were synced **and** a migration is pending, writes the flag for `notify-update`. |
|
|
267
|
+
| `notify-update` | `UserPromptSubmit` (Claude Code) / `beforeSubmitPrompt` (Cursor) | If the flag exists **and** a methodology migration is pending (same table as `/refacil:update`), injects the instruction or pauses the first message; if the sync happened without a migration, the flag is not created or is discarded silently. |
|
|
268
|
+
| `compact-bash` | `PreToolUse` (Bash) | Silently rewrites bare Bash commands via `updatedInput`. No extra turns, the IDE does not see the change. Requires Claude Code >= 2.1.89. |
|
|
269
|
+
| `check-review` | `PreToolUse` (Bash) | Intercepts `git push` and blocks if `.review-passed` is missing in any active change. |
|
|
249
270
|
|
|
250
|
-
|
|
271
|
+
All four hooks are installed in `.claude/settings.json` (Claude Code) and `.cursor/settings.json` (Cursor) with the same parametric logic.
|
|
251
272
|
|
|
252
|
-
> **
|
|
273
|
+
> **Why two hooks for updates?** `SessionStart` does the silent sync when opening the session without user interaction. `notify-update` on `UserPromptSubmit` / `beforeSubmitPrompt` injects the instruction just before the agent processes the next user message, ensuring it is not ignored.
|
|
253
274
|
|
|
254
|
-
###
|
|
275
|
+
### Review gate on push
|
|
255
276
|
|
|
256
277
|
```
|
|
257
278
|
┌──────────────────────────────┐
|
|
258
|
-
│ Dev
|
|
259
|
-
│
|
|
279
|
+
│ Dev runs /refacil:up-code │
|
|
280
|
+
│ or manual git push │
|
|
260
281
|
└──────────────┬───────────────┘
|
|
261
282
|
│
|
|
262
283
|
┌──────────────────┴──────────────────┐
|
|
263
|
-
│ Via /refacil:up-code │ git push
|
|
284
|
+
│ Via /refacil:up-code │ Direct git push
|
|
264
285
|
▼ ▼
|
|
265
286
|
┌─────────────────────┐ ┌───────────────────────┐
|
|
266
|
-
│ up-code
|
|
267
|
-
│
|
|
268
|
-
│
|
|
269
|
-
│
|
|
287
|
+
│ up-code detects │ │ Hook check-review │
|
|
288
|
+
│ missing │ │ (PreToolUse on Bash) │
|
|
289
|
+
│ .review-passed → │ │ Checks .review-passed │
|
|
290
|
+
│ INVOKES /refacil: │ │ in changes/* │
|
|
291
|
+
│ review │ │ │
|
|
270
292
|
└─────────┬───────────┘ └──────────┬────────────┘
|
|
271
293
|
│ │
|
|
272
294
|
▼ ▼
|
|
273
295
|
┌──────────────┐ ┌─────────────────┐
|
|
274
|
-
│
|
|
296
|
+
│ Review OK? │ │ Any missing? │
|
|
275
297
|
└──┬────────┬──┘ └──┬───────────┬──┘
|
|
276
|
-
|
|
277
|
-
▼ ▼
|
|
278
|
-
push OK
|
|
279
|
-
no
|
|
298
|
+
YES│ NO│ YES│ NO│
|
|
299
|
+
▼ ▼ ▼ ▼
|
|
300
|
+
push OK report + block + allow
|
|
301
|
+
no push instruct push
|
|
280
302
|
```
|
|
281
303
|
|
|
282
|
-
###
|
|
304
|
+
### `compact-bash` hook — silent command rewrite
|
|
283
305
|
|
|
284
|
-
|
|
306
|
+
A second token-reduction layer, **with no conversational cost**. Claude emits a Bash command; before executing it, the hook inspects it, and if it matches a rule rewrites it via `updatedInput`. Claude does not see the change.
|
|
285
307
|
|
|
286
|
-
**
|
|
308
|
+
**Intent detector**: if the command already has explicit flags (`git log -p`, `jest --watch`, `docker logs --tail 50`), the hook **does not intervene** — your intent takes precedence.
|
|
287
309
|
|
|
288
|
-
**Escape**:
|
|
310
|
+
**Escape**: prefix `COMPACT=0` to the command (`COMPACT=0 git log`).
|
|
289
311
|
|
|
290
|
-
**
|
|
312
|
+
**Active rules — git, tests, docker logs**:
|
|
291
313
|
|
|
292
|
-
| Bare |
|
|
314
|
+
| Bare | Rewritten to | Savings |
|
|
293
315
|
|---|---|---|
|
|
294
316
|
| `git log` | `git log --oneline -20` | ~85% |
|
|
295
317
|
| `git status` | `git status -s` | ~70% |
|
|
296
|
-
| `git diff` (
|
|
318
|
+
| `git diff` (no args) | `git diff --stat` | ~80% |
|
|
297
319
|
| `git show` | `git show --stat` | ~70% |
|
|
298
320
|
| `docker logs <c>` | `docker logs --tail 100 <c>` | ~80% |
|
|
299
321
|
| `npm test` / `yarn test` / `pnpm test` | `… 2>&1 \| tail -80` | ~90% |
|
|
300
322
|
| `jest` | `jest --silent --reporters=summary` | ~85% |
|
|
301
323
|
| `pytest` | `pytest -q` | ~60% |
|
|
302
324
|
|
|
303
|
-
**
|
|
325
|
+
**Active rules — linters, type checkers, build, system**:
|
|
304
326
|
|
|
305
|
-
| Bare |
|
|
327
|
+
| Bare | Rewritten to | Savings |
|
|
306
328
|
|---|---|---|
|
|
307
329
|
| `eslint` | `eslint . --format compact --quiet` | ~70% |
|
|
308
330
|
| `eslint <path>` | `eslint <path> --format compact` | ~60% |
|
|
@@ -312,106 +334,109 @@ Segunda capa de reduccion de tokens, **sin costo conversacional**. Claude emite
|
|
|
312
334
|
| `npm audit` | `npm audit 2>&1 \| tail -10` | ~80% |
|
|
313
335
|
| `npm ls` | `npm ls --depth=0` | ~90% |
|
|
314
336
|
| `cargo build / test / check` | `… --quiet` | ~50% |
|
|
315
|
-
| `go test …` (
|
|
337
|
+
| `go test …` (no flags) | `… 2>&1 \| tail -80` | ~70% |
|
|
316
338
|
| `mvn test` | `mvn test -q` | ~60% |
|
|
317
339
|
| `./gradlew test` / `gradle test` | `… -q` | ~60% |
|
|
318
340
|
| `ps aux` | `ps -eo pid,pcpu,pmem,comm \| head -30` | ~80% |
|
|
319
341
|
|
|
320
|
-
**
|
|
342
|
+
**Telemetry**: each rewrite appends a JSON line to `~/.refacil-sdd-ai/compact.log` (local, nothing leaves the machine). `compact stats` calculates token savings and estimated USD (at $3/MTok input for Sonnet, conservative).
|
|
321
343
|
|
|
322
|
-
###
|
|
344
|
+
### `compact-guidance` block in AGENTS.md
|
|
323
345
|
|
|
324
|
-
|
|
346
|
+
The SDD-AI methodology generates a lot of context (artifacts, specs, prompts). To compensate, the package maintains a block in `AGENTS.md` that instructs the AI to request compact output (Read with offset/limit, `git log --oneline`, tests with failures only, etc.).
|
|
325
347
|
|
|
326
|
-
-
|
|
327
|
-
-
|
|
328
|
-
-
|
|
329
|
-
-
|
|
348
|
+
- Delimited by `<!-- refacil-sdd-ai:compact-guidance:start -->` and `...:end -->`
|
|
349
|
+
- Source of truth: `templates/compact-guidance.md`
|
|
350
|
+
- Synced on: `init`, `update`, and the `check-update` hook (every SessionStart)
|
|
351
|
+
- If `AGENTS.md` does not exist, it is not created behind the user's back
|
|
330
352
|
|
|
331
|
-
> **
|
|
353
|
+
> **Do not manually edit** between the markers. Content is overwritten on the next session.
|
|
332
354
|
|
|
333
355
|
---
|
|
334
356
|
|
|
335
|
-
##
|
|
357
|
+
## Cross-methodology rules
|
|
336
358
|
|
|
337
|
-
|
|
359
|
+
Defined in `skills/prereqs/METHODOLOGY-CONTRACT.md`:
|
|
338
360
|
|
|
339
|
-
- **
|
|
340
|
-
- **
|
|
341
|
-
- **
|
|
342
|
-
- **`AGENTS.md`
|
|
343
|
-
- **
|
|
361
|
+
- **Flow states**: `READY_FOR_APPLY` / `VERIFY` / `REVIEW` / `ARCHIVE` / `MERGE` — each transition validates prerequisites.
|
|
362
|
+
- **Branch policy**: every new branch (`feature/*`, `fix/*`, etc.) is created from an up-to-date `develop`/`dev`. Integration to protected branches (`testing`, `develop`, `dev`, `main`, `master`, `qa`) always via PR. **Never** direct commits to `master`/`main`. Single exception: repos without `develop`/`dev`, where `main` or `master` may be used temporarily as a base.
|
|
363
|
+
- **Multi-stack tests**: detects the real test command (does not hardcode `npm test`).
|
|
364
|
+
- **`AGENTS.md` by profile** (`sdd` vs `agents`): the methodology respects both.
|
|
365
|
+
- **Output mode**: concise by default, detailed on demand.
|
|
366
|
+
- **Language policy**: internal agent and skill instructions are in **English**. Responses to the user are in the **user's language** (default: Spanish). SDD artifacts are in the **team's agreed language**.
|
|
344
367
|
|
|
345
368
|
---
|
|
346
369
|
|
|
347
|
-
## refacil-bus — chat room
|
|
370
|
+
## refacil-bus — agent chat room
|
|
348
371
|
|
|
349
|
-
|
|
372
|
+
Local bus (WebSocket over `127.0.0.1`) so agents across different repos can communicate via plain text. **Does not share files, context, or tokens between repos** — each agent responds from its own code.
|
|
350
373
|
|
|
351
|
-
**
|
|
374
|
+
**Primary use case**: a dev with several IDE windows open (one per repo). Before the bus, the dev acted as a transcriber between their own agents. With the bus, agents talk to each other directly.
|
|
352
375
|
|
|
353
|
-
**
|
|
376
|
+
**Properties**:
|
|
354
377
|
|
|
355
|
-
- 100% local:
|
|
356
|
-
- Zero config:
|
|
357
|
-
- ~40 MB RAM, 0% CPU idle.
|
|
358
|
-
-
|
|
378
|
+
- 100% local: nothing leaves `127.0.0.1`. No accounts, no shared service.
|
|
379
|
+
- Zero config: the broker auto-spawns the first time a skill needs it (`127.0.0.1:7821`, fallback 7822/7823).
|
|
380
|
+
- ~40 MB RAM, 0% CPU idle. Persistence: `~/.refacil-sdd-ai/bus/<room>/inbox.jsonl` (7-day rotation).
|
|
381
|
+
- Same skills in Claude Code and Cursor.
|
|
359
382
|
|
|
360
|
-
**
|
|
383
|
+
**Quick start**:
|
|
361
384
|
|
|
362
385
|
```bash
|
|
363
|
-
#
|
|
386
|
+
# In each repo, once
|
|
364
387
|
/refacil:join refacil-main
|
|
365
|
-
#
|
|
388
|
+
# On the first time the LLM writes an introduction block in AGENTS.md
|
|
366
389
|
```
|
|
367
390
|
|
|
368
|
-
**
|
|
391
|
+
**Optimal pattern**: before starting a task that may require querying another repo, go to the other repo's window and say *"attend the bus"*. That puts it into `/refacil:attend` and the agent conversation happens in the background without the dev switching windows.
|
|
369
392
|
|
|
370
|
-
**
|
|
393
|
+
**SDD-AI conventions in the bus**: anyone in the room joined with `/refacil:join` (methodology already active in the repo). **Change requests** to another session go with **clear scope** in the `ask` (no pasting the guide in every message); the destination repo channels with **`/refacil:propose`** and whoever implements **closes via bus** to who requested the work. Details and edge cases: `refacil-prereqs/BUS-CROSS-REPO.md` in the installed skills.
|
|
371
394
|
|
|
372
|
-
**
|
|
395
|
+
**Pure observer** (0 tokens): `refacil-sdd-ai bus watch <session>` or `refacil-sdd-ai bus view` for the web UI.
|
|
373
396
|
|
|
374
|
-
> **
|
|
397
|
+
> **Diagrams, scenarios and pitch**: see `refacil-bus-diagrams.md` (included in the package) — includes architecture, flow with attend, flow without attend, comparative impact table, and visual decision guide (Mermaid).
|
|
375
398
|
|
|
376
|
-
###
|
|
399
|
+
### Known limitations
|
|
377
400
|
|
|
378
|
-
-
|
|
379
|
-
-
|
|
380
|
-
-
|
|
401
|
+
- While `/refacil:attend` is active, the IDE session is occupied (abort with ESC). Mitigation: a second window of the same repo dedicated to listening.
|
|
402
|
+
- The LLM does not receive external pushes: full automation requires the receiver to be in `attend`, or for the dev to ask `/refacil:inbox` afterwards.
|
|
403
|
+
- No authentication: any local process can connect to the broker (by design, loopback only and on-demand by the dev).
|
|
381
404
|
|
|
382
405
|
---
|
|
383
406
|
|
|
384
|
-
##
|
|
407
|
+
## What Gets Installed in Your Repo
|
|
385
408
|
|
|
386
409
|
```
|
|
387
|
-
.claude/skills/refacil-*/ #
|
|
388
|
-
.claude/agents/refacil-*.md #
|
|
389
|
-
#
|
|
410
|
+
.claude/skills/refacil-*/ # Claude Code skills (includes refacil-prereqs: METHODOLOGY-CONTRACT.md, BUS-CROSS-REPO.md, …)
|
|
411
|
+
.claude/agents/refacil-*.md # Read-only sub-agents: auditor, investigator, validator
|
|
412
|
+
# Write sub-agents: tester, implementer, debugger, proposer
|
|
390
413
|
.claude/settings.json # Hooks: check-update + check-review + compact-bash
|
|
391
|
-
.cursor/skills/refacil-*/ #
|
|
392
|
-
.cursor/agents/refacil-*.md #
|
|
393
|
-
.cursor/settings.json # Hooks: check-update + check-review + compact-bash (mirror
|
|
394
|
-
CLAUDE.md #
|
|
395
|
-
.cursorrules #
|
|
396
|
-
.claudeignore #
|
|
397
|
-
.cursorignore #
|
|
398
|
-
AGENTS.md #
|
|
399
|
-
#
|
|
400
|
-
# (compact-guidance
|
|
401
|
-
.agents/ #
|
|
402
|
-
# summary.md, architecture.md, stack.md, testing.md, commands.md
|
|
403
|
-
|
|
414
|
+
.cursor/skills/refacil-*/ # Cursor skills (equivalent)
|
|
415
|
+
.cursor/agents/refacil-*.md # Cursor sub-agents (readonly:true/false + model:inherit auto-generated)
|
|
416
|
+
.cursor/settings.json # Hooks: check-update + check-review + compact-bash (mirror of .claude/)
|
|
417
|
+
CLAUDE.md # Minimal index → points to AGENTS.md
|
|
418
|
+
.cursorrules # Same in Cursor format
|
|
419
|
+
.claudeignore # Base exclusions (node_modules, dist, .env, *.key, etc.)
|
|
420
|
+
.cursorignore # Same content as .claudeignore
|
|
421
|
+
AGENTS.md # Project index → generated by /refacil:setup
|
|
422
|
+
# Points to .agents/ + includes auto-managed blocks
|
|
423
|
+
# (compact-guidance and bus presentation)
|
|
424
|
+
.agents/ # Project detail by area (generated by /refacil:setup)
|
|
425
|
+
# summary.md, architecture.md, stack.md, testing.md, commands.md…
|
|
426
|
+
refacil-sdd/ # SDD artifacts store
|
|
427
|
+
changes/ # Active changes: proposal.md, specs, design.md, tasks.md
|
|
428
|
+
changes/archive/ # Archived changes (moved here by /refacil:archive)
|
|
429
|
+
specs/ # Persistent specifications synced from archived changes
|
|
404
430
|
```
|
|
405
431
|
|
|
406
432
|
---
|
|
407
433
|
|
|
408
|
-
##
|
|
434
|
+
## Technologies
|
|
409
435
|
|
|
410
|
-
- [
|
|
411
|
-
- [
|
|
412
|
-
- [
|
|
413
|
-
- [Cursor](https://cursor.sh) — IDE con IA
|
|
436
|
+
- [AGENTS.md](https://agents.md/) — universal AI instructions standard
|
|
437
|
+
- [Claude Code](https://claude.ai/code) — Anthropic CLI
|
|
438
|
+
- [Cursor](https://cursor.sh) — AI IDE
|
|
414
439
|
|
|
415
|
-
##
|
|
440
|
+
## License
|
|
416
441
|
|
|
417
442
|
MIT
|