{"id":48269045,"url":"https://github.com/tverney/agent-memory-daemon","last_synced_at":"2026-04-09T02:00:50.879Z","repository":{"id":348783166,"uuid":"1199873993","full_name":"tverney/agent-memory-daemon","owner":"tverney","description":"Open-source memory manager daemon for AI agents. Filesystem-native, LLM-pluggable, framework-agnostic. Works with OpenClaw, Strands, LangChain, AgentCore Runtime or any agent that can write a file.","archived":false,"fork":false,"pushed_at":"2026-04-07T14:34:56.000Z","size":289,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-08T01:02:52.153Z","etag":null,"topics":["agent-memory","agentcore-runtime","ai-agents","bedrock","consolidation","daemon","langchain","llm","memory","openai","openclaw","strands","strands-agents","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/tverney.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/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":null,"dco":null,"cla":null}},"created_at":"2026-04-02T19:54:49.000Z","updated_at":"2026-04-08T00:41:00.000Z","dependencies_parsed_at":"2026-04-05T23:01:18.349Z","dependency_job_id":"4dc0c418-33d6-4fbd-906f-962b2bb4f326","html_url":"https://github.com/tverney/agent-memory-daemon","commit_stats":null,"previous_names":["tverney/agent-memory-daemon"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/tverney/agent-memory-daemon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tverney%2Fagent-memory-daemon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tverney%2Fagent-memory-daemon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tverney%2Fagent-memory-daemon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tverney%2Fagent-memory-daemon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tverney","download_url":"https://codeload.github.com/tverney/agent-memory-daemon/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tverney%2Fagent-memory-daemon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31581864,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"online","status_checked_at":"2026-04-09T02:00:06.848Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["agent-memory","agentcore-runtime","ai-agents","bedrock","consolidation","daemon","langchain","llm","memory","openai","openclaw","strands","strands-agents","typescript"],"created_at":"2026-04-04T22:03:20.432Z","updated_at":"2026-04-09T02:00:50.873Z","avatar_url":"https://github.com/tverney.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Open-source memory manager daemon for AI agents\n\nOpen-source memory consolidation and extraction daemon for AI agents. Filesystem-native, LLM-pluggable, framework-agnostic.\n\nAgents feed it raw observations as markdown files; the daemon runs two complementary modes:\n\n- **Consolidation** — periodically reorganizes, deduplicates, and prunes existing memory files via a four-phase pass (orient → gather → consolidate → prune)\n- **Extraction** — watches for new session content and runs an LLM pass to identify facts, decisions, preferences, and error corrections worth remembering, writing them as individual memory files\n\nThe filesystem is the interface — no SDK, no API, no MCP required. The LLM backend is pluggable (OpenAI, Amazon Bedrock, or anything with a chat API).\n\nmemconsolidate is a standalone, agent-agnostic daemon — available to anyone building with OpenClaw, Strands, LangChain, or any custom agent framework.\n\n## How it works\n\n### Consolidation (reorganize existing memories)\n\n1. Agents write markdown memory files (with YAML frontmatter) to a watched directory\n2. A three-gate trigger system (time elapsed + session count + lock) decides when to consolidate\n3. The daemon runs a four-phase pass: orient → gather → consolidate → prune\n4. The result is organized, deduplicated, size-budgeted memory with a concise MEMORY.md index\n\n### Extraction (discover new memories from sessions)\n\n1. The daemon tracks a cursor (`.extraction-cursor`) — the timestamp of the last extraction\n2. On each poll, it scans the session directory for files modified since the cursor\n3. If new content is found, it builds a prompt containing the current memory manifest + session content\n4. The LLM identifies facts, decisions, preferences, and corrections worth remembering\n5. Valid operations are applied to the memory directory and the MEMORY.md index is updated\n6. The cursor advances on success; on failure it stays put so the same content is retried\n\nConsolidation takes priority — if both triggers fire on the same tick, consolidation runs first and extraction waits for the next cycle. A shared PID-based lock ensures they never run concurrently.\n\n## Key design goals\n\n- **Agent-agnostic**: any agent that can write a file can use it — OpenClaw, Strands, LangChain, custom agents, raw LLM calls\n- **Language-agnostic**: filesystem is the interface — no SDK required\n- **LLM-pluggable**: bring your own model (OpenAI, Amazon Bedrock, or any chat API)\n- **Two modes, one daemon**: consolidation and extraction run in the same process with mutual exclusion\n- **Size-budgeted**: MEMORY.md index stays under 200 lines / 25 KB\n- **Concurrent-safe**: PID-based lock file prevents corruption from parallel runs\n- **Observable**: structured JSON-line logs with duration, prompt size, and operation metrics\n- **Dry-run mode**: preview what either mode would change without writing anything\n\n## Quick start\n\n### Install\n\n```bash\nnpm install agent-memory-daemon\n```\n\nOr run directly with npx:\n\n```bash\nnpx agent-memory-daemon init\nnpx agent-memory-daemon start\n```\n\n### Configure\n\n```toml\nmemory_directory = \"./memory\"\nsession_directory = \"./sessions\"\nmin_hours = 24\nmin_sessions = 5\n\n# Enable extraction mode (off by default)\nextraction_enabled = true\nextraction_interval_ms = 60000        # minimum 10000\nmax_extraction_session_chars = 5000\n\n[llm_backend]\nname = \"bedrock\"          # or \"openai\"\nregion = \"us-east-1\"\nprofile = \"default\"\nmodel = \"us.anthropic.claude-sonnet-4-20250514-v1:0\"\n```\n\n### Run\n\n```bash\nnpx agent-memory-daemon start\n```\n\nOr if installed globally / as a project dependency:\n\n```bash\nagent-memory-daemon start\n```\n\nThe daemon polls on a configurable interval. Ctrl+C for graceful shutdown.\n\n## Integration with agent frameworks\n\nThe integration pattern is the same regardless of framework — your agent writes session notes, memconsolidate consolidates them in the background, and your agent reads the organized memories at startup.\n\n**OpenClaw**: Point `session_directory` at your OpenClaw workspace's transcript directory. memconsolidate consolidates what the agent accumulates.\n\n**Strands / LangChain**: After each agent run, append a session summary to the sessions directory. At startup, read `MEMORY.md` + topic files into your agent's system prompt.\n\n**Raw LLM calls**: Same pattern — dump session artifacts as markdown, read the memory index before each conversation.\n\n## Configuration reference\n\nAll keys use `snake_case` in TOML and are mapped to `camelCase` internally.\n\n### Consolidation settings\n\n| Key | Default | Description |\n|---|---|---|\n| `memory_directory` | `./memory` | Path to the memory file directory |\n| `session_directory` | `./sessions` | Path to the session file directory |\n| `min_hours` | `24` | Minimum hours since last consolidation before triggering |\n| `min_sessions` | `5` | Minimum session files required to trigger |\n| `poll_interval_ms` | `60000` | How often the daemon checks triggers (ms) |\n| `min_consolidation_interval_ms` | `300000` | Minimum ms between consolidation passes |\n| `max_session_content_chars` | `2000` | Max chars per session file included in the prompt |\n| `max_memory_content_chars` | `4000` | Max chars per memory file included in the prompt |\n| `max_index_lines` | `200` | MEMORY.md line budget |\n| `max_index_bytes` | `25000` | MEMORY.md size budget |\n| `stale_lock_threshold_ms` | `3600000` | Lock age before it's considered stale |\n| `dry_run` | `false` | Preview changes without writing files |\n\n### Extraction settings\n\n| Key | Default | Description |\n|---|---|---|\n| `extraction_enabled` | `false` | Enable the extraction mode |\n| `extraction_interval_ms` | `60000` | Minimum ms between extraction passes (min: 10000) |\n| `max_extraction_session_chars` | `5000` | Max chars of session content included in the extraction prompt |\n\n### LLM backend\n\n```toml\n[llm_backend]\nname = \"bedrock\"          # \"bedrock\" or \"openai\"\nregion = \"us-east-1\"      # Bedrock only\nprofile = \"default\"       # Bedrock only (AWS profile)\nmodel = \"us.anthropic.claude-sonnet-4-20250514-v1:0\"\n# api_key = \"${OPENAI_API_KEY}\"  # OpenAI only\n```\n\n## Extraction in detail\n\nExtraction identifies new knowledge from agent sessions and writes it as structured memory files. It's designed to run frequently (every 60 seconds by default) with low overhead — only modified session files are processed.\n\n### What it extracts\n\nThe LLM is instructed to look for:\n- **Facts** — concrete information about the project, codebase, or environment\n- **Decisions** — architectural choices, tool selections, approach decisions\n- **Preferences** — user coding style, tool preferences, workflow habits\n- **Error corrections** — things that were wrong before and are now corrected\n\n### How the cursor works\n\nThe `.extraction-cursor` file in the memory directory contains a millisecond timestamp. On each poll:\n\n1. Session files with `mtime \u003e cursor` are collected\n2. If any are found, extraction runs\n3. On success, the cursor advances to the current time\n4. On failure, the cursor stays put — the same files will be retried next cycle\n\nIf the cursor file is missing (first run), all session files are processed.\n\n### Mutual exclusion\n\nConsolidation and extraction share the same PID-based lock and never run concurrently. The daemon enforces this with boolean flags (`consolidating` / `extracting`) checked at the top of each poll cycle. Consolidation always takes priority.\n\n### Log events\n\n| Event | When |\n|---|---|\n| `daemon:extraction-start` | Extraction pass begins |\n| `daemon:extraction-complete` | Extraction pass finishes successfully |\n| `daemon:extraction-failed` | Extraction pass fails |\n\n## How does this compare to OpenClaw's memory system?\n\nBoth projects use markdown files on disk for agent memory, but they solve different problems at different layers.\n\n**OpenClaw** is a full personal AI assistant with a built-in memory subsystem. Its memory system focuses on *retrieval* — hybrid search (BM25 + vector similarity) so the agent can recall relevant memories during a conversation. Memories are written in real-time during sessions (manual saves, pre-compaction flush, session hooks). There's a community `memory-organizer` skill for manual cleanup, but no automated background consolidation.\n\n**memconsolidate** is a standalone daemon that focuses on *curation*. It runs independently of any agent, periodically reviewing and reorganizing the memory directory using an LLM. It merges duplicates, converts relative dates to absolute, removes contradicted facts, and keeps the index within a size budget. Any agent in any language can drop `.md` files into the directory — memconsolidate handles the housekeeping.\n\n| | OpenClaw | memconsolidate |\n|---|---|---|\n| What it is | Full AI assistant with memory plugin | Standalone consolidation + extraction daemon |\n| Core focus | Memory retrieval (search) | Memory curation (consolidation) + discovery (extraction) |\n| When memories are organized | Manually or at compaction | Automatically via background daemon |\n| When new memories are created | Agent writes during chat | Extraction mode discovers them from session files |\n| Search capabilities | Hybrid vector + BM25 | Not in scope |\n| Agent coupling | Plugin inside OpenClaw runtime | Agent-agnostic, filesystem interface |\n| Trigger mechanism | User-initiated or compaction threshold | Time + session count + lock gates (consolidation), cursor + mtime (extraction) |\n| LLM usage for memory | Agent writes memories during chat | Separate LLM calls for consolidation and extraction |\n\nThey're complementary — you could point memconsolidate at an OpenClaw workspace's `memory/` directory and let it periodically clean up what the agent accumulates.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftverney%2Fagent-memory-daemon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftverney%2Fagent-memory-daemon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftverney%2Fagent-memory-daemon/lists"}