feat(pegas-memory): Tier-1 self-improvement tools (commit + staleness)

- memory_commit: closes the 'commit hole' — writes verified answers from
  closed gaps back into atoms (mandatory dedup); leaves gap open if no
  verified answer exists. Reads verified status from PostgreSQL (source of
  truth), not the Qdrant projection.
- memory_stale: staleness guard with two signals — content-staleness
  (re-fetch + LLM verdict, needs proxy for foreign sites) and age-staleness
  (proxy-free fallback by pm_document.fetched_at, max_age_days).
- db: populate pm_document.fetched_at on upsert (freshness signal).
- docs: README/AGENTS/ARCHITECTURE/EXAMPLES updated (18 tools).
- self_improve.py: new module (227 lines).
This commit is contained in:
n1kt4r committed 2026-10-15 22:06:30 +05:00
1 parent a4c4a766c1
commit eca8a11e23
8 files changed
+439 -6

No files matched your search

+2
View File
@@ -45,6 +45,8 @@ Read this file before answering any question about knowledge, memory, or researc
| "Show one gap" | `memory_get_gap` |
| "Delete a gap" | `memory_delete_gap` |
| "Run logical inference" | `memory_infer` |
| "Commit verified answers from closed gaps into atoms" | `memory_commit(gap_ids, dedup?)` — закрывает «дыра commit»: answer пробела пишется в атомы (dedup обязательный); без верифицированного ответа пробел не трогает |
| "Mark stale atoms" | `memory_stale(atom_id?/all?, limit?, sample?, min_confidence?, age_only?, max_age_days?)` — гвард сталкности: content-staleness (рефетч + LLM, нужен прокси для заруб.) или age-staleness (proxy-free по `fetched_at`) |
**Ambiguity rule:** if the question is about *knowledge content* → memory tools.
If it is about *the outside world right now* → `web_search` (built-in).