@agent-wiki/mcp 0.22.4 → 0.22.6

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.
Files changed (94) hide show
  1. package/README.md +31 -0
  2. package/dist/cli.js +177 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/evidence-migration.js +1 -1
  5. package/dist/evidence-migration.js.map +1 -1
  6. package/dist/evidence-report.d.ts +17 -0
  7. package/dist/evidence-report.d.ts.map +1 -1
  8. package/dist/evidence-report.js +46 -2
  9. package/dist/evidence-report.js.map +1 -1
  10. package/dist/evidence-search.d.ts +71 -0
  11. package/dist/evidence-search.d.ts.map +1 -1
  12. package/dist/evidence-search.js +104 -1
  13. package/dist/evidence-search.js.map +1 -1
  14. package/dist/evidence-search.test.js +58 -1
  15. package/dist/evidence-search.test.js.map +1 -1
  16. package/dist/index.d.ts +10 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +5 -0
  19. package/dist/index.js.map +1 -1
  20. package/dist/okf-compat.d.ts +152 -0
  21. package/dist/okf-compat.d.ts.map +1 -0
  22. package/dist/okf-compat.js +604 -0
  23. package/dist/okf-compat.js.map +1 -0
  24. package/dist/okf-compat.test.d.ts +2 -0
  25. package/dist/okf-compat.test.d.ts.map +1 -0
  26. package/dist/okf-compat.test.js +234 -0
  27. package/dist/okf-compat.test.js.map +1 -0
  28. package/dist/okf-export.d.ts +63 -0
  29. package/dist/okf-export.d.ts.map +1 -0
  30. package/dist/okf-export.js +655 -0
  31. package/dist/okf-export.js.map +1 -0
  32. package/dist/okf-export.test.d.ts +2 -0
  33. package/dist/okf-export.test.d.ts.map +1 -0
  34. package/dist/okf-export.test.js +469 -0
  35. package/dist/okf-export.test.js.map +1 -0
  36. package/dist/okf-import.d.ts +136 -0
  37. package/dist/okf-import.d.ts.map +1 -0
  38. package/dist/okf-import.js +471 -0
  39. package/dist/okf-import.js.map +1 -0
  40. package/dist/okf-import.test.d.ts +2 -0
  41. package/dist/okf-import.test.d.ts.map +1 -0
  42. package/dist/okf-import.test.js +339 -0
  43. package/dist/okf-import.test.js.map +1 -0
  44. package/dist/okf-trust.test.d.ts +2 -0
  45. package/dist/okf-trust.test.d.ts.map +1 -0
  46. package/dist/okf-trust.test.js +223 -0
  47. package/dist/okf-trust.test.js.map +1 -0
  48. package/dist/okf.d.ts +128 -0
  49. package/dist/okf.d.ts.map +1 -0
  50. package/dist/okf.js +659 -0
  51. package/dist/okf.js.map +1 -0
  52. package/dist/search-currency.d.ts +44 -0
  53. package/dist/search-currency.d.ts.map +1 -0
  54. package/dist/search-currency.js +111 -0
  55. package/dist/search-currency.js.map +1 -0
  56. package/dist/search.d.ts +19 -0
  57. package/dist/search.d.ts.map +1 -1
  58. package/dist/search.js.map +1 -1
  59. package/dist/server.d.ts +0 -1
  60. package/dist/server.d.ts.map +1 -1
  61. package/dist/server.js +617 -21
  62. package/dist/server.js.map +1 -1
  63. package/dist/server.test.js +772 -0
  64. package/dist/server.test.js.map +1 -1
  65. package/dist/wiki-graph.d.ts +126 -0
  66. package/dist/wiki-graph.d.ts.map +1 -0
  67. package/dist/wiki-graph.js +479 -0
  68. package/dist/wiki-graph.js.map +1 -0
  69. package/dist/wiki-graph.test.d.ts +2 -0
  70. package/dist/wiki-graph.test.d.ts.map +1 -0
  71. package/dist/wiki-graph.test.js +216 -0
  72. package/dist/wiki-graph.test.js.map +1 -0
  73. package/dist/wiki.d.ts +140 -1
  74. package/dist/wiki.d.ts.map +1 -1
  75. package/dist/wiki.js +509 -23
  76. package/dist/wiki.js.map +1 -1
  77. package/dist/worklist.d.ts +43 -0
  78. package/dist/worklist.d.ts.map +1 -0
  79. package/dist/worklist.js +147 -0
  80. package/dist/worklist.js.map +1 -0
  81. package/dist/worklist.test.d.ts +2 -0
  82. package/dist/worklist.test.d.ts.map +1 -0
  83. package/dist/worklist.test.js +233 -0
  84. package/dist/worklist.test.js.map +1 -0
  85. package/docs/evidence-envelope.md +5 -0
  86. package/docs/okf-adoption-plan.md +566 -0
  87. package/docs/okf-compat-plan.md +418 -0
  88. package/docs/okf-extensions.md +245 -0
  89. package/docs/open-knowledge-format.md +280 -0
  90. package/docs/tools.md +264 -2
  91. package/package.json +1 -1
  92. package/schemas/agent-wiki-okf.schema.json +130 -0
  93. package/skills/agent-wiki/SKILL.md +7 -0
  94. package/skills/agent-wiki/references/tools-reference.md +80 -3
@@ -0,0 +1,130 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://github.com/xinhuagu/agent-wiki/schemas/agent-wiki-okf.schema.json",
4
+ "title": "Agent Wiki Open Knowledge Format Manifest",
5
+ "description": "Portable package manifest for Agent Wiki OKF v0.1 knowledge packages.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "format",
10
+ "format_version",
11
+ "name",
12
+ "version",
13
+ "license",
14
+ "owner",
15
+ "created_at",
16
+ "source_policy",
17
+ "wiki_policy",
18
+ "evidence_policy"
19
+ ],
20
+ "properties": {
21
+ "format": {
22
+ "const": "agent-wiki-okf",
23
+ "description": "Manifest format identifier."
24
+ },
25
+ "format_version": {
26
+ "description": "OKF format version. YAML parsers may load 0.1 as a number, so both forms are accepted.",
27
+ "oneOf": [
28
+ { "const": "0.1" },
29
+ { "const": 0.1 }
30
+ ]
31
+ },
32
+ "name": {
33
+ "type": "string",
34
+ "minLength": 1,
35
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$",
36
+ "description": "Portable package name."
37
+ },
38
+ "version": {
39
+ "type": "string",
40
+ "minLength": 1,
41
+ "description": "Package version, typically semver."
42
+ },
43
+ "license": {
44
+ "type": "string",
45
+ "minLength": 1,
46
+ "description": "License or access policy identifier for the package content."
47
+ },
48
+ "owner": {
49
+ "type": "string",
50
+ "minLength": 1,
51
+ "description": "Team, person, or system responsible for the package."
52
+ },
53
+ "created_at": {
54
+ "type": "string",
55
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}($|T)",
56
+ "description": "Package creation date as YYYY-MM-DD or ISO 8601 datetime."
57
+ },
58
+ "description": {
59
+ "type": "string"
60
+ },
61
+ "generator": {
62
+ "type": "object",
63
+ "additionalProperties": false,
64
+ "required": ["name", "version"],
65
+ "properties": {
66
+ "name": {
67
+ "type": "string",
68
+ "minLength": 1
69
+ },
70
+ "version": {
71
+ "type": "string",
72
+ "minLength": 1
73
+ }
74
+ }
75
+ },
76
+ "source_policy": {
77
+ "type": "object",
78
+ "additionalProperties": false,
79
+ "required": ["raw_immutable", "require_sha256"],
80
+ "properties": {
81
+ "raw_immutable": {
82
+ "type": "boolean",
83
+ "const": true
84
+ },
85
+ "require_sha256": {
86
+ "type": "boolean",
87
+ "const": true
88
+ },
89
+ "require_meta_sidecars": {
90
+ "type": "boolean"
91
+ }
92
+ }
93
+ },
94
+ "wiki_policy": {
95
+ "type": "object",
96
+ "additionalProperties": false,
97
+ "required": ["require_sources_for_grounded_pages", "allow_synthesis_pages"],
98
+ "properties": {
99
+ "require_sources_for_grounded_pages": {
100
+ "type": "boolean"
101
+ },
102
+ "allow_synthesis_pages": {
103
+ "type": "boolean"
104
+ },
105
+ "stale_after_days": {
106
+ "type": "integer",
107
+ "minimum": 1
108
+ }
109
+ }
110
+ },
111
+ "evidence_policy": {
112
+ "type": "object",
113
+ "additionalProperties": false,
114
+ "required": ["allow_unsupported_pages", "require_abstain_signal"],
115
+ "properties": {
116
+ "allow_unsupported_pages": {
117
+ "type": "string",
118
+ "enum": ["allow", "warn", "reject"]
119
+ },
120
+ "require_abstain_signal": {
121
+ "type": "boolean"
122
+ }
123
+ }
124
+ },
125
+ "metadata": {
126
+ "type": "object",
127
+ "description": "Freeform package metadata for tool-specific annotations."
128
+ }
129
+ }
130
+ }
@@ -71,6 +71,7 @@ If not in CWD, use `-w /path/to/config/root` on every call.
71
71
  | `wiki_delete` | Delete a wiki page (cannot delete system pages) |
72
72
  | `wiki_list` | List wiki pages, optionally filtered by type/tag |
73
73
  | `wiki_search` | Full-text BM25 search with snippets |
74
+ | `wiki_graph` | Query the `[[wikilink]]` graph — pick a `query_type`: `backlinks`, `neighbors`, `orphans`, `broken_links`, `shortest_path` |
74
75
  | `wiki_lint` | Health checks: contradictions, orphans, broken links, integrity |
75
76
  | `wiki_init` | Initialize a new knowledge base |
76
77
  | `wiki_config` | Show workspace configuration |
@@ -120,6 +121,12 @@ agent-wiki call wiki_write '{"page":"concept-x.md","content":"...updated content
120
121
  agent-wiki call wiki_lint
121
122
  ```
122
123
 
124
+ To see what is due and in which order (pages whose source changed, contradictions, lapsed reviews, raw files nobody has read yet), ask for the worklist and work from the top:
125
+
126
+ ```bash
127
+ agent-wiki call wiki_admin '{"action":"worklist"}'
128
+ ```
129
+
123
130
  ### 4. Parse COBOL source code
124
131
 
125
132
  ```bash
@@ -146,6 +146,7 @@ Create or update a wiki page. Auto-classifies type/tags if missing. Auto-routes
146
146
  "page": "(required) string — Path relative to wiki/",
147
147
  "content": "(required) string — Full content with YAML frontmatter + Markdown body",
148
148
  "source": "string — Provenance note (why this write happened)",
149
+ "actor": "string — Who is writing, as an OKF actor (my-agent/model-name, human:ana). Recorded in generated.by when the content changes. Default: agent-wiki/<version>.",
149
150
  "return_content": "boolean — Include final written content in response. Default: false."
150
151
  }
151
152
  ```
@@ -193,6 +194,33 @@ List wiki pages with optional filters.
193
194
 
194
195
  Returns: `{ pages: [...], count: N }`
195
196
 
197
+ ### wiki_graph
198
+
199
+ Query the `[[wikilink]]` graph between wiki pages. Read-only.
200
+
201
+ ```json
202
+ {
203
+ "query_type": "(required) string — backlinks | neighbors | orphans | broken_links | shortest_path",
204
+ "page": "string — [backlinks, neighbors] page path or slug",
205
+ "depth": "number — [neighbors] hops to follow (default 1, max 3)",
206
+ "from": "string — [shortest_path] page to start from",
207
+ "to": "string — [shortest_path] page to reach",
208
+ "max_depth": "number — [shortest_path] longest path in hops (default 6, max 10)",
209
+ "directed": "boolean — [shortest_path] follow links only forwards (default false: both ways)",
210
+ "include_system": "boolean — [neighbors, shortest_path] also walk through index.md, log.md, timeline.md, */index.md (default false)",
211
+ "limit": "number — [backlinks, neighbors, orphans, broken_links] max rows (default 100, max 500)"
212
+ }
213
+ ```
214
+
215
+ Returns, by `query_type`:
216
+ - `backlinks`: `{ page, count, backlinks: [{ page, title, link, snippet }], truncated, evidence }`
217
+ - `neighbors`: `{ page, depth, count, neighbors: [{ page, title, hops, direction, via }], truncated, evidence }`
218
+ - `orphans`: `{ count, orphans: [{ page, title, outDegree }], truncated, evidence }`
219
+ - `broken_links`: `{ count, broken_links: [{ page, link, snippet }], ambiguous_count, ambiguous_links: [{ page, link, snippet, candidates }], truncated, evidence }`
220
+ - `shortest_path`: `{ from, to, found, hops, path: [{ page, title }], links: [{ from, to, link, snippet }], evidence }`; when not found, `depth_cap_reached` says whether `max_depth` stopped the search
221
+
222
+ `evidence`: a direct link is `strong`; 2+ hops is `weak` / `inferred`; nothing found, or the depth cap hit, sets `abstain: true`.
223
+
196
224
  ### wiki_search
197
225
 
198
226
  Full-text BM25 keyword search. Optionally reads top results in one call.
@@ -205,6 +233,7 @@ Full-text BM25 keyword search. Optionally reads top results in one call.
205
233
  "tags": "string array — Filter by tags (any match)",
206
234
  "include_content": "boolean — Inline page content in results. Default: false.",
207
235
  "inline_budget": "number — Max total chars of inlined content (with include_content). Omit for no limit.",
236
+ "min_trust": "string — machine-confirmed | human-reviewed. When the top cited page is below this trust tier, confidence drops from strong to weak.",
208
237
  "read_top_n": "number — Read top N unique matching pages (max: 10). Activates combined search+read mode.",
209
238
  "section": "string — Section heading filter applied to read pages (with read_top_n).",
210
239
  "per_page_limit":"number — Max lines per read page (default: 200, max: 500) (with read_top_n).",
@@ -227,10 +256,22 @@ Wiki administration and maintenance.
227
256
 
228
257
  ```json
229
258
  {
230
- "action": "(required) string — init | config | rebuild | lint",
259
+ "action": "(required) string — init | config | rebuild | lint | reconcile | import | export | verify | worklist",
231
260
  "path": "[init] string — Config root where .agent-wiki.yaml is created (default: '.')",
232
261
  "workspace": "[init] string — Separate data directory for wiki/, raw/, schemas/",
233
- "apply_fixes":"[lint] boolean — Auto-fix fixable issues (missing frontmatter). Default: false."
262
+ "apply_fixes":"[lint] boolean — Auto-fix fixable issues (missing frontmatter). Default: false.",
263
+ "page_a": "[reconcile] string — First page of the contradicting pair",
264
+ "page_b": "[reconcile] string — Second page of the contradicting pair",
265
+ "winner": "[reconcile] string — page_a or page_b: the page whose claim you judge correct. Omit to only view both claims.",
266
+ "note": "[reconcile] string — Why that page wins; recorded in the reconciliation page",
267
+ "format": "[import, export] string — okf (Open Knowledge Format v0.3). Default: okf.",
268
+ "kind": "[worklist] string — rewrite | reconcile | review | ingest. Default: all.",
269
+ "limit": "[worklist] number — Max items. Default: 50.",
270
+ "page": "[verify] string — The page that was reviewed, relative to wiki/",
271
+ "by": "[verify] string — Who reviewed it: human:<id>, process:<id> or <producer>/<version>",
272
+ "out": "[export] string — Directory to write the bundle to; empty or not existing unless overwrite is set.",
273
+ "overwrite": "[import] boolean — Replace files that already exist in wiki/. [export] Replace an earlier export. Default: false.",
274
+ "dry_run": "[import] boolean — Check and report, write nothing. Default: false."
234
275
  }
235
276
  ```
236
277
 
@@ -244,7 +285,43 @@ Returns: `{ configRoot, workspace, wikiDir, rawDir, schemasDir, lint, search, se
244
285
  Returns: `{ ok, message }`
245
286
 
246
287
  **action: lint** — Run comprehensive health checks: contradictions, orphan pages, broken links, SHA-256 integrity, synthesis integrity.
247
- Returns: `{ pagesChecked, rawChecked, issues: [...], contradictions: [...], fixed, fixedPages }`
288
+ Returns: `{ pagesChecked, rawChecked, issues: [...], contradictions: [...], reconciledContradictions?, fixed, fixedPages }`
289
+
290
+ **action: reconcile** — Settle a contradiction between two pages. You decide; the tool records.
291
+ - Without `winner`: `{ page_a, page_b, contradictions: [{ claim, severity, a: { page, title, excerpt, sources }, b: {...} }], already_reconciled, next, evidence }`
292
+ - With `winner`: writes `reconciliation-<a>-vs-<b>-<hash>.md` (one decision record per claim; earlier decisions for the pair are kept) and returns `{ ok, resolution_page, winner, superseded, reconciled_claims, still_disputed, evidence }`
293
+
294
+ Neither page is edited. `evidence.basis` is always `inferred`. After reconciling, `wiki_search` stops flagging that claim as disputed.
295
+
296
+ **action: import** — Import an OKF v0.3 bundle from `path` (a directory or .zip on the server's machine) into wiki/. Run with `dry_run: true` first.
297
+
298
+ Returns: `{ ok, dryRun, bundle: { okf_version, title, conformant, concepts, other_markdown, assets }, imported: [...], skipped: [{ path, reason }], conflicts: [...], refused?, findings: [{ level, code, path, line?, message }] }`
299
+
300
+ `ok: false` with `refused` when the bundle is not conformant (see `findings` with `level: "error"`) or when files already exist and `overwrite` is not set. Nothing is written in either case.
301
+
302
+ **action: worklist** — What needs attention, most urgent first: pages to `rewrite` (a cited source changed, is gone or has a newer version), pairs to `reconcile`, pages to `review` (changed after their last review, or past `stale_after`), raw files to `ingest`.
303
+
304
+ Returns: `{ summary: { rewrite, reconcile, review, ingest, total }, items: [{ kind, priority, page?, other_page?, raw?, reason, action, dependents? }], truncated }`
305
+
306
+ Call it at the start of a maintenance session and after adding raw files, and work from the top. Each item says what to do; doing it takes the item off the list.
307
+
308
+ **action: verify** — Record that `by` confirmed `page` against its sources. Appends a `verified` event; nothing else in the page changes.
309
+
310
+ Returns: `{ ok, page, verified: { by, at }, trust_tier }`
311
+
312
+ Call this only when a check really happened, and name the actor that did it: `human:<id>` only when a person told you they reviewed the page, `process:<id>` or your own `<producer>/<version>` for a check you ran yourself. A review counts until the page content changes; after a rewrite the page is `unverified` again.
313
+
314
+ **action: export** — Write the workspace to `out` as an OKF v0.3 bundle: wikilinks become Markdown links, `sources` become resource mappings, cited raw files are copied to `references/raw/`. The workspace is not changed.
315
+
316
+ Returns: `{ ok, out, bundle: { okf_version, title, conformant, concepts, other_markdown, assets, raw_files }, written: [...], skipped: [{ path, reason }], links_converted, links_unresolved: [{ page, link }], refused?, findings: [...] }`
317
+
318
+ `links_unresolved` are wikilinks with no page to point at; they are written as plain text. Fix them in the wiki and export again if they matter.
319
+
320
+ When `wiki_search` returns `evidence.confidence: "weak"` with a rationale starting `Disputed:`, a cited page conflicts with another page: read both, then reconcile.
321
+
322
+ When the rationale contains `Lifecycle:`, a cited page says of itself that it is not current: `status` is deprecated or draft, or its `stale_after` has passed. For a deprecated page, read the page named after "superseded by" instead. Top results may also carry `okf.trust_tier` (`unverified`, `machine-confirmed`, `human-reviewed`): prefer human-reviewed pages when two results disagree. `okf.review_lapsed: true` and a `Trust:` note in the rationale mean the page was reviewed before its last change: say so if you rely on it. Pass `min_trust` when the user needs reviewed knowledge. A result with `demoted` was ranked lower because the page is known not to be current (deprecated, past its `stale_after`, or its source has moved on); `relevance` is the score the match itself earned.
323
+
324
+ When the rationale contains `Source drift:`, a cited page was written against a raw source that has since changed, disappeared or got a newer version. Read the current source (`raw_read`, `raw_versions`), correct the page, and write it again: `wiki_write` records the new SHA in `sources_sha` and the flag clears on the next `lint` or `rebuild`. Do not edit `sources_sha` by hand; it is replaced on every write.
248
325
 
249
326
  ---
250
327