by MarcoPorcellato
Transforms a local Logseq OG graph into an autonomous, high‑token‑density workspace by continuously indexing notes with a local LLM and applying agentic enhancements, all while staying fully offline.
Matryca Plumber is a headless, sandboxed daemon that watches a Logseq OG vault, runs a locally hosted LLM (e.g., Ollama or LM Studio), and repeatedly enriches the markdown files with semantic indexes, link‑healing, entity consolidation, and other agentic modifications. It operates entirely offline, writes directly to the Logseq AST on disk, and optionally exposes the same mutation plane via an MCP‑compatible stdio interface.
uv Python manager:
uv tool install matryca-plumber
.env.example to .env and set at least:
LOGSEQ_GRAPH_PATH=/absolute/path/to/your/graph
MATRYCA_LM_BASE_URL=http://localhost:1234/v1 # LM Studio / Ollama endpoint
MATRYCA_LM_MODEL=gemma-4-e4b-it # default model
matryca plumber status
The UI guides you through a pre‑flight checklist and lets you start the engine.matryca plumber start # background daemon
matryca --json read page "My Project"
matryca context load "My Project|aaaaaaaa-..."
matryca --json read subtree '{"page":"My Project","block_uuid":"…","heading":"Implementation"}'
matryca service install
.md files directly.dead-link:: / missing-asset:: markers for broken wiki links or missing assets.alias:: properties for overlapping concepts.--json – machine‑readable output for downstream automation.read subtree) and write back findings directly into the graph.Q: Do I need Logseq running while the daemon works? A: No. The daemon works directly on the markdown files. Logseq can be open or closed; changes made by either side are merged safely via OCC.
Q: Will my data be sent to the cloud? A: No. All processing happens locally with your own LLM instance; there are zero network calls unless you explicitly configure a remote model endpoint.
Q: Can I test the daemon without risking my main vault?
A: Yes. The README strongly advises cloning the vault first and pointing LOGSEQ_GRAPH_PATH to the copy.
Q: How does the MCP integration work?
A: When MATRYCA_MCP_ENABLED=true the daemon exposes a stdio‑based MCP server that accepts the same commands the UI uses (e.g., store_fact, ingest_document). No additional setup is required beyond the env flag.
Q: What hardware is required? A: A typical laptop with ~16 GB RAM and a CPU‑only LLM (Gemma 4‑E4b Instruct is the default) works well. Larger models may need more memory.
Q: How do I stop the daemon?
A: matryca plumber stop or kill the service if installed as a system daemon.
Developed by Marco Porcellato · Matryca.ai — open-source local-first maintenance daemon for Logseq OG. The product name is Matryca Plumber (not “Matryca” alone). See docs/BRANDING.md.
v1.9 — Structural graph hygiene + agent DX. Agentic Knowledge Management for Logseq OG: enterprise-grade, local-first background AI with Sovereign UI, typed CLI, and direct Markdown AST mutation (no Logseq HTTP API). v1.9 adds zero-LLM link rot checks (
dead-link::/missing-asset::), Journey Log on today's journal, CLI--json,matryca context load, andread subtreefor token-efficient agent reads — on top of v1.8 Zero-Prefill prompts, bounded RAM, and cooperative bootstrap I/O for 16 GB CPU-only laptops. Optional FastMCP stdio reuses the samegraph_dispatchcontract. Inspired by Andrej Karpathy's LLM-Wiki vision. 100% native Logseq AST parity, OCC, versioned AI authorship stamping.

"Logseq is building the best local outliner database. But AI Agent memory is at the very bottom of their roadmap. Matryca Plumber gives you that future today, safely bridging your local agents to your Logseq graph without waiting years." - Marco Porcellato - Matryca.ai chief architect and co-founder
Matryca Plumber is a 100% headless, sandboxed standalone daemon + CLI that turns your local Logseq graph into a high token-density agentic workspace — no network APIs and no Logseq desktop JSON-RPC. It treats your vault as a tree of blocks, not a flat document store. Logseq OG remains optional: humans and the daemon co-edit the same .md trees on disk.
Matryca Plumber is not a one-shot script — it is an enterprise-grade, local-first background AI daemon for Logseq. It polls your graph on a duty cycle, calls a local LLM (LM Studio or Ollama), appends semantic indexes, runs optional cognitive lint modules, and logs every token transaction — while you edit the same .md files in Logseq or leave the vault idle. Optional MCP-attached sessions reuse the identical mutation plane for interactive queries; they are not required for background operation. Every write path mirrors Logseq's on-disk AST contract: page frontmatter at line 0, block properties contiguous to their parent bullet, namespace filenames encoded exactly like Logseq's Clojure Datalog layer, and optimistic concurrency control that aborts stale writes when you type during inference.
Matryca Plumber turns your local graph into a high token-density agentic workspace by continuously polling your notes, running local LLMs (like LM Studio or Ollama), appending semantic indexes, and healing broken links—all completely offline, while you work or sleep.
Zero Cloud. Zero Data Leaks. 100% Native Logseq AST.
Matryca Plumber edits your local .md files directly. While it features safe Optimistic Concurrency Control (OCC) to prevent data loss, we strongly recommend testing it on a clone of your graph first. This allows you to see the AI in action and explore its capabilities without affecting your primary notes.
How to safely clone your graph (crucial if you use Logseq Sync):
MyGraph folder and rename it to MyGraph_Test).MyGraph_Test directory..env configuration (LOGSEQ_GRAPH_PATH) to this test folder.Once you are comfortable with how Matryca Plumber behaves and have tuned the safety tiers, you can point it to your main graph.
The fastest way to get started is using uv, the blazing-fast Python package manager.
Run the CLI directly without polluting your system. This only opens the Sovereign UI at http://127.0.0.1:8500 — it does not start graph maintenance until you complete the pre-flight checklist and click Start Engine (or run matryca plumber start separately).
uvx --from matryca-plumber matryca-plumber status
(matryca-plumber status is shorthand for matryca plumber status.)
Install the binary to use the matryca command anywhere:
uv tool install matryca-plumber
matryca plumber status
# same as: matryca-plumber status
The browser opens the Sovereign UI. On every fresh visit, a Pre-flight checklist modal appears first (even if you already ran matryca plumber start in a terminal). Dismiss it with Continue to dashboard once the live checks are green, then click Start Engine in the header to launch the maintenance daemon from the UI.
Optional — headless daemon before opening the UI:
matryca plumber start # background worker only; no browser
matryca plumber status # UI still shows pre-flight; engine may already show IDLE/RUNNING
Install it as a LaunchAgent/systemd service so it wakes up with your OS:
matryca service install
Same headless contract as MCP tools; add --json for structured stdout:
export LOGSEQ_GRAPH_PATH=/path/to/your/graph
matryca --json read page "My Project"
matryca context load "My Project"
matryca context load "My Project|aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
matryca --json read subtree '{"page":"My Project","block_uuid":"…","heading":"Implementation"}'
Full spec: docs/openspec/agent-dx.md. Background link checks: docs/openspec/link-verification.md.
Unlike generic scripts, Matryca Plumber is a continuous background engine. When paired with a local LLM (Gemma 4-E4b Instruct via LM Studio or Ollama), it provides:
[[WikiLinks]] and creates isolated seed pages for them.alias:: properties for overlapping concepts.store_fact + ingest_document) query and mutate your graph headlessly. Set MATRYCA_MCP_ENABLED=true in .env only on machines where you trust the MCP host (stdio MCP is off by default; the host has full graph read/write with no separate authentication).pages/matryca___config.md or pages/matryca-config.md with - # Telos and - # AI Constraints headings — injected into daemon LLM prompts and MCP output; store_fact appends durable preferences under Constraints (docs/openspec/identity-config.md).ingest_document parses external Markdown via an OS temp file (never under pages/), stamps fresh id:: UUIDs, and appends to daily Ingest/YYYY-MM-DD or MATRYCA_INGEST_PAGE, with optional LOG / GLOSSARY ledgers (docs/openspec/ingest.md).assets/ paths into .matryca_link_registry.json; async HTTP HEAD + filesystem checks; OCC-safe dead-link:: / missing-asset:: block properties (docs/openspec/link-verification.md).--json, matryca context load, read subtree, and Journey Log (## 🤖 Matryca Activity on today's journal) (docs/openspec/agent-dx.md).Matryca Plumber is 100% headless, but it ships with a Sovereign UI Cockpit (matryca plumber status or uvx … matryca-plumber status).
It's a local React dashboard running on http://127.0.0.1:8500 that provides:
X-Matryca-Token). Set MATRYCA_UI_TOKEN on shared hosts (or MATRYCA_UI_REQUIRE_EXPLICIT_TOKEN=true); session bootstrap is loopback-only; split rate limits for authenticated vs anonymous API traffic.See SECURITY.md for the full operator hardening matrix (MATRYCA_MCP_ENABLED, graph path allowlist, shared LLM SSRF policy, log redaction).
Matryca Plumber provisions missing runtime files automatically where possible (repo .env from .env.example, matryca-l1/, cache dirs, matryca-wiki.yml). The modal still walks you through setup so nothing surprises you on first run. It is developed by Marco Porcellato at Matryca.ai — the same attribution shown in the Sovereign UI pre-flight wizard.
Operator steps (same text as the UI wizard):
Control room connection — If you can read this dashboard, the local API on port 8500 is up. Keep the window open while the engine runs.
Logseq graph (test vault first) — Point LOGSEQ_GRAPH_PATH at the root of a Logseq OG vault (the folder that contains pages/). Use a clone for your first run; do not enable Logseq Sync on test graphs. In the UI: Settings (gear) → Logseq Graph Path → absolute path → Save.
Local LLM — Start an OpenAI-compatible server (LM Studio, Ollama, etc.). In Settings set the base URL (e.g. http://localhost:1234/v1) and the exact model id, then Refresh models to confirm discovery.
Matryca Plumber (by Marco Porcellato · Matryca.ai) is built for offline, CPU-only use on a typical 16 GB RAM machine — no cloud subscription or discrete GPU required. The recommended and tested model is Gemma 4-E4b Instruct — set the exact id gemma-4-e4b-it in Settings, then Refresh models. For CPU inference, prefer GGUF weights at Q4_K_M or Q5_K_M. We are actively testing additional open models to improve CPU-only, 16 GB setups; Gemma 4-E4b Instruct is our current default. Avoid large MoE models (e.g. Llama 4 Scout): full weights still require 60GB+ RAM.
First-run expectations — Phase 1 catalogs the entire graph (can take a long time on large vaults; v1.8 yields to the OS periodically during harvest). Phase 2 processes roughly one LLM-heavy page per poll interval by default. After Phase 1, the daemon releases heavy in-memory indexes to keep RAM stable for long runs.
Live checks (re-run anytime with Re-run checks):
| Check | What it validates |
|---|---|
| Environment file | Repository .env exists (created from .env.example on first boot when possible). |
| Logseq graph path | LOGSEQ_GRAPH_PATH is set and points at a valid vault root. |
| L1 session memory | Sibling matryca-l1/ (or configured MATRYCA_L1_PATH / wiki memory_path) is ready. |
| Local LLM endpoint | LLM_BASE_URL passes SSRF policy and GET /v1/models responds; warns if the configured model id is not listed. |
Start Engine stays disabled until every live check is green. If you started the daemon earlier with matryca plumber start, the UI may already show IDLE or RUNNING and Start Engine may be disabled — the pre-flight modal still opens so you can review settings; use Pre-flight in the header to reopen it later.
.md files directly using atomic file I/O.st_mtime before inference and acquires the page lock only for the write. If you edited in Logseq while the model was thinking, the commit aborts. No silent data loss — and Logseq can still save during long local runs..matryca_plumber_daemon.lock).docs/resilience-llm-json-triz.md.PagePromptSession), bounded RAM (BM25 postings-lite, semantic cache LRU, post-bootstrap teardown), and cooperative bootstrap I/O — tuned for 16 GB laptops and vaults up to ~10,000 pages. See docs/v1.8-OPTIMIZATION-PLAN.md.matryca --json … for machine-readable stdout; matryca context load and read subtree to shrink context windows.You are in control. Nothing mutates your prose unless you explicitly enable it in the UI.
| Mode | Risk | What it allows |
|---|---|---|
| 🟢 Safe Mode | Read-only | Semantic routing cache, entity consolidation (alias::), property hygiene — never edits your bullet text. |
| 🟠 Augmented Mode | Side-blocks | Heal Dangling Links, Backpropagate Links (appends foldable context sections) — your original bullets stay intact. |
| 🔴 Surgeon Mode | Inline edits | Inline Semantic Corrections (wraps concepts in [[WikiLinks]]), Auto-Split Dense Blocks — strictly opt-in. |
Copy .env.example to .env. The only required variable is your graph path:
LOGSEQ_GRAPH_PATH=/absolute/path/to/your/Logseq/graph
MATRYCA_LM_BASE_URL=http://localhost:1234/v1 # LM Studio or Ollama endpoint
MATRYCA_LM_MODEL=gemma-4-e4b-it # Gemma 4-E4b Instruct — tested default
# Optional: Claude Desktop / Cursor MCP (off by default)
MATRYCA_MCP_ENABLED=true
On first start (daemon, CLI, MCP, or UI), Matryca Plumber automatically creates anything missing for a healthy runtime:
logs/ (or paths from MATRYCA_PLUMBER_LOG_PATH / MATRYCA_LOGURU_LOG_PATH)<parent-of-your-vault>/matryca-l1/ — session rules beside the vault (not inside pages/); optional override via MATRYCA_L1_PATH<vault>/.matryca_semantic_cache/, templates/, and matryca-wiki.yml (from matryca-wiki.example.yml when absent)The identity config page is not auto-created (use Logseq or store_fact). Ingest / LOG / GLOSSARY pages are created on first ingest_document call. Optional MATRYCA_INGEST_PAGE pins a fixed inbox (e.g. AI_Inbox). See docs/openspec/identity-config.md and docs/openspec/ingest.md.
See docs/openspec/runtime-bootstrap.md for rationale (L1 vs L2, idempotency, and what is intentionally not auto-created).
(See docs/ARCHITECTURE.md for advanced thermal pacing, context compression, and deep linter settings. Copy the full template from .env.example — it documents UI auth, rate limits, graph allowlists, and log redaction.)
Copy the v1.8 Edge computing & performance block from .env.example. Highlights:
| Knob | Why |
|---|---|
MATRYCA_BOOTSTRAP_YIELD_EVERY |
Keeps macOS/Windows responsive during Phase 1 file scans |
MATRYCA_RAM_BUDGET_MB |
Logs when daemon RSS exceeds a soft cap |
MATRYCA_BM25_MODE=ondemand |
Trade query latency for lower steady-state RAM |
MATRYCA_LLM_CLUSTER_HISTORY=false |
Shorter Ermes history — better KV reuse in cluster mode |
MATRYCA_CPU_SANDBOX=true |
Pin Plumber to idle cores; pair with manual LLM core mask |
MATRYCA_GRAPH_READ_MMAP=true |
Kernel-paged reads during Phase 1 regex catalog path |
Install CPU affinity support: uv sync --extra edge or pip install matryca-plumber[edge] (psutil).
Deep dive: docs/v1.8-OPTIMIZATION-PLAN.md · docs/v1.8-SOFTWARE-EDGE-PLAN.md · docs/openspec/llm-performance.md
Load testing: uv run python scripts/gen_synthetic_graph.py /path/to/graph --count 1000 · Slow CI: make perf
Want to contribute or run from source?
git clone [https://github.com/MarcoPorcellato/matryca-plumber.git](https://github.com/MarcoPorcellato/matryca-plumber.git)
cd matryca-plumber
make install
# Build the React frontend
cd frontend && npm install && npm run build && cd ..
# Run tests (550+ passing, Mypy strict)
make check
# Optional: slow memory / harvest soak tests
make perf
| Document | Description |
|---|---|
SYSTEM_PROMPT.md |
Agent discipline, made-by:: authorship, OCC rules. |
docs/ARCHITECTURE.md |
Data planes, Plumber lifecycle, RMW locking, v1.9 hygiene + v1.8 edge performance. |
docs/v1.8-OPTIMIZATION-PLAN.md |
v1.8 scope, env vars, load testing. |
docs/v1.8-SOFTWARE-EDGE-PLAN.md |
CPU sandbox, frozen KV prefix, adaptive LLM, mmap reads. |
docs/openspec/README.md |
Index of behavioral specs (lint, ingest, identity, v1.9 hygiene/DX). |
docs/openspec/llm-performance.md |
LLM prompt layout, memory, and I/O contracts. |
docs/BRANDING.md |
Product name (Matryca Plumber), Matryca.ai attribution, writing rules. |
docs/openspec/runtime-bootstrap.md |
Startup provisioning: logs, L1, cache, wiki YAML. |
docs/openspec/l1-l2-routing.md |
L1 memory vs L2 graph routing for agents. |
docs/openspec/identity-config.md |
Telos / AI Constraints and store_fact. |
docs/openspec/ingest.md |
ingest_document atomic ingestion pipeline. |
docs/openspec/link-verification.md |
v1.9 URL/asset hygiene and sidecar registry. |
docs/openspec/agent-dx.md |
v1.9 CLI JSON, context macro, Journey Log. |
docs/PROJECT_DIARY.md |
Maintainer log, phase history, crushed bottlenecks. |
CONTRIBUTING.md |
Setup, uv commands, make check standards. |
SECURITY.md |
Vulnerability reporting and .env hardening controls. |
Apache-2.0 — see LICENSE.

Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by modelcontextprotocol
A basic implementation of persistent memory using a local knowledge graph. This lets Claude remember information about the user across chats.
by topoteretes
Provides dynamic memory for AI agents through modular ECL (Extract, Cognify, Load) pipelines, enabling seamless integration with graph and vector stores using minimal code.
by basicmachines-co
Enables persistent, local‑first knowledge management by allowing LLMs to read and write Markdown files during natural conversations, building a traversable knowledge graph that stays under the user’s control.
by agentset-ai
Provides an open‑source platform to build, evaluate, and ship production‑ready retrieval‑augmented generation (RAG) and agentic applications, offering end‑to‑end tooling from ingestion to hosting.
by smithery-ai
Provides read and search capabilities for Markdown notes in an Obsidian vault for Claude Desktop and other MCP clients.
by chatmcp
Summarize chat messages by querying a local chat database and returning concise overviews.
by dmayboroda
Provides on‑premises conversational retrieval‑augmented generation (RAG) with configurable Docker containers, supporting fully local execution, ChatGPT‑based custom GPTs, and Anthropic Claude integration.
by qdrant
Provides a Model Context Protocol server that stores and retrieves semantic memories using Qdrant vector search, acting as a semantic memory layer.
by doobidoo
Provides a universal memory service with semantic search, intelligent memory triggers, OAuth‑enabled team collaboration, and multi‑client support for Claude Desktop, Claude Code, VS Code, Cursor and over a dozen AI applications.