{"id":49902290,"url":"https://github.com/majiayu000/remem","last_synced_at":"2026-05-16T08:14:54.150Z","repository":{"id":339639172,"uuid":"1162785678","full_name":"majiayu000/remem","owner":"majiayu000","description":"Persistent memory for Claude Code — single Rust binary, zero config","archived":false,"fork":false,"pushed_at":"2026-05-13T13:40:23.000Z","size":2207,"stargazers_count":4,"open_issues_count":6,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-13T15:35:52.356Z","etag":null,"topics":["ai-tools","claude-code","cli","developer-tools","knowledge-management","mcp","memory","persistent-storage","rust","sqlite"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/majiayu000.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-02-20T17:35:19.000Z","updated_at":"2026-05-12T17:15:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"b73692da-f094-4414-ba68-60d597b57f1e","html_url":"https://github.com/majiayu000/remem","commit_stats":null,"previous_names":["majiayu000/remem"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/majiayu000/remem","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/majiayu000%2Fremem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/majiayu000%2Fremem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/majiayu000%2Fremem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/majiayu000%2Fremem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/majiayu000","download_url":"https://codeload.github.com/majiayu000/remem/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/majiayu000%2Fremem/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33093666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-tools","claude-code","cli","developer-tools","knowledge-management","mcp","memory","persistent-storage","rust","sqlite"],"created_at":"2026-05-16T08:14:53.569Z","updated_at":"2026-05-16T08:14:54.138Z","avatar_url":"https://github.com/majiayu000.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Remem Memory\n\n\u003e Automatic memory for Claude Code and Codex.\n\nLanguage: **English** | [简体中文](README.zh-CN.md)\n\n`remem` is a single Rust binary that automatically captures, distills, and injects project context across sessions: decisions, patterns, preferences, and learnings. Stop re-explaining your project every new session.\n\n[![CI](https://github.com/majiayu000/remem/actions/workflows/ci.yml/badge.svg)](https://github.com/majiayu000/remem/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n\n![Remem Memory terminal demo](assets/remem-demo.gif)\n\n## The Problem\n\n- **Session amnesia**: every new Claude Code session starts from zero.\n- **Lost context**: bug-fix rationale and design decisions disappear after the session ends.\n- **Preference fatigue**: the same preferences must be repeated every session.\n- **No continuity**: long-running work is hard to resume with confidence.\n\n## How remem Solves This\n\n| Without remem | With remem |\n|---|---|\n| \"We use FTS5 trigram tokenizer...\" (every session) | Injected automatically from memory |\n| \"Do not use `expect()` in non-test code\" (again) | Preference surfaced before you ask |\n| \"Last session we decided to...\" (reconstruct manually) | Decision history with rationale |\n| Bug context lost after session ends | Root cause + fix preserved |\n\n## Install\n\n```bash\n# Option 1: Quick install (prebuilt binary)\ncurl -fsSL https://raw.githubusercontent.com/majiayu000/remem/main/install.sh | sh\n\n# Option 2: Cargo\ncargo install remem-ai --bin remem\n\n# Option 3: Build from source\ngit clone https://github.com/majiayu000/remem.git\ncd remem\ncargo build --release\ncp target/release/remem ~/.local/bin/\ncodesign -s - -f ~/.local/bin/remem  # required on macOS ARM\n\n# Configure detected Claude Code/Codex hooks + MCP\nremem install\n\n# Optional: target one host explicitly\nremem install --target codex    # auto | claude | codex | all\nremem install --dry-run         # preview config changes\n```\n\nRestart your AI coding tool after installation.\n\n## How It Works\n\nremem uses host-specific hook strategies:\n\n```\nClaude Code workflow\n        |\n        |- SessionStart      -\u003e Inject memories + preferences\n        |- UserPromptSubmit  -\u003e Register session, flush stale queues\n        |- PostToolUse       -\u003e Capture tool operations (queued, \u003c1ms)\n        '- Stop              -\u003e Summarize in background (~6ms return)\n\nCodex workflow\n        |\n        |- SessionStart      -\u003e Inject memories + preferences\n        '- Stop              -\u003e Summarize in background with Codex CLI\n```\n\nCodex does not install a high-frequency `PostToolUse(Bash)` observe hook by\ndefault. Shell-heavy sessions must use the coalesced capture pipeline before\nper-command capture is enabled again; otherwise Bash output can create an\nunbounded backlog. Existing legacy hooks are also ignored unless\n`REMEM_ENABLE_CODEX_BASH_OBSERVE=1` is set explicitly.\n\nThe capture pipeline starts with an append-only ledger:\n`captured_events` stores raw hook/session evidence, `event_blobs` keeps large\npayloads out of prompt-sized rows, and `extraction_tasks` coalesces work by\nhost/project/session instead of creating one LLM job per tool call. Curated\nmemory remains the promoted output of this pipeline, not the raw event itself.\n\n## Search Architecture\n\nremem uses 4-channel Reciprocal Rank Fusion (RRF) inspired by [Hindsight](https://github.com/vectorize-io/hindsight):\n\n```\nQuery: \"database encryption\"\n        |\n   +----+------------------------------------+\n   |          4 parallel channels            |\n   +-----------------------------------------+\n   | 1. FTS5 (BM25)   trigram + OR           |\n   | 2. Entity Index  1600+ entities         |\n   | 3. Temporal      \"yesterday\"/\"last week\" |\n   | 4. LIKE fallback short tokens           |\n   +-------------+---------------------------+\n                 |\n        RRF score = sum(1 / (60 + rank_i))\n                 |\n             Top-K merged results\n```\n\nEnhancements:\n\n- Entity graph expansion (2-hop multi-hop retrieval)\n- Project-scoped entity search (no cross-project leakage)\n- CJK segmentation support\n- Chinese-English synonym expansion\n- Title-weighted BM25 (`bm25(fts, 10.0, 1.0)`)\n- Content-hash deduplication via `topic_key`\n- Multi-step retrieval guidance in MCP tool descriptions\n\n## Benchmark Snapshot\n\n### LoCoMo\n\nFull [LoCoMo](https://github.com/snap-research/locomo) benchmark (10 conversations, 1540 QA pairs after adversarial skip):\n\n| Config | Overall | Single-hop | Multi-hop | Temporal | Open-domain | Ingest | Model |\n|---|---:|---:|---:|---:|---:|---|---|\n| **v1 (fair)** | **56.8%** | 67.1% | 39.0% | 53.9% | 28.1% | per-turn | gpt-5.4 |\n| **v2 (optimized)** | **62.7%** | 72.3% | 61.3% | 40.5% | 56.2% | session_summary | gpt-5.4 |\n\n### Internal Eval (1777 real memories)\n\n| Metric | Value |\n|---|---:|\n| MRR | 0.858 |\n| Hit Rate@5 | 1.000 |\n| Dedup rate | 1.0% |\n| Project leak | 0% |\n| Self-retrieval | 100% |\n\n### Local QA Eval\n\n```bash\npython3 eval/local/run_local_eval.py --n 20\n```\n\n| Metric | Score |\n|---|---:|\n| Overall | **85.0%** |\n| Decision | 77.8% |\n| Discovery | 87.5% |\n| Preference | 100% |\n| Source in top-20 | 90.0% |\n\nRequires `.env` with `OPENAI_API_KEY` (optional `OPENAI_BASE_URL`, `OPENAI_MODEL`).\n\n## Token Usage And Cost Reporting\n\nremem records an AI usage ledger for its own background extraction, summary,\ncompression, and promotion calls. The CLI can report daily and weekly token\nusage and estimated cost:\n\n```bash\nremem usage --days 14 --weeks 8\nremem usage --project /path/to/project --days 30 --weeks 12\n```\n\nThe report includes calls, input tokens, cache tokens, output tokens, reasoning\ntokens, total tokens, estimated USD cost, and a precision note. Usage rows are\ntagged by source:\n\n- `anthropic_usage`: provider-reported usage from the Anthropic Messages API\n- `codex_log`: exact token counts parsed from the current `codex exec --json`\n  `turn.completed.usage` event\n- `text_estimate`: fallback estimate from prompt/response text length\n\nCost is an estimate, not an invoice. Historical rows may be text estimates or\nmay have been repriced from older rows that did not store the exact model.\nCodex summarization defaults to `gpt-5.2`; set `REMEM_CODEX_MODEL=auto` to let\nCodex choose its own default, or set any explicit Codex model name.\n\n## Commands\n\n```bash\nremem install\nremem uninstall\nremem doctor\nremem search \"query\"\nremem search \"query\" --branch main --type decision --multi-hop --offset 10\nremem show \u003cid\u003e\nremem eval\nremem eval-local\nremem backfill-entities\nremem encrypt\nremem api --port 5567\nremem status\nremem usage --days 14 --weeks 8\nremem pending list-failed\nremem pending retry-failed --dry-run\nremem pending purge-failed --dry-run --older-than-days 7\nremem review list\nremem review approve \u003cid\u003e\nremem review discard \u003cid\u003e\nremem review edit \u003cid\u003e --text \"updated memory\"\nremem preferences list\nremem preferences add \"text\"\nremem preferences remove 42\nremem context --cwd .\nremem cleanup\nremem dream [--project X] [--dry-run]\nremem install --target codex\nremem mcp\nremem sync-memory --cwd .\n```\n\n## REST API\n\n```bash\nremem api --port 5567\n```\n\n| Endpoint | Method | Description |\n|---|---|---|\n| `/api/v1/search?query=\u0026project=\u0026type=\u0026limit=\u0026offset=\u0026branch=\u0026multi_hop=` | GET | Search memories |\n| `/api/v1/memory?id=` | GET | Get one memory |\n| `/api/v1/memories` | POST | Save memory |\n| `/api/v1/status` | GET | System status |\n\n## Security\n\n- SQLCipher encryption at rest (`remem encrypt`)\n- Data directory permissions (`0700`)\n- Key file permissions (`0600`)\n- API binds localhost only (`127.0.0.1`)\n\n## Architecture Docs\n\nSee [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for full internals and data flow.\n\n## Uninstall\n\n```bash\nremem uninstall\nrm -rf ~/.remem\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmajiayu000%2Fremem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmajiayu000%2Fremem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmajiayu000%2Fremem/lists"}