@creativeaitools/agent-wiki 2.0.0

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/ONBOARD.md ADDED
@@ -0,0 +1,373 @@
1
+ ## First-Run Onboarding
2
+
3
+ This file is an operator guide, not the onboarding engine. The lifecycle CLI is the deterministic source of truth for setup status:
4
+
5
+ ```bash
6
+ agent-wiki onboard --check
7
+ ```
8
+
9
+ Use this file to understand the flow, explain setup choices, and orient a new agent before it edits a wiki. Do not replace the CLI report with freeform interpretation of this document.
10
+
11
+ Start with the lifecycle CLI and register the wiki by name:
12
+
13
+ ```bash
14
+ agent-wiki init --type vault --root ./Business
15
+ agent-wiki registry add Business --root ./Business --type vault
16
+ agent-wiki --wiki Business onboard --check
17
+ agent-wiki --wiki Business compile
18
+ agent-wiki --wiki Business index --check
19
+ ```
20
+
21
+ For a project workspace with an embedded wiki:
22
+
23
+ ```bash
24
+ cd /path/to/project
25
+ agent-wiki init --type workspace --workspace-root . --wiki-dir wiki
26
+ agent-wiki registry add MyProject --root ./wiki --type workspace
27
+ agent-wiki --wiki MyProject onboard --check
28
+ agent-wiki --wiki MyProject workspace pending --workspace-root . --json
29
+ ```
30
+
31
+ `agent-wiki init` owns folder creation, local config creation, and bundled template installation by default. `agent-wiki doctor` is the read-only lifecycle check. `agent-wiki onboard --check` is the deterministic first-run report for agents and automation. It emits structured JSON with wiki type, config state, doctor issues, required docs/skills, optional tool availability, import-link state, and next steps.
32
+
33
+ Use plain `agent-wiki init` for normal fresh wikis. It includes the bundled docs, package metadata, and skills needed for a fresh agent to operate it immediately. Use `--no-config` or `--no-template` only for advanced bare-skeleton setup or tests.
34
+
35
+ Before editing wiki content, run the deterministic CLI onboarding sequence:
36
+
37
+ ```bash
38
+ agent-wiki --wiki Business doctor
39
+ agent-wiki --wiki Business onboard --check
40
+ agent-wiki --wiki Business compile
41
+ agent-wiki --wiki Business index --check
42
+ ```
43
+
44
+ If the wiki has not been registered yet, use `--wiki-root /path/to/wiki` for `doctor` and `onboard`, then run `compile` and `index --check` from the wiki root.
45
+
46
+ When a human needs to choose local setup policy, generate stable prompts:
47
+
48
+ ```bash
49
+ agent-wiki onboard --check --questions --wiki-root /path/to/wiki
50
+ ```
51
+
52
+ Agents must treat the CLI output as the onboarding source of truth. Read this file for explanation, not as an interactive onboarding substitute.
53
+
54
+ When the machine tracks more than one Agent Wiki root, register each root locally:
55
+
56
+ ```bash
57
+ agent-wiki registry add Business --root /path/to/wiki --type vault
58
+ agent-wiki list
59
+ agent-wiki --wiki Business onboard --check
60
+ ```
61
+
62
+ The registry is machine-local operator state at `~/.config/agent-wiki/registry.json`. It should contain only Agent Wiki roots created or migrated by this CLI.
63
+
64
+ For multiple fresh vault wikis:
65
+
66
+ ```bash
67
+ agent-wiki init --type vault --root ./Business
68
+ agent-wiki registry add Business --root ./Business --type vault
69
+ agent-wiki init --type vault --root ./Research
70
+ agent-wiki registry add Research --root ./Research --type vault
71
+ agent-wiki list
72
+ agent-wiki check --all
73
+ ```
74
+
75
+ For scheduled maintenance in an external agent harness, generate prompts from the registry instead of hardcoding wiki paths:
76
+
77
+ ```bash
78
+ agent-wiki schedule prompt process-inbox
79
+ agent-wiki schedule prompt extract-primitives
80
+ agent-wiki schedule prompt update-overview
81
+ ```
82
+
83
+ Each prompt defaults to all registered wikis. Pass wiki names to target a subset:
84
+
85
+ ```bash
86
+ agent-wiki schedule prompt process-inbox Business Research
87
+ agent-wiki schedule prompt update-overview --wiki Business
88
+ ```
89
+
90
+ These commands print scheduled-agent prompts only. They do not execute the skill workflows. The scheduled agent should log per-wiki failures and continue to the next registered wiki.
91
+
92
+ Before editing wiki content:
93
+
94
+ 1. Read [[AGENTS]] for the agent behavior contract.
95
+ 2. Read [[WIKI#4.1 Common runtime schemas]] for the runtime schema and examples; [[WIKI#5 Status vocabularies]] for status enums; [[WIKI#3 Page types]] for page types.
96
+ 3. Read [[AGENT-WIKI-SPEC-v2]] only when changing project behavior, resolving ambiguity, or when [[WIKI#4.1 Common runtime schemas]] is insufficient.
97
+ 4. Run `agent-wiki --wiki NAME doctor` for the target registered wiki, or `agent-wiki doctor --wiki-root /path/to/wiki` before registration.
98
+ 5. Run `agent-wiki --wiki NAME onboard --check`, or `agent-wiki onboard --check --wiki-root /path/to/wiki` before registration.
99
+ 6. Keep local `_system/config.json` limited to local operator policy and command preferences.
100
+ 7. Configure `skills/import-link/config.json` before importing external material.
101
+ 8. Run the compile pipeline and confirm it reports zero validation issues.
102
+ 9. Optionally run the `write-synthesis` skill when the wiki needs a durable cross-source brief, comparison, analysis, summary, or timeline narrative.
103
+ 10. Optionally run the `update-overview` skill when the wiki needs a human-facing root `overview.md` landing page.
104
+
105
+ ---
106
+
107
+ ## Vault Wiki Onboarding
108
+
109
+ Vault mode preserves the classic Agent Wiki layout. The wiki root is the working root. It includes the raw inbox lifecycle:
110
+
111
+ - `_inbox/` is the active drop zone.
112
+ - `_inbox/trash/` holds rejected inbox material.
113
+ - `raw/` retains original raw captures after promotion.
114
+ - `sources/` and `sources/parts/` hold canonical source pages.
115
+
116
+ Initialize a vault wiki:
117
+
118
+ ```bash
119
+ agent-wiki init --type vault --root /path/to/wiki
120
+ ```
121
+
122
+ Check it:
123
+
124
+ ```bash
125
+ agent-wiki doctor --wiki-root /path/to/wiki --type vault
126
+ ```
127
+
128
+ Use vault mode when the wiki itself is the primary repository and source material enters through `_inbox/`, `import-link`, or direct source-page creation.
129
+
130
+ ---
131
+
132
+ ## Workspace Wiki Onboarding
133
+
134
+ Workspace mode embeds the wiki inside an existing project. By default the wiki lives at `workspace/wiki`, and original workspace files stay where they are.
135
+
136
+ Workspace mode includes `_inbox/`, `_inbox/trash/`, and `raw/` for deliberate external captures and notes. Workspace source capture is still reference-based:
137
+
138
+ - `agent-wiki workspace pending` finds candidate workspace files.
139
+ - The agent reads selected workspace files in place.
140
+ - Canonical `sources/` pages cite workspace-relative `originPath` values.
141
+ - `agent-wiki workspace mark-sourced ...` records which workspace files have been captured.
142
+
143
+ The workspace scanner excludes the wiki directory itself, so `_inbox/` items are handled by the inbox workflow rather than rediscovered as workspace files.
144
+
145
+ Initialize a workspace wiki:
146
+
147
+ ```bash
148
+ agent-wiki init --type workspace --workspace-root /path/to/project --wiki-dir wiki
149
+ ```
150
+
151
+ Check it:
152
+
153
+ ```bash
154
+ agent-wiki doctor --wiki-root /path/to/project/wiki --type workspace
155
+ ```
156
+
157
+ Use workspace mode when Agent Wiki is documenting or synthesizing an existing project without moving or owning that project's files.
158
+
159
+ ---
160
+
161
+ ## Upgrade From v1.x
162
+
163
+ Agent Wiki v2 moves the installable CLI from Python to npm/TypeScript. Existing content pages usually do not need data conversion, but older checkouts may still contain Python-era helper scripts and docs that point to them.
164
+
165
+ From the wiki root, preview the migration:
166
+
167
+ ```bash
168
+ agent-wiki migrate --from v1 --check
169
+ ```
170
+
171
+ Apply the safe migration:
172
+
173
+ ```bash
174
+ agent-wiki migrate --from v1 --write
175
+ ```
176
+
177
+ The writer backs up changed and removed files under `_archive/migrations/v1-to-v2/`, removes obsolete Python helper paths, refreshes missing v2 template files, rewrites old helper-command references where safe, runs `agent-wiki doctor`, and runs `agent-wiki compile`.
178
+
179
+ Review the printed summary after migration. Existing canonical content pages under `sources/`, `entities/`, `concepts/`, `claims/`, `questions/`, and `syntheses/` should remain in place.
180
+
181
+ ---
182
+
183
+ ## Environment Probe
184
+
185
+ Run the lower-level onboarding probe from the wiki root only when environment details matter:
186
+
187
+ ```bash
188
+ agent-wiki onboard --check
189
+ ```
190
+
191
+ The probe is read-only. It reports OS/platform details, whether `.obsidian/` is present at the wiki root, local Python commands, `.venv/` status, `_system/config.json`, `_system/config.example.json`, import-link configuration, mode-specific required folders, key script availability such as `agent-wiki create-page`, converter command availability, and importable Python converter packages. It does not install packages, create folders, write config, or mutate wiki content.
192
+
193
+ To generate user-friendly setup prompts, run:
194
+
195
+ ```bash
196
+ agent-wiki onboard --check --questions
197
+ ```
198
+
199
+ Use those prompts when asking the user for setup decisions. The user should be able to reply with compact letter choices such as `1A 2B 3A 4C 5A`. Do not ask long open-ended setup questions unless the user needs to provide a specific path or command.
200
+
201
+ If the probe cannot run, check Python manually:
202
+
203
+ ```bash
204
+ python3 --version
205
+ python --version
206
+ ```
207
+
208
+ Use whichever command resolves to Python 3.8 or newer. If neither command is available, warn the user that Python 3 is only needed for optional local document conversion backends. If only `python` works, substitute `python` anywhere this repo shows `python3`.
209
+
210
+ Compile from the wiki root:
211
+
212
+ ```bash
213
+ agent-wiki compile
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Local System Configuration
219
+
220
+ `_system/config.json` is optional local operational configuration for wiki type, workspace mode, tool policy, and command preferences. It is not canonical wiki knowledge, should not contain secrets, and should not be committed. `_system/config.example.json` is the tracked example shape.
221
+
222
+ Use it when the user wants persistent local preferences such as:
223
+
224
+ - whether this root is a `vault` or `workspace` wiki
225
+ - workspace root and wiki directory
226
+ - which Python command to use
227
+ - whether inbox conversion is enabled
228
+ - automatic conversion backend order
229
+ - backend command names
230
+ - whether network, OCR, LLM, transcription, or hosted document-intelligence behavior is allowed
231
+ - optional `knownVaults` mappings from Obsidian vault names to absolute local paths for resolving `obsidian://` references
232
+
233
+ Prefer `agent-wiki init` for initial `wikiType` and workspace settings. Do not write `_system/config.json` until the user has approved the setup choices. Missing config means tools should use conservative local-only defaults and default to vault mode.
234
+
235
+ When local Python or conversion policy is needed, use the onboarding config writer so only approved local policy fields are persisted:
236
+
237
+ ```bash
238
+ agent-wiki onboard --write-config --python-command python3 --conversion disabled
239
+ ```
240
+
241
+ Use `--conversion available-local` only when the user wants inbox conversion enabled with already installed local backends. Use explicit flags such as `--allow-ocr` only when the user has approved that behavior.
242
+
243
+ ---
244
+
245
+ ## Optional Obsidian Setup
246
+
247
+ Obsidian is optional. The wiki can be used as a plain Markdown repository, and onboarding does not require an Obsidian vault to already exist.
248
+
249
+ After onboarding, if the user wants to use this wiki in Obsidian, recommend opening the wiki root as an Obsidian vault:
250
+
251
+ 1. Open Obsidian.
252
+ 2. Click the current vault name at the bottom of the file explorer pane, or use Obsidian's vault switcher if the control is not visible.
253
+ 3. Click "Manage vaults..."
254
+ 4. Click "Open folder as vault".
255
+ 5. Navigate to the wiki root.
256
+ 6. Click "Select Folder".
257
+
258
+ Obsidian may create a local `.obsidian/` folder. That folder is local application state and should not be committed.
259
+
260
+ For links to another Obsidian vault, use Obsidian's "Copy Obsidian URL" action and store the result as a standard markdown link using an `obsidian://` URI. Agents must not launch these URIs. They can read the target only when `_system/config.json` includes a matching `knownVaults` entry; otherwise the URI remains an opaque external reference.
261
+
262
+ ---
263
+
264
+ ## Optional Virtual Environment
265
+
266
+ The compile pipeline does not need third-party Python packages. Optional inbox conversion backends may need Python packages.
267
+
268
+ If optional packages are installed, prefer a project-local virtual environment:
269
+
270
+ ```bash
271
+ python3 -m venv .venv
272
+ source .venv/bin/activate
273
+ python -m pip install markitdown pymupdf4llm
274
+ ```
275
+
276
+ Agents must not create `.venv/` or install packages unless the user explicitly asks. If Python or optional packages are missing, warn the user and explain what is needed.
277
+
278
+ ---
279
+
280
+ ## Import Link Configuration
281
+
282
+ The `import-link` skill needs local setup before first use. Do not assume another user's Obsidian path, browser profile, model, or retrieval tools are valid for this checkout.
283
+
284
+ Edit `skills/import-link/config.json` before importing. The checked-in file is intentionally not configured for a specific user.
285
+
286
+ Required first-run edits:
287
+
288
+ 1. Set `configured` to `true`.
289
+ 2. Confirm `retrievalModes`.
290
+ 3. Confirm `attachmentPolicy`.
291
+
292
+ Default config:
293
+
294
+ ```json
295
+ {
296
+ "schemaVersion": 1,
297
+ "configured": false,
298
+ "retrievalModes": ["manual_paste"],
299
+ "browserProfile": null,
300
+ "youtubeTranscriptTool": null,
301
+ "attachmentPolicy": "copy",
302
+ "sourceDirectory": "sources",
303
+ "attachmentDirectory": "_attachments"
304
+ }
305
+ ```
306
+
307
+ Config fields:
308
+
309
+ | Setting | Required | Notes |
310
+ |---|---|---|
311
+ | `configured` | yes | Must be `true` before import. Leave `false` in shared starter repos. |
312
+ | `retrievalModes` | yes | Ordered list of available retrieval methods. Use `manual_paste` for no-tool setup. Other values may include `direct_fetch`, `browser_capture`, or `transcript`. |
313
+ | `browserProfile` | no | Only needed if browser fallback is available in the user's environment. |
314
+ | `youtubeTranscriptTool` | no | Only set if `yt-dlp` or another transcript tool is installed. |
315
+ | `attachmentPolicy` | yes | Use `copy` to save imported images/files into `_attachments/`, or `external_link` to leave them remote. |
316
+ | `sourceDirectory` | yes | Relative source directory, normally `sources`. |
317
+ | `attachmentDirectory` | yes | Relative attachment directory, normally `_attachments`. |
318
+
319
+ If any required value is unknown, the agent should ask the user before running `import-link`.
320
+
321
+ The `_inbox/` workflow is handled by [[INBOX]] and the `process-inbox` skill in vault mode. Raw files dropped into `_inbox/` are promoted into canonical source pages and then moved to `raw/`.
322
+
323
+ For binary or non-markdown inbox files, `process-inbox` may use configured local conversion backends. Run `agent-wiki onboard --check` first when converter availability is unknown, then ask the user which conversion policy to use before running `agent-wiki onboard --write-config` or installing anything.
324
+
325
+ Large raw files should be promoted as a short parent source page plus source part pages under `sources/parts/`, not as one giant markdown file.
326
+
327
+ Source pages use the source status vocabulary from [[WIKI#5 Status vocabularies]]: `unprocessed`, `partitioned`, `processed`, and `archived`.
328
+
329
+ ---
330
+
331
+ ## Recommended v2 Implementation Sequence
332
+
333
+ 1. Create wiki lifecycle commands
334
+ 2. Add universal frontmatter handling
335
+ 3. Add page-type-specific validation
336
+ 4. Implement claim extraction
337
+ 5. Implement evidence normalization
338
+ 6. Implement relation extraction
339
+ 7. Emit `pages.json`
340
+ 8. Emit `claims.jsonl`
341
+ 9. Emit `relations.jsonl`
342
+ 10. Emit `agent-digest.json`
343
+ 11. Regenerate root `index.md`
344
+ 12. Generate required reports
345
+ 13. Add contradiction/question caches
346
+ 14. Add or refresh root `overview.md` when the wiki needs a human-facing landing page
347
+
348
+ ---
349
+
350
+ ## Out of Scope for v2
351
+
352
+ The following are out of scope for strict v2 compliance:
353
+
354
+ - automatic ontology learning from prose
355
+ - autonomous contradiction resolution
356
+ - semantic entity merge without explicit operator decision
357
+ - probabilistic graph inference beyond explicit claims/relations
358
+ - full schema migration framework
359
+ - embedded vector index format standardization
360
+ - multi-vault federation protocol
361
+
362
+ ---
363
+
364
+ ## Philosophy
365
+
366
+ The v2 model has four layers:
367
+
368
+ - The wiki is the container: markdown pages, folders, human notes, and generated artifacts.
369
+ - The ontology is the truth model: entities, concepts, sources, claims, evidence, relations, contradictions, questions, and syntheses.
370
+ - The compile layer is the bridge: stable machine-facing cache files, the deterministic root page catalog, and generated maintenance reports.
371
+ - The overview layer is the human landing page: durable prose that orients readers without replacing canonical evidence or compiled data.
372
+
373
+ The wiki should separate what exists, what is claimed, what supports it, what conflicts with it, what is unknown, how things connect, and how agents consume it.