Brain Graph is a local-first research vault for growing a structured paper graph with raw/ intake notes, curated wiki/ notes, and exported graph artifacts.
- A Python CLI for creating notes, discovering papers, compiling raw material, linting links, and exporting the graph.
- An Obsidian-friendly vault layout with
raw/,wiki/,views/, andshared/. - A seeded agent-security corpus imported from a local PDF folder, so the graph already contains connected paper, concept, and map notes.
cd /Users/mijiatong/Code/brain-graph
python -m brain_graph.cli import-paper --pdf /Users/me/Desktop/papers/foo.pdf
python -m brain_graph.cli compile-paper --slug foo
python -m brain_graph.cli compile-batch --source raw/papers
python -m brain_graph.cli discover-papers --query "prompt injection" --provider both --limit 5
python -m brain_graph.cli research-loop --query "agent defense" --provider both --limit 5
python -m brain_graph.cli lint
python -m brain_graph.cli export-graphThis writes the current graph to:
exports/brain_graph.jsonexports/brain_graph.mmd
Create a new structured wiki note:
python -m brain_graph.cli new-note --type paper --title "MemoryGraft" --id paper-memorygraftIngest a raw source note:
python -m brain_graph.cli ingest-raw --kind paper --slug memorygraft --title "MemoryGraft" --summary "Imported from a local PDF or clip."Import a paper into the P0 pipeline:
python -m brain_graph.cli import-paper --pdf /Users/me/Desktop/papers/foo.pdf
python -m brain_graph.cli import-paper --url https://arxiv.org/abs/2512.16962 --title "MemoryGraft"Compile one imported paper:
python -m brain_graph.cli compile-paper --slug foo
python -m brain_graph.cli compile-paper --slug foo --compiler openrouter --model openai/gpt-4.1-miniCompile the queue in batch:
python -m brain_graph.cli compile-batch --source raw/papers --limit 20
python -m brain_graph.cli compile-batch --source raw/papers --compiler openrouter --model openai/gpt-4.1-miniDiscover papers from remote scholarly sources and import them into raw/:
python -m brain_graph.cli discover-papers --query "prompt injection" --provider both --limit 10Run the end-to-end research loop:
python -m brain_graph.cli research-loop --query "agent defense" --provider both --limit 10Check structural consistency:
python -m brain_graph.cli lintExport the graph:
python -m brain_graph.cli export-graphRun tests:
pytest -qraw/: append-only source captures grouped by kind, such aspapers/,clips/, andmetadata/.wiki/: curated graph notes grouped by node type, such aspapers/,concepts/,methods/,gaps/,authors/, andmaps/.views/: derived views and graph-facing artifacts, including canvas and dataview output.shared/research.md: shared research notes and cross-cutting context for the graph.exports/: machine-readable graph exports for downstream tooling.
The repository now includes an initial graph grown from a local agent-security PDF corpus. The first pass adds:
wiki/papers/seed notes for the imported paperswiki/concepts/seed concepts such asPrompt Injection,Red Teaming, andAgent Benchmarkswiki/maps/Agent Security Seed Corpus.mdas an overview note that links the initial clusters togetherraw/papers/intake notes that record the imported PDF filenames without copying the PDFs into the repo
These links are intentionally heuristic. They are meant to make the graph usable immediately, then be refined as you read and curate the notes.
- Import a local PDF or paper URL into
raw/. - Inspect the generated raw note and metadata sidecar in
raw/papers/andraw/metadata/papers/. - Compile one paper into structured
wiki/papers/and linkedwiki/concepts/. - Run batch compilation to process the remaining imported queue.
- Open
views/canvas/starter.canvasin Obsidian to see the refreshed graph.
- Discover fresh papers into
raw/withdiscover-papers. - Compile one paper or a batch with richer graph generation for
concept,method,gap, andauthornotes. - Let batch compile refresh topical maps such as
Attack Paper MapandSystem Paper Map. - Use
research-loopto chain discovery, compile, graph export, and a summary append toshared/research.md. - Open the generated maps and
views/canvas/starter.canvasin Obsidian.
OPENROUTER_API_KEY: required only when using--compiler openrouterSEMANTIC_SCHOLAR_API_KEY: optional future-proof slot for Semantic Scholar higher-rate access