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

Notes are stored across four tables (notes, an FTS5 index, and entity/concept links), created automatically at database initialization.

note_typeOne of the 9 types (default general)
title / contentRequired title and body
summaryOptional short summary
priorityInteger 1–10 (default 5); higher ranks first
statusactive, superseded, or archived
tagsOptional list of strings
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 devscriptor.db 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.

Pruning, Not Deletion

Pruning ages out stale knowledge by setting old notes to archived — history is preserved, never silently lost. Run with dry_run first to preview.

MCP Tools

5 Context Graph Tools

Five of Devscriptor's 31 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 a given entity type.

{
  "entity_type": "function",
  "max_content_length": 300
}

prune_context

Archive old notes (defaults to a safe dry run).

{
  "max_age_days": 90,
  "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 over note titles and content
devscriptor context showShow a single note by ID
devscriptor context deleteDelete a note by ID
devscriptor context pruneArchive notes older than N days (--max-age-days, --dry-run)
devscriptor context entityList notes linked to a given entity type
devscriptor context conceptList notes linked to a concept