rigjs 4.0.5 → 4.0.7

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.
@@ -15,14 +15,24 @@ metadata:
15
15
 
16
16
  **Positioning.** rig wiki is an **agent-facing tool**. Humans don't memorise the CLI; they tell their agent (you) what they want, and you orchestrate `rig wiki *`. Treat any direct user-typed `rig wiki ...` invocation as a fallback — your job is to make raw CLI use unnecessary. Never just hand the user a command and walk away; run it, observe, report.
17
17
 
18
- You orchestrate `rig wiki *` on behalf of the user. The user speaks in intent; you map to commands. Below is the intent → action table. Resolve the **target wiki** by reading `rig wiki list` once at session start; if none registered, see "Setup" at the bottom.
18
+ ## Vault model one fixed dir per project
19
+
20
+ A vault is **a single `rig-wiki/` dir at the project root** holding metadata (purpose.md, schema.md, page tree, `.rig/config.yml`). The project root itself is the conceptual "vault" — `rig-wiki/` is just the metadata subdir living inside it, named `rig-wiki/` by convention. User-authored data (`personal/`, `research/`, etc.) lives in sibling dirs and is NEVER touched.
21
+
22
+ - **The scope** — which sibling data dir(s) the wiki actually ingests — is recorded in `<rig-wiki>/.rig/config.yml` (`name`, `root`, `include`).
23
+ - **Discovery is automatic.** Any `rig wiki *` command walks up from CWD; at each level it checks both `<dir>/.rig/config.yml` (you're inside the vault) and `<dir>/rig-wiki/.rig/config.yml` (you're at the project root). So `cd` anywhere inside the project works.
24
+
25
+ This means:
26
+ - **No `--wiki <name>` flag exists.** Don't try to pass one.
27
+ - **No `rig wiki list`, `register`, or `unregister` commands.** They've been removed.
28
+ - If the user is in a project that has no vault, the next step is `rig wiki init <scope>` (see "Setup" below).
19
29
 
20
30
  ## Intent → command map
21
31
 
22
32
  | User intent (any language) | Action |
23
33
  |---|---|
24
34
  | "把 / record / take notes on / 添加 / 收一下 / 收藏 …" + a URL | `rig wiki fetch <url>` then `rig wiki ingest raw/<resulting-file>` |
25
- | "…" + a local file path or content paste | Write the content to `<wiki>/raw/YYYY-MM-DD-<kebab-slug>.md` with frontmatter (`source-url`, `fetched-at`, `fetcher: agent-paste`, `content-sha`). Then `rig wiki ingest <that-path>`. |
35
+ | "…" + a local file path or content paste | Write the content to `<vault>/raw/YYYY-MM-DD-<kebab-slug>.md` with frontmatter (`source-url`, `fetched-at`, `fetcher: agent-paste`, `content-sha`). Then `rig wiki ingest <that-path>`. |
26
36
  | "ingest / re-process / 重新整理 / 重新 ingest <something>" | `rig wiki ingest <path>` — handles new sources AND re-ingest of modified ones. |
27
37
  | "what's new / 有什么变化 / scan / diff" | `rig wiki scan` — surface the NEW / MODIFIED / DELETED / RAW DRIFT report verbatim. |
28
38
  | "ingest everything new / 把新东西都收一下" | `rig wiki scan` → for each NEW path → `rig wiki ingest <path>` (one call per file). |
@@ -30,43 +40,74 @@ You orchestrate `rig wiki *` on behalf of the user. The user speaks in intent; y
30
40
  | "summarize what we know about X / 总结一下 X" | `rig wiki query "<X>" --synth` — adds a Claude-synthesized paragraph with `[[wikilink]]` citations after the hit list. |
31
41
  | "lint / 检查一遍 / what's broken in my wiki" | `rig wiki lint`. Surface the report. Exit code 11 = severe (broken refs / missing source). |
32
42
  | "rebuild / 全部重 embed / 换了模型 / 新机器" | `rig wiki rebuild` — full nuclear refresh. Only suggest this when the user mentions a new device or explicitly switching the embed model. |
33
- | "wiki list / what wikis are registered" | `rig wiki list` |
34
43
 
35
- Always run from inside the registered project (or pass `--wiki <name>`). If the user is in some other CWD, `cd` to the wiki's project first.
44
+ ## Vault layout (flat no inner `wiki/` subdir)
45
+
46
+ ```
47
+ <project>/ ← the conceptual vault (e.g. overmind/)
48
+ rig-wiki/ ← fixed metadata-dir name; created by `rig wiki init`
49
+ purpose.md ← human-authored, never write
50
+ schema.md ← human-authored, never write
51
+ index.md ← LLM-writable
52
+ overview.md ← LLM-writable
53
+ log.md ← append-only LLM log
54
+ reviews.md ← LLM-writable backlog of human-review items
55
+ raw/ ← immutable source files (never edit existing)
56
+ sources/ ← one .md per ingested source — page tree at vault root
57
+ entities/
58
+ concepts/
59
+ synthesis/
60
+ queries/
61
+ .rig/config.yml ← per-vault settings (name, root, include, exclude, …)
62
+ .gitignore
63
+ personal/ ← user-authored data — scope target (NEVER touched)
64
+ research/ ← (other sibling data dirs)
65
+ ...
66
+ ```
67
+
68
+ Note: page directories (`sources/`, `entities/`, `concepts/`, `synthesis/`, `queries/`) live directly under `rig-wiki/` — no nested `wiki/` subdir.
36
69
 
37
70
  ## Argument inference rules
38
71
 
39
- - **slug** = kebab-case, no dates inside `wiki/`, dates only on `raw/YYYY-MM-DD-*` prefix.
72
+ - **slug** = kebab-case, no dates in page filenames; dates only on `raw/YYYY-MM-DD-*` prefix.
40
73
  - **raw filename** = `YYYY-MM-DD-<slug>.md`. Pick today's local date; if filename collides, append `-2`, `-3`.
41
74
  - **URL → slug**: last path segment, drop extension, lowercase, replace non-`[a-z0-9-]` with `-`, max 64 chars.
42
- - **wiki dir name** when initializing: prefer user-stated name; if absent, ask once. Never default to `wiki` or CWD silently.
75
+ - **`rig wiki init <scope>` arg** is a data subdir NAME, not a path to create. Examples: `rig wiki init personal` (scopes to `./personal/`), `rig wiki init research`. The vault metadata dir is always `./rig-wiki/`. Never pass a path like `rig-wiki` that's the metadata dir, not the scope.
43
76
 
44
77
  ## Hard rules — refuse and explain if violated
45
78
 
46
79
  - **Never** edit `raw/`, `purpose.md`, or `schema.md` directly. Those are human-authored. If the user asks you to, tell them to do it manually.
47
- - **Never** ingest or init at a **hidden path** (any segment starting with `.`) or a **.gitignored** path. rig wiki refuses at the CLI level — it sees these as "the project deliberately doesn't want this in the wiki." Workaround if the user insists: `cp -R <hidden-or-ignored> <wiki>/raw/<slug>/` first, then ingest the copy. Never bypass the guard.
48
- - **Never** ingest a path outside the wiki's `include[]` scope (anything in `raw/` is always fine; outside that requires the path to be listed in the registered wiki's `include`).
80
+ - **Never** init a vault INSIDE a user-authored data directory (e.g. `personal/wiki/`). The vault dir contaminates the user's source tree. Put the vault at the project root (e.g. `<project>/rig-wiki/`) and point `include[]` at the data dirs via `<vault>/.rig/config.yml`.
81
+ - **Never** init a vault at a **hidden path** (any segment starting with `.`) or a **.gitignored** path. rig wiki refuses at the CLI level.
49
82
  - **`rig wiki scan` exit 10 (RAW DRIFT)** = a `raw/` file's bytes changed since last scan. Do NOT auto-fix or re-ingest. Surface to the user as a data-integrity warning.
50
83
  - **`rig wiki lint` exit 11** = severe findings. Surface the report path and the top findings; do not auto-fix unless the user asks.
51
84
  - **Never** suggest editing `~/.rig/cache/qmd/*.sqlite` or `~/.cache/qmd/`. Those are rebuildable caches.
52
85
 
86
+ ## Auto-exclusions (no config needed)
87
+
88
+ The scanner skips these automatically — do not waste user time adding them to `exclude`:
89
+ - Any path segment starting with `.` (`.git/`, `.obsidian/`, `.vscode/`, `.DS_Store`, …).
90
+ - Any path matched by the project's `.gitignore`.
91
+
92
+ What you DO need to put in `exclude` are content-type filters the user cares about — e.g. `**/*.zip`, `**/*.pdf` if they don't want those in their text wiki.
93
+
53
94
  ## Common error → recovery
54
95
 
55
96
  | Error | What it means | Action |
56
97
  |---|---|---|
57
- | `qmd query failed. Run \`rig wiki index\` first` | No vector index for this wiki | `rig wiki index --wiki <name>` then retry |
58
- | `no wiki resolved` | CWD is not inside a registered wiki and no `--wiki` flag | Either `cd` into the project or pass `--wiki <name>` |
59
- | `claude not installed on PATH` (during ingest/synth) | Claude Code CLI missing | Tell the user; suggest `yarn dlx @anthropics/claude-code` or use a non-agent flow |
98
+ | `No rig wiki vault found.` | CWD has no `.rig/config.yml` and no parent does either | `cd` into the vault (or the project that contains one), or run `rig wiki init <subdir>` |
99
+ | `qmd query failed. Run \`rig wiki index\` first` | No vector index for this vault | `rig wiki index`, then retry |
100
+ | `claude not installed on PATH` (during ingest/synth) | Claude Code CLI missing | Tell the user; suggest `yarn dlx @anthropics/claude-code` |
60
101
  | Reranker download stalls on first query | CDN cold node, can take ~1 min | Just wait; subsequent queries are instant |
61
102
 
62
103
  ## Output handling
63
104
 
64
- - After running a `rig wiki *` command, **summarise in natural language** what changed. Don't dump raw `rig` output unless the user asks ("show me the raw output"). Examples:
105
+ - After running a `rig wiki *` command, **summarise in natural language** what changed. Don't dump raw `rig` output unless the user asks. Examples:
65
106
  - After `rig wiki ingest`: "Wrote 11 pages (1 source, 2 entities, 5 concepts, …). Lint clean."
66
- - After `rig wiki query`: cite the top hit by slug `[[wikilink]]` and quote a 1-line snippet; offer to run `--synth` if user wants a paragraph.
107
+ - After `rig wiki query`: cite the top hit by slug `[[wikilink]]` and quote a 1-line snippet; offer `--synth` for a paragraph.
67
108
  - After `rig wiki scan`: "3 new, 1 modified. Want me to ingest them?"
68
109
  - For **machine** consumption (chaining): use `--json` on any command. Shape is `{ ok, code, data?, error? }`.
69
- - **Long ingest** (Claude two-step CoT): expect 1–3 minutes. Tell the user once at the start; don't ping them mid-run.
110
+ - **Long ingest** (Claude two-step CoT): expect 1–3 minutes per source. Tell the user once at the start; don't ping them mid-run.
70
111
  - **First-run model download** (embed model on first `ingest` / `index`, reranker on first `query`): each is ~610MB from the rig CDN — usually under a minute. Mention it the first time, then forget.
71
112
 
72
113
  ## When NOT to use this skill
@@ -76,38 +117,37 @@ Always run from inside the registered project (or pass `--wiki <name>`). If the
76
117
  - User is talking about a different knowledge system (Obsidian-only, Notion, etc.).
77
118
  - Task is unrelated to personal knowledge capture (e.g. code search → use `grep`).
78
119
 
79
- ## Setup — if no wiki is registered
120
+ ## Setup — if no vault is found
80
121
 
81
- `rig wiki list` shows zero entries → ask the user **once** (don't list multiple defaults; pick one suggestion and confirm):
122
+ `rig wiki scan` (or any command) reports `No rig wiki vault found.` → ask the user **once** which sibling data dir to scope this wiki to (don't guess silently):
82
123
 
83
- > "No wiki registered here. Want me to init one under `knowledge/`? (or pick another subdir name)"
124
+ > "No vault here. Which subdir should this wiki ingest from `personal/`, `research/`, …?"
84
125
 
85
126
  Then orchestrate without further prompting:
86
127
 
87
128
  ```bash
88
- rig wiki init <subdir> # REQUIRED fails if path missing or hidden/gitignored
89
- rig wiki register <subdir>
129
+ cd <project> # the root that contains the scope dir
130
+ rig wiki init <scope> # e.g. `rig wiki init personal` → creates ./rig-wiki/, scope = ./personal/
90
131
  ```
91
132
 
92
- After init, **pause and ask the user to edit `<subdir>/purpose.md`** (one-time human scoping — define what this wiki is for, in/out of scope). Don't write purpose.md yourself; it's the only human-authored anchor for everything downstream.
133
+ After init, **pause and ask the user to edit `<project>/rig-wiki/purpose.md`** (one-time human scoping — define what this wiki is for, in/out of scope). Don't write purpose.md yourself; it's the only human-authored anchor for everything downstream.
93
134
 
94
- If the user describes a scan scope that differs from the defaults (e.g. "include every md file in the parent dir but ignore zip files"), translate that into edits to `<subdir>/.rig/config.yml` that's the per-vault settings file (`name`, `root`, `include`, `exclude`, `schedule`, `ingestRules`). The vault is self-contained: nothing about its identity or scope lives outside its own directory.
135
+ If the user wants finer scoping than a single subdir (e.g. "ingest `personal/` but ignore zip files"), translate that into edits to `<project>/rig-wiki/.rig/config.yml`. Fields: `name`, `root` (relative scan base, default `../<scope>`), `include[]`, `exclude[]`, `schedule`, `ingestRules`. Everything about the vault lives in that dir nothing leaks outside.
95
136
 
96
- ## Configuration model (read once, then forget)
137
+ ## Configuration files
97
138
 
98
- Two layers, both YAML:
139
+ Two YAML files, both optional except where noted:
99
140
 
100
- - `~/.rig/config.yml` — rig-global prefs only (default agent, qmd toggle, log rotation). Touched by `rig wiki agent use`.
101
- - `~/.rig/wikis.yml` — registry. **Just a flat list of vault paths** for discovery. No per-wiki settings here.
102
- - `<vault>/.rig/config.yml` — **the only place per-vault settings live.** `name`, optional `root` (relative scan base, default `..`), `include[]`, `exclude[]`, `schedule`, `ingestRules`. Created automatically by `init`. Safe to edit by hand.
141
+ - `~/.rig/config.yml` — rig-global prefs (default agent, qmd toggle, log rotation). Touched by `rig wiki agent use`.
142
+ - `<vault>/.rig/config.yml` — **the only place per-vault settings live.** Auto-created by `rig wiki init`. Safe to edit by hand.
103
143
 
104
- Never edit `~/.rig/wikis.yml` to change a wiki's name, scope, or schedule — those belong in the vault. Never invent a `package.rig.json5` wiki block; that file is unrelated to rig wiki (legacy rig CICD only).
144
+ No global registry. No `package.rig.json5` wiki block (that file is for legacy rig CICD, unrelated).
105
145
 
106
146
  ## Architecture (read once, then forget)
107
147
 
108
148
  - Vector-only retrieval: Qwen3-Embedding-0.6B (~610MB) + Qwen3-Reranker-0.6B (~610MB), both CDN-mirrored at `assets.terncloud.com/rig/models/`.
109
149
  - Models auto-downloaded on first use into `~/.cache/qmd/models/`; subsequent runs are instant.
110
- - Per-wiki SQLite at `~/.rig/cache/qmd/<wiki>.sqlite` (sqlite-vec extension). `.gitignore`'d by default.
150
+ - Per-vault SQLite at `~/.rig/cache/qmd/<vault-name>.sqlite` (sqlite-vec extension). `.gitignore`'d by default.
111
151
  - `ingest` triggers incremental embed at the end — no need to manually call `index` in routine use.
112
152
  - macOS-only in v1.
113
153
 
package/RIG_WIKI_SKILL.md CHANGED
@@ -15,14 +15,24 @@ metadata:
15
15
 
16
16
  **Positioning.** rig wiki is an **agent-facing tool**. Humans don't memorise the CLI; they tell their agent (you) what they want, and you orchestrate `rig wiki *`. Treat any direct user-typed `rig wiki ...` invocation as a fallback — your job is to make raw CLI use unnecessary. Never just hand the user a command and walk away; run it, observe, report.
17
17
 
18
- You orchestrate `rig wiki *` on behalf of the user. The user speaks in intent; you map to commands. Below is the intent → action table. Resolve the **target wiki** by reading `rig wiki list` once at session start; if none registered, see "Setup" at the bottom.
18
+ ## Vault model one fixed dir per project
19
+
20
+ A vault is **a single `rig-wiki/` dir at the project root** holding metadata (purpose.md, schema.md, page tree, `.rig/config.yml`). The project root itself is the conceptual "vault" — `rig-wiki/` is just the metadata subdir living inside it, named `rig-wiki/` by convention. User-authored data (`personal/`, `research/`, etc.) lives in sibling dirs and is NEVER touched.
21
+
22
+ - **The scope** — which sibling data dir(s) the wiki actually ingests — is recorded in `<rig-wiki>/.rig/config.yml` (`name`, `root`, `include`).
23
+ - **Discovery is automatic.** Any `rig wiki *` command walks up from CWD; at each level it checks both `<dir>/.rig/config.yml` (you're inside the vault) and `<dir>/rig-wiki/.rig/config.yml` (you're at the project root). So `cd` anywhere inside the project works.
24
+
25
+ This means:
26
+ - **No `--wiki <name>` flag exists.** Don't try to pass one.
27
+ - **No `rig wiki list`, `register`, or `unregister` commands.** They've been removed.
28
+ - If the user is in a project that has no vault, the next step is `rig wiki init <scope>` (see "Setup" below).
19
29
 
20
30
  ## Intent → command map
21
31
 
22
32
  | User intent (any language) | Action |
23
33
  |---|---|
24
34
  | "把 / record / take notes on / 添加 / 收一下 / 收藏 …" + a URL | `rig wiki fetch <url>` then `rig wiki ingest raw/<resulting-file>` |
25
- | "…" + a local file path or content paste | Write the content to `<wiki>/raw/YYYY-MM-DD-<kebab-slug>.md` with frontmatter (`source-url`, `fetched-at`, `fetcher: agent-paste`, `content-sha`). Then `rig wiki ingest <that-path>`. |
35
+ | "…" + a local file path or content paste | Write the content to `<vault>/raw/YYYY-MM-DD-<kebab-slug>.md` with frontmatter (`source-url`, `fetched-at`, `fetcher: agent-paste`, `content-sha`). Then `rig wiki ingest <that-path>`. |
26
36
  | "ingest / re-process / 重新整理 / 重新 ingest <something>" | `rig wiki ingest <path>` — handles new sources AND re-ingest of modified ones. |
27
37
  | "what's new / 有什么变化 / scan / diff" | `rig wiki scan` — surface the NEW / MODIFIED / DELETED / RAW DRIFT report verbatim. |
28
38
  | "ingest everything new / 把新东西都收一下" | `rig wiki scan` → for each NEW path → `rig wiki ingest <path>` (one call per file). |
@@ -30,43 +40,74 @@ You orchestrate `rig wiki *` on behalf of the user. The user speaks in intent; y
30
40
  | "summarize what we know about X / 总结一下 X" | `rig wiki query "<X>" --synth` — adds a Claude-synthesized paragraph with `[[wikilink]]` citations after the hit list. |
31
41
  | "lint / 检查一遍 / what's broken in my wiki" | `rig wiki lint`. Surface the report. Exit code 11 = severe (broken refs / missing source). |
32
42
  | "rebuild / 全部重 embed / 换了模型 / 新机器" | `rig wiki rebuild` — full nuclear refresh. Only suggest this when the user mentions a new device or explicitly switching the embed model. |
33
- | "wiki list / what wikis are registered" | `rig wiki list` |
34
43
 
35
- Always run from inside the registered project (or pass `--wiki <name>`). If the user is in some other CWD, `cd` to the wiki's project first.
44
+ ## Vault layout (flat no inner `wiki/` subdir)
45
+
46
+ ```
47
+ <project>/ ← the conceptual vault (e.g. overmind/)
48
+ rig-wiki/ ← fixed metadata-dir name; created by `rig wiki init`
49
+ purpose.md ← human-authored, never write
50
+ schema.md ← human-authored, never write
51
+ index.md ← LLM-writable
52
+ overview.md ← LLM-writable
53
+ log.md ← append-only LLM log
54
+ reviews.md ← LLM-writable backlog of human-review items
55
+ raw/ ← immutable source files (never edit existing)
56
+ sources/ ← one .md per ingested source — page tree at vault root
57
+ entities/
58
+ concepts/
59
+ synthesis/
60
+ queries/
61
+ .rig/config.yml ← per-vault settings (name, root, include, exclude, …)
62
+ .gitignore
63
+ personal/ ← user-authored data — scope target (NEVER touched)
64
+ research/ ← (other sibling data dirs)
65
+ ...
66
+ ```
67
+
68
+ Note: page directories (`sources/`, `entities/`, `concepts/`, `synthesis/`, `queries/`) live directly under `rig-wiki/` — no nested `wiki/` subdir.
36
69
 
37
70
  ## Argument inference rules
38
71
 
39
- - **slug** = kebab-case, no dates inside `wiki/`, dates only on `raw/YYYY-MM-DD-*` prefix.
72
+ - **slug** = kebab-case, no dates in page filenames; dates only on `raw/YYYY-MM-DD-*` prefix.
40
73
  - **raw filename** = `YYYY-MM-DD-<slug>.md`. Pick today's local date; if filename collides, append `-2`, `-3`.
41
74
  - **URL → slug**: last path segment, drop extension, lowercase, replace non-`[a-z0-9-]` with `-`, max 64 chars.
42
- - **wiki dir name** when initializing: prefer user-stated name; if absent, ask once. Never default to `wiki` or CWD silently.
75
+ - **`rig wiki init <scope>` arg** is a data subdir NAME, not a path to create. Examples: `rig wiki init personal` (scopes to `./personal/`), `rig wiki init research`. The vault metadata dir is always `./rig-wiki/`. Never pass a path like `rig-wiki` that's the metadata dir, not the scope.
43
76
 
44
77
  ## Hard rules — refuse and explain if violated
45
78
 
46
79
  - **Never** edit `raw/`, `purpose.md`, or `schema.md` directly. Those are human-authored. If the user asks you to, tell them to do it manually.
47
- - **Never** ingest or init at a **hidden path** (any segment starting with `.`) or a **.gitignored** path. rig wiki refuses at the CLI level — it sees these as "the project deliberately doesn't want this in the wiki." Workaround if the user insists: `cp -R <hidden-or-ignored> <wiki>/raw/<slug>/` first, then ingest the copy. Never bypass the guard.
48
- - **Never** ingest a path outside the wiki's `include[]` scope (anything in `raw/` is always fine; outside that requires the path to be listed in the registered wiki's `include`).
80
+ - **Never** init a vault INSIDE a user-authored data directory (e.g. `personal/wiki/`). The vault dir contaminates the user's source tree. Put the vault at the project root (e.g. `<project>/rig-wiki/`) and point `include[]` at the data dirs via `<vault>/.rig/config.yml`.
81
+ - **Never** init a vault at a **hidden path** (any segment starting with `.`) or a **.gitignored** path. rig wiki refuses at the CLI level.
49
82
  - **`rig wiki scan` exit 10 (RAW DRIFT)** = a `raw/` file's bytes changed since last scan. Do NOT auto-fix or re-ingest. Surface to the user as a data-integrity warning.
50
83
  - **`rig wiki lint` exit 11** = severe findings. Surface the report path and the top findings; do not auto-fix unless the user asks.
51
84
  - **Never** suggest editing `~/.rig/cache/qmd/*.sqlite` or `~/.cache/qmd/`. Those are rebuildable caches.
52
85
 
86
+ ## Auto-exclusions (no config needed)
87
+
88
+ The scanner skips these automatically — do not waste user time adding them to `exclude`:
89
+ - Any path segment starting with `.` (`.git/`, `.obsidian/`, `.vscode/`, `.DS_Store`, …).
90
+ - Any path matched by the project's `.gitignore`.
91
+
92
+ What you DO need to put in `exclude` are content-type filters the user cares about — e.g. `**/*.zip`, `**/*.pdf` if they don't want those in their text wiki.
93
+
53
94
  ## Common error → recovery
54
95
 
55
96
  | Error | What it means | Action |
56
97
  |---|---|---|
57
- | `qmd query failed. Run \`rig wiki index\` first` | No vector index for this wiki | `rig wiki index --wiki <name>` then retry |
58
- | `no wiki resolved` | CWD is not inside a registered wiki and no `--wiki` flag | Either `cd` into the project or pass `--wiki <name>` |
59
- | `claude not installed on PATH` (during ingest/synth) | Claude Code CLI missing | Tell the user; suggest `yarn dlx @anthropics/claude-code` or use a non-agent flow |
98
+ | `No rig wiki vault found.` | CWD has no `.rig/config.yml` and no parent does either | `cd` into the vault (or the project that contains one), or run `rig wiki init <subdir>` |
99
+ | `qmd query failed. Run \`rig wiki index\` first` | No vector index for this vault | `rig wiki index`, then retry |
100
+ | `claude not installed on PATH` (during ingest/synth) | Claude Code CLI missing | Tell the user; suggest `yarn dlx @anthropics/claude-code` |
60
101
  | Reranker download stalls on first query | CDN cold node, can take ~1 min | Just wait; subsequent queries are instant |
61
102
 
62
103
  ## Output handling
63
104
 
64
- - After running a `rig wiki *` command, **summarise in natural language** what changed. Don't dump raw `rig` output unless the user asks ("show me the raw output"). Examples:
105
+ - After running a `rig wiki *` command, **summarise in natural language** what changed. Don't dump raw `rig` output unless the user asks. Examples:
65
106
  - After `rig wiki ingest`: "Wrote 11 pages (1 source, 2 entities, 5 concepts, …). Lint clean."
66
- - After `rig wiki query`: cite the top hit by slug `[[wikilink]]` and quote a 1-line snippet; offer to run `--synth` if user wants a paragraph.
107
+ - After `rig wiki query`: cite the top hit by slug `[[wikilink]]` and quote a 1-line snippet; offer `--synth` for a paragraph.
67
108
  - After `rig wiki scan`: "3 new, 1 modified. Want me to ingest them?"
68
109
  - For **machine** consumption (chaining): use `--json` on any command. Shape is `{ ok, code, data?, error? }`.
69
- - **Long ingest** (Claude two-step CoT): expect 1–3 minutes. Tell the user once at the start; don't ping them mid-run.
110
+ - **Long ingest** (Claude two-step CoT): expect 1–3 minutes per source. Tell the user once at the start; don't ping them mid-run.
70
111
  - **First-run model download** (embed model on first `ingest` / `index`, reranker on first `query`): each is ~610MB from the rig CDN — usually under a minute. Mention it the first time, then forget.
71
112
 
72
113
  ## When NOT to use this skill
@@ -76,38 +117,37 @@ Always run from inside the registered project (or pass `--wiki <name>`). If the
76
117
  - User is talking about a different knowledge system (Obsidian-only, Notion, etc.).
77
118
  - Task is unrelated to personal knowledge capture (e.g. code search → use `grep`).
78
119
 
79
- ## Setup — if no wiki is registered
120
+ ## Setup — if no vault is found
80
121
 
81
- `rig wiki list` shows zero entries → ask the user **once** (don't list multiple defaults; pick one suggestion and confirm):
122
+ `rig wiki scan` (or any command) reports `No rig wiki vault found.` → ask the user **once** which sibling data dir to scope this wiki to (don't guess silently):
82
123
 
83
- > "No wiki registered here. Want me to init one under `knowledge/`? (or pick another subdir name)"
124
+ > "No vault here. Which subdir should this wiki ingest from `personal/`, `research/`, …?"
84
125
 
85
126
  Then orchestrate without further prompting:
86
127
 
87
128
  ```bash
88
- rig wiki init <subdir> # REQUIRED fails if path missing or hidden/gitignored
89
- rig wiki register <subdir>
129
+ cd <project> # the root that contains the scope dir
130
+ rig wiki init <scope> # e.g. `rig wiki init personal` → creates ./rig-wiki/, scope = ./personal/
90
131
  ```
91
132
 
92
- After init, **pause and ask the user to edit `<subdir>/purpose.md`** (one-time human scoping — define what this wiki is for, in/out of scope). Don't write purpose.md yourself; it's the only human-authored anchor for everything downstream.
133
+ After init, **pause and ask the user to edit `<project>/rig-wiki/purpose.md`** (one-time human scoping — define what this wiki is for, in/out of scope). Don't write purpose.md yourself; it's the only human-authored anchor for everything downstream.
93
134
 
94
- If the user describes a scan scope that differs from the defaults (e.g. "include every md file in the parent dir but ignore zip files"), translate that into edits to `<subdir>/.rig/config.yml` that's the per-vault settings file (`name`, `root`, `include`, `exclude`, `schedule`, `ingestRules`). The vault is self-contained: nothing about its identity or scope lives outside its own directory.
135
+ If the user wants finer scoping than a single subdir (e.g. "ingest `personal/` but ignore zip files"), translate that into edits to `<project>/rig-wiki/.rig/config.yml`. Fields: `name`, `root` (relative scan base, default `../<scope>`), `include[]`, `exclude[]`, `schedule`, `ingestRules`. Everything about the vault lives in that dir nothing leaks outside.
95
136
 
96
- ## Configuration model (read once, then forget)
137
+ ## Configuration files
97
138
 
98
- Two layers, both YAML:
139
+ Two YAML files, both optional except where noted:
99
140
 
100
- - `~/.rig/config.yml` — rig-global prefs only (default agent, qmd toggle, log rotation). Touched by `rig wiki agent use`.
101
- - `~/.rig/wikis.yml` — registry. **Just a flat list of vault paths** for discovery. No per-wiki settings here.
102
- - `<vault>/.rig/config.yml` — **the only place per-vault settings live.** `name`, optional `root` (relative scan base, default `..`), `include[]`, `exclude[]`, `schedule`, `ingestRules`. Created automatically by `init`. Safe to edit by hand.
141
+ - `~/.rig/config.yml` — rig-global prefs (default agent, qmd toggle, log rotation). Touched by `rig wiki agent use`.
142
+ - `<vault>/.rig/config.yml` — **the only place per-vault settings live.** Auto-created by `rig wiki init`. Safe to edit by hand.
103
143
 
104
- Never edit `~/.rig/wikis.yml` to change a wiki's name, scope, or schedule — those belong in the vault. Never invent a `package.rig.json5` wiki block; that file is unrelated to rig wiki (legacy rig CICD only).
144
+ No global registry. No `package.rig.json5` wiki block (that file is for legacy rig CICD, unrelated).
105
145
 
106
146
  ## Architecture (read once, then forget)
107
147
 
108
148
  - Vector-only retrieval: Qwen3-Embedding-0.6B (~610MB) + Qwen3-Reranker-0.6B (~610MB), both CDN-mirrored at `assets.terncloud.com/rig/models/`.
109
149
  - Models auto-downloaded on first use into `~/.cache/qmd/models/`; subsequent runs are instant.
110
- - Per-wiki SQLite at `~/.rig/cache/qmd/<wiki>.sqlite` (sqlite-vec extension). `.gitignore`'d by default.
150
+ - Per-vault SQLite at `~/.rig/cache/qmd/<vault-name>.sqlite` (sqlite-vec extension). `.gitignore`'d by default.
111
151
  - `ingest` triggers incremental embed at the end — no need to manually call `index` in routine use.
112
152
  - macOS-only in v1.
113
153