scry

Agent memory you query in SQL. Markers in your files, indexed live, queryable cold. The disk is the database. The SQL is the cache.

What scry is

scry is for developers building and running long-lived AI coding agents — systems that work across many sessions on the same codebase, accumulating knowledge faster than any single session can hold.

scry is a marker-indexed knowledge graph for those agents. Every artifact the agent produces — a design, a decision, a lesson learned — carries a short structured note (a marker) written into the file itself. A background indexer turns every marker into a row in a small local SQLite cache. The problem this solves: an agent’s persisted knowledge grows unbounded across sessions, while any single session can only hold a finite slice in context. Without scry, a later session reads through code and reconstructs answers it cannot find; with scry, it asks a direct question in SQL and gets a direct answer.

A marker — written into the file itself
<!-- @scry.entry
id: design.auth-flow~9eb0fd7e
kind: design
summary: >
  JWT auth middleware. Also:
  bearer-token, refresh-flow.
tags: ["topic:auth", "auth"]
seeded_questions:
  - "What is the JWT refresh flow?"
@scry.entry.end -->
A later session asks. The index answers.
SELECT id, summary
FROM   scry__doc
WHERE  kind = 'design'
  AND  'topic:auth' IN (
    SELECT tag
    FROM   scry__doc_tag
    WHERE  doc_id = scry__doc.id
  );

Install — scry runs as an MCP server.

uv tool install scry-mcp

The problem

The preeminent problem in agentic coding and more broader agentic space in general is what is becoming known as the “agent context problem.”

The agent context problem: an agent’s persisted knowledge is unbounded and accrues across sessions, while the context available to it in any single session is finite. Because the precise knowledge a task requires cannot be fully determined before the task is under way, each session must approximate a selection-and-presentation function — which subset of the corpus — the full body of knowledge an agent has accumulated across sessions — to surface, and in what form — under a fixed budget in which omitting needed knowledge and admitting irrelevant knowledge are both costly.

Every point of information an agent could ever need in a future session can be captured — but what aspects of that knowledge to surface to an agent and how to surface it remain the lynchpin of the agent context problem. The scry marker specification attempts to address some of the surface of the agent context problem as it relates specifically to agentic coding.

Other attempts

The agent context problem is not new, and scry is not the first attempt at it. The approaches that came before each address a real part of it — and each leaves a different part unsolved.

Larger context windows. The simplest answer: make the budget bigger. But the corpus grows without bound while any window, however large, stays finite — and a larger window dilutes attention across more tokens, raising the cost of the irrelevant knowledge that gets admitted. A bigger budget moves the line; it does not remove it.

Retrieval-augmented generation. Embed the corpus, retrieve by vector similarity at query time. This is the closest prior art, and scry shares its instinct — surface a subset, not the whole. The gap is in how the subset is chosen. Similarity is not relevance: an embedding match returns what is near the query, not what answers it. The embedding space is opaque — you can rank neighbors but you cannot explain why one is nearer than another, which makes the retrieval step hard to audit and silently sensitive to embedding-model upgrades. Scry’s selection function lives in fields the agent authored at write time, in plain text, queryable by SQL — the same question always returns the same answer, and the reason is legible.

Hand-maintained memory files. A CLAUDE.md, an AGENTS.md, a notes file the agent reads at the start of every session. These work until the corpus outgrows the file: everything is loaded every time, relevant or not, and a human must curate what stays. The selection function is hand-curation — useful at small scale, but the file grows monotonically while the context budget does not. Selective imports and hierarchical loading buy time; they do not provide a query-time selection function.

Grep, and its modern extensions (ripgrep, Sourcegraph, ast-grep, LSP-driven navigation). Search the codebase directly. These are deterministic and need no model in the query path — the property scry inherits. What they lack is a meaning-shaped index: they find the files that contain a string or match a structural pattern, not the files that answer a question, and they cannot rank a load-bearing design note above an incidental mention.

Agent-memory tools. A newer category — mem0, MemGPT/Letta, Zep, the platforms’ own built-in memory features. These are scry’s nearest neighbors in product space: persistent stores for what an agent has learned, queried across sessions. The difference is where the work goes. Memory tools extract structure from raw text after the fact — consolidation passes, summarization, learned categories — which means the retrieval surface is shaped by a model, not by the agent that did the work. Scry inverts this: the agent shapes the surface at write time, in a marker it authors itself, indexed by SQL it can read. The selection function is explicit and editable; nothing learned sits between the agent and what it wrote.

Scry takes the deterministic, no-model retrieval of grep and gives it a curated, meaning-shaped index: markers authored to be found, indexed into a structured cache, queried in SQL. The selection function is explicit, the query path has no LLM in it, and the same question always returns the same answer.

Scry’s own cost is marker discipline. A file without a marker is invisible to the curated index; a marker whose fields no longer match the file’s content silently degrades recall. Both are caught only by the agent that uses the system. The trade is upfront authoring work for cheap, deterministic recall — worth it when the same knowledge is recalled across many sessions, not worth it for one-off or fast-changing state.

Scry’s answer

An agent is already producing the knowledge a future session will need — designs, decisions, lessons learned. Scry captures it at the moment it’s made: a short structured note — a marker — written into the file itself. A background indexer turns every marker into a row in a small local database. A later session doesn’t grep and hope; it asks a direct question and gets a direct answer.

Without scry

A new session needs to know why an earlier one chose the retry strategy it did. The reasoning lives in a design note from several sessions back — but nothing tells this session that note exists. It reads through the code, reconstructs an answer, and sometimes quietly contradicts the original decision.

With scry

The same session asks the marker index one question and the original note comes back — the decision, the reasoning, the file it lives in. No grep, no guessing, no re-derivation. It continues from where the last session left off.

The marker model

@scry.entry — in the file
<!-- @scry.entry
id: design.auth-flow~9eb0fd7e
kind: design
status: active
weight: 0.9
tags:
  - "topic:auth"
  - "auth"
summary: >
  JWT auth middleware, validates
  bearer tokens. Also: JWT,
  bearer-token, auth-guard,
  refresh-flow.
applies: adding protected
  endpoints, modifying auth
seeded_questions:
  - "What is the JWT refresh flow?"
  - "JWT bearer token validation"
@scry.entry.end -->
scry_sql — from another session
SELECT id, summary
FROM   scry__doc
WHERE  kind = 'design'
  AND  id IN (
    SELECT doc_id
    FROM   scry__doc_tag
    WHERE  tag = 'topic:auth'
  )
ORDER BY weight DESC;

-- or, full-text:
SELECT id, summary
FROM   scry__doc_fts
WHERE  scry__doc_fts MATCH
       'JWT refresh flow'
ORDER BY rank;

Scry markers are written for agents by agents. Every artifact an agent produces — a design, a spec, documentation, even a code file — carries a marker, written into the file itself and authored to be found: its summary, tags, and seeded questions shaped the way a later search will reach for them. Scry indexes those markers into a SQLite cache the next agent retrieves with a line of SQL — full-text-searched and deterministic. The hard choice — which knowledge is worth surfacing — is made once, at write time, by the agent that did the work; recall is just a query against what was already judged worth keeping.

Case studies

Reflection, a 100+ track autonomous substrate, runs scry in production. The numbers below are queried live from reflection’s own project.db at the time this page was deployed.

Marker corpus

2,707

curated @scry.entry markers across 10,115 indexed files. 2,674 files carry their own marker; the remainder are body-indexed only.

Searchable surface

17,663

tags on the corpus (3,716 unique), plus 8,415 seeded questions and 1,174 distinct topic: classifiers — each one a query an agent already shaped against future-itself.

Authoring throughput

198

markers minted by reflection’s sessions on a single day (2026-05-19). The graph grows by the work the system does, not by a separate documentation pass.

Shape of the corpus

kindcountwhat it is
report 2,013session-report records — what happened in a session and why
internal 267 runtime fixtures — track session files, control surfaces, contracts
design 127 current-truth design docs
pattern 107 canonical recipes — “the way to do Z”
spec 54 authoritative contracts
research 41 findings + sources from investigation sessions
code 40 code-file markers
task 24 discrete work items
lesson 22 “I tried X, here’s why it failed”
audit 7 conformance audits
milestone 4 phase markers

Source: reflection — the 100+ track autonomous substrate that developed and runs scry. Numbers are a live snapshot at deploy time.

scry was built using the substrate that uses it. The corpus above is what reflection has accumulated, addressed against itself, and recalled from across sessions; it is also the corpus the next reflection session will query before deciding what to do.

Try a marker

Paste an @scry.entry marker on the left. The parser runs in your browser and shows the structured row scry would insert into scry__doc. That row is what the next agent recalls with a single SQL query, in any session, indefinitely.

marker source
parsed row · scry__doc

The parser implements the same sentinel + comment-prefix-strip + YAML body rules as scry-parse. Edit the marker and the row updates live. The contract is plain enough that the entire scoped parser fits on this page; the production parser adds anchors, bindings, diagnostics, and FR-conformance coverage.

The query, end to end

Below is the same marker / SQL pair as above, expanded into a shape you can copy and run. The marker lives at the top of the file; the SQL runs against the SQLite cache scry init created in your project.

# In agent/design/auth-flow.md
<!-- @scry.entry
id: design.auth-flow~9eb0fd7e
kind: design
status: active
weight: 0.9
tags: ["topic:auth", "auth", "scope:runtime"]
summary: >
  JWT auth middleware, validates bearer tokens. Also:
  JWT, bearer-token, auth-guard, refresh-flow.
applies: adding protected endpoints, modifying auth
seeded_questions:
  - "What is the JWT refresh flow?"
  - "JWT bearer token validation"
@scry.entry.end -->

# In a future session, scry_sql:
SELECT d.id, d.summary
FROM   scry__doc d
JOIN   scry__doc_tag t ON t.doc_id = d.id
WHERE  t.tag = 'topic:auth'
  AND  d.status = 'active'
ORDER BY d.weight DESC;

The query returns whatever the marker index holds — zero rows, one, or many — keyed by the fields the author chose to expose. A marker that was never written when the artifact was produced leaves the artifact invisible to scry. The discipline lives at write time, not query time.

Install

  1. Install the MCP server.

    uv tool install scry-mcp
    # or:
    pip install scry-mcp
  2. Add scry to your agent’s MCP config.

    {
      "mcpServers": {
        "scry": {
          "command": "scry",
          "args": ["serve"]
        }
      }
    }
  3. Initialize scry in your project.

    cd path/to/your/project
    scry init

    A project.db appears in the working directory; the watcher begins indexing markers as files are saved.

The spec

scry-spec v1.1 — the versioned Scry Marker Contract. Defines the three marker kinds (@scry.entry, @scry.anchor, @scry.bind), the required and optional fields, and the resolution rules for binding references. Versioned independently from any implementation.

SQL is scry’s answer, not the spec’s mandate — scry-spec defines the marker; scry is the implementation that makes it queryable. A different implementation could index the same marker corpus into embeddings and serve recall by similarity; RAG, in that sense, is a possible implementation of the marker contract rather than a peer alternative to it.

Read scry-spec v1.1 →