Skip to main content

Hebb Mind — neuroscience-inspired long-term memory framework for AI agents (neurons that fire together, wire together)

Project description

Hebb Mind logo Hebb Mind

A neuroscience-inspired memory framework for AI agents

Encode. Consolidate. Activate. Forget.

Documentation · English | 中文

Documentation CI PyPI License Python


Hebb Mind gives AI agents a neuroscience-inspired memory loop — encode → replay → consolidate → forget. A pipx install and one command stand up a local REST + MCP endpoint: SQLite for storage, sentence-transformers for embedding, NetworkX for the tag graph. Zero external services — bring an LLM key only when you want consolidation to do its work.

Where peers diverge: mem0 is cloud-first and append-only; letta needs an external DB and a separate sleeptime agent; zep needs Postgres + Neo4j. Hebb Mind runs on a single binary, with one biological loop.

Quick Start

Try in 60 seconds — no API key needed

Ingest and hybrid search work fully offline with the bundled local embedding.

pipx install hebb-mind
hebb setup              # picks an embedding model based on your OS locale
hebb service install    # registers a background service (launchd / systemd / Task Scheduler)

Don't have pipx? It's the recommended installer for Python CLI tools — isolated venv, automatic PATH, plays nice with PEP 668. Install it once:

# macOS (Homebrew)
brew install pipx && pipx ensurepath

# Linux — Debian / Ubuntu 23.04+
sudo apt install pipx && pipx ensurepath

# Linux — Fedora
sudo dnf install pipx && pipx ensurepath

# Windows / any platform with Python 3.10+
python -m pip install --user pipx && python -m pipx ensurepath

Then open a new terminal so the updated PATH takes effect, and re-run pipx install hebb-mind.

Prefer plain pip instead? python -m venv .venv && source .venv/bin/activate && pip install -U hebb-mind works fine — hebb lives on the venv's PATH automatically.

Hebb Mind runs as an OS-managed background service — no foreground process to keep alive, no start/stop shells to remember. The service is per-user by default and needs no admin/sudo. Use --scope system for a system-wide install. See hebb service --help.

In another shell:

curl -X POST http://localhost:8321/api/v1/memories \
  -H 'Content-Type: application/json' \
  -d '{"content": "User prefers dark mode and compact layout", "tags": ["preference", "ui"]}'

curl -X POST http://localhost:8321/api/v1/search \
  -H 'Content-Type: application/json' \
  -d '{"query": "UI preferences", "top_k": 5}'

Open http://localhost:8321/ for the Web Console.

Hebb Mind Web Console — partitioned memories and tag graph

Full experience (5 min) — enable LLM consolidation

Consolidation, conflict resolution, and tag extraction need an LLM backend. Without a key, those endpoints are a silent no-op (a known v0.1.1 gap — see #consolidation-no-op).

hebb config set llm_api_key sk-...
hebb config set llm_model openai/gpt-4o-mini
# For Qwen / GLM / Kimi via LiteLLM:
hebb config set llm_base_url https://dashscope.aliyuncs.com/compatible-mode/v1

Trigger consolidation manually, or wait for the daily 18:00 job:

curl -X POST http://localhost:8321/api/v1/admin/consolidate

Installation Paths

pipx install hebb-mind                 # recommended (isolated CLI install)
pipx install 'hebb-mind[pg]'           # + PostgreSQL/pgvector
pipx upgrade hebb-mind                 # upgrade later
hebb claude-code install --scope user  # Claude Code: hooks-based auto memory
hebb codex install --scope user        # Codex: MCP memory tools

Docker, one-line install, and source build: Installation Guide.

30-second Python SDK

from hebb import HebbMind

mem = HebbMind()  # uses ~/.hebb/hebb.json

mem.add("User prefers dark mode", tags=["preference", "ui"], importance=7.5)
mem.add("User uses VS Code with the One Dark theme", tags=["preference", "tools"])

for hit in mem.search("UI preferences", top_k=5):
    print(hit.score, hit.content)

The HebbMind() facade wraps the REST endpoints above; when no daemon is running locally, it boots an in-process server automatically.

The memory loop

The same four stages, every day, in roughly the same order the brain runs them:

Stage Brain analogue What happens here Trigger
Encoding Hippocampal CA1 captures the moment New memories land in the working-memory inbox (mem_hippocampus) API write
Replay & consolidation Sharp-wave ripples during slow-wave sleep Agent classifies into a partition, resolves conflicts, writes tags into the knowledge graph Daily 18:00 / manual
Retrieval Pattern completion in CA3 Three-path hybrid search (vector + keyword + graph), scored on recency / importance / relevance API search
Forgetting Synaptic pruning + the Ebbinghaus curve Dynamic TTL on access count and importance — neglected memories fade Periodic

Walkthroughs: Memory Lifecycle · Hybrid Search · Architecture diagram

Comparison

Honest summary; full table on the docs site.

Feature Mem0 Letta Zep Hebb Mind
Self-hosted Web UI Cloud only (discussion) Cloud only Cloud only Built-in SPA
Knowledge graph Pluggable (removed in v3) No Yes (Graphiti) Tag-based (NetworkX)
Memory consolidation Append-only Sleeptime Agent Contradiction resolve Auto + conflict resolve
Forgetting / decay No No Temporal invalidation Dynamic TTL
Zero-config local deploy Needs API key Needs API key + DB Needs Postgres + Neo4j SQLite + local embed

Configuration

All config lives in hebb.json. Common settings:

hebb config list
hebb config set llm_model openai/gpt-4o-mini
hebb config set storage_type postgresql
hebb config set pg_url postgresql://user:pass@localhost/hebb

Full reference: Configuration Guide.

API

REST docs at http://localhost:8321/docs once the server is running. Key endpoints:

Method Endpoint Purpose
POST /api/v1/memories Store a memory
POST /api/v1/search Hybrid search
POST /api/v1/admin/consolidate Run consolidation now (requires llm_api_key)
GET /api/v1/graph/tags List knowledge-graph tags
GET /api/v1/graph/neighbors/{tag}?depth=2 Walk the tag graph

Benchmarks

TODO: experiments in preparation.

Why "Hebb Mind"?

In 1949, psychologist Donald O. Hebb proposed a rule that later got distilled into four words:

Neurons that fire together, wire together.

A memory is not a place you look something up — it is a pattern of connection. Concepts that co-occur get physically linked into cell assemblies, and lighting up part of an assembly recalls the rest. Repetition strengthens the wiring; disuse lets it fade. That single rule — Hebbian learning — has shaped most of what came after in memory research and artificial neural networks.

Hebb Mind runs on that rule. Its tag knowledge graph is a cell assembly: tags that appear together gain an edge, and every time they co-occur that edge grows stronger. Retrieval walks those edges, so a partial cue completes the whole pattern. Consolidation keeps what gets reinforced; forgetting prunes what does not — fire together, wire together; neglect it, lose it.

The hippocampus has a place here too — it names the working-memory partition (mem_hippocampus), the inbox where every new memory lands before consolidation. In the brain, the hippocampus is the gateway that holds new experience until it is wired into long-term cortical memory; in 1957, the patient known as H.M. lost both of his and could never form a new long-term memory again (Squire, 1992; Tulving, 2002). Today's AI agents are H.M. — every conversation starts from zero. Hebb Mind gives your agent that missing loop.

Contributing

Setup: pip install -e ".[dev]" && pytest tests/ -v. See CONTRIBUTING.md.

Acknowledgments

Cognitive neuroscience. Ebbinghaus, H. (1885). Über das Gedächtnis. · Hebb, D. O. (1949). The Organization of Behavior. Wiley — the namesake; the postulate behind "fire together, wire together." · Tulving, E. (1972). Episodic and semantic memory. · Squire, L. R. (1992). Memory and the hippocampus: a synthesis from findings with rats, monkeys, and humans. Psychological Review, 99(2). · O'Reilly, R. C., & McClelland, J. L. (1994). Hippocampal conjunctive encoding, storage, and recall. Hippocampus, 4(6). · Wilson, M. A., & McNaughton, B. L. (1994). Reactivation of hippocampal ensemble memories during sleep. Science, 265(5172). · Tulving, E. (2002). Episodic memory: from mind to brain. Annual Review of Psychology, 53. · Buzsáki, G. (2015). Hippocampal sharp wave-ripple. Hippocampus, 25(10).

AI memory systems. Generative Agents (scoring) · MemGPT / Letta (agent-driven memory) · CoALA (partition taxonomy) · Graphiti (temporal KG). Survey notes in reports/papers/.

"Memory is the scribe of the soul." — Aristotle The brain solved this in deep time. We're just porting the loop.

License

MIT

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

hebb_mind-0.1.2.tar.gz (333.0 kB view details)

Uploaded Source

Built Distribution

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

hebb_mind-0.1.2-py3-none-any.whl (343.3 kB view details)

Uploaded Python 3

File details

Details for the file hebb_mind-0.1.2.tar.gz.

File metadata

  • Download URL: hebb_mind-0.1.2.tar.gz
  • Upload date:
  • Size: 333.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hebb_mind-0.1.2.tar.gz
Algorithm Hash digest
SHA256 55c12fe78c527624b315f8e7d8869a306b167afb91fe8899d2680736e717222e
MD5 6b3a841e63222b7263e82255e3a5841c
BLAKE2b-256 ef16864add736f93de742fb7216b6b427e20b05312f7c79668d0c215ca0aa888

See more details on using hashes here.

Provenance

The following attestation bundles were made for hebb_mind-0.1.2.tar.gz:

Publisher: publish.yml on afx-team/hebb-mind

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hebb_mind-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: hebb_mind-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 343.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hebb_mind-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f0f5c029b93440e00052d750f9aaa3fb53733c0c1588cd81690b1ed517c5790f
MD5 f581bda6bc116f50a485a866ca0b2836
BLAKE2b-256 0793f06c01c28dafad7397d2c6db9f0eabe42901dbf34c5379509afa935d4012

See more details on using hashes here.

Provenance

The following attestation bundles were made for hebb_mind-0.1.2-py3-none-any.whl:

Publisher: publish.yml on afx-team/hebb-mind

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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