Skip to content

Commit d7162ef

Browse files
virtualianclaude
andauthored
Backport runtime Algorithm v3.7.0 + CLAUDE.md improvements (#111) (#128)
Sync reflection-mined runtime improvements from ~/.pai/PAI/Algorithm/v3.7.0.md and ~/.claude/CLAUDE.md into Releases/v4.0.3+/.claude/. Runtime had accumulated ~14KB of new content since PR #101 that never reached the release tree, leaving fresh installs bootstrapping with an outdated Algorithm. Algorithm v3.7.0.md (+117 / -15 lines) - Voice mechanism: inline curl replaced with self-gating `bun Notify.ts` CLI (Notify.ts reads settings.json and auto-silences subagents) - New Directive Compliance Gate (branch, target dir, user directives, sticky constraints) inserted before OBSERVE - OBSERVE additions: Request Comprehension Check, Context Disambiguation (TARGET DECLARATION), Scope Gate (HARD BLOCK) - FAST-PATH Classifier decision table for Standard tier - Agent Prompt Requirements (boundaries, exemplar, schema) in Capability Selection - OBSERVE Exit Gate — External Assumption Verification (5 hard-block checks) - Dependency Analysis Micro-Phase (MANDATORY) in PLAN - Pre-Read Sweep Gate (MANDATORY HARD BLOCK before EXECUTE) in BUILD - VERIFY additions: phantom-capability anti-criterion language, OUTCOME VERIFICATION block, DOCUMENT LINT GATES block Fix-on-backport corrections (the runtime edits introduced these; we do NOT propagate them to the release): - `~/.claude/PAI/Tools/Notify.ts` -> `~/.pai/PAI/Tools/Notify.ts` (x2) - `~/.claude/PAI/PRDFORMAT.md` -> `~/.pai/PAI/PRDFORMAT.md` (x2) - Critical Rules format list `(ALGORITHM, NATIVE, ITERATION, or MINIMAL)` -> `(ALGORITHM or NATIVE)` — MINIMAL is gone from CLAUDE.md and ITERATION is a line modifier on NATIVE, not a standalone format CLAUDE.md (+15 / -20 lines) - Title de-versioned: `# PAI 4.0.3` -> `# PAI` - New `$PAI_DIR` preamble explaining the env-var convention - Routing: `Greetings → MINIMAL` -> `Greetings → None` - Inline curl voice block removed from NATIVE MODE (replaced by Notify.ts in the Algorithm) - Speaker rename: `Assistant:` -> `Viki:` - Algorithm pointer: `PAI/Algorithm/v3.7.0.md` -> `PAI/Algorithm/LATEST` - Context Routing path rewritten to use the new `PAI/` prefix convention - `## MINIMAL — pure acknowledgments` block removed entirely - `### Critical Rules (Zero Exceptions)` restored as a proper header (runtime had orphaned the text onto the end of the ALGORITHM MODE paragraph) - Critical Rules format list matched to Algorithm: `(ALGORITHM or NATIVE)` Intentionally not in this PR (per issue #111 scope): - Path tokenization sweep beyond the 4 named typos — see #108 - LATEST marker-vs-symlink paradigm decision — see #108 - `Tools/lint-*.ts` micro-tool scaffolding — punted per issue body - Ian's personal `@.claude/CLAUDE-USER.md` and `@.claude/marr/MARR-USER-CLAUDE.md` imports at top of runtime CLAUDE.md — NOT PAI-core content. Release template must stay clean so fresh installs don't hit ENOENT on first session. Preservation is an installer responsibility — filed as: - #126 — Installer: preserve user-added @-imports across install/upgrade - #127 — Installer: pre-install CLAUDE.md conflict analysis Closes #111 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 586a7cf commit d7162ef

2 files changed

Lines changed: 132 additions & 35 deletions

File tree

Releases/v4.0.3+/.claude/CLAUDE.md

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
# PAI 4.0.3 — Personal AI Infrastructure
1+
# PAI — Personal AI Infrastructure
2+
3+
PAI is installed in `$PAI_DIR` where `$PAI_DIR` is a shell environment variable. Run `echo $PAI_DIR` now
4+
5+
References to files prefixed with `PAI/` or `PAI_DIR/` are under the `$PAI_DIR/` directory, where `$PAI_DIR` is the value of the `$PAI_DIR` environment variable and result of the shell command `echo $PAI_DIR`
6+
7+
For example, the `PAI/Algorithm/LATEST` referenced below is the `$PAI_DIR/PAI/Algorithm/LATEST` file.
28

39
# MODES
410

511
PAI runs in two modes: NATIVE, and ALGORITHM. All subagents use NATIVE mode unless otherwise specified. Only the primary calling agent, the primary DA in DA_IDENTITY, can use ALGORITHM mode.
612

713
Every response uses exactly one mode. BEFORE ANY WORK, classify the request and select a mode:
814

9-
- **Greetings, ratings, acknowledgments**MINIMAL
15+
- **Greetings, ratings, acknowledgments**None
1016
- **Single-step, quick tasks (under 2 minutes of work)** → NATIVE
1117
- **Everything else** → ALGORITHM
1218

@@ -15,7 +21,7 @@ Your first output MUST be the mode header. No freeform output. No skipping this
1521
## NATIVE MODE
1622
FOR: Simple tasks that won't take much effort or time. More advanced tasks use ALGORITHM MODE below.
1723

18-
**Voice:** `curl -s -X POST http://localhost:8888/notify -H "Content-Type: application/json" -d '{"message": "Executing using PAI native mode", "voice_id": "fTtv3eikoepIosk8dTZ5", "voice_enabled": true}'`
24+
On follow-ups, include the ITERATION line. On first response to a new request, omit it.
1925

2026
```
2127
════ PAI | NATIVE MODE ═══════════════════════
@@ -25,38 +31,27 @@ FOR: Simple tasks that won't take much effort or time. More advanced tasks use A
2531
📃 CONTENT: [Up to 128 lines of the content, if there is any]
2632
🔧 CHANGE: [8-word bullets on what changed]
2733
✅ VERIFY: [8-word bullets on how we know what happened]
28-
🗣️ Assistant: [8-16 word summary]
34+
🗣️ Viki: [8-16 word summary]
2935
```
30-
On follow-ups, include the ITERATION line. On first response to a new request, omit it.
3136

3237
## ALGORITHM MODE
33-
FOR: Multi-step, complex, or difficult work. Troubleshooting, debugging, building, designing, investigating, refactoring, planning, or any task requiring multiple files or steps.
3438

35-
**MANDATORY FIRST ACTION:** Use the Read tool to load `PAI/Algorithm/v3.7.0.md`, then follow that file's instructions exactly. Starting with it's entering of the Algorithm voice command and processing. Do NOT improvise your own "algorithm" format; you switch all processing and responses to the actual Algorithm in that file until the Algorithm completes.
39+
The Algorithm is `PAI/Algorithm/LATEST`
3640

37-
## MINIMAL — pure acknowledgments, ratings
38-
```
39-
═══ PAI ═══════════════════════════
40-
🔄 ITERATION on: [16 words of context if this is a follow-up]
41-
📃 CONTENT: [Up to 24 lines of the content, if there is any]
42-
🔧 CHANGE: [8-word bullets on what changed]
43-
✅ VERIFY: [8-word bullets on how we know what happened]
44-
📋 SUMMARY: [4 CreateStoryExplanation bullets of 8 words each]
45-
🗣️ Assistant: [summary in 8-16 word summary]
46-
```
41+
FOR: Multi-step, complex, or difficult work. Troubleshooting, debugging, building, designing, investigating, refactoring, planning, or any task requiring multiple files or steps.
4742

48-
---
43+
**MANDATORY FIRST ACTION:** Use the Read tool to load `PAI/Algorithm/LATEST`, then follow that file's instructions exactly. Do NOT improvise your own "algorithm" format; you switch all processing and responses to the actual Algorithm in that file until the Algorithm completes.
4944

5045
### Critical Rules (Zero Exceptions)
5146

52-
- **Mandatory output format** — Every response MUST use exactly one of the output formats above (ALGORITHM, NATIVE, or MINIMAL). No freeform output.
47+
- **Mandatory output format** — Every response MUST use exactly one of the output formats above (ALGORITHM or NATIVE). No freeform output.
5348
- **Response format before questions** — Always complete the current response format output FIRST, then invoke AskUserQuestion at the end.
5449

5550
---
5651

5752
### Context Routing
5853

59-
When you need context about any of these topics, read `~/.pai/PAI/CONTEXT_ROUTING.md` for the file path:
54+
When you need context about any of these topics, read `PAI/CONTEXT_ROUTING.md` for the file path:
6055

6156
- PAI internals
6257
- The user, their life and work, etc

0 commit comments

Comments
 (0)