llm-wiki-kit 0.1.5 → 0.1.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.
package/README.md CHANGED
@@ -47,6 +47,7 @@ llm-wiki/
47
47
  ├── raw/
48
48
  ├── wiki/
49
49
  │ ├── index.md
50
+ │ ├── memory.md
50
51
  │ ├── log.md
51
52
  │ ├── sources/
52
53
  │ ├── concepts/
@@ -60,7 +61,7 @@ llm-wiki/
60
61
  └── procedures/
61
62
  ```
62
63
 
63
- `raw/` is the immutable or redacted evidence layer. `wiki/` is the LLM-maintained knowledge layer. `outputs/` stores live Q&A and requested reports. `.kit-state.json` records which runtime version last applied managed templates to the project. Text written by the kit is normalized to NFC so Korean filenames and content stay composed.
64
+ `raw/` is the immutable or redacted evidence layer. `wiki/` is the LLM-maintained knowledge layer. `wiki/memory.md` is the short hot index injected into hook context before deeper search results. `outputs/` stores live Q&A and requested reports. `.kit-state.json` records which runtime version last applied managed templates to the project. Text written by the kit is normalized to NFC so Korean filenames and content stay composed.
64
65
 
65
66
  ## Normal Use
66
67
 
@@ -68,29 +69,26 @@ Use Claude Code or Codex normally.
68
69
 
69
70
  The installed hooks:
70
71
 
71
- - inject relevant wiki context at session start and prompt submit time
72
+ - inject `wiki/memory.md`, `wiki/index.md`, and relevant wiki context at session start and prompt submit time
72
73
  - record redacted turn summaries
73
74
  - capture decision points, debugging findings, changed files, and verification notes
74
75
  - allow tool calls to proceed without secret/PII-based hook blocking
75
76
  - update `llm-wiki/outputs/questions/YYYY-MM-DD-live-qa.md`
76
- - promote useful answers into `llm-wiki/wiki/queries/`
77
+ - capture reusable-answer candidates into `llm-wiki/wiki/queries/`
77
78
  - promote decision-like turns into `llm-wiki/wiki/decisions/`
79
+ - nudge the active LLM to fold reusable facts into existing wiki pages instead of leaving everything as one-off Q&A
80
+ - automatically refresh managed rules/templates for older projects when the current runtime starts a session
78
81
 
79
82
  If you need to think about saving every answer manually, the setup has failed.
80
83
 
81
- ## User-Facing Commands
84
+ ## Operational Commands
82
85
 
83
- ```bash
84
- llm-wiki install --workspace /path/to/project --profile standard
85
- llm-wiki doctor
86
- llm-wiki status --workspace /path/to/project
87
- llm-wiki projects --workspace /path/to/search-root
88
- llm-wiki update --check --workspace /path/to/project
89
- llm-wiki update --all --workspace /path/to/search-root
90
- llm-wiki update --dry-run --workspace /path/to/project
91
- llm-wiki update --workspace /path/to/project
92
- llm-wiki uninstall
93
- ```
86
+ Most users should not need these during daily Claude Code/Codex work. They exist for install, update, diagnostics, and agent-side maintenance.
87
+
88
+ - Install/update: `llm-wiki install`, `llm-wiki update`, `llm-wiki projects`
89
+ - Diagnostics: `llm-wiki doctor`, `llm-wiki status`, `llm-wiki version`
90
+ - Agent maintenance helpers: `llm-wiki context`, `llm-wiki lint`, `llm-wiki consolidate`
91
+ - Cleanup: `llm-wiki uninstall`
94
92
 
95
93
  `llm-wiki status` is an offline consistency check. It reports the installed runtime version, hook targets, and whether the current workspace has the current managed templates applied.
96
94
 
@@ -98,9 +96,33 @@ llm-wiki uninstall
98
96
 
99
97
  `llm-wiki update` upgrades the global npm package, reinstalls the hook entries, and patches only managed project files such as the marked `AGENTS.md` policy block and generated `llm-wiki/AGENTS.md`/procedure files. Existing wiki content is not overwritten.
100
98
 
99
+ `llm-wiki context "<query>"` prints the same layered context used by hooks. It is mainly for debugging what Codex/Claude Code will see; daily use should rely on hook injection.
100
+
101
+ `llm-wiki lint` checks wiki health and detects outdated managed rules from older kit versions. Agents may use it before/after meaningful wiki maintenance.
102
+
103
+ `llm-wiki consolidate` refreshes only generated marker blocks in `wiki/memory.md` and `wiki/index.md`. It is an agent maintenance helper, not a command users should run after every turn.
104
+
101
105
  `llm-wiki projects --workspace /apps` lists project roots that already have `llm-wiki-kit` state and shows the update commands to run. `llm-wiki update --all --workspace /apps` updates the global runtime once, then reapplies managed templates across every discovered project root under `/apps`.
102
106
 
103
- After a plain `npm install -g llm-wiki-kit@latest`, installed hooks point at the same global binary path. The next `SessionStart`/`InstructionsLoaded` hook automatically reapplies safe managed template updates for the active project root. This only patches generated/managed files and does not overwrite wiki content.
107
+ After a plain `npm install -g llm-wiki-kit@latest`, existing hooks keep working when they already point at the global npm package path. The next `SessionStart`/`InstructionsLoaded` hook automatically reapplies safe managed template updates for the active project root. Clearly generated older `llm-wiki/AGENTS.md` and procedure files are refreshed even when old state is missing; user-edited files are not overwritten and are surfaced to the active agent as cleanup work. If hooks point at a source checkout or stale shim, run `llm-wiki post-update --workspace <project>` or `llm-wiki install --workspace <project>` once to reconnect them.
108
+
109
+ On PCs that use nvm or user-local npm, prefer the non-sudo global install and make sure the `llm-wiki` command resolves to that npm package:
110
+
111
+ ```bash
112
+ npm install -g llm-wiki-kit@latest --registry=https://registry.npmjs.org/ --prefer-online
113
+ which -a llm-wiki
114
+ readlink -f "$(command -v llm-wiki)"
115
+ llm-wiki version
116
+ llm-wiki status
117
+ ```
118
+
119
+ If `which -a llm-wiki` shows a stale `~/.local/bin/llm-wiki` before the nvm/npm global binary, remove only that file, not the whole `~/.local/bin` directory:
120
+
121
+ ```bash
122
+ rm -f "$HOME/.local/bin/llm-wiki"
123
+ hash -r
124
+ llm-wiki version
125
+ ```
104
126
 
105
127
  Real `update --check` and `update` require the package to exist in the npm registry. Before publication, use local tarball installs for smoke testing and fake npm in automated tests.
106
128
 
@@ -126,6 +148,7 @@ Source checkout installs are supported for development:
126
148
  ```bash
127
149
  git clone <your-git-url>/llm-wiki-kit.git /apps/llm-wiki-kit
128
150
  cd /apps/llm-wiki-kit
151
+ npm install
129
152
  ./install.sh --workspace /apps --profile standard
130
153
  node --test
131
154
  ```
package/docs/concepts.md CHANGED
@@ -8,17 +8,19 @@ raw sources -> wiki -> schema/rules
8
8
 
9
9
  - `raw/` is evidence. It is immutable unless a hook appends a redacted event envelope.
10
10
  - `wiki/` is the living Markdown knowledge layer maintained by the agent.
11
+ - `wiki/memory.md` is the compact hot index that keeps the most reusable current facts close to the context window.
11
12
  - `AGENTS.md`, `CLAUDE.md`, and `procedures/` are the schema/rules layer.
12
13
  - `.kit-state.json` records which managed rules/templates were applied by which runtime version.
13
14
 
14
15
  The important behavior is a loop:
15
16
 
16
17
  1. A Claude Code or Codex session starts.
17
- 2. Relevant wiki context is injected automatically.
18
- 3. The user works normally.
18
+ 2. `memory.md`, `index.md`, and relevant wiki context are injected automatically.
19
+ 3. The user works normally; no extra command loop is required.
19
20
  4. Hooks gather redacted prompt/tool/result summaries.
20
21
  5. At stop/session end, useful knowledge is written back to Markdown.
21
- 6. Future sessions start from the improved wiki.
22
+ 6. Future sessions start from the improved wiki instead of relying on long chat history.
23
+ 7. When reusable knowledge appears, the active Claude Code/Codex agent folds it into existing durable wiki pages instead of leaving everything as one-off Q&A.
22
24
 
23
25
  The kit is a template/runtime repository. It must not centralize project wiki contents.
24
26
 
@@ -26,4 +28,15 @@ Runtime updates and project knowledge are separate:
26
28
 
27
29
  - npm updates replace the runtime package and hook targets.
28
30
  - project patching updates only managed policy blocks and generated procedure files.
31
+ - old generated `llm-wiki/AGENTS.md` and procedure files are refreshed automatically when they are clearly kit-generated, even if old project state is missing.
32
+ - user-edited files are preserved and surfaced to the agent as cleanup work.
33
+ - `memory.md` is created when missing, then treated as project-owned content.
29
34
  - curated wiki pages remain project-owned content and are not overwritten by runtime updates.
35
+
36
+ The maintenance loop is intentionally layered:
37
+
38
+ - `memory.md`: short hot index for current durable facts.
39
+ - `index.md`: broad navigation map.
40
+ - MiniSearch + wikilinks: retrieval over the rest of `wiki/**/*.md`, with substring fallback when MiniSearch is not installed in a source checkout.
41
+ - `lint`: finds broken links, stale pages, duplicates, metadata gaps, secret-like content, and outdated managed rules.
42
+ - `consolidate`: agent helper that refreshes generated blocks in `memory.md` and `index.md` while preserving handwritten notes and keeping default query/context/session pages out of the durable generated maps.
@@ -40,6 +40,8 @@ when no project `CLAUDE.md` exists. Existing `CLAUDE.md` files are not overwritt
40
40
 
41
41
  The hook records redacted turn summaries but does not deny tool calls only because an input looks sensitive.
42
42
 
43
+ At `SessionStart`/`InstructionsLoaded`, the hook injects `llm-wiki/wiki/memory.md`, `llm-wiki/wiki/index.md`, recent log context, and operating rules. At `UserPromptSubmit`, it searches wiki pages with MiniSearch or substring fallback, expands one-hop wikilinks, redacts context fields, and injects the smallest useful context set.
44
+
43
45
  After installation or update, run:
44
46
 
45
47
  ```bash
@@ -29,8 +29,8 @@ Handled events:
29
29
 
30
30
  Expected behavior:
31
31
 
32
- - `SessionStart` injects `llm-wiki/wiki/index.md`, recent log context, and operating rules.
33
- - `UserPromptSubmit` searches project wiki pages and injects the smallest useful context set.
32
+ - `SessionStart` injects `llm-wiki/wiki/memory.md`, `llm-wiki/wiki/index.md`, recent log context, and operating rules.
33
+ - `UserPromptSubmit` searches project wiki pages with MiniSearch or substring fallback, expands one-hop wikilinks, redacts context fields, and injects the smallest useful context set.
34
34
  - `PreToolUse` records redacted tool summaries without blocking tool calls.
35
35
  - `PostToolUse` records redacted tool summaries in a turn buffer.
36
36
  - `Stop` writes live Q&A and durable wiki pages.
@@ -47,9 +47,12 @@ The installer:
47
47
  - bootstraps the workspace `llm-wiki/`
48
48
  - records managed template state in `llm-wiki/.kit-state.json`
49
49
 
50
+ Use `llm-wiki install --no-project` only when you want hook/bin installation without bootstrapping the current workspace as a project.
51
+
50
52
  Source checkout installs are still useful for development:
51
53
 
52
54
  ```bash
55
+ npm install
53
56
  ./install.sh --workspace /apps --profile standard
54
57
  ```
55
58
 
@@ -63,15 +66,21 @@ llm-wiki install --workspace /apps --profile standard
63
66
 
64
67
  Do not delete a project `llm-wiki/` tree to reinstall the runtime. `llm-wiki uninstall` removes hook entries only; project knowledge is intentionally left intact.
65
68
 
66
- ## Status And Updates
69
+ ## Maintainer And Agent Reference
70
+
71
+ Daily work should happen through Claude Code/Codex. These commands are for maintainer checks, troubleshooting, and agent-side maintenance.
67
72
 
68
73
  ```bash
74
+ llm-wiki version
69
75
  llm-wiki status --workspace /path/to/project
70
76
  llm-wiki projects --workspace /path/to/search-root
71
77
  llm-wiki update --check --workspace /path/to/project
72
78
  llm-wiki update --all --workspace /path/to/search-root
73
79
  llm-wiki update --dry-run --workspace /path/to/project
74
80
  llm-wiki update --workspace /path/to/project
81
+ llm-wiki context "search phrase" --workspace /path/to/project
82
+ llm-wiki lint --workspace /path/to/project
83
+ llm-wiki consolidate --workspace /path/to/project
75
84
  ```
76
85
 
77
86
  `status` is offline and answers whether the local installation is internally consistent:
@@ -95,14 +104,101 @@ llm-wiki update --workspace /path/to/project
95
104
 
96
105
  `update --all --workspace <search-root>` performs the npm runtime update once, then reapplies managed templates to every discovered project root under the search root.
97
106
 
98
- After a plain `npm install -g llm-wiki-kit@latest`, existing hooks keep pointing at the global package path. On the next `SessionStart` or `InstructionsLoaded`, the runtime automatically reapplies safe managed template updates for the active project root.
107
+ After a plain `npm install -g llm-wiki-kit@latest`, existing hooks keep working when they already point at the global npm package path. On the next `SessionStart` or `InstructionsLoaded`, the runtime automatically reapplies safe managed template updates for the active project root. If hooks point at a source checkout or stale shim, run `llm-wiki post-update --workspace <project>` or `llm-wiki install --workspace <project>` once to reconnect them.
108
+
109
+ ## Context And Wiki Maintenance
110
+
111
+ Daily use should be Claude Code/Codex first. The user should not need to run a chain of `llm-wiki` commands while working. Hooks inject the context automatically, and the active agent is expected to update durable wiki pages when reusable project knowledge appears.
112
+
113
+ `llm-wiki context "<query>"` is the manual debug form of hook context injection. It reads:
114
+
115
+ - `llm-wiki/wiki/memory.md` as the short hot index
116
+ - `llm-wiki/wiki/index.md` as the navigation map
117
+ - MiniSearch results from `llm-wiki/wiki/**/*.md`, with substring fallback when MiniSearch is unavailable
118
+ - one-hop wikilink neighbors for the strongest matches
119
+ - redacted output fields for query text, memory/index/log excerpts, hit paths, titles, snippets, matched terms, and link expansion metadata
120
+
121
+ Use it only when you want to inspect what the next agent turn should see:
122
+
123
+ ```bash
124
+ llm-wiki context "auth architecture" --workspace /path/to/project
125
+ llm-wiki context "auth architecture" --workspace /path/to/project --json
126
+ llm-wiki context "auth architecture" --workspace /path/to/project --limit 8 --no-expand
127
+ ```
128
+
129
+ `llm-wiki lint` checks Markdown wiki health without modifying files:
130
+
131
+ - missing `index.md`, `log.md`, or `memory.md`
132
+ - missing or invalid frontmatter
133
+ - broken or ambiguous `[[wikilinks]]`
134
+ - broken relative Markdown links, including non-Markdown local files
135
+ - invalid path-escaping or protocol-style `source_ids`
136
+ - missing source files referenced by valid `source_ids`
137
+ - secret-like content patterns such as tokens, password assignments, bearer credentials, and private keys
138
+ - duplicate aliases or titles
139
+ - stale pages and orphan candidates
140
+ - outdated managed rules/templates from earlier `llm-wiki-kit` versions
141
+
142
+ Broken links, invalid source IDs, and secret-like content are errors and return exit code 1. Metadata and discoverability gaps are warnings.
143
+
144
+ `llm-wiki consolidate` performs conservative generated-block maintenance:
145
+
146
+ - refreshes the generated block inside `wiki/memory.md`
147
+ - refreshes the generated block inside `wiki/index.md`
148
+ - excludes default `query`, `context`, and `session-log` pages from generated maps unless they are explicitly durable (`memory_type: semantic` or `procedural`, `importance >= 4`)
149
+ - skips malformed generated marker blocks instead of overwriting them
150
+ - preserves handwritten content outside marker blocks
151
+ - appends a log entry when files change
152
+ - supports `--dry-run`
153
+
154
+ Agents may run `consolidate` after meaningful wiki growth. Users should not need to run it after every turn.
155
+
156
+ When a new runtime sees an older project, `SessionStart`/`InstructionsLoaded` automatically reapplies safe managed template updates. Files that are clearly generated by older kit versions are refreshed. Files that look user-edited are preserved and surfaced to the active agent as cleanup context instead of being overwritten.
157
+
158
+ ## Updating User-Local Or nvm Installs
159
+
160
+ When Node is managed by nvm, update as the normal user instead of using `sudo`. `sudo npm install -g` writes to root's npm environment and may also fail behind a proxy/TLS-inspection network.
161
+
162
+ ```bash
163
+ npm install -g llm-wiki-kit@latest --registry=https://registry.npmjs.org/ --prefer-online
164
+ llm-wiki version
165
+ llm-wiki status --workspace /path/to/project
166
+ ```
167
+
168
+ If `npm install -g` reports success but `llm-wiki` still prints old help output, inspect the command resolution:
169
+
170
+ ```bash
171
+ which -a llm-wiki
172
+ readlink -f "$(command -v llm-wiki)"
173
+ npm root -g
174
+ node "$(npm root -g)/llm-wiki-kit/bin/llm-wiki.js" version
175
+ ```
176
+
177
+ When `which -a llm-wiki` shows `~/.local/bin/llm-wiki` before the nvm global binary, remove only that stale command file:
178
+
179
+ ```bash
180
+ rm -f "$HOME/.local/bin/llm-wiki"
181
+ hash -r
182
+ llm-wiki version
183
+ ```
184
+
185
+ Do not delete the whole `~/.local/bin` directory. It may contain unrelated user tools.
186
+
187
+ Use package-name-only uninstall syntax:
188
+
189
+ ```bash
190
+ npm uninstall -g llm-wiki-kit
191
+ ```
192
+
193
+ `npm uninstall -g llm-wiki-kit@latest` is not the right form and does not remove source checkouts or stale manually-created shims.
99
194
 
100
195
  Managed project files are conservative:
101
196
 
102
197
  - root `AGENTS.md` is patched only inside the `llm-wiki-kit` marker block
103
- - `llm-wiki/AGENTS.md` is replaced only when it is generated by the kit
104
- - generated procedures are replaced only when their recorded hash still matches or their content is a known generated template
105
- - `llm-wiki/wiki/index.md` and existing wiki pages are not overwritten
198
+ - `llm-wiki/AGENTS.md` is replaced only when its recorded hash still matches or the whole file exactly matches the current generated template
199
+ - generated procedures are replaced only when their recorded hash still matches or the whole file exactly matches the current generated template
200
+ - `llm-wiki/wiki/memory.md` is created if missing but never overwritten by template update once it exists
201
+ - `llm-wiki/wiki/index.md` and existing wiki pages are not overwritten by runtime update; `llm-wiki consolidate` updates only its generated marker block
106
202
 
107
203
  Real registry checks require `llm-wiki-kit` to be published to npm. Before publication, `llm-wiki update --check` returns npm 404. Use fake npm in tests or local tarball install for server smoke checks.
108
204
 
@@ -10,9 +10,13 @@ Important conclusions:
10
10
  - The durable pattern is `raw sources -> wiki -> schema`.
11
11
  - `raw/` and `wiki/` must not be mixed.
12
12
  - `index.md` should be a small navigation surface.
13
+ - `memory.md` should be an even smaller hot index for the facts most likely to matter in the next turn.
13
14
  - `log.md` should be append-only.
14
15
  - Good answers should be written back into the wiki instead of remaining in chat history.
15
16
  - Duplicate and stale pages are major failure modes.
16
17
  - Full automation without human review is risky for large imports or high-stakes decisions.
17
18
  - Obsidian, Graphify, MCP, and RAG can be useful extensions, but v1 must work with plain Markdown and hooks.
18
-
19
+ - Retrieval should combine lexical search with explicit Markdown links before adding heavier external infrastructure.
20
+ - Consolidation should be conservative: update generated blocks and navigation surfaces, but preserve human/agent-written page bodies.
21
+ - Separate LLM API integration is not required for the current design. Claude Code and Codex already provide the reasoning/writing layer; the kit should supply context, durable files, guardrails, and safe automatic project-rule updates.
22
+ - Heavy layers such as embeddings, graph databases, MCP tools, and hierarchical summary systems are future considerations only when project wikis become too large for the plain Markdown + hook workflow.
@@ -0,0 +1,27 @@
1
+ # Future Large-Scale Considerations
2
+
3
+ These items are not part of the current implementation plan.
4
+
5
+ The current product direction is plain Markdown plus Codex/Claude Code hooks:
6
+
7
+ - inject the smallest useful wiki context automatically
8
+ - let the active LLM update durable Markdown during normal work
9
+ - keep generated/template updates safe for older projects
10
+ - preserve raw/wiki separation and redaction rules
11
+
12
+ Consider heavier infrastructure only when real project wikis become large enough that this model fails in practice.
13
+
14
+ Deferred options:
15
+
16
+ - embeddings for semantic retrieval
17
+ - graph database storage
18
+ - MCP tools for direct wiki operations
19
+ - GraphRAG/RAPTOR-style hierarchical summaries
20
+ - external LLM API calls for automatic summarization
21
+
22
+ Reasons to defer:
23
+
24
+ - They add setup, cost, data-retention, and failure modes.
25
+ - Codex and Claude Code already provide the LLM reasoning layer.
26
+ - The immediate failure mode is wiki hygiene and old-template drift, not lack of model capacity.
27
+ - Plain Markdown remains inspectable, portable, and easy to repair.
package/docs/security.md CHANGED
@@ -11,4 +11,6 @@ Before writing durable summaries, the runtime redacts authentication values such
11
11
  - private key blocks
12
12
  - bearer credentials
13
13
 
14
+ Manual and hook context output also runs through redaction before returning excerpts or search hits. `llm-wiki lint` reports remaining secret-like wiki content as an error so it can be removed or rewritten before it becomes reusable project memory.
15
+
14
16
  Hook payloads are stored as small event envelopes, not full raw transcripts. Full transcript capture is intentionally not implemented as a default. If a project needs it, add a project-local policy and a redaction path first.
@@ -73,7 +73,7 @@ If the proxy performs TLS inspection, install the organization's CA and set `caf
73
73
 
74
74
  ## npm install -g Succeeds But llm-wiki Is Still Old
75
75
 
76
- If `npm install -g llm-wiki-kit@latest` succeeds but `llm-wiki --help` does not show newer commands such as `projects` or `version`, the shell is probably executing an older source checkout or stale shim before the npm global binary.
76
+ If `npm install -g llm-wiki-kit@latest` succeeds but `llm-wiki --help` does not show newer commands such as `projects`, `context`, `lint`, or `consolidate`, the shell is probably executing an older source checkout or stale shim before the npm global binary.
77
77
 
78
78
  Confirm what is actually running:
79
79
 
@@ -97,6 +97,28 @@ llm-wiki status
97
97
 
98
98
  If `readlink -f "$(command -v llm-wiki)"` points at a repository checkout such as `/mnt/d/dev_proj/llm-wiki-kit/bin/llm-wiki.js`, `npm install -g` is not updating that checkout. Either switch the shim to the npm package as above, or update the checkout itself with `git pull` and run it intentionally as source.
99
99
 
100
+ If `which -a llm-wiki` shows both `~/.local/bin/llm-wiki` and an nvm path such as `~/.nvm/versions/node/v20.20.2/bin/llm-wiki`, the `~/.local/bin` entry usually wins because it appears earlier on `PATH`. If the `~/.local/bin/llm-wiki` file is stale, remove only that file and let the nvm npm global command take over:
101
+
102
+ ```bash
103
+ rm -f "$HOME/.local/bin/llm-wiki"
104
+ hash -r
105
+ which -a llm-wiki
106
+ readlink -f "$(command -v llm-wiki)"
107
+ llm-wiki version
108
+ llm-wiki status
109
+ ```
110
+
111
+ Do not remove the entire `~/.local/bin` directory; it may contain unrelated commands. If the nvm command is missing after removing the stale file, reinstall the package in the active nvm Node version:
112
+
113
+ ```bash
114
+ npm uninstall -g llm-wiki-kit
115
+ npm install -g llm-wiki-kit@latest --registry=https://registry.npmjs.org/ --prefer-online
116
+ hash -r
117
+ llm-wiki version
118
+ ```
119
+
120
+ Use `npm uninstall -g llm-wiki-kit` with the package name only. `npm uninstall -g llm-wiki-kit@latest` is not the correct uninstall syntax and does not remove source checkouts or manually-created command shims.
121
+
100
122
  ## npm install -g Fails With EACCES
101
123
 
102
124
  If npm tries to write under `/usr` and fails with `EACCES`, use sudo when the server policy allows system-wide global packages:
@@ -153,7 +175,14 @@ The hook does not block tool calls only because inputs look sensitive. Durable s
153
175
  Run a manual review:
154
176
 
155
177
  ```bash
178
+ llm-wiki lint --workspace /path/to/project
156
179
  rg -n "title:|aliases:|source_ids:" llm-wiki/wiki
157
180
  ```
158
181
 
159
182
  Prefer merging duplicates into existing pages and preserving contradictions in an `Open Questions` section.
183
+
184
+ After merging or adding durable pages, refresh generated navigation blocks:
185
+
186
+ ```bash
187
+ llm-wiki consolidate --workspace /path/to/project
188
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llm-wiki-kit",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Hook-first living LLM Wiki runtime for Codex and Claude Code.",
5
5
  "type": "module",
6
6
  "files": [
@@ -20,6 +20,9 @@
20
20
  "doctor": "node bin/llm-wiki.js doctor",
21
21
  "status": "node bin/llm-wiki.js status"
22
22
  },
23
+ "dependencies": {
24
+ "minisearch": "^7.2.0"
25
+ },
23
26
  "engines": {
24
27
  "node": ">=20"
25
28
  },
package/src/cli.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { resolve } from 'path';
2
+ import { formatConsolidateResult, runConsolidate } from './consolidate.js';
2
3
  import { handleHook } from './hook.js';
3
4
  import { install, status, uninstall } from './install.js';
4
5
  import { bootstrapProject } from './project.js';
@@ -7,18 +8,28 @@ import { commandForProject, knownProjectRoots } from './projects.js';
7
8
  import { formatDoctor, runDoctor } from './doctor.js';
8
9
  import { migrate } from './migrate.js';
9
10
  import { postUpdate, update } from './update.js';
11
+ import { buildContextPack, formatContextPack } from './wiki-search.js';
12
+ import { formatLintResult, runLint } from './wiki-lint.js';
10
13
 
11
14
  function parseOptions(args) {
12
15
  const options = {};
13
16
  const rest = [];
17
+ const optionValue = (name, index) => {
18
+ const value = args[index + 1];
19
+ if (!value || value.startsWith('--')) throw new Error(`${name} requires a value`);
20
+ return value;
21
+ };
14
22
  for (let i = 0; i < args.length; i += 1) {
15
23
  const arg = args[i];
16
24
  if (arg === '--workspace' || arg === '--cwd') {
17
- options.workspace = args[++i];
25
+ options.workspace = optionValue(arg, i);
26
+ i += 1;
18
27
  } else if (arg === '--profile') {
19
- options.profile = args[++i];
28
+ options.profile = optionValue(arg, i);
29
+ i += 1;
20
30
  } else if (arg === '--to') {
21
- options.to = args[++i];
31
+ options.to = optionValue(arg, i);
32
+ i += 1;
22
33
  } else if (arg === '--no-codex') {
23
34
  options.codex = false;
24
35
  } else if (arg === '--no-claude') {
@@ -29,6 +40,16 @@ function parseOptions(args) {
29
40
  options.check = true;
30
41
  } else if (arg === '--dry-run') {
31
42
  options.dryRun = true;
43
+ } else if (arg === '--limit') {
44
+ const value = optionValue(arg, i);
45
+ const limit = Number(value);
46
+ if (!Number.isInteger(limit) || limit < 1 || limit > 50) {
47
+ throw new Error('--limit must be an integer from 1 to 50');
48
+ }
49
+ options.limit = limit;
50
+ i += 1;
51
+ } else if (arg === '--no-expand') {
52
+ options.expand = false;
32
53
  } else if (arg === '--replace-hooks') {
33
54
  options.replaceHooks = true;
34
55
  } else if (arg === '--all') {
@@ -71,6 +92,9 @@ Usage:
71
92
  llm-wiki hook claude <EventName>
72
93
  llm-wiki bootstrap --workspace <project>
73
94
  llm-wiki migrate --workspace <project>
95
+ llm-wiki context "<query>" --workspace <project> [--limit 5] [--no-expand]
96
+ llm-wiki lint --workspace <project>
97
+ llm-wiki consolidate --workspace <project> [--dry-run]
74
98
  `);
75
99
  return;
76
100
  }
@@ -143,6 +167,27 @@ Usage:
143
167
  return;
144
168
  }
145
169
 
170
+ if (command === 'context') {
171
+ const projectRoot = resolve(options.workspace || process.cwd());
172
+ const query = rest.join(' ').trim();
173
+ printJsonOrText(await buildContextPack(projectRoot, query, options), options, formatContextPack);
174
+ return;
175
+ }
176
+
177
+ if (command === 'lint') {
178
+ const projectRoot = resolve(options.workspace || process.cwd());
179
+ const result = await runLint(projectRoot, options);
180
+ printJsonOrText(result, options, formatLintResult);
181
+ if (!result.ok) process.exitCode = 1;
182
+ return;
183
+ }
184
+
185
+ if (command === 'consolidate') {
186
+ const projectRoot = resolve(options.workspace || process.cwd());
187
+ printJsonOrText(await runConsolidate(projectRoot, options), options, formatConsolidateResult);
188
+ return;
189
+ }
190
+
146
191
  if (command === 'hook') {
147
192
  const provider = rest[0] || 'codex';
148
193
  const eventName = rest[1];
@@ -178,6 +223,8 @@ async function listProjects(options) {
178
223
 
179
224
  function formatStatus(value) {
180
225
  const project = value.project || {};
226
+ const autoUpdateCount = (project.managedFiles || []).filter((file) => !file.current && file.patchable).length;
227
+ const attentionCount = (project.managedFiles || []).filter((file) => file.needsAttention).length;
181
228
  return [
182
229
  'llm-wiki-kit status',
183
230
  `- version: ${value.runtimeVersion}`,
@@ -190,6 +237,8 @@ function formatStatus(value) {
190
237
  `- claude hook: ${value.claudeInstalled ? 'current' : 'missing/outdated'}`,
191
238
  `- project applied runtime: ${project.lastRuntimeVersionApplied || 'unknown'}`,
192
239
  `- project templates current: ${project.managedFilesCurrent ? 'yes' : 'no'}`,
240
+ `- project auto-updateable rules: ${autoUpdateCount}`,
241
+ `- project rules needing agent cleanup: ${attentionCount}`,
193
242
  ].join('\n');
194
243
  }
195
244