From e09dc6332d4f684feaa6e420fa897c2eb7dad37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=97=D0=B0=D1=80=D1=83=D0=B1=D0=B8=D0=BD=20=D0=A4=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=D0=BF=D0=BF?= <289370046+zarubinphil@users.noreply.github.com> Date: Thu, 18 Jun 2026 17:19:22 +0300 Subject: [PATCH] docs: deep-mode covers provider abstraction, enrichment, digest, owner-context Co-Authored-By: Claude Opus 4.8 (1M context) --- docs/deep-mode.md | 20 ++++++++++++++++---- docs/deep-mode.ru.md | 20 ++++++++++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/docs/deep-mode.md b/docs/deep-mode.md index 51d7ccf..b7ee92c 100644 --- a/docs/deep-mode.md +++ b/docs/deep-mode.md @@ -23,16 +23,28 @@ If deep mode is requested but Codex is not available, the run **falls back to lo ## The Codex bridge -All LLM calls go through one shared module: `scripts/mnemazine-codex.mjs`. It reuses the same headless pattern as the repo's `scripts/kb-*-codex.sh` scripts — a single schema-constrained `codex exec` call, JSON captured via `-o`, prompt on stdin. There is no second LLM client. +All LLM calls go through one provider-abstracted module: `scripts/mnemazine-llm.mjs` (`llmJson(prompt, schema, {provider, tools})`). The **code-first engine is Claude** (headless `claude -p`); **Codex is kept at parity** — the same contract, so anything that works via Claude also works via Codex. There is no third LLM client. `mnemazine-codex.mjs` remains as a thin back-compat shim. ### Environment variables | Variable | Default | Purpose | |----------|---------|---------| -| `MNEMAZINE_CODEX_BIN` | `/Applications/Codex.app/Contents/Resources/codex` | Path to the Codex binary. Override to point at another install (must be an existing executable). | -| `MNEMAZINE_CODEX_TIMEOUT_MS` | `300000` | Per-call timeout. | -| `MNEMAZINE_DEEP` | unset | `1` enables deep mode (atomize + verify). | +| `MNEMAZINE_LLM` | `claude` | Engine: `claude` (primary) or `codex` (parity). | +| `MNEMAZINE_CLAUDE_BIN` | `claude` (PATH) | Path to the Claude CLI. Pin it for headless runs. | +| `MNEMAZINE_CODEX_BIN` | `/Applications/Codex.app/Contents/Resources/codex` | Path to the Codex binary. | +| `MNEMAZINE_LLM_TIMEOUT_MS` | `420000` | Per-call timeout. | +| `MNEMAZINE_DEEP` | unset | `1` enables deep mode (enrich + atomize + verify + digest). | +| `MNEMAZINE_ENRICH` | `1` within deep | `0` (or `--no-enrich`) skips the enrichment stage. | | `MNEMAZINE_MAX_ATOMS` | `20` | Cap on atoms produced per source cluster. | +| `MNEMAZINE_OWNER_CONTEXT` | generic | Personal project context for the digest's "why it matters". Or put it in the gitignored `.mnemazine/owner-context.txt`. | + +### Enrichment (knowledge expansion) + +Before atomization, deep mode runs a web-capable LLM agent that **researches and expands** the captured material "as much as is genuinely useful" — primary sources, current facts/versions, practitioner experience — with every added fact tied to a fetched URL (anti-hallucination). Atoms are then built from the **expanded** knowledge, not just the raw capture. Disable with `--no-enrich` / `MNEMAZINE_ENRICH=0`. + +### Digest (Russian human-readable summary) + +After Graphify, `scripts/mnemazine-digest.mjs` (`npm run digest`) writes a humanizer-style Russian **Справка** into each note — *Что это / О чём / Почему важно мне / Связи* — with real connections pulled from the graph, plus one session summary note mapping all atoms. This is the reuse surface: open one note, understand the knowledge and how it connects. Idempotent (skips notes that already have a Справка unless `--force`). ### Atomization (G4) diff --git a/docs/deep-mode.ru.md b/docs/deep-mode.ru.md index 3598c05..1febde8 100644 --- a/docs/deep-mode.ru.md +++ b/docs/deep-mode.ru.md @@ -23,16 +23,28 @@ npm run synthesize -- --deep ## Мост Codex -Все вызовы LLM идут через один общий модуль: `scripts/mnemazine-codex.mjs`. Он переиспользует тот же headless-паттерн, что и скрипты репозитория `scripts/kb-*-codex.sh` — один вызов `codex exec` со схемой, JSON через `-o`, промпт через stdin. Второго LLM-клиента нет. +Все вызовы LLM идут через один провайдер-абстрактный модуль: `scripts/mnemazine-llm.mjs` (`llmJson(prompt, schema, {provider, tools})`). **Движок в первую очередь — Claude** (headless `claude -p`); **Codex держится в паритете** — тот же контракт, поэтому всё, что работает через Claude, работает и через Codex. Третьего LLM-клиента нет. `mnemazine-codex.mjs` остаётся тонким shim'ом обратной совместимости. ### Переменные окружения | Переменная | По умолчанию | Назначение | |----------|---------|---------| -| `MNEMAZINE_CODEX_BIN` | `/Applications/Codex.app/Contents/Resources/codex` | Путь к бинарю Codex. Переопределите на другую установку (должен существовать и быть исполняемым). | -| `MNEMAZINE_CODEX_TIMEOUT_MS` | `300000` | Таймаут одного вызова. | -| `MNEMAZINE_DEEP` | не задано | `1` включает deep-режим (атомизация + проверка). | +| `MNEMAZINE_LLM` | `claude` | Движок: `claude` (primary) или `codex` (паритет). | +| `MNEMAZINE_CLAUDE_BIN` | `claude` (PATH) | Путь к Claude CLI. Зафиксируйте для headless-прогонов. | +| `MNEMAZINE_CODEX_BIN` | `/Applications/Codex.app/Contents/Resources/codex` | Путь к бинарю Codex. | +| `MNEMAZINE_LLM_TIMEOUT_MS` | `420000` | Таймаут одного вызова. | +| `MNEMAZINE_DEEP` | не задано | `1` включает deep-режим (enrich + атомизация + проверка + digest). | +| `MNEMAZINE_ENRICH` | `1` в deep | `0` (или `--no-enrich`) пропускает стадию обогащения. | | `MNEMAZINE_MAX_ATOMS` | `20` | Лимит атомов на один кластер источника. | +| `MNEMAZINE_OWNER_CONTEXT` | общий | Контекст личных проектов для блока «почему важно» в справке. Либо положите в gitignored `.mnemazine/owner-context.txt`. | + +### Обогащение (расширение знаний) + +Перед атомизацией deep-режим запускает web-агента LLM, который **исследует и расширяет** захваченный материал «насколько реально полезно» — первоисточники, актуальные факты/версии, опыт практиков — каждый добавленный факт привязан к fetched-URL (антигаллюцинация). Атомы строятся из **расширенного** знания, не только из сырого захвата. Отключение: `--no-enrich` / `MNEMAZINE_ENRICH=0`. + +### Справка (русская человеческая сводка) + +После Graphify `scripts/mnemazine-digest.mjs` (`npm run digest`) пишет в каждую заметку русскую **Справку** в стиле humanizer — *Что это / О чём / Почему важно мне / Связи* — с реальными связями из графа, плюс одну ноту-сводку прогона с картой всех атомов. Это поверхность переиспользования: открыл одну заметку — понял знание и как оно связано. Идемпотентно (пропускает заметки со Справкой, если не `--force`). ### Атомизация (G4)