brainiac

A command interface for searching and managing Brainiac, a knowledge graph that stores connected project learnings. A knowledge graph represents information as nodes and relationships between them.

In plain words
What is it for?
For searching, adding, linking, consolidating, rendering, and checking the quality of knowledge-graph entries using the listed subcommands.
Why use it?
It gives a controlled set of commands for finding past knowledge, recording new learnings, connecting related items, and checking graph quality.

Command for Claude Code

Part of the cortex plugin — 1 skill, 15 commands, 3 agents, 5 hooks, 2 MCP servers shipped together

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 commands/peaky8linders/claude-cortex/brainiac
Clone the repo
git clone --depth 1 https://github.com/Peaky8linders/claude-cortex

Made for: Claude Code.

Or install cortex, the plugin that ships this one along with the rest of its 1 skill, 15 commands, 3 agents, 5 hooks, 2 MCP servers.

Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 404 The whole file, excluding the scripts and references it only reads on demand.
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.00009 $0.00404
Opus 5 $0.00005 $0.00202
Sonnet 5 $0.00002 $0.00081
Haiku 4.5 $0.00001 $0.00040

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

Security

Grade A, and why

brainiac 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 3d 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.

.claude/commands/brainiac.md · 43 lines

What it actually says

/brainiac — Query and Manage the Knowledge Graph

You interact with the Brainiac knowledge graph engine. The graph stores all cross-project learnings as interconnected nodes with semantic, temporal, causal, and entity edges.

System Location

  • Engine: ~/.claude/knowledge/brainiac/
  • Graph data: ~/.claude/knowledge/graph/ (nodes.json, edges.json, embeddings.npz)
  • Views: ~/.claude/knowledge/views/ (auto-generated markdown)

Command

Parse the user's message after /brainiac and run the appropriate command.

Important: Only accept these known subcommands: search, stats, add, link, consolidate, render, quality. Reject any other input to prevent command injection.

cd ~/.claude/knowledge && python -m brainiac <subcommand> [args]

Available Operations

If no arguments provided, show this help:

  • search "QUERY" — Semantic search across all nodes
  • stats — Graph overview (node counts, edge counts, quality)
  • add <type> "content" — Add node (types: pattern, antipattern, workflow, hypothesis, solution, decision)
  • link <id1> <id2> <relation> — Link nodes (relations: semantic, temporal, causal, entity)
  • consolidate — Find merge/prune candidates
  • render — Regenerate markdown views
  • quality — Get quality score (0-100)

When to Use

  • Before starting work: search for relevant patterns or solutions
  • During debugging: search for known solutions
  • When making architecture decisions: search for prior decisions
  • When reviewing: check antipatterns
  • Periodically: run consolidate to keep the graph healthy
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. 3d ago First seen · 43 lines · 9 tokens per session scan A 84caef92579a

Subscribe to this mod's changes

brainiac is a command published in the GitHub repository Peaky8linders/claude-cortex (11 stars, last pushed 2mo ago), licensed MIT. It adds 9 tokens to every session and 404 once invoked, about $0.0000 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-30.