From logseq-expert
Expert in reading data from Logseq DB graphs via HTTP API or CLI. Auto-invokes when users want to fetch pages, blocks, or properties from Logseq, execute Datalog queries against their graph, search content, or retrieve backlinks and relationships. Provides the logseq-client library for operations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/logseq-expert:reading-logseq-dataThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill auto-invokes when:
This skill auto-invokes when:
Client Library: See {baseDir}/scripts/logseq-client.py for the unified API.
| Operation | Description |
|---|---|
get_page(title) | Get page content and properties |
get_block(uuid) | Get block with children |
search(query) | Full-text search across graph |
datalog_query(query) | Execute Datalog query |
list_pages() | List all pages |
get_backlinks(title) | Find pages linking to this one |
get_graph_info() | Get current graph metadata |
from logseq_client import LogseqClient
client = LogseqClient()
page = client.get_page("My Page")
print(f"Title: {page['title']}")
print(f"Properties: {page['properties']}")
# Find all books with rating >= 4
results = client.datalog_query('''
[:find (pull ?b [:block/title :user.property/rating])
:where
[?b :block/tags ?t]
[?t :block/title "Book"]
[?b :user.property/rating ?r]
[(>= ?r 4)]]
''')
for book in results:
print(f"{book['block/title']}: {book['user.property/rating']} stars")
# Search for mentions of "project"
results = client.search("project")
for block in results:
print(f"Found in: {block['page']}")
print(f"Content: {block['content'][:100]}...")
[:find (pull ?p [:block/title])
:where
[?p :block/tags ?t]
[?t :db/ident :logseq.class/Page]]
[:find (pull ?b [*])
:where
[?b :block/tags ?t]
[?t :block/title "Book"]]
[:find ?title ?author
:where
[?b :block/title ?title]
[?b :user.property/author ?author]
[?b :block/tags ?t]
[?t :block/title "Book"]]
[:find (pull ?t [:block/title :logseq.property/status])
:where
[?t :block/tags ?tag]
[?tag :db/ident :logseq.class/Task]
[?t :logseq.property/status ?s]
[?s :block/title "In Progress"]]
[:find (pull ?b [:block/title {:block/page [:block/title]}])
:in $ ?page-title
:where
[?p :block/title ?page-title]
[?b :block/refs ?p]]
;; Count books per author
[:find ?author (count ?b)
:where
[?b :block/tags ?t]
[?t :block/title "Book"]
[?b :user.property/author ?author]]
from logseq_client import LogseqClient
# Auto-detect backend
client = LogseqClient()
# Force specific backend
client = LogseqClient(backend="http")
# Custom URL/token
client = LogseqClient(
url="http://localhost:12315",
token="your-token"
)
try:
page = client.get_page("Nonexistent Page")
except client.NotFoundError:
print("Page doesn't exist")
except client.ConnectionError:
print("Cannot connect to Logseq")
except client.AuthError:
print("Invalid token")
# Get multiple pages efficiently
pages = ["Page1", "Page2", "Page3"]
results = [client.get_page(p) for p in pages]
# Or use a single query
query = '''
[:find (pull ?p [*])
:in $ [?titles ...]
:where
[?p :block/title ?titles]]
'''
results = client.datalog_query(query, [pages])
(pull ?e [:needed :fields]) vs [*]:in clauseIf HTTP API unavailable, the client falls back to CLI:
# CLI mode (automatic if HTTP fails)
client = LogseqClient(backend="cli", graph_path="/path/to/graph")
# Query still works the same way
results = client.datalog_query("[:find ?title :where [?p :block/title ?title]]")
Returns Python dicts/lists directly from API.
# Get normalized output
page = client.get_page("My Page", normalize=True)
# Returns: {"title": "...", "uuid": "...", "properties": {...}, "blocks": [...]}
{baseDir}/references/read-operations.md for all operations{baseDir}/templates/query-template.edn for query patternsnpx claudepluginhub c0ntr0lledcha0s/claude-code-plugin-automations --plugin logseq-expertActivates when user needs to search, retrieve, or browse notes from SiYuan Notebooks. Supports keyword search, recent content, task management, and SQL queries.
Build and maintain an LLM-curated personal knowledge base — the "LLM Wiki" pattern from Andrej Karpathy's April 2026 gist. Use this skill whenever the user wants to ingest a source (paper, article, transcript, PDF, notes) into a persistent compounding knowledge base, ask a question against accumulated notes, lint or audit such a base, or initialize a new one. Trigger on phrases like "add this to my wiki", "ingest this paper", "compile this into the knowledge base", "what does my wiki say about X", "lint the wiki", "build a knowledge base from these documents", "research notes", "second brain", "personal knowledge base", or any reference to LLM Wiki / OmegaWiki. Trigger even when the user does not say "wiki" — if they are accumulating sources over time and want them organized, this applies. The skill scales — sharded indexes, atomic pages, YAML frontmatter, and a bundled search script keep the wiki from becoming a context bottleneck at hundreds or thousands of pages.