claude-prism 0.6.0 → 0.7.1
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 +113 -443
- package/bin/cli.mjs +11 -11
- package/hooks/plan-enforcement.mjs +58 -0
- package/lib/config.mjs +1 -4
- package/lib/installer.mjs +68 -83
- package/lib/messages.mjs +1 -8
- package/package.json +2 -5
- package/templates/rules.md +133 -110
- package/templates/runners/post-tool.mjs +0 -6
- package/templates/runners/pre-tool.mjs +2 -2
- package/templates/settings.json +6 -7
- package/hooks/alignment.mjs +0 -103
- package/hooks/debug-loop.mjs +0 -104
- package/hooks/scope-guard.mjs +0 -101
- package/hooks/turn-reporter.mjs +0 -70
- package/lib/adapter.mjs +0 -90
- package/templates/runners/debug-loop.mjs +0 -4
- package/templates/runners/scope-guard.mjs +0 -4
- package/templates/runners/user-prompt.mjs +0 -7
package/README.md
CHANGED
|
@@ -1,513 +1,183 @@
|
|
|
1
1
|
```
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
spectrum
|
|
2
|
+
╱╲
|
|
3
|
+
━━━━━━━━━▶ ╱ ╲ ── U Understand
|
|
4
|
+
complex ╱ ╲ ── D Decompose
|
|
5
|
+
problem ╱ PRISM╲── E Execute
|
|
6
|
+
╱________╲─ C Checkpoint
|
|
8
7
|
```
|
|
9
8
|
|
|
10
9
|
[](https://www.npmjs.com/package/claude-prism)
|
|
11
10
|
[](https://github.com/lazysaturday91/claude-prism/blob/main/LICENSE)
|
|
12
11
|
[](https://nodejs.org)
|
|
13
12
|
|
|
14
|
-
> `ai-coding` · `
|
|
13
|
+
> `ai-coding` · `methodology` · `udec` · `claude-code`
|
|
15
14
|
|
|
16
15
|
# claude-prism
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
**UDEC methodology framework for AI coding agents.**
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
**Core philosophy:** Never implement what you haven't understood. Never execute what you haven't decomposed.
|
|
23
|
-
|
|
24
|
-
### What's New in v0.4.0
|
|
25
|
-
|
|
26
|
-
- **Task size tags** — Every task gets `[S]`, `[M]`, or `[L]` with adaptive batch composition (S+S+M = 1 batch, L = solo)
|
|
27
|
-
- **Verification strategy per task** — `| Verify: TDD`, `| Verify: Build`, or `| Verify: Visual` in plan templates
|
|
28
|
-
- **Pre-decomposition checklist** — Mandatory type/schema/dependency check before creating plans
|
|
29
|
-
- **Progress dashboard** — Visual progress bar with phase/batch/task percentages at each checkpoint
|
|
30
|
-
- **Adaptive checkpoints** — After 3 consecutive approvals, batch size expands to 5-8 for the rest of the phase
|
|
31
|
-
- **Scope guard disk fallback** — Detects existing `docs/plans/*.md` on disk, not just in-session writes (fixes false "without a plan" warnings across sessions)
|
|
32
|
-
- **20 test runner patterns** — Added bun, pnpm, yarn, deno, rspec, dotnet, mvn, gradle detection
|
|
33
|
-
- **9 framework-specific result detectors** — Accurate pass/fail for node, jest, vitest, pytest, go, cargo, mocha, rspec, dotnet
|
|
34
|
-
- **Unified hook pipeline** — Single process per hook event instead of separate processes per rule (reduced I/O)
|
|
35
|
-
- **Session event logging** — JSONL-based per-session event recording
|
|
36
|
-
- **Alignment detection** — Scope drift tracking and major decision flagging
|
|
37
|
-
- **Custom rules** — User-defined hook rules via config
|
|
19
|
+
Installs the UDEC methodology — **Understand, Decompose, Execute, Checkpoint** — directly into your project's Claude Code environment. Includes an entry protocol (Assess) and session transition protocol (Handoff) that bookend the core cycle. Three lightweight hooks enforce the methodology where it matters most.
|
|
38
20
|
|
|
39
21
|
## The Problem
|
|
40
22
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
| Without Prism | With Prism |
|
|
44
|
-
|---|---|
|
|
45
|
-
| Reads request → assumes understanding | Reads request → assesses sufficiency |
|
|
46
|
-
| Starts coding immediately | Asks 1-2 clarifying questions first |
|
|
47
|
-
| Builds one 30-minute mega-feature | Decomposes into 2-5 minute verifiable units |
|
|
48
|
-
| Runs autonomously (no checkpoints) | Adaptive batches (1-8 tasks by complexity) → checkpoint → ask permission |
|
|
49
|
-
| Produces working code that's wrong | Produces code that's correct *and* wanted |
|
|
50
|
-
|
|
51
|
-
## Installation
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
npx claude-prism init # Install with hooks
|
|
55
|
-
npx claude-prism init --no-hooks # Rules only, no hooks
|
|
56
|
-
npx claude-prism init --global # Install as global skill (available in all projects)
|
|
57
|
-
npx claude-prism update # Update rules and commands to latest
|
|
58
|
-
npx claude-prism update --global # Update global skill too
|
|
59
|
-
prism check # Verify installation
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### What Gets Installed
|
|
63
|
-
|
|
64
|
-
After running `prism init`, your project gains:
|
|
65
|
-
|
|
66
|
-
**UDEC Rules** — Injected into `CLAUDE.md` between `PRISM:START` and `PRISM:END` markers. Explains the four-phase methodology:
|
|
67
|
-
- **U** — Assess information sufficiency before acting. Ask one question at a time, multiple choice, max 3 rounds.
|
|
68
|
-
- **D** — Decompose complex problems into 2-5 minute units with TDD. Create a plan file for 6+ file changes.
|
|
69
|
-
- **E** — Execute in adaptive batches. Apply context-aware verification by file path (TDD / build / lint-only).
|
|
70
|
-
- **C** — Checkpoint after each batch. Report progress, show next batch preview, get confirmation before continuing.
|
|
71
|
-
|
|
72
|
-
**Slash Commands** — Added to `.claude/commands/claude-prism/`:
|
|
73
|
-
- `/claude-prism:prism` — Full UDEC workflow (understand → decompose → execute → checkpoint). Also handles analysis-only requests.
|
|
74
|
-
- `/claude-prism:checkpoint` — Check batch progress, show next batch preview
|
|
75
|
-
- `/claude-prism:plan` — List, create, or view plan files
|
|
76
|
-
- `/claude-prism:doctor` — Diagnose installation health via Claude
|
|
77
|
-
- `/claude-prism:stats` — Show project statistics, hook status, and plan progress
|
|
78
|
-
- `/claude-prism:update` — Update rules and commands to latest version
|
|
79
|
-
- `/claude-prism:help` — Command reference
|
|
80
|
-
|
|
81
|
-
**Hooks** (optional, unless `--no-hooks` is set) — Six CLI guards that enforce discipline:
|
|
82
|
-
- `commit-guard` — Prevents commits when tests haven't run recently
|
|
83
|
-
- `debug-loop` — Detects divergent editing patterns on the same file (catches infinite debugging loops)
|
|
84
|
-
- `test-tracker` — Detects test execution (20 patterns, 9 framework-specific result detectors) and records pass/fail
|
|
85
|
-
- `scope-guard` — Warns at 4 unique files modified, blocks at 7 (agent-aware, plan-aware with disk fallback)
|
|
86
|
-
- `alignment` — Detects scope drift (new directories outside base scope) and major decisions (package installs, db migrations, destructive deletes)
|
|
87
|
-
- `turn-reporter` — Tracks turn count, warns at 5 autonomous turns without user input, provides previous turn summary
|
|
88
|
-
|
|
89
|
-
**Configuration** — `.claude-prism.json` stores hook settings. Includes OMC (oh-my-claudecode) detection.
|
|
90
|
-
|
|
91
|
-
## File Structure After Installation
|
|
23
|
+
AI coding agents fail in predictable ways:
|
|
92
24
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
│ │ ├── prism.md # /claude-prism:prism
|
|
101
|
-
│ │ ├── checkpoint.md # /claude-prism:checkpoint
|
|
102
|
-
│ │ ├── plan.md # /claude-prism:plan
|
|
103
|
-
│ │ ├── doctor.md # /claude-prism:doctor
|
|
104
|
-
│ │ ├── stats.md # /claude-prism:stats
|
|
105
|
-
│ │ ├── update.md # /claude-prism:update
|
|
106
|
-
│ │ └── help.md # /claude-prism:help
|
|
107
|
-
│ ├── hooks/ # (optional, if --no-hooks not set)
|
|
108
|
-
│ │ ├── pre-tool.mjs # Unified PreToolUse runner
|
|
109
|
-
│ │ ├── post-tool.mjs # Unified PostToolUse runner
|
|
110
|
-
│ │ └── user-prompt.mjs # UserPromptSubmit runner
|
|
111
|
-
│ ├── rules/ # Hook logic modules
|
|
112
|
-
│ │ ├── commit-guard.mjs
|
|
113
|
-
│ │ ├── debug-loop.mjs
|
|
114
|
-
│ │ ├── test-tracker.mjs
|
|
115
|
-
│ │ ├── scope-guard.mjs
|
|
116
|
-
│ │ ├── alignment.mjs
|
|
117
|
-
│ │ └── turn-reporter.mjs
|
|
118
|
-
│ ├── lib/ # Hook dependencies
|
|
119
|
-
│ │ ├── adapter.mjs
|
|
120
|
-
│ │ ├── pipeline.mjs
|
|
121
|
-
│ │ ├── state.mjs
|
|
122
|
-
│ │ ├── session.mjs
|
|
123
|
-
│ │ ├── config.mjs
|
|
124
|
-
│ │ ├── messages.mjs
|
|
125
|
-
│ │ └── utils.mjs
|
|
126
|
-
│ └── settings.json # Claude Code hook registration
|
|
127
|
-
└── docs/plans/
|
|
128
|
-
└── YYYY-MM-DD-topic.md # Plan files (created during /claude-prism:prism execution)
|
|
129
|
-
```
|
|
25
|
+
| Failure Mode | What Happens | UDEC Fix |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| Skip understanding | Builds the wrong thing for 30 minutes | UNDERSTAND phase |
|
|
28
|
+
| No decomposition | One massive change that's hard to review | DECOMPOSE into verifiable batches |
|
|
29
|
+
| No verification | "should work" without evidence | Risk-based verification strategy |
|
|
30
|
+
| Scope creep | "While I'm here..." changes nobody asked for | Scope Guard in methodology |
|
|
31
|
+
| Context loss | New session = start from scratch | HANDOFF protocol |
|
|
130
32
|
|
|
131
|
-
|
|
33
|
+
**The biggest failure mode of AI coding isn't bad code — it's building the wrong thing.**
|
|
132
34
|
|
|
133
|
-
|
|
134
|
-
START
|
|
135
|
-
|
|
|
136
|
-
v
|
|
137
|
-
[ UNDERSTAND ] ← Assess sufficiency, ask clarifying questions
|
|
138
|
-
|
|
|
139
|
-
v
|
|
140
|
-
[ DECOMPOSE ] ← Break into 2-5 min units, create plan file
|
|
141
|
-
|
|
|
142
|
-
v
|
|
143
|
-
[ EXECUTE ] ← Run adaptive batch, verify each unit
|
|
144
|
-
|
|
|
145
|
-
v
|
|
146
|
-
[ CHECKPOINT ] ← Report, show next batch, ask to continue
|
|
147
|
-
|
|
|
148
|
-
[LOOP or STOP]
|
|
149
|
-
```
|
|
35
|
+
## Core Philosophy
|
|
150
36
|
|
|
151
|
-
|
|
37
|
+
> Never implement what you haven't understood. Never execute what you haven't decomposed.
|
|
152
38
|
|
|
153
|
-
|
|
39
|
+
## What Prism Provides
|
|
154
40
|
|
|
155
|
-
|
|
156
|
-
|---------|-------------|---------|
|
|
157
|
-
| `/claude-prism:prism` | Any task (code or analysis) | Run full UDEC cycle; stops at U phase for analysis-only requests |
|
|
158
|
-
| `/claude-prism:plan` | Manage plan files | List, create, or view plans |
|
|
159
|
-
| `/claude-prism:checkpoint` | Mid-project | Check batch progress, preview next batch |
|
|
160
|
-
| `/claude-prism:doctor` | Installation issues | Diagnose health, suggest fixes |
|
|
161
|
-
| `/claude-prism:stats` | Check current state | Version, hooks, plan progress |
|
|
162
|
-
| `/claude-prism:update` | After `npm update` | Update rules and commands to latest |
|
|
163
|
-
| `/claude-prism:help` | Forgot commands | Quick reference |
|
|
41
|
+
### 1. UDEC v2 Methodology (the core product)
|
|
164
42
|
|
|
165
|
-
|
|
43
|
+
Injected into `CLAUDE.md`, UDEC is a behavioral framework that corrects how AI agents approach tasks:
|
|
166
44
|
|
|
167
45
|
```
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
Plan mgmt ──────▶ /claude-prism:plan (list/create)
|
|
46
|
+
ASSESS ─── Classify: bugfix / feature / migration / refactor / investigation
|
|
47
|
+
│ (entry protocol)
|
|
48
|
+
▼
|
|
49
|
+
┌─────────────────── UDEC Core Cycle ───────────────────┐
|
|
50
|
+
│ UNDERSTAND ── Sufficiency assessment → ask → align │
|
|
51
|
+
│ │ │
|
|
52
|
+
│ DECOMPOSE ── Batches → plan file for 6+ files → [S][M][L] │
|
|
53
|
+
│ │ │
|
|
54
|
+
│ EXECUTE ── Adaptive batches → risk-based verification │
|
|
55
|
+
│ │ │
|
|
56
|
+
│ CHECKPOINT ── Report with evidence → get approval ─────┤
|
|
57
|
+
│ (loops back for next batch) │
|
|
58
|
+
└────────────────────────────────────────────────────────┘
|
|
59
|
+
│
|
|
60
|
+
▼
|
|
61
|
+
HANDOFF ── Session transition doc → next steps
|
|
62
|
+
(exit protocol)
|
|
186
63
|
```
|
|
187
64
|
|
|
188
|
-
|
|
65
|
+
**Task-type aware**: Each task type (bugfix, feature, migration, refactor, investigation) follows a different optimal path. Migrations skip per-file decomposition. Bugfixes skip straight to locate-fix-verify. Investigations skip decomposition entirely.
|
|
189
66
|
|
|
190
|
-
**
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
→ Plan created: docs/plans/2026-02-16-auth.md
|
|
195
|
-
→ Batch 1 executes (3 tasks)
|
|
196
|
-
/claude-prism:checkpoint → "Batch 1 done. Continue to batch 2?"
|
|
197
|
-
```
|
|
67
|
+
**Risk-based verification**: Verification matches the risk of the change, not the file path:
|
|
68
|
+
- **High risk** (business logic, auth, state machines): TDD required
|
|
69
|
+
- **Medium risk** (new components, API integration): Build + runtime check
|
|
70
|
+
- **Low risk** (imports, types, renaming): Build/lint passes
|
|
198
71
|
|
|
199
|
-
|
|
200
|
-
```
|
|
201
|
-
/claude-prism:prism → "Improve performance"
|
|
202
|
-
→ Claude: [Insufficient] "What kind?"
|
|
203
|
-
1. Build time (next build)
|
|
204
|
-
2. Runtime (page load/render)
|
|
205
|
-
3. Bundle size (recommended)
|
|
206
|
-
→ Agreement reached → proceeds to D/E/C or stops if analysis-only
|
|
207
|
-
→ /claude-prism:prism to start execution
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
**Pattern 3: Resume Previous Work**
|
|
211
|
-
```
|
|
212
|
-
/claude-prism:plan → List existing plans, show progress
|
|
213
|
-
/claude-prism:checkpoint → "Plan X: 5/12 tasks done. Batch 3 next."
|
|
214
|
-
→ "Continue" → Resume execution
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
**Pattern 4: Quick Troubleshooting**
|
|
218
|
-
```
|
|
219
|
-
/claude-prism:doctor → Check installation health
|
|
220
|
-
/claude-prism:stats → Verify hooks, OMC status
|
|
221
|
-
```
|
|
72
|
+
### 2. Three Focused Hooks
|
|
222
73
|
|
|
223
|
-
|
|
74
|
+
Hooks enforce the methodology at critical points. All three are deterministic (no heuristics, no state accumulation issues):
|
|
224
75
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
**After (Prism applied)**
|
|
231
|
-
1. User: "Refactor auth module"
|
|
232
|
-
2. Claude (automatic questions):
|
|
233
|
-
- "Goal: Keep existing API and only improve internal structure? (Yes/No)"
|
|
234
|
-
- "Scope: Authentication/authorization both? Or authentication only?"
|
|
235
|
-
- "Tests: Keep existing tests as-is?"
|
|
236
|
-
3. User confirms → decomposition starts
|
|
237
|
-
4. Result: Completed as intended
|
|
238
|
-
|
|
239
|
-
## Hooks
|
|
76
|
+
| Hook | What It Does | Trigger |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| **commit-guard** | Blocks commits when tests failed or haven't run | `git commit` |
|
|
79
|
+
| **test-tracker** | Records test pass/fail results | Test commands (20 patterns) |
|
|
80
|
+
| **plan-enforcement** | Warns when editing 6+ files without a plan | `Edit` / `Write` |
|
|
240
81
|
|
|
241
|
-
|
|
82
|
+
**Why only three?** Previous versions had 6 hooks (scope-guard, debug-loop, alignment, turn-reporter). They produced false positives that undermined the methodology they were supposed to enforce. These three survive because they're deterministic: file count + plan existence, test result parsing, commit detection. No ambiguity.
|
|
242
83
|
|
|
243
|
-
###
|
|
84
|
+
### 3. Slash Commands
|
|
244
85
|
|
|
245
|
-
|
|
86
|
+
| Command | Purpose |
|
|
87
|
+
|---------|---------|
|
|
88
|
+
| `/claude-prism:prism` | Run full UDEC cycle |
|
|
89
|
+
| `/claude-prism:checkpoint` | Check batch progress |
|
|
90
|
+
| `/claude-prism:plan` | List/create/view plan files |
|
|
91
|
+
| `/claude-prism:doctor` | Diagnose installation health |
|
|
92
|
+
| `/claude-prism:stats` | Version, hooks, plan count |
|
|
93
|
+
| `/claude-prism:update` | Update to latest version |
|
|
94
|
+
| `/claude-prism:help` | Command reference |
|
|
246
95
|
|
|
247
|
-
|
|
248
|
-
{
|
|
249
|
-
"hooks": {
|
|
250
|
-
"commit-guard": {
|
|
251
|
-
"enabled": true,
|
|
252
|
-
"maxTestAge": 300
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
**Behavior:**
|
|
259
|
-
- Detects test run via `test-tracker`
|
|
260
|
-
- Blocks commit if: (current time - last test run) > maxTestAge
|
|
261
|
-
- Prevents shipping untested code
|
|
262
|
-
|
|
263
|
-
### debug-loop
|
|
264
|
-
|
|
265
|
-
Detects editing patterns on the same file. Distinguishes between **divergent** edits (same code area repeatedly — likely thrashing) and **convergent** edits (different areas like imports, logic, JSX — normal progressive work).
|
|
96
|
+
## Installation
|
|
266
97
|
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
"warnAt": 3,
|
|
273
|
-
"blockAt": 5
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
98
|
+
```bash
|
|
99
|
+
npx claude-prism init # Install with hooks
|
|
100
|
+
npx claude-prism init --no-hooks # Methodology only, no hooks
|
|
101
|
+
npx claude-prism init --global # Global skill (all projects)
|
|
102
|
+
npx claude-prism init --dry-run # Preview what would be installed
|
|
277
103
|
```
|
|
278
104
|
|
|
279
|
-
|
|
280
|
-
- Tracks edit patterns using snippet analysis
|
|
281
|
-
- **Divergent pattern** (same area): warns at 3 edits, blocks at 5
|
|
282
|
-
- **Convergent pattern** (different areas): passes silently, downgrades block to warn
|
|
283
|
-
- Catches infinite debugging loops while allowing normal multi-area edits
|
|
284
|
-
|
|
285
|
-
### test-tracker
|
|
286
|
-
|
|
287
|
-
Detects test command execution and records the timestamp and pass/fail state. Used by `commit-guard` to verify tests ran recently.
|
|
288
|
-
|
|
289
|
-
**Detects (20 patterns):**
|
|
290
|
-
- `npm test`, `pnpm test`, `yarn test`, `bun test`
|
|
291
|
-
- `jest`, `vitest`, `mocha`, `rspec`
|
|
292
|
-
- `node --test`, `deno test`
|
|
293
|
-
- `npx jest`, `npx vitest`, `npx mocha`, `bunx vitest`
|
|
294
|
-
- `pytest`, `cargo test`, `go test`
|
|
295
|
-
- `dotnet test`, `mvn test`, `gradle test`
|
|
296
|
-
- `make test`
|
|
297
|
-
|
|
298
|
-
**Framework-specific result detection (9 detectors):**
|
|
299
|
-
- Node test runner, Jest, Vitest, Pytest, Go, Cargo, Mocha, RSpec, dotnet
|
|
300
|
-
- Analyzes both stdout and stderr for accurate pass/fail determination
|
|
105
|
+
### What Gets Installed
|
|
301
106
|
|
|
302
|
-
**Configuration:**
|
|
303
|
-
```json
|
|
304
|
-
{
|
|
305
|
-
"hooks": {
|
|
306
|
-
"test-tracker": {
|
|
307
|
-
"enabled": true
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
107
|
```
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
```json
|
|
324
|
-
{
|
|
325
|
-
"hooks": {
|
|
326
|
-
"scope-guard": {
|
|
327
|
-
"enabled": true,
|
|
328
|
-
"warnAt": 4,
|
|
329
|
-
"blockAt": 7,
|
|
330
|
-
"agentWarnAt": 8,
|
|
331
|
-
"agentBlockAt": 12
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
}
|
|
108
|
+
your-project/
|
|
109
|
+
├── CLAUDE.md # UDEC methodology injected
|
|
110
|
+
├── .claude-prism.json # Hook configuration
|
|
111
|
+
├── .claude/
|
|
112
|
+
│ ├── commands/claude-prism/ # 7 slash commands
|
|
113
|
+
│ ├── hooks/ # pre-tool.mjs, post-tool.mjs
|
|
114
|
+
│ ├── rules/ # commit-guard, test-tracker, plan-enforcement
|
|
115
|
+
│ ├── lib/ # Shared dependencies
|
|
116
|
+
│ └── settings.json # Hook registration
|
|
117
|
+
└── docs/plans/ # Plan files (created during work)
|
|
335
118
|
```
|
|
336
119
|
|
|
337
|
-
**Behavior:**
|
|
338
|
-
- Tracks unique source files (`.ts`, `.tsx`, `.js`, `.jsx`, `.py`, `.go`, `.rs`, `.java`, `.c`, `.cpp`, `.h`, `.svelte`, `.vue`)
|
|
339
|
-
- Excludes test files (`.test.`, `.spec.`, `_test.`)
|
|
340
|
-
- Standard thresholds: warns at 4 files, blocks at 7
|
|
341
|
-
- Agent thresholds (when OMC sub-agents running): warns at 8, blocks at 12
|
|
342
|
-
- Warning: "Consider running /claude-prism:prism to decompose the task"
|
|
343
|
-
- Block: "Run /claude-prism:prism to decompose before continuing"
|
|
344
|
-
- **Plan-aware**: When a plan file is created (`docs/plans/*.md`), thresholds are automatically doubled
|
|
345
|
-
- Standard with plan: warns at 8, blocks at 14
|
|
346
|
-
- Agent with plan: warns at 16, blocks at 24
|
|
347
|
-
- **Cross-session persistence**: Detects existing plan files on disk (`docs/plans/*.md`), not just plans created in the current session. Fixes false "without a plan" warnings when resuming work in a new session.
|
|
348
|
-
|
|
349
120
|
## Configuration
|
|
350
121
|
|
|
351
|
-
Edit `.claude-prism.json
|
|
122
|
+
Edit `.claude-prism.json`:
|
|
352
123
|
|
|
353
124
|
```json
|
|
354
125
|
{
|
|
355
126
|
"hooks": {
|
|
356
127
|
"commit-guard": { "enabled": true, "maxTestAge": 300 },
|
|
357
|
-
"debug-loop": { "enabled": true, "warnAt": 3, "blockAt": 5 },
|
|
358
128
|
"test-tracker": { "enabled": true },
|
|
359
|
-
"
|
|
129
|
+
"plan-enforcement": { "enabled": true, "warnAt": 6 }
|
|
360
130
|
}
|
|
361
131
|
}
|
|
362
132
|
```
|
|
363
133
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
- `hooks.scope-guard.warnAt/blockAt` — File counts for standard mode
|
|
369
|
-
- `hooks.scope-guard.agentWarnAt/agentBlockAt` — File counts for OMC agent mode
|
|
134
|
+
| Setting | Default | Description |
|
|
135
|
+
|---------|---------|-------------|
|
|
136
|
+
| `commit-guard.maxTestAge` | 300 | Seconds before test run is considered stale |
|
|
137
|
+
| `plan-enforcement.warnAt` | 6 | Unique source file count that triggers plan warning |
|
|
370
138
|
|
|
371
139
|
## CLI Commands
|
|
372
140
|
|
|
373
|
-
### prism check
|
|
374
|
-
|
|
375
|
-
Verify installation after `prism init`:
|
|
376
|
-
|
|
377
|
-
```bash
|
|
378
|
-
prism check
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
Output:
|
|
382
|
-
```
|
|
383
|
-
Commands: ✅
|
|
384
|
-
Rules: ✅
|
|
385
|
-
Hooks: ✅
|
|
386
|
-
Config: ✅
|
|
387
|
-
|
|
388
|
-
Status: ✅ All good
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
For CI integration, use `--ci` flag for JSON output:
|
|
392
|
-
|
|
393
|
-
```bash
|
|
394
|
-
prism check --ci
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
### prism doctor
|
|
398
|
-
|
|
399
|
-
Diagnose installation issues with actionable fix suggestions. Also detects oh-my-claudecode (OMC) presence.
|
|
400
|
-
|
|
401
|
-
```bash
|
|
402
|
-
prism doctor
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
Output:
|
|
406
|
-
```
|
|
407
|
-
✅ Installation is healthy. No issues found.
|
|
408
|
-
|
|
409
|
-
OMC: ✅ v4.1.1
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
If issues are found:
|
|
413
|
-
```
|
|
414
|
-
Issues found:
|
|
415
|
-
|
|
416
|
-
❌ CLAUDE.md rules not found
|
|
417
|
-
❌ /claude-prism:prism command not installed
|
|
418
|
-
|
|
419
|
-
Suggested fixes:
|
|
420
|
-
|
|
421
|
-
💡 Run: npx claude-prism init
|
|
422
|
-
💡 Check: .claude/commands/claude-prism/prism.md exists
|
|
423
|
-
```
|
|
424
|
-
|
|
425
|
-
### prism stats
|
|
426
|
-
|
|
427
|
-
Show installation summary including version, hook status, plan file count, and OMC detection:
|
|
428
|
-
|
|
429
|
-
```bash
|
|
430
|
-
prism stats
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
Output:
|
|
434
|
-
```
|
|
435
|
-
Version: v0.4.0
|
|
436
|
-
Plans: 2 file(s)
|
|
437
|
-
OMC: ✅ v4.1.1
|
|
438
|
-
Hooks:
|
|
439
|
-
✅ commit-guard
|
|
440
|
-
✅ debug-loop
|
|
441
|
-
✅ test-tracker
|
|
442
|
-
✅ scope-guard
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
### prism reset
|
|
446
|
-
|
|
447
|
-
Clear all hook state (edit counters, test timestamps, scope tracking). Use when starting a fresh task or after major refactor:
|
|
448
|
-
|
|
449
|
-
```bash
|
|
450
|
-
prism reset
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
Output:
|
|
454
|
-
```
|
|
455
|
-
✅ Hook state cleared (edit counters, test timestamps)
|
|
456
|
-
|
|
457
|
-
🌈 Fresh start. All hooks reset.
|
|
458
|
-
```
|
|
459
|
-
|
|
460
|
-
## Uninstall
|
|
461
|
-
|
|
462
141
|
```bash
|
|
463
|
-
|
|
142
|
+
prism init [--no-hooks] [--global] [--dry-run] # Install
|
|
143
|
+
prism check [--ci] # Verify installation
|
|
144
|
+
prism doctor # Diagnose issues
|
|
145
|
+
prism stats # Installation summary
|
|
146
|
+
prism reset # Clear hook state
|
|
147
|
+
prism update [--global] # Update to latest
|
|
148
|
+
prism uninstall [--global] # Remove
|
|
464
149
|
```
|
|
465
150
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
## OMC (oh-my-claudecode) Integration
|
|
469
|
-
|
|
470
|
-
Prism auto-detects if [oh-my-claudecode](https://github.com/raidenppl/oh-my-claudecode) is installed in your environment. When OMC is present:
|
|
471
|
-
|
|
472
|
-
- **Higher scope thresholds for agents** — Sub-agents get `agentWarnAt: 8, agentBlockAt: 12` instead of standard `warnAt: 4, blockAt: 7`
|
|
473
|
-
- **Visible in status commands** — `prism stats` and `prism doctor` show OMC detection with version
|
|
474
|
-
- **No configuration needed** — Detection happens automatically
|
|
475
|
-
|
|
476
|
-
Check OMC status:
|
|
151
|
+
## Before & After
|
|
477
152
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
This allows OMC agents (executor, architect, etc.) to modify more files per task without triggering scope warnings, recognizing that coordinated multi-agent work has different constraints than single-agent development.
|
|
484
|
-
|
|
485
|
-
## Verification Strategy
|
|
153
|
+
**Before** (AI agent default behavior):
|
|
154
|
+
1. User: "Refactor auth module"
|
|
155
|
+
2. AI: 30 minutes autonomous execution, no questions asked
|
|
156
|
+
3. Result: Structure nobody wanted, untested, scope creep everywhere
|
|
486
157
|
|
|
487
|
-
|
|
158
|
+
**After** (with UDEC):
|
|
159
|
+
1. User: "Refactor auth module"
|
|
160
|
+
2. AI classifies as **Refactor** type, assesses information as **[Partial]**
|
|
161
|
+
3. Asks: "Keep existing API surface? Or allowed to change public interface?"
|
|
162
|
+
4. Decomposes into 3 batches with size tags, creates plan file
|
|
163
|
+
5. Executes batch 1 → checkpoints with evidence → continues on approval
|
|
164
|
+
6. Result: Exactly what was asked, verified, documented
|
|
488
165
|
|
|
489
|
-
|
|
490
|
-
|---|---|---|
|
|
491
|
-
| `lib/`, `utils/`, `store/`, `hooks/`, `services/` | **TDD required** — failing test → implement → verify | Always TDD |
|
|
492
|
-
| `components/`, `pages/`, `views/` | **Build verification** — build passes + visual check | Escalate to TDD if complex logic |
|
|
493
|
-
| `config/`, `styles/`, `types/`, `*.json` | **Build/lint only** | Never |
|
|
166
|
+
## OMC Integration
|
|
494
167
|
|
|
495
|
-
|
|
496
|
-
1. Never claim completion without fresh verification evidence
|
|
497
|
-
2. Never commit code that doesn't build
|
|
498
|
-
3. TDD paths: write failing test → minimal code → verify
|
|
499
|
-
4. Build paths: run build/lint → confirm no regressions
|
|
168
|
+
Prism auto-detects [oh-my-claudecode](https://github.com/raidenppl/oh-my-claudecode). When present, `prism stats` and `prism doctor` show OMC version. No configuration needed.
|
|
500
169
|
|
|
501
170
|
## Design Philosophy
|
|
502
171
|
|
|
503
|
-
|
|
172
|
+
UDEC is the product. Everything else serves it.
|
|
173
|
+
|
|
174
|
+
The methodology works because it targets the specific failure modes of AI agents — not human developers. Humans naturally ask questions and break things down. AI optimizes for speed and skips these steps. UDEC forces the discipline that makes AI-assisted coding reliable.
|
|
504
175
|
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
- Context-aware verification (TDD, build, or lint — matched to file type)
|
|
176
|
+
The hooks exist to enforce the two most critical rules:
|
|
177
|
+
1. **Don't commit untested code** (commit-guard + test-tracker)
|
|
178
|
+
2. **Don't edit many files without a plan** (plan-enforcement)
|
|
509
179
|
|
|
510
|
-
|
|
180
|
+
Everything else is handled by the methodology itself, living in CLAUDE.md where the AI reads and follows it.
|
|
511
181
|
|
|
512
182
|
## License
|
|
513
183
|
|