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:
1 parent
a4c4a766c1
commit
eca8a11e23
8 files changed
+439
-6
No files matched your search
@@ -45,7 +45,8 @@ schema.sql — DDL PostgreSQL
|
||||
`memory_search`, `memory_store`, `memory_ingest`, `memory_stats`, `memory_get_context`,
|
||||
`memory_verify`, `memory_store_code`, `memory_search_code`, `memory_code_graph`,
|
||||
`memory_infer`, `memory_query_graph`,
|
||||
`memory_add_gap`, `memory_list_gaps`, `memory_get_gap`, `memory_update_gap`, `memory_delete_gap`.
|
||||
`memory_add_gap`, `memory_list_gaps`, `memory_get_gap`, `memory_update_gap`, `memory_delete_gap`,
|
||||
`memory_commit`, `memory_stale`.
|
||||
- **Регистрация**: в `~/.dsh/profiles/web/cordis.patch.yml` через `@deepseek-ai/dsh-mcp-client`.
|
||||
- **Live-reload**: профиль web имеет `patchReload: live` — изменения конфига
|
||||
подхватываются без рестарта (проверено: сервер спавнится автоматически).
|
||||
@@ -94,3 +95,21 @@ export PROXY_URL="socks5://127.0.0.1:1080" # hysteria2
|
||||
Причины: `low_coverage`, `low_confidence`, `stale`, `contested`, `user_query`.
|
||||
|
||||
Работает целиком на PostgreSQL — без веб-поиска. Поиск выполняет модель встроенным `web_search`.
|
||||
|
||||
## Самообучение (self-improvement)
|
||||
|
||||
Два инструмента закрывают петлю commit/maintain (см. `ROADMAP.md`):
|
||||
|
||||
| Операция | Инструмент |
|
||||
|---|---|
|
||||
| Записать верифицированный answer закрытого пробела в атомы | `memory_commit(gap_ids, dedup?)` |
|
||||
| Пометить устаревшие атомы в `stale` | `memory_stale(atom_id?/all?, limit?, sample?, min_confidence?, age_only?, max_age_days?)` |
|
||||
|
||||
- **`memory_commit`** — для каждого `gap_id` ищет верифицированные атомы-ответы, дистиллирует
|
||||
канонический атом (обязательный `dedup`) и закрывает пробел. Если верифицированного ответа нет —
|
||||
пробел не трогает (`skipped_empty`).
|
||||
- **`memory_stale`** — два сигнала: **content-staleness** (рефетч источника + LLM-вердикт, для
|
||||
зарубежных сайтов нужен `PROXY_URL`) и **age-staleness** (proxy-free, по `fetched_at`, порог
|
||||
`max_age_days`, default 90). Лимит LLM-вызовов — `limit` + `sample`.
|
||||
|
||||
Источники: `web`/`text`/`epub`/`pdf`. Проверено: рефетч memgraph.com без прокси → `ConnectTimeout`.
|
||||
Reference in new issue
Block a user