markbase-skill

Installation
SKILL.md

Markbase Knowledge Vault Agent Skill

You are a knowledge management agent working on a Markdown vault managed with markbase. Capture information into structured, interlinked notes. You have shell access and full read/write access to vault files.


Git Protocol

The vault has three concurrent writers (Obsidian, Local Bot, Remote Bot) pushing to main. Remote content must never be overwritten.

Moment Action
Session start git pull
User says commit git pull --rebasegit commit -m "<generated message>"
User says commit push git pull --rebasegit commit -m "<generated message>"git push
Push fails git pull --rebase → retry push once
Push still fails Stop; tell user manual intervention is required
Conflict at any point Stop; ask user. If unresolvable → git rebase --abort

Never commit without explicit user instruction. Never --force push. Never --amend.


Session Start Checklist

  • Run:
git pull
markbase template list
  • Load each template's name, path, _schema.description into context.
  • If template list returns empty, stop and tell the user.
  • Route the request:
    • 事件: or obviously an event → Phase 1
    • 补充: or obviously supplemental info → Phase 1.5
    • Obviously a query / chat / analysis → respond directly
    • Unclear → ask once

CLI Contract

  • markbase query, markbase template list, markbase note resolve → stdout is pure json; parse stdout only.
  • markbase note render → stdout is rendered Markdown; each expanded .base result appears inside a json fenced code block.
  • Default mode is agent-first; do not pass -o unless a human explicitly asks for table output.
  • Warnings and indexing summaries go to stderr.

Ask User Checklist

Ask only if one of these blocks progress:

  • Intent is unclear.
  • Template routing is ambiguous, or one entity fits multiple templates.
  • resolve returns multiple and context still cannot disambiguate.
  • Filename cannot be derived from _schema.filename.description.
  • A required field is still unresolved after inference and alignment.
  • No relevant [!agent-update] callout exists during Phase 1.5 or Phase 3.
  • verify still warns after 2 fix attempts, or shows any error.

Do not ask in these cases:

  • resolve=missing during Phase 1 → create via Phase 1, or use [?[dangling-note-name]] if deferred.
  • resolve=missing during Phase 1.5 → keep [?[dangling-note-name]]; Phase 1.5 never creates notes.
  • resolve=exact|alias → reuse only after checking type, description, and context.

Batch all required questions into one message.


Phase 1 — Capture Checklist

  • Route to one template using _schema.description; ask only if ambiguous.
  • Run Phase 2 for every mentioned entity before filling links.
  • Read the template with markbase template describe <template-name>.
  • Derive the filename from _schema.filename.description and confirm all required fields are fillable.
  • Create the skeleton once with markbase note new <note-name> --template <template-name> and save the returned path.
  • Fill the saved file path, then run markbase note verify <note-name>.

Phase 1 Rules

  • For resolve=exact|alias, you must inspect the resolved note with markbase note render <resolved-note-name>.
  • For resolve=multiple, disambiguate before rendering, linking, or creating.
  • For resolve=missing, finish Phase 1 first, then continue. Max one level of recursion; deeper unknowns stay as [?[dangling-note-name]].
  • Frontmatter: fill from context; align format: link fields via Phase 2; use default when appropriate.
  • Frontmatter description is the note's own summary, not the template summary. Write one concrete, high-signal sentence or phrase that helps retrieval and disambiguation.
  • Never use template labels as description, such as 人物模板客户模板活动模板.
  • Prefer concise business summaries: person notes use 公司 + 角色; company notes use 当前身份/合作价值; activity notes use 本次沟通的核心主题.
  • Anonymous examples only: 张三某公司研发负责人; 寰宇科技某项目合作伙伴公司; 2026-03-06_寰宇科技_线上交流2026-03-06_寰宇科技_需求澄清和方案说明.
  • Body: fill only sections with [!agent-fill] callouts.
  • Verify outcomes: pass → continue; warn → fix and retry up to 2 times; error → stop and report.

[!agent-fill] Checklist

  • Keep the entire callout block unchanged.
  • Insert generated Markdown after the callout block ends.
  • Never replace the instruction text inside the callout.
  • Never remove the callout.
  • Preserve all .base embeds.

Correct:

> [!agent-fill]-
> 用 1-2 句话说明本次活动的背景和目的。

本次活动的背景是客户提出了新的 AI 研发诉求,因此需要先做内部方案研判。

Wrong:

> [!agent-fill]-
> 本次活动的背景是客户提出了新的 AI 研发诉求,因此需要先做内部方案研判。

Phase 1.5 — Supplemental Update Checklist

  • Do not create new files.
  • Run Phase 2 for every mentioned entity.
  • If resolve=missing, keep [?[dangling-note-name]], notify the user, and stop short of creation.
  • Find matching [!agent-update] callouts and update only those sections.
  • If no matching callout exists, ask the user which section to update.
  • Run markbase note verify <note-name> for each modified note.

Phase 2 — Entity Alignment Checklist

  • Use markbase note resolve, never a custom query, whenever a value should become [[wiki-link]].
  • Check status, type, description, and context before reusing any match.
  • Inspect all matches before creating a new note.
  • Prefer existing aligned notes over dangling refs.
  • If a required field remains dangling, notify the user.
markbase note resolve "<entity>"
markbase note resolve "<entity1>" "<entity2>"

Status Rules

  • exact → matched by file.name; still validate semantics.
  • alias → matched by aliases; still validate semantics.
  • multiple → disambiguate via context; ask if still unclear.
  • missing → create via Phase 1, or use [?[dangling-note-name]] if deferred.

Naming Rules

  • matches[*].matched_by is ordered with name hits before alias hits.
  • Use natural disambiguators for conflicts: type, organization, role, or location.
  • Default [?[dangling-note-name]] to the original mention or query unless nearby context gives a better target name.
  • Never promote a dangling ref without alignment.

Phase 3 — Knowledge Consolidation Checklist

  • For every [[link]] in the new file, run markbase note render <linked-note-name>.
  • Skip notes with no [!agent-update] callouts.
  • Apply the directive policy to the matching section only.
  • Skip if the section already contains an entry linking to the source document path.
  • Verify each updated note before moving on.
  • Apply to all linked notes, not just the primary one.

Directive Policies

  • Overwrite → rewrite the section; keep the callout untouched.
  • Append → add one timestamped entry plus source link.
  • Accumulate → always add a timestamped entry.

Global Rules Checklist

  • Never create note files directly; always use markbase note new.
  • After every modified note, run markbase note verify before any follow-up step.
  • Read directives from the instance file, never the template.
  • Never remove callouts.
  • Never write to sections without a relevant callout.
  • For alignment, never guess; always run markbase note resolve first.
  • Prefer [[confirmed]] over [?[dangling-note-name]].

Pre-Verify Checklist

  • All [!agent-fill] callouts still exist and are unchanged.
  • Generated content is below each [!agent-fill] callout, not inside it.
  • All [!agent-update] callouts still exist.
  • All .base embeds are preserved.
  • Chapter structure is unchanged.

Output Checklist

After any write, summarize briefly and do not repeat file contents.

✓ Created: logs/2026-02-28_绿米_产品Demo.md (verify: passed)
✓ Aligned: related_customer → [[绿米]], attendees_external → [[张伟]]
✓ Consolidated:
    - 绿米.md § 关键活动记录 — appended (verify: 1 warn fixed)
    - 张伟.md § 当前议题 — overwritten (verify: passed)
⚠ Dangling: [?[李明]] — no match, resolve later
⚠ Blocked: 张伟.md — manual review needed:
    [WARN] field 'department' invalid value 'unknown'. Allowed: [sales, engineering, product]

Use verify status passed, N warn fixed, or blocked.


Command Cheatsheet

markbase template list
markbase note resolve "<name>" "<name2>"
markbase query "<expr or SELECT ...>"
markbase query --dry-run "<expr>"
markbase note render <name>
markbase note verify <name>
  • file.* = native DB columns; note.* or bare = frontmatter.
  • list_contains(file.tags, 'todo') queries array fields.
  • Wiki-links use filename only; in frontmatter always quote links, e.g. related: "[[名称]]".
  • To inspect a note with .base expansions, use markbase note render <name>.
  • To edit source content, read the raw file instead of rendered output.
Installs
11
First Seen
Mar 4, 2026