Metadata-Version: 2.5
Name: context-graph-viewer
Version: 0.1.1
Summary: Read-only terminal viewer for a Context Graph: capture health, pipeline state, session anatomy and the knowledge graph
License: MIT
License-File: LICENSE
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Requires-Dist: memgraph-context-graph>=0.8.0
Requires-Dist: memgraph-toolbox
Requires-Dist: textual<9,>=8.2
Provides-Extra: test
Requires-Dist: actions-graph[memgraph-context-graph]>=0.5.0; extra == 'test'
Requires-Dist: pytest-asyncio>=0.26.0; extra == 'test'
Requires-Dist: pytest>=9.0.3; extra == 'test'
Requires-Dist: resources-graph[memgraph-context-graph]; extra == 'test'
Requires-Dist: sessions-graph[memgraph-context-graph]>=0.8.1; extra == 'test'
Description-Content-Type: text/markdown

# context-graph-viewer

A read-only terminal viewer for your Context Graph. It shows what your Claude Code / Codex hooks captured, whether
capture is failing, where reconciliation stands, and what the graph learned, without Cypher or Memgraph Lab.

```bash
memgraph-context-graph ui
```

It reads the same config file as the hooks (`CONTEXT_GRAPH_CONFIG`, else `~/.config/context-graph/config.toml`),
polls Memgraph every few seconds, and never writes to the graph.

## Install

`memgraph-context-graph setup` installs it unless you pass `--no-viewer`. It runs in the same tool environment as
`memgraph-context-graph`, so to add it by hand, add it to that tool's `uv tool install`:

```bash
uv tool install "memgraph-context-graph[mcp]" \
  --with "skills-graph[memgraph-context-graph]" \
  --with "actions-graph[memgraph-context-graph]" \
  --with "sessions-graph[memgraph-context-graph]" \
  --with context-graph-viewer
```

`context-graph-viewer` also installs its own command, which takes the same flags as `memgraph-context-graph ui`.

## Views

| View | Reached by | Shows |
|---|---|---|
| **Dashboard** | start | Sessions in scope, the pipeline (reconcile and embedding queues, extraction backend, ontology version, failures, capture tokens), capture health (the local capture-failure log plus hints from the graph), and new entities per day. |
| **Session** | `enter` on a session | The timeline with subagents folded under the call that spawned them, each action's input and the resources it touched, and what the session produced (chunks, entities, memory files). |
| **Entities** | `k` on the dashboard, `g` on a session | Entities merged by name, by support (how many sessions and memory files ground them) or most recent, with their provenance. |
| **Neighbourhood** | `enter` on an entity | One entity's relations grouped by type, with the evidence behind each. `enter` on a neighbour moves there; `esc` walks back. |

## Keys

| Key | Does |
|---|---|
| `a` | Widen the scope: your sessions → plus unattributed ones → everyone's |
| `p` | Narrow every view to one project (working directory) |
| `/` | Filter the table |
| `1`–`4` | Jump to a pane; `f` makes it fill the screen |
| `v` | Neighbourhood: relation tree or flat table |
| `+` / `-` | Neighbourhood: raise or lower the confidence floor |
| `h` / `s` | Entities: show value types (dates, amounts) / sort by most recent |
| `w` | Enterprise: next space this login can read |
| `r` | Refresh now |
| `?` | All keys |
| `esc` / `q` | Back / quit |

## Look

The viewer opens in Memgraph's brand: black surface, white text, grays for borders, and orange for focus, the
selected row, key hints and the timeline bars. Yellow, red and green appear only for warning, error and success.
The palette lives in `context_graph_viewer/theme.py`, and a test keeps views from naming a colour of their own.
`ctrl+p` opens Textual's command palette, where any built-in theme can replace it.

## Scope

By default you see your own sessions: `identity.user_id` in Community, your Memgraph login in Enterprise. Sessions
captured before a user was configured belong to nobody (reconcile files them under an `anon-…` user), so if the
dashboard opens empty, press `a`.

## Development

Tests run against a real Memgraph and drive the app headless:

```bash
./scripts/dev-memgraph.sh test context-graph-viewer
```
