← Back to Skills Marketplace
juanirm

Logseq

by juanirm · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
3313
Downloads
6
Stars
8
Active Installs
1
Versions
Install in OpenClaw
/install logseq
Description
Provide commands for interacting with a local Logseq instance through its Plugin API. Use for creating pages, inserting blocks, querying the graph database, managing tasks, retrieving content, or automating workflows in Logseq. Only works with a locally running instance with the API enabled; default port or set path expected for [$API accessible skill].
README (SKILL.md)

Logseq Plugin API

Interact with your local Logseq instance through its JavaScript Plugin API. This skill enables reading, writing, querying, and automating workflows in your Logseq graph.

Prerequisites

Logseq must be running locally with a plugin that exposes the API. The standard way is:

  1. Install a bridge plugin that exposes logseq API via HTTP (e.g., via a custom plugin or localhost endpoint)
  2. Alternative: Use Node.js with @logseq/libs package to script against the running Logseq instance

The API is primarily designed for in-browser plugins, so accessing it from external scripts requires a bridge/proxy.

Core API Namespaces

The Logseq Plugin API is organized into these main proxies:

logseq.App

Application-level operations: getting app info, user configs, current graph, commands, UI state, external links.

Key methods:

  • getInfo() - Get app version and info
  • getUserConfigs() - Get user preferences (theme, format, language, etc.)
  • getCurrentGraph() - Get current graph info (name, path, URL)
  • registerCommand(type, opts, action) - Register custom commands
  • pushState(route, params, query) - Navigate to routes

logseq.Editor

Block and page editing operations: creating, updating, moving, querying content.

Key methods:

  • getBlock(uuid) - Get block by UUID
  • getCurrentPage() - Get current page entity
  • getCurrentPageBlocksTree() - Get all blocks on current page
  • getPageBlocksTree(page) - Get all blocks for a specific page
  • insertBlock(target, content, opts) - Insert a new block
  • updateBlock(uuid, content) - Update block content
  • createPage(pageName, properties, opts) - Create a new page
  • deletePage(pageName) - Delete a page
  • getPageLinkedReferences(page) - Get backlinks to a page
  • registerSlashCommand(tag, action) - Add custom slash commands

logseq.DB

Database queries using Datalog.

Key methods:

  • q(query, ...inputs) - Run Datalog query
  • datascriptQuery(query, ...inputs) - Direct Datascript query

logseq.UI

UI operations: messages, dialogs, main UI visibility.

Key methods:

  • showMsg(content, status) - Show toast notification
  • queryElementById(id) - Query DOM elements

logseq.Git

Git operations for the current graph.

Key methods:

  • execCommand(args) - Execute git command

logseq.Assets

Asset management.

Key methods:

  • listFilesOfCurrentGraph(path) - List files in graph

Common Workflows

Read Content

// Get current page
const page = await logseq.Editor.getCurrentPage();

// Get all blocks on a page
const blocks = await logseq.Editor.getPageBlocksTree('Daily Notes');

// Get a specific block
const block = await logseq.Editor.getBlock('block-uuid-here');

// Query with Datalog
const results = await logseq.DB.q(`
  [:find (pull ?b [*])
   :where [?b :block/marker "TODO"]]
`);

Write Content

// Create a new page
await logseq.Editor.createPage('Project Notes', {
  tags: 'project',
  status: 'active'
}, { redirect: false });

// Insert a block
const block = await logseq.Editor.insertBlock(
  'target-block-uuid',
  '- New task item',
  { before: false, sibling: true }
);

// Update a block
await logseq.Editor.updateBlock('block-uuid', 'Updated content');

// Batch insert multiple blocks
const blocks = [
  { content: 'First item' },
  { content: 'Second item', children: [
    { content: 'Nested item' }
  ]}
];
await logseq.Editor.insertBatchBlock('parent-uuid', blocks, { sibling: false });

Task Management

// Find all TODO items
const todos = await logseq.DB.q(`
  [:find (pull ?b [*])
   :where
   [?b :block/marker ?marker]
   [(contains? #{"TODO" "DOING"} ?marker)]]
`);

// Mark task as DONE
await logseq.Editor.updateBlock('task-uuid', 'DONE Task content');

// Get tasks on current page
const page = await logseq.Editor.getCurrentPage();
const blocks = await logseq.Editor.getPageBlocksTree(page.name);
const tasks = blocks.filter(b => b.marker === 'TODO' || b.marker === 'DOING');

Navigation and UI

// Navigate to a page
logseq.App.pushState('page', { name: 'Project Notes' });

// Show notification
logseq.UI.showMsg('✅ Task completed!', 'success');

// Get app config
const configs = await logseq.App.getUserConfigs();
console.log('Theme:', configs.preferredThemeMode);
console.log('Format:', configs.preferredFormat);

Implementation Approaches

Since Logseq's Plugin API is browser-based, you have several options:

Option 1: Bridge Plugin

Create a minimal Logseq plugin that exposes API calls via HTTP:

// In Logseq plugin (index.js)
logseq.ready(() => {
  // Expose API endpoints
  logseq.provideModel({
    async handleAPICall({ method, args }) {
      return await logseq.Editor[method](...args);
    }
  });
});

// Then call from external script via HTTP POST

Option 2: Node.js Script with @logseq/libs

For automation scripts, use the @logseq/libs package:

npm install @logseq/libs

Note: This requires a running Logseq instance and proper connection setup.

Option 3: Direct Plugin Development

Develop a full Logseq plugin following the plugin samples at: https://github.com/logseq/logseq-plugin-samples

API Reference

For complete API documentation, see:

Key Data Structures

BlockEntity

{
  id: number,           // Entity ID
  uuid: string,         // Block UUID
  content: string,      // Block content
  format: 'markdown' | 'org',
  page: { id: number }, // Parent page
  parent: { id: number }, // Parent block
  left: { id: number }, // Previous sibling
  properties: {},       // Block properties
  marker?: string,      // TODO/DOING/DONE
  children?: []         // Child blocks
}

PageEntity

{
  id: number,
  uuid: string,
  name: string,              // Page name (lowercase)
  originalName: string,       // Original case
  'journal?': boolean,
  properties: {},
  journalDay?: number,       // YYYYMMDD for journals
}

Tips & Best Practices

  1. Always check for null: API methods may return null if entity doesn't exist
  2. Use UUIDs over IDs: Block UUIDs are stable, entity IDs can change
  3. Batch operations: Use insertBatchBlock for multiple inserts
  4. Query efficiently: Datalog queries are powerful but can be slow on large graphs
  5. Properties are objects: Access with block.properties.propertyName
  6. Format matters: Respect user's preferred format (markdown vs org-mode)
  7. Async all the way: All API calls return Promises

Common Gotchas

  • Page names are lowercase: When querying, use lowercase page names
  • Journal pages: Use journalDay format (YYYYMMDD) not date strings
  • Block hierarchy: Respect parent/child relationships when inserting
  • Format differences: Markdown uses - for bullets, Org uses *
  • Properties syntax: Different between markdown (prop::) and org (:PROPERTIES:)
Usage Guidance
This skill is documentation and examples for talking to a locally running Logseq instance — it won't magically connect to remote services or ask for secrets. Before using: (1) only enable or install an HTTP bridge if you bind it to localhost and/or add authentication so other machines can't access your notes; (2) verify any npm package versions (e.g., @logseq/libs) you install come from the official registry; (3) be aware API calls and logseq.Git.execCommand can modify or move your local files—backup important data and ensure you have appropriate git credentials configured if operating on remote repos; (4) because the skill is instruction-only, no code will run until you implement a bridge or run scripts yourself, so review any bridge/plugin code you write or install.
Capability Analysis
Type: OpenClaw Skill Name: logseq Version: 1.0.0 This skill is classified as suspicious due to the documentation of high-risk capabilities within the Logseq Plugin API, specifically `logseq.Git.execCommand` and `logseq.Assets.listFilesOfCurrentGraph` in `SKILL.md` and `references/api-reference.md`. While the skill bundle itself does not contain explicit malicious instructions or prompt injection attempts, these documented APIs allow the AI agent to execute arbitrary git commands and list local files within the Logseq graph's directory. These capabilities, if exploited by a malicious user prompt, could lead to unauthorized file system interaction or information disclosure, even though they are presented as legitimate features of the Logseq API.
Capability Assessment
Purpose & Capability
The name/description match the content: everything in SKILL.md documents the Logseq Plugin API and local automation approaches. No unrelated environment variables, binaries, or install steps are requested. The only external dependency mentioned (@logseq/libs via npm) is directly relevant to scripting Logseq.
Instruction Scope
The instructions stay within the stated purpose (reading/writing/querying a local Logseq graph). They recommend two approaches: a bridge plugin that exposes API endpoints over HTTP and using @logseq/libs from Node.js. The bridge approach can expose your local notes if the HTTP endpoint is not carefully bound to localhost or secured; the SKILL.md does not provide guidance on access controls. The docs also show use of logseq.Git.execCommand and other operations that can modify repository files—expected for this purpose but powerful, so be aware these actions modify local data.
Install Mechanism
This is an instruction-only skill with no install spec or code files, so nothing will be written or executed by installing the skill itself. The SKILL.md suggests optionally running `npm install @logseq/libs` for Node.js scripts; that is a normal, proportional dependency for scripting Logseq.
Credentials
No environment variables, credentials, or config paths are requested. This aligns with a local-API skill. Note: performing Git operations against remote repositories may require existing git credentials/config on the host—this is expected behavior, not a hidden credential request.
Persistence & Privilege
The skill does not request persistent presence (always: false) and is user-invocable. There is no code or install that changes other skills or system-wide settings in the package, consistent with an instruction-only helper.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install logseq
  3. After installation, invoke the skill by name or use /logseq
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release – provides powerful local Logseq automation via Plugin API: - Enables creating pages, inserting/updating blocks, managing tasks, and querying the graph database. - Supports Git integration, asset management, and in-app navigation/notifications. - Accesses all core Logseq Plugin API namespaces: App, Editor, DB, UI, Git, and Assets. - Requires a locally running Logseq instance with API access via a bridge plugin or compatible setup. - Includes usage tips, best practices, and quick code examples for streamlined workflows.
Metadata
Slug logseq
Version 1.0.0
License
All-time Installs 8
Active Installs 8
Total Versions 1
Frequently Asked Questions

What is Logseq?

Provide commands for interacting with a local Logseq instance through its Plugin API. Use for creating pages, inserting blocks, querying the graph database, managing tasks, retrieving content, or automating workflows in Logseq. Only works with a locally running instance with the API enabled; default port or set path expected for [$API accessible skill]. It is an AI Agent Skill for Claude Code / OpenClaw, with 3313 downloads so far.

How do I install Logseq?

Run "/install logseq" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Logseq free?

Yes, Logseq is completely free (open-source). You can download, install and use it at no cost.

Which platforms does Logseq support?

Logseq is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Logseq?

It is built and maintained by juanirm (@juanirm); the current version is v1.0.0.

💬 Comments