braindb-agent

A persistent memory service that lets an agent recall information across conversations and save new information for later. It runs as a local BrainDB API service.

In plain words
What is it for?
Use it to retrieve relevant stored facts at the start of work and record new facts in long-term memory.
Why use it?
It prevents useful context about the user or project from being lost when a session ends.

Skill for Claude CodeCodex

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 skills/dimknaf/braindb/braindb-agent
Any agent
npx skills add dimknaf/braindb --skill braindb-agent
Clone the repo
git clone --depth 1 https://github.com/dimknaf/braindb

Made for: Claude Code, Codex.

Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,083 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00040 $0.03083
Opus 5 $0.00020 $0.01541
Sonnet 5 $0.00008 $0.00617
Haiku 4.5 $0.00004 $0.00308

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

Security

Grade A, and why

braindb-agent scanned grade A with 1 finding 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

!`curl -sf http://localhost:8000/health > /dev/null 2>&1 && echo "OK" || echo "BRAINDB_DOWN"`
skills/braindb-agent/SKILL.md · 242 lines

How it starts

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

BrainDB Memory Agent

BrainDB has its own internal agent (LiteLLM with pluggable provider via LLM_PROFILE; defaults to deepinfra/google/gemma-4-31B-it) that handles all memory operations. You don't call individual endpoints — you ask the agent in plain English via one endpoint: POST http://localhost:8000/api/v1/agent/query.

Health check:

!curl -sf http://localhost:8000/health > /dev/null 2>&1 && echo "OK" || echo "BRAINDB_DOWN"

If the output contains BRAINDB_DOWN, the memory database is not running. Do this:

  1. Ask the user: "BrainDB isn't running. Do you want me to start it for you?"
  2. Find the braindb repo — look for a directory that has ALL of these:
    • docker-compose.yml at the root
    • braindb/main.py
    • pyproject.toml with name = "braindb" Search in: current dir, parent dirs (up to 3 levels), common locations like ~/source/repos/**/braindb/.
  3. Start it: cd <braindb-path> && docker compose up -d
  4. Cache the path: echo "<braindb-path>" > ~/.claude/skills/braindb-agent/.repo_path
  5. Wait for it: poll curl -sf http://localhost:8000/health for up to 30 seconds.
  6. If healthy, proceed. If the user declines or start fails, proceed WITHOUT memory.

TOOL PRIORITY (read this first)

The agent has a clear order of tools it should reach for. When you phrase a request, lean into the sophisticated tools — don't ask it to "run SQL" for anything to do with recall or understanding.

  1. Query-driven recall"what do we know about X?" → the agent calls /memory/context (keyword-mediated fuzzy + embedding + graph + ranking, with diversity quotas). The default for ALL discovery and understanding.
  2. Entity-driven neighbourhood — the agent's view_tree returns a nested JSON tree (root keyed by entity_type, children arrays per node, 1-N hops out, keyword + retired-wiki noise filtered by default, _truncated marker if more remain). Especially useful when an entity ID is already in hand — often sharper than another query about the same entity. On hub entities pass max_depth=3 for narrative chains.
  3. Multi-step investigation"investigate / disambiguate / resolve X" → the agent delegates to a subagent. Keeps the main context clean.
  4. Direct lookupsview_entity_relations, get_entity, list_entities for narrow questions.
  5. search_sql ⚠ exception only — for explicit aggregates (counts, GROUP BY, activity-log joins). Never for finding / understanding / "what's related to" — those are jobs for the tools above.

Read the full file on GitHub · 242 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 · 242 lines · 40 tokens per session scan A 92296a586c4a

Subscribe to this mod's changes

braindb-agent is a skill published in the GitHub repository dimknaf/braindb (107 stars, last pushed 12d ago), licensed Apache-2.0. It adds 40 tokens to every session and 3,083 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

docx

Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). For CREATING new documents (report, memo, letter, résumé, contract from scratch), call the built-in tool renderDocx instead — it renders Markdown to .docx in milliseconds without forking Node.js. This skill…

mateaix/mateclaw · 152 tokens

pdf

Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and…

mateaix/mateclaw · 92 tokens

skill-authoring

Author SKILL.md skills: frontmatter, validator limits, structure.

mateaix/mateclaw · 18 tokens

systematic-debugging

4-phase root cause debugging: understand bugs before fixing.

mateaix/mateclaw · 16 tokens

gzh_article

公众号图文创作 / 推文 / 官方号文章 (official account article) — 端到端:选题→搜集→成文→配图→去AI化→公众号内联样式排版→交付/草稿箱。honors user persona & style memory.

mateaix/mateclaw · 66 tokens

pptx

Use this skill any time a .pptx file is involved in any way - as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx file; editing, modifying, or updating existing presentations; combining or splitting slide files; working with…

mateaix/mateclaw · 103 tokens