AI Memory

Context Graph
Long-Term Memory for AI Agents

A persistent, queryable store of notes — decisions, standards, optimizations, reflections — that an agent records about a codebase and recalls in later sessions, linked to the code entities and concepts they describe.

Persistent Storage

Knowledge survives across AI sessions in the same local database. No re-explaining project context.

9 Note Types

Structured types with a shared schema keep documentation consistent and searchable.

Code Integration

Notes link to entities and concepts, so an agent can retrieve what it knows about a function or module.

9 Note Types

Structured Knowledge Capture

Every note shares one schema and is tagged with a type, so context stays searchable and machine-readable.

adr

Architecture Decision Record

Capture a significant architectural decision and its rationale.

standard

Coding Standard

A coding convention or standard the codebase follows.

optimization

Optimization

Record a performance optimization and its impact.

failure

Failure

A failure or mistake worth remembering to avoid repeats.

practice

Best Practice

Documented best-practice guidance for the project.

reflection

Reflection

A reflection or retrospective on work done.

general

General

General knowledge note — the default type.

file_description

File Description

A description of a file's contents and purpose.

modification

Modification

A record of a code modification.

Note Anatomy

One Shared Schema

Five tables hold the notes: the notes themselves, an FTS5 index, their entity and concept links, and their embeddings for semantic search — created automatically with the database.

note_typeOne of the 9 types (default general)
title / contentRequired title and body
summaryOptional short summary
authorDefaults to agent
priorityInteger 1–10 (default 5); higher ranks first
statusactive, superseded, or archived (new notes are active)
tagsOptional list of strings
created_at / updated_atTimestamps, set automatically
effective_from / untilOptional validity window
structured_data / metadataOptional JSON blobs
Key Features

How Context Graph Works

Same Local SQLite Database

Notes live in the same database as the code graph — persisting across sessions and processes, with no separate setup. This is what makes it long-term memory.

Linked to Code & Concepts

Attach a note to concrete entities (by type/name/file) or to abstract concepts and patterns, then recall "what do I know about this?" by association later.

Keyword, Semantic & Hybrid Search

search_context runs keyword, vector-semantic, or RRF-fused hybrid search, with optional note_type, status, and min_priority filters. A search of the code names the notes its query matches, up to three, in context_notes, so an agent knows when the Context Graph has something to say without asking.

Pruning, Previewed First

Pruning archives the active notes not updated within a window (90 days by default), and deletes those left archived for more than twice it; max_notes caps the active notes kept. prune_context only previews until you pass dry_run: false.

MCP Tools

5 Context Graph Tools

Five of Devscriptor's 32 core MCP tools manage the Context Graph.

add_context_note

Create a note, optionally linked to code entities and concepts.

{
  "note_type": "adr",
  "title": "Use rustls instead of OpenSSL",
  "content": "All HTTPS goes through rustls...",
  "tags": ["tls", "dependencies"],
  "priority": 8,
  "related_entities": [
    { "entity_type": "function",
      "entity_name": "build_http_client",
      "file_path": "src/net.rs" }
  ]
}

search_context

Keyword / semantic / hybrid search over notes, with filters.

{
  "query": "auth token verification",
  "search_type": "hybrid",
  "note_type": "adr",
  "top_k": 5
}

get_related_context

Retrieve notes linked to an entity type, optionally narrowed to one name and file.

{
  "entity_type": "function",
  "entity_name": "verify_token",
  "file_path": "src/auth.rs"
}

prune_context

Archive old and surplus notes and delete long-archived ones (a dry run by default).

{
  "max_age_days": 180,
  "max_notes": 500,
  "dry_run": true
}

get_context_statistics

Totals, counts by type, and average priority.

{}
CLI

devscriptor context

The same Context Graph is available from the command line.

devscriptor context addAdd a note (--title, --content, --note-type, --entities, --entity-type)
devscriptor context listList notes with pagination (--limit, --offset)
devscriptor context searchKeyword search, as search_context’s keyword strategy (--limit)
devscriptor context showShow a single note by ID
devscriptor context deleteDelete a note by ID
devscriptor context pruneArchive notes not updated in N days, and delete those archived for twice that (--max-age-days, --dry-run)
devscriptor context entityList notes linked to a given entity type
devscriptor context conceptList notes linked to a concept