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.
Structured Knowledge Capture
Every note shares one schema and is tagged with a type, so context stays searchable and machine-readable.
Architecture Decision Record
Capture a significant architectural decision and its rationale.
Coding Standard
A coding convention or standard the codebase follows.
Optimization
Record a performance optimization and its impact.
Failure
A failure or mistake worth remembering to avoid repeats.
Best Practice
Documented best-practice guidance for the project.
Reflection
A reflection or retrospective on work done.
General
General knowledge note — the default type.
File Description
A description of a file's contents and purpose.
Modification
A record of a code modification.
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 bodysummaryOptional short summarypriorityInteger 1–10 (default 5); higher ranks firststatusactive, superseded, or archivedtagsOptional list of stringseffective_from / untilOptional validity windowstructured_data / metadataOptional JSON blobsHow 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.
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.
{}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 contentdevscriptor context showShow a single note by IDdevscriptor context deleteDelete a note by IDdevscriptor context pruneArchive notes older than N days (--max-age-days, --dry-run)devscriptor context entityList notes linked to a given entity typedevscriptor context conceptList notes linked to a concept