sqlite-graph-memory AGENTS.md

A set of instructions for a small memory system built with Python and SQLite. It stores searchable notes, manually linked associations, per-turn records, and comparison data for testing memory retrieval.

In plain words
What is it for?
Use it when changing note indexing, memory searches, linked-note expansion, retrieval comparisons, or the hook that records each agent turn.
Why use it?
It tells coding agents how this personal second-brain system is organized and how to check changes without treating it as a large framework. It also documents the limits and deliberately minimal design.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/tonydzi/sqlite-graph-memory/agents-md
Clone the repo
git clone --depth 1 https://github.com/tonydzi/sqlite-graph-memory

Made for: Codex, OpenCode.

Per session 939 This file is loaded in full into every session.
When invoked 939 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00939 $0.00939
Opus 5 $0.00469 $0.00469
Sonnet 5 $0.00188 $0.00188
Haiku 4.5 $0.00094 $0.00094

Measured 2d ago against content hash f0bd7c7d23e5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sqlite-graph-memory AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 73 lines

How it starts

The opening of the file, as written. The whole thing — 73 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md — working in this repo

Written for AI coding agents, and equally readable by a human contributor. Short on purpose.

What this repo is

The extracted memory layer of a personal second-brain agent setup: vector retrieval for entry points, hand-curated [[wikilinks]] for association, a cross-encoder rerank, and SQLite for the only two things worth persisting — a per-turn ledger and A/B telemetry.

Status: pilot. It runs daily in one real setup and it is deliberately minimal. It is not a framework and should not grow into one. The interesting claim here is what it does not need: no graph database, no ETL, no entity-extraction pass.

Stack and layout

  • Python + SQLite (stdlib driver). requirements.txt covers the embedding/rerank models only.
  • index_notes.py — chunk + embed a markdown folder (e5-base) into a .npy/.pkl index.
  • brain_ask.py — the recall pipeline: dense retrieve → optional --graph 1-hop wikilink expansion → cross-encoder rerank → top-12. --ab runs vector-only and vector+graph, diffs them, and logs the delta to SQLite.
  • turnstate_hook.py — agent Stop-hook; appends one row per assistant turn. Zero tokens, pure stdlib. turnstate_show.py is the read-only viewer.
  • schema.sql — documents both tables (turns, ab_recall).
  • examples/claude-code-stop-hook.json — how the hook gets wired.

How to verify a change

There is no test suite yet — that is a known gap with an open issue, and closing it is welcome work. Until then, a change is verified by running it and pasting the output:

python index_notes.py <folder-of-markdown>     # build an index over a small sample
python brain_ask.py "<question>" --graph       # recall, with graph expansion
python brain_ask.py "<question>" --ab          # both arms + the logged delta
python turnstate_show.py                       # what the ledger captured

Use a synthetic notes folder — five or six files with a couple of [[wikilinks]] between them is enough to show a behaviour change. Never paste real notes into an issue or PR.

Read the full file on GitHub · 73 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 73 lines · 939 tokens per session scan A f0bd7c7d23e5

Subscribe to this mod's changes

sqlite-graph-memory AGENTS.md is an instructions file published in the GitHub repository tonydzi/sqlite-graph-memory (4 stars, last pushed 3d ago), licensed MIT. It adds 939 tokens to every session, about $0.0047 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

causal-memory CLAUDE.md

Instructions for JingxuanC/causal-memory, covering causal memory mcp integration, causal memory integration, after acting on a decision and observing the result, when something fails unexpectedly and when a recorded lesson turns out to be wrong.

JingxuanC/causal-memory · 511 tokens

kernel-claude AGENTS.md

Instructions for ariaxhan/kernel-claude, a project described as: Claude Code learns from itself. Persistent memory, multi-agent orchestration, and a scientific experiment engine that proves which rules actually work.

ariaxhan/kernel-claude · 6,558 tokens

aios CLAUDE.md

Instructions for sublimecoder/aios, covering claude — ai os entry point, start here, every session, scopes, strict separation (optional — off by default) and global rules (the contract).

sublimecoder/aios · 1,610 tokens

kernel-claude CLAUDE.md

Instructions for ariaxhan/kernel-claude, a project described as: Claude Code learns from itself. Persistent memory, multi-agent orchestration, and a scientific experiment engine that proves which rules actually work.

ariaxhan/kernel-claude · 6,566 tokens

obsidian-llm-hub AGENTS.md

Instructions for takeshy/obsidian-llm-hub, a project described as: Obsidian plugin for AI chat, workflow automation, and semantic search — supports Gemini, OpenAI, OpenRouter, Grok, Ollama, and CLI backends.

takeshy/obsidian-llm-hub · 44 tokens

inkwell-memory CLAUDE.md

Instructions for veronchenko/inkwell-memory, covering claude.md — inkwellmemory, layout, multi-tenant mode (inkwellmultitenant=1), conventions and testing.

veronchenko/inkwell-memory · 2,378 tokens