# Logseq Matryca Parser

> A deterministic Python parser, typed AST, in-memory graph, RAG adapter, exporter, visualizer, and bounded agent-access layer for sovereign Logseq Markdown vaults.

Current source version: v1.11.4. Source metadata is not publication evidence;
verify availability on PyPI and GitHub Releases. Broken-reference scans reuse
a temporary block-alias index for eligible lookups. This changes neither
Markdown parsing nor reference-resolution rules and is not performance
qualification. The bounded agent-file hardening from v1.11.3 remains in place.

Logseq Markdown files are the source of truth. The parser preserves outliner
hierarchy, block UUIDs, page aliases, backlinks, properties, tasks, timestamps,
and assets instead of flattening a vault into unrelated text chunks. Derived
views include graph queries, LangChain documents, context-enriched chunks,
JSON and Obsidian exports, interactive visualization, and token-efficient
agent reads and writes. Native LlamaIndex nodes are delegated to the separate
`logseq-matryca-parser-llamaindex` companion, which is planned but not yet
published on PyPI; it is not a Parser dependency.

Use documented package-root imports for stable APIs. Treat filesystem writes,
symlinks, asset paths, graph identity, and parse/serialize round trips as safety
boundaries. Read AGENTS.md before changing the repository.

`agent-read` writes an unauthenticated X-Ray alias cache in place. It rejects
identity mismatches detected by checking the path before opening, the opened
descriptor, and the path immediately before writing, but does not guarantee
detection of every later path replacement or a hard link added after
validation. The write is non-atomic and not serialized across processes. Use
X-Ray only with trusted vaults and trusted, stable parent directories. See the
[filesystem safety contract](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/reference/FILESYSTEM_SAFETY.md).

## Start here

- [Human overview](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/README.md): Product purpose, capabilities, installation, CLI, Python API, and support routes.
- [AI agent instructions](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/AGENTS.md): Product map, source-of-truth model, repository contract, safety rules, and validation gates.
- [Machine knowledge index](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/index.md): Canonical maintained documentation entry point.
- [Cookbook](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/COOKBOOK.md): Runnable integration recipes for RAG, graph queries, watching, agents, and testing.

## Core capabilities

- [Architecture](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/ARCHITECTURE.md): LOGOS parsing, LogseqGraph, SYNAPSE, FORGE, KINETIC, LENS, agents, and data flow.
- [Clean architecture](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/CLEAN_CODE_ARCHITECTURE.md): Canonical module boundaries, stable graph APIs, and dependency rules.
- [AST primer](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/logseq_ast_primer.md): Logseq Markdown topology, indentation, properties, references, tasks, and temporal semantics.
- [API stability](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/reference/API_STABILITY.md): Stable, provisional, and internal API tiers plus typing guarantees.
- [Structured diagnostics](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/reference/DIAGNOSTICS.md): Diagnostic payloads, codes, rendering, path safety, and escalation.
- [Filesystem safety](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/reference/FILESYSTEM_SAFETY.md): Vault containment, symlink policy, atomic replacement, dry runs, metadata, and limits.
- [Agent action contract](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/reference/AGENT_ACTION_CONTRACT.md): Read/write authority, approval boundaries, provenance, and prompt-injection rules.
- [Support and compatibility matrix](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/reference/CONFORMANCE_SUPPORT_MATRIX.md): Supported runtimes, public API tiers, optional adapters, and explicit limits.
- Experimental Org reader: private, non-stable, read-only parsing of Org text or one selected `.org` file; no vault graph and no complete GNU Org/Logseq conformance. Diagnostics are selective, not a full unsupported-syntax inventory. See [API stability](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/reference/API_STABILITY.md) and [maintainer status](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/internal/LOGSEQ_ORG_PARSER_EXPERIMENTAL_STATUS.md).
- [Supply-chain evidence policy](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/reference/DEPENDENCY_LICENSE_POLICY.md): Release SBOM, dependency/license inventory, checksums, and provenance verification.
- [Daily metrics threat model](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/security/DAILY_METRICS_THREAT_MODEL.md): Security and privacy boundary for repository traffic automation.

## Runnable entry points

- [Offline SYNAPSE RAG example](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/examples/run_synapse_rag.py): Combined LangChain, LlamaIndex and enriched-chunk example without a user vault. Without the separate companion it exits at the LlamaIndex call before printing results; use the cookbook's independent LangChain/enriched recipes instead. The companion is not yet published.
- [Support and compatibility matrix](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/reference/CONFORMANCE_SUPPORT_MATRIX.md): Current Parser and optional-companion boundaries.
- [Demo example](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/examples/run_demo.py): Small end-to-end parser demonstration.
- [CLI entry point](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/src/logseq_matryca_parser/kinetic.py): Shared options and the export command; use `matryca-parse` or `python -m logseq_matryca_parser`.
- [Additional CLI commands](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/src/logseq_matryca_parser/kinetic_commands.py): scan, assure, visualize, demo, append, agent-read and agent-write. There is no separate parse subcommand; use the Python parser API or export/scan workflows.
- [Public package API](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/src/logseq_matryca_parser/__init__.py): Supported package-root exports.

## Build, test, and contribute

- [Contributing](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/CONTRIBUTING.md): Environment setup, quality gates, tests, and pull-request workflow.
- [Official Logseq Markdown compatibility evidence](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/quality/OFFICIAL_LOGSEQ_MARKDOWN_COMPATIBILITY_2026-10-10.md): Verified results for all 313 selected official documents, metadata-only page semantics, corpus provenance and explicit coverage limits.
- [Additional Logseq Markdown datasets](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/quality/LOGSEQ_MARKDOWN_DATASET_CANDIDATES_2026-10-10.md): Research-backed corpus candidates, syntax diversity, content rights and proposed priorities; these datasets have not yet been tested.
- [Security policy](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/SECURITY.md): Supported versions and private vulnerability reporting.
- [Public roadmap](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/ROADMAP_2026-2027.md): Milestones, dependencies, and evidence gates without release promises.
- [Issue triage policy](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/ISSUE_TRIAGE_POLICY.md): Issue labels, priorities, good-first issue lifecycle, stale-work, and closure rules.
- [Protocol adapter decision](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/decisions/ADR-0001-PROTOCOL_ADAPTER_BOUNDARY.md): Conditions for any future MCP, A2A, or networked adapter.
- [Official OKF migration gate](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/decisions/ADR-0002-OFFICIAL-OKF-V02-MIGRATION-GATE.md): Why the measured v0.2 backlog is not hidden by a mechanical rewrite.
- [AAIF submission gate](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/decisions/ADR-0003-AAIF-SUBMISSION-GATE.md): Current NO-GO and the evidence required before reconsideration.
- [Release process](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/RELEASE_PROCESS.md): SemVer, immutable build, provenance, PyPI, and GitHub publication procedure.

## Optional

- [Release highlights](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/RELEASE_HIGHLIGHTS.md): Reader-focused history of shipped capability milestones.
- [Changelog](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/CHANGELOG.md): Exhaustive versioned changes.
- [Repository improvement roadmap](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/REPOSITORY_STELLAR_ROADMAP_2026-08-06.md): Dated audit evidence and sequenced improvement record.
- [Current issue reconciliation](https://raw.githubusercontent.com/MarcoPorcellato/logseq-matryca-parser/main/docs/quality/OPEN_ISSUE_RECONCILIATION_2026-09-24.md): Dated backlog decisions and shipped evidence; rebind live GitHub status before acting.
