{"id":46714008,"url":"https://github.com/riscue/ha-ai-memory","last_synced_at":"2026-04-12T23:31:40.434Z","repository":{"id":325878177,"uuid":"1102681376","full_name":"Riscue/ha-ai-memory","owner":"Riscue","description":"Long-term memory system for AI assistants in Home Assistant. Store facts, preferences, and context that persists across conversations.","archived":false,"fork":false,"pushed_at":"2025-12-19T11:17:59.000Z","size":295,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-22T04:11:53.218Z","etag":null,"topics":["ai","assist","custom-component","hacs","home-assistant","ltm","memory","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Riscue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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},"funding":{"buy_me_a_coffee":"riscue"}},"created_at":"2025-11-23T22:13:10.000Z","updated_at":"2025-12-19T11:15:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Riscue/ha-ai-memory","commit_stats":null,"previous_names":["riscue/ha-ai-memory"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/Riscue/ha-ai-memory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Riscue%2Fha-ai-memory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Riscue%2Fha-ai-memory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Riscue%2Fha-ai-memory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Riscue%2Fha-ai-memory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Riscue","download_url":"https://codeload.github.com/Riscue/ha-ai-memory/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Riscue%2Fha-ai-memory/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30290899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T02:57:19.223Z","status":"ssl_error","status_checked_at":"2026-03-09T02:56:26.373Z","response_time":61,"last_error":"SSL_read: 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","assist","custom-component","hacs","home-assistant","ltm","memory","sqlite"],"created_at":"2026-03-09T10:01:29.519Z","updated_at":"2026-03-09T10:01:30.739Z","avatar_url":"https://github.com/Riscue.png","language":"Python","funding_links":["https://buymeacoffee.com/riscue"],"categories":[],"sub_categories":[],"readme":"# 🧠 AI Long Term Memory for Home Assistant\n\n[![Home Assistant](https://img.shields.io/badge/home%20assistant-%2341BDF5.svg?style=for-the-badge\u0026logo=home-assistant\u0026logoColor=white)](https://home-assistant.io)\n[![hacs](https://img.shields.io/badge/HACS-Custom-orange.svg?style=for-the-badge)](https://www.hacs.xyz/docs/faq/custom_repositories/)\n[![License][license-shield]](LICENSE.md)\n\n[license-shield]: https://img.shields.io/github/license/Riscue/ha-ai-memory.svg?style=for-the-badge\n\n[![Active installations](https://img.shields.io/badge/dynamic/json?style=for-the-badge\u0026color=41BDF5\u0026logo=home-assistant\u0026label=active%20installations\u0026cacheSeconds=15600\u0026url=https://analytics.home-assistant.io/custom_integrations.json\u0026query=$.ai_memory.total)](https://github.com/Riscue/ha-ai-memory)\n[![GitHub Downloads (all assets, latest release)](https://img.shields.io/github/downloads/Riscue/ha-ai-memory/latest/total?label=downloads\u0026style=for-the-badge)](https://github.com/Riscue/ha-ai-memory/releases)\n\n[![GitHub Release](https://img.shields.io/github/release/Riscue/ha-ai-memory.svg?style=for-the-badge)](https://github.com/Riscue/ha-ai-memory/releases)\n[![GitHub Activity](https://img.shields.io/github/commit-activity/y/Riscue/ha-ai-memory.svg?style=for-the-badge)](https://github.com/Riscue/ha-ai-memory/commits/master)\n\n![Icon](assets/logo.png)\n\n[![Add Integration](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=ai_memory)\n\nLong-term memory system for AI assistants in Home Assistant. Store facts, preferences, and context that persists across\nconversations.\n\n## ✨ Features\n\n- **Native LLM Integration**: Automatically exposes tools to Home Assistant's Assist agents.\n- **Multi-Engine Support**: Choose between `SentenceTransformer` (Best Quality), `FastEmbed` (RPi4 Optimized), or\n  `TF-IDF` (Lightweight).\n- **Scoped Memory**: Supports `private` (agent-specific) and `common` (shared) memories.\n- **Privacy First**: All data is stored locally in your Home Assistant instance.\n- **Offline Capable**: Works entirely offline with TF-IDF or cached models.\n\n## 🚀 Installation\n\n### HACS Installation (Recommended)\n\n[HACS Custom Repository Installation](https://www.hacs.xyz/docs/faq/custom_repositories/)\n\n[![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=Riscue\u0026repository=ha-ai-memory)\n\n### Manual Installation\n\n1. Copy `custom_components/ai_memory` to your `config/custom_components/` directory.\n2. Restart Home Assistant.\n3. Add the integration via Settings \u003e Devices \u0026 Services.\n\n[![Add Integration](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=ai_memory)\n\n## ⚙️ Configuration\n\nDuring setup (or via \"Configure\" on the integration entry), you can customize:\n\n- **Storage Location**: Fixed at `/config/ai_memory/`.\n- **Embedding Engine**:\n    - **SentenceTransformer**: Best accuracy. Requires ~500MB RAM. Ideal for PC/NUC.\n    - **FastEmbed**: Good accuracy, optimized for ARM/RPi4. Requires ~100MB RAM.\n    - **TF-IDF**: Zero dependencies, very fast, lower semantic accuracy. Best for low-power hardware.\n    - **Auto**: Tries engines in order: SentenceTransformer → FastEmbed → TF-IDF.\n\n## 🤖 Usage\n\n### For AI Agents (LLM Tools)\n\nOnce installed, the following tools are automatically available to your Assist agents:\n\n- **`add_memory`**: Proactively saves information.\n    - `content`: The text to save.\n    - `scope`: `private` (default, specific to the agent) or `common` (shared household facts).\n- **`search_memory`**: Retrieves relevant memories based on semantic similarity.\n\n**Example Interaction:**\n\u003e **User:** \"I'm allergic to peanuts.\"\n\u003e **AI:** *Calls `add_memory(content=\"User is allergic to peanuts\", scope=\"private\")`*\n\u003e **AI:** \"I've made a note of your peanut allergy.\"\n\n### For Automations (Services)\n\nYou can manage memories programmatically using Home Assistant services.\n\n#### `ai_memory.add_memory`\n\nAdd a memory entry manually.\n\n```yaml\nservice: ai_memory.add_memory\ndata:\n  memory_id: sensor.ai_memory_store\n  text: \"The garage door code is 1234\"\n```\n\n#### `ai_memory.list_memories`\n\nRetrieve all memories.\n\n```yaml\nservice: ai_memory.list_memories\nresponse_variable: memories\n```\n\n#### `ai_memory.clear_memory`\n\nWipe all memories for a sensor.\n\n```yaml\nservice: ai_memory.clear_memory\ndata:\n  memory_id: sensor.ai_memory_store\n```\n\n## 🐛 Troubleshooting\n\n- **\"No embedding engine available\"**: Ensure you have selected a supported engine for your hardware. Try switching to\n  `TF-IDF` or `Auto`.\n- **Import Errors**: Check logs. If using `SentenceTransformer` or `FastEmbed`, ensure dependencies are installed or\n  switch to `TF-IDF`.\n- **Database Issues**: If the database becomes corrupted, stop HA and delete the `ai_memory.db` file in your storage\n  directory.\n\n## License\n\nMIT © [Riscue](https://github.com/riscue)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friscue%2Fha-ai-memory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friscue%2Fha-ai-memory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friscue%2Fha-ai-memory/lists"}