AI Memory

Context Graph
Long-Term Memory for AI Agents

A structured knowledge system that persists across sessions. Store architectural decisions, coding standards, and project context with 7 specialized note types.

Persistent Storage

Knowledge survives across AI sessions. No need to re-explain project context.

Structured Notes

7 note types with defined fields ensure consistent, searchable documentation.

Code Integration

Notes link directly to code. Changes are tracked and stale context is detected.

7 Note Types

Structured Knowledge Capture

Each note type has defined fields designed for specific use cases. This structure makes context searchable and machine-readable.

ADR

Architectural Decision Records

Document significant architectural decisions

Fields:

  • contextThe situation that led to this decision
  • decisionWhat was decided and why
  • consequencesExpected outcomes and trade-offs
  • alternativesOptions considered and rejected

Use: Record major design choices with full context and rationale

STANDARD

Coding Standards

Store coding conventions and style guides

Fields:

  • scopeWhere this standard applies
  • standardThe rule or convention
  • rationaleWhy this standard exists
  • enforcementHow to enforce or check compliance

Use: Maintain consistency across the codebase

OPTIMIZATION

Performance Optimizations

Record performance improvements

Fields:

  • problemPerformance issue identified
  • solutionOptimization applied
  • before_metricsPerformance before optimization
  • after_metricsPerformance after optimization

Use: Document performance wins and lessons learned

FAILURE

Lessons Learned

Document failures and prevention strategies

Fields:

  • errorWhat went wrong
  • causeRoot cause analysis
  • fixHow it was resolved
  • preventionHow to prevent recurrence

Use: Learn from mistakes and prevent future issues

REFACTOR

Refactoring Plans

Plan and track refactoring work

Fields:

  • targetWhat needs refactoring
  • reasonWhy refactoring is needed
  • approachHow to perform the refactoring
  • risksPotential issues and mitigation

Use: Structure complex refactoring efforts

TODO

Technical Debt

Track technical debt and pending work

Fields:

  • taskWhat needs to be done
  • priorityUrgency level (high/medium/low)
  • effortEstimated effort required
  • blockingWhat is blocking completion

Use: Manage pending tasks and known issues

QUESTION

Open Questions

Document open questions and investigations

Fields:

  • questionThe question being asked
  • contextBackground and relevance
  • attemptsWhat has been tried
  • answerResolution when found

Use: Track investigations and their outcomes

Key Features

How Context Graph Works

Advanced features that make Context Graph an essential tool for AI-assisted development.

File Context Workflow

Single-description-per-file pattern ensures each file has exactly one authoritative context note. AI queries get consistent, up-to-date information without redundancy.

Code Linking

Link notes to specific functions, classes, or files. Navigate seamlessly between context and code with automatic relationship tracking.

Stale Context Detection

System automatically flags when linked code changes. Know immediately when context notes may be outdated and need review.

Context-First Queries

AI queries Context Graph before Code Graph, dramatically reducing search space and improving response relevance.

MCP Tools

Context Management Tools

Three specialized MCP tools for adding, retrieving, and searching context notes.

add_context_note

Add a structured note to the context graph

{
  "file_path": "src/auth.rs",
  "note_type": "ADR",
  "content": "Implemented JWT authentication",
  "fields": {
    "context": "Need for stateless auth",
    "decision": "Use JWT tokens",
    "consequences": "Scalable but requires token refresh",
    "alternatives": "Session-based auth (rejected for scalability)"
  },
  "tags": ["auth", "security"]
}

get_context_notes

Retrieve context notes for files or the entire project

{
  "file_path": "src/auth.rs",
  "note_types": ["ADR", "TODO"],
  "include_stale": false
}

search_context

Search through context notes and memories

{
  "query": "authentication",
  "note_types": ["ADR", "STANDARD"],
  "tags": ["security"]
}
Example

Typical Workflow

1

AI makes an architectural decision

During development, AI decides to use a specific design pattern

2

Record with add_context_note (ADR)

Documents context, decision, consequences, and alternatives

3

Later sessions query get_context_notes

New AI sessions understand previous decisions without asking

4

search_context finds relevant notes

AI quickly locates relevant context when needed