opencode-skills-collection 4.0.34 → 4.0.36
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/bundled-skills/.antigravity-install-manifest.json +7 -1
- package/bundled-skills/agent-evaluation-reporting/SKILL.md +136 -0
- package/bundled-skills/anti-ui-slop/SKILL.md +115 -0
- package/bundled-skills/cross-platform-contract-propagation-audit/SKILL.md +159 -0
- package/bundled-skills/docs/integrations/jetski-cortex.md +3 -3
- package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +1 -1
- package/bundled-skills/docs/maintainers/repo-growth-seo.md +1 -1
- package/bundled-skills/docs/maintainers/skills-update-guide.md +1 -1
- package/bundled-skills/docs/users/aas-core.md +1 -1
- package/bundled-skills/docs/users/bundles.md +1 -1
- package/bundled-skills/docs/users/claude-code-skills.md +1 -1
- package/bundled-skills/docs/users/gemini-cli-skills.md +1 -1
- package/bundled-skills/docs/users/kiro-integration.md +1 -1
- package/bundled-skills/docs/users/usage.md +3 -3
- package/bundled-skills/docs/users/visual-guide.md +4 -4
- package/bundled-skills/dsh-deepread/SKILL.md +200 -0
- package/bundled-skills/liuguang-banlan-ui/SKILL.md +135 -0
- package/bundled-skills/liuguang-banlan-ui/assets/starter/favicon.svg +4 -0
- package/bundled-skills/liuguang-banlan-ui/assets/starter/index.html +32 -0
- package/bundled-skills/liuguang-banlan-ui/assets/starter/launcher.css +25 -0
- package/bundled-skills/liuguang-banlan-ui/assets/starter/obsidian/index.html +179 -0
- package/bundled-skills/liuguang-banlan-ui/assets/starter/obsidian/theme-config.js +105 -0
- package/bundled-skills/liuguang-banlan-ui/assets/starter/obsidian/theme.css +107 -0
- package/bundled-skills/liuguang-banlan-ui/assets/starter/opal/index.html +179 -0
- package/bundled-skills/liuguang-banlan-ui/assets/starter/opal/theme-config.js +105 -0
- package/bundled-skills/liuguang-banlan-ui/assets/starter/opal/theme.css +107 -0
- package/bundled-skills/liuguang-banlan-ui/assets/starter/shared/base.css +423 -0
- package/bundled-skills/liuguang-banlan-ui/assets/starter/shared/spectral-field.js +450 -0
- package/bundled-skills/liuguang-banlan-ui/assets/starter/shared/workbench.js +255 -0
- package/bundled-skills/liuguang-banlan-ui/references/style-contract.md +53 -0
- package/bundled-skills/liuguang-banlan-ui/references/verification.md +70 -0
- package/bundled-skills/liuguang-banlan-ui/scripts/measure_preview.py +144 -0
- package/bundled-skills/liuguang-banlan-ui/scripts/requirements.txt +2 -0
- package/bundled-skills/liuguang-banlan-ui/scripts/scaffold_template.py +43 -0
- package/bundled-skills/liuguang-banlan-ui/scripts/validate_manifest.py +173 -0
- package/bundled-skills/using-lwc/LICENSE +201 -0
- package/bundled-skills/using-lwc/README.md +926 -0
- package/bundled-skills/using-lwc/README.zh-CN.md +836 -0
- package/bundled-skills/using-lwc/SKILL.md +156 -0
- package/bundled-skills/using-lwc/agents/openai.yaml +4 -0
- package/bundled-skills/using-lwc/assets/global-purpose.md +17 -0
- package/bundled-skills/using-lwc/assets/global-schema.md +28 -0
- package/bundled-skills/using-lwc/references/active-memory.md +81 -0
- package/bundled-skills/using-lwc/references/agent-onboarding.md +84 -0
- package/bundled-skills/using-lwc/references/code-graph.md +60 -0
- package/bundled-skills/using-lwc/references/core-memory.md +51 -0
- package/bundled-skills/using-lwc/references/document-conversion.md +53 -0
- package/bundled-skills/using-lwc/references/document-graph.md +58 -0
- package/bundled-skills/using-lwc/references/llm-wiki.md +75 -0
- package/bundled-skills/using-lwc/references/memory-policy.md +551 -0
- package/bundled-skills/using-lwc/references/operations-manual.md +503 -0
- package/bundled-skills/using-lwc/references/recovery-maintenance.md +53 -0
- package/bundled-skills/using-lwc/references/strong-context.md +54 -0
- package/bundled-skills/using-lwc/references/trigger-playbook.md +53 -0
- package/bundled-skills/using-lwc/references/word-graph.md +45 -0
- package/bundled-skills/using-lwc/scripts/bootstrap.sh +359 -0
- package/bundled-skills/using-lwc/scripts/install-lwc.sh +172 -0
- package/package.json +1 -1
- package/skills_index.json +189 -0
|
@@ -0,0 +1,926 @@
|
|
|
1
|
+
<h1 align="center">LWC — Proactive Memory for AI Agents</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Agent-driven · Persistent · Source-grounded</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/@i-xor/lwc"><img alt="npm: @i-xor/lwc" src="https://img.shields.io/badge/npm-%40i--xor%2Flwc-CB3837?logo=npm"></a>
|
|
9
|
+
<a href="https://crates.io/crates/lwc"><img alt="crates.io: lwc" src="https://img.shields.io/crates/v/lwc.svg"></a>
|
|
10
|
+
<img alt="Node.js 22 or newer" src="https://img.shields.io/badge/node-%3E%3D22-5FA04E?logo=nodedotjs">
|
|
11
|
+
<img alt="Platform: macOS, Linux, Windows" src="https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-666666">
|
|
12
|
+
<a href="https://github.com/JanYork/llm-wiki-cli/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/JanYork/llm-wiki-cli/actions/workflows/ci.yml/badge.svg"></a>
|
|
13
|
+
<a href="https://skills.sh/janyork/llm-wiki-cli/using-lwc"><img alt="skills.sh: using-lwc" src="https://img.shields.io/badge/skills.sh-using--lwc-000000?logo=vercel"></a>
|
|
14
|
+
<a href="LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-blue.svg"></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<a href="README.md">English</a> · <a href="README.zh-CN.md">简体中文</a>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p align="center">
|
|
22
|
+
<img src="https://raw.githubusercontent.com/JanYork/llm-wiki-cli/main/docs/images/lwc-social-preview.png" alt="LWC — Proactive Memory for AI Agents" width="100%">
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
`lwc` is an agent-driven proactive memory CLI for AI agents. It lets Agents
|
|
26
|
+
autonomously recall, maintain, and evolve persistent, source-grounded knowledge
|
|
27
|
+
across sessions.
|
|
28
|
+
|
|
29
|
+
**Works with Claude Code, Codex, Cursor, OpenCode, Gemini CLI, Kiro, Hermes,
|
|
30
|
+
Antigravity, and pi.**
|
|
31
|
+
|
|
32
|
+
LWC turns curated documents into a durable Wiki. Agents reason and synthesize;
|
|
33
|
+
`lwc` preserves sources, pages, citations, links, indexes, and history so
|
|
34
|
+
knowledge compounds instead of being rediscovered from raw chunks on every
|
|
35
|
+
query.
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
<img src="https://raw.githubusercontent.com/JanYork/llm-wiki-cli/main/docs/images/lwc-overview-en.png" alt="LWC product overview" width="820">
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
## LWC Is Agent Memory, Not RAG
|
|
42
|
+
|
|
43
|
+
RAG and LWC can both help an LLM work with external documents, but they keep
|
|
44
|
+
state in different places. A typical RAG request retrieves raw chunks and builds
|
|
45
|
+
one answer at query time:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
query -> retrieve chunks -> generate answer
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
LWC keeps the useful work between requests:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
task -> recall maintained Wiki -> reason from sources and prior synthesis
|
|
55
|
+
-> write durable improvements back
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Retrieval is one operation inside LWC, not its organizing principle. The durable
|
|
59
|
+
artifact is a source-grounded Wiki whose pages, citations, links,
|
|
60
|
+
contradictions, and history are revised as knowledge changes. LWC therefore
|
|
61
|
+
does not require embeddings or a vector database, and it does not discard each
|
|
62
|
+
synthesis after answering. It can complement RAG, but it is not query-time RAG.
|
|
63
|
+
|
|
64
|
+
<p align="center">
|
|
65
|
+
<img src="https://raw.githubusercontent.com/JanYork/llm-wiki-cli/main/docs/images/lwc-source-grounding-en.png" alt="LWC source grounding and traceability" width="820">
|
|
66
|
+
</p>
|
|
67
|
+
|
|
68
|
+
### The Agent operates LWC
|
|
69
|
+
|
|
70
|
+
`lwc` is a machine interface for Agents, not a human-facing note-taking app. In
|
|
71
|
+
normal use, a human selects sources, states goals, asks questions, and reviews
|
|
72
|
+
answers or the projected Markdown. The Agent runs the CLI, manages scope,
|
|
73
|
+
integrates sources, maintains citations and links, and decides what is worth
|
|
74
|
+
recalling or writing back.
|
|
75
|
+
|
|
76
|
+
Do not manually drive the routine `lwc` workflow unless you are developing or
|
|
77
|
+
debugging the tool. Ask your Agent to activate the bundled canonical
|
|
78
|
+
`using-lwc` Skill instead—usually as `$using-lwc`.
|
|
79
|
+
|
|
80
|
+
## Recommended: Ask Your Agent to Set Up LWC
|
|
81
|
+
|
|
82
|
+
Paste this prompt into the Agent you use. It installs the global CLI, delegates
|
|
83
|
+
all supported host configuration to LWC's idempotent AgentTarget installer, and
|
|
84
|
+
uses native self-configuration only for an unregistered Agent.
|
|
85
|
+
|
|
86
|
+
<details>
|
|
87
|
+
<summary><strong>Copy the complete setup prompt</strong></summary>
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
Configure LWC completely for this user. Perform and verify the work; do not
|
|
91
|
+
merely describe commands for me to run.
|
|
92
|
+
|
|
93
|
+
Source of truth:
|
|
94
|
+
- https://github.com/JanYork/llm-wiki-cli
|
|
95
|
+
- https://github.com/JanYork/llm-wiki-cli/tree/main/skills/using-lwc
|
|
96
|
+
|
|
97
|
+
Requirements:
|
|
98
|
+
1. Read this README, `SECURITY.md`, and `skills/using-lwc/SKILL.md`. Install the
|
|
99
|
+
official checksum-verified release if `lwc` is not globally callable; never
|
|
100
|
+
prefix routine commands with a private binary path or `LWC_PROJECT_ROOT`.
|
|
101
|
+
2. Run `lwc --version`, initialize global memory once with
|
|
102
|
+
`lwc --scope global init` when missing, then run `lwc agent install --yes`.
|
|
103
|
+
This command detects installed supported Agents and safely installs their
|
|
104
|
+
MCP, Skill, Hook and Instructions using official locations. Do not recreate
|
|
105
|
+
that logic manually or install a native package for the same Agent as well.
|
|
106
|
+
3. Inspect `lwc agent status --target all --location global`. Restart affected
|
|
107
|
+
Agents and complete their normal Hook trust review where required. Do not
|
|
108
|
+
initialize a project Wiki or either graph without explicit project consent.
|
|
109
|
+
4. If the current runtime is not one of LWC's registered AgentTargets, use its
|
|
110
|
+
official user-level conventions to install the canonical `using-lwc` Skill,
|
|
111
|
+
an additive instruction block, `lwc serve --mcp`, and a bounded session Hook
|
|
112
|
+
only where those surfaces are officially supported. Preserve existing
|
|
113
|
+
configuration, remain idempotent, and report unsupported surfaces instead of
|
|
114
|
+
inventing paths or keys.
|
|
115
|
+
|
|
116
|
+
Finish with the LWC version, detected and configured Targets, status results,
|
|
117
|
+
files changed, unsupported surfaces, and any restart or trust action remaining.
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
</details>
|
|
121
|
+
|
|
122
|
+
## Origin and Acknowledgements
|
|
123
|
+
|
|
124
|
+
`lwc` implements the [LLM Wiki](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)
|
|
125
|
+
pattern proposed by Andrej Karpathy: an LLM incrementally builds and maintains a
|
|
126
|
+
persistent, interlinked Wiki instead of reconstructing knowledge from raw
|
|
127
|
+
documents for every query. The CLI architecture and selected implementation
|
|
128
|
+
details also draw inspiration from
|
|
129
|
+
[`nashsu/llm_wiki`](https://github.com/nashsu/llm_wiki).
|
|
130
|
+
|
|
131
|
+
This project adapts those ideas into an agent-first Rust CLI backed by SQLite.
|
|
132
|
+
|
|
133
|
+
## Core Design
|
|
134
|
+
|
|
135
|
+
<p align="center">
|
|
136
|
+
<img src="https://raw.githubusercontent.com/JanYork/llm-wiki-cli/main/docs/images/lwc-architecture-en.png" alt="LWC architecture" width="100%">
|
|
137
|
+
</p>
|
|
138
|
+
|
|
139
|
+
The persistent knowledge model has three logical layers:
|
|
140
|
+
|
|
141
|
+
| Layer | Contents | Contract |
|
|
142
|
+
| --- | --- | --- |
|
|
143
|
+
| Raw sources | Immutable snapshots of curated input | Add through `source`; never rewrite source truth. |
|
|
144
|
+
| Wiki | Agent-maintained pages, citations, links, and provenance | Update through `page`; cite sources and classify durable non-source knowledge. |
|
|
145
|
+
| Schema and purpose | Maintenance rules and project intent | Guide every future ingest and revision. |
|
|
146
|
+
|
|
147
|
+
SQLite is canonical. The Markdown tree is a rebuildable projection for people
|
|
148
|
+
and tools such as Obsidian. Agents mutate knowledge through `lwc`, not by editing
|
|
149
|
+
`.lwc/wiki.db` or projected Markdown directly. Successful commands return JSON
|
|
150
|
+
on stdout; failures return structured JSON on stderr.
|
|
151
|
+
|
|
152
|
+
Read commands keep current-format stores read-only. When an older writable
|
|
153
|
+
store is opened by a newer CLI, its schema is migrated transactionally once
|
|
154
|
+
before the read proceeds.
|
|
155
|
+
|
|
156
|
+
## Hierarchical Recall and Knowledge Graph
|
|
157
|
+
|
|
158
|
+
Every current Source and Wiki page is deterministically indexed as passages and
|
|
159
|
+
sentences. SQLite remains authoritative; span FTS and an optional external
|
|
160
|
+
document graph are rebuilt indexes. Existing search stays document-only
|
|
161
|
+
unless a granularity is requested:
|
|
162
|
+
|
|
163
|
+
<p align="center">
|
|
164
|
+
<img src="https://raw.githubusercontent.com/JanYork/llm-wiki-cli/main/docs/images/lwc-memory-graph-en.png" alt="LWC memory graph" width="100%">
|
|
165
|
+
</p>
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
lwc search "projection consistency" --granularity sentence --type page
|
|
169
|
+
lwc search "projection consistency" --granularity passage
|
|
170
|
+
lwc search "projection consistency" --granularity all --group-by document
|
|
171
|
+
lwc span get <SPAN_ID>
|
|
172
|
+
lwc span expand <SPAN_ID> --before 1 --after 1 --children 20
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Span locators contain the document fingerprint and segmentation version. A
|
|
176
|
+
locator from a replaced body fails with `stale_span` and reports prior/current
|
|
177
|
+
metadata; LWC never silently remaps it to similar text.
|
|
178
|
+
|
|
179
|
+
Use the bounded, typed graph API for exploration without requiring keywords:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
lwc graph explore # representative macro view
|
|
183
|
+
lwc graph node page:projection-policy
|
|
184
|
+
lwc graph neighbors page:projection-policy --direction outgoing
|
|
185
|
+
lwc graph path page:implementation page:policy --max-depth 6
|
|
186
|
+
lwc graph impact page:policy --max-depth 4
|
|
187
|
+
lwc graph overview
|
|
188
|
+
lwc graph status
|
|
189
|
+
lwc graph verify
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Automatic edges are limited to structural/evidential facts. Semantic claims
|
|
193
|
+
must be explicit and auditable:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
lwc graph relation set page:implementation DEPENDS_ON page:policy \
|
|
197
|
+
--provenance source-grounded --source 12 \
|
|
198
|
+
--reason "Source 12 states the required policy" --confidence 0.95
|
|
199
|
+
lwc graph relation list --from page:implementation
|
|
200
|
+
lwc graph relation retract page:implementation DEPENDS_ON page:policy \
|
|
201
|
+
--reason "The dependency was superseded"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Relation reasons are durable content: never put credentials, secrets, or raw
|
|
205
|
+
chain-of-thought in them.
|
|
206
|
+
|
|
207
|
+
SQLite documents remain authoritative. Graph storage is disabled by default;
|
|
208
|
+
enable exactly one external engine when traversal is needed. Configuration is
|
|
209
|
+
layered from built-in defaults through global and project files:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
lwc config show
|
|
213
|
+
lwc config set --graph grafeo
|
|
214
|
+
lwc config set --graph surrealdb
|
|
215
|
+
lwc config set --graph disabled
|
|
216
|
+
lwc config unset --graph
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Markdown conversion is a separate opt-in operation. `lwc init` reports the
|
|
220
|
+
same machine-readable setup guidance, but never installs or enables a
|
|
221
|
+
converter. Install one adapter, select it explicitly, convert to a new local
|
|
222
|
+
Markdown file, review it, and only then ingest it:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
# Choose one adapter; both are disabled unless configured.
|
|
226
|
+
npm install --global @firecrawl/anydoc
|
|
227
|
+
lwc config set --trans anydoc
|
|
228
|
+
|
|
229
|
+
# Or:
|
|
230
|
+
python3 -m pip install 'markitdown[all]'
|
|
231
|
+
lwc config set --trans markitdown
|
|
232
|
+
|
|
233
|
+
lwc trans INPUT --output OUTPUT.md
|
|
234
|
+
lwc source add OUTPUT.md
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Configuration accepts `--trans-timeout 1..900` and repeated
|
|
238
|
+
`--trans-arg=<value>` options for the selected adapter. LWC invokes the fixed
|
|
239
|
+
adapter executable directly, never falls back to the other adapter, accepts
|
|
240
|
+
local files only, caps input and output at 64 MiB, and never overwrites an
|
|
241
|
+
existing output. Keep credentials in the adapter's environment rather than in
|
|
242
|
+
LWC configuration. See the official [Anydoc](https://github.com/firecrawl/anydoc)
|
|
243
|
+
and [MarkItDown](https://github.com/microsoft/markitdown) documentation for
|
|
244
|
+
supported formats and optional flags.
|
|
245
|
+
|
|
246
|
+
Grafeo and embedded SurrealDB use disposable sidecars under `.lwc/`. Each
|
|
247
|
+
`graph-project` Work commits one current Source/Page and its owned links,
|
|
248
|
+
citations, and explicit relations before starting the next document. Updates
|
|
249
|
+
and deletions enqueue only touched documents; rebuild and resume use the same
|
|
250
|
+
document units. Historical source revisions remain immutable and are never
|
|
251
|
+
re-tokenized or projected. Use `work list`, `work status`, or `work watch` to
|
|
252
|
+
observe progress and `work resume` after interruption. `graph status` reports
|
|
253
|
+
the selected engine and projected document count; `graph verify` compares its
|
|
254
|
+
current document keys with SQLite.
|
|
255
|
+
|
|
256
|
+
## Installation
|
|
257
|
+
|
|
258
|
+
Most users should use the Agent setup prompt above. The manual commands below
|
|
259
|
+
are for maintainers, debugging, or Agent environments that cannot install the
|
|
260
|
+
companion Skill.
|
|
261
|
+
|
|
262
|
+
Install with Homebrew (prebuilt bottles are available for Apple silicon macOS
|
|
263
|
+
and x86_64 Linux):
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
brew install JanYork/tap/lwc
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Install with npm (Node.js 22+):
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
npm install --global @i-xor/lwc
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Install from crates.io:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
cargo install --locked lwc
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Install from GitHub:
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
installer="$(mktemp)"
|
|
285
|
+
curl --proto '=https' --tlsv1.2 -fsSL \
|
|
286
|
+
https://github.com/JanYork/llm-wiki-cli/releases/download/v0.14.7/install.sh \
|
|
287
|
+
-o "$installer"
|
|
288
|
+
less "$installer" # inspect before execution
|
|
289
|
+
sh "$installer"
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
The installer supports x86_64/aarch64 macOS, glibc Linux, and Windows Git Bash,
|
|
293
|
+
verifies the release checksum, and installs or updates `lwc`.
|
|
294
|
+
It uses `~/.local/bin` by default, or updates an existing copy in
|
|
295
|
+
`~/.local/bin` or `~/.cargo/bin`. To choose another directory:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
installer="$(mktemp)"
|
|
299
|
+
curl --proto '=https' --tlsv1.2 -fsSL \
|
|
300
|
+
https://github.com/JanYork/llm-wiki-cli/releases/download/v0.14.7/install.sh \
|
|
301
|
+
-o "$installer"
|
|
302
|
+
less "$installer" # inspect before execution
|
|
303
|
+
LWC_INSTALL_DIR="$HOME/bin" sh "$installer"
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Alternatively, build and install from GitHub with Cargo:
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
cargo install --locked --git https://github.com/JanYork/llm-wiki-cli
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Or install a local checkout:
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
git clone https://github.com/JanYork/llm-wiki-cli.git
|
|
316
|
+
cd llm-wiki-cli
|
|
317
|
+
cargo install --locked --path .
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
## Companion Agent Skill
|
|
321
|
+
|
|
322
|
+
The repository includes [`skills/using-lwc`](https://github.com/JanYork/llm-wiki-cli/blob/main/skills/using-lwc), an Agent Skill
|
|
323
|
+
that makes `lwc` a proactive memory layer for substantive sessions. Install it
|
|
324
|
+
from [skills.sh](https://skills.sh/JanYork/llm-wiki-cli):
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
npx skills add JanYork/llm-wiki-cli --skill using-lwc -g
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
Or copy it from a local checkout into the current Agent runtime's user-level
|
|
331
|
+
Skills directory. For Codex:
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
mkdir -p "$HOME/.agents/skills"
|
|
335
|
+
cp -R skills/using-lwc "$HOME/.agents/skills/"
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
The canonical invocation is `$using-lwc`.
|
|
339
|
+
|
|
340
|
+
When triggered, the Skill:
|
|
341
|
+
|
|
342
|
+
- finds a compatible CLI and reports when an explicitly approved,
|
|
343
|
+
checksum-verified installation is required;
|
|
344
|
+
- reports missing global memory and initializes it only after explicit approval;
|
|
345
|
+
- recalls bounded global and project context before repeated investigation;
|
|
346
|
+
- initializes the active project on explicit invocation, otherwise asks first;
|
|
347
|
+
- refuses project writes outside the current authorized workspace root;
|
|
348
|
+
- separates project facts from reusable global knowledge;
|
|
349
|
+
- integrates sources and writes durable answers back into the Wiki.
|
|
350
|
+
|
|
351
|
+
`SKILL.md` is a short router rather than a monolithic manual. It links one
|
|
352
|
+
focused teaching document for basic memory, trigger timing, active memory,
|
|
353
|
+
physical document graph, bounded Word Graph, CodeGraph, strong tags, document
|
|
354
|
+
conversion, Agent onboarding, and recovery/maintenance. Each document states
|
|
355
|
+
when to use and skip the capability, its minimum workflow, consent boundary, and
|
|
356
|
+
completion evidence.
|
|
357
|
+
|
|
358
|
+
The Skill normally discovers the active project from the current directory and
|
|
359
|
+
invokes the globally installed `lwc` command directly. `LWC_PROJECT_ROOT` is an
|
|
360
|
+
explicit boundary for a deliberately targeted project, not a prefix to export
|
|
361
|
+
for routine commands in the project you are already working in.
|
|
362
|
+
|
|
363
|
+
Automatic CLI installation is disabled by default. After explicit approval,
|
|
364
|
+
set `LWC_AUTO_INSTALL=1` for one bootstrap command. The reviewed installer
|
|
365
|
+
bundled in the Skill pins LWC `v0.14.7` and verifies the downloaded archive
|
|
366
|
+
against a platform-specific SHA-256 reviewed into the script; the checksum is
|
|
367
|
+
integrity protection, not publisher code signing. Upgrades require a new review
|
|
368
|
+
and pin. Global initialization is likewise opt-in through a one-command
|
|
369
|
+
`LWC_GLOBAL_INIT=1` retry. Release binaries
|
|
370
|
+
cover x86_64/aarch64 macOS, glibc Linux, and Windows through Git Bash. `SKILL.md` follows the Agent Skills
|
|
371
|
+
resource layout, while
|
|
372
|
+
`agents/openai.yaml` supplies OpenAI/Codex metadata. The CLI itself is
|
|
373
|
+
runtime-neutral: any Agent that can execute it and load or adapt the Skill's
|
|
374
|
+
instructions can use LWC. Skill commands, global instructions, and Hooks remain
|
|
375
|
+
runtime-specific, so the setup prompt detects and configures the current host.
|
|
376
|
+
|
|
377
|
+
### Native Agent setup
|
|
378
|
+
|
|
379
|
+
LWC can detect supported Agents and install one unified read-only LWC MCP.
|
|
380
|
+
All 12 registered AgentTargets are strong adapters: each installs every
|
|
381
|
+
official file-based MCP, Skill, Hook, and Instructions surface available for
|
|
382
|
+
that host and scope, while UI-owned, preview, or unsupported surfaces are
|
|
383
|
+
reported explicitly.
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
lwc agent install --yes
|
|
387
|
+
lwc agent status --target all --location global
|
|
388
|
+
lwc agent install --print-config codex
|
|
389
|
+
lwc agent refresh --target codex,claude
|
|
390
|
+
lwc agent uninstall --target codex,claude --yes
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
`--yes` selects detected Agents, global scope, and each target's default
|
|
394
|
+
lifecycle/prompt Hooks. Use `--no-prompt-hook` to omit Claude's per-prompt Hook. The installed
|
|
395
|
+
entry is `lwc -> serve --mcp`; its single `lwc_explore`
|
|
396
|
+
tool defaults to bounded Wiki memory and accepts explicit `code`/`all` modes.
|
|
397
|
+
The requested `projectPath` must stay inside the workspace where the MCP host
|
|
398
|
+
started LWC. It never downloads or initializes CodeGraph. Repeated install and refresh are
|
|
399
|
+
byte-idempotent; uninstall restores only owned state and leaves project indexes
|
|
400
|
+
intact. Optional Codex, Claude Code, and Pi packages live under `integrations/`;
|
|
401
|
+
installing a package does not grant or bypass native trust. Do not combine the
|
|
402
|
+
direct installer and native package for the same Agent. Each native package
|
|
403
|
+
bundles the complete `using-lwc` Skill, so installation does not depend on a
|
|
404
|
+
third-party Skill manager or any maintainer-specific environment.
|
|
405
|
+
|
|
406
|
+
Pi exposes LWC MCP through its official extension bridge because Pi has no
|
|
407
|
+
built-in MCP. Other Targets register only `lwc serve --mcp`; CodeGraph stays an
|
|
408
|
+
internal LWC code-context plane and is never registered as a second Agent MCP.
|
|
409
|
+
Officially UI-owned trust and permission settings remain user-managed. Preview
|
|
410
|
+
surfaces are labeled as such, and partial project scopes install the supported
|
|
411
|
+
surfaces instead of weakening or rejecting the whole Target. Kiro global paths
|
|
412
|
+
honor `KIRO_HOME`.
|
|
413
|
+
|
|
414
|
+
The target interface, registry order, detection rules, and MCP paths follow
|
|
415
|
+
CodeGraph's MIT-licensed installer adapter design; LWC adds the unified LWC MCP,
|
|
416
|
+
per-surface capability reporting, Skills and Hooks, shared-file ownership, and
|
|
417
|
+
exact rollback.
|
|
418
|
+
See [`THIRD_PARTY_NOTICES.md`](https://github.com/JanYork/llm-wiki-cli/blob/main/THIRD_PARTY_NOTICES.md).
|
|
419
|
+
|
|
420
|
+
Fresh project `lwc init` output and session/compaction Hooks expose bounded
|
|
421
|
+
`LWC_READINESS` facts for the Wiki, physical document graph, CodeGraph runtime
|
|
422
|
+
and project index, plus Agent integration commands. Physical graph readiness
|
|
423
|
+
distinguishes configured consent from a pending or failed projection. Detection
|
|
424
|
+
is read-only and never enables or initializes a graph. When both graphs need
|
|
425
|
+
authorization, the portable baseline is plain text, so Agents without checkbox
|
|
426
|
+
support behave the same way:
|
|
427
|
+
|
|
428
|
+
```text
|
|
429
|
+
1. Enable physical document graph and CodeGraph (recommended)
|
|
430
|
+
2. Enable physical document graph only
|
|
431
|
+
3. Enable CodeGraph only
|
|
432
|
+
4. Later
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
After explicit choice `1`, the Agent initializes a missing project Wiki, enables
|
|
436
|
+
Grafeo, waits for and verifies its projection Work, initializes CodeGraph, and
|
|
437
|
+
checks both results independently. `Later` changes nothing and does not block
|
|
438
|
+
the primary task. Native plugins may render the same choice IDs with their own
|
|
439
|
+
UI, but checkbox support is never required.
|
|
440
|
+
|
|
441
|
+
Strong tags provide bounded full-page loading for core rules and runbooks:
|
|
442
|
+
|
|
443
|
+
```bash
|
|
444
|
+
lwc tag set "operations" incident-response --priority 100 --reason "primary runbook"
|
|
445
|
+
lwc load tag "operations" --limit 3
|
|
446
|
+
lwc tag autoload "operations" --enable --priority 100 --limit 3 \
|
|
447
|
+
--max-chars 50000 --reason "required at session boundaries"
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
This is an explicit strong-load mechanism, not token-derived search: limits and
|
|
451
|
+
character budgets are applied before complete pages enter Agent context.
|
|
452
|
+
|
|
453
|
+
## Quick Start
|
|
454
|
+
|
|
455
|
+
This section documents the CLI protocol that the Agent executes. Humans do not
|
|
456
|
+
need to run these commands during normal use.
|
|
457
|
+
|
|
458
|
+
### 1. Initialize a project Wiki
|
|
459
|
+
|
|
460
|
+
```bash
|
|
461
|
+
cd your-project
|
|
462
|
+
lwc init
|
|
463
|
+
printf '# Schema\nEvery page declares provenance; source-grounded claims cite sources.\n' | lwc schema set -
|
|
464
|
+
printf '# Purpose\nBuild a durable project Wiki.\n' | lwc purpose set -
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
Project initialization adds the project-relative `.lwc/` path to Git's local
|
|
468
|
+
`info/exclude` file when needed, without changing the repository `.gitignore`.
|
|
469
|
+
Use `lwc init --no-git-exclude` only when the Wiki is intentionally versioned.
|
|
470
|
+
|
|
471
|
+
### 2. Add source material
|
|
472
|
+
|
|
473
|
+
```bash
|
|
474
|
+
lwc source add-dir docs/
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
Files without an explicit title use their source origin as a stable,
|
|
478
|
+
human-readable fallback. Identical bytes are deduplicated by SHA-256.
|
|
479
|
+
Project sources that resolve outside the active Wiki root require
|
|
480
|
+
`--allow-external-source`. High-confidence credential markers are rejected
|
|
481
|
+
unless the reviewed source is explicitly acknowledged with
|
|
482
|
+
`--acknowledge-sensitive-source`.
|
|
483
|
+
|
|
484
|
+
Each successful add also records the observed file path and its current
|
|
485
|
+
immutable snapshot. Check only the sources relevant to the task before relying
|
|
486
|
+
on file-backed evidence:
|
|
487
|
+
|
|
488
|
+
```bash
|
|
489
|
+
lwc source status 7 12
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
The command streams each live file through SHA-256 and reports path lineage
|
|
493
|
+
(`current` or `superseded`) separately from filesystem state (`current`,
|
|
494
|
+
`modified`, `missing`, `unreadable`, `oversized`, or `unstable`). It is
|
|
495
|
+
read-only. Use `source status --all` only for explicit maintenance because its
|
|
496
|
+
cost is proportional to the bytes in all tracked files. Inspect a modified path
|
|
497
|
+
before updating knowledge:
|
|
498
|
+
|
|
499
|
+
```bash
|
|
500
|
+
lwc source diff 7
|
|
501
|
+
lwc source refs 7 --limit 1000
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
`source diff` compares the immutable source with its live file, or with another
|
|
505
|
+
snapshot via `--to-source`. It returns a bounded unified diff: at most 8 MiB and
|
|
506
|
+
200,000 lines per side, 20,000 Unicode output characters by default, and
|
|
507
|
+
100,000 with `--max-chars`. If one source was observed at multiple paths, select
|
|
508
|
+
an exact `--path`. A truncated diff is only a preview. `source refs` lists
|
|
509
|
+
directly citing review candidates; it does not prove which pages are
|
|
510
|
+
semantically affected. Re-run `source add` only after review when the same path
|
|
511
|
+
contains a meaningful new revision. An A -> B -> A sequence remains three path
|
|
512
|
+
observations even though content A reuses its original source ID. External live
|
|
513
|
+
paths require `--allow-external-source` again; flagged live text also requires
|
|
514
|
+
`--acknowledge-sensitive-source` after inspection.
|
|
515
|
+
|
|
516
|
+
Sources migrated from older stores remain explicitly untracked because LWC does
|
|
517
|
+
not guess historical paths; re-add the intended file once to establish its
|
|
518
|
+
first tracked revision. If a file or path head changes during the check, LWC
|
|
519
|
+
returns `source_status_unstable`; retry instead of trusting a mixed-time result.
|
|
520
|
+
|
|
521
|
+
For a curated atomic import, paths in a JSON manifest resolve from the
|
|
522
|
+
manifest's directory:
|
|
523
|
+
|
|
524
|
+
```json
|
|
525
|
+
{
|
|
526
|
+
"sources": [
|
|
527
|
+
{"path": "ARCHITECTURE.md", "title": "Architecture contract"},
|
|
528
|
+
{"path": "src/store.rs", "title": "SQLite store"}
|
|
529
|
+
]
|
|
530
|
+
}
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
```bash
|
|
534
|
+
lwc source add-manifest lwc-sources.json
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### 3. Analyze and integrate one source
|
|
538
|
+
|
|
539
|
+
```bash
|
|
540
|
+
lwc ingest next --context-limit 50 --source-max-chars 100000
|
|
541
|
+
lwc ingest analyze 1 --file analysis.md
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
Use `lwc ingest claim 7` when a manifest or scheduler already selected an exact
|
|
545
|
+
pending source ID.
|
|
546
|
+
|
|
547
|
+
If `source_window.has_more` is true, continue reading from
|
|
548
|
+
`source_window.next_offset_chars`:
|
|
549
|
+
|
|
550
|
+
```bash
|
|
551
|
+
lwc source show 1 --offset-chars 100000 --max-chars 100000
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
Create a cited source-summary page and integrate its contribution into at least
|
|
555
|
+
one non-source page before completing the ingest task:
|
|
556
|
+
|
|
557
|
+
```bash
|
|
558
|
+
lwc page put source-1 \
|
|
559
|
+
--title "Source 1 Summary" \
|
|
560
|
+
--kind source \
|
|
561
|
+
--summary "What this source contributes" \
|
|
562
|
+
--file source-summary.md \
|
|
563
|
+
--source 1
|
|
564
|
+
|
|
565
|
+
lwc page put durable-concept \
|
|
566
|
+
--title "Durable Concept" \
|
|
567
|
+
--kind concept \
|
|
568
|
+
--summary "How this source changes shared knowledge" \
|
|
569
|
+
--file concept.md \
|
|
570
|
+
--source 1
|
|
571
|
+
|
|
572
|
+
lwc ingest complete 1
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
Both layers are required: the source page is a navigation and provenance aid;
|
|
576
|
+
the non-source page makes knowledge compound. If a source genuinely changes no
|
|
577
|
+
shared page, complete it with a specific audited explanation:
|
|
578
|
+
|
|
579
|
+
```bash
|
|
580
|
+
lwc ingest complete 1 \
|
|
581
|
+
--no-derived-pages-reason "Duplicate evidence; existing synthesis already covers every supported claim"
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
Source citations automatically expose `source-grounded` provenance. For
|
|
585
|
+
durable knowledge that comes from the user, an Agent observation, or an
|
|
586
|
+
explicit hypothesis, repeat `--provenance` as needed instead of inventing a
|
|
587
|
+
source:
|
|
588
|
+
|
|
589
|
+
```bash
|
|
590
|
+
lwc page put architecture-decision \
|
|
591
|
+
--title "Architecture decision" \
|
|
592
|
+
--kind query \
|
|
593
|
+
--summary "Accepted constraint and remaining uncertainty" \
|
|
594
|
+
--file decision.md \
|
|
595
|
+
--provenance user-provided \
|
|
596
|
+
--provenance hypothesis
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
`page put` replaces the complete citation and explicit-provenance sets. Read
|
|
600
|
+
the existing page first, then repeat every still-valid `--source` and
|
|
601
|
+
non-source `--provenance` value. Do not pass `source-grounded` explicitly; it is
|
|
602
|
+
derived from citations. Provenance is returned by page reads, context, search,
|
|
603
|
+
source references, and Markdown projection, but does not change search ranking.
|
|
604
|
+
|
|
605
|
+
### 4. Query the accumulated Wiki
|
|
606
|
+
|
|
607
|
+
```bash
|
|
608
|
+
lwc context --limit 50
|
|
609
|
+
lwc search "question keywords" --limit 20
|
|
610
|
+
lwc search "question keywords" --limit 20 --explain
|
|
611
|
+
lwc search "concept only" --type page --kind concept
|
|
612
|
+
lwc search "exact evidence" --type source
|
|
613
|
+
lwc page show source-1
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
## Agent Workflow
|
|
617
|
+
|
|
618
|
+
The intended workflow is:
|
|
619
|
+
|
|
620
|
+
1. Collect immutable sources.
|
|
621
|
+
2. Claim one ingest task with bounded `lwc ingest next`, or `ingest claim <ID>`
|
|
622
|
+
when the source was selected explicitly.
|
|
623
|
+
3. Read every returned source window, plus the schema, purpose, and bounded context.
|
|
624
|
+
4. Analyze before generating pages.
|
|
625
|
+
5. Write or revise a source summary and shared durable pages with explicit `--source` citations.
|
|
626
|
+
6. Complete only after both integration gates pass, or record why no shared page should change.
|
|
627
|
+
7. Put a multi-command ingest or broad revision in one changeset, validate the
|
|
628
|
+
draft, then publish it atomically.
|
|
629
|
+
8. Use `search`, `context`, `graph`, and `lint` to keep the Wiki coherent over time.
|
|
630
|
+
|
|
631
|
+
See [docs/agent-workflow.md](https://github.com/JanYork/llm-wiki-cli/blob/main/docs/agent-workflow.md) for the full operating contract.
|
|
632
|
+
Run `lwc --help` or `lwc <command> --help` for Agent-oriented preconditions,
|
|
633
|
+
state transitions, side effects, and next actions.
|
|
634
|
+
|
|
635
|
+
## Atomic Multi-command Changes
|
|
636
|
+
|
|
637
|
+
A single `source` or `page` command is transactional. Use a changeset when one
|
|
638
|
+
logical update needs several commands and must not expose a partial Wiki:
|
|
639
|
+
|
|
640
|
+
```bash
|
|
641
|
+
lwc --scope project changeset begin architecture-refresh
|
|
642
|
+
lwc --scope project --changeset architecture-refresh source add-manifest sources.json
|
|
643
|
+
lwc --scope project --changeset architecture-refresh ingest claim 1
|
|
644
|
+
# Analyze, write cited pages, and complete ingest with the same selector.
|
|
645
|
+
lwc --scope project --changeset architecture-refresh lint
|
|
646
|
+
lwc --scope project --changeset architecture-refresh search "expected answer" --limit 5
|
|
647
|
+
lwc --scope project changeset show architecture-refresh
|
|
648
|
+
lwc --scope project changeset commit architecture-refresh
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
Draft reads see staged writes, while live SQLite and Markdown stay unchanged.
|
|
652
|
+
The draft database starts as a small sparse overlay; it does not copy or
|
|
653
|
+
checkpoint the live Wiki. `changeset show` reports staged operations, revisions,
|
|
654
|
+
and readiness without running lint. Commit validates and applies only
|
|
655
|
+
touched entities, so unrelated live writes survive; a same-entity revision conflict
|
|
656
|
+
fails without overwriting either side. Commit rejects empty drafts and lint
|
|
657
|
+
issues; there is no force or automatic merge. Use
|
|
658
|
+
`--allow-lint-issues --reason "reviewed pre-existing debt"` only for audited
|
|
659
|
+
debt that the changeset did not introduce. After commit, rerun the same fixed
|
|
660
|
+
retrieval checks against live state. Commit freezes the reviewed draft before
|
|
661
|
+
publication; `changeset_frozen` blocks any later staged write. Retry the same
|
|
662
|
+
commit for recovery, or discard after a reported conflict—never add more work
|
|
663
|
+
to a frozen draft.
|
|
664
|
+
|
|
665
|
+
```bash
|
|
666
|
+
lwc --scope project changeset discard architecture-refresh
|
|
667
|
+
lwc --scope project changeset rollback <CHANGESET_ID>
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
Discard touches only an uncommitted draft. Commit writes a checksummed inverse
|
|
671
|
+
patch containing only touched entities and returns the exact rollback ID;
|
|
672
|
+
rollback restores only those entities and refuses if one changed again. Project
|
|
673
|
+
and global changesets are separate, `--scope all` is invalid, and `init`,
|
|
674
|
+
`maintenance`, `checkpoint`, and nested changeset commands reject
|
|
675
|
+
`--changeset`. Drafts never create a second Markdown projection. If a structured
|
|
676
|
+
error reports `committed=true` with cleanup or materialization work remaining,
|
|
677
|
+
do not repeat the knowledge changes; run the returned recovery action.
|
|
678
|
+
|
|
679
|
+
Sparse commit currently has exact patches for Source add/ingest, Page
|
|
680
|
+
put/remove, schema, purpose, and recorded search operations. Retrieval-weight
|
|
681
|
+
and explicit semantic-relation mutations fail before checkpointing or taking a
|
|
682
|
+
live write lock with `changeset_sparse_unsupported`; apply those as direct
|
|
683
|
+
single-entity transactions until their sparse inverse patches are available.
|
|
684
|
+
|
|
685
|
+
## Scopes
|
|
686
|
+
|
|
687
|
+
`lwc` supports three scopes:
|
|
688
|
+
|
|
689
|
+
| Scope | Store | Use |
|
|
690
|
+
| --- | --- | --- |
|
|
691
|
+
| `project` | Nearest ancestor `.lwc/wiki.db` | Default, project-specific knowledge |
|
|
692
|
+
| `global` | `~/.lwc/wiki.db` | Reusable cross-project knowledge |
|
|
693
|
+
| `all` | Project and global stores | Combined `search` and `context` only |
|
|
694
|
+
|
|
695
|
+
Examples:
|
|
696
|
+
|
|
697
|
+
```bash
|
|
698
|
+
lwc --scope global init
|
|
699
|
+
lwc --scope global source add shared.md
|
|
700
|
+
lwc --scope all search "shared term"
|
|
701
|
+
lwc --scope all context
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
Knowledge writes are explicit. `all` does not create implicit cross-store citations
|
|
705
|
+
or links; `search --record` only appends the query operation to each selected store.
|
|
706
|
+
|
|
707
|
+
## Search and CJK
|
|
708
|
+
|
|
709
|
+
Search is lexical and deterministic.
|
|
710
|
+
|
|
711
|
+
- Search terms are plain text, not raw FTS syntax.
|
|
712
|
+
- `--type auto` is the default: compiled pages rank first, paired raw sources
|
|
713
|
+
are hidden, and raw sources provide fallback recall.
|
|
714
|
+
- Use `--type page`, `--type source`, or `--type all` to select a layer.
|
|
715
|
+
Repeat `--kind` to restrict page results, such as
|
|
716
|
+
`--kind concept --kind synthesis`.
|
|
717
|
+
- Multi-character CJK query terms use adjacent bigrams; the index also retains
|
|
718
|
+
non-stopword unigrams so one-character queries remain searchable.
|
|
719
|
+
- Latin text is tokenized into lowercased alphanumeric terms.
|
|
720
|
+
- Ranking keeps title, source filename, path/slug, summary, and body evidence
|
|
721
|
+
distinct. Exact/partial title and path matches receive bounded boosts.
|
|
722
|
+
- README/index/overview documents and explicit navigation hubs are
|
|
723
|
+
query-conditionally downweighted in favor of specific feature documents;
|
|
724
|
+
asking for the README or overview disables that penalty.
|
|
725
|
+
- Page candidates may receive a bounded direct-link or shared-source graph
|
|
726
|
+
boost. Common-neighbor-only relationships cannot change search order, and a
|
|
727
|
+
broad navigation hub receives a bounded graph penalty.
|
|
728
|
+
- `--explain` returns the exact score arithmetic, including lexical, generic,
|
|
729
|
+
graph, manual-weight, and query-feedback signals. It does not record the
|
|
730
|
+
query; `--record` remains the only search-history opt-in.
|
|
731
|
+
- Fixed coefficients and lower-is-better ranks keep project and global results
|
|
732
|
+
comparable under `--scope all`.
|
|
733
|
+
|
|
734
|
+
This is intentionally dictionary-free. The goal is stable behavior for product names, code names, mixed-language terms, and emerging vocabulary without depending on a word-segmentation dictionary.
|
|
735
|
+
|
|
736
|
+
### Explicit retrieval weights and feedback
|
|
737
|
+
|
|
738
|
+
Use a document weight for a durable, query-independent judgment about a page
|
|
739
|
+
or source. Use feedback for one exact ordered-token query fingerprint:
|
|
740
|
+
|
|
741
|
+
```bash
|
|
742
|
+
lwc weight set page payment-rules \
|
|
743
|
+
--value 2 \
|
|
744
|
+
--reason "Canonical payment rules specification" \
|
|
745
|
+
--provenance agent-observed
|
|
746
|
+
lwc weight list page payment-rules
|
|
747
|
+
|
|
748
|
+
lwc weight feedback page payment-rules \
|
|
749
|
+
--query "payment reconciliation rules" \
|
|
750
|
+
--signal relevant \
|
|
751
|
+
--reason "Verified against the expected answer" \
|
|
752
|
+
--provenance agent-observed
|
|
753
|
+
|
|
754
|
+
lwc weight feedback-clear page payment-rules \
|
|
755
|
+
--query "payment reconciliation rules" \
|
|
756
|
+
--provenance agent-observed
|
|
757
|
+
lwc weight clear page payment-rules --provenance agent-observed
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
Document values are `-2`, `-1`, `1`, or `2`; use `clear` for zero. Both
|
|
761
|
+
mechanisms only rerank lexical candidates and cannot make a nonmatching
|
|
762
|
+
document appear. A `user-provided` row takes precedence over an
|
|
763
|
+
`agent-observed` row while both remain auditable. Feedback stores the SHA-256
|
|
764
|
+
fingerprint, not the raw query, and does not transfer to paraphrases with
|
|
765
|
+
different tokens. Reasons and operation records are durable, so never copy a
|
|
766
|
+
sensitive query into `--reason`. Mutations require an explicit `project` or
|
|
767
|
+
`global` scope; `--scope all` is rejected.
|
|
768
|
+
|
|
769
|
+
## Read-only Viewer and CodeGraph
|
|
770
|
+
|
|
771
|
+
`lwc view` starts a foreground, loopback-only project inspector and opens the
|
|
772
|
+
browser. It serves one embedded TS + Lit application—no CDN and no Node runtime
|
|
773
|
+
at use time—and exposes GET/HEAD APIs only. Pages, sources, Markdown, the
|
|
774
|
+
knowledge graph, and the optional code graph are read from the current project
|
|
775
|
+
without migration, refresh, or graph construction:
|
|
776
|
+
|
|
777
|
+
```bash
|
|
778
|
+
lwc view
|
|
779
|
+
lwc view --port 4173 --no-open
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
The viewer starts in English. Use the `中文` / `EN` control to switch languages;
|
|
783
|
+
the browser remembers the selection while Wiki content remains in its authored
|
|
784
|
+
language. Graphs use a single Obsidian-inspired 3D relationship view with small
|
|
785
|
+
nodes, persistent labels, thin links, rotation, and zoom.
|
|
786
|
+
|
|
787
|
+
<p align="center">
|
|
788
|
+
<img src="https://raw.githubusercontent.com/JanYork/llm-wiki-cli/main/docs/images/lwc-codegraph-en.png" alt="LWC CodeGraph code intelligence" width="100%">
|
|
789
|
+
</p>
|
|
790
|
+
|
|
791
|
+
Code indexing is project-only and disabled until explicitly initialized. The
|
|
792
|
+
pinned LWC CodeGraph fork is downloaded once from its GitHub Release, verified
|
|
793
|
+
with SHA-256, and cached under `~/.lwc/runtime/codegraph/<PIN>/<TARGET>/`; each
|
|
794
|
+
project keeps only its index under `.lwc/codegraph`. Telemetry is always off and
|
|
795
|
+
no `.codegraph` state is used.
|
|
796
|
+
|
|
797
|
+
```bash
|
|
798
|
+
lwc cg status
|
|
799
|
+
lwc cg init # download once, then index one complete file at a time
|
|
800
|
+
lwc cg sync
|
|
801
|
+
lwc cg query UserService
|
|
802
|
+
lwc cg node UserService
|
|
803
|
+
lwc cg callers UserService
|
|
804
|
+
lwc cg callees UserService
|
|
805
|
+
lwc cg impact UserService
|
|
806
|
+
lwc cg files
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
All CodeGraph query capabilities are forwarded by `lwc cg`. Global lifecycle
|
|
810
|
+
commands (`install`, `uninstall`, `upgrade`, `telemetry`, `daemon`, `daemons`)
|
|
811
|
+
are blocked. The exact `lwc cg serve --mcp` bridge remains for legacy manual
|
|
812
|
+
compatibility; new Agent integrations use `lwc serve --mcp`, which fuses
|
|
813
|
+
bounded Wiki and CodeGraph exploration behind one read-only tool. LWC owns the
|
|
814
|
+
runtime and enforces the project boundary. Initial,
|
|
815
|
+
incremental, full, update, delete, reference-resolution, and recovery writes
|
|
816
|
+
commit one owner file completely before the next; the current graph remains
|
|
817
|
+
readable and historical document revisions are never refreshed.
|
|
818
|
+
|
|
819
|
+
## Maintenance and Projection
|
|
820
|
+
|
|
821
|
+
Useful maintenance commands:
|
|
822
|
+
|
|
823
|
+
```bash
|
|
824
|
+
lwc lint
|
|
825
|
+
lwc maintenance reindex
|
|
826
|
+
lwc maintenance materialize
|
|
827
|
+
lwc maintenance compact
|
|
828
|
+
lwc work list
|
|
829
|
+
lwc work status <WORK_ID>
|
|
830
|
+
lwc work watch <WORK_ID>
|
|
831
|
+
lwc work cancel <WORK_ID>
|
|
832
|
+
lwc work resume <WORK_ID>
|
|
833
|
+
lwc checkpoint create before-large-update
|
|
834
|
+
lwc checkpoint list
|
|
835
|
+
lwc log --limit 20
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
Notes:
|
|
839
|
+
|
|
840
|
+
- Maintenance commands return a durable `work` immediately. Read progress with
|
|
841
|
+
`work status`, or use `work watch` and inspect `work.result` after success.
|
|
842
|
+
Schema v10 to v11 migration uses the same mechanism automatically, so normal
|
|
843
|
+
commands never perform that migration inline.
|
|
844
|
+
- `lint` is read-only by default. Add `--record` only when the lint pass belongs
|
|
845
|
+
in durable operation history.
|
|
846
|
+
- `maintenance reindex` rebuilds derived search artifacts from SQLite.
|
|
847
|
+
- `maintenance materialize` rebuilds the projected Markdown tree from SQLite.
|
|
848
|
+
- `maintenance compact` only attempts a WAL truncate checkpoint; it does not
|
|
849
|
+
hide a full FTS optimization. Run it while the Wiki is idle and inspect
|
|
850
|
+
`busy` plus `after_bytes`. A busy reader returns promptly without changing
|
|
851
|
+
canonical content.
|
|
852
|
+
- Search queries are private by default; add `--record` only when you want the query wording stored in the durable operation log.
|
|
853
|
+
|
|
854
|
+
`lwc checkpoint create <NAME>` uses SQLite's online backup API. Restore with
|
|
855
|
+
`lwc checkpoint restore <NAME>`; LWC first creates a `pre-restore-*` safety
|
|
856
|
+
checkpoint and then rebuilds the projection. Use `source remove <ID>` and
|
|
857
|
+
`page remove <SLUG>` for guarded deletion: sources with citations and pages
|
|
858
|
+
with inbound links are refused. Removing the current source for a tracked path
|
|
859
|
+
stops tracking that path instead of silently exposing an older revision as
|
|
860
|
+
current.
|
|
861
|
+
|
|
862
|
+
For a multi-source ingest or broad page replacement, prefer a changeset over a
|
|
863
|
+
manual checkpoint: successful commit writes a sparse inverse patch, publishes
|
|
864
|
+
only touched canonical entities in one transaction, and incrementally
|
|
865
|
+
materializes changed Markdown. Commit attempts a WAL truncate after publication;
|
|
866
|
+
`wal_checkpointed=false` means an active reader prevented it and does not mean
|
|
867
|
+
the canonical commit failed.
|
|
868
|
+
|
|
869
|
+
For an external filesystem backup, stop active `lwc` commands and copy the
|
|
870
|
+
complete `.lwc/` directory. Do not copy only `wiki.db` while a writer may still
|
|
871
|
+
be using its WAL files.
|
|
872
|
+
|
|
873
|
+
## Benchmark Suite
|
|
874
|
+
|
|
875
|
+
The opt-in benchmark imports a local UTF-8 corpus into a temporary Wiki and
|
|
876
|
+
reports import time, search P50/P95, Recall@5/10, MRR, and storage before/after
|
|
877
|
+
compaction. Ground truth is a JSONL file of queries and expected
|
|
878
|
+
corpus-relative paths:
|
|
879
|
+
|
|
880
|
+
```bash
|
|
881
|
+
cargo build --release
|
|
882
|
+
LWC_BENCH_CORPUS=/path/to/sanitized-corpus \
|
|
883
|
+
LWC_BENCH_QUERY_SET=/path/to/query-set.jsonl \
|
|
884
|
+
LWC_BENCH_BINARY="$PWD/target/release/lwc" \
|
|
885
|
+
cargo test --test search_benchmark -- --ignored --nocapture
|
|
886
|
+
```
|
|
887
|
+
|
|
888
|
+
Normal `cargo test --all-targets` covers page-first search, type/kind filters,
|
|
889
|
+
UTF-8 source windows, ingest completion gates, graph precision, migrations,
|
|
890
|
+
lint, and WAL compaction. See [benchmarks/README.md](https://github.com/JanYork/llm-wiki-cli/blob/main/benchmarks/README.md) for
|
|
891
|
+
the workload contract and fair before/after comparison rules.
|
|
892
|
+
|
|
893
|
+
## Limits and Non-Goals
|
|
894
|
+
|
|
895
|
+
Current design constraints:
|
|
896
|
+
|
|
897
|
+
- single-machine, single-user knowledge base;
|
|
898
|
+
- UTF-8 text workflow;
|
|
899
|
+
- bounded input size of 64 MiB per schema, purpose, source, or page body;
|
|
900
|
+
- lexical search, not semantic vector retrieval.
|
|
901
|
+
|
|
902
|
+
Deliberate non-goals for this CLI:
|
|
903
|
+
|
|
904
|
+
- no built-in LLM calls;
|
|
905
|
+
- no vector database;
|
|
906
|
+
- no daemon or background service;
|
|
907
|
+
- no web UI or desktop UI;
|
|
908
|
+
- no direct database editing contract.
|
|
909
|
+
|
|
910
|
+
If the projected Markdown drifts, rebuild it. If the SQLite schema is wrong, fix it through the CLI and migrations, not by hand.
|
|
911
|
+
|
|
912
|
+
## Contributing
|
|
913
|
+
|
|
914
|
+
Issues and pull requests are welcome, especially around:
|
|
915
|
+
|
|
916
|
+
- agent workflow ergonomics;
|
|
917
|
+
- deterministic projection behavior;
|
|
918
|
+
- durable citation and page maintenance contracts;
|
|
919
|
+
- search quality for multilingual technical corpora.
|
|
920
|
+
|
|
921
|
+
Please read [CONTRIBUTING.md](https://github.com/JanYork/llm-wiki-cli/blob/main/CONTRIBUTING.md) before opening a pull request.
|
|
922
|
+
Report security issues according to [SECURITY.md](https://github.com/JanYork/llm-wiki-cli/blob/main/SECURITY.md).
|
|
923
|
+
|
|
924
|
+
## License
|
|
925
|
+
|
|
926
|
+
Licensed under the [Apache License 2.0](LICENSE).
|