From 31e2b466210ea509476c9c5584ad1aff4e6fd2bb Mon Sep 17 00:00:00 2001 From: Geoff White Date: Tue, 7 Apr 2026 17:21:34 +0000 Subject: [PATCH 1/3] rich support for matrix protocol, rust-based mcp server and bot --- plugins/a0-matrix-mcp/index.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plugins/a0-matrix-mcp/index.yaml diff --git a/plugins/a0-matrix-mcp/index.yaml b/plugins/a0-matrix-mcp/index.yaml new file mode 100644 index 0000000..1d5741b --- /dev/null +++ b/plugins/a0-matrix-mcp/index.yaml @@ -0,0 +1,12 @@ +title: Matrix Protocol MCP Server and Bot (agent-matrix) +description: Rust implementation of matrix-mcp-server plug compatible with mjknowles server. Along with companion Bot. Will support E2EE. +github: https://github.com/l0r3zz/a0-matrix +tags: + - integration + - automation + - agents + - tools + - matrix + - chat + - e2ee + - mcp From 8b0bc58b889f446fb43896eb9b688a31cb8f77c8 Mon Sep 17 00:00:00 2001 From: Geoff White Date: Wed, 8 Apr 2026 04:50:18 +0000 Subject: [PATCH 2/3] change mname of plugin from a0-matrix-mcp to a0-matrix --- plugins/{a0-matrix-mcp => a0-matrix}/index.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename plugins/{a0-matrix-mcp => a0-matrix}/index.yaml (100%) diff --git a/plugins/a0-matrix-mcp/index.yaml b/plugins/a0-matrix/index.yaml similarity index 100% rename from plugins/a0-matrix-mcp/index.yaml rename to plugins/a0-matrix/index.yaml From 3931ae7ba85774f5af95f36f2c7f064fef79bff9 Mon Sep 17 00:00:00 2001 From: Geoff White Date: Sun, 17 May 2026 22:26:20 +0000 Subject: [PATCH 3/3] Add faiss_integrity_check plugin: auto-detects and rebuilds missing/corrupted FAISS index files on agent startup --- .../monologue_start/_00_verify_faiss.py | 99 +++++++++++++++++++ plugins/faiss_integrity_check/plugin.yaml | 7 ++ 2 files changed, 106 insertions(+) create mode 100644 plugins/faiss_integrity_check/extensions/python/monologue_start/_00_verify_faiss.py create mode 100644 plugins/faiss_integrity_check/plugin.yaml diff --git a/plugins/faiss_integrity_check/extensions/python/monologue_start/_00_verify_faiss.py b/plugins/faiss_integrity_check/extensions/python/monologue_start/_00_verify_faiss.py new file mode 100644 index 0000000..132a946 --- /dev/null +++ b/plugins/faiss_integrity_check/extensions/python/monologue_start/_00_verify_faiss.py @@ -0,0 +1,99 @@ +import os +import json +from helpers.extension import Extension +from agent import LoopData + + +class VerifyFaiss(Extension): + """Verify FAISS index integrity before memory recall runs. + + Checks that index.faiss and index.pkl exist in the active memory + directory. If missing or corrupted, auto-creates a fresh empty + index using the embedding model specified in embedding.json. + + This prevents ValueError crashes in the recall extension when + FAISS files are lost (e.g., after storage migration or corruption). + """ + + _checked = False # class-level flag: only run once per agent lifetime + + async def execute(self, loop_data: LoopData = LoopData(), **kwargs): + if not self.agent: + return + + # Only check once per agent boot, not every monologue + if VerifyFaiss._checked: + return + VerifyFaiss._checked = True + + memory_dir = "/a0/usr/memory/default" + index_faiss = os.path.join(memory_dir, "index.faiss") + index_pkl = os.path.join(memory_dir, "index.pkl") + embedding_json = os.path.join(memory_dir, "embedding.json") + + # Check if both index files exist and are non-empty + faiss_ok = os.path.isfile(index_faiss) and os.path.getsize(index_faiss) > 0 + pkl_ok = os.path.isfile(index_pkl) and os.path.getsize(index_pkl) > 0 + + if faiss_ok and pkl_ok: + # Files exist and are non-empty — do a quick load test + try: + import pickle + with open(index_pkl, "rb") as f: + data = pickle.load(f) + # If we get here without error, index is loadable + self.agent.context.log.log( + type="info", + heading="FAISS integrity check", + content="FAISS index OK.", + ) + return + except Exception as e: + self.agent.context.log.log( + type="warning", + heading="FAISS integrity check", + content=f"FAISS index.pkl corrupted: {e}. Rebuilding...", + ) + else: + missing = [] + if not faiss_ok: + missing.append("index.faiss") + if not pkl_ok: + missing.append("index.pkl") + self.agent.context.log.log( + type="warning", + heading="FAISS integrity check", + content=f"Missing FAISS files: {', '.join(missing)}. Rebuilding...", + ) + + # Rebuild: determine embedding model + model_name = "sentence-transformers/all-MiniLM-L6-v2" # safe default + if os.path.isfile(embedding_json): + try: + with open(embedding_json, "r") as f: + emb_config = json.load(f) + model_name = emb_config.get("model_name", model_name) + except Exception: + pass + + try: + from langchain_community.vectorstores import FAISS + from langchain_community.embeddings import HuggingFaceEmbeddings + + embeddings = HuggingFaceEmbeddings(model_name=model_name) + faiss_store = FAISS.from_texts(["initialization placeholder"], embeddings) + + os.makedirs(memory_dir, exist_ok=True) + faiss_store.save_local(memory_dir) + + self.agent.context.log.log( + type="info", + heading="FAISS integrity check", + content=f"Fresh FAISS index created at {memory_dir} using {model_name}.", + ) + except Exception as e: + self.agent.context.log.log( + type="error", + heading="FAISS integrity check", + content=f"Failed to rebuild FAISS index: {e}", + ) diff --git a/plugins/faiss_integrity_check/plugin.yaml b/plugins/faiss_integrity_check/plugin.yaml new file mode 100644 index 0000000..a16c315 --- /dev/null +++ b/plugins/faiss_integrity_check/plugin.yaml @@ -0,0 +1,7 @@ +name: faiss_integrity_check +title: FAISS Integrity Check +description: Validates FAISS vector store integrity on agent startup. Auto-recreates a fresh empty index if files are missing or corrupted to prevent recall crashes. +version: 1.0.0 +settings_sections: [] +per_project_config: false +per_agent_config: false