# anchorstate-lab/gmr architecture

> Architecture diagram of the GitHub repository anchorstate-lab/gmr, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anchorstate-lab/gmr
- Repository: https://github.com/anchorstate-lab/gmr

## Overview

GMR is a grounded-memory runtime: it watches declared coordinates, records readings and transitions, and lets callers retrieve drifting memories or test whether one-shot conclusions remain grounded. The principal CLI flow initializes and opens anchors, observes them during checks, and hands due memories back for review and acceptance. Separate runtime operations read and sample anchors, bind or ground claims, and preserve journaled state. The README documents these capabilities; unsampled command and runtime modules are represented at their exact enclosing paths, with only documented wiring shown.

Main entry points: [`crates/gmr-runtime/src/lib.rs`](https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-runtime/src/lib.rs) (Runtime API), [`console/core/src/lib.rs`](https://github.com/anchorstate-lab/gmr/blob/main/console/core/src/lib.rs) (Runtime assembly), [`packs/coding/extract/src/lib.rs`](https://github.com/anchorstate-lab/gmr/blob/main/packs/coding/extract/src/lib.rs) (Coding probes), [`crates/gmr-store/src/sqlite/mod.rs`](https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-store/src/sqlite/mod.rs) (SQLite store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["GMR CLI<br/>[main.rs]"]
  node_commands["Commands"]
  node_sdk["Node and Python SDKs<br/>[lib.rs]"]
  node_assembly["Runtime assembly<br/>[lib.rs]"]
end

subgraph group_runtime["Grounding runtime"]
  node_runtime["Runtime API<br/>[lib.rs]"]
  node_observe["Observe and check<br/>[observe.rs]"]
  node_read["Read and ground<br/>[read.rs]"]
  node_memory["Memory bindings<br/>[memory.rs]"]
  node_links["Claim links<br/>[link.rs]"]
  node_expressions["Invariant evaluation<br/>[eval.rs]"]
end

subgraph group_evidence["Evidence probes"]
  node_probe_dispatch["Probe dispatch<br/>[lib.rs]"]
  node_coding_probes["Coding probes<br/>[lib.rs]"]
  node_shapes["Drift rules<br/>[lib.rs]"]
end

subgraph group_state["Persistent state"]
  node_sqlite[("SQLite store<br/>[mod.rs]")]
  node_core_model["Anchors and journal<br/>[lib.rs]"]
end

subgraph group_integrations["Content integrations"]
  node_providers["Content providers<br/>[lib.rs]"]
end

node_person(("Person or agent"))
node_project["Project files"]

node_person -->|"runs commands"| node_cli
node_cli -->|"dispatches"| node_commands
node_commands -->|"calls runtime"| node_assembly
node_person -->|"calls SDK"| node_sdk
node_sdk -->|"opens runtime"| node_assembly
node_assembly -->|"assembles"| node_runtime
node_assembly -->|"opens store"| node_sqlite
node_assembly -.->|"registers providers"| node_providers
node_runtime -->|"dispatches checks"| node_observe
node_runtime -->|"dispatches reads"| node_read
node_runtime -->|"uses bindings"| node_memory
node_runtime -->|"uses links"| node_links
node_runtime -->|"evaluates invariants"| node_expressions
node_observe -->|"requests observations"| node_probe_dispatch
node_probe_dispatch -->|"routes coordinates"| node_coding_probes
node_coding_probes -->|"reads source"| node_project
node_coding_probes -->|"supplies observations"| node_shapes
node_runtime -->|"reads and writes state"| node_sqlite
node_sqlite -->|"persists domain state"| node_core_model
node_read -.->|"fetches stored content"| node_providers

click node_cli "https://github.com/anchorstate-lab/gmr/blob/main/console/cli/src/main.rs"
click node_commands "https://github.com/anchorstate-lab/gmr/tree/main/console/cli/src/verbs"
click node_sdk "https://github.com/anchorstate-lab/gmr/blob/main/console/node/src/lib.rs"
click node_assembly "https://github.com/anchorstate-lab/gmr/blob/main/console/core/src/lib.rs"
click node_runtime "https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-runtime/src/lib.rs"
click node_observe "https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-runtime/src/observe.rs"
click node_read "https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-runtime/src/read.rs"
click node_memory "https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-runtime/src/memory.rs"
click node_links "https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-runtime/src/link.rs"
click node_expressions "https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-expr/src/eval.rs"
click node_probe_dispatch "https://github.com/anchorstate-lab/gmr/blob/main/batteries/transport/src/lib.rs"
click node_coding_probes "https://github.com/anchorstate-lab/gmr/blob/main/packs/coding/extract/src/lib.rs"
click node_shapes "https://github.com/anchorstate-lab/gmr/blob/main/packs/coding/shapes/src/lib.rs"
click node_sqlite "https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-store/src/sqlite/mod.rs"
click node_core_model "https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-core/src/lib.rs"
click node_providers "https://github.com/anchorstate-lab/gmr/blob/main/batteries/provider/src/lib.rs"

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_cli,node_commands,node_sdk,node_assembly toneBlue
class node_runtime,node_observe,node_read,node_memory,node_links,node_expressions toneAmber
class node_probe_dispatch,node_coding_probes,node_shapes toneMint
class node_sqlite,node_core_model toneRose
class node_providers,node_person,node_project toneIndigo
```

## Components

### User interfaces

- [GMR CLI](https://github.com/anchorstate-lab/gmr/blob/main/console/cli/src/main.rs): `console/cli/src/main.rs`
- [Commands](https://github.com/anchorstate-lab/gmr/tree/main/console/cli/src/verbs): `console/cli/src/verbs`
- [Node and Python SDKs](https://github.com/anchorstate-lab/gmr/blob/main/console/node/src/lib.rs): `console/node/src/lib.rs`
- [Runtime assembly](https://github.com/anchorstate-lab/gmr/blob/main/console/core/src/lib.rs): `console/core/src/lib.rs`

### Grounding runtime

- [Runtime API](https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-runtime/src/lib.rs): `crates/gmr-runtime/src/lib.rs`
- [Observe and check](https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-runtime/src/observe.rs): `crates/gmr-runtime/src/observe.rs`
- [Read and ground](https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-runtime/src/read.rs): `crates/gmr-runtime/src/read.rs`
- [Memory bindings](https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-runtime/src/memory.rs): `crates/gmr-runtime/src/memory.rs`
- [Claim links](https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-runtime/src/link.rs): `crates/gmr-runtime/src/link.rs`
- [Invariant evaluation](https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-expr/src/eval.rs): `crates/gmr-expr/src/eval.rs`

### Evidence probes

- [Probe dispatch](https://github.com/anchorstate-lab/gmr/blob/main/batteries/transport/src/lib.rs): `batteries/transport/src/lib.rs`
- [Coding probes](https://github.com/anchorstate-lab/gmr/blob/main/packs/coding/extract/src/lib.rs): `packs/coding/extract/src/lib.rs`
- [Drift rules](https://github.com/anchorstate-lab/gmr/blob/main/packs/coding/shapes/src/lib.rs): `packs/coding/shapes/src/lib.rs`

### Persistent state

- [SQLite store](https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-store/src/sqlite/mod.rs): `crates/gmr-store/src/sqlite/mod.rs`
- [Anchors and journal](https://github.com/anchorstate-lab/gmr/blob/main/crates/gmr-core/src/lib.rs): `crates/gmr-core/src/lib.rs`

### Content integrations

- [Content providers](https://github.com/anchorstate-lab/gmr/blob/main/batteries/provider/src/lib.rs): `batteries/provider/src/lib.rs`

### Other components

- **Person or agent**
- **Project files**

## Connections

- Person or agent → GMR CLI: runs commands
- GMR CLI → Commands: dispatches
- Commands → Runtime assembly: calls runtime
- Person or agent → Node and Python SDKs: calls SDK
- Node and Python SDKs → Runtime assembly: opens runtime
- Runtime assembly → Runtime API: assembles
- Runtime assembly → SQLite store: opens store
- Runtime assembly → Content providers: registers providers
- Runtime API → Observe and check: dispatches checks
- Runtime API → Read and ground: dispatches reads
- Runtime API → Memory bindings: uses bindings
- Runtime API → Claim links: uses links
- Runtime API → Invariant evaluation: evaluates invariants
- Observe and check → Probe dispatch: requests observations
- Probe dispatch → Coding probes: routes coordinates
- Coding probes → Project files: reads source
- Coding probes → Drift rules: supplies observations
- Runtime API → SQLite store: reads and writes state
- SQLite store → Anchors and journal: persists domain state
- Read and ground → Content providers: fetches stored content
