Repository navigation
v4.2.0 — failover · telemetry · Insights · KG hygiene · quality bar
MeMesh v4.2.0 — local memory layer for Claude Code & MCP coding agents. Universal AI memory (one SQLite file, no Docker, no cloud required).
Install / Upgrade
Option A — Claude Code plugin (recommended for Claude Code users):
/plugin marketplace add PCIRCLE-AI/memesh-llm-memory
/plugin install memesh@pcircle-memesh
Existing v4.1.7 plugin users: re-running /plugin install memesh@pcircle-memesh upgrades in place. v4.1.6 and earlier should re-add the marketplace first via the marketplace add command above (the marketplace identifier was renamed in v4.1.7).
Option B — npm global (works with any MCP-compatible client):
npm install -g @pcircle/memesh@4.2.0
memesh install-hooks # wires up Claude Code hooks
memesh doctor # verifies setup is green
Verify after install: memesh doctor should report Overall: PASS with Skills + hooks integrity: PASS.
A combined release covering recall-path simplification, cross-provider LLM failover, end-to-end LLM telemetry, the new Insights / Analytics dashboard surfaces, KG-connectivity work, and a type-safety + lint cleanup pass (0 lint warnings, 0 executable any in src/). +6k LOC, +46 tests (938 → 984 passing). Highlights below grouped per Keep-a-Changelog convention.
Added
- Cross-provider LLM failover (
src/core/llm-client.ts+config.ts) — new optionalllmFallbacks: LLMConfig[]config field walked in order when the primaryllmprovider fails with auth / rate-limit / upstream / network errors. A 400-class bad-request stops the chain (the prompt itself is broken). Per-attempt telemetry surfaces viaopts.onAttempt; secret-shaped tokens (sk-*,Bearer *) are redacted before reaching telemetry. Wired into all 5 Smart-Mode flows (dreamer, pattern-detector, consolidator, auto-tagger, failure-analyzer). Also exposed via the dashboard's POST/v1/configendpoint with mirrored apiKey masking on GET responses. - Persistent LLM telemetry (
src/core/llm-telemetry.ts+llm_telemetrySQLite table) — every callLLM attempt (primary + each fallback tried) writes one row with{flow, provider, model, project, attempt_index, status, latency_ms, error_class, error_message, fallback_used}. Newmemesh telemetry [--window N]CLI command renders a per-flow scorecard. Prompt and response bodies are intentionally NOT persisted — the schema stays narrow to avoid a new privacy boundary. - Dashboard Insights tab (
dashboard/src/components/InsightsTab.tsx) — surfaces the dreamer's pending / applied / rejected proposals with one-click accept/reject, replacing the CLI-onlymemesh dream list. New first-tab landing for fresh users. Backed by GET/POST/v1/dream/proposals[/:id][/accept|reject]endpoints. - Dashboard Insights banner (
dashboard/src/components/InsightsBanner.tsx) — slim cross-tab nudge appearing when pending proposals > 0. Click navigates to Insights tab; × dismisses for the current session (re-surfaces next session). Hidden when current tab is already Insights. - Dashboard Analytics LLM telemetry panel (
dashboard/src/components/LlmTelemetryPanel.tsx) — per-flow scorecard with success rate, fallback usage warning, median latency, provider breakdown, and error-class chips. 7d / 30d / 90d window pills. Color-coded left border by success rate (green ≥90%, yellow ≥50%, red <50%). Backed by GET/v1/telemetry?window=N. - Dashboard PatternCard (
dashboard/src/components/PatternCard.tsx) — distinct visual treatment forpattern_emergentproposals (amber accent, severity surfacing) so emerging patterns read differently from weekly recap digests. Wired through a newkindfield onProposalSummarythatlistProposalsnow returns. - Stop-hook dream auto-trigger (
scripts/hooks/session-summary.js:maybeTriggerDream) — after every coding session, if the project has ≥10 episodic entities and the project's last dream pass was >24h ago, spawn a detachedmemesh dream run --max-llm-calls 2 --window-days 14so the Insights tab populates without the user knowing the CLI exists. Per-project state in~/.memesh/dream-history.json; per-run logs under~/.memesh/dream-runs/<project>-<ts>.log. - Heuristic KG relation backfill (
src/core/kg-backfill.ts+ newmemesh kg backfill-relationsCLI) — non-LLM connector for orphan entities. Two rules: tag co-occurrence (related-tofor entities sharing ≥2 topical tags after a strict allow-list filter) and project clustering (belongs-to-projectlinking orphan lessons / decisions / bug-fixes to the most recent release / feature in the same project). Conservative filter excludes auto-capture noise (session_end, auto_saved, commit, completed, lesson, etc.) to prevent cartesian-edge explosion on dense lesson clusters. - Optional digest validator (
src/core/digest-validator.ts+--validateCLI flag onmemesh dream run) — second LLM pass that cross-checks a proposed digest's claims against source observations. Returnspass | soften | reject. Soften writes the proposal with avalidation_warningsarray attached; reject skips the proposal entirely. Default off because it doubles per-proposal LLM cost. Validator's own LLM calls land in telemetry under flow=digest_validator. summarizes/evidence_forrelations on accepted dream proposals (src/core/dreamer.ts:applyProposal) — accepting a digest now creates onesummarizesedge per source entity (digest → source). Patterns getevidence_for(source → pattern). Without these edges, accepted digests showed as graph orphans even though they conceptually summarize their sources.- Dashboard roadmap tree + mindmap toggle (
ProjectRoadmap.tsx) — vertical timeline tree visualization (default) with a mindmap toggle for radial dendrogram view. Roadmap milestones now require a PM-anchorable entity (release / feature / decision / plan / architecture / bug_fix / lesson_learned / etc.) — date-range fallback labels for activity-only weeks have been retired. created_attimestamp on dashboard memory rows — every row in Browse / Manage now displays its absolute timestamp inYYYY-MM-DD HH:mmform alongside the relative-time badge.
Changed
- Recall is now strictly LLM-free. The
query-expandermodule has been retired (src/core/query-expander.tsand its 17 tests removed).recallEnhancedis single-pass FTS5 + sqlite-vec. Verified at 95.40% R@5 / 97.60% R@10 / MRR 0.8899 on LongMemEval-S Mode A — identical to the previously published baseline at every per-question-type breakdown. Mean per-query latency holds at ~18ms. Recall has been documented as FTS5-only on the hot path for several releases; the query-expander module is now removed so source matches docs exactly. - Dashboard graph tab card overflow fixed — type-filter row converted from
flexWrap: 'wrap'toflexWrap: 'nowrap'+overflowX: 'auto'(a horizontal scroll strip) so the canvas is no longer pushed below the viewport on a 1440x900 screen.CANVAS_HEIGHTreduced 500 → 440. Canvas width measurement switched togetBoundingClientRectminus card horizontal padding (24px) so sub-pixel layout never produces a horizontal scrollbar on the card itself. - Dashboard "dream" terminology replaced with user-friendly framing — across 11 locales, "consolidate + dream compression" became "weekly recap + pattern detection". Same engineering work, less metaphorical naming.
- Dashboard
Insightsis now the default landing tab for fresh users (was Lessons). Existing users' last-tab persistence still wins. - CLI
memesh dreamsummary preserves the full error reason. The previouss.reason.split(':')[0]collapsed multi-segment provider errors (e.g."LLM call failed: provider error: 401") into the leading fragment, losing the error class. Full reason is now grouped and printed. - Doc-sync for the query-expander retire — README + 4 locale parities (de / vi / th / pt) + ARCHITECTURE.md + API_REFERENCE.md + dashboard i18n's
settings.llmOptional.smartFeatures(11 locales) all updated. Smart Mode benefits now described as auto-tagging + failure analysis + consolidate + dream, not "LLM query expansion (~97% recall)". - Type-safety pass across
src/— eliminated all 60 executableanyinstances in shipping code. Express handlers now use typedRequest<P, ResB, ReqB>generics;catch (err: any)replaced withinstanceof Errornarrowing; SQLite metadata payloads typed asRecord<string, unknown>. Pattern is uniform and PR-review enforces it going forward. - Lint health — resolved every standing warning.
npm run lintreports 0 errors and 0 warnings at v4.2.0. ESLint flat config now codifies the hook silent-failure pattern ('no-empty': ['warn', { allowEmptyCatch: true }]) so legitimate hook code passes while genuine empty blocks still surface. - Native i18n translations for v4.2.0 dashboard surfaces — 8 locales (
ja,ko,pt-BR,fr,de,vi,es,th) now have native translations for Insights / banner / telemetry / pattern keys. Previously these locales carried English placeholders to satisfy the parity test.
Fixed
/v1/configGET response masksllmFallbacks[].apiKey. Mirrors the existingllm.apiKeymasking pattern. ThellmFallbacksfield is new in v4.2.0; the masking landed before any release tagged this code path. Verified end-to-end with a placeholder key./v1/configPOST body schema acceptsllmFallbacks. PreviouslyConfigBody.strip()silently dropped the field, so the dashboard had no way to configure a fallback chain.- PatternCard cosmetic fixes (
InsightsTab.tsx):- busyId race on rapid accept clicks — replaced scalar
busyIdwithSet<number>so two concurrent accepts don't stomp each other's button-disabled state. digest_observations_preview === '(empty)'no longer renders as(empty)….- Filter chips have
aria-pressed, expand toggle hasaria-expanded(accessibility). - Status-badge color falls back to neutral gray on unknown future status values.
- Removed dead-code response-shape unwrap (
Array.isArray(data) ? data : ...).
- busyId race on rapid accept clicks — replaced scalar
Security
- API-key paths in fallback chains are masked on every dashboard config response (see Fixed).
Tests
- 938 → 984 vitest tests (+46) across 63 files, +6k LOC. New test files:
tests/core/llm-client.test.ts(failover decision tree, 23 cases),tests/core/llm-telemetry.test.ts(persistence + summarise, 4 cases),tests/core/kg-backfill.test.ts(heuristic contract, 19 cases),tests/core/digest-validator.test.ts(pass / soften / reject + sanitiser integration, 13 cases),tests/hooks/dream-auto-trigger.test.ts(gate + throttle + spawn, 5 cases). 3 independent LongMemEval-S Mode A regression runs confirm 95.40% R@5 unchanged.
Migration
- A new
llm_telemetrySQLite table is created on firstopenDatabase()after upgrade (idempotentCREATE TABLE IF NOT EXISTS). No data is migrated — telemetry starts fresh. - Existing
dream_proposalsrows are unaffected. New proposals fromapplyProposalnow also writesummarizes/evidence_foredges, but historical proposals' graph connectivity is unchanged. Runmemesh kg backfill-relationsto retroactively connect the high-signal long tail. - Dashboard build artifact (
dashboard/dist/index.html) grows from 333 kB → 370 kB (gzip 84 kB → 90 kB) — the four new tabs / panels / cards landed inline.
Known limitations
- Windows
dream-auto-trigger.test.ts"all gates pass" scenario is skipped. Hook completes butdream-history.jsonis not updated when MEMESH_DIR is propagated throughexecFileSyncto a child Node process. Functionality verified on macOS + Linux. The other four gate scenarios (LLM gate, activity gate, throttle gate, prefix-collision) all pass on Windows. v4.2.0 ships with stderr-trace instrumentation behind theMEMESH_DREAM_TRIGGER_DEBUG=1env flag so the failing gate can be identified from the first[memesh dream-trigger] exit reason=…line on a Windows runner.
Verification
npx tsc --noEmitcleannpm run lint— 0 errors / 0 warningsnpm test— 984/984 passing (63 test files)memesh doctor— Overall: PASS (13/13)- LongMemEval-S Mode A — R@5 95.40% / R@10 97.60% / MRR 0.8899 (baseline preserved across 3 independent runs)
Full Diff
v4.1.7 → v4.2.0 diff · Merged via PR #43