DataMind Technology · ticketron-22 · Architecture companion

Live Context Graph

What is in the graph, how it is stored on Lakebase, how agents search it when picking up a spec — and what is still missing before that journey is real end-to-end.

Epic: ticketron-22 (27dcc424) Sibling: Ticketron SA HTML As-built: 09-as-built.md Updated: 2026-08-21

00 Verdict

The graph is a thin, typed index over work + code + docs + infra + occupancy, hosted in the same Lakebase database as Ticketron tickets, queried through the same MCP token. It returns keys and one-line facts; bodies stay in Git behind uri.

Live as of 2026-08-21 Dogfood seed ran against Lakebase via hosted MCP (scripts/seed_graph.py --via-mcp): ticketron 260 files / 113 edges · automaton 228 files · dmx-marketer 454 files. find_nodes returns real file/spec hits. Ticket→file get_slice neighborhoods still need implements/documents edges from judgment or ship (E1) — the inventory exists; the “one hop from ticket” walk is incomplete until those edges land.

01 What it is (and is not)

Primary win: fewer tokens and tool calls for planner / lead-engineer / orchestrator. Secondary: lineage (“what did this feature touch?”).

It is

  • Index-only MCP surface on Path B-hybrid (DB is system of record)
  • Closed ontology from migration 0005 — adding a kind means deleting one
  • Fact layer (deterministic indexer + pipeline) + judgment layer (summaries / legacy maps)
  • Same tenant RLS boundary as tickets

It is not

  • A dump of file or spec bodies
  • Markdown codebase-graph.md as the queryable SoR (seed corpus only)
  • Neo4j / BM25 / vector RAG (BM25 may enrich find_nodes later)
  • A second ticketing system — tickets stay in ticketron.ticket; graph holds a shadow

02 Physical structure

ticketron.*
thin tickets
→ shadow triggers →
graph.*
node · edge · event
indexer E0/E2
facts
upsert_*
Lakebase
SoR
get_slice
agent
then Read(uri)

Same DB · same MCP · same tenant token · migrations 0005/0006 · query db/queries/slice.sql

graph.node
id uuid · tenant_id · project_id · kind · natural_key · name · summary (one line) · uri · branch_state · lifecycle · attrs jsonb · valid_from / valid_to (NULL = current) · recorded_at
graph.edge
id · tenant_id · from_id → node · to_id → node · rel · provenance · attrs · validity interval
graph.event
id bigserial (poll cursor) · kind · subject_id · payload · expires_at

Default read plane: valid_to IS NULL AND lifecycle IN ('active','reference'). Archived material costs zero tokens by construction. RLS keys on app.current_tenant — the client never supplies tenant_id.

03 Nodes & edges (closed ontology)

Node kinds

KindNatural keyPrimary writer
ticket / releaseUUIDDB shadow triggers only
filerepo-relative pathE0 inventory; E2 fills attrs.key_symbols
spec / doc / runbookpathE0 frontmatter + path heuristics
asset / identity / datastore / …namedictionaries · postapply (names/IDs only)
worktree / agent_sessionpath / session idsession seams
symbolDeferred as nodes — store on file.attrs.key_symbols until blast-radius demands E3

Edge rels

RelMeaningTypical provenance
depends_onimport / build dep (file→file)fact · indexer E2
tested_bytests that gate a filefact · E2 / gate
implementsticket|spec → fileorchestrator ship · judgment for legacy
touchesticket|worktree changed fileorchestrator (git diff)
documentsdoc|spec explains file|specjudgment / seed
deployed_in / works_on / waits_on / …release & occupancyrelease-engineer · session
§5b write-permission rule Judgment provenance (seed / resync / human) may annotate facts, never create file/symbol nodes or depends_on/tested_by/touches edges. Fact stamps in practice: ticketron · orchestrator · postapply (there is no extractor enum value in 0005).

04 How search works today

Not a free-form graph query language. Three thin verbs, token-budgeted:

VerbJob
get_sliceDepth-limited (≤2) undirected neighborhood from a ticket id or anchor_key. Wraps db/queries/slice.sql. Returns id/kind/key/name/summary/uri/depth — never bodies, never attrs in the default projection.
find_nodesName / natural_key ILIKE match, optional kind, default lifecycle filter. BM25 later, same signature.
get_eventsPoll bigserial since cursor — ship signals, worktree open/close, dependency_cleared.

Contract (G3): call get_slice first; on miss / outage / staleness, grep. Then Read(uri) only for the shopping list.

get_slice(ticket_id) → { nodes: thin facts, uris }
        ↓
agent Read(uri) for selected bodies only
        ↓
optional: emit_event / ship writes touches+implements for lineage

05 Intended agent journey

#QuestionGraph answer
1What am I building?Ticketron get_ticket + shadow kind=ticket
2Where is the spec?ticket.spec_uri / spec node uri
3Which files implement it?implements / documents (needs E1 or judgment edges)
4What do those files depend on?depends_on depth 1–2 (E2 — seeded for ticketron)
5What tests gate them?tested_by
6Anyone else touching them?worktree / touches / works_on
7Deploy / assets?deployed_in, dictionary nodes, postapply harvest

06 Seed & refresh

Order: ticketron → automaton → dmx-marketer; stop before TAP.

# PowerShell — Lakebase through hosted MCP (no local APP_DATABASE_URL required)
$env:TICKETRON_TOKEN = [Environment]::GetEnvironmentVariable('TICKETRON_TOKEN','User')
$env:TICKETRON_MCP_URL = 'https://ticketron-mcp.livelypond-7bd06177.eastus2.azurecontainerapps.io/mcp'
uv run python scripts/seed_graph.py --via-mcp --dry-run
uv run python scripts/seed_graph.py --via-mcp

Direct-DB mode still works when APP_DATABASE_URL points at the Lakebase app role. Idempotent on (tenant, project, kind, natural_key). DQ heal: python -m graph_audit --project ticketron --repo ..

Front door Use /ticketron:init-graph (alias /ticketron:graph-seed) for first-time / rebuild seed. Use /ticketron:update-graph for path-scoped keepalive after commits. Optional Class-B Azure/tf harvest on init: --with-azure / --with-terraform plus automaton/docs/runbooks/init-graph-azure-tf-harvest.md.

07 Gap to the intended use

CapabilityState
Schema + verbs on hosted MCPShipped (G0–G1, G5)
Writer / reader seams in automatonShipped (G2–G3) — activate on live ships
Lakebase dogfood inventorySeeded 2026-08-21 — find_nodes works
Ticket → files in one hopIncomplete — need implements/documents edges
init-graph front doorShipped/ticketron:init-graph (alias /ticketron:graph-seed)
update-graph keepaliveShipped (V1)/ticketron:update-graph / python -m graph_update
With/without-graph benchmarkNot run
Web Graph Inventory pageNot built (V0.2 second surface)
G4 TAP pilotDeferred (won't fix now)

Binding ontology: ../datamind-automaton/automaton/docs/knowledge/07-graph-ontology-and-substrate-decision.md. Plan: solution-architecture-live-context-graph.md.

Ticketron Studio · Live Context Graph HTML · companion to solution-architecture-ticketron.html · epic ticketron-22