claude-prism 1.8.0 → 1.9.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-prism",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "AI agent harness implementing the EUDEC methodology",
5
5
  "author": { "name": "lazysaturday91" },
6
6
  "repository": "https://github.com/lazysaturday91/claude-prism",
package/CHANGELOG.md CHANGED
@@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.9.0] — 2026-03-18
9
+
10
+ ### Added
11
+ - **Modular protocol files** — EUDEC methodology split into 6 on-demand protocol files (`essence.md`, `understand.md`, `decompose.md`, `execute.md`, `checkpoint.md`, `handoff.md`)
12
+ - `copyProtocols()` in installer — copies protocol files to `.claude/protocols/prism/` during `init` and `update`
13
+ - Protocol file verification tests
14
+
15
+ ### Changed
16
+ - **Default `rulesMode` changed from `full` to `lean`** — CLAUDE.md injection reduced from 586 lines (26KB) to 114 lines (4.5KB), an 82% reduction
17
+ - `rules-lean.md` now references `.claude/protocols/prism/*.md` for on-demand reading instead of `/claude-prism:prism` slash command
18
+ - `preservedRulesMode` logic updated to preserve `full` mode for users who explicitly opted in
19
+ - Existing users get lean mode automatically on `prism update` (marker-based replacement)
20
+
21
+ ## [1.8.1] — 2026-03-09
22
+
23
+ ### Changed
24
+ - **ESSENCE phase expanded** — Entry Judgment (Top-down/Bottom-up/Hybrid), Top-Down Removal Method with Counterexample test, Bottom-Up Competitive Exploration for novel problems
25
+ - **Scope Classification** added to DECOMPOSE — Core/Support/Out of Scope concentric circle model; "Out of Scope must not be empty" constraint
26
+ - **Self-Correction Triggers** — each trigger now specifies explicit fallback phase (→ ESSENCE/UNDERSTAND/DECOMPOSE); new triggers for scope expansion and error type oscillation
27
+ - `rules-lean.md` synced with Entry Judgment summary and fallback annotations
28
+
8
29
  ## [1.8.0] — 2026-03-06
9
30
 
10
31
  ### Added
package/README.md CHANGED
@@ -23,7 +23,7 @@ the infrastructure that channels AI coding agents toward correct, verified outpu
23
23
  It combines a behavioral methodology (EUDEC), deterministic hooks for enforcement,
24
24
  session lifecycle automation, and adaptive process weight that scales with task complexity.
25
25
 
26
- Installs the EUDEC methodology — **Essence, Understand, Decompose, Execute, Checkpoint** — directly into your project's Claude Code environment. Includes a session transition protocol (Handoff) that bookends the core cycle. Seven hooks enforce the methodology and automate session management.
26
+ Installs the EUDEC methodology — **Essence, Understand, Decompose, Execute, Checkpoint** — directly into your project's Claude Code environment. Includes a session transition protocol (Handoff) that bookends the core cycle. Eight hooks enforce the methodology and automate session management.
27
27
 
28
28
  ## The Problem
29
29
 
@@ -52,8 +52,8 @@ Injected into `CLAUDE.md`, EUDEC is a behavioral framework that corrects how AI
52
52
 
53
53
  ```
54
54
  ┌──────────────────── EUDEC Core Cycle ───────────────────┐
55
- │ ESSENCE ── Extract core problem simplifyexpand
56
- │ │ Task type derivation from essence
55
+ │ ESSENCE ── Entry Judgmentextract core simplify
56
+ │ │ expand · Scope Classification
57
57
  │ UNDERSTAND ── Sufficiency assessment → ask → align │
58
58
  │ │ Environment validation │
59
59
  │ │ Analysis-only branch (skip D/E/C if no code │
@@ -90,7 +90,18 @@ Injected into `CLAUDE.md`, EUDEC is a behavioral framework that corrects how AI
90
90
  - **Streamlined verification**: 3-level fallback ladder (Tests → Build → Diff)
91
91
  - **Adaptive checkpoints**: no pause for small tasks, summary for medium, full for large
92
92
 
93
- **New in v1.7.0:**
93
+ **New in v1.8.1:**
94
+ - **ESSENCE phase expanded** — Entry Judgment (Top-down/Bottom-up/Hybrid approach selection), Top-Down Removal Method with Counterexample test, Bottom-Up Competitive Exploration for novel problems
95
+ - **Scope Classification** — Core/Support/Out of Scope concentric circle model; "Out of Scope must not be empty" constraint prevents unbounded work
96
+ - **Self-Correction Fallbacks** — each trigger now specifies an explicit fallback phase (→ ESSENCE/UNDERSTAND/DECOMPOSE) instead of generic "stop"
97
+
98
+ **v1.8.0:**
99
+ - **Plan progress auto-tracking** — `PostToolUse [Edit|Write]` hook tracks file-level progress against active plan's "Files in Scope"
100
+ - **plan-progress-tracker** rule — matches edited files to scoped files, records milestones (25/50/75%), auto-transitions `draft → active` on first edit
101
+ - **Auto-backfill frontmatter** — plans without frontmatter get status auto-derived from checkbox progress
102
+ - **mergeSettings() fix** — `prism update` now correctly adds new matchers for existing hook commands
103
+
104
+ **v1.7.0:**
94
105
  - **Plan Lifecycle Management** — 6 states (`draft` → `active` → `completed` → `archived`, plus `blocked` and `abandoned`) with validated state machine transitions
95
106
  - **Auto-transitions** — plans auto-activate on first task check, auto-complete when all tasks done, with progress milestones (25/50/75%) logged
96
107
  - **Plan History** — `.prism/plans/.history.jsonl` records all status changes and milestones as timestamped events
@@ -119,7 +130,7 @@ Injected into `CLAUDE.md`, EUDEC is a behavioral framework that corrects how AI
119
130
  - **Verification scoping**: Build check output filtered to changed files only — pre-existing errors are ignored
120
131
  - **Agent failure recovery**: 3-step protocol when delegated agents produce incomplete results
121
132
 
122
- ### 2. Seven Focused Hooks
133
+ ### 2. Eight Focused Hooks
123
134
 
124
135
  Hooks enforce the methodology at critical points:
125
136
 
@@ -132,8 +143,9 @@ Hooks enforce the methodology at critical points:
132
143
  | **session-end-handler** | SessionEnd | Saves HANDOFF + appends to `docs/PROJECT-MEMORY.md` |
133
144
  | **scope-injector** | SubagentStart | Injects current plan batch context into subagent |
134
145
  | **plan-sync** | TaskCompleted | Auto-updates plan file checkboxes on task completion |
146
+ | **plan-progress** | PostToolUse | Tracks file-level progress against active plan's "Files in Scope" |
135
147
 
136
- The original three hooks (commit-guard, test-tracker, plan-enforcement) are deterministic enforcers. The four new hooks (v1.4.0) are **session lifecycle automations** — they don't block or warn, they auto-save context and sync plan state.
148
+ The original three hooks (commit-guard, test-tracker, plan-enforcement) are deterministic enforcers. The four v1.4.0 hooks are **session lifecycle automations** — they auto-save context and sync plan state. The v1.8.0 **plan-progress** hook bridges the gap by tracking real-time file edits against the plan.
137
149
 
138
150
  ### 3. Slash Commands
139
151
 
@@ -221,7 +233,7 @@ your-project/
221
233
  │ ├── commands/claude-prism/ # 9 slash commands
222
234
  │ ├── hooks/ # 6 runners (pre-tool, post-tool, precompact,
223
235
  │ │ # session-end, subagent-start, task-completed)
224
- │ ├── rules/ # 7 rule modules
236
+ │ ├── rules/ # 8 rule modules
225
237
  │ ├── lib/ # 9 shared dependencies
226
238
  │ └── settings.json # Hook registration (6 events)
227
239
 
@@ -245,7 +257,8 @@ Edit `.prism/config.json`:
245
257
  "precompact-handler": { "enabled": true },
246
258
  "session-end-handler": { "enabled": true },
247
259
  "subagent-scope-injector": { "enabled": true },
248
- "task-plan-sync": { "enabled": true, "matchThreshold": 0.3 }
260
+ "task-plan-sync": { "enabled": true, "matchThreshold": 0.3 },
261
+ "plan-progress-tracker": { "enabled": true }
249
262
  },
250
263
  "webhooks": [
251
264
  {
@@ -320,6 +333,18 @@ Prism auto-detects [oh-my-claudecode](https://github.com/Yeachan-Heo/oh-my-claud
320
333
 
321
334
  ## Upgrading
322
335
 
336
+ ### To v1.8.x
337
+
338
+ ```bash
339
+ npx claude-prism update
340
+ ```
341
+
342
+ v1.8.0 adds real-time plan progress tracking via `PostToolUse [Edit|Write]` hooks. The new `plan-progress-tracker` rule matches file edits against your plan's "Files in Scope" section and auto-tracks progress (25/50/75% milestones). Plans auto-transition from `draft` to `active` on the first scoped file edit.
343
+
344
+ v1.8.1 expands the ESSENCE phase with Entry Judgment (approach selection), Scope Classification, and explicit fallback phases for self-correction triggers.
345
+
346
+ `prism update` installs the new rule and adds the `Edit|Write` matcher to `settings.json` automatically. Existing hooks and configuration are preserved.
347
+
323
348
  ### To v1.7.0
324
349
 
325
350
  ```bash
package/lib/config.mjs CHANGED
@@ -7,7 +7,7 @@ import { readFileSync, existsSync } from 'fs';
7
7
  import { join, dirname } from 'path';
8
8
 
9
9
  const DEFAULTS = {
10
- rulesMode: 'full',
10
+ rulesMode: 'lean',
11
11
  sourceExtensions: ['ts', 'tsx', 'js', 'jsx', 'py', 'go', 'rs', 'java', 'c', 'cpp', 'h', 'svelte', 'vue', 'rb', 'kt', 'swift', 'php', 'cs', 'scala', 'ex', 'clj', 'zig', 'lua', 'dart'],
12
12
  testPatterns: ['test', 'spec', '_test'],
13
13
  customRules: [],
package/lib/installer.mjs CHANGED
@@ -83,6 +83,9 @@ export async function init(projectDir, options = {}) {
83
83
  // 4. Inject rules into CLAUDE.md
84
84
  injectRules(projectDir);
85
85
 
86
+ // 4b. Copy protocol reference files (on-demand EUDEC methodology)
87
+ copyProtocols(projectDir);
88
+
86
89
  // 5. Create .prism/ directory with config.json
87
90
  const prismDir = join(projectDir, '.prism');
88
91
  mkdirSync(prismDir, { recursive: true });
@@ -409,8 +412,8 @@ export async function update(projectDir) {
409
412
 
410
413
  await init(projectDir, { hooks });
411
414
 
412
- // Restore rulesMode if it was set before migration
413
- if (preservedRulesMode && preservedRulesMode !== 'full') {
415
+ // Restore rulesMode if it was explicitly set to non-default (default is now 'lean')
416
+ if (preservedRulesMode && preservedRulesMode !== 'lean') {
414
417
  const newConfig = JSON.parse(readFileSync(configPath, 'utf8'));
415
418
  newConfig.rulesMode = preservedRulesMode;
416
419
  writeFileSync(configPath, JSON.stringify(newConfig, null, 2) + '\n');
@@ -418,7 +421,7 @@ export async function update(projectDir) {
418
421
  injectRules(projectDir);
419
422
  }
420
423
 
421
- // Source repo: re-inject rules from local templates (overrides the npx version)
424
+ // Source repo: re-inject rules and protocols from local templates (overrides the npx version)
422
425
  if (sourceRepo) {
423
426
  const mode = getRulesMode(projectDir);
424
427
  const fileName = mode === 'lean' ? 'rules-lean.md' : 'rules.md';
@@ -426,6 +429,10 @@ export async function update(projectDir) {
426
429
  if (existsSync(localRulesPath)) {
427
430
  injectRules(projectDir, localRulesPath);
428
431
  }
432
+ const localProtocolsDir = join(projectDir, 'templates', 'protocols');
433
+ if (existsSync(localProtocolsDir)) {
434
+ copyProtocols(projectDir, localProtocolsDir);
435
+ }
429
436
  }
430
437
 
431
438
  return sourceRepo ? { sourceRepo: true } : undefined;
@@ -856,6 +863,19 @@ function createRegistry(projectDir) {
856
863
 
857
864
  // ─── internal helpers ───
858
865
 
866
+ function copyProtocols(projectDir, overrideDir) {
867
+ const protocolsSrcDir = overrideDir || join(TEMPLATES_DIR, 'protocols');
868
+ if (!existsSync(protocolsSrcDir)) return;
869
+
870
+ const protocolsDestDir = join(projectDir, '.claude', 'protocols', 'prism');
871
+ mkdirSync(protocolsDestDir, { recursive: true });
872
+
873
+ const protocolFiles = readdirSync(protocolsSrcDir).filter(f => f.endsWith('.md'));
874
+ for (const file of protocolFiles) {
875
+ copyFileSync(join(protocolsSrcDir, file), join(protocolsDestDir, file));
876
+ }
877
+ }
878
+
859
879
  function injectRules(projectDir, overrideRulesPath) {
860
880
  const claudeMdPath = join(projectDir, 'CLAUDE.md');
861
881
  let rulesPath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-prism",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "AI agent harness implementing the EUDEC methodology — Essence, Understand, Decompose, Execute, Checkpoint.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,46 @@
1
+ # EUDEC 5. CHECKPOINT — Confirmation Protocol
2
+
3
+ ## Quality Gate: EXECUTE → CHECKPOINT
4
+
5
+ Before reporting completion of a phase:
6
+ - [ ] All batch tasks reach terminal state (done or explicitly skipped with reason)
7
+ - [ ] Build passes with zero new errors
8
+ - [ ] No uncommitted changes left unstaged
9
+ - [ ] Plan file updated with current `[x]` status
10
+
11
+ If any gate fails → continue in EXECUTE, do not report completion.
12
+
13
+ ## 5-1. Batch Checkpoint
14
+
15
+ After each batch:
16
+ - Report what was completed
17
+ - Report verification results (with evidence)
18
+ - **Freshness check**: verify remaining plan targets still exist in codebase (quick grep)
19
+ - Update plan file: mark completed tasks `[x]`, note any targets already done
20
+ - Preview next batch
21
+ - "Continue?"
22
+
23
+ **Plan-Reality sync** (run at every checkpoint):
24
+ 1. Grep for plan's change targets (patterns, files, functions to modify)
25
+ 2. If target no longer exists → mark task as "already completed (prior work)"
26
+ 3. If new targets discovered → add to plan's "Risks / Open Questions"
27
+ 4. Update plan file's `Codebase Audit` section with fresh counts
28
+
29
+ **Checkpoint frequency** (proportional to task weight):
30
+ - **Lightweight tasks**: no checkpoint pause — report completion with evidence
31
+ - **Standard tasks**: summary checkpoint (1-2 lines: what done, verification result, next)
32
+ - **Full tasks**: full checkpoint with progress dashboard + "Continue?"
33
+ - **Phase boundary**: always stop (mandatory, all weights)
34
+ - **Blocker encountered**: always stop (mandatory, all weights)
35
+
36
+ **Progress dashboard:**
37
+ ```
38
+ Phase: [phase] | Batch: [N/M] | Tasks: [done/total] ([%])
39
+ [████████░░] 80% — Next: [next batch name]
40
+ Plan freshness: verified [date] | Remaining targets: [N] confirmed in code
41
+ ```
42
+
43
+ ## 5-2. Direction Change
44
+
45
+ User says "change direction" → return to ESSENCE (re-examine from the core)
46
+ User says "stop here" → clean exit
@@ -0,0 +1,106 @@
1
+ # EUDEC 3. DECOMPOSE — Planning Protocol
2
+
3
+ ## 3-1. Decomposition Trigger
4
+
5
+ | Task Type | Trigger | Action |
6
+ |-----------|---------|--------|
7
+ | **Bugfix** | — | Skip decomposition. Go straight to locate → fix → verify. |
8
+ | **Feature** | 3+ files affected (advisory: 2+ in tightly-coupled legacy, 5+ in well-tested modular) | Decompose into batches. Plan file if 6+ files or 3+ modules. |
9
+ | **Migration** | — | Define pattern + file list. No per-file decomposition. |
10
+ | **Refactor** | 3+ files affected (same advisory as Feature) | Decompose into batches. Plan file if 6+ files or 3+ modules. |
11
+ | **Investigation** | — | Skip decomposition. Define exploration scope. |
12
+
13
+ ## 3-2. Scope Classification (before decomposing)
14
+
15
+ Before breaking into batches, classify all changes using the concentric circle model:
16
+
17
+ ```
18
+ "Is this required for the essence to work?"
19
+ → YES → Core (must be in scope)
20
+ → NO → "Does this amplify the essence's value?"
21
+ → YES → Support (nice to have, lower priority)
22
+ → NO → Out of Scope (explicitly excluded)
23
+ ```
24
+
25
+ - Only **Core** items enter batch decomposition
26
+ - **Support** items are noted for later (not in current plan)
27
+ - **Out of Scope** must not be empty — if everything is "Core", scope classification has failed (return to ESSENCE)
28
+
29
+ ## 3-3. Decomposition Principles (Feature/Refactor only)
30
+
31
+ 1. **Independent verification**: each unit has a pass criterion
32
+ 2. **Files specified**: each task lists files to create/modify
33
+ 3. **Dependencies noted**: mark if a unit depends on a previous one
34
+ 4. **Test first**: tests come before implementation when tests exist for the area
35
+
36
+ **Size Tags:**
37
+ - **[S]** Small: <30 LOC, config/style/single-function changes
38
+ - **[M]** Medium: 30-100 LOC, feature implementation, component creation
39
+ - **[L]** Large: >100 LOC, multi-file rewrite, new module/architecture
40
+
41
+ **Batch composition**:
42
+ - Mixed: S+S+M = 1 batch, L = 1 batch alone
43
+ - **[S]-only: up to 8 per batch** (independent small changes can be batched aggressively)
44
+ - Aligns with 4-1 adaptive batch size (simple/mechanical: 5-8 per batch)
45
+
46
+ ## 3-4. Plan File Persistence
47
+
48
+ Save multi-step plans (6+ files) as markdown:
49
+ - **Path**: `.prism/plans/YYYY-MM-DD-<topic>.md`
50
+
51
+ ```markdown
52
+ ---
53
+ status: draft
54
+ created: YYYY-MM-DD
55
+ ---
56
+
57
+ ## Goal
58
+ One sentence: what we're building and why.
59
+
60
+ ## Architecture
61
+ Tech stack, key decisions, 2-3 sentences max.
62
+
63
+ ## Related Plans
64
+ - Depends on: `YYYY-MM-DD-<prior-plan>.md` (status: complete/in-progress)
65
+ - Shared files: list files that overlap with other active plans
66
+ - (Omit this section if no other plans exist)
67
+
68
+ ## Codebase Audit
69
+ - Audit date: YYYY-MM-DD
70
+ - Targets remaining: N files (verified by grep/search)
71
+ - Already completed: N items (by prior work or other branches)
72
+ - Evidence: `grep -r "pattern" --include="*.ext" | wc -l` → N
73
+
74
+ ## Files in Scope
75
+ - `path/to/file1.ts` — [what changes]
76
+ - `path/to/file2.ts` — [what changes]
77
+
78
+ ## Batch 1: [Name]
79
+ - [ ] Task 1.1: [S] [description] | Verify: [auto: build/test/lint]
80
+ - [ ] Task 1.2: [M] [description] | Verify: [auto: test] [manual: visual check]
81
+ - Prerequisite: Task 1.1
82
+
83
+ ## Risks / Open Questions
84
+ - [Known unknowns or potential blockers]
85
+ ```
86
+
87
+ ## 3-5. Pre-Decomposition Check
88
+
89
+ Before creating the plan:
90
+ - [ ] **Codebase audit**: grep/search to verify targets actually exist in code (don't trust assumptions from prior sessions)
91
+ - [ ] **Cross-plan check**: if other plans exist in `.prism/plans/`, identify overlapping files and note dependencies
92
+ - [ ] Required types/interfaces have the necessary fields?
93
+ - [ ] External package APIs behave as expected?
94
+ - [ ] Cross-package dependencies identified?
95
+
96
+ **Staleness prevention**: If plan targets (files to change, patterns to replace) no longer exist in the codebase, mark them as "already completed" before starting execution. Never start a plan without verifying its targets are real.
97
+
98
+ ## 3-6. Quality Gate: DECOMPOSE → EXECUTE
99
+
100
+ Before starting execution, all must pass:
101
+ - [ ] Plan file exists and targets verified against codebase
102
+ - [ ] Project builds from current state (no pre-existing failures)
103
+ - [ ] Dependencies resolved (lock file matches, no missing packages)
104
+ - [ ] Environment validated (required env vars, services, configs present)
105
+
106
+ If any gate fails → resolve before executing. Do not start implementation on a broken baseline.
@@ -0,0 +1,122 @@
1
+ # EUDEC 1. ESSENCE — Essence Extraction Protocol
2
+
3
+ Starting point for all work. Strip down to the core of the problem before implementation.
4
+
5
+ Essence = "the thing without which it ceases to be what it is."
6
+
7
+ ## 1-1. Entry Judgment
8
+
9
+ Before extracting essence, determine the approach:
10
+
11
+ > "Can existing elements be removed from this problem?" (Are there references, prior art, existing solutions?)
12
+
13
+ | Answer | Meaning | Path |
14
+ |--------|---------|------|
15
+ | **YES** | References, existing products, prior art exist | → Top-down (removal method) |
16
+ | **NO** | No precedent, blank slate, novel domain | → Bottom-up (competitive exploration) |
17
+ | **PARTIAL** | Some parts have references, some don't | → Hybrid (split, apply each path independently, merge in output) |
18
+
19
+ Most coding tasks are **YES** (top-down). Bottom-up is for genuinely novel problems (new product direction, undefined feature space).
20
+
21
+ ## 1-2. Essence Extraction — Top-Down (Removal Method)
22
+
23
+ The default path. Remove non-essential elements to reveal what remains.
24
+
25
+ ```
26
+ Step 1. List all components of the problem/system
27
+ Step 2. Remove one at a time, asking:
28
+ "Without this, is it still the thing?"
29
+ → YES (still the thing) → not essential, remove
30
+ → NO (no longer the thing) → essence candidate
31
+ Step 3. Validate remaining candidates:
32
+ "Do these alone justify the thing's existence?"
33
+ → YES → essence confirmed
34
+ → NO → restore one removed item, re-test
35
+ Step 4. Counterexample test:
36
+ "Can I name one scenario where this essence is wrong?"
37
+ → NO → proceed
38
+ → YES → weaken confidence, document the counterexample, and verify the essence still holds from a different angle (e.g., different user persona, edge case, or opposing assumption)
39
+ ```
40
+
41
+ **Output format:**
42
+ ```
43
+ ## ESSENCE
44
+ - Essence: [one sentence — no technology/tool names]
45
+ - Minimal case: [simplest working form]
46
+ - Expansion path: minimal → [step1] → [step2] → [complete]
47
+ ```
48
+
49
+ ## 1-3. Essence Extraction — Bottom-Up (Competitive Exploration)
50
+
51
+ For novel problems with no prior art. Generate multiple essence candidates, compete them, select the survivor.
52
+
53
+ ```
54
+ Step 1. Collect broadly (don't judge yet — quantity > quality)
55
+ Stop when: information saturates OR 3+ independent perspectives gathered OR time box hit
56
+ Step 2. Filter (two-pass):
57
+ 1st pass: gut feel — strong / moderate / weak (drop weak)
58
+ 2nd pass: score remaining on frequency (1-3), impact (1-3), connectivity (1-3)
59
+ → 7-9 points: essence candidate
60
+ → 4-6 points: support element (reuse in DECOMPOSE)
61
+ Step 3. Cluster similar candidates → select top 2-3
62
+ If only 1 candidate remains → create its opposite, compete them
63
+ Step 4. Parallel exploration: "If this were the essence, what would we build?"
64
+ → Score difference ≤2 or irreversible decision → explore all equally
65
+ → Score difference >2 and reversible → staged elimination
66
+ Step 5. Converge: which candidate solves the user's problem more directly?
67
+ Feasibility is NOT a factor here (that's DECOMPOSE's job)
68
+ ```
69
+
70
+ ## 1-4. Task Type Derivation
71
+
72
+ The task type naturally emerges from the essence:
73
+
74
+ | Essence Character | Type | Path |
75
+ |-------------------|------|------|
76
+ | "X is broken" | Bugfix | Fast Path (1-5) |
77
+ | "X should be possible" | Feature | UNDERSTAND → DECOMPOSE → EXECUTE → CHECKPOINT |
78
+ | "All X must become Y" | Migration | UNDERSTAND → pattern → batch apply → verify |
79
+ | "X's structure must change" | Refactor | UNDERSTAND → DECOMPOSE → EXECUTE → CHECKPOINT |
80
+ | "Why does X happen?" | Investigation | explore → analyze → report |
81
+
82
+ **Migration shortcut**: When applying the same transformation to 10+ files, don't decompose into individual file tasks. Define the pattern once, apply in batches of 5-10, verify after each batch. Scope guard thresholds are raised automatically when a plan file exists.
83
+
84
+ ## 1-5. Essence Validation (Error Prevention)
85
+
86
+ | Trap | Response |
87
+ |------|----------|
88
+ | Mistaking symptom for essence | "Is this the cause, or a consequence?" |
89
+ | Mistaking solution for essence | "Add caching" is not the essence. "Eliminate redundant computation" is. |
90
+ | Too abstract | "Can I write even one line of code from this?" |
91
+ | Too specific | "What's the real problem one level up?" |
92
+
93
+ **Core test**: If the essence statement contains specific technology/tool names → it's still at solution level, not essence. Go one level higher.
94
+
95
+ ## 1-6. Adaptive Weight (Task Size Routing)
96
+
97
+ After extracting essence and task type, assess task weight to select the appropriate EUDEC path:
98
+
99
+ | Weight | Criteria | Path |
100
+ |--------|----------|------|
101
+ | **Lightweight** | 1-2 files, <50 LOC, clear scope | Essence (1 line) → Execute → Verify → Done |
102
+ | **Standard** | 3-5 files, 50-200 LOC | Full EUDEC, summary checkpoints |
103
+ | **Full** | 6+ files, 200+ LOC, or unclear scope | Full EUDEC with plan file + full checkpoints |
104
+
105
+ **Lightweight path** skips formal UNDERSTAND (sufficiency assessment, question rounds, alignment confirmation) and DECOMPOSE. The essence statement still grounds the work but takes one line, not a full section. Record: append 1-line summary to `docs/PROJECT-MEMORY.md` (what was changed and why).
106
+
107
+ **Bugfix fast path** (regardless of file count):
108
+ 1. Reproduce the symptom
109
+ 2. Trace to root cause
110
+ 3. Minimal fix (smallest change that resolves the cause)
111
+ 4. Verify (test/build/diff)
112
+
113
+ Bugfixes skip ESSENCE extraction, UNDERSTAND ceremony, and DECOMPOSE entirely. The 4-step debugging protocol (4-3) is the complete path.
114
+
115
+ ## 1-7. Quality Gate: ESSENCE → UNDERSTAND
116
+
117
+ Before moving to UNDERSTAND, verify:
118
+ - [ ] Essence statement is technology-neutral (holds without naming specific tools/libraries)
119
+ - [ ] Minimal case is truly "minimal" (can it be reduced further?)
120
+ - [ ] Each step in the expansion path works independently
121
+ - [ ] Task type has been clearly derived
122
+ - [ ] Counterexample test passed (no unresolved counterexamples)
@@ -0,0 +1,125 @@
1
+ # EUDEC 4. EXECUTE — Execution Protocol
2
+
3
+ ## 4-1. Batch Execution
4
+
5
+ 1. **Adaptive batch size**:
6
+ - Simple/mechanical changes (imports, types, config, migration): 5-8 per batch
7
+ - Standard changes (feature add/modify): 3-4 per batch
8
+ - Complex changes (new module, architecture): 1-2 per batch
9
+ 2. **Git-as-Memory**: commit after each completed batch as a rollback point. Use `git diff` summaries to maintain context in long sessions.
10
+ 3. **Checkpoint**: report results after each batch + wait for user feedback
11
+ 4. **Report content**: what was done / verification results / next batch preview
12
+ 5. **On blockers**: stop immediately and report (do not guess)
13
+
14
+ ## 4-2. Verification Strategy (Risk-Based)
15
+
16
+ Choose verification proportional to the **risk of the change**, not the file path:
17
+
18
+ | Risk Level | When | Auto Verification | Manual (recommend only) |
19
+ |------------|------|-------------------|----------------------|
20
+ | **High** | Business logic, data mutation, auth, state machines, calculations | TDD: failing test → implement → pass | — |
21
+ | **Medium** | New components with logic, API integration, config that affects behavior | Build + lint pass | Visual/runtime spot-check |
22
+ | **Low** | Imports, types, style/layout, renaming, mechanical migration | Build/lint passes | — |
23
+ | **No test infra** | No test framework, no CI/CD, manual deploy (legacy PHP, WordPress, etc.) | Grep-based static check + syntax validation | Browser/manual verification |
24
+
25
+ **Auto vs Manual separation:**
26
+ - **Auto** (required): build, test, lint — must pass before claiming completion
27
+ - **Manual** (recommended, not required): visual checks, browser testing, UX review — note as "manual check recommended" in plan, don't list as a gate
28
+
29
+ **Verifiability modifier**: Some changes are hard to verify automatically (UI layout, business rule nuances, security boundaries). For hard-to-verify + high-risk changes, require **human approval before commit** regardless of test results.
30
+
31
+ **Verification Fallback Ladder** (use highest available level):
32
+
33
+ | Level | Method | When |
34
+ |-------|--------|------|
35
+ | 1. Tests | Automated tests (unit, integration, e2e) | Test infrastructure exists |
36
+ | 2. Build | Compiles + lint without new errors | No tests for this area |
37
+ | 3. Diff | `git diff` reviewed for regressions | No build tooling |
38
+
39
+ **Every change must have SOME verification.** If no tooling exists, `git diff` review is the minimum.
40
+
41
+ **Verification scoping**: When running build checks (tsc, lint, etc.), filter output to only changed files. Pre-existing errors in other files are not your concern. Example: `tsc --noEmit 2>&1 | grep -i "<changed-file>"`
42
+
43
+ **Core Rules:**
44
+ 1. Never claim completion without fresh **auto** verification evidence
45
+ 2. Never commit code that doesn't build
46
+ 3. For high-risk: write failing test first → minimal code to pass → verify
47
+ 4. For high-risk: write at least one **negative test** (what should this code NOT do? what input should it reject?)
48
+ 5. For medium/low: run build/lint after changes → confirm no regressions
49
+ 6. Never list manual verification as a pass criterion — it won't be enforced consistently
50
+
51
+ ## 4-3. Systematic Debugging (Bugfix path)
52
+
53
+ | Step | Action | Output |
54
+ |------|--------|--------|
55
+ | 1. Root cause | Read error → reproduce → check recent changes → trace data flow | Hypothesis |
56
+ | 2. Pattern analysis | Find working similar code → compare differences | Diff list |
57
+ | 3. Hypothesis test | Single hypothesis → minimal change → test one at a time | Result |
58
+ | 4. Fix | Write failing test → single fix → verify | Fix complete |
59
+
60
+ **After 3 failed fixes: STOP. The problem is likely architectural, not local. Discuss with user.**
61
+
62
+ ## 4-4. Self-Correction Triggers
63
+
64
+ - Same file edited 3+ times → "Possible thrashing. Investigate root cause." → **Fallback: UNDERSTAND (re-examine the problem)**
65
+ - Editing file not in plan → "Scope change needed?" → **Fallback: DECOMPOSE (re-classify scope)**
66
+ - 3 consecutive test failures → "Approach problem." → **Fallback: ESSENCE (was the essence wrong?)**
67
+ - New package needed → "Confirm with user"
68
+ - 5 turns autonomous → "Report progress before continuing"
69
+ - Adding workarounds to fix workarounds → "Design problem." → **Fallback: ESSENCE (re-extract)**
70
+ - Copy-pasting similar code 3+ times → "Need abstraction? Ask user."
71
+ - Dependency version mismatch detected → "Resolve before continuing."
72
+ - Plan file checkboxes not updated after batch → "Update plan checkboxes and frontmatter before continuing"
73
+ - Scope expanding beyond plan → "Scope creep." → **Fallback: DECOMPOSE (re-run scope classification)**
74
+ - Error messages changing type across fixes → "Chasing symptoms, not root cause." → **Fallback: ESSENCE**
75
+
76
+ **Goal Recitation** (prevents drift in long sessions):
77
+ - At every batch boundary, re-read the plan file and confirm: "Current work aligns with: [original goal]"
78
+ - If current work does not serve the original goal → STOP, report drift, return to plan
79
+
80
+ **Thrashing Detector** (beyond simple edit counting):
81
+ - Successive edits reverting previous changes (oscillation) → "Reverting own work. Wrong approach." → **Fallback: ESSENCE**
82
+
83
+ ## 4-5. Scope Guard
84
+
85
+ **Only change what was requested. Nothing more, nothing less.**
86
+
87
+ 1. **Was this change explicitly requested?** → proceed
88
+ 2. **Is it required to make the requested change work?** → proceed
89
+ 3. **Is it an improvement I noticed while working?** → STOP. Note it, don't do it.
90
+ 4. **Is it "while I'm here" cleanup?** → STOP. Not your job right now.
91
+
92
+ **If tempted:** Note it for the user. Ask: "I noticed X could be improved. Want me to address it after the current task?"
93
+
94
+ ## 4-6. Agent Delegation Verification
95
+
96
+ When delegating work to sub-agents:
97
+
98
+ 1. **Clear instructions**: specify inputs, expected outputs, invariants, and pass criteria
99
+ 2. **Resource ownership**: each file/module has exactly one agent writing at a time — define non-overlapping scopes upfront
100
+ 3. **Read actual files** after agent completes — never trust the agent's report alone
101
+ 4. **Run build/test** to verify the agent's changes work
102
+ 5. **Fix or retry** if incomplete
103
+
104
+ **Agent failure recovery**: If a delegated agent partially fails or produces incomplete results:
105
+ 1. Verify actual file state (read the file, not just the agent's report)
106
+ 2. If partially correct → complete the remaining work directly
107
+ 3. If fully wrong → retry with clearer instructions or execute directly
108
+
109
+ **Never mark a delegated task as complete without reading the actual file state.**
110
+
111
+ ## 4-7. Project-Type Verification Examples
112
+
113
+ | Project Type | Syntax Check | Smoke Test | Approval Test |
114
+ |-------------|-------------|------------|---------------|
115
+ | **PHP/WordPress** | `php -l file.php` | `curl` key pages, `wp-cli` commands | Capture page output before/after, diff |
116
+ | **Static Sites** | Build completes | Link checker, visual diff of HTML | Compare output directory before/after |
117
+ | **Scripts/CLI** | Language syntax check | Run with known inputs, compare outputs | Capture stdout before/after |
118
+ | **Infra/Config** | `terraform plan`, `docker build` | Dry-run deploy | Compare plan output before/after |
119
+
120
+ ## 4-8. Checkpoint Integration
121
+
122
+ Claude Code creates automatic checkpoints on every edit. Use `Esc+Esc` or `/rewind` to restore.
123
+ - Before risky changes: checkpoint exists automatically
124
+ - After failed batch: consider `/rewind` to restore clean state before retry
125
+ - Checkpoints complement Git-as-Memory: git for cross-session, checkpoints for intra-session
@@ -0,0 +1,63 @@
1
+ # EUDEC 6. HANDOFF — Session Transition Protocol
2
+
3
+ ## 6-1. When to Handoff
4
+
5
+ - Context window approaching limit (compaction warnings appearing)
6
+ - Task is multi-session by nature (multi-day refactor, large migration)
7
+ - Switching to a different task mid-session
8
+
9
+ **Auto-triggers (via Prism hooks):**
10
+ - PreCompact hook → auto-generates `docs/HANDOFF.md`
11
+ - SessionEnd hook → auto-generates `docs/HANDOFF.md` + appends to `docs/PROJECT-MEMORY.md`
12
+
13
+ ## 6-2. Handoff Document
14
+
15
+ Create `docs/HANDOFF.md` with:
16
+
17
+ ```markdown
18
+ ## Status
19
+ [What's done, what's remaining]
20
+
21
+ ## Current State
22
+ [Branch name, last commit, any uncommitted changes]
23
+
24
+ ## Next Steps
25
+ [Exact next action to take, with file paths]
26
+
27
+ ## Decisions Made
28
+ [Key choices and why, so they don't get re-debated]
29
+
30
+ ## Known Issues
31
+ [Anything broken or incomplete]
32
+ ```
33
+
34
+ ## 6-3. Project Memory (persistent across all sessions)
35
+
36
+ Maintain `docs/PROJECT-MEMORY.md` — cumulative knowledge that survives session transitions:
37
+
38
+ ```markdown
39
+ ## Architectural Decisions
40
+ - [date] [decision] — [rationale]
41
+
42
+ ## Conventions
43
+ - [naming, patterns, file structure rules discovered/established]
44
+
45
+ ## Environment Gotchas
46
+ - [quirks, workarounds, version constraints and why]
47
+
48
+ ## Package Constraints
49
+ - [package@version — why pinned, what breaks if upgraded]
50
+ ```
51
+
52
+ **Rules:**
53
+ - HANDOFF.md is session-scoped (overwritten each session transition)
54
+ - PROJECT-MEMORY.md is permanent (append-only, never overwrite)
55
+ - On session start: read PROJECT-MEMORY.md first, then HANDOFF.md if it exists
56
+
57
+ ## 6-4. Resuming from Handoff
58
+
59
+ When a session starts:
60
+ 1. Read `docs/PROJECT-MEMORY.md` if it exists (persistent context)
61
+ 2. Read `docs/HANDOFF.md` if it exists (session context)
62
+ 3. Verify the described state matches reality (git status, file contents)
63
+ 4. Continue from "Next Steps"
@@ -0,0 +1,56 @@
1
+ # EUDEC 2. UNDERSTAND — Understanding Protocol
2
+
3
+ ## 2-1. Information Sufficiency Assessment (MANDATORY)
4
+
5
+ Before acting on any request, assess first:
6
+
7
+ - **[Sufficient]** Specific file, function, symptom mentioned → skip to PLAN/DECOMPOSE
8
+ - **[Partial]** Direction clear but details missing → explore code, then ask 1-2 questions
9
+ - **[Insufficient]** Abstract, vague, multiple interpretations → must ask questions first
10
+
11
+ ## 2-2. Question Rules
12
+
13
+ 1. **One question at a time** — never ask multiple questions simultaneously
14
+ 2. **Multiple choice first** — 2-3 options with a recommendation
15
+ 3. **Include reasoning** — explore code first, then ask context-aware questions
16
+ 4. **Maximum 3 rounds** — Round 1: direction (what) / Round 2: constraints (how) / Round 3: scope
17
+ 5. **Explore first** — check package.json, existing structure before asking
18
+
19
+ ## 2-3. Environment Validation
20
+
21
+ Before any implementation, verify:
22
+ - Project builds from current state (no pre-existing failures)
23
+ - Declared dependencies match lock file versions
24
+ - Environment-specific config identified (env vars, local services, deploy targets)
25
+
26
+ If any of these fail → resolve first. Do not implement on a broken baseline.
27
+
28
+ ## 2-4. Alignment Confirmation
29
+
30
+ Before moving to DECOMPOSE:
31
+ - Goal summarized in one sentence
32
+ - Tech stack/approach agreed
33
+ - MVP scope defined
34
+ - User confirmed "proceed"
35
+
36
+ ## 2-5. Assumption Detection (Red Flag Checklist)
37
+
38
+ **If you think you understand fully on first read, you probably don't.**
39
+
40
+ | Red Flag | Question to Ask Yourself |
41
+ |----------|------------------------|
42
+ | "Obviously they want X" | Did they actually say X? Or am I inferring? |
43
+ | "This is similar to Y" | What are the differences? Similar ≠ identical |
44
+ | "The standard approach is..." | Is that what the user wants, or what I default to? |
45
+ | "I know how this codebase works" | When did I last verify? Has it changed? |
46
+ | "This is a simple fix" | Have I read the surrounding code? What might break? |
47
+ | "They didn't mention Z, so it's not needed" | Or did they assume Z was obvious? |
48
+
49
+ **Triggers:**
50
+ - User request < 2 sentences → likely missing context. Explore first.
51
+ - No file/function names mentioned → [Insufficient]. Must ask.
52
+ - Words like "just", "simply", "quickly" → complexity is being underestimated.
53
+
54
+ ## 2-6. Analysis-Only Requests
55
+
56
+ If no code change is needed (architecture review, cause analysis, investigation), report findings and ask: "Further action needed?" Do NOT proceed to DECOMPOSE/EXECUTE/CHECKPOINT unless the user requests implementation.
@@ -12,13 +12,24 @@ On session start, read in order:
12
12
  After reading, verify described state matches reality (git status, file contents).
13
13
  <!-- PRISM:BOOT:END -->
14
14
 
15
- # Prism — EUDEC Methodology (Lean Mode)
15
+ # Prism — EUDEC Methodology Framework
16
16
 
17
17
  **EUDEC = Essence, Understand, Decompose, Execute, Checkpoint** — the core cycle.
18
18
 
19
19
  > **Never implement what you haven't understood. Never understand what you haven't distilled to its essence.**
20
20
 
21
- For the full methodology, run `/claude-prism:prism`.
21
+ ## Protocol Reference (Read on demand)
22
+
23
+ When entering an EUDEC phase, read the corresponding protocol file:
24
+
25
+ | Phase | When to Read | File |
26
+ |-------|-------------|------|
27
+ | **Essence** | New feature, refactor, or unclear task | `.claude/protocols/prism/essence.md` |
28
+ | **Understand** | Need to clarify requirements or assumptions | `.claude/protocols/prism/understand.md` |
29
+ | **Decompose** | 3+ files affected, need batch plan | `.claude/protocols/prism/decompose.md` |
30
+ | **Execute** | During implementation (batch execution, verification) | `.claude/protocols/prism/execute.md` |
31
+ | **Checkpoint** | Reporting batch/phase completion | `.claude/protocols/prism/checkpoint.md` |
32
+ | **Handoff** | Session ending, context limit, or task transition | `.claude/protocols/prism/handoff.md` |
22
33
 
23
34
  ---
24
35
 
@@ -27,17 +38,24 @@ For the full methodology, run `/claude-prism:prism`.
27
38
  | Weight | Criteria | Path |
28
39
  |--------|----------|------|
29
40
  | **Lightweight** | 1-2 files, <50 LOC, clear scope | Essence (1 line) → Execute → Verify → Record (1-line to `docs/PROJECT-MEMORY.md`) → Done |
30
- | **Standard** | 3-5 files, 50-200 LOC | Run `/claude-prism:prism` for full EUDEC guidance |
31
- | **Full** | 6+ files, 200+ LOC, or unclear scope | Run `/claude-prism:prism` for full EUDEC with plan file |
41
+ | **Standard** | 3-5 files, 50-200 LOC | Full EUDEC (read protocols as needed) |
42
+ | **Full** | 6+ files, 200+ LOC, or unclear scope | Full EUDEC with plan file + full checkpoints |
43
+
44
+ ## Entry Judgment
45
+
46
+ Before extracting essence: "Can existing elements be removed from this problem?"
47
+ - **YES** (prior art exists) → Top-down: list components, remove one at a time, what remains is essence
48
+ - **NO** (blank slate) → Bottom-up: collect broadly, score, compete 2-3 candidates, select survivor
49
+ - **PARTIAL** → Split the problem, apply each path to its part
32
50
 
33
51
  ## Task Type Derivation
34
52
 
35
53
  | Essence Character | Type | Path |
36
54
  |-------------------|------|------|
37
55
  | "X is broken" | Bugfix | Fast Path (below) |
38
- | "X should be possible" | Feature | `/claude-prism:prism` |
56
+ | "X should be possible" | Feature | Read `essence.md` → full EUDEC |
39
57
  | "All X must become Y" | Migration | Pattern → batch apply → verify |
40
- | "X's structure must change" | Refactor | `/claude-prism:prism` |
58
+ | "X's structure must change" | Refactor | Read `essence.md` → full EUDEC |
41
59
 
42
60
  ## Bugfix Fast Path
43
61
 
@@ -69,11 +87,12 @@ After 3 failed fixes: STOP. Discuss with user.
69
87
 
70
88
  ## Self-Correction Triggers
71
89
 
72
- - Same file edited 3+ times → investigate root cause
73
- - Editing file not in plan → scope change needed?
74
- - 3 consecutive test failures → back to essence
90
+ - Same file edited 3+ times → investigate root cause → **Fallback: UNDERSTAND**
91
+ - Editing file not in plan → scope change needed? → **Fallback: DECOMPOSE**
92
+ - 3 consecutive test failures → **Fallback: ESSENCE (was the essence wrong?)**
75
93
  - 5 turns autonomous → report progress before continuing
76
- - Adding workarounds to fix workarounds → design problem, step back
94
+ - Adding workarounds to fix workarounds → **Fallback: ESSENCE (re-extract)**
95
+ - Scope expanding beyond plan → **Fallback: DECOMPOSE (re-classify scope)**
77
96
 
78
97
  ## Rationalization Defense
79
98
 
@@ -87,14 +106,14 @@ After 3 failed fixes: STOP. Discuss with user.
87
106
  ## Checkpoint Frequency
88
107
 
89
108
  - **Lightweight**: report completion with evidence, no pause
90
- - **Standard/Full**: run `/claude-prism:prism` for guided checkpoints
109
+ - **Standard/Full**: read `.claude/protocols/prism/checkpoint.md` for guided checkpoints
91
110
  - **Blocker encountered**: always stop
92
111
 
93
112
  ## Session Handoff
94
113
 
95
114
  Prism hooks auto-generate `docs/HANDOFF.md` on compaction and session end.
96
115
  `docs/PROJECT-MEMORY.md` is auto-appended on session end.
97
- For manual handoff: Status, Current State, Next Steps, Decisions Made, Known Issues.
116
+ For manual handoff: read `.claude/protocols/prism/handoff.md`.
98
117
 
99
118
  ## Completion Declaration
100
119
 
@@ -29,13 +29,41 @@ The approach: **Essence → Simplify → Expand**. Strip down to the core of the
29
29
 
30
30
  Starting point for all work. Strip down to the core of the problem before implementation.
31
31
 
32
- ### 1-1. Essence Extraction (3 Steps)
32
+ Essence = "the thing without which it ceases to be what it is."
33
33
 
34
- | Step | Question | Output |
35
- |------|----------|--------|
36
- | **Extract** | "What do they actually want?" | Essence statement (1 sentence) |
37
- | **Simplify** | "What's the smallest working version?" | Minimal case |
38
- | **Expansion path** | "How do we grow from here?" | Expansion steps (2-4 steps) |
34
+ ### 1-1. Entry Judgment
35
+
36
+ Before extracting essence, determine the approach:
37
+
38
+ > "Can existing elements be removed from this problem?" (Are there references, prior art, existing solutions?)
39
+
40
+ | Answer | Meaning | Path |
41
+ |--------|---------|------|
42
+ | **YES** | References, existing products, prior art exist | → Top-down (removal method) |
43
+ | **NO** | No precedent, blank slate, novel domain | → Bottom-up (competitive exploration) |
44
+ | **PARTIAL** | Some parts have references, some don't | → Hybrid (split, apply each path independently, merge in output) |
45
+
46
+ Most coding tasks are **YES** (top-down). Bottom-up is for genuinely novel problems (new product direction, undefined feature space).
47
+
48
+ ### 1-2. Essence Extraction — Top-Down (Removal Method)
49
+
50
+ The default path. Remove non-essential elements to reveal what remains.
51
+
52
+ ```
53
+ Step 1. List all components of the problem/system
54
+ Step 2. Remove one at a time, asking:
55
+ "Without this, is it still the thing?"
56
+ → YES (still the thing) → not essential, remove
57
+ → NO (no longer the thing) → essence candidate
58
+ Step 3. Validate remaining candidates:
59
+ "Do these alone justify the thing's existence?"
60
+ → YES → essence confirmed
61
+ → NO → restore one removed item, re-test
62
+ Step 4. Counterexample test:
63
+ "Can I name one scenario where this essence is wrong?"
64
+ → NO → proceed
65
+ → YES → weaken confidence, document the counterexample, and verify the essence still holds from a different angle (e.g., different user persona, edge case, or opposing assumption)
66
+ ```
39
67
 
40
68
  **Output format:**
41
69
  ```
@@ -45,7 +73,28 @@ Starting point for all work. Strip down to the core of the problem before implem
45
73
  - Expansion path: minimal → [step1] → [step2] → [complete]
46
74
  ```
47
75
 
48
- ### 1-2. Task Type Derivation
76
+ ### 1-3. Essence Extraction — Bottom-Up (Competitive Exploration)
77
+
78
+ For novel problems with no prior art. Generate multiple essence candidates, compete them, select the survivor.
79
+
80
+ ```
81
+ Step 1. Collect broadly (don't judge yet — quantity > quality)
82
+ Stop when: information saturates OR 3+ independent perspectives gathered OR time box hit
83
+ Step 2. Filter (two-pass):
84
+ 1st pass: gut feel — strong / moderate / weak (drop weak)
85
+ 2nd pass: score remaining on frequency (1-3), impact (1-3), connectivity (1-3)
86
+ → 7-9 points: essence candidate
87
+ → 4-6 points: support element (reuse in DECOMPOSE)
88
+ Step 3. Cluster similar candidates → select top 2-3
89
+ If only 1 candidate remains → create its opposite, compete them
90
+ Step 4. Parallel exploration: "If this were the essence, what would we build?"
91
+ → Score difference ≤2 or irreversible decision → explore all equally
92
+ → Score difference >2 and reversible → staged elimination
93
+ Step 5. Converge: which candidate solves the user's problem more directly?
94
+ Feasibility is NOT a factor here (that's DECOMPOSE's job)
95
+ ```
96
+
97
+ ### 1-4. Task Type Derivation
49
98
 
50
99
  The task type naturally emerges from the essence:
51
100
 
@@ -59,7 +108,7 @@ The task type naturally emerges from the essence:
59
108
 
60
109
  **Migration shortcut**: When applying the same transformation to 10+ files, don't decompose into individual file tasks. Define the pattern once, apply in batches of 5-10, verify after each batch. Scope guard thresholds are raised automatically when a plan file exists.
61
110
 
62
- ### 1-3. Essence Validation (Error Prevention)
111
+ ### 1-5. Essence Validation (Error Prevention)
63
112
 
64
113
  | Trap | Response |
65
114
  |------|----------|
@@ -70,15 +119,7 @@ The task type naturally emerges from the essence:
70
119
 
71
120
  **Core test**: If the essence statement contains specific technology/tool names → it's still at solution level, not essence. Go one level higher.
72
121
 
73
- ### 1-4. Quality Gate: ESSENCE UNDERSTAND
74
-
75
- Before moving to UNDERSTAND, verify:
76
- - [ ] Essence statement is technology-neutral (holds without naming specific tools/libraries)
77
- - [ ] Minimal case is truly "minimal" (can it be reduced further?)
78
- - [ ] Each step in the expansion path works independently
79
- - [ ] Task type has been clearly derived
80
-
81
- ### 1-5. Adaptive Weight (Task Size Routing)
122
+ ### 1-6. Adaptive Weight (Task Size Routing)
82
123
 
83
124
  After extracting essence and task type, assess task weight to select the appropriate EUDEC path:
84
125
 
@@ -98,6 +139,15 @@ After extracting essence and task type, assess task weight to select the appropr
98
139
 
99
140
  Bugfixes skip ESSENCE extraction, UNDERSTAND ceremony, and DECOMPOSE entirely. The 4-step debugging protocol (4-3) is the complete path.
100
141
 
142
+ ### 1-7. Quality Gate: ESSENCE → UNDERSTAND
143
+
144
+ Before moving to UNDERSTAND, verify:
145
+ - [ ] Essence statement is technology-neutral (holds without naming specific tools/libraries)
146
+ - [ ] Minimal case is truly "minimal" (can it be reduced further?)
147
+ - [ ] Each step in the expansion path works independently
148
+ - [ ] Task type has been clearly derived
149
+ - [ ] Counterexample test passed (no unresolved counterexamples)
150
+
101
151
  ---
102
152
 
103
153
  ## EUDEC 2. UNDERSTAND — Understanding Protocol
@@ -171,7 +221,23 @@ If no code change is needed (architecture review, cause analysis, investigation)
171
221
  | **Refactor** | 3+ files affected (same advisory as Feature) | Decompose into batches. Plan file if 6+ files or 3+ modules. |
172
222
  | **Investigation** | — | Skip decomposition. Define exploration scope. |
173
223
 
174
- ### 3-2. Decomposition Principles (Feature/Refactor only)
224
+ ### 3-2. Scope Classification (before decomposing)
225
+
226
+ Before breaking into batches, classify all changes using the concentric circle model:
227
+
228
+ ```
229
+ "Is this required for the essence to work?"
230
+ → YES → Core (must be in scope)
231
+ → NO → "Does this amplify the essence's value?"
232
+ → YES → Support (nice to have, lower priority)
233
+ → NO → Out of Scope (explicitly excluded)
234
+ ```
235
+
236
+ - Only **Core** items enter batch decomposition
237
+ - **Support** items are noted for later (not in current plan)
238
+ - **Out of Scope** must not be empty — if everything is "Core", scope classification has failed (return to ESSENCE)
239
+
240
+ ### 3-3. Decomposition Principles (Feature/Refactor only)
175
241
 
176
242
  1. **Independent verification**: each unit has a pass criterion
177
243
  2. **Files specified**: each task lists files to create/modify
@@ -188,7 +254,7 @@ If no code change is needed (architecture review, cause analysis, investigation)
188
254
  - **[S]-only: up to 8 per batch** (independent small changes can be batched aggressively)
189
255
  - Aligns with 4-1 adaptive batch size (simple/mechanical: 5-8 per batch)
190
256
 
191
- ### 3-3. Plan File Persistence
257
+ ### 3-4. Plan File Persistence
192
258
 
193
259
  Save multi-step plans (6+ files) as markdown:
194
260
  - **Path**: `.prism/plans/YYYY-MM-DD-<topic>.md`
@@ -229,7 +295,7 @@ Tech stack, key decisions, 2-3 sentences max.
229
295
  - [Known unknowns or potential blockers]
230
296
  ```
231
297
 
232
- ### 3-4. Pre-Decomposition Check
298
+ ### 3-5. Pre-Decomposition Check
233
299
 
234
300
  Before creating the plan:
235
301
  - [ ] **Codebase audit**: grep/search to verify targets actually exist in code (don't trust assumptions from prior sessions)
@@ -240,7 +306,7 @@ Before creating the plan:
240
306
 
241
307
  **Staleness prevention**: If plan targets (files to change, patterns to replace) no longer exist in the codebase, mark them as "already completed" before starting execution. Never start a plan without verifying its targets are real.
242
308
 
243
- ### 3-5. Quality Gate: DECOMPOSE → EXECUTE
309
+ ### 3-6. Quality Gate: DECOMPOSE → EXECUTE
244
310
 
245
311
  Before starting execution, all must pass:
246
312
  - [ ] Plan file exists and targets verified against codebase
@@ -315,24 +381,24 @@ Choose verification proportional to the **risk of the change**, not the file pat
315
381
 
316
382
  ### 4-4. Self-Correction Triggers
317
383
 
318
- - Same file edited 3+ times → "Possible thrashing. Investigate root cause."
319
- - Editing file not in plan → "Scope change needed?"
320
- - 3 consecutive test failures → "Approach problem. Back to ESSENCE did we get the essence wrong?"
384
+ - Same file edited 3+ times → "Possible thrashing. Investigate root cause." → **Fallback: UNDERSTAND (re-examine the problem)**
385
+ - Editing file not in plan → "Scope change needed?" → **Fallback: DECOMPOSE (re-classify scope)**
386
+ - 3 consecutive test failures → "Approach problem." **Fallback: ESSENCE (was the essence wrong?)**
321
387
  - New package needed → "Confirm with user"
322
388
  - 5 turns autonomous → "Report progress before continuing"
323
- - Adding workarounds to fix workarounds → "Design problem. Step back."
389
+ - Adding workarounds to fix workarounds → "Design problem." **Fallback: ESSENCE (re-extract)**
324
390
  - Copy-pasting similar code 3+ times → "Need abstraction? Ask user."
325
391
  - Dependency version mismatch detected → "Resolve before continuing."
326
392
  - Plan file checkboxes not updated after batch → "Update plan checkboxes and frontmatter before continuing"
393
+ - Scope expanding beyond plan → "Scope creep." → **Fallback: DECOMPOSE (re-run scope classification)**
394
+ - Error messages changing type across fixes → "Chasing symptoms, not root cause." → **Fallback: ESSENCE**
327
395
 
328
396
  **Goal Recitation** (prevents drift in long sessions):
329
397
  - At every batch boundary, re-read the plan file and confirm: "Current work aligns with: [original goal]"
330
398
  - If current work does not serve the original goal → STOP, report drift, return to plan
331
399
 
332
400
  **Thrashing Detector** (beyond simple edit counting):
333
- - Successive edits reverting previous changes (oscillation) → "Reverting own work. Wrong approach."
334
- - Scope of changes expanding beyond plan → "Scope creep. Return to DECOMPOSE."
335
- - Error messages changing type across fixes → "Chasing symptoms, not root cause. Back to ESSENCE."
401
+ - Successive edits reverting previous changes (oscillation) → "Reverting own work. Wrong approach." → **Fallback: ESSENCE**
336
402
 
337
403
  ### 4-5. Scope Guard
338
404