therain2020/dsh-obsidian-sync--packages-plugin-obsidian-sync ↗★ 0

dsh-plugin-obsidian-sync

面向模型的 Obsidian 笔记读写工具,带路径穿越防护。 适合让 agent 读写本地 Obsidian 库笔记;需先有 vault 路径。

包名
dsh-plugin-obsidian-sync
兼容性
待验证
Harness 依赖范围
0.1.1-rc.2
Cordis 依赖范围
^4.0.1
版本
0.1.0
最近更新
2026年8月21日

安装

此插件尚未提供可验证的 bundle,或兼容性检查未通过。请先阅读仓库说明。 阅读完整 README ↗

dsh-plugin-obsidian-sync

An example DeepSeek Harness plugin: one model-facing tool, one system-prompt section, no state.

What it registers

obsidian_sync_greet — greets someone by name.

ArgumentTypeRequiredMeaning
namestringyeswho to greet
languagestringnoen, zh, or ja; defaults to the configured language

Returns the canonical value { greeting, language }. The model reads the greeting text; language reaches the UI through presentation metadata.

A blank name or an unsupported language fails as a structured tool error naming the supported set, so the model can correct itself in one turn.

A system-prompt section (tool:obsidian_sync_greet, order 900) telling the model what the tool is for and that it is a demonstration.

Config

KeyTypeDefaultMeaning
defaultLanguagestringenlanguage used when a call omits language

An unsupported defaultLanguage throws at load rather than at first call — a plugin that mounts should be one that works.

Role

Function plugin: named name / inject / Config / apply, no default export. Injects tools and systemPrompt. Both registrations are fiber-scoped, so disposal withdraws them with no manual teardown.

src/greet.ts holds the logic as a pure function; src/index.ts is only wiring. That split is what keeps the interesting cases unit-testable without booting a Context.

Model Experience

Tool schema

What the model sees

The obsidian_sync_greet schema: a required name string, an optional language string whose description names the supported tags, and the description above.

Token effect

Fixed schema cost on every request where the tool is visible.

KV Cache effect

Prefix-stable while the definition and visibility are unchanged. Plugin lifecycle or a config change that alters the schema invalidates reuse from it.

Prompt section and tool result

What the model sees

One short static prompt section, plus the rendered greeting text on each call.

Token effect

The section is a fixed cost per request; each result adds one short line.

KV Cache effect

Append-only: the section sits in the stable request prefix, and results follow it without invalidating existing entries.

Known Limitations and Deferred Work

  • Three hardcoded languages — the greeting table is a constant, not config. A real plugin whose value set varies by deployment would make it a Config field.
  • No presentResult — a completed call falls back to the generic card. A tool whose result deserves richer rendering should implement it and carry the fields through presentationMeta.