claude-prism 1.5.0 → 1.6.0-beta.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/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +10 -0
- package/README.md +17 -0
- package/lib/config.mjs +6 -0
- package/lib/installer.mjs +28 -4
- package/package.json +1 -1
- package/templates/rules-lean.md +92 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ 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.6.0-beta.1] — 2026-03-04
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Lean Router** — `rulesMode: "lean"` in `.prism/config.json` injects ~80-line behavioral modifiers instead of the full ~500-line methodology
|
|
12
|
+
- Core principle, Adaptive Weight routing, Bugfix Fast Path, Scope Guard, Verification Fallback Ladder, Self-correction triggers, Rationalization Defense, Completion Declaration
|
|
13
|
+
- Standard/Full tasks routed to `/claude-prism:prism` slash command for full EUDEC guidance
|
|
14
|
+
- Fallback: if `rules-lean.md` missing, automatically uses `rules.md`
|
|
15
|
+
- `getRulesMode()` export in `lib/config.mjs`
|
|
16
|
+
- 5 new lean mode tests
|
|
17
|
+
|
|
8
18
|
## [1.5.0] — 2026-03-04
|
|
9
19
|
|
|
10
20
|
### Changed
|
package/README.md
CHANGED
|
@@ -246,11 +246,28 @@ Edit `.prism/config.json`:
|
|
|
246
246
|
| Setting | Default | Description |
|
|
247
247
|
|---------|---------|-------------|
|
|
248
248
|
| `version` | 1 | Config schema version (for future migrations) |
|
|
249
|
+
| `rulesMode` | `"full"` | `"full"` injects the complete ~500-line EUDEC methodology; `"lean"` injects ~80-line behavioral modifiers and routes to `/claude-prism:prism` for full guidance |
|
|
249
250
|
| `commit-guard.maxTestAge` | 300 | Seconds before test run is considered stale |
|
|
250
251
|
| `plan-enforcement.warnAt` | 6 | Unique source file count that triggers plan warning |
|
|
251
252
|
| `task-plan-sync.matchThreshold` | 0.3 | Keyword overlap ratio for fuzzy task matching |
|
|
252
253
|
| `webhooks` | `[]` | HTTP endpoints for event notifications |
|
|
253
254
|
|
|
255
|
+
### Lean Router (beta)
|
|
256
|
+
|
|
257
|
+
By default, Prism injects the full EUDEC methodology (~500 lines) into `CLAUDE.md`. This provides passive absorption — the agent always has the complete framework in context.
|
|
258
|
+
|
|
259
|
+
**Lean mode** injects only ~80 lines of behavioral modifiers (Scope Guard, Verification Ladder, Bugfix Fast Path, etc.) and routes Standard/Full tasks to the `/claude-prism:prism` slash command for on-demand full guidance. This saves context window for code.
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# Switch to lean mode
|
|
263
|
+
echo '{"version":1,"rulesMode":"lean"}' > .prism/config.json
|
|
264
|
+
prism update
|
|
265
|
+
|
|
266
|
+
# Switch back to full mode
|
|
267
|
+
echo '{"version":1,"rulesMode":"full"}' > .prism/config.json
|
|
268
|
+
prism update
|
|
269
|
+
```
|
|
270
|
+
|
|
254
271
|
## CLI Commands
|
|
255
272
|
|
|
256
273
|
```bash
|
package/lib/config.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { readFileSync, existsSync } from 'fs';
|
|
|
7
7
|
import { join } from 'path';
|
|
8
8
|
|
|
9
9
|
const DEFAULTS = {
|
|
10
|
+
rulesMode: 'full',
|
|
10
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'],
|
|
11
12
|
testPatterns: ['test', 'spec', '_test'],
|
|
12
13
|
customRules: [],
|
|
@@ -70,4 +71,9 @@ export function buildTestPattern(patterns) {
|
|
|
70
71
|
return new RegExp(`\\.(${escaped.join('|')})\\.`);
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
export function getRulesMode(projectRoot) {
|
|
75
|
+
const config = loadConfig(projectRoot);
|
|
76
|
+
return config.rulesMode === 'lean' ? 'lean' : 'full';
|
|
77
|
+
}
|
|
78
|
+
|
|
73
79
|
export { DEFAULTS };
|
package/lib/installer.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import { join, dirname } from 'path';
|
|
|
8
8
|
import { fileURLToPath } from 'url';
|
|
9
9
|
import { tmpdir, homedir } from 'os';
|
|
10
10
|
import { detectOmc } from './omc.mjs';
|
|
11
|
+
import { getRulesMode } from './config.mjs';
|
|
11
12
|
|
|
12
13
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
14
|
const TEMPLATES_DIR = join(__dirname, '..', 'templates');
|
|
@@ -371,10 +372,12 @@ export async function update(projectDir) {
|
|
|
371
372
|
}
|
|
372
373
|
}
|
|
373
374
|
|
|
374
|
-
// Migrate config: add version field if missing
|
|
375
|
+
// Migrate config: add version field if missing, preserve rulesMode
|
|
376
|
+
let preservedRulesMode;
|
|
375
377
|
if (existsSync(configPath)) {
|
|
376
378
|
try {
|
|
377
379
|
const existingConfig = JSON.parse(readFileSync(configPath, 'utf8'));
|
|
380
|
+
preservedRulesMode = existingConfig.rulesMode;
|
|
378
381
|
if (!existingConfig.version) {
|
|
379
382
|
existingConfig.version = 1;
|
|
380
383
|
writeFileSync(configPath, JSON.stringify(existingConfig, null, 2) + '\n');
|
|
@@ -385,10 +388,23 @@ export async function update(projectDir) {
|
|
|
385
388
|
|
|
386
389
|
await init(projectDir, { hooks });
|
|
387
390
|
|
|
391
|
+
// Restore rulesMode if it was set before migration
|
|
392
|
+
if (preservedRulesMode && preservedRulesMode !== 'full') {
|
|
393
|
+
const newConfig = JSON.parse(readFileSync(configPath, 'utf8'));
|
|
394
|
+
newConfig.rulesMode = preservedRulesMode;
|
|
395
|
+
writeFileSync(configPath, JSON.stringify(newConfig, null, 2) + '\n');
|
|
396
|
+
// Re-inject rules with restored mode
|
|
397
|
+
injectRules(projectDir);
|
|
398
|
+
}
|
|
399
|
+
|
|
388
400
|
// Source repo: re-inject rules from local templates (overrides the npx version)
|
|
389
401
|
if (sourceRepo) {
|
|
390
|
-
const
|
|
391
|
-
|
|
402
|
+
const mode = getRulesMode(projectDir);
|
|
403
|
+
const fileName = mode === 'lean' ? 'rules-lean.md' : 'rules.md';
|
|
404
|
+
const localRulesPath = join(projectDir, 'templates', fileName);
|
|
405
|
+
if (existsSync(localRulesPath)) {
|
|
406
|
+
injectRules(projectDir, localRulesPath);
|
|
407
|
+
}
|
|
392
408
|
}
|
|
393
409
|
|
|
394
410
|
return sourceRepo ? { sourceRepo: true } : undefined;
|
|
@@ -747,7 +763,15 @@ export function hudStatus(options = {}) {
|
|
|
747
763
|
|
|
748
764
|
function injectRules(projectDir, overrideRulesPath) {
|
|
749
765
|
const claudeMdPath = join(projectDir, 'CLAUDE.md');
|
|
750
|
-
|
|
766
|
+
let rulesPath;
|
|
767
|
+
if (overrideRulesPath) {
|
|
768
|
+
rulesPath = overrideRulesPath;
|
|
769
|
+
} else {
|
|
770
|
+
const mode = getRulesMode(projectDir);
|
|
771
|
+
const fileName = mode === 'lean' ? 'rules-lean.md' : 'rules.md';
|
|
772
|
+
rulesPath = join(TEMPLATES_DIR, fileName);
|
|
773
|
+
if (!existsSync(rulesPath)) rulesPath = join(TEMPLATES_DIR, 'rules.md');
|
|
774
|
+
}
|
|
751
775
|
if (!existsSync(rulesPath)) return;
|
|
752
776
|
|
|
753
777
|
const rules = readFileSync(rulesPath, 'utf8');
|
package/package.json
CHANGED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
|
|
2
|
+
<!-- PRISM:START -->
|
|
3
|
+
# Prism — EUDEC Methodology (Lean Mode)
|
|
4
|
+
|
|
5
|
+
**EUDEC = Essence, Understand, Decompose, Execute, Checkpoint** — the core cycle.
|
|
6
|
+
|
|
7
|
+
> **Never implement what you haven't understood. Never understand what you haven't distilled to its essence.**
|
|
8
|
+
|
|
9
|
+
For the full methodology, run `/claude-prism:prism`.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Adaptive Weight (Task Size Routing)
|
|
14
|
+
|
|
15
|
+
| Weight | Criteria | Path |
|
|
16
|
+
|--------|----------|------|
|
|
17
|
+
| **Lightweight** | 1-2 files, <50 LOC, clear scope | Essence (1 line) → Execute → Verify → Done |
|
|
18
|
+
| **Standard** | 3-5 files, 50-200 LOC | Run `/claude-prism:prism` for full EUDEC guidance |
|
|
19
|
+
| **Full** | 6+ files, 200+ LOC, or unclear scope | Run `/claude-prism:prism` for full EUDEC with plan file |
|
|
20
|
+
|
|
21
|
+
## Task Type Derivation
|
|
22
|
+
|
|
23
|
+
| Essence Character | Type | Path |
|
|
24
|
+
|-------------------|------|------|
|
|
25
|
+
| "X is broken" | Bugfix | Fast Path (below) |
|
|
26
|
+
| "X should be possible" | Feature | `/claude-prism:prism` |
|
|
27
|
+
| "All X must become Y" | Migration | Pattern → batch apply → verify |
|
|
28
|
+
| "X's structure must change" | Refactor | `/claude-prism:prism` |
|
|
29
|
+
|
|
30
|
+
## Bugfix Fast Path
|
|
31
|
+
|
|
32
|
+
1. Reproduce the symptom
|
|
33
|
+
2. Trace to root cause
|
|
34
|
+
3. Minimal fix (smallest change that resolves the cause)
|
|
35
|
+
4. Verify (test/build/diff)
|
|
36
|
+
|
|
37
|
+
After 3 failed fixes: STOP. Discuss with user.
|
|
38
|
+
|
|
39
|
+
## Scope Guard
|
|
40
|
+
|
|
41
|
+
**Only change what was requested. Nothing more, nothing less.**
|
|
42
|
+
|
|
43
|
+
1. Was this change explicitly requested? → proceed
|
|
44
|
+
2. Is it required to make the requested change work? → proceed
|
|
45
|
+
3. Is it an improvement I noticed while working? → STOP. Note it, don't do it.
|
|
46
|
+
4. Is it "while I'm here" cleanup? → STOP. Not your job right now.
|
|
47
|
+
|
|
48
|
+
## Verification & Fallback Ladder
|
|
49
|
+
|
|
50
|
+
| Level | Method | When |
|
|
51
|
+
|-------|--------|------|
|
|
52
|
+
| 1. Tests | Automated tests | Test infrastructure exists |
|
|
53
|
+
| 2. Build | Compiles + lint without new errors | No tests for this area |
|
|
54
|
+
| 3. Diff | `git diff` reviewed for regressions | No build tooling |
|
|
55
|
+
|
|
56
|
+
**Every change must have SOME verification.** Never claim completion without evidence.
|
|
57
|
+
|
|
58
|
+
## Self-Correction Triggers
|
|
59
|
+
|
|
60
|
+
- Same file edited 3+ times → investigate root cause
|
|
61
|
+
- Editing file not in plan → scope change needed?
|
|
62
|
+
- 3 consecutive test failures → back to essence
|
|
63
|
+
- 5 turns autonomous → report progress before continuing
|
|
64
|
+
- Adding workarounds to fix workarounds → design problem, step back
|
|
65
|
+
|
|
66
|
+
## Rationalization Defense
|
|
67
|
+
|
|
68
|
+
| Excuse | Reality |
|
|
69
|
+
|--------|---------|
|
|
70
|
+
| "I know what they mean" | Verify. Assumption is the root of all bugs |
|
|
71
|
+
| "While I'm here, let me also..." | Scope creep. Note it for later |
|
|
72
|
+
| "Too simple to decompose" | Check file count and coupling |
|
|
73
|
+
| "I'll add tests later" | High-risk: tests come first |
|
|
74
|
+
|
|
75
|
+
## Checkpoint Frequency
|
|
76
|
+
|
|
77
|
+
- **Lightweight**: report completion with evidence, no pause
|
|
78
|
+
- **Standard/Full**: run `/claude-prism:prism` for guided checkpoints
|
|
79
|
+
- **Blocker encountered**: always stop
|
|
80
|
+
|
|
81
|
+
## Session Handoff
|
|
82
|
+
|
|
83
|
+
When context is running low or switching tasks, create `docs/HANDOFF.md` with: Status, Current State, Next Steps, Decisions Made, Known Issues.
|
|
84
|
+
|
|
85
|
+
## Completion Declaration
|
|
86
|
+
|
|
87
|
+
Before declaring completion:
|
|
88
|
+
1. **IDENTIFY** — What proves completion?
|
|
89
|
+
2. **RUN** — Execute the relevant test/build
|
|
90
|
+
3. **READ** — Check the output directly
|
|
91
|
+
4. **CLAIM** — Only declare based on evidence
|
|
92
|
+
<!-- PRISM:END -->
|