Claude Code — Boole Learn Propositional Map¶
A propositional analysis of Claude Code's architecture using the Boole Learn framework: find the foundational propositions, stress-test them, map their logical connections.
Why This Matters¶
Understanding Claude Code as a set of 7 foundational propositions (instead of ~1300 TypeScript files) gives you the mental architecture to reason about any feature, bug, or extension. Draw the picture before you walk into the building.
Foundational Propositions¶
P1: Permission Triple Gate — Rock Solid¶
Every tool call passes through three sequential gates: input validation → permission check → execution. No tool can bypass this.
The entire security model. Every tool contract (Tool.ts) requires validateInput() and checkPermissions(). Subagent permission inheritance, auto-mode classifier, and rule-based allow/deny all depend on this contract.
P2: Streaming Message Accumulator Loop — Rock Solid¶
The query engine iterates: submit messages → stream response → extract tool calls → execute concurrently → append results → repeat. Exits when stop_reason ≠ tool_use or budget/max-turns hit.
Without this loop, multi-turn tool chains are impossible. Token budgeting, context compaction, conversation recovery, and session persistence all presume this stateful loop.
P3: Immutable System Context — Contested¶
System context (tool schemas, permission rules, working dir, git state) is computed once per query and frozen during execution.
Prompt cache depends on immutability. But MCP tools can arrive mid-query without getting added to the frozen prompt, and Tool Search defers schemas — the model can call tools not in its system prompt.
P4: Permission Rule Precedence — Contested¶
Hooks > deny rules > allow rules > ask user. Hooks cannot be overridden by subsequent rules.
Intent is clear but implementation is fragile — precedence depends on condition ordering in permissions.ts. Rule persistence creates subtle lifecycle questions.
P5: Subagent Isolation — Rock Solid¶
Subagents get cloned message history, restricted tool set, and their own agentId. Cannot modify parent AppState — communicate only via SendMessageTool.
Without isolation, a rogue subagent could corrupt the parent session.
P6: Triple Tool Gating — Paradigm-Dependent¶
Tool availability is filtered by: compile-time feature flags (Bun bundle), user type (ant/external), and runtime mode (REPL/coordinator/simple).
Relies on Bun's dead-code elimination working as documented. If feature flags don't strip code, all gated tools would be present in the binary.
P7: Message Compaction — Provisional¶
Auto-compaction triggers when token usage exceeds threshold, preserves recent turns, summarizes old context. Enables unbounded conversation.
Compaction algorithm is opaque. Determinism is assumed but not proven.
Logical Structure¶
P3 (Immutable context) ──┬─→ P6 (Tool gating)
└─→ P1 (Permission triple)
P2 (Message loop) ─────────→ P7 (Compaction) ─→ Session recovery
P1 (Permission triple) ───→ P4 (Rule precedence) ──→ P5 (Subagent isolation)
↑
└─ Hooks can override rules
Critical path: P2 → P3 → P1 → P5
Key Tensions¶
- P3 vs P4 — frozen prompt vs dynamic permissions. The model sees a stable system prompt but permission state can change mid-query via hooks.
- P3 vs Tool Search — model can call tools not listed in its system prompt via deferred schema loading.
- P6 vs P4 — tools removed at compile time can't be referenced by runtime permission rules (silent no-op).
Falsification Summary¶
| Proposition | Rating | Strongest Challenge |
|---|---|---|
| P1: Permission triple | Rock solid | Enforced at type level |
| P2: Message loop | Rock solid | Entire architecture depends on it |
| P3: Immutable context | Contested | MCP + Tool Search break the contract |
| P4: Rule precedence | Contested | Implementation fragility |
| P5: Subagent isolation | Rock solid | No code path leaks |
| P6: Tool gating | Paradigm-dependent | Trusts Bun's dead-code elimination |
| P7: Compaction | Provisional | Algorithm is opaque |
What to Study Next¶
- Tool Search — how deferred tools get validated at call time
- MCP server lifecycle — when servers connect relative to prompt assembly
- Compaction algorithm — summarization strategy and determinism
- Subagent context cloning — which parts of AppState are cloned vs shared
Provenance¶
Framework: Boole Learn (Boole's epistemology + Popper's falsification + Ausubel's advance organizers) Codebase: ~/dev/claude-code (~1332 TypeScript files) Generated: 2026-04-13 by CC Sam