{"id":51569263,"url":"https://github.com/hueidou/mem1","last_synced_at":"2026-07-10T18:01:20.354Z","repository":{"id":369703772,"uuid":"1290962296","full_name":"hueidou/mem1","owner":"hueidou","description":"mem1 is a lightweight, self-hosted persistent memory service for AI agents.","archived":false,"fork":false,"pushed_at":"2026-07-06T14:45:30.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-07-06T15:14:16.874Z","etag":null,"topics":["agent","agent-memory","cloudflare-worker","lightweight","memory","self-hosted","serverless","skill"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hueidou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"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-07-06T11:31:51.000Z","updated_at":"2026-07-06T14:55:31.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/hueidou/mem1","commit_stats":null,"previous_names":["hueidou/mem1"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/hueidou/mem1","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hueidou%2Fmem1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hueidou%2Fmem1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hueidou%2Fmem1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hueidou%2Fmem1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hueidou","download_url":"https://codeload.github.com/hueidou/mem1/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hueidou%2Fmem1/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35338653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-10T02:00:06.465Z","response_time":60,"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","agent-memory","cloudflare-worker","lightweight","memory","self-hosted","serverless","skill"],"created_at":"2026-07-10T18:01:05.291Z","updated_at":"2026-07-10T18:01:20.337Z","avatar_url":"https://github.com/hueidou.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mem1 — Agent Memory Service\n\n**mem1** is a lightweight, self-hosted persistent memory service for AI agents.\nIt stores structured memories in SQLite and retrieves them via simple keyword matching — no vector databases, no external dependencies, no complexity.\n\n\u003e Built for agent teams that need a **simple memory backend** without running a full vector DB. Perfect for prototyping, personal projects, or small agent fleets.\n\n## ✨ Features\n\n- **Simple CRUD API** — add, search, list, and clear memories via HTTP\n- **Multi-tenant** — memories are scoped by `user_id` + `agent_id`\n- **Keyword search** — lightweight relevance scoring without vector embeddings\n- **Browser UI** — built-in web interface for manual operations\n- **Single file** — everything in one Python file\n- **SQLite backend** — no database server needed\n\n## 🤖 Agent Skill Prompt\n\nCopy this to tell any AI agent about mem1. You can also get this from the **Web UI** (`/ui/`) — it auto-fills the address and has a copy button.\n\n```\nHey, you can use the mem1 memory service.\nAddress: http://127.0.0.1:8012\nAuth: Bearer Pa$$w0rd\nUser: alice\n\nHit the root endpoint first — it'll tell you everything you need.\n```\n\n## Quick Start\n\n### Prerequisites\n\n- Python 3.10+\n- `pip install fastapi uvicorn`\n\n### Run\n\n```bash\npython server.py\n```\n\nThen visit:\n- **API docs**: http://127.0.0.1:8012/\n- **Web UI**: http://127.0.0.1:8012/ui/\n\n## API Reference\n\nAll requests (except `/` and `/health`) require authentication:\n\n```\nAuthorization: Bearer Pa$$w0rd\n```\n\n| Method | Path | Description |\n|--------|------|-------------|\n| `GET` | `/` | API documentation (agent prompt) |\n| `GET` | `/health` | Health check |\n| `GET` | `/ui/` | Browser-based management UI |\n| `POST` | `/memory/add` | Save a memory |\n| `POST` | `/memory/search` | Search memories by keyword |\n| `GET` | `/memory/{user_id}` | Get all memories for a user |\n| `POST` | `/memory/clear/{user_id}` | Clear memories for a user |\n\n### Add a memory\n\n```bash\ncurl -X POST http://127.0.0.1:8012/memory/add \\\n  -H \"Authorization: Bearer Pa$$w0rd\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"user_id\": \"alice\", \"messages\": \"User prefers dark mode and keyboard shortcuts.\"}'\n```\n\n### Search memories\n\n```bash\ncurl -X POST http://127.0.0.1:8012/memory/search \\\n  -H \"Authorization: Bearer Pa$$w0rd\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"user_id\": \"alice\", \"query\": \"keyboard shortcuts\", \"limit\": 5}'\n```\n\n## Project Structure\n\n```\nmem1/\n├── server.py        # FastAPI application (~150 lines)\n├── index.html       # Browser-based management UI\n├── mem0.db          # SQLite database (auto-created)\n├── cf-worker/       # Cloudflare Worker version (KV storage)\n│   ├── src/index.js\n│   ├── wrangler.toml\n│   └── README.md\n└── README.md        # This file\n```\n\n## Deployment\n\n### Python (self-hosted)\n\nThe service typically runs behind a reverse proxy or tunnel (e.g. [Cloudflare Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/)). Start it with:\n\n```bash\nnohup python3 server.py \u0026\n```\n\n### Cloudflare Worker (edge)\n\nSee [cf-worker/README.md](cf-worker/README.md) for deploying the Workers + KV version at the edge — no server management needed.\n\n## Agent Prompt\n\nWhen an AI agent calls `GET /`, it receives the following usage guide embedded in the JSON response. This tells the agent how to use mem1:\n\n```\n# Mem1 - Agent Memory Service\n\nMem1 is a lightweight persistent memory service for AI agents. It uses simple SQLite + keyword matching.\n\n**Base URL:** `{base_url}`\n\n## Authentication\nAll requests require header: `Authorization: Bearer Pa$$w0rd`\n\n## Endpoints\n\n### GET /\nReturns this usage guide. Read this first when you encounter a Mem1 server.\n\n### GET /health\nHealth check.\n\n### GET /ui or /ui/\nBrowser-based UI for all API operations (requires API key input in browser).\n\n### POST /memory/add\nSave a memory.\nBody: {\"user_id\": \"\u003cwho\u003e\", \"agent_id\": \"\u003cwhich agent\u003e\", \"messages\": \"\u003ccontent to remember\u003e\"}\n\n### POST /memory/search\nSearch memories by keyword.\nBody: {\"user_id\": \"\u003cwho\u003e\", \"agent_id\": \"\u003cwhich agent\u003e\", \"query\": \"\u003ckeywords\u003e\", \"limit\": 5}\n\n### GET /memory/{user_id}\nGet all memories for a user.\nQuery param: `agent_id` (default: \"default\")\n\n### POST /memory/clear/{user_id}\nClear all memories for a user.\n\n## Best Practices\n1. Save important info immediately after learning it.\n2. Use short, structured content (plain text, JSON, or markdown).\n3. Search before asking the user for information already stored.\n4. user_id is typically the human's name; agent_id identifies which agent saved it.\n```\n\n## Customization\n\nTo change the API key, edit the `API_KEY` variable at the top of `server.py`. The database path is configured via `DB_PATH`.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhueidou%2Fmem1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhueidou%2Fmem1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhueidou%2Fmem1/lists"}