Commit Graph
47 Commits
Author SHA1 Message Date
Зарубин Филипп 126ea7a071 Align Mnemazine agent workflow and postrun reports 2026-06-23 12:06:44 +03:00
Зарубин Филипп 39264f7179 fix(onboarding): greeting prints at true end, not buried mid-install
setup.sh (the README-default path) ran install.sh as a mid-flow step, so
its author greeting scrolled past under stages 4-7 and users never saw it.

- scripts/hello.sh: single source of the bilingual greeting.
- install.sh: greet only when run directly; silent under MNEMAZINE_FROM_SETUP.
- setup.sh: pass that flag, print the greeting itself as the last line.
2026-06-19 19:43:00 +03:00
Зарубин Филипп 6236cda2e2 feat(intake): inbox honours MNEMAZINE_INBOX via gitignored sidecar
- sync.sh: LOCAL_INBOX/STAGING from MNEMAZINE_INBOX (default repo/inbox),
  exported so `npm run run` reads the same dir; handles paths with spaces.
- sync.sh + poll.sh: source .mnemazine/config.local.sh for non-secret
  personal path overrides (keeps secrets out of tracked files and .env guard).
- .gitignore: config.local.sh + runtime .last-daily marker.
2026-06-19 19:33:49 +03:00
Зарубин ФилиппandClaude Opus 4.8 c0b7cd89fc feat(graph): track semantic swarm + shard merge scripts
Commit the two scripts already referenced by the graph:semantic-swarm and
graph:merge-semantic-shards npm scripts so a fresh clone has them. Bounded-pool
concurrent semantic batcher + shard-graph merge into the master graph. Local
graph tooling, no VPS deploy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 19:03:37 +03:00
Зарубин ФилиппandClaude Opus 4.8 103efd029a feat(search): facet-diverse swarm + verify lenses + eval harness + install greeting
2A perspective-diversity for ~free: the planner call now returns 2-4 query
facets (real axes of the question) alongside terms. Facets steer 0-token recon
routing, give each shard a focus axis in its prompt, and seed synthesis themes
— diversity without extra agents.

2B opt-in verify (MNEMAZINE_SEARCH_VERIFY=1): one agent per top-K finding judges
3 lenses at once (grounded/relevant/actionable) against the note's own text and
drops ungrounded findings. Bounded (K calls), default off to keep tokens tight.

Eval harness (tests/search-eval.mjs, §5): Tier A deterministic recall/anti-noise
over an inline synthetic vault (0 tokens, wired into release-check); Tier B
opt-in LLM judge scoring the deep report for groundedness/relevance/coverage
(generator != evaluator). New `npm run search:eval`.

install.sh: bilingual (RU/EN) greeting from the author on first install —
thanks, GitHub star ask, invite to suggest improvements.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 18:52:30 +03:00
Зарубин ФилиппandClaude Opus 4.8 48af0c5b4c feat(search): fail-closed cost cap on swarm size
Hard-limit the number of LLM agents a deep search spawns via
MNEMAZINE_SEARCH_MAX_SHARDS / --max-shards (default 12). Local mode stays
uncapped (0-token). Dropped shards are logged to stderr AND surfaced in the
report header — no silent truncation. Closes the missing circuit-breaker
called out by the agent-systems playbook.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 18:40:38 +03:00
Зарубин ФилиппandClaude Opus 4.8 8debd7f14e fix(release): stop public-check flagging its own root@YOUR_VPS_HOST placeholder
The `root@` private marker matched the literal placeholder used in the VPS
config example and the poller/sync scripts, so the gate failed on a clean
tree. Require a real host char (lowercase/digit) after `root@`; the uppercase
`root@YOUR_VPS_HOST` placeholder no longer trips it, while a genuine
`root@host` leak still does.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 18:30:59 +03:00
Зарубин ФилиппandClaude Opus 4.8 fbe205f3f1 feat(search): orchestrator-led agent swarm to search the vault + Mini App button
Add `npm run search` (mnemazine-kb-search.mjs): a recon → fan-out → fan-in
swarm over the live vault that writes a Russian "Справка" Markdown report.
Recon keyword-scores notes (0 tokens); --deep/MNEMAZINE_DEEP engages a
bounded-pool LLM swarm (one agent per shard, untrusted notes fenced), then
the orchestrator dedups + synthesizes. Local fallback keeps it 0-token by
default, mirroring the rest of the deep pipeline. Self-test included.

Wire it into the Telegram Mini App: the vault is Mac-only and the server is
on the VPS, so the button only enqueues. Server gains POST /api/search
(queue), GET /api/searches (list reports), GET /api/search?name= (read, with
path-escape guard). Mini App gets a search card + report list + text viewer
(rendered as text — no markdown XSS sink). The Mac poller drains the queue,
runs the swarm locally, and rsyncs reports back to the VPS.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 18:28:37 +03:00
zarubinvibeandЗарубин Филипп 3b7c85bae5 feat(telegram): intake bot + Mini App + guided installer (#2)
* feat(telegram): bot intake → inbox + daily VPS pull sync

- mnemazine-telegram-bot.mjs: zero-dep long-poll bot, writes text/photo/doc/voice/audio/video into staging inbox; chat_id allowlist; --selftest
- mnemazine-telegram-sync.sh: daily rsync pull VPS buffer → local inbox, then npm run run
- launchd plist template for daily 09:00 schedule

* feat(telegram): Mini App — status/send/run-now + reverse-channel poller

- webapp/index.html: Telegram Mini App (theme-aware, minimal); buffer status, send-to-inbox, run-now
- mnemazine-webapp-server.mjs: localhost API, initData HMAC verify + user allowlist, /api/{status,send,run}; --selftest
- run-now reverse channel: API touches .run-now; poll.sh consumes flag, Mac pulls+runs
- poll.sh: 5-min launchd tick — manual flag or daily 09:00 window; writes .last-run for app
- sync.sh: drop exec so markers persist; plist → StartInterval 300

* docs: Telegram intake architecture (bot + Mini App), EN+RU, no secrets

Generic scheme — host/secrets/domain abstracted. Linked from both READMEs.

* feat(setup): guided step-by-step installer for fresh devices

- setup.sh: staged wizard, numbered-menu questions, gates each stage
- checks prereqs and says exactly what to install before continuing
- missing capability → 'Друг, значит этого тебе не оставим' + continue
- asks inbox location (repo vs Desktop); optional Telegram bot incl. VPS deploy
- MNEMAZINE_SETUP_DRYRUN=1 walks stages without installing/deploying
- README EN+RU point to it

* fix(telegram): C1/C2 — secrets out of git, two-phase move (no data loss)

Phase 0+1.1 of audit fix plan:
- poll.sh/sync.sh: drop hardcoded VPS host/key → placeholders + gitignored .mnemazine/config.env (fail-fast on placeholder)
- sync.sh: two-phase move — pull to staging, promote, run protocol, delete on VPS ONLY after success (closes --remove-source-files data-loss window); deletes only files it took
- config.env.example template; .mnemazine/config.env gitignored
- selftest chat_id fixture 1 → 1 (was real personal id)

* fix(telegram): C3/C4 — kill stored-XSS + initData replay window

- webapp: render inbox file names via textContent/createElement (was innerHTML — file names come from untrusted Telegram uploads); add strict CSP meta
- webapp-server: verifyInitData now rejects stale auth_date (default 24h TTL, MNEMAZINE_INITDATA_TTL); closes forever-valid captured initData
- selftest: assert stale initData rejected (C7 — test from the threat, not current behavior)

* fix(telegram): C5 reliability — stop storm, TTY-guard, fail-closed, DoS caps

Phase 2:
- poll.sh: write daily marker BEFORE sync (no 5-min storm on failure); mkdir single-flight lock (macOS has no flock) with 60-min stale steal; re-queue manual run-now on failure. plist: RunAtLoad
- setup.sh: read EOF/TTY guard (no infinite loop under curl|bash/CI); gate install.sh exit code (stage actually gates)
- bot: advance/persist offset only AFTER successful handle (at-least-once, no dropped message); fail-closed allowlist (empty = reject + log id, not accept-all); cap download size 30MB; sanitize file extension (no traversal)
- webapp-server: cap request body 64KB (413); 500 returns generic error, detail to stderr only

* feat(telegram): C6 vault-patterns — run audit, config.env boundary, idempotent setup

Phase 3:
- /api/run: flag now carries {at, by} audit (kept as coalescing flag, not a full job queue — single user/button; YAGNI)
- 3.2 fenceUntrusted already covered: digest/synthesize fence note bodies at the LLM boundary (mnemazine-llm.mjs); inbox stays raw by design
- setup.sh: writes .mnemazine/config.env (chmod 600) from entered VPS details so poll/sync read the boundary; idempotent pm2 (start||restart) for rerun-safe deploy

* feat(telegram): Phase 4 polish — confirm run, auto-refresh, access log, throttle

- frontend: tg.showConfirm before run (no accidental token-spend); auto-refresh status every 15s while visible + on visibilitychange
- server: structured access log (stderr {ts,user,method,path}); light per-user 1/sec write throttle (429)

---------

Co-authored-by: Зарубин Филипп <289370046+zarubinphil@users.noreply.github.com>
2026-06-19 13:03:46 +03:00
Зарубин Филипп 80376437b2 Add semantic graph batcher 2026-06-18 23:41:18 +03:00
Зарубин Филипп e2dd73c98a Complete Mnemazine intake gate 2026-06-18 23:14:29 +03:00
Зарубин ФилиппandClaude Opus 4.8 73cbc0d30c feat(swarm): async LLM bridge + bounded-concurrency research swarm in deep synthesize
E3: llm bridge now uses async spawn (non-blocking) instead of spawnSync, so agent calls run concurrently. Deep synthesize processes clusters through a bounded pool (MNEMAZINE_CONCURRENCY, default 4) — cheap and fast. Each task is isolated (inner + outer try/catch): one cluster failing never blocks the swarm. Docs cover recognition fallback, swarm, concurrency.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 17:33:11 +03:00
Зарубин ФилиппandClaude Opus 4.8 b92328837e feat(run): per-file recognition isolation + LLM extraction fallback (deep)
E1: each file's extraction is isolated — a recognition failure logs extract_error, leaves the file in inbox, and never breaks the rest of the batch (failed count surfaced). E2: local-first recognition stays 0 tokens (Apple Vision OCR / markitdown / whisper); only when local yields nothing usable AND --deep is on does a vision-capable LLM (llmText, Read tool) transcribe the file. New llmText() in the provider bridge (Claude primary, Codex parity).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 17:29:34 +03:00
Зарубин ФилиппandClaude Opus 4.8 fb0831bb92 feat(llm): robust Claude binary discovery (npm/Homebrew/standalone/Desktop/VSCode)
Resolve claude independently of install method: explicit env -> login-shell PATH (respects however the user installed it: Desktop, npm global, standalone) -> common absolute locations -> newest VSCode extension binary. No longer tied to the VSCode path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 17:22:35 +03:00
Зарубин ФилиппandClaude Opus 4.8 b470ca9ab7 feat(digest): D Russian humanizer Spravka per note + session summary, after Graphify
mnemazine-digest.mjs writes a humanizer-style RU Справка (Что это/О чём/Почему важно мне/Связи) into each note with real connections from the Graphify graph, plus one session summary note mapping all atoms. Idempotent. Wired into run.mjs --deep after the graph pass; npm run digest. Owner context kept out of the public repo (MNEMAZINE_OWNER_CONTEXT / gitignored .mnemazine/owner-context.txt). Stub-tested injection + summary.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 17:19:22 +03:00
Зарубин ФилиппandClaude Opus 4.8 4cae8f5fb2 feat(synthesize): B knowledge enrichment stage before atomize (--deep)
Web-capable LLM agent researches and EXPANDS captured material (kb-enrich philosophy: recon, primary sources, practitioner experience, anti-hallucination fact->URL) before atomization, so atoms are built from grown knowledge not just the raw capture. On within --deep; disable via --no-enrich / MNEMAZINE_ENRICH=0. Reports enriched count; degrades to raw atomize on failure. Stub-tested enrich->atom chain.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 17:14:40 +03:00
Зарубин ФилиппandClaude Opus 4.8 bc60800660 feat(llm): provider abstraction — Claude primary, Codex parity
New mnemazine-llm.mjs: llmJson(prompt,schema,{provider,tools}). MNEMAZINE_LLM=claude(default)|codex. Claude via headless 'claude -p --output-format json' (JSON instructed in-prompt, no --dangerously-skip-permissions; tools opt-in). Codex backend unchanged at parity. codex.mjs is now a back-compat shim. synthesize/verify route through llm; verify selftest exercises codex stub via the shared contract.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 17:12:53 +03:00
Зарубин ФилиппandClaude Opus 4.8 e60d5bcad1 feat(security): scan extraction cache for token-secrets in release gate
Captured screenshots/PDFs can carry credentials that flow into notes. Token-only, dir-scoped, skipped on clean checkout. Positive-tested with planted AWS key.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 16:57:35 +03:00
Зарубин ФилиппandClaude Opus 4.8 6714bec65a fix(codex/synthesize/verify): neutralize prompt injection + harden error/edge paths
CRITICAL: untrusted extracted text fenced (inert-data delimiter + sentinel neutralize) before codex calls that run with headless bypass. HIGH: codexJson + listRecords JSON.parse guarded; fingerprint/atomFingerprint scoped by cluster id (no silent skip on shared/empty source refs); headOk uses a fresh timeout per request; synthesize reports degraded when --deep falls back. Codex scratch in one private 0700 mkdtemp. verifyDeep now covered by a stub-codex selftest.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 16:52:10 +03:00
Зарубин ФилиппandClaude Opus 4.8 45c03a499a fix(weekly): basename-collision data-loss + state path matches README:224
KGB adversarial proved two same-basename notes in different sections clobbered on move. Now keyed by full vault-relative path (slashes->__). State dir defaults to ~/Desktop/Mnemazine/.mnemazine/state (README:224). ENOENT->missing, no crash. Selftest covers collision + collision-content survival.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 16:52:10 +03:00
Зарубин ФилиппandClaude Opus 4.8 840a8daf35 chore(release-check): copy + syntax-check new codex/verify/weekly-state modules
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 16:19:05 +03:00
Зарубин ФилиппandClaude Opus 4.8 58b80aa52b feat(runner): G3 wire --deep/MNEMAZINE_DEEP through run -> synthesize (default conservative)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 16:19:05 +03:00
Зарубин ФилиппandClaude Opus 4.8 b9f3aaa7c6 feat(weekly): G2 apply read/work/forget to vault (work->backlog, forget->quarantine, never delete)
Browser exports weekly-state.json; weekly:state CLI applies it. Path-escape refused. --selftest covers move-not-delete + escape.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 16:19:05 +03:00
Зарубин ФилиппandClaude Opus 4.8 cc751dd6eb feat(synthesize): honest draft notes + idempotent fingerprints; G4 LLM atomize + G5 hybrid verify
C2 status:draft/verified:false. U2/U3 content-fingerprint naming + skip-existing. G4: --deep atomizes one cluster into focused atoms via shared codex bridge (default off -> local template). G5: verification_status verified/assumed/unknown — local structural gate by default, --deep adds HEAD+codex web cross-check.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 16:19:05 +03:00
Зарубин ФилиппandClaude Opus 4.8 dc909f4bc5 feat(graph): U5 prune graphify backups (keep N, default 3)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 16:18:52 +03:00
Зарубин ФилиппandClaude Opus 4.8 b61dd0bb4a feat(ingest): G1 site ingest — JSON-LD, API hints, meta/description, doc links
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 16:18:52 +03:00
Зарубин ФилиппandClaude Opus 4.8 aa87a85d9b feat(security): C1 broaden token markers + scan untracked; C3 resolveVault util
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 16:18:52 +03:00
Зарубин Филипп 86a68b6c64 Stop semantic shard runner on provider quota 2026-06-18 15:20:26 +03:00
Зарубин Филипп 42ca8cdbd4 Add strict semantic shard runner 2026-06-18 15:08:32 +03:00
Зарубин Филипп ccb8004f63 Fix same-vault Graphify semantic merge 2026-06-18 00:54:10 +03:00
Зарубин Филипп bb640adcfe Allow partial Graphify semantic success 2026-06-18 00:44:45 +03:00
Зарубин Филипп 18028c720e Limit Graphify API concurrency 2026-06-18 00:07:55 +03:00
Зарубин Филипп 3f58c7f8b9 Merge Graphify semantic API output safely 2026-06-17 23:46:24 +03:00
Зарубин Филипп d782c7faca Support API-backed Graphify semantic refresh 2026-06-17 23:32:16 +03:00
Зарубин Филипп 42c96d2b8c Add protocol synthesis stage 2026-06-17 22:52:06 +03:00
Зарубин Филипп 4ed7a71518 Enforce Mnemazine vault protocol 2026-06-17 22:32:54 +03:00
Зарубин Филипп 24cf2b937e Add report synthesis quality gate 2026-06-17 22:23:39 +03:00
Зарубин Филипп 2d2b1ee4b6 Improve video intake and graph refresh semantics 2026-06-17 21:57:24 +03:00
Зарубин Филипп 081988af7b fix: исключить graphify-out* бэкап-дирки из walk (не переобрабатывать) 2026-06-17 00:22:52 +03:00
tv5171621-source 2cf669fb0c docs: bilingual README pair (README.md EN + README.ru.md RU)
- README.md: full English, language toggle to README.ru.md
- README.ru.md: full Russian translation (replaces patchy inline RU)
- release-check: enforce two-file bilingual parity + H2 section drift guard
2026-06-15 15:45:28 +03:00
tv5171621-source dc323329d6 Ignore graph artifacts in release smoke 2026-06-15 14:47:35 +03:00
tv5171621-source f9e4049f02 Add release readiness gate 2026-06-15 14:46:29 +03:00
tv5171621-source af17f4e20e Harden local intake quality gate 2026-06-15 14:40:56 +03:00
tv5171621-source 79cd8c4944 Harden graph refresh defaults and smoke tests 2026-06-15 14:30:49 +03:00
tv5171621-source 65b36a93d0 Add guarded Graphify refresh helper 2026-06-15 14:22:32 +03:00
tv5171621-source 60289f787d Add YouTube channel ingestion 2026-06-15 03:11:15 +03:00
tv5171621-source 5c59152c06 Initial open source release 2026-06-15 02:47:14 +03:00