logseq-asset-linker

A formatting rule for creating links from macOS file paths to assets in Logseq, a note-taking and knowledge-management application. It also explains how Logseq stores pages with nested names, called namespaces, as filenames.

In plain words
What is it for?
Use it to turn asset paths into relative Markdown links and account for namespace filenames such as Parent__Child__Grandchild.md.
Why use it?
It helps prevent incorrect asset links when a file path and Logseq's relative-link format use different locations or naming conventions.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/codekiln/logseq-cursor-rules/logseq-asset-linker
Clone the repo
git clone --depth 1 https://github.com/codekiln/logseq-cursor-rules
Per session 7 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,643 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00007 $0.01643
Opus 5 $0.00003 $0.00822
Sonnet 5 $0.00001 $0.00329
Haiku 4.5 $0.00001 $0.00164

Measured yesterday against content hash a40ce49db4e3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

logseq-asset-linker scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

logseq-asset-linker.mdc · 139 lines

How it starts

The opening of the file, as written. The whole thing — 139 lines — stays where its author put it; the contents beside it link to each section on GitHub.

This project rule is an extension to logseq-flavored-markdown which describes how to construct links to assets in the assets directory and its subdirectories.

Description

This rule can help the user convert macOS file paths into relative Markdown links for Logseq, a knowledge management and note-taking application.

Logseq uses a concept called namespaces. Namespaces are characters that allow for the addition of hierarchy in a file system.

In Logseq, page titles that use namespaces (e.g., [[Work/Projects/Logseq]]) are converted to filenames by replacing the slashes (/) with double underscores (__), resulting in Work__Projects__Logseq.md.

This translation allows Logseq to represent hierarchical namespaces logically within the app while storing all files in a single directory.

Therefore, any namespace structure like [[Parent/Child/Grandchild]] becomes a single file named Parent__Child__Grandchild.md.


Use Case 1: Path Name to Markdown Asset Link

When provided with a full file path to an asset, this GPT should:

  • Identify the Logseq folder within the path.
  • Format a relative link starting from a typical page location (logseq/pages/), assuming the page is located in logseq/pages/somepage.md.
  • Generate Markdown code that can be directly copied into Logseq, maintaining correct relative paths for seamless linking.

The response should always be formatted as a code snippet for easy copying.

Example Interaction:
  • USER: Can you give me the link for /a/b/c/logseq/assets/Course-101/assignments/week3/notes/course101__assignment__03__notes.pdf?
  • GPT:
    ![course101__assignment__03__notes.pdf](mdc:../assets/Course-101/assignments/week3/notes/course101__assignment__03__notes.pdf)
    

Use Case 2: Logseq Namespace Name to Asset Path

This GPT should also be able to:

  • Turn a Logseq page reference from a namespaced name into a filename and an asset path.
  • For example, given a Logseq page like [[A/B/C/D]], generate:
    • A filename A__B__C__D of the appropriate type (e.g., png, pdf, etc.).
    • The expected location of the asset as ../assets/A/B/C/D/A__B__C__D.
    • Replace all non-alphanumeric characters with underscores in filenames to ensure compatibility.

Read the full file on GitHub · 139 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 139 lines · 7 tokens per session scan A a40ce49db4e3

Subscribe to this mod's changes

logseq-asset-linker is a cursor rule published in the GitHub repository codekiln/logseq-cursor-rules (2 stars, last pushed 11mo ago), licensed MIT. It adds 7 tokens to every session and 1,643 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.