Skip to main content

Featured work

braincore getbraincore.com

Local-first cognitive memory for AI coding agents. Attention, decision graph, the right to say I don't know.

  • Go 1.25
  • SQLite
  • MCP
  • tree-sitter
  • internal git
  • pluggable LLM

The problem

total-agent-memory is a Python service. That’s fine for a research stack, terrible for a binary I want to ship to friendlies. braincore is the same idea rebuilt in Go: 21 MB stripped, pure Go, zero CGO, one artefact.

What’s inside

  • Memory pillars — episodic, skills, intents, workflow, reflection.
  • Cognitive bridge — associations, analogies (Dempster-Shafer fusion), contradictions, temporal queries.
  • Code-graph — Go AST + tree-sitter + a regex universal parser covering 13+ languages.
  • Agent runtime sandbox — read-only adapter plus a safe side-effect execution pipeline: the agent dry-runs effects first, then commits.
  • Long-horizon goals — a dedicated memory layer for long-running goals, not just short-lived episodes.
  • Pluggable LLM — None / Ollama / Anthropic / OpenAI / Groq / Gemini / DeepSeek / OpenRouter with auto-routing, swap by config.

Storage

Internal git versioning over JSON snapshots is the source of truth. SQLite + FTS5 is the derived speed-cache. braincore checkout HEAD~3 and you see what the agent believed three sessions ago — no drift.

Implementation highlights

  • Activation spreadingconcepts.Spread(seeds) walks the unified graph (code edges + triples + decision-code refs) with configurable decay, hops, threshold, and per-relation weights.
  • Self-correcting factskg_invalidate_fact plus auto valid_from/valid_to lets the agent change its mind without losing history.
  • Cross-project analogiesanalogize(query, exclude_project) does Jaccard + Trigram + FTS rank + triples overlap, fused via Dempster-Shafer, returns belief-weighted matches.
  • Self-improvement loops — recurring error patterns (≥3 occurrences) auto-promote into behavioural rules.
  • Self-updatebraincore update with a signed manifest and update feed, atomic rename, ed25519 verification.

Status and numbers

Private beta, dogfooded daily. Bench baseline: R@5 = 0.95, p95 = 0.58 ms. Real-world milestone — 125,462 records migrated from the older Python stack into a single ~/.braincore/memory.db, 130+ projects in the shared store.

Lessons

  • A binary you can drop into someone’s ~/bin removes 95 % of adoption friction.
  • Pure Go is liberating — every reach for CGO ended up biting me eventually.
  • Memory is not state. State is what an agent has in front of it. Memory is what it knows it has.