llm-wiki-kit 0.1.6 → 0.1.8
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 +26 -29
- package/docs/concepts.md +8 -5
- package/docs/integrations/claude-code.md +7 -3
- package/docs/integrations/codex.md +9 -3
- package/docs/operations.md +36 -18
- package/docs/research/baseline.md +2 -0
- package/docs/research/future-large-scale.md +27 -0
- package/docs/troubleshooting.md +22 -11
- package/package.json +1 -1
- package/src/cli.js +32 -9
- package/src/doctor.js +49 -19
- package/src/hook.js +9 -3
- package/src/install.js +98 -8
- package/src/project-state.js +265 -9
- package/src/project.js +6 -3
- package/src/projects.js +16 -4
- package/src/state.js +5 -0
- package/src/templates.js +133 -29
- package/src/update.js +73 -12
- package/src/wiki-lint.js +11 -1
- package/src/wiki-search.js +3 -0
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ After the package is published to npm:
|
|
|
11
11
|
```bash
|
|
12
12
|
npm install -g llm-wiki-kit
|
|
13
13
|
llm-wiki install --workspace /apps --profile standard
|
|
14
|
-
llm-wiki doctor
|
|
14
|
+
llm-wiki doctor --workspace /apps
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
Restart Claude Code and Codex sessions after installation.
|
|
@@ -69,49 +69,46 @@ Use Claude Code or Codex normally.
|
|
|
69
69
|
|
|
70
70
|
The installed hooks:
|
|
71
71
|
|
|
72
|
-
- inject `wiki/memory.md`, `wiki/index.md`, and relevant wiki context at session start
|
|
72
|
+
- inject `wiki/memory.md`, `wiki/index.md`, and relevant wiki context at session start, instructions loaded, prompt submit, and post-compact time
|
|
73
73
|
- record redacted turn summaries
|
|
74
74
|
- capture decision points, debugging findings, changed files, and verification notes
|
|
75
75
|
- allow tool calls to proceed without secret/PII-based hook blocking
|
|
76
76
|
- update `llm-wiki/outputs/questions/YYYY-MM-DD-live-qa.md`
|
|
77
|
-
-
|
|
77
|
+
- capture reusable-answer candidates into `llm-wiki/wiki/queries/`
|
|
78
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
|
|
79
81
|
|
|
80
82
|
If you need to think about saving every answer manually, the setup has failed.
|
|
81
83
|
|
|
82
|
-
##
|
|
84
|
+
## Operational Commands
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
llm-wiki install --workspace /path/to/project --profile standard
|
|
86
|
-
llm-wiki doctor
|
|
87
|
-
llm-wiki version
|
|
88
|
-
llm-wiki status --workspace /path/to/project
|
|
89
|
-
llm-wiki projects --workspace /path/to/search-root
|
|
90
|
-
llm-wiki update --check --workspace /path/to/project
|
|
91
|
-
llm-wiki update --all --workspace /path/to/search-root
|
|
92
|
-
llm-wiki update --dry-run --workspace /path/to/project
|
|
93
|
-
llm-wiki update --workspace /path/to/project
|
|
94
|
-
llm-wiki context "search phrase" --workspace /path/to/project
|
|
95
|
-
llm-wiki lint --workspace /path/to/project
|
|
96
|
-
llm-wiki consolidate --workspace /path/to/project
|
|
97
|
-
llm-wiki uninstall
|
|
98
|
-
```
|
|
86
|
+
Most users should not need these during daily Claude Code/Codex work. They exist for install, update, diagnostics, and agent-side maintenance.
|
|
99
87
|
|
|
100
|
-
`llm-wiki
|
|
88
|
+
- Install/update: `llm-wiki install`, `llm-wiki update`, `llm-wiki post-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`
|
|
101
92
|
|
|
102
|
-
`llm-wiki
|
|
93
|
+
`llm-wiki status` is an offline consistency check. It reports the installed runtime version, hook targets, whether the `llm-wiki` command on `PATH` resolves to the current runtime, whether the current workspace has the current managed templates applied, how many rules are auto-updateable, and how many managed-looking rules need agent cleanup.
|
|
103
94
|
|
|
104
|
-
`llm-wiki update`
|
|
95
|
+
`llm-wiki update --check [--to <version-or-tag>]` is the online update check. It compares the installed package version with the npm registry target without changing files, and reports an available update only when the target version is newer than the installed version.
|
|
105
96
|
|
|
106
|
-
`llm-wiki
|
|
97
|
+
`llm-wiki update` upgrades the global npm package, reinstalls the hook entries, and reapplies safe managed template updates across known project roots. Use `--current-only` when you intentionally want to update only the supplied workspace. Existing wiki content is not overwritten.
|
|
107
98
|
|
|
108
|
-
`llm-wiki
|
|
99
|
+
`llm-wiki post-update --workspace <project>` reapplies the current runtime's hook entries and safe managed template updates without running `npm install -g`. Use `post-update --all --workspace <search-root>` to reapply templates across discovered project roots.
|
|
109
100
|
|
|
110
|
-
`llm-wiki
|
|
101
|
+
`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.
|
|
111
102
|
|
|
112
|
-
`llm-wiki
|
|
103
|
+
`llm-wiki lint` checks wiki health and detects outdated managed rules from older kit versions. Agents may use it before/after meaningful wiki maintenance.
|
|
113
104
|
|
|
114
|
-
|
|
105
|
+
`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.
|
|
106
|
+
|
|
107
|
+
`llm-wiki projects --workspace /apps` lists project roots that already have `llm-wiki-kit` state or an older `llm-wiki/wiki/index.md`, and shows the update commands to run. `llm-wiki update --workspace /apps` updates the global runtime once, then reapplies managed templates across every known or discovered project root under `/apps`.
|
|
108
|
+
|
|
109
|
+
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.
|
|
110
|
+
|
|
111
|
+
`llm-wiki install` no longer creates a user-local `~/.local/bin/llm-wiki` shim when an npm/nvm global `llm-wiki` command already resolves to the current runtime. If an older kit-managed local shim is shadowing that npm command, install backs it up and removes it.
|
|
115
112
|
|
|
116
113
|
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:
|
|
117
114
|
|
|
@@ -123,10 +120,10 @@ llm-wiki version
|
|
|
123
120
|
llm-wiki status
|
|
124
121
|
```
|
|
125
122
|
|
|
126
|
-
If `which -a llm-wiki` shows a stale `~/.local/bin/llm-wiki` before the nvm/npm global binary, remove
|
|
123
|
+
If `which -a llm-wiki` shows a stale `~/.local/bin/llm-wiki` before the nvm/npm global binary, run install once so the kit can remove a managed shadowing shim or report an unmanaged one:
|
|
127
124
|
|
|
128
125
|
```bash
|
|
129
|
-
|
|
126
|
+
llm-wiki install --workspace /path/to/project --profile standard
|
|
130
127
|
hash -r
|
|
131
128
|
llm-wiki version
|
|
132
129
|
```
|
package/docs/concepts.md
CHANGED
|
@@ -16,10 +16,11 @@ The important behavior is a loop:
|
|
|
16
16
|
|
|
17
17
|
1. A Claude Code or Codex session starts.
|
|
18
18
|
2. `memory.md`, `index.md`, and relevant wiki context are injected automatically.
|
|
19
|
-
3. The user works normally.
|
|
19
|
+
3. The user works normally; no extra command loop is required.
|
|
20
20
|
4. Hooks gather redacted prompt/tool/result summaries.
|
|
21
|
-
5. At stop/session end,
|
|
22
|
-
6.
|
|
21
|
+
5. At stop/session end, hooks append redacted live Q&A and create query or decision candidates when the turn has enough captured context.
|
|
22
|
+
6. 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.
|
|
23
|
+
7. Future sessions start from the improved wiki instead of relying on long chat history.
|
|
23
24
|
|
|
24
25
|
The kit is a template/runtime repository. It must not centralize project wiki contents.
|
|
25
26
|
|
|
@@ -27,6 +28,8 @@ Runtime updates and project knowledge are separate:
|
|
|
27
28
|
|
|
28
29
|
- npm updates replace the runtime package and hook targets.
|
|
29
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.
|
|
30
33
|
- `memory.md` is created when missing, then treated as project-owned content.
|
|
31
34
|
- curated wiki pages remain project-owned content and are not overwritten by runtime updates.
|
|
32
35
|
|
|
@@ -35,5 +38,5 @@ The maintenance loop is intentionally layered:
|
|
|
35
38
|
- `memory.md`: short hot index for current durable facts.
|
|
36
39
|
- `index.md`: broad navigation map.
|
|
37
40
|
- MiniSearch + wikilinks: retrieval over the rest of `wiki/**/*.md`, with substring fallback when MiniSearch is not installed in a source checkout.
|
|
38
|
-
- `lint`: finds broken links, stale pages, duplicates, and
|
|
39
|
-
- `consolidate`: 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.
|
|
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.
|
|
@@ -38,15 +38,19 @@ Claude Code reads `CLAUDE.md`. For project compatibility, the kit creates a `CLA
|
|
|
38
38
|
|
|
39
39
|
when no project `CLAUDE.md` exists. Existing `CLAUDE.md` files are not overwritten.
|
|
40
40
|
|
|
41
|
-
The hook records redacted turn summaries but does not deny tool calls only because an input looks sensitive.
|
|
41
|
+
The hook records redacted turn summaries but does not deny tool calls only because an input looks sensitive. Hook payloads are stored as small redacted event envelopes rather than full transcripts, and context output is redacted field by field before it is returned to Claude Code.
|
|
42
42
|
|
|
43
|
-
At `SessionStart`/`InstructionsLoaded`, the hook injects `llm-wiki/wiki/memory.md`, `llm-wiki/wiki/index.md`, recent log context, and
|
|
43
|
+
At `SessionStart`/`InstructionsLoaded`, the hook first attempts a safe managed-template refresh, then injects `llm-wiki/wiki/memory.md`, `llm-wiki/wiki/index.md`, recent log context, operating rules, and any maintenance note for outdated or customized managed 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
|
+
|
|
45
|
+
`PostToolUse` and `PostToolBatch` record redacted tool summaries in the same turn buffer. `PreCompact` records a compaction note, and `PostCompact` records the note and returns fresh wiki context. `SubagentStop`, `Stop`, and `SessionEnd` append live Q&A and create `wiki/queries/` candidates when a captured question exists. A `wiki/decisions/` page is created only when the captured turn looks decision-like. `Stop` and `SessionEnd` clear the per-session turn buffer after recording; `SubagentStop` does not.
|
|
46
|
+
|
|
47
|
+
Set `LLM_WIKI_KIT_AUTO_PROJECT_UPDATE=0` only while diagnosing automatic managed-template refresh behavior.
|
|
44
48
|
|
|
45
49
|
After installation or update, run:
|
|
46
50
|
|
|
47
51
|
```bash
|
|
48
52
|
llm-wiki status --workspace /path/to/project
|
|
49
|
-
llm-wiki doctor
|
|
53
|
+
llm-wiki doctor --workspace /path/to/project
|
|
50
54
|
```
|
|
51
55
|
|
|
52
56
|
Restart Claude Code so it reloads hook settings.
|
|
@@ -29,17 +29,23 @@ Handled events:
|
|
|
29
29
|
|
|
30
30
|
Expected behavior:
|
|
31
31
|
|
|
32
|
-
- `SessionStart` injects `llm-wiki/wiki/memory.md`, `llm-wiki/wiki/index.md`, recent log context, and
|
|
32
|
+
- `SessionStart` first attempts a safe managed-template refresh, then injects `llm-wiki/wiki/memory.md`, `llm-wiki/wiki/index.md`, recent log context, operating rules, and any maintenance note for outdated or customized managed rules.
|
|
33
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
|
+
- `PreCompact` records a compaction note; `PostCompact` records the note and returns fresh wiki context.
|
|
37
|
+
- `SubagentStop` and `Stop` append live Q&A and create `wiki/queries/` candidates when a captured question exists. A `wiki/decisions/` page is created only when the captured turn looks decision-like.
|
|
38
|
+
- `Stop` clears the per-session turn buffer after recording. `SubagentStop` leaves the parent turn buffer available for the final stop event.
|
|
39
|
+
|
|
40
|
+
Hook payloads are stored as small redacted event envelopes rather than full transcripts. Context output is also redacted field by field before it is returned to Codex.
|
|
41
|
+
|
|
42
|
+
Set `LLM_WIKI_KIT_AUTO_PROJECT_UPDATE=0` only while diagnosing automatic managed-template refresh behavior.
|
|
37
43
|
|
|
38
44
|
Run these after install:
|
|
39
45
|
|
|
40
46
|
```bash
|
|
41
47
|
llm-wiki status --workspace /path/to/project
|
|
42
|
-
llm-wiki doctor
|
|
48
|
+
llm-wiki doctor --workspace /path/to/project
|
|
43
49
|
```
|
|
44
50
|
|
|
45
51
|
If Codex reports untrusted hooks, trust the hook through Codex's own trust flow or run a trusted automation profile that explicitly accepts the hook source. Restart Codex after hook installation or update.
|
package/docs/operations.md
CHANGED
|
@@ -41,7 +41,9 @@ Avoid mixing root-owned and user-local installs unless you intentionally choose
|
|
|
41
41
|
|
|
42
42
|
The installer:
|
|
43
43
|
|
|
44
|
-
-
|
|
44
|
+
- uses an npm/nvm global `llm-wiki` command when it already resolves to the current runtime
|
|
45
|
+
- removes an older kit-managed `~/.local/bin/llm-wiki` shim when it shadows that npm/nvm command
|
|
46
|
+
- creates a user-local shim only when no `PATH` command points at the current runtime, such as source checkout development or user-local fallback installs
|
|
45
47
|
- backs up existing Codex/Claude settings before editing
|
|
46
48
|
- merges hook entries without removing existing hooks
|
|
47
49
|
- bootstraps the workspace `llm-wiki/`
|
|
@@ -66,16 +68,21 @@ llm-wiki install --workspace /apps --profile standard
|
|
|
66
68
|
|
|
67
69
|
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.
|
|
68
70
|
|
|
69
|
-
##
|
|
71
|
+
## Maintainer And Agent Reference
|
|
72
|
+
|
|
73
|
+
Daily work should happen through Claude Code/Codex. These commands are for maintainer checks, troubleshooting, and agent-side maintenance.
|
|
70
74
|
|
|
71
75
|
```bash
|
|
72
76
|
llm-wiki version
|
|
73
77
|
llm-wiki status --workspace /path/to/project
|
|
78
|
+
llm-wiki doctor --workspace /path/to/project
|
|
74
79
|
llm-wiki projects --workspace /path/to/search-root
|
|
75
|
-
llm-wiki update --check --workspace /path/to/project
|
|
76
|
-
llm-wiki update --
|
|
80
|
+
llm-wiki update --check --workspace /path/to/project [--to <version-or-tag>]
|
|
81
|
+
llm-wiki update --workspace /path/to/search-root
|
|
82
|
+
llm-wiki update --current-only --workspace /path/to/project
|
|
77
83
|
llm-wiki update --dry-run --workspace /path/to/project
|
|
78
|
-
llm-wiki update --workspace /path/to/project
|
|
84
|
+
llm-wiki post-update --workspace /path/to/project
|
|
85
|
+
llm-wiki post-update --all --workspace /path/to/search-root
|
|
79
86
|
llm-wiki context "search phrase" --workspace /path/to/project
|
|
80
87
|
llm-wiki lint --workspace /path/to/project
|
|
81
88
|
llm-wiki consolidate --workspace /path/to/project
|
|
@@ -84,29 +91,35 @@ llm-wiki consolidate --workspace /path/to/project
|
|
|
84
91
|
`status` is offline and answers whether the local installation is internally consistent:
|
|
85
92
|
|
|
86
93
|
- runtime version and install source
|
|
94
|
+
- whether the `llm-wiki` command on `PATH` resolves to the current runtime
|
|
87
95
|
- Codex/Claude hook entries pointing at the current runtime
|
|
88
96
|
- project template state from `llm-wiki/.kit-state.json`
|
|
89
97
|
- current managed file hashes
|
|
98
|
+
- auto-updateable managed rules and managed-looking rules that need agent cleanup
|
|
90
99
|
|
|
91
|
-
`update --check` is online and asks npm
|
|
100
|
+
`update --check [--to <version-or-tag>]` is online and asks npm for the target version. It reports `update available` only when that registry target is newer than the installed version, so it does not suggest downgrades.
|
|
92
101
|
|
|
93
|
-
`projects --workspace <search-root>` lists discovered project roots that have `llm-wiki/.kit-state.json`, reports whether their managed templates are current, and prints the update commands for the search root.
|
|
102
|
+
`projects --workspace <search-root>` lists discovered project roots that have `llm-wiki/.kit-state.json` or an older `llm-wiki/wiki/index.md`, reports whether their managed templates are current, and prints the update commands for the search root.
|
|
94
103
|
|
|
95
104
|
`update` applies changes explicitly only when the user runs it:
|
|
96
105
|
|
|
97
106
|
- runs `npm install -g llm-wiki-kit@<target>`
|
|
98
107
|
- restarts into the updated binary for `post-update`
|
|
99
108
|
- reinstalls hook entries without duplicating them
|
|
100
|
-
- patches only managed project files
|
|
109
|
+
- patches only managed project files across known or discovered project roots
|
|
101
110
|
- backs up changed files under `~/.local/share/llm-wiki-kit/backups/`
|
|
102
111
|
|
|
103
|
-
`update --
|
|
112
|
+
By default, `update --workspace <search-root>` performs the npm runtime update once, then reapplies managed templates to every known or discovered project root under the search root. Use `update --current-only --workspace <project>` to limit template reapplication to one project.
|
|
113
|
+
|
|
114
|
+
`post-update --workspace <project>` skips npm installation and reapplies the current runtime's hook entries plus safe managed template updates. `post-update --all --workspace <search-root>` does the same template reapplication across discovered project roots.
|
|
104
115
|
|
|
105
|
-
After a plain `npm install -g llm-wiki-kit@latest`, existing hooks keep
|
|
116
|
+
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. `install` will avoid recreating a local shim when an npm/nvm command already points at the current runtime.
|
|
106
117
|
|
|
107
118
|
## Context And Wiki Maintenance
|
|
108
119
|
|
|
109
|
-
`llm-wiki context
|
|
120
|
+
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.
|
|
121
|
+
|
|
122
|
+
`llm-wiki context "<query>"` is the manual debug form of hook context injection. It reads:
|
|
110
123
|
|
|
111
124
|
- `llm-wiki/wiki/memory.md` as the short hot index
|
|
112
125
|
- `llm-wiki/wiki/index.md` as the navigation map
|
|
@@ -114,7 +127,7 @@ After a plain `npm install -g llm-wiki-kit@latest`, existing hooks keep pointing
|
|
|
114
127
|
- one-hop wikilink neighbors for the strongest matches
|
|
115
128
|
- redacted output fields for query text, memory/index/log excerpts, hit paths, titles, snippets, matched terms, and link expansion metadata
|
|
116
129
|
|
|
117
|
-
Use it when you want to inspect what the next agent turn should see:
|
|
130
|
+
Use it only when you want to inspect what the next agent turn should see:
|
|
118
131
|
|
|
119
132
|
```bash
|
|
120
133
|
llm-wiki context "auth architecture" --workspace /path/to/project
|
|
@@ -133,6 +146,7 @@ llm-wiki context "auth architecture" --workspace /path/to/project --limit 8 --no
|
|
|
133
146
|
- secret-like content patterns such as tokens, password assignments, bearer credentials, and private keys
|
|
134
147
|
- duplicate aliases or titles
|
|
135
148
|
- stale pages and orphan candidates
|
|
149
|
+
- outdated managed rules/templates from earlier `llm-wiki-kit` versions
|
|
136
150
|
|
|
137
151
|
Broken links, invalid source IDs, and secret-like content are errors and return exit code 1. Metadata and discoverability gaps are warnings.
|
|
138
152
|
|
|
@@ -146,7 +160,9 @@ Broken links, invalid source IDs, and secret-like content are errors and return
|
|
|
146
160
|
- appends a log entry when files change
|
|
147
161
|
- supports `--dry-run`
|
|
148
162
|
|
|
149
|
-
|
|
163
|
+
Agents may run `consolidate` after meaningful wiki growth. Users should not need to run it after every turn.
|
|
164
|
+
|
|
165
|
+
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. Set `LLM_WIKI_KIT_AUTO_PROJECT_UPDATE=0` only while diagnosing automatic template refresh behavior.
|
|
150
166
|
|
|
151
167
|
## Updating User-Local Or nvm Installs
|
|
152
168
|
|
|
@@ -167,10 +183,10 @@ npm root -g
|
|
|
167
183
|
node "$(npm root -g)/llm-wiki-kit/bin/llm-wiki.js" version
|
|
168
184
|
```
|
|
169
185
|
|
|
170
|
-
When `which -a llm-wiki` shows `~/.local/bin/llm-wiki` before the nvm global binary,
|
|
186
|
+
When `which -a llm-wiki` shows `~/.local/bin/llm-wiki` before the nvm global binary, run install once. The kit removes an older managed shadowing shim when the npm/nvm command already points at the current runtime, and reports unmanaged local commands through `status`/`doctor`.
|
|
171
187
|
|
|
172
188
|
```bash
|
|
173
|
-
|
|
189
|
+
llm-wiki install --workspace /path/to/project --profile standard
|
|
174
190
|
hash -r
|
|
175
191
|
llm-wiki version
|
|
176
192
|
```
|
|
@@ -188,8 +204,10 @@ npm uninstall -g llm-wiki-kit
|
|
|
188
204
|
Managed project files are conservative:
|
|
189
205
|
|
|
190
206
|
- root `AGENTS.md` is patched only inside the `llm-wiki-kit` marker block
|
|
191
|
-
- `llm-wiki/AGENTS.md` is replaced only when its recorded hash still matches
|
|
192
|
-
- generated procedures are replaced only when their recorded hash still matches
|
|
207
|
+
- `llm-wiki/AGENTS.md` is replaced only when its recorded hash still matches, the whole file exactly matches the current generated template, or the whole file exactly matches a known legacy generated template
|
|
208
|
+
- generated procedures are replaced only when their recorded hash still matches, the whole file exactly matches the current generated template, or the whole file exactly matches a known legacy generated template
|
|
209
|
+
- missing generated `llm-wiki/AGENTS.md` and procedure files are restored when the project wiki tree exists
|
|
210
|
+
- customized managed-looking files and malformed root policy markers are not overwritten; `status`, `lint`, and injected maintenance context surface them for agent cleanup
|
|
193
211
|
- `llm-wiki/wiki/memory.md` is created if missing but never overwritten by template update once it exists
|
|
194
212
|
- `llm-wiki/wiki/index.md` and existing wiki pages are not overwritten by runtime update; `llm-wiki consolidate` updates only its generated marker block
|
|
195
213
|
|
|
@@ -213,7 +231,7 @@ npm view llm-wiki-kit version
|
|
|
213
231
|
npm install -g llm-wiki-kit
|
|
214
232
|
llm-wiki install --workspace /apps --profile standard
|
|
215
233
|
llm-wiki status --workspace /apps
|
|
216
|
-
llm-wiki doctor
|
|
234
|
+
llm-wiki doctor --workspace /apps
|
|
217
235
|
llm-wiki update --check --workspace /apps
|
|
218
236
|
```
|
|
219
237
|
|
|
@@ -18,3 +18,5 @@ Important conclusions:
|
|
|
18
18
|
- Obsidian, Graphify, MCP, and RAG can be useful extensions, but v1 must work with plain Markdown and hooks.
|
|
19
19
|
- Retrieval should combine lexical search with explicit Markdown links before adding heavier external infrastructure.
|
|
20
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/troubleshooting.md
CHANGED
|
@@ -5,12 +5,21 @@
|
|
|
5
5
|
Run:
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
llm-wiki doctor
|
|
9
|
-
llm-wiki status
|
|
8
|
+
llm-wiki doctor --workspace /path/to/project
|
|
9
|
+
llm-wiki status --workspace /path/to/project
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
Then restart Claude Code or Codex.
|
|
13
13
|
|
|
14
|
+
`doctor` and `status` report whether hooks point at the current runtime, whether the `llm-wiki` command on `PATH` resolves to that runtime, and whether project managed templates are current. If hooks or shims point at a source checkout or stale path, run one of these once:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
llm-wiki post-update --workspace /path/to/project
|
|
18
|
+
llm-wiki install --workspace /path/to/project --profile standard
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Use `LLM_WIKI_KIT_AUTO_PROJECT_UPDATE=0` only while diagnosing automatic managed-template refresh behavior.
|
|
22
|
+
|
|
14
23
|
## Is An Update Available?
|
|
15
24
|
|
|
16
25
|
Use the offline check first:
|
|
@@ -85,30 +94,30 @@ npm root -g
|
|
|
85
94
|
node "$(npm root -g)/llm-wiki-kit/bin/llm-wiki.js" version
|
|
86
95
|
```
|
|
87
96
|
|
|
88
|
-
If the direct `node "$(npm root -g)/llm-wiki-kit/bin/llm-wiki.js" version` command prints the latest version but plain `llm-wiki` is old,
|
|
97
|
+
If the direct `node "$(npm root -g)/llm-wiki-kit/bin/llm-wiki.js" version` command prints the latest version but plain `llm-wiki` is old, reconnect through the installer:
|
|
89
98
|
|
|
90
99
|
```bash
|
|
91
|
-
|
|
92
|
-
ln -sfn "$(npm root -g)/llm-wiki-kit/bin/llm-wiki.js" "$HOME/.local/bin/llm-wiki"
|
|
93
|
-
export PATH="$HOME/.local/bin:$PATH"
|
|
100
|
+
llm-wiki install --workspace /path/to/project --profile standard
|
|
94
101
|
hash -r
|
|
95
|
-
llm-wiki status
|
|
102
|
+
llm-wiki status --workspace /path/to/project
|
|
96
103
|
```
|
|
97
104
|
|
|
98
105
|
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
106
|
|
|
100
|
-
|
|
107
|
+
Running `llm-wiki post-update --workspace /path/to/project` or `llm-wiki install --workspace /path/to/project --profile standard` also reconnects hook entries to the current runtime. `install` uses an npm/nvm global command when it already resolves to the current runtime, removes an older kit-managed local shim when it shadows that command, and creates a local shim only when no `PATH` command points at the current runtime.
|
|
108
|
+
|
|
109
|
+
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`. Let install handle managed shims first:
|
|
101
110
|
|
|
102
111
|
```bash
|
|
103
|
-
|
|
112
|
+
llm-wiki install --workspace /path/to/project --profile standard
|
|
104
113
|
hash -r
|
|
105
114
|
which -a llm-wiki
|
|
106
115
|
readlink -f "$(command -v llm-wiki)"
|
|
107
116
|
llm-wiki version
|
|
108
|
-
llm-wiki status
|
|
117
|
+
llm-wiki status --workspace /path/to/project
|
|
109
118
|
```
|
|
110
119
|
|
|
111
|
-
Do not remove the entire `~/.local/bin` directory; it may contain unrelated commands. If
|
|
120
|
+
Do not remove the entire `~/.local/bin` directory; it may contain unrelated commands. If `status` or `doctor` reports an unmanaged local command that still shadows npm, inspect that one file before removing it. If the nvm command is missing, reinstall the package in the active nvm Node version:
|
|
112
121
|
|
|
113
122
|
```bash
|
|
114
123
|
npm uninstall -g llm-wiki-kit
|
|
@@ -170,6 +179,8 @@ Check:
|
|
|
170
179
|
|
|
171
180
|
The hook does not block tool calls only because inputs look sensitive. Durable summaries redact authentication values before writing, while ordinary work context such as dates, phone numbers, emails, and business identifiers is preserved by default.
|
|
172
181
|
|
|
182
|
+
Hook payloads are stored as small redacted event envelopes rather than full transcripts. Manual and hook context output is redacted before wiki excerpts or search hits are returned.
|
|
183
|
+
|
|
173
184
|
## Duplicate Pages Appear
|
|
174
185
|
|
|
175
186
|
Run a manual review:
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import { handleHook } from './hook.js';
|
|
|
4
4
|
import { install, status, uninstall } from './install.js';
|
|
5
5
|
import { bootstrapProject } from './project.js';
|
|
6
6
|
import { inspectProjectState } from './project-state.js';
|
|
7
|
-
import { commandForProject, knownProjectRoots } from './projects.js';
|
|
7
|
+
import { commandForProject, knownProjectRoots, recordProject } from './projects.js';
|
|
8
8
|
import { formatDoctor, runDoctor } from './doctor.js';
|
|
9
9
|
import { migrate } from './migrate.js';
|
|
10
10
|
import { postUpdate, update } from './update.js';
|
|
@@ -54,6 +54,8 @@ function parseOptions(args) {
|
|
|
54
54
|
options.replaceHooks = true;
|
|
55
55
|
} else if (arg === '--all') {
|
|
56
56
|
options.all = true;
|
|
57
|
+
} else if (arg === '--current-only') {
|
|
58
|
+
options.currentOnly = true;
|
|
57
59
|
} else if (arg === '--json') {
|
|
58
60
|
options.json = true;
|
|
59
61
|
} else {
|
|
@@ -82,8 +84,9 @@ export async function runCli(args) {
|
|
|
82
84
|
|
|
83
85
|
Usage:
|
|
84
86
|
llm-wiki install --workspace /apps [--profile standard]
|
|
85
|
-
llm-wiki update --workspace <project> [--check|--dry-run|--to <version-or-tag>]
|
|
86
|
-
llm-wiki
|
|
87
|
+
llm-wiki update --workspace <project-or-search-root> [--check|--dry-run|--current-only|--to <version-or-tag>]
|
|
88
|
+
llm-wiki post-update --workspace <project> [--all]
|
|
89
|
+
llm-wiki doctor --workspace <project>
|
|
87
90
|
llm-wiki projects --workspace /apps
|
|
88
91
|
llm-wiki status
|
|
89
92
|
llm-wiki version
|
|
@@ -104,7 +107,9 @@ Usage:
|
|
|
104
107
|
printJsonOrText(result, options, (value) => [
|
|
105
108
|
'llm-wiki-kit installed',
|
|
106
109
|
`- workspace: ${value.workspace}`,
|
|
107
|
-
`- bin: ${value.
|
|
110
|
+
`- runtime bin: ${value.binPath}`,
|
|
111
|
+
`- command: ${value.commandPath || 'not found on PATH'}`,
|
|
112
|
+
`- local shim: ${value.localBin} (${value.localBinAction})`,
|
|
108
113
|
`- changed hooks: ${value.changed.length ? value.changed.join(', ') : 'none (already installed)'}`,
|
|
109
114
|
'Restart Codex/Claude Code sessions so new hooks are loaded.',
|
|
110
115
|
].join('\n'));
|
|
@@ -149,7 +154,7 @@ Usage:
|
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
if (command === 'doctor') {
|
|
152
|
-
const result = await runDoctor();
|
|
157
|
+
const result = await runDoctor(options);
|
|
153
158
|
printJsonOrText(result, options, formatDoctor);
|
|
154
159
|
if (!result.ok) process.exitCode = 1;
|
|
155
160
|
return;
|
|
@@ -157,7 +162,9 @@ Usage:
|
|
|
157
162
|
|
|
158
163
|
if (command === 'bootstrap') {
|
|
159
164
|
const projectRoot = resolve(options.workspace || process.cwd());
|
|
160
|
-
|
|
165
|
+
const result = await bootstrapProject(projectRoot, options);
|
|
166
|
+
await recordProject(projectRoot, 'bootstrap').catch(() => {});
|
|
167
|
+
printJsonOrText(result, options);
|
|
161
168
|
return;
|
|
162
169
|
}
|
|
163
170
|
|
|
@@ -223,6 +230,8 @@ async function listProjects(options) {
|
|
|
223
230
|
|
|
224
231
|
function formatStatus(value) {
|
|
225
232
|
const project = value.project || {};
|
|
233
|
+
const autoUpdateCount = (project.managedFiles || []).filter((file) => !file.current && file.patchable).length;
|
|
234
|
+
const attentionCount = (project.managedFiles || []).filter((file) => file.needsAttention).length;
|
|
226
235
|
return [
|
|
227
236
|
'llm-wiki-kit status',
|
|
228
237
|
`- version: ${value.runtimeVersion}`,
|
|
@@ -230,11 +239,14 @@ function formatStatus(value) {
|
|
|
230
239
|
`- bin: ${value.binPath}`,
|
|
231
240
|
`- command: ${value.commandPath || 'not found'}`,
|
|
232
241
|
`- command matches runtime: ${value.commandMatchesRuntime ? 'yes' : 'no'}`,
|
|
242
|
+
`- local shim: ${value.localBin?.path || 'unknown'} (${value.localBin?.exists ? (value.localBin.managed ? 'managed' : 'unmanaged') : 'absent'}${value.localBin?.matchesRuntime ? ', current' : ''})`,
|
|
233
243
|
`- hooks current: ${value.hooksCurrent ? 'yes' : 'no'}`,
|
|
234
244
|
`- codex hook: ${value.codexInstalled ? 'current' : 'missing/outdated'}`,
|
|
235
245
|
`- claude hook: ${value.claudeInstalled ? 'current' : 'missing/outdated'}`,
|
|
236
246
|
`- project applied runtime: ${project.lastRuntimeVersionApplied || 'unknown'}`,
|
|
237
247
|
`- project templates current: ${project.managedFilesCurrent ? 'yes' : 'no'}`,
|
|
248
|
+
`- project auto-updateable rules: ${autoUpdateCount}`,
|
|
249
|
+
`- project rules needing agent cleanup: ${attentionCount}`,
|
|
238
250
|
].join('\n');
|
|
239
251
|
}
|
|
240
252
|
|
|
@@ -249,13 +261,22 @@ function formatUpdate(value) {
|
|
|
249
261
|
].join('\n');
|
|
250
262
|
}
|
|
251
263
|
if (value.mode === 'dry-run') {
|
|
264
|
+
const projects = Array.isArray(value.projects) ? value.projects : [];
|
|
265
|
+
const changed = projects.length > 0
|
|
266
|
+
? projects.reduce((sum, item) => sum + (item.project?.changed?.length || 0), 0)
|
|
267
|
+
: (value.project?.changed?.length || 0);
|
|
268
|
+
const skipped = projects.length > 0
|
|
269
|
+
? projects.reduce((sum, item) => sum + (item.project?.skipped?.length || 0), 0)
|
|
270
|
+
: (value.project?.skipped?.length || 0);
|
|
252
271
|
return [
|
|
253
272
|
'llm-wiki-kit update dry-run',
|
|
254
273
|
`- installed: ${value.installedVersion}`,
|
|
255
274
|
`- latest: ${value.latestVersion}`,
|
|
256
275
|
`- update available: ${value.updateAvailable ? 'yes' : 'no'}`,
|
|
257
|
-
`-
|
|
258
|
-
`-
|
|
276
|
+
`- scope: ${value.scope || 'current'}`,
|
|
277
|
+
...(projects.length > 0 ? [`- projects checked: ${projects.length}`] : []),
|
|
278
|
+
`- project template changes: ${changed}`,
|
|
279
|
+
`- project template skipped: ${skipped}`,
|
|
259
280
|
].join('\n');
|
|
260
281
|
}
|
|
261
282
|
return [
|
|
@@ -263,6 +284,7 @@ function formatUpdate(value) {
|
|
|
263
284
|
`- workspace: ${value.workspace}`,
|
|
264
285
|
`- before: ${value.before}`,
|
|
265
286
|
`- target: ${value.target}`,
|
|
287
|
+
`- scope: ${value.scope || 'current'}`,
|
|
266
288
|
...(value.projects ? [`- projects updated: ${value.projects.length}`] : []),
|
|
267
289
|
].join('\n');
|
|
268
290
|
}
|
|
@@ -300,7 +322,8 @@ function formatProjects(value) {
|
|
|
300
322
|
lines.push(`- ${project.workspace}: ${status}`);
|
|
301
323
|
}
|
|
302
324
|
}
|
|
303
|
-
lines.push('', 'To update every listed project root:', commandForProject('update
|
|
325
|
+
lines.push('', 'To update every listed project root:', commandForProject('update', value.workspace));
|
|
326
|
+
lines.push('To update only the current project root:', commandForProject('update --current-only', value.workspace));
|
|
304
327
|
lines.push('To reapply templates without npm install:', commandForProject('post-update --all', value.workspace));
|
|
305
328
|
return lines.join('\n');
|
|
306
329
|
}
|