Logseq Rig: safer AI workflows for Logseq OG graphs

I built Logseq Rig for people who want AI coding agents to work with a Logseq OG graph without giving them unrestricted access to the whole thing.

Repo: GitHub - gustavo-meilus/logseq-rig: Local guardrails for AI-assisted Logseq OG graphs: exact Markdown/Git retrieval, managed Codex setup, and integrity checks. · GitHub

The idea is simple: Markdown and Git stay authoritative. The agent gets bounded retrieval, explicit context, and integrity checks.

Instead of recursively reading an entire graph, an agent can ask for exactly what it needs:

logseq-rig resolve /path/to/graph "Project Alpha"
logseq-rig find /path/to/graph "release notes"
logseq-rig context /path/to/graph "Project Alpha" --children 2
logseq-rig backlinks /path/to/graph "Project Alpha"

Results are JSON, so they work well in shell, Codex, and other agent workflows.

After an agent edits the Markdown:

logseq-rig check /path/to/graph --changed

The checks are meant to catch graph-specific breakage involving properties, assets, block IDs/references, configured directories, and related invariants.

The project is deliberately narrow. It is not an MCP server, semantic search layer, remote endpoint, or unrestricted graph-writing API.

The question I’m exploring is:

What is the smallest trustworthy interface an AI agent needs to work effectively with an existing Logseq OG graph?

Logseq Rig currently provides:

  • exact page/block/reference/backlink retrieval
  • bounded context instead of broad graph reads
  • Git-aware history and changed-file checks
  • managed Codex setup
  • safe install/update/uninstall with --dry-run
  • optional local read-only DataScript queries
  • Python 3.11+, with no runtime Python dependencies

Quick start:

git clone https://github.com/gustavo-meilus/logseq-rig.git
cd logseq-rig
python -m pip install .

logseq-rig status /path/to/graph
logseq-rig doctor /path/to/graph

I’m especially interested in feedback from people using OG graphs with Claude, Codex, or other coding agents:

  • What retrieval operation is missing?
  • What has an external editor or AI agent broken in your graph before?
  • What agent integration would be useful next without turning this into a general-purpose graph server?

Real edge cases and small synthetic reproductions are very welcome.

Hi, thanks for sharing this, great work!

I also have an agent skill/script for working with Logseq OG, but there’s no validation with note writing like you have – I need to integrate that! The main things it adds beyond Rig’s current scope are zettelkasten-specific writing conventions; hierarchical note-ID allocation, checking and repair; persistent block-UUID creation and lookup; index generation from block references; Zotero citation-key conventions; and a scripted write-branch → commit → merge workflow.

It’s all unpublished at the moment, but if some of that would fit your direction, I’d be happy share some of it or even prepare a pull request.

1 Like

Thanks! This sounds very aligned with where I’d like to take Rig.

My intent is to make it more of a collaborative project if that sounds good to you, so I’d be very happy to incorporate these ideas. Feel free to share what you have, open PRs for the parts if that fit naturally, or send changes for me to review and integrate together.

The note-ID/UUID handling, index generation, Zotero conventions, and Git workflow in particular sound very good and useful additions.

Cool. Already did a little pull request. And my agent skill is already using your code. I’ll split some of my features into further pull requests!

1 Like