Skip to content

hiivmind/claudecode-pseudocode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude Code in Pseudocode

LMPL specifications that reconstruct Claude Code's internal architecture from the public analyses of the March 2026 source map leak (cli.js.map shipped in @anthropic-ai/claude-code@2.1.88).

Each spec uses the @profile("agentic") / @intent("specify") LMPL profile and follows the same two-layer structure: an idealized skeleton, then a refined expansion grounded in source-level findings. No source code is reproduced — the pseudocode is an independent expression of the documented control flow.

Index

# Spec Captures Lines
01 Core agentic loop queryLoop(), State, Continue Site pattern, transition reasons, recovery branches 467
02 Tool catalog Tool interface, registry, 6-stage lifecycle, concurrency partitioning, 5 canonical tools 518
03 Sub-agents & coordinator spawn_subagent, 3 isolation levels, cache-alignment, coordinator as prompt contract 402
04 Guardrails & permissions can_use_tool pipeline, 6 permission modes, yoloClassifier, bashSecurity 5-layer 489
05 MCP client Transports, lifecycle, tools/resources/prompts, namespacing, trust model 612
06 Skills & slash-commands Frontmatter contract, discovery, progressive disclosure, Skill meta-tool 472
07 Hooks 9 events across 3 families, exit-code conventions, effect model, Guardrail integration 492
08 Plugin ecosystem Manifest, components, marketplaces, activation lifecycle, version resolution, trust 654
09 Memory tiers CLAUDE.md hierarchy, auto-memory (memdir/), JSONL sessions, filter pass 558
10 Context compaction 4-tier pipeline, circuit breaker, PreCompact hook integration, recovery 513
11 Prompt cache SYSTEM_PROMPT_DYNAMIC_BOUNDARY, 14 break vectors, sticky latches, fork-based sharing 441

Dependency Graph

Read in any order — each spec stands alone — but specs with fewer dependencies are easier entry points.

              01 Core loop
              /  |  |  \
            02  03  09  (02 Tool catalog, 03 Sub-agents, 09 Memory)
           /   / \  |
          04  /   \ |
          ↑  10   11 (10 Compaction uses 03; 11 Prompt cache uses 03+09)
          |   ↑
          07  (07 Hooks extends 04 and integrates with 02/10)
          ↑
         05 (05 MCP consumes 02, 04)
          ↑
         06 (06 Skills consumes 02, 05)
          ↑
         08 (08 Plugins packages 06/07/03/05)

Suggested reading orders:

  • Quick tour — 01, 02, 04, 08 (loop → tools → guardrails → how it all gets packaged)
  • Runtime-first — 01, 02, 03, 04, 10, 11 (loop + everything that runs per-turn)
  • Extension-first — 01, 06, 07, 08, 05 (loop + every way to extend it)

Shared Conventions

Every spec carries:

  • Scope & non-goals up front.
  • Types section defining the vocabulary the spec uses.
  • A refined expansion layer with source-grounded fidelity (behavioral scars, not just abstract intent).
  • LMPL gaps — a running list of language-level features the specs need but don't have. Roughly 60 proposed extensions across the set; useful as an artifact for evolving the LMPL profile itself.
  • Cross-spec references table and a References section citing the public analyses used as source grounding.

Source Grounding

These specs reconstruct behavior documented in the public analyses of the 2026-03-31 leak. Representative sources (each spec cites its own):

No source code is reproduced in this repository. All pseudocode is independent LMPL expression of documented control flow.

LMPL Profile

The pseudocode uses the agentic profile defined in hiivmind-lmpl (spec/profiles/agentic.md). Key constructs used throughout:

  • agent_loop { observe / reason / act / update / until } — the canonical observe-reason-act skeleton
  • @max_iterations, @requires_approval, @boundary — agent-level annotations
  • require / ensure / invariant — pre/post/invariant contracts
  • concurrently { ... } join — parallel fan-out (used for tool partitioning and swarm sub-agents)
  • attempt / on failure — tool failure handling

Specs deliberately note where LMPL doesn't quite fit, rather than papering over the gap — these are the "LMPL gaps" sections.

About

LMPL pseudocode specs reconstructing Claude Code internals from public analyses of the 2026-03 source map leak

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors