Skip to main content

Persistent associative memory system for Claude Code โ€” complete development workflow

Project description

๐Ÿง  MangoBrain

A development system for Claude Code where every session learns from the last

Plan with /discuss. Execute with /task. Knowledge saves itself.


The Problem

Claude Code forgets everything between sessions. Every new conversation starts from zero โ€” you re-explain architecture, re-discover bugs, re-make decisions. The longer your project lives, the more you repeat yourself.

Memory MCP servers exist, but they're just databases. They store and retrieve. You still have to manually decide what to save, when to recall, and how to structure it. The memory doesn't participate in your workflow โ€” it sits next to it.

How MangoBrain Works

MangoBrain is not a memory store. It's a complete development workflow that builds memory as a side-effect of doing real work.

 /discuss                    /task                         automatic
 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
 โ”‚ Plan a featureโ”‚      โ”‚ Execute the plan   โ”‚      โ”‚ mem-manager      โ”‚
 โ”‚              โ”‚      โ”‚                   โ”‚      โ”‚ saves what you   โ”‚
 โ”‚ Claude starts โ”‚โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚ analyzer explores  โ”‚โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚ learned, what    โ”‚
 โ”‚ by recalling  โ”‚      โ”‚   with memory     โ”‚      โ”‚ broke, what      โ”‚
 โ”‚ past decisionsโ”‚      โ”‚ executor codes     โ”‚      โ”‚ decisions were   โ”‚
 โ”‚ and known bugsโ”‚      โ”‚ verifier checks    โ”‚      โ”‚ made โ€” without   โ”‚
 โ”‚              โ”‚      โ”‚   known issues    โ”‚      โ”‚ you doing        โ”‚
 โ”‚ You plan     โ”‚      โ”‚                   โ”‚      โ”‚ anything         โ”‚
 โ”‚ better.      โ”‚      โ”‚ You ship faster.  โ”‚      โ”‚ Next session     โ”‚
 โ”‚              โ”‚      โ”‚                   โ”‚      โ”‚ starts smarter.  โ”‚
 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Session 1: You tell Claude that prices must be stored in cents, not euros. Session 47: Claude is about to write price logic. The memory surfaces automatically. Claude already knows.

Session 3: A timezone bug costs you 2 hours debugging. Session 28: Claude touches date logic. The verifier recalls the timezone gotcha. The bug doesn't happen again.

This is the closed loop that no other tool provides: work โ†’ capture โ†’ recall โ†’ better work.


How It's Different

Most tools give you a piece of the puzzle. MangoBrain is the whole puzzle.

Memory Store Workflow Framework MangoBrain
Mem0, Official MCP, WhenMoon Ruflo, Claude Pilot, cc-sdd
Remembers across sessions โœ… โŒ or basic โœ…
Structured workflow โŒ โœ… โœ…
Specialized agents โŒ Some โœ… 4 agents with strict roles
Graph relationships โŒ โŒ โœ… typed edges + propagation
Temporal decay โŒ โŒ โœ… episodic/semantic/procedural
Contradicts & supersedes โŒ โŒ โœ… outdated info auto-suppressed
Memory captures automatically โŒ โŒ โœ… mem-manager at session close
Memory informs execution โŒ โŒ โœ… analyzer + verifier query memory
Health monitoring โŒ โŒ โœ… dashboard + diagnose + alerts

The difference: other tools give you storage or structure. MangoBrain gives you a system where the verifier knows that bug #47 already happened, the analyzer starts with architectural context from 30 sessions ago, and the mem-manager captures what worked โ€” without you lifting a finger.


The Workflow

Daily cycle

/discuss โ”€โ”€โ†’ /task โ”€โ”€โ†’ knowledge saved automatically
    โ”‚            โ”‚              โ”‚
    โ”‚            โ”‚              โ–ผ
    โ”‚            โ”‚        Next /discuss starts
    โ”‚            โ”‚        with more context
    โ”‚            โ–ผ
    โ”‚      4 specialized agents:
    โ”‚      โ€ข analyzer (explores code + recalls memory)
    โ”‚      โ€ข executor (writes code โ€” 100% focused, no memory)
    โ”‚      โ€ข verifier (QA + checks past known issues)
    โ”‚      โ€ข mem-manager (saves everything at close)
    โ”‚
    โ–ผ
  Produces task.md โ†’ fed into /task

/discuss โ€” Plan with memory

You describe what you want to build. Claude recalls past decisions, known bugs, architectural patterns. Analyzer agents explore the codebase and query memory for relevant gotchas. You plan with full context. Output: a task.md ready for execution.

/task โ€” Execute with agents

Claude reads the task, spawns analyzers (code + memory), creates a plan, then sends executors to write code. The verifier checks the result and queries memory for known issues in the areas touched. At close, the mem-manager captures everything learned.

/memorize โ€” Manual save (free sessions)

For sessions outside the discussโ†’task cycle. Spawns the mem-manager to extract and save what happened.

Maintenance

Skill When What it does
/elaborate Weekly Consolidates memory: builds graph edges, finds contradictions, creates abstractions
/health-check Monthly Diagnoses memory health, finds content gaps, runs targeted fixes
/smoke-test After changes Tests retrieval quality with 10-20 diverse queries

Under the Hood

The memory engine isn't a simple vector database. It has three layers that work together:

๐Ÿ” Retrieval โ€” Three modes for different moments
Mode Results Graph When
Deep ~20 Full propagation (ฮฑ=0.3) Session start, big picture
Quick ~6 Light propagation (ฮฑ=0.15) Mid-task lookups
Recent ~15 Time-weighted WIP context, session resume

The retrieval pipeline: cosine similarity โ†’ graph propagation (PageRank-style) โ†’ knapsack selection (optimize relevance per token).

๐Ÿ•ธ๏ธ Graph โ€” Memories are connected, not flat

Every memory can relate to others through typed edges:

Edge Direction Effect in retrieval
relates_to bidirectional mutual boost
depends_on A โ†’ B A boosts B
caused_by A โ†’ B A boosts B
co_occurs bidirectional mutual boost
contradicts bidirectional suppresses the weaker one
supersedes A โ†’ B suppresses the old version

This means: when a decision is updated, the old version doesn't just sit there confusing Claude โ€” it gets automatically suppressed.

โณ Decay โ€” Not all memories age equally
Type Decay rate Example
Episodic Fast (0.01/day) "Bug X happened on Tuesday"
Semantic Slow (0.002/day) "This module uses the strategy pattern"
Procedural Very slow (0.001/day) "Always use cents, never euros"

Bug reports fade. Architecture decisions persist. Conventions stick around forever.

๐Ÿงฉ MCP Tools (14 available)
Tool Description
remember Retrieve memories (deep/quick/recent)
memorize Save new memories with embeddings
update_memory Modify content, tags, deprecate
extract_session Parse Claude Code chat JSONL
prepare_elaboration Build working set for elaboration
apply_elaboration Apply elaboration updates
sync_codebase Detect stale/orphan memories
diagnose Health score + prescriptions
setup_status Track initialization progress
stats System statistics
list_memories Search/filter with pagination
reinforce Boost edge weights
decay Apply temporal decay
init_project Bootstrap project metadata

Dashboard

A visual control center with 6 pages:

Page Purpose
Overview Health score, memory growth timeline, setup status, alerts
Setup Step-by-step initialization wizard with progress tracking
Memories Browse, search, filter, inspect individual memories
Graph Force-directed visualization of the memory network
Monitoring Health breakdown, prescriptions, elaboration history
Guide Complete in-app documentation

Quick Start

Requirements

  • Python 3.11+
  • Claude Code (Anthropic CLI)

Option A โ€” Let Claude do everything

Open Claude Code in your project and paste this:

Install MangoBrain for this project.
IMPORTANT: Use Python 3.11 or higher. Check available versions first (python --version,
py -3.12 --version, python3.12 --version, etc.) and use the correct one for pip install.
Run: pip install mango-brain  (using Python >= 3.11's pip)
Then run: mango-brain install
Then run: mango-brain serve --api (in background)
Then tell me to open http://localhost:3101 and to restart Claude Code.
After restart, I should run /brain-init.

Option B โ€” Do it yourself

pip install mango-brain
cd /path/to/your/project
mango-brain install
mango-brain serve --api

What mango-brain install does

  • Detects your GPU and installs the right PyTorch (CUDA or CPU)
  • Installs skills, agents, rules, and prompts into .claude/
  • Configures .mcp.json for Claude Code
  • Updates CLAUDE.md with MangoBrain documentation
  • Registers the project in the MangoBrain database

After install

  1. Open http://localhost:3101 โ€” the dashboard tracks your progress live
  2. Restart Claude Code to load the MCP server
  3. Run /brain-init โ€” the wizard guides you through memory initialization

The /brain-init wizard guides you through 14 steps across 7 phases:

Phase What it does Sessions
1. Doc Base Extracts memories from CLAUDE.md, rules, and documentation 1
2. Code Base Parallel agents scan the codebase for patterns and architecture 1-2
3. Event Base Imports existing knowledge (task lists, project docs) โ€” optional 1
4. Chat Base Extracts knowledge from past Claude Code sessions (JSONL) 1-3
5. Elaborate Builds the memory graph: edges, contradictions, abstractions 1-2
6. Smoke Test 10-20 diverse queries to verify retrieval quality 1
7. Health Check Diagnoses gaps, runs targeted fixes, validates final state 1

Note: Each phase runs in a separate Claude Code session (for fresh context). The wizard tells you exactly when to restart and what to do next. Progress is tracked automatically โ€” if you stop mid-way, /brain-init picks up where you left off. Watch the dashboard update in real-time as memories are created and connected.

When the dashboard shows "Memory Ready", initialization is complete.

After that, your daily workflow is simply: /discuss โ†’ /task โ†’ repeat.


Configuration

# mangobrain.toml

[embedding]
model = "auto"          # GPU โ†’ bge-large (1024d), CPU โ†’ bge-base (768d)
device = "auto"         # auto-detects CUDA

[retrieval]
deep_threshold = 0.78
quick_threshold = 0.85

[decay]
episodic = 0.01         # fast
semantic = 0.002        # medium
procedural = 0.001      # slow

CLI

mango-brain serve              # MCP server (stdio)
mango-brain serve --api        # API + dashboard
mango-brain serve --all        # Both

mango-brain init -p NAME --path PATH   # Initialize project
mango-brain install --path PATH        # Install skills/agents/rules
mango-brain status -p NAME             # Setup progress
mango-brain doctor                     # System health check
mango-brain dashboard                  # Open dashboard in browser

Requirements

  • Python 3.11+
  • PyTorch 2.2+ (GPU optional โ€” CPU works fine)
  • Node.js 18+ (for dashboard build)

Project Structure

mangobrain/
โ”œโ”€โ”€ server/           # Python MCP server + REST API
โ”œโ”€โ”€ dashboard/        # React 19 + Vite + Tailwind
โ”œโ”€โ”€ skills/           # 7 skills (/discuss, /task, /brain-init, /memorize, /elaborate, /health-check, /smoke-test)
โ”œโ”€โ”€ agents/           # 4 agent prompts (analyzer, executor, verifier, mem-manager)
โ”œโ”€โ”€ rules/            # 2 auto-loaded rules (query strategy, workflow integration)
โ”œโ”€โ”€ prompts/          # Init phase instructions + memory quality reference
โ”œโ”€โ”€ tests/            # Test suite
โ”œโ”€โ”€ mangobrain.toml   # Configuration
โ””โ”€โ”€ pyproject.toml    # Python package

Built by Mango
Because your AI pair-programmer shouldn't have amnesia.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mango_brain-3.1.1.tar.gz (410.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mango_brain-3.1.1-py3-none-any.whl (418.6 kB view details)

Uploaded Python 3

File details

Details for the file mango_brain-3.1.1.tar.gz.

File metadata

  • Download URL: mango_brain-3.1.1.tar.gz
  • Upload date:
  • Size: 410.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for mango_brain-3.1.1.tar.gz
Algorithm Hash digest
SHA256 980984a4021e82104106e1e6bafa36af758845cb73417dfb71a82f8e95695e64
MD5 b93c354009a6df5b4934dbdb0fd72639
BLAKE2b-256 b36594af612cdacd4295374d055c447cbba67be3819838b9d6b80642e05d2610

See more details on using hashes here.

File details

Details for the file mango_brain-3.1.1-py3-none-any.whl.

File metadata

  • Download URL: mango_brain-3.1.1-py3-none-any.whl
  • Upload date:
  • Size: 418.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for mango_brain-3.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 83a81d8e22857bb854d5d22cc0c0c0d61e63c50e60a733e263434caeaf931fcc
MD5 8c94872fc98b42aeaddbc11b5a56f2c8
BLAKE2b-256 b7740bc68360f8cdcf0f7cf25c66d9d5caa61d690f0d4ce8084c21f453f9d1ea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page