# xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode architecture

> Architecture diagram of the GitHub repository xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode
- Repository: https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode

## Overview

1. **Repository type and boundary**
   - This is not an application codebase; it is a **spec-first behavioral protocol** for AI chat. The “implementation” is the text of the spec, not executable code.
   - The main runtime boundary is between a **host model/session** that loads the spec as system instructions and the **user conversation** that triggers routing.

2. **Canonical runtime surface**
   - `A.D.A.M.v5.txt` is the single authoritative protocol artifact.
   - The README explicitly treats it as the live surface and describes the repo as **v5-first**, with older shapes relegated to history.

3. **Core data flow**
   - The conceptual flow is: **input → structural kernel → mode state → output contract → action/audit**.
   - In practical terms, each user message is classified, routed to LOW/MID/DEEP, then emitted under a strict reply format with optional bounded audit metadata.

4. **Routing engine**
   - The central subsystem is the **rule-ordered depth router**:
     - `LOW` for minimal answers
     - `MID` for structured reasoning
     - `DEEP` for full decision support
   - Mode can be set by the **first token** in the user message, which means user override has priority over auto-routing.

5. **DEEP gate and consent flow**
   - DEEP is not entered automatically when merely suggested.
   - The protocol uses a two-step gate: `MODE: MID -> POSSIBLE DEEP`, then a hard-stop prompt asking for exact `yes`.
   - This creates a consent boundary that separates routine response generation from more exhaustive reasoning.

6. **Bootstrap and session-state boundary**
   - Activation begins with the exact handshake `ADAM PING`.
   - The bootstrap phase exposes an explicit `BOOTSTRAP_CLASS` (`TEXT_ONLY`, `BOUND_RO`, `BOUND_RW`, `GHOST`) so the host’s capability state is made visible rather than implicit.
   - The repo also defines fail-closed behavior such as `ADAM_UNSUPPORTED` when the host cannot satisfy the bootstrap contract.

7. **Output contract and audit boundary**
   - Replies are constrained by a visible mode tag and a clean “action lane.”
   - When needed, auditability is appended as a strict `AUDIT` footer with `ACTION`, `RISK`, and `BASIS`.
   - This is a deliberate boundary: the protocol wants traceability without turning every reply into a verbose chain-of-thought dump.

8. **Internal runtime layers named in the spec**
   - The README’s technical reference describes three internal layers:
     - **Structural kernel**: routing and gating logic
     - **State Overlay (LITE)**: internal workflow states like EXPLORE → CONVERGE → DECIDE → VERIFY
     - **Output Contract (OVL)**: final-format validation only
   - These are conceptual layers, not separate files, but they matter for understanding how the spec is organized.

9. **Diagnostics and external checks**
   - `ADAM_SELF_TEST.md` and `SYS_STATUS.md` are operator-facing diagnostics, not activation prerequisites.
   - They are meant to be run after the protocol is active, which means the runtime is designed to work without depending on them.
   - The README also mentions a recovery-oriented command path (`ADAM REMOUNT`, `UNSUPPORTED WHY`) as part of operational support.

10. **Reference documentation subsystem**
   - `docs/lexicon.md` is the terminology SSOT, which suggests the repo carefully controls language as part of behavior stability.
   - `docs/field-report-chat.md` provides long-form empirical context and examples, functioning as evidence for how the protocol behaves in real sessions.
   - These docs support the spec but do not define runtime behavior.

11. **Compatibility and host assumptions**
   - The architecture assumes a host that supports a real **system prompt/instructions layer**.
   - Uploading the file is treated as transport only; activation still depends on the exact protocol handshake.
   - Some host UI artifacts are explicitly considered outside the protocol boundary.

12. **Main architectural theme**
   - The repo’s architecture is about **controlling depth, epistemic discipline, and reply shape** in LLM conversations.
   - It is closer to a standards document plus test harness than a software package: one canonical spec, supporting references, external checks, and strict interaction contracts.

Main entry points: [`A.D.A.M.v5.txt`](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt) (A.D.A.M. v5), [`README.md`](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/README.md) (README), [`ADAM_SELF_TEST.md`](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/ADAM_SELF_TEST.md) (ADAM_SELF_TEST), [`SYS_STATUS.md`](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/SYS_STATUS.md) (SYS_STATUS)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g1["Protocol surface"]
  node_n1["A.D.A.M. v5<br/>canonical spec<br/>[A.D.A.M.v5.txt]"]
  node_n2["README<br/>entry guide<br/>[README.md]"]
  node_n3["Handshake<br/>activation<br/>[A.D.A.M.v5.txt]"]
  node_n4["Bootstrap class<br/>host state<br/>[A.D.A.M.v5.txt]"]
  node_n5["Router<br/>depth routing<br/>[A.D.A.M.v5.txt]"]
  node_n6["DEEP gate<br/>consent gate<br/>[A.D.A.M.v5.txt]"]
  node_n7["State overlay<br/>workflow states<br/>[A.D.A.M.v5.txt]"]
  node_n8["Output contract<br/>reply format<br/>[A.D.A.M.v5.txt]"]
  node_n9["Audit footer<br/>trace metadata<br/>[A.D.A.M.v5.txt]"]
end

subgraph group_g2["Operational support"]
  node_n10["Fail closed<br/>error contract<br/>[A.D.A.M.v5.txt]"]
  node_n11["ADAM_SELF_TEST<br/>operator check<br/>[ADAM_SELF_TEST.md]"]
  node_n12["SYS_STATUS<br/>operator status<br/>[SYS_STATUS.md]"]
  node_n15["License<br/>legal"]
end

subgraph group_g3["Reference docs"]
  node_n13["Lexicon<br/>terminology ssot<br/>[lexicon.md]"]
  node_n14["Field report<br/>empirical notes"]
end

node_n2 -->|"describes"| node_n1
node_n1 -->|"defines"| node_n3
node_n1 -->|"exposes"| node_n4
node_n1 -->|"routes"| node_n5
node_n5 -->|"escalates"| node_n6
node_n5 -->|"formats"| node_n8
node_n6 -->|"permits"| node_n7
node_n7 -->|"collapses into"| node_n8
node_n8 -->|"optionally appends"| node_n9
node_n1 -->|"specifies"| node_n10
node_n11 -->|"checks"| node_n1
node_n12 -->|"reports"| node_n1
node_n13 -->|"clarifies terms"| node_n1
node_n14 -->|"evidences"| node_n1
node_n15 -->|"governs"| node_n2

click node_n1 "https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt"
click node_n2 "https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/README.md"
click node_n3 "https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt"
click node_n4 "https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt"
click node_n5 "https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt"
click node_n6 "https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt"
click node_n7 "https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt"
click node_n8 "https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt"
click node_n9 "https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt"
click node_n10 "https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt"
click node_n11 "https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/ADAM_SELF_TEST.md"
click node_n12 "https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/SYS_STATUS.md"
click node_n13 "https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/docs/lexicon.md"
click node_n14 "https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/docs/field-report-chat.md"
click node_n15 "https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/tree/main/LICENSE"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_n1,node_n2,node_n3,node_n4,node_n5,node_n6,node_n7,node_n8,node_n9 toneBlue
class node_n10,node_n11,node_n12,node_n15 toneAmber
class node_n13,node_n14 toneMint
```

## Components

### Protocol surface

Canonical spec and the runtime contract it defines.

- [A.D.A.M. v5](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt): canonical spec · Single authoritative protocol artifact; defines the live behavior surface. · `A.D.A.M.v5.txt`
- [README](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/README.md): entry guide · Explains the repo as v5-first and orients readers to the active protocol surface. · `README.md`
- [Handshake](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt): activation · Exact bootstrap trigger and session-start contract for the host. · `A.D.A.M.v5.txt`
- [Bootstrap class](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt): host state · Explicit host capability modes exposed during activation. · `A.D.A.M.v5.txt`
- [Router](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt): depth routing · Rule-ordered classifier that routes messages into LOW, MID, or DEEP. · `A.D.A.M.v5.txt`
- [DEEP gate](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt): consent gate · Two-step boundary that requires explicit yes before exhaustive reasoning. · `A.D.A.M.v5.txt`
- [State overlay](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt): workflow states · Internal progression such as EXPLORE, CONVERGE, DECIDE, and VERIFY. · `A.D.A.M.v5.txt`
- [Output contract](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt): reply format · Visible mode tag and strict response shape enforced on final answers. · `A.D.A.M.v5.txt`
- [Audit footer](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt): trace metadata · Optional bounded ACTION, RISK, and BASIS footer for accountability. · `A.D.A.M.v5.txt`

### Operational support

Bootstrap, self-check, and status artifacts used around the active protocol.

- [Fail closed](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/A.D.A.M.v5.txt): error contract · Unsupported-host behavior such as ADAM_UNSUPPORTED and recovery-oriented fallbacks. · `A.D.A.M.v5.txt`
- [ADAM_SELF_TEST](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/ADAM_SELF_TEST.md): operator check · Post-activation self-test and diagnostic artifact. · `ADAM_SELF_TEST.md`
- [SYS_STATUS](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/SYS_STATUS.md): operator status · Operator-facing status and recovery artifact for the active protocol. · `SYS_STATUS.md`
- [License](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/tree/main/LICENSE): legal · Repository licensing boundary. · `LICENSE`

### Reference docs

Supporting terminology and field notes that clarify the spec but do not drive runtime behavior.

- [Lexicon](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/docs/lexicon.md): terminology ssot · Controlled vocabulary that stabilizes protocol language. · `docs/lexicon.md`
- [Field report](https://github.com/xxyoudeadpunkxx/a.d.a.m.-adaptive-depth-and-mode/blob/main/docs/field-report-chat.md): empirical notes · Long-form examples and observed behavior from real chat sessions. · `docs/field-report-chat.md`

## Connections

- README → A.D.A.M. v5: describes · README positions the v5 spec as the active surface.
- A.D.A.M. v5 → Handshake: defines · The spec establishes the activation handshake.
- A.D.A.M. v5 → Bootstrap class: exposes · Bootstrap reveals host capability state.
- A.D.A.M. v5 → Router: routes · Message handling begins with depth classification.
- Router → DEEP gate: escalates · MID can transition into the explicit DEEP consent gate.
- Router → Output contract: formats · Routing selects the visible reply contract.
- DEEP gate → State overlay: permits · After consent, deeper internal workflow states may run.
- State overlay → Output contract: collapses into · Internal reasoning resolves into final output format.
- Output contract → Audit footer: optionally appends · Audit metadata is added only when needed.
- A.D.A.M. v5 → Fail closed: specifies · Unsupported or partial hosts are handled fail-closed.
- ADAM_SELF_TEST → A.D.A.M. v5: checks · Self-test validates the protocol after activation.
- SYS_STATUS → A.D.A.M. v5: reports · Status artifacts reflect runtime state, not activation.
- Lexicon → A.D.A.M. v5: clarifies terms · Lexicon stabilizes the language used by the spec.
- Field report → A.D.A.M. v5: evidences · Field report documents observed protocol behavior.
- License → README: governs · Repository license applies across the documentation set.
