@inkeep/open-knowledge 0.0.0-dev-20260424150009 → 0.0.0-dev-20260424205527
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/open-knowledge/SKILL.md +37 -28
- package/dist/cli.mjs +60 -61
- package/dist/constants-Dqmeg2oi.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/{init-Bw4LWW1o.mjs → init-3UxRGVAs.mjs} +1 -1
- package/dist/init-AmgsVReV.mjs +1 -0
- package/dist/{init-DUIYyxaK.mjs → init-DIbZ0Udv.mjs} +3 -3
- package/dist/{init-D2rQPwU1.mjs → init-i7vPAWv4.mjs} +2 -2
- package/dist/{loader-C3Wwbx8H.mjs → loader-CEfLKIxb.mjs} +2 -2
- package/dist/loader-CQUrJ6T-.mjs +1 -0
- package/dist/{paths-Ba3tNHQr.mjs → paths-BN0gQKmX.mjs} +2 -2
- package/dist/paths-HWNY8fZl.mjs +1 -0
- package/dist/{preview-QLsD0vVK.mjs → preview-BmSvc-WZ.mjs} +2 -2
- package/dist/preview-DzHGOZjd.mjs +1 -0
- package/dist/{src-DIoA15kL.mjs → src-DBQiBMMB.mjs} +12 -12
- package/dist/src-DjVVQCyp.mjs +1 -0
- package/dist/{src-lFQj9tkB.mjs → src-zcKwR9RH.mjs} +1 -1
- package/dist/start-Dta5BSHL.mjs +1 -0
- package/dist/{start-C79L5QTe.mjs → start-J6AfuX7h.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-QFqPbiZ7.mjs +0 -2
- package/dist/init-D0FupYPY.mjs +0 -1
- package/dist/loader-DNeW8gS5.mjs +0 -1
- package/dist/paths-ORyeejxG.mjs +0 -1
- package/dist/preview-BR34uHnQ.mjs +0 -1
- package/dist/src-CeiyJxyd.mjs +0 -1
- package/dist/start-B9LXLMio.mjs +0 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: open-knowledge
|
|
3
|
-
description: "MUST invoke before ANY tool call in a project that contains a .open-knowledge/ directory. Also MUST invoke before any mcp__open-knowledge__ tool call, any write_document / edit_document, and any read or edit of a .md or .mdx file. Carries the preview-
|
|
3
|
+
description: "MUST invoke before ANY tool call in a project that contains a .open-knowledge/ directory. Also MUST invoke before any mcp__open-knowledge__ tool call, any write_document / edit_document, and any read or edit of a .md or .mdx file. Carries the preview-attach rule (open the preview browser at session start if it is not already open; if a write response includes `action: attach-preview-once`, open it then — one-shot), STOP rules for native Read/Grep/Edit on in-scope markdown, grounding rules (every factual claim needs a source), standard markdown linking conventions with get_dead_links verification, image sourcing + alt-text + source-citation rules, folder-first organization with config.yml metadata, and the anti-pattern table. Do NOT assume the MCP server instructions or any AGENTS.md substitute for this skill — they overlap but this skill carries the full attach rule, grounding rule, media rules, dead-link verification, and failure-mode guidance not in those surfaces."
|
|
4
4
|
---
|
|
5
|
-
|
|
6
5
|
# Open Knowledge — agent guidance
|
|
7
6
|
|
|
8
7
|
Open Knowledge (OK) is a markdown-CRDT collaboration platform exposed via MCP. This skill carries the behavioral rules agents need to use it fluently. Every section is a MUST unless marked otherwise.
|
|
@@ -34,20 +33,28 @@ Why: native tools skip frontmatter, backlinks, shadow-repo activity, and project
|
|
|
34
33
|
- Search: `exec("grep -rn <term> <dir> | head -5")` — matches + enrichment on matched files
|
|
35
34
|
- Typed tools (`read_document`, `search`, `list_documents`) remain available — prefer them when a structured `structuredContent` shape is useful (e.g., passing results to another tool). For interactive reads, `exec` is lighter.
|
|
36
35
|
|
|
37
|
-
##
|
|
36
|
+
## Preview — open the browser at session start
|
|
37
|
+
|
|
38
|
+
**Open the preview browser as your first OK action of the session, if it is not already open.** The user watches edits land live in that pane; if it isn't open, your work is invisible and the whole CRDT pipeline is wasted. Treat this as step zero — before your first read, before your first write.
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
- Claude Code Desktop: `preview_start("open-knowledge-ui")`.
|
|
41
|
+
- Cursor: use the host's open-URL tool with a `previewUrl` from any write response.
|
|
42
|
+
- Other hosts: use whatever command opens a URL (macOS: `open <url>`). On hosts with no preview tool (Codex, generic stdio), surface the URL in chat for the user to click.
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
2. **Open that URL in your preview browser** so the user sees the document.
|
|
43
|
-
3. **Only then call `write_document` / `edit_document`** — the CRDT edit streams live into the already-open editor.
|
|
44
|
+
**How to know if it's already open.** You usually can't pre-check from the agent side — rely on these signals:
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
1. You already opened it earlier in this session → don't reopen.
|
|
47
|
+
2. A `write_document` / `edit_document` response returns `previewUrl` but NO `warning: { action: "attach-preview-once" }` → a browser is attached somewhere; do nothing.
|
|
48
|
+
3. A response DOES include `warning: { action: "attach-preview-once", previewUrl, message }` → no browser is attached; open immediately, one-shot. The hint fires only when needed (server tracks `__system__` subscribers) and at most once per session in the normal fresh-start case.
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
If the server isn't running, you'll see a `"Hocuspocus server is not running"` error or `previewUrl: null`. Start the UI (`open-knowledge ui` from a terminal, or `preview_start("open-knowledge-ui")` in Claude Code), then retry. NEVER construct preview URLs by hand — always use the `previewUrl` returned in tool responses.
|
|
48
51
|
|
|
49
52
|
**No screenshots after edits.** Do NOT take `preview_screenshot` after every `edit_document` / `write_document`. Trust the CRDT tool response as confirmation the edit landed. Only screenshot when debugging a visual issue or when explicitly asked.
|
|
50
53
|
|
|
54
|
+
## Writing
|
|
55
|
+
|
|
56
|
+
Call `write_document` / `edit_document` as soon as you have content. Native `Edit` / `sed` / direct `Write` on in-scope markdown is forbidden — it bypasses the CRDT and loses agent attribution in the shadow repo.
|
|
57
|
+
|
|
51
58
|
## Grounding — every factual claim needs a source (MUST)
|
|
52
59
|
|
|
53
60
|
Knowledge-base docs are factual artifacts. Every claim must be traceable to a source.
|
|
@@ -160,6 +167,7 @@ folders:
|
|
|
160
167
|
```
|
|
161
168
|
|
|
162
169
|
Rules:
|
|
170
|
+
|
|
163
171
|
- Rules apply in declaration order; later matches override earlier scalars.
|
|
164
172
|
- Tags concat + dedup across all matching rules; first-occurrence preserved.
|
|
165
173
|
- File's own frontmatter always wins per-scalar; folder defaults fill in blanks.
|
|
@@ -184,30 +192,31 @@ This is primarily a human-watchability concern — the user watches edits land i
|
|
|
184
192
|
|
|
185
193
|
## Anti-patterns — at a glance
|
|
186
194
|
|
|
187
|
-
| Task
|
|
188
|
-
|
|
|
189
|
-
| List a markdown-heavy dir
|
|
190
|
-
| Find all SPEC.md files
|
|
191
|
-
| Search a phrase across markdown
|
|
192
|
-
| Read an individual doc
|
|
193
|
-
| Explore a markdown-heavy dir
|
|
194
|
-
|
|
|
195
|
-
|
|
|
196
|
-
|
|
|
197
|
-
|
|
|
198
|
-
|
|
|
199
|
-
|
|
|
200
|
-
|
|
|
195
|
+
| Task | Don't | Do |
|
|
196
|
+
| ----------------------------------------------- | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
|
|
197
|
+
| List a markdown-heavy dir | `Bash: ls specs/` | `exec("ls specs/")` |
|
|
198
|
+
| Find all SPEC.md files | `Glob: **/SPEC.md` | `exec("find specs -name SPEC.md")` |
|
|
199
|
+
| Search a phrase across markdown | `Grep: "pattern" *.md` | `search({ query: "pattern" })` |
|
|
200
|
+
| Read an individual doc | `Read: specs/foo/SPEC.md` | `exec("cat specs/foo/SPEC.md")` or `read_document(...)` |
|
|
201
|
+
| Explore a markdown-heavy dir | `Agent(Explore): "..."` | Do `exec`-based exploration yourself |
|
|
202
|
+
| Wait for the server to tell you to open preview | Skip the session-start preview open and wait for the `attach-preview-once` hint | Open the preview browser at session start; the hint is a fallback when you didn't |
|
|
203
|
+
| Ignore the attach hint | Skip the `warning: { action: "attach-preview-once" }` hint in write-tool responses | Open the `previewUrl` when the hint fires; otherwise do nothing |
|
|
204
|
+
| Reference another doc | `` `[text](./page.md)` `` (backticked) or HTML `<a>` | `[text](./page.md)` (raw markdown) |
|
|
205
|
+
| Embed an image | `<img src="...">` (HTML) or hot-linked external URL | Fetch + save locally + `` |
|
|
206
|
+
| Write a factual claim | plausible prose without citation | prose with `[source](URL)` per Grounding rule |
|
|
207
|
+
| Add an image | empty alt `` or generic alt `` | meaningful alt + source caption below |
|
|
208
|
+
| Catalog folder contents | create `INDEX.md` hub file | add `folders:` entry in `.open-knowledge/config.yml` |
|
|
209
|
+
| Fork a skill and expect no stomp | Edit installed SKILL.md | `npx skills remove` before CLI upgrade |
|
|
201
210
|
|
|
202
211
|
## Workflow tools — when to invoke them
|
|
203
212
|
|
|
204
213
|
Three MCP tools build on the primitives above and correspond to [Karpathy's three-layer knowledge-base pattern](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f):
|
|
205
214
|
|
|
206
|
-
| Tool
|
|
207
|
-
|
|
|
208
|
-
| `ingest`
|
|
209
|
-
| `research`
|
|
210
|
-
| `consolidate` | Wiki, canonical
|
|
215
|
+
| Tool | Layer | When to invoke |
|
|
216
|
+
| ------------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
217
|
+
| `ingest` | Raw sources (immutable) | User shares a URL, PDF, or file to preserve verbatim. No analysis in the file itself — takeaways go back to the user in chat. |
|
|
218
|
+
| `research` | Wiki, provisional | User asks you to investigate, compare alternatives, or synthesize multiple sources. Produces a `status: provisional` article with a `sources:` list. Follows scan-first routing, a STOP scoping gate, 3P-external framing, and a validate checklist — the tool body enforces each step. |
|
|
219
|
+
| `consolidate` | Wiki, canonical | Team has actually decided after research and wants the outcome committed as source-of-truth. Starts with a STOP gate confirming the decision exists; writes a `status: canonical` article with a `supersedes:` chain. |
|
|
211
220
|
|
|
212
221
|
Each tool returns a multi-step instructional body when invoked. The bodies enforce their own gates — follow the numbered steps in order, don't skip the STOP gates.
|
|
213
222
|
|