claude-prism 1.2.7 → 1.4.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.
@@ -0,0 +1,82 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "Bash",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "node ${CLAUDE_PLUGIN_ROOT}/scripts/pre-tool.mjs",
10
+ "timeout": 5000
11
+ }
12
+ ]
13
+ },
14
+ {
15
+ "matcher": "Edit|Write",
16
+ "hooks": [
17
+ {
18
+ "type": "command",
19
+ "command": "node ${CLAUDE_PLUGIN_ROOT}/scripts/pre-tool.mjs",
20
+ "timeout": 5000
21
+ }
22
+ ]
23
+ }
24
+ ],
25
+ "PostToolUse": [
26
+ {
27
+ "matcher": "Bash",
28
+ "hooks": [
29
+ {
30
+ "type": "command",
31
+ "command": "node ${CLAUDE_PLUGIN_ROOT}/scripts/post-tool.mjs",
32
+ "timeout": 5000
33
+ }
34
+ ]
35
+ }
36
+ ],
37
+ "PreCompact": [
38
+ {
39
+ "hooks": [
40
+ {
41
+ "type": "command",
42
+ "command": "node ${CLAUDE_PLUGIN_ROOT}/scripts/precompact.mjs",
43
+ "timeout": 10000
44
+ }
45
+ ]
46
+ }
47
+ ],
48
+ "SessionEnd": [
49
+ {
50
+ "hooks": [
51
+ {
52
+ "type": "command",
53
+ "command": "node ${CLAUDE_PLUGIN_ROOT}/scripts/session-end.mjs",
54
+ "timeout": 10000
55
+ }
56
+ ]
57
+ }
58
+ ],
59
+ "SubagentStart": [
60
+ {
61
+ "hooks": [
62
+ {
63
+ "type": "command",
64
+ "command": "node ${CLAUDE_PLUGIN_ROOT}/scripts/subagent-start.mjs",
65
+ "timeout": 5000
66
+ }
67
+ ]
68
+ }
69
+ ],
70
+ "TaskCompleted": [
71
+ {
72
+ "hooks": [
73
+ {
74
+ "type": "command",
75
+ "command": "node ${CLAUDE_PLUGIN_ROOT}/scripts/task-completed.mjs",
76
+ "timeout": 5000
77
+ }
78
+ ]
79
+ }
80
+ ]
81
+ }
82
+ }
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { runPipelineAsync } from '../lib/pipeline.mjs';
3
+ import { testTracker } from '../hooks/test-tracker.mjs';
4
+
5
+ await runPipelineAsync([
6
+ { name: 'test-tracker', rule: testTracker },
7
+ ], 'PostToolUse');
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import { runPipelineAsync } from '../lib/pipeline.mjs';
3
+ import { commitGuard } from '../hooks/commit-guard.mjs';
4
+ import { planEnforcement } from '../hooks/plan-enforcement.mjs';
5
+
6
+ await runPipelineAsync([
7
+ { name: 'commit-guard', rule: commitGuard },
8
+ { name: 'plan-enforcement', rule: planEnforcement },
9
+ ], 'PreToolUse');
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Plugin-mode runner for PreCompact event
4
+ * Generates HANDOFF.md before context compaction
5
+ */
6
+ import { readFileSync } from 'fs';
7
+ import { precompactHandler } from '../hooks/precompact-handler.mjs';
8
+ import { loadConfig } from '../lib/config.mjs';
9
+
10
+ try {
11
+ const input = JSON.parse(readFileSync(0, 'utf8'));
12
+ const config = loadConfig(process.cwd());
13
+ const result = precompactHandler.evaluate(input, config);
14
+ if (result) {
15
+ process.stdout.write(JSON.stringify(result));
16
+ }
17
+ } catch (e) {
18
+ // Silent fail — hooks should never break the session
19
+ process.exit(0);
20
+ }
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Plugin-mode runner for SessionEnd event
4
+ * Saves HANDOFF.md and appends to PROJECT-MEMORY.md
5
+ */
6
+ import { readFileSync } from 'fs';
7
+ import { sessionEndHandler } from '../hooks/session-end-handler.mjs';
8
+ import { loadConfig } from '../lib/config.mjs';
9
+
10
+ try {
11
+ const input = JSON.parse(readFileSync(0, 'utf8'));
12
+ const config = loadConfig(process.cwd());
13
+ const result = sessionEndHandler.evaluate(input, config);
14
+ if (result) {
15
+ process.stdout.write(JSON.stringify(result));
16
+ }
17
+ } catch (e) {
18
+ process.exit(0);
19
+ }
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Plugin-mode runner for SubagentStart event
4
+ * Injects current plan scope into subagent context
5
+ */
6
+ import { readFileSync } from 'fs';
7
+ import { scopeInjector } from '../hooks/subagent-scope-injector.mjs';
8
+ import { loadConfig } from '../lib/config.mjs';
9
+
10
+ try {
11
+ const input = JSON.parse(readFileSync(0, 'utf8'));
12
+ const config = loadConfig(process.cwd());
13
+ const result = scopeInjector.evaluate(input, config);
14
+ if (result) {
15
+ process.stdout.write(JSON.stringify(result));
16
+ }
17
+ } catch (e) {
18
+ process.exit(0);
19
+ }
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Plugin-mode runner for TaskCompleted event
4
+ * Auto-updates plan file checkboxes
5
+ */
6
+ import { readFileSync } from 'fs';
7
+ import { planSync } from '../hooks/task-plan-sync.mjs';
8
+ import { loadConfig } from '../lib/config.mjs';
9
+
10
+ try {
11
+ const input = JSON.parse(readFileSync(0, 'utf8'));
12
+ const config = loadConfig(process.cwd());
13
+ const result = planSync.evaluate(input, config);
14
+ if (result) {
15
+ process.stdout.write(JSON.stringify(result));
16
+ }
17
+ } catch (e) {
18
+ process.exit(0);
19
+ }
@@ -2,7 +2,7 @@
2
2
 
3
3
  When this command is invoked:
4
4
 
5
- 1. **Read the plan file** from `docs/plans/` (most recent matching file)
5
+ 1. **Read the plan file** from `.prism/plans/` (most recent matching file)
6
6
  2. **Auto-count progress** by running:
7
7
  - `grep -c '\- \[x\]' <plan-file>` → completed count
8
8
  - `grep -c '\- \[ \]' <plan-file>` → remaining count
@@ -5,7 +5,7 @@ When this command is invoked, check all components of the prism installation:
5
5
  ## Checks
6
6
 
7
7
  1. **CLAUDE.md**: Does it contain `<!-- PRISM:START -->` marker?
8
- 2. **Config**: Does `.claude-prism.json` exist? Is it valid JSON?
8
+ 2. **Config**: Does `.prism/config.json` exist? Is it valid JSON?
9
9
  3. **Commands**: Do these files exist in `.claude/commands/claude-prism/`?
10
10
  - prism.md, checkpoint.md, plan.md, doctor.md, stats.md, help.md, update.md
11
11
  4. **Hooks**: Do these files exist in `.claude/hooks/`?
@@ -23,7 +23,7 @@ When this command is invoked, check all components of the prism installation:
23
23
  🌈 claude-prism doctor
24
24
 
25
25
  CLAUDE.md: ✅ PRISM rules present
26
- Config: ✅ .claude-prism.json valid
26
+ Config: ✅ .prism/config.json valid
27
27
  Commands: ✅ 7/7 installed
28
28
  Hooks: ✅ 2/2 installed
29
29
  Rules: ✅ 3/3 installed
@@ -6,7 +6,7 @@
6
6
  |---------|-------------|
7
7
  | `/claude-prism:prism` | Start full EUDEC workflow (Essence → Understand → Decompose → Execute → Checkpoint). Also handles analysis-only requests — stops after U phase when no code change is needed. |
8
8
  | `/claude-prism:checkpoint` | Check current batch progress, show next batch preview |
9
- | `/claude-prism:plan` | List, create, or view plan files in `docs/plans/` |
9
+ | `/claude-prism:plan` | List, create, or view plan files in `.prism/plans/` |
10
10
  | `/claude-prism:doctor` | Diagnose installation health and suggest fixes |
11
11
  | `/claude-prism:stats` | Show project statistics, hook status, and plan progress |
12
12
  | `/claude-prism:help` | This reference |
@@ -4,8 +4,8 @@ When this command is invoked:
4
4
 
5
5
  ## List Plans
6
6
 
7
- 1. **Check** if `docs/plans/` exists. If not, report "No plans directory found. Create one with `/claude-prism:plan create <topic>`."
8
- 2. **Scan** `docs/plans/` for all `.md` files
7
+ 1. **Check** if `.prism/plans/` exists. If not, report "No plans directory found. Create one with `/claude-prism:plan create <topic>`."
8
+ 2. **Scan** `.prism/plans/` for all `.md` files
9
9
  3. **Show each plan** with:
10
10
  - Filename and date
11
11
  - Goal (first line after `## Goal`)
@@ -17,7 +17,7 @@ When this command is invoked:
17
17
  If user requests a new plan:
18
18
 
19
19
  1. **Determine topic** from user's description
20
- 2. **Create file** at `docs/plans/YYYY-MM-DD-<topic>.md`
20
+ 2. **Create file** at `.prism/plans/YYYY-MM-DD-<topic>.md`
21
21
  3. **Use EUDEC template**:
22
22
 
23
23
  ```
@@ -69,12 +69,12 @@ When this command is invoked, follow the EUDEC framework strictly:
69
69
  13. **Assign verification strategy** per task: `| Verify: TDD` or `| Verify: Build` or `| Verify: Visual`
70
70
  14. **Pre-decomposition checklist**:
71
71
  - **Codebase audit**: grep/search to verify targets actually exist in code
72
- - **Cross-plan check**: if other plans exist in `docs/plans/`, identify overlapping files
72
+ - **Cross-plan check**: if other plans exist in `.prism/plans/`, identify overlapping files
73
73
  - Required types/interfaces have the necessary fields?
74
74
  - External package APIs behave as expected?
75
75
  - Cross-package dependencies identified and noted as prerequisites?
76
76
  15. **Quality gate**: Plan file exists and targets verified, project builds, dependencies resolved, environment validated. All must pass before execution.
77
- 16. **Save plan** to `docs/plans/YYYY-MM-DD-<topic>.md`
77
+ 16. **Save plan** to `.prism/plans/YYYY-MM-DD-<topic>.md`
78
78
  17. **Get approval**: "Proceed with this plan?"
79
79
 
80
80
  ## X — EXECUTE
@@ -83,7 +83,7 @@ When this command is invoked, follow the EUDEC framework strictly:
83
83
  - Simple changes (imports, types, config): 5-8 per batch
84
84
  - Standard changes (feature add/modify): 3-4 per batch
85
85
  - Complex changes (new module, architecture): 1-2 per batch
86
- 19. **Git-as-Memory**: commit after each completed batch as a rollback point. Use `git diff` summaries to maintain context in long sessions.
86
+ 19. **Git-as-Memory**: commit after each completed batch as a rollback point. Use `git diff` summaries to maintain context in long sessions. Claude Code checkpoints (`Esc+Esc` / `/rewind`) complement git for intra-session rollback.
87
87
  20. Apply risk-based verification:
88
88
  - **High risk** (business logic, auth, data mutation): TDD — failing test → implement → pass. Include negative tests.
89
89
  - **Medium risk** (new components with logic, API integration): Build + lint pass
@@ -4,10 +4,10 @@ When this command is invoked:
4
4
 
5
5
  ## Gather Information
6
6
 
7
- 1. **Read `.claude-prism.json`** for:
7
+ 1. **Read `.prism/config.json`** for:
8
8
  - Language setting
9
9
  - Hook configurations and enabled status
10
- 2. **Scan plan files** in `docs/plans/*.md`:
10
+ 2. **Scan plan files** in `.prism/plans/*.md`:
11
11
  - Count total files
12
12
  - For each plan, count `[x]` (done) vs `[ ]` (pending) tasks
13
13
  - Calculate completion percentage
@@ -159,7 +159,7 @@ If no code change is needed (architecture review, cause analysis, investigation)
159
159
  ### 3-3. Plan File Persistence
160
160
 
161
161
  Save multi-step plans (6+ files) as markdown:
162
- - **Path**: `docs/plans/YYYY-MM-DD-<topic>.md`
162
+ - **Path**: `.prism/plans/YYYY-MM-DD-<topic>.md`
163
163
 
164
164
  ```markdown
165
165
  ## Goal
@@ -196,7 +196,7 @@ Tech stack, key decisions, 2-3 sentences max.
196
196
 
197
197
  Before creating the plan:
198
198
  - [ ] **Codebase audit**: grep/search to verify targets actually exist in code (don't trust assumptions from prior sessions)
199
- - [ ] **Cross-plan check**: if other plans exist in `docs/plans/`, identify overlapping files and note dependencies
199
+ - [ ] **Cross-plan check**: if other plans exist in `.prism/plans/`, identify overlapping files and note dependencies
200
200
  - [ ] Required types/interfaces have the necessary fields?
201
201
  - [ ] External package APIs behave as expected?
202
202
  - [ ] Cross-package dependencies identified?
@@ -327,6 +327,13 @@ When delegating work to sub-agents:
327
327
 
328
328
  **Never mark a delegated task as complete without reading the actual file state.**
329
329
 
330
+ ### 4-8. Checkpoint Integration
331
+
332
+ Claude Code creates automatic checkpoints on every edit. Use `Esc+Esc` or `/rewind` to restore.
333
+ - Before risky changes: checkpoint exists automatically
334
+ - After failed batch: consider `/rewind` to restore clean state before retry
335
+ - Checkpoints complement Git-as-Memory: git for cross-session, checkpoints for intra-session
336
+
330
337
  ### 4-7. Project-Type Verification Examples
331
338
 
332
339
  | Project Type | Syntax Check | Smoke Test | Approval Test |
@@ -464,7 +471,7 @@ If any of these excuses come to mind, **that's a warning signal**. Stop and retu
464
471
  | "It worked in my head" | Run the test. Thought experiments don't count |
465
472
  | "The existing code is messy anyway" | Fix what was asked. Note the rest for later |
466
473
  | "The plan says 0% so we start fresh" | Grep the codebase. Prior work may already exist |
467
- | "Other plans won't conflict" | Check `docs/plans/` for overlapping files |
474
+ | "Other plans won't conflict" | Check `.prism/plans/` for overlapping files |
468
475
  | "Tests pass, so it must be correct" | Passing tests only prove what you tested. Check edge cases and negative cases |
469
476
  | "3 files is too few to decompose" | Depends on coupling. 2 files in a tightly-coupled legacy system may need decomposition |
470
477
  | "I already grasped the essence" | If the essence statement contains technology names, it's still at solution level |
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI-mode runner for PreCompact event
4
+ * Installed to .claude/hooks/precompact.mjs
5
+ */
6
+ import { readFileSync } from 'fs';
7
+ import { precompactHandler } from '../rules/precompact-handler.mjs';
8
+ import { loadConfig } from '../lib/config.mjs';
9
+
10
+ try {
11
+ const input = JSON.parse(readFileSync(0, 'utf8'));
12
+ const config = loadConfig(process.cwd());
13
+ const result = precompactHandler.evaluate(input, config);
14
+ if (result) {
15
+ process.stdout.write(JSON.stringify(result));
16
+ }
17
+ } catch (e) {
18
+ process.exit(0);
19
+ }
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI-mode runner for SessionEnd event
4
+ * Installed to .claude/hooks/session-end.mjs
5
+ */
6
+ import { readFileSync } from 'fs';
7
+ import { sessionEndHandler } from '../rules/session-end-handler.mjs';
8
+ import { loadConfig } from '../lib/config.mjs';
9
+
10
+ try {
11
+ const input = JSON.parse(readFileSync(0, 'utf8'));
12
+ const config = loadConfig(process.cwd());
13
+ const result = sessionEndHandler.evaluate(input, config);
14
+ if (result) {
15
+ process.stdout.write(JSON.stringify(result));
16
+ }
17
+ } catch (e) {
18
+ process.exit(0);
19
+ }
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI-mode runner for SubagentStart event
4
+ * Installed to .claude/hooks/subagent-start.mjs
5
+ */
6
+ import { readFileSync } from 'fs';
7
+ import { scopeInjector } from '../rules/subagent-scope-injector.mjs';
8
+ import { loadConfig } from '../lib/config.mjs';
9
+
10
+ try {
11
+ const input = JSON.parse(readFileSync(0, 'utf8'));
12
+ const config = loadConfig(process.cwd());
13
+ const result = scopeInjector.evaluate(input, config);
14
+ if (result) {
15
+ process.stdout.write(JSON.stringify(result));
16
+ }
17
+ } catch (e) {
18
+ process.exit(0);
19
+ }
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI-mode runner for TaskCompleted event
4
+ * Installed to .claude/hooks/task-completed.mjs
5
+ */
6
+ import { readFileSync } from 'fs';
7
+ import { planSync } from '../rules/task-plan-sync.mjs';
8
+ import { loadConfig } from '../lib/config.mjs';
9
+
10
+ try {
11
+ const input = JSON.parse(readFileSync(0, 'utf8'));
12
+ const config = loadConfig(process.cwd());
13
+ const result = planSync.evaluate(input, config);
14
+ if (result) {
15
+ process.stdout.write(JSON.stringify(result));
16
+ }
17
+ } catch (e) {
18
+ process.exit(0);
19
+ }
@@ -33,6 +33,50 @@
33
33
  }
34
34
  ]
35
35
  }
36
+ ],
37
+ "PreCompact": [
38
+ {
39
+ "hooks": [
40
+ {
41
+ "type": "command",
42
+ "command": "node .claude/hooks/precompact.mjs",
43
+ "timeout": 10000
44
+ }
45
+ ]
46
+ }
47
+ ],
48
+ "SessionEnd": [
49
+ {
50
+ "hooks": [
51
+ {
52
+ "type": "command",
53
+ "command": "node .claude/hooks/session-end.mjs",
54
+ "timeout": 10000
55
+ }
56
+ ]
57
+ }
58
+ ],
59
+ "SubagentStart": [
60
+ {
61
+ "hooks": [
62
+ {
63
+ "type": "command",
64
+ "command": "node .claude/hooks/subagent-start.mjs",
65
+ "timeout": 5000
66
+ }
67
+ ]
68
+ }
69
+ ],
70
+ "TaskCompleted": [
71
+ {
72
+ "hooks": [
73
+ {
74
+ "type": "command",
75
+ "command": "node .claude/hooks/task-completed.mjs",
76
+ "timeout": 5000
77
+ }
78
+ ]
79
+ }
36
80
  ]
37
81
  }
38
82
  }
@@ -99,12 +99,12 @@ AI agents optimize for speed, not correctness. Without structure, they skip unde
99
99
  13. **Assign verification strategy** per task: `| Verify: TDD` or `| Verify: Build` or `| Verify: Visual`
100
100
  14. **Pre-decomposition checklist**:
101
101
  - **Codebase audit**: grep/search to verify targets actually exist in code
102
- - **Cross-plan check**: if other plans exist in `docs/plans/`, identify overlapping files
102
+ - **Cross-plan check**: if other plans exist in `.prism/plans/`, identify overlapping files
103
103
  - Required types/interfaces have the necessary fields?
104
104
  - External package APIs behave as expected?
105
105
  - Cross-package dependencies identified and noted as prerequisites?
106
106
  15. **Quality gate**: Plan file exists and targets verified, project builds, dependencies resolved, environment validated. All must pass before execution.
107
- 16. **Save plan** to `docs/plans/YYYY-MM-DD-<topic>.md`
107
+ 16. **Save plan** to `.prism/plans/YYYY-MM-DD-<topic>.md`
108
108
  17. **Get approval**: "Proceed with this plan?"
109
109
 
110
110
  ## X — EXECUTE
@@ -113,7 +113,7 @@ AI agents optimize for speed, not correctness. Without structure, they skip unde
113
113
  - Simple changes (imports, types, config): 5-8 per batch
114
114
  - Standard changes (feature add/modify): 3-4 per batch
115
115
  - Complex changes (new module, architecture): 1-2 per batch
116
- 19. **Git-as-Memory**: commit after each completed batch as a rollback point. Use `git diff` summaries to maintain context in long sessions.
116
+ 19. **Git-as-Memory**: commit after each completed batch as a rollback point. Use `git diff` summaries to maintain context in long sessions. Claude Code checkpoints (`Esc+Esc` / `/rewind`) complement git for intra-session rollback.
117
117
  20. Apply risk-based verification:
118
118
  - **High risk** (business logic, auth, data mutation): TDD — failing test → implement → pass. Include negative tests.
119
119
  - **Medium risk** (new components with logic, API integration): Build + lint pass