Neuroscience-inspired memory framework for AI agents. Open-source under github.com/afx-team, distributed on PyPI as hebb-mind.
When rules conflict, follow this priority order:
- MUST — Non-negotiable constraints (违反则输出无效)
- SHOULD — Strong recommendations (默认遵守,可明确说明理由后偏离)
- MAY — Optional suggestions (视具体情况采用)
Status: Production (PyPI hebb-mind)
Domain: Long-term memory for LLM agents — write, consolidate, recall, forget
Surfaces: Python package, Click CLI (hebb), FastAPI server, MCP server (stdio), web console, Claude Code + Codex integrations
Docs site: VitePress → GitHub Pages at https://afx-team.github.io/hebb-mind/
repo_pages/is the public website (VitePress → GitHub Pages). User-facing docs go here. Never commit secrets, internal analysis, or proprietary data — anything merged is published.reports/is internal-only (papers, analysis, design, surveys). Research notes, audits, and design drafts go here, not inrepo_pages/.
The benchmark harness lives in eval/ — datasets, metrics, CLI, and report layout are documented in eval/README.md (read it before running or updating evals). Must-know invariants:
- Each benchmark runs against an isolated server (own port
8401–8409, own workdirhebb.db) — never the dailyhebb serviceon 8321. - Match the metric to the dataset's ground truth — session
Recall@k/Hit@kwhere a clean evidence id exists; end-to-end QA only otherwise. LongMemEval QA uses the official reader +get_anscheck_promptjudge verbatim (no benchmark-tuned prompts). - A published number in
repo_pages/benchmarks/MUST cite an in-treerun-Nreport; update the EN page and itszh/mirror together.
The user's complete path — install → first command → background operation → uninstall — is the product. Every crossing between environments (shell ↔ GUI app ↔ launchd ↔ systemd ↔ Task Scheduler ↔ a third-party CLI's subprocess) is the framework's responsibility, never the user's.
# MUST: Type hints on all public functions (mypy strict is enabled in pyproject.toml)
def process_memory(memory: Memory) -> ProcessedMemory: ...
# MUST: Docstring with Args, Returns, Raises for public APIs
def retrieve(query: str, k: int = 5) -> list[Memory]:
"""Retrieve top-k relevant memories.
Args:
query: Search query string.
k: Number of results to return.
Returns:
Memories sorted by composite score, descending.
"""- MUST NOT use relative imports across modules — import from
hebb.<module>. - MUST NOT hardcode API keys, secrets, or absolute paths outside the user's workspace.
- MUST NOT mix Chinese and English in the same document (per-language pages only).
- MUST add unit tests for new core logic; E2E for new workflows.
- SHOULD use
mermaidfor architecture / data-flow diagrams (renders in VitePress and on GitHub). - SHOULD keep CLI exits via
click.ClickException; reserveSystemExit(1)for unrecoverable failures.
| Decision | YES if | NO if |
|---|---|---|
| New module | Independent lifecycle, clear API boundary, or >500 lines | Just grouping related functions — use a class |
| New abstraction | Pattern repeats 3+ times | Used once or twice — wait for the pattern to stabilize |
Design doc in reports/design/ |
Affects 2+ modules, new dependency, or API contract change | Local refactor or single-module bug fix |
- Architecture clarity — directory structure equals module boundaries.
- Semantic naming — names reveal intent, not implementation.
- Multi-model support — Claude / GPT / Llama / Qwen via LiteLLM; embedding via sentence-transformers or any LiteLLM embedding provider.
- Test coverage — unit tests for logic, E2E for workflows, eval suite for retrieval quality.
- Incremental complexity — start simple, add abstraction only after the pattern stabilizes.