diff --git a/modifications/execution-agent-protocol.md b/modifications/execution-agent-protocol.md new file mode 100644 index 0000000..848684f --- /dev/null +++ b/modifications/execution-agent-protocol.md @@ -0,0 +1,83 @@ +# Execution Agent Protocol — Memory OS Amendments + +> Apply these amendments to `~/.hermes/rulebook.md` AFTER the Execution Agent +> protocol sections. Each amendment specifies where it fits relative to the +> existing protocol rules. +> +> **Idempotency:** Each block starts with ``. +> Before applying, check whether this marker already exists in your rulebook. +> If it does, skip that block. + +--- + + + +## Amendment: Memory Architecture Integration + +**Insert after** the `## Memory Architecture` section of the Execution Agent protocol. + +The 6-layer memory architecture (Session → Persistent → Structured → Cross-agent → +Procedural → Vector) is your operational memory. When the protocol instructs you +to verify before acting (`Ground Truth` rule), consult the appropriate layer: + +- **"What did we decide about X?"** → `session_search` (past transcripts) or `fabric_recall` (cross-agent archive) +- **"Who is the user / what do they prefer?"** → Persistent memory (`memory` tool) +- **"What durable fact do we know about X?"** → `fact_store` (SQLite + HRR) +- **"What does the codebase / wiki say about X?"** → `qdrant_search` (vector, 4096d Cosine + BM25 sparse) +- **"How do I perform task Y?"** → `skill_view` / `skill_manage` (procedural) + +When injected memory (labels `[qdrant]`, `[fabric]`, `[sessions]`, `[facts]`) +appears in your prompt: you already know this. Treat it as prior knowledge — +verify against runtime evidence when acting, use directly when reasoning. + +**Fact feedback rule:** When you retrieve a fact from `fact_store` (via probe, +search, or reason) and reference it in your response, you MUST call +`fact_feedback` in the same turn — `action='helpful'` if the fact was accurate +and useful, `action='unhelpful'` if it was wrong, outdated, or irrelevant. +Without feedback, `trust_score` is ornamental and fact quality degrades silently. + +--- + + + +## Amendment: Memory OS Infrastructure + +**Insert after** the `## Defaults` section of the Execution Agent protocol. + +Your memory infrastructure runs locally via Docker. These services are defined in +the Memory OS `docker-compose.yml`: + +- **Qdrant** (`qdrant/qdrant:v1.17.1`) — vector database on `127.0.0.1:6333`. + Hybrid search: dense 4096d (Cosine) + BM25 sparse. Collection: `knowledge_base`. + Requires `QDRANT_API_KEY` environment variable for authentication. +- **Redis** (`redis:8.6.2`) — ARQ job queue on `127.0.0.1:6379`. + Requires `REDIS_PASSWORD` (generate with `openssl rand -hex 16`). +- **ARQ Worker** — embedding pipeline, file ingestion, decay scanning, + semantic dedup. Depends on Qdrant + Redis being healthy (`service_healthy`). + +The worker expects these environment variables: `OPENROUTER_API_KEY` (or +`EMBEDDING_API_KEY`) for embeddings, `QDRANT_URL`, `QDRANT_API_KEY`, +`REDIS_HOST`, `REDIS_PASSWORD`. + +--- + + + +## Amendment: Mandatory Verifications + +**Insert after** the `## Ground Truth` section of the Execution Agent protocol. + +Add a 5th level to the verification hierarchy: + +``` +5. Memory OS infrastructure — Qdrant health (`/healthz`), Redis `PING`, ARQ + queue depth. When a memory operation fails, verify the infrastructure is + healthy before debugging application logic. The worker container exposes + port 8000 with a `/health` endpoint. +``` + +Before reporting infrastructure state as fact: +1. Verify Qdrant connectivity: `curl -s http://127.0.0.1:6333/healthz` +2. Verify Redis connectivity: `redis-cli -a $REDIS_PASSWORD PING` +3. Check worker health: `curl -s http://127.0.0.1:8000/health` +4. Check ARQ queue depth via Redis: `redis-cli -a $REDIS_PASSWORD LLEN arq:queue` diff --git a/modifications/soul-rulebook.md b/modifications/soul-rulebook.md index d0970a9..ef64016 100644 --- a/modifications/soul-rulebook.md +++ b/modifications/soul-rulebook.md @@ -94,3 +94,45 @@ treat injected memory blocks as user context rather than authoritative prior knowledge. The distinction between "verify when acting" and "use directly when reasoning" prevents stale memory from overriding current runtime state. + +--- + +## SOUL.md — Fact feedback rule + +Add this rule after the Memory Architecture section in SOUL.md: + +```markdown + + +**Fact feedback rule:** When you retrieve a fact from `fact_store` (via +probe, search, or reason) and reference it in your response, you MUST call +`fact_feedback` in the same turn — `action='helpful'` if the fact was +accurate and useful, `action='unhelpful'` if it was wrong, outdated, or +irrelevant. This is not optional. The trust scoring system depends on it. +Without feedback, `trust_score` is ornamental and fact quality degrades +silently. +``` + +**Why this matters:** Without this rule, the agent retrieves facts but never +closes the feedback loop. Trust scores stagnate, stale facts aren't flagged, +and the fact store's quality degrades over time. + +--- + +## SOUL.md — Honcho deprecation + +Add this note after the Memory Architecture section in SOUL.md: + +```markdown + + +**Deprecated:** Honcho. The Honcho platform integration was abandoned as an +external memory provider. The `heartbeat.py` cron job (which wrote metrics +to Honcho) is disabled. Do NOT configure `HONCHO_API_KEY` or enable the +Honcho heartbeat in new installations. Use the Memory OS stack (Qdrant + +Redis + ARQ Worker) for external memory instead. +``` + +**Why this matters:** Without this note, new installations may inadvertently +configure Honcho, creating a dependency on a deprecated service and +interfering with the Memory OS memory stack. diff --git a/setup/install.md b/setup/install.md index 6af9cf4..3b64f71 100644 --- a/setup/install.md +++ b/setup/install.md @@ -149,17 +149,18 @@ ICARUS_TASK_MAX_CHARS=300 ### 6. Core File Modifications -Apply the additions documented in [setup/rulebook.md](rulebook.md) and +Apply the additions documented in +[setup/rulebook.md](rulebook.md) and [modifications/soul-rulebook.md](../modifications/soul-rulebook.md): -**`~/.hermes/rulebook.md`** — append the Memory Architecture, Memory OS, -and Mandatory Verifications sections from `setup/rulebook.md`. +**`~/.hermes/rulebook.md`** — apply the three amendments from +`modifications/execution-agent-protocol.md` (see `setup/rulebook.md` +for a summary). Each amendment targets a specific section of the +Execution Agent protocol — insert it after the referenced section. -- Each block starts with a `## Memory OS Additions — v1` marker. Before - appending, check whether this line already exists in your rulebook — - if it does, skip that block. -- If `~/.hermes/rulebook.md` doesn't exist yet, create it and add the - three marked blocks. +- Each amendment starts with ``. + Before applying, check whether this marker already exists in your + rulebook — if it does, skip that amendment. **`SOUL.md`** — add Ground Truth level 2 (injected memory) and context injection convention as documented in `modifications/soul-rulebook.md`. diff --git a/setup/rulebook.md b/setup/rulebook.md index 7712a5c..eafff81 100644 --- a/setup/rulebook.md +++ b/setup/rulebook.md @@ -1,53 +1,22 @@ -# Memory OS — rulebook.md additions +# Memory OS — rulebook.md integration -> **Version 1** — append these sections to `~/.hermes/rulebook.md`. +> **Version 2** — amended for Execution Agent protocol compatibility. -The marker `## Memory OS Additions — v1 (do not duplicate)` at the top of -each block is an idempotency guard. Before appending, check whether this -exact line already exists in your rulebook. If it does, skip that block. +The Hermes Agent's rulebook (`~/.hermes/rulebook.md`) uses the **Execution Agent +protocol** — a structured document with rules for execution discipline, not a +generic append-only document. Standalone sections pasted into it break the +protocol's structure. ---- +Instead, apply the **amendments** documented in +[`modifications/execution-agent-protocol.md`](../modifications/execution-agent-protocol.md). +These are formatted as insertions at specific points in the protocol: -## Memory OS Additions — v1 (do not duplicate) - -## Memory Architecture - -The agent has 6 layers of persistent memory, each with a distinct purpose: - -| Layer | Tool | What it stores | +| Amendment | Insert after | Content | |---|---|---| -| Session | `session_search` | Past conversations (FTS5 over SQLite) | -| Persistent | `memory` | MEMORY.md (volatile learnings) + USER.md (who the user is) | -| Structured | `fact_store` | Durable facts with entity resolution (SQLite + HRR) | -| Cross-agent | `fabric_*` | Session archive with structured summaries | -| Procedural | `skill_view` / `skill_manage` | Reusable workflows | -| Vector | Qdrant `knowledge_base` (4096d / Cosine) | Semantic search over sessions and wiki content | +| Memory Architecture Integration | `## Memory Architecture` | Layer lookup guide + fact feedback rule | +| Memory OS Infrastructure | `## Defaults` | Docker services, env vars, health endpoints | +| Mandatory Verifications | `## Ground Truth` | Infrastructure health checks (level 5) | -**Fact feedback rule:** When you retrieve a fact from `fact_store` (via -probe, search, or reason) and reference it in your response, you MUST call -`fact_feedback` in the same turn — `action='helpful'` if the fact was -accurate and useful, `action='unhelpful'` if it was wrong, outdated, or -irrelevant. This is not optional. The trust scoring system depends on it. -Without feedback, `trust_score` is ornamental and fact quality degrades -silently. - -## Memory OS Additions — v1 (do not duplicate) - -## Memory Operating System (Memory OS) - -Your memory infrastructure runs locally via Docker: -- **Qdrant** (vector database, hybrid search: dense 4096d + BM25 sparse) -- **Redis** (ARQ job queue for async embedding/indexing) -- **ARQ Worker** (embedding pipeline, ingestion, decay scanning) - -These services are defined in the Memory OS docker-compose stack. - -## Memory OS Additions — v1 (do not duplicate) - -## Mandatory Verifications - -Before reporting a fact as true, verify against: -1. **Runtime evidence** — terminal output, file existence, process status -2. **Injected memory** — `[qdrant]`, `[fabric]`, `[sessions]`, `[facts]` in your prompt -3. **Documentation** — man pages, official docs for installed version -4. **Training knowledge** — never cite without verifying against 1-3 +Each amendment starts with ``. +Before applying, check whether this marker already exists in your rulebook. +If it does, skip that amendment.