Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/davide-desio-eleva/kirograph/llms.txt

Use this file to discover all available pages before exploring further.

KiroGraph-Mem gives AI agents a persistent, searchable memory layer that survives session boundaries. Every observation — a debugging decision, an architectural pattern, a known error — is compressed, linked to the code symbols it mentions, embedded for semantic search, and deduplicated via SHA-256. Future sessions surface relevant observations automatically inside kirograph_context and kirograph_impact results, without the agent needing to re-read source files.

Enabling Memory

Add enableMemory to .kirograph/config.json:
{
  "enableMemory": true
}
Once enabled, KiroGraph applies the memory schema to kirograph.db and registers all 16 memory tools with the MCP server.

How It Works

1

Content arrives

The agent calls kirograph_mem_store. KiroGraph strips any <private>…</private> blocks, then checks exclude patterns (memoryExcludePatterns).
2

Compression (if caveman mode is on)

The observation text is compressed with the caveman grammar — a deterministic, rule-based prose compressor. Zero LLM tokens spent. The original text is preserved alongside as content_raw when memoryKeepRaw: true.
3

Deduplication

A SHA-256 hash of the (compressed) content is computed. If an identical observation already exists in the database it is silently skipped.
4

Symbol linking

Identifiers in the observation text — CamelCase, snake_case, dot.notation — are matched against the code graph. Matching symbols are stored as stable qualified_name references in mem_symbol_links.
5

Embedding

The observation is embedded with the configured semantic engine (nomic-ai/nomic-embed-text-v1.5 by default). Enables natural-language search via kirograph_mem_search.
6

Auto-surfacing

When any subsequent call hits kirograph_context or kirograph_impact, KiroGraph queries linked observations for the symbols in scope. Matching observations above memoryContextThreshold are included — up to memoryContextLimit per call.
Write cost: ~0 extra LLM tokens. Search cost: ~150–350 tokens per query — compared to ~2,000–5,000 tokens to re-discover the same context by reading source files.

Observation Kinds

Every observation is tagged with a kind. Use the kind that best describes the nature of the information:
KindWhen to use
decisionAn architectural or implementation choice and its rationale
errorA bug, failure mode, or trap encountered during debugging
patternA recurring implementation pattern worth reinforcing
architectureA high-level structural note about the system
summaryA synthesis of multiple observations (used by Watchmen)
noteAnything that does not fit the above categories

MCP Tools

Memory requires enableMemory: true. The 16 tools add approximately ~746 tokens of tool descriptions to the model context.
Stores an observation in project memory.
ParameterTypeDefaultDescription
contentstringrequiredObservation text
kindstringnotedecision, error, pattern, architecture, summary, note
topicKeystringStable slug for deduplication, e.g. architecture/auth-model
reviewAfternumberUnix timestamp — surfaces observation in kirograph_mem_review after this date
projectPathstringcwdProject root path
Normal response: { "id": "obs_abc123" }. When Watchmen is enabled and the threshold is reached, the response also includes watchmenReady: true with synthesis instructions.
Hybrid FTS5 + vector search over all stored observations.
ParameterTypeDefaultDescription
querystringrequiredNatural-language search query
kindstringFilter by kind
limitnumber10Max results
sessionIdstringNarrow to a specific session
projectPathstringcwdProject root path
Lists recent sessions and their observations in chronological order.
ParameterTypeDefaultDescription
limitnumber5Number of sessions to show
sessionIdstringShow observations for a specific session only
projectPathstringcwdProject root path
Returns the health of the memory subsystem: session count, observation count, embedding coverage, model mismatch detection, and pending conflict count.
Establishes a typed relation between two observations. Accepts observation IDs or topic_key values. Creates a pending relation for agent review.
ParameterTypeDefaultDescription
observationAstringrequiredFirst observation ID or topic_key
observationBstringrequiredSecond observation ID or topic_key
relationstringrequiredsupersedes, conflicts_with, compatible, scoped, related, not_conflict
confidencenumber1.0Confidence score 0.0–1.0
reasonstringExplanation for the relation
Finalizes a pending conflict relation — confirm, revise, or dismiss it. Changes judgment_status from pending to judged.
ParameterTypeDefaultDescription
relationIdstringrequiredRelation ID from kirograph_mem_compare
relationstringrequiredFinal relation type
confidencenumberrequiredFinal confidence 0.0–1.0
reasonstringReasoning for the judgment
Lists observations past their review_after date — stale facts the agent should re-evaluate, update, or supersede. Reports days overdue per observation.
ToolPurpose
kirograph_mem_mark_reviewedClear an observation’s review_after date
kirograph_mem_captureExtract structured observations from a freeform text block with ## Key Learnings, ## Decisions, etc. sections
kirograph_mem_save_promptSave the current user prompt to session memory
kirograph_mem_suggest_topic_keyGet a deterministic slug for an observation based on kind + title
kirograph_mem_conflicts_scanScan recent observations for potential conflicts via FTS similarity
kirograph_mem_conflicts_listList pending conflict relations
kirograph_mem_conflicts_ignoreDismiss a pending conflict relation
kirograph_mem_lintCheck for stale links, model mismatches, and stale sessions
kirograph_mem_pruneRemove observations older than a given duration

Practical Workflow

The following shows a typical session cycle — an agent debugs a problem, stores what it learned, and future sessions benefit automatically.
1

Session 1: Agent debugs a rate-limit issue

After fixing a bug in RateLimiter.check, the agent stores its finding:
{
  "tool": "kirograph_mem_store",
  "content": "RateLimiter.check uses Redis EXPIRE not EXPIREAT — TTL resets on each write under burst traffic. Fixed by switching to EXPIREAT with absolute deadline.",
  "kind": "error"
}
KiroGraph links the observation to the RateLimiter.check symbol and embeds it.
2

Session 2: Agent works on AuthController

The agent calls kirograph_context for a task touching the auth flow. RateLimiter.check appears in the impact graph. KiroGraph automatically appends the stored observation to the context result — no extra tool call needed.
3

Ongoing: conflict detection

When two sessions produce conflicting notes about the same component, kirograph_mem_conflicts_scan surfaces them. The agent calls kirograph_mem_compare to classify the relation, then kirograph_mem_judge to finalize it.

Watchmen — Automatic Brief Synthesis

Watchmen is an opt-in synthesis layer that accumulates memory observations and automatically distills them into workspace briefs and skill files. It requires enableMemory: true.
{
  "enableMemory": true,
  "enableWatchmen": true,
  "watchmenThreshold": 5,
  "watchmenSynthesisMode": "local",
  "watchmenLocalModel": "onnx-community/gemma-4-E4B-it-ONNX"
}
After each kirograph_mem_store call, KiroGraph counts non-summary observations since the last kind: 'summary'. When the count reaches watchmenThreshold, the response includes a watchmenReady: true flag with targetFiles, skillTargetDir, and synthesis instructions. Synthesis modes:

local (default)

Runs onnx-community/gemma-4-E4B-it-ONNX on-device via @huggingface/transformers. No API key, no external calls. Works for all AI tools.

agent (Kiro only)

Delegates synthesis to the active AI agent via the askAgent hook. Higher output quality but consumes API tokens. Requires Kiro IDE.
What Watchmen writes:
  • Workspace brief — a ## KiroGraph Watchmen section upserted into the tool’s project memory file (.kiro/steering/kirograph-watchmen.md for Kiro, CLAUDE.md for Claude Code, AGENTS.md for others).
  • Skill files (Kiro only) — individual inclusion: manual steering files at .kiro/steering/watchmen-<slug>.md for recurring procedures. Files from previous synthesis runs are pruned when patterns change.
  • Summary observation — a kind: 'summary' observation stored to reset the counter.
Watchmen is experimental. Local synthesis quality varies significantly with the model and hardware. The default model (gemma-4-E4B-it-ONNX) requires a ~3–4 GB one-time download and ~3–5 GB RAM at inference. Expect 8–15 seconds on Apple Silicon M1+ and 30–60 seconds on Intel CPU. Use watchmenSynthesisMode: "agent" on Kiro for best results.

Hook-Based Capture

KiroGraph installs a kirograph-mem-capture.kiro.hook that fires at agentStop. It prompts the agent to review the session and store structured observations using ## Key Learnings, ## Decisions, ## Observations, or ## Key Changes headings — which kirograph_mem_capture then parses into typed observations automatically. This means observations are stored at the end of every session with no manual intervention, building up the memory store progressively over time.

Config Reference

FieldTypeDefaultDescription
enableMemorybooleanfalseEnable persistent cross-session memory
memorySearchAlphanumber0.5Blend weight for hybrid search (0 = FTS only, 1 = vector only)
memoryKeepRawbooleantrueStore original text alongside compressed version
memoryMaxObservationsnumber10000Max observations before auto-pruning oldest
memorySessionTimeoutnumber3600000Session timeout in ms (1 hour)
memoryContextLimitnumber3Max observations surfaced in kirograph_context
memoryContextThresholdnumber0.3Min relevance score to surface in context
memoryExcludePatternsstring[][]Glob patterns for files to exclude from symbol linking
enableWatchmenbooleanfalseEnable Watchmen brief synthesis (requires enableMemory)
watchmenThresholdnumber5Observations since last synthesis before watchmenReady fires
watchmenSynthesisModestringlocallocal (on-device model) or agent (Kiro only)
watchmenLocalModelstringonnx-community/gemma-4-E4B-it-ONNXHuggingFace model ID for local synthesis

Build docs developers (and LLMs) love