Gaps: full lifecycle management (get/update/delete), pure PostgreSQL (no web search)

This commit is contained in:
n1kt4r committed 2026-10-15 17:47:40 +05:00
1 parent adfa630578
commit a4c4a766c1
5 files changed
+266 -81

No files matched your search

+30
View File
@@ -40,6 +40,10 @@ Read this file before answering any question about knowledge, memory, or researc
| "Find a function/class named X" | `memory_search_code` |
| "Show relations / graph edges" | `memory_query_graph` — `kind` is an **edge** type (`imports`/`depends_on`/`calls`/`inherits`/`related`), not an atom type |
| "Remember to research X later" | `memory_add_gap` |
| "Edit a gap" (text/priority/reason) | `memory_update_gap` |
| "Close / take a gap" | `memory_update_gap` with `status` = `researching` / `resolved` / `dismissed` |
| "Show one gap" | `memory_get_gap` |
| "Delete a gap" | `memory_delete_gap` |
| "Run logical inference" | `memory_infer` |
**Ambiguity rule:** if the question is about *knowledge content* → memory tools.
@@ -53,6 +57,7 @@ If it is about *the outside world right now* → `web_search` (built-in).
1. DETECT memory_stats / memory_list_gaps → what is missing?
2. CHECK memory_search → do I already know it?
3. PLAN memory_add_gap(question) → register the gap
TRACK memory_update_gap(id, status) → researching → resolved/dismissed
4. ACQUIRE web_search / web_fetch / read URL → find sources
5. EXTRACT memory_ingest(text|url|path) → distill into atoms
6. VERIFY memory_verify → candidate → verified/contested
@@ -102,3 +107,28 @@ Every atom needs a **claim** (one short sentence) and, where possible, provenanc
- If a fact is `candidate` (unverified), say so.
- If the base has nothing, say "not in the knowledge base" and offer to research it.
- Never present web content as memory, and never present memory as live web data.
---
## 7. Managing gaps (full lifecycle)
A **gap** is a question you know you cannot answer yet. Manage them, don't just collect them:
| Operation | Tool |
|---|---|
| Create | `memory_add_gap(question, reason, priority)` |
| List (filter by status) | `memory_list_gaps(status?, limit?)` |
| Read one | `memory_get_gap(gap_id)` |
| Edit text / reason / priority / status | `memory_update_gap(gap_id, ...)` |
| Delete | `memory_delete_gap(gap_id)` |
**Statuses:** `open` → `researching` → `resolved` | `dismissed`
**Reasons:** `low_coverage` · `low_confidence` · `stale` · `contested` · `user_query`
**Rules:**
- When you start working on a gap → set `status='researching'`.
- When the knowledge is in the base → set `status='resolved'`.
- If the question turned out irrelevant → `status='dismissed'` (prefer this over deleting).
- Raise `priority` when the user asks about the topic; lower it when it stops mattering.
- Keep questions **specific and answerable** ("How does HNSW build its graph?" not "HNSW").