llm-wiki-kit 0.2.18 → 0.2.19
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 +6 -6
- package/docs/concepts.md +6 -6
- package/docs/integrations/claude-code.md +2 -2
- package/docs/integrations/codex.md +3 -3
- package/docs/manual.md +7 -7
- package/docs/operations.md +4 -4
- package/docs/troubleshooting.md +2 -2
- package/package.json +1 -1
- package/src/capture-policy.js +11 -2
- package/src/compact-capture.js +2 -2
- package/src/hook.js +2 -2
- package/src/maintenance.js +20 -37
- package/src/templates.js +11 -11
package/README.md
CHANGED
|
@@ -106,15 +106,15 @@ The installed hooks:
|
|
|
106
106
|
- remove Codex-facing legacy `oh-my-codex:wiki`/`omx_wiki` surfaces at session start so `llm-wiki/` remains the active wiki implementation
|
|
107
107
|
- record small redacted raw event envelopes and per-turn state
|
|
108
108
|
- capture meaningful work and structured decision points, including tool evidence, changed files, verification notes, and reusable durable-candidate signals
|
|
109
|
-
- attach safe `evidence_refs` candidates to generated
|
|
110
|
-
- before compaction, classify the current turn and save a redacted checkpoint only for meaningful work, structured decisions, explicit durable requests, or
|
|
109
|
+
- attach safe `evidence_refs` candidates to generated queue items when changed files or verification commands are available
|
|
110
|
+
- before compaction, classify the current turn and save a redacted checkpoint only for meaningful work, structured decisions, explicit durable requests, or recovered work; explicit/structured durable candidates get a maintenance queue item when no durable wiki update is detected
|
|
111
111
|
- after compaction, store the redacted compact summary only; if pre-compact preservation failed, prepare a recovery packet for the next legal model-visible context hook
|
|
112
112
|
- allow tool calls to proceed without secret/PII-based hook blocking
|
|
113
|
-
- update chunked `llm-wiki/outputs/questions/YYYY-MM-DD/live-qa-001.md` style archives only for meaningful work, structured decision turns, or
|
|
113
|
+
- update chunked `llm-wiki/outputs/questions/YYYY-MM-DD/live-qa-001.md` style archives only for meaningful work, structured decision turns, or explicit durable requests
|
|
114
114
|
- avoid automatic `wiki/queries/` and `wiki/decisions/` promotion in the default answer-first mode
|
|
115
|
-
- queue durable cleanup candidates for explicit documentation requests,
|
|
115
|
+
- queue durable cleanup candidates for explicit documentation requests, structured durable conclusions, or recovered stale turn state that were not reflected in durable wiki files
|
|
116
116
|
- recover stale per-turn state into that queue on the next session start or prompt submit when the previous stop hook did not complete
|
|
117
|
-
- nudge the active LLM to fold
|
|
117
|
+
- nudge the active LLM to batch-review accumulated candidates and fold only explicit, repeated, or clearly reusable facts into existing wiki pages
|
|
118
118
|
- automatically refresh managed rules/templates for older projects when the current runtime starts a session
|
|
119
119
|
|
|
120
120
|
If you need to think about saving every answer manually, the setup has failed.
|
|
@@ -150,7 +150,7 @@ Installed npm runtimes also perform a cached update notice check from hooks whil
|
|
|
150
150
|
|
|
151
151
|
`llm-wiki consolidate` refreshes only generated marker blocks in `wiki/memory.md` and `wiki/index.md`. Generated maps keep durable non-archived pages, hide default episodic records, skip stale/archived/superseded pages, and report those counts in dry-run output. It is an agent maintenance helper, not a command users should run after every turn.
|
|
152
152
|
|
|
153
|
-
`llm-wiki maintenance` prints the queue and review due status from `llm-wiki/outputs/maintenance/queue.md`. Queue states are `pending -> approved -> done` or `skipped`. Use `llm-wiki maintenance --workspace <project> --approve <id> --target <wiki/...md>` when durable promotion
|
|
153
|
+
`llm-wiki maintenance` prints the queue and review due status from `llm-wiki/outputs/maintenance/queue.md`. Queue states are `pending -> approved -> done` or `skipped`. Use `llm-wiki maintenance --workspace <project> --approve <id> --target <wiki/...md>` only when a human/agent explicitly accepts durable promotion, `--done <id> --target <wiki/...md>` after the active agent has merged the fact into a durable page, and `--skip <id> [--note "..."]` for duplicate or non-durable candidates. `llm-wiki maintenance --workspace <project> --apply-lifecycle --dry-run` previews automatic queue hygiene; without `--dry-run`, candidates remain pending for batch review, old low-signal candidates may be skipped, and old reviewed items move to `outputs/maintenance/archive/`. Hooks apply that lifecycle only on `SessionStart`/`InstructionsLoaded`; `UserPromptSubmit` only reminds for explicit documentation, recovered state, maintenance prompts, or batch thresholds. Approved items are shown before pending items in hook reminders. Periodic maintenance is a soft agent-side reminder, not a user command loop.
|
|
154
154
|
|
|
155
155
|
`llm-wiki eval --workspace <project> [--fixture <path>] [--limit 5] [--json]` runs retrieval fixtures from `llm-wiki/evals/retrieval.json` by default. If the fixture is absent, it exits successfully with `no fixture found`. Fixtures list `query`, `expected`, and `unexpected` paths; output reports recall, missed expected hits, unexpected hits, and top hits using the same durable visibility policy as export.
|
|
156
156
|
|
package/docs/concepts.md
CHANGED
|
@@ -18,13 +18,13 @@ The important behavior is a loop:
|
|
|
18
18
|
2. `memory.md`, `index.md`, and relevant wiki context are injected automatically with an answer-first instruction.
|
|
19
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, hooks append redacted chunked live Q&A only for turns with work evidence, structured decision/debugging conclusions, or
|
|
21
|
+
5. At stop/session end, hooks append redacted chunked live Q&A only for turns with work evidence, structured decision/debugging conclusions, or explicit durable requests.
|
|
22
22
|
6. When possible, generated candidates carry safe `evidence_refs` such as changed files, verification commands, raw source IDs, or external URLs.
|
|
23
23
|
7. Simple answers, status checks, and keyword-only responses stay out of live Q&A and durable wiki by default.
|
|
24
|
-
8. Durable wiki promotion is selective: explicit record/document requests and
|
|
24
|
+
8. Durable wiki promotion is selective: explicit record/document requests and structured durable conclusions enter the queue, but the active agent should batch-review and merge only explicit, repeated, or clearly reusable facts into existing wiki pages.
|
|
25
25
|
9. At the next start/prompt after an abrupt shutdown, hooks can recover stale turn state into `outputs/maintenance/queue.md`.
|
|
26
|
-
10. At session start, deterministic lifecycle hygiene
|
|
27
|
-
11. When reusable knowledge appears, the active Claude Code/Codex agent folds
|
|
26
|
+
10. At session start, deterministic lifecycle hygiene keeps candidates pending for batch review, may skip old low-signal items, and archives old reviewed items without generating wiki pages automatically.
|
|
27
|
+
11. When reusable knowledge appears repeatedly or explicitly, the active Claude Code/Codex agent folds it into existing durable wiki pages instead of creating one page per candidate.
|
|
28
28
|
12. Export and eval reuse the same durable visibility policy so handoff manifests, retrieval fixtures, and context selection describe the same wiki surface.
|
|
29
29
|
13. Future sessions start from the improved wiki instead of relying on long chat history.
|
|
30
30
|
|
|
@@ -45,9 +45,9 @@ The maintenance loop is intentionally layered:
|
|
|
45
45
|
- `index.md`: broad navigation map.
|
|
46
46
|
- MiniSearch + wikilinks: retrieval over durable `wiki/**/*.md`, with episodic `wiki/queries/`, `wiki/context/`, and `session-log` pages hidden by default unless promoted or `--include-episodic` is requested; archived/superseded pages stay preserved but hidden unless `--include-archived` is requested. Verbose context explains `why selected`; hook context stays compact.
|
|
47
47
|
- `evidence_refs`: optional frontmatter that ties durable claims to `file:`, `cmd:`, `raw:`, or `url:` evidence without embedding secrets or raw transcripts.
|
|
48
|
-
- `outputs/maintenance/queue.md`: selective reminders for explicit durable requests,
|
|
48
|
+
- `outputs/maintenance/queue.md`: selective reminders for explicit durable requests, structured durable conclusions, and stale turn recovery that need batch review. Queue state is `pending`, `approved`, `done`, or `skipped`; reviewed history can move to `outputs/maintenance/archive/`.
|
|
49
49
|
- `lint`: finds broken links, stale pages, duplicates, metadata gaps, invalid evidence refs, secret-like content, outdated managed rules, memory/page-count budget pressure, hidden episodic growth, and stale/archived discoverability gaps.
|
|
50
|
-
- `maintenance`: reports `reviewDue` only when periodic thresholds are met; hook reminders are soft and limited to session start/instructions loaded or compact prompt-time reminders for maintenance prompts, approved items, durable
|
|
50
|
+
- `maintenance`: reports `reviewDue` only when periodic thresholds are met; hook reminders are soft and limited to session start/instructions loaded or compact prompt-time reminders for maintenance prompts, approved items, explicit durable requests, recovered items, or batch-threshold pressure. `--apply-lifecycle` previews or applies bounded queue hygiene; it does not merge, auto-approve, or create durable wiki pages.
|
|
51
51
|
- `consolidate`: agent helper that refreshes generated blocks in `memory.md` and `index.md` while preserving handwritten notes, keeping default query/context/session pages out of the durable generated maps, and skipping stale/archived/superseded pages.
|
|
52
52
|
- `eval`: checks retrieval fixtures in `llm-wiki/evals/retrieval.json` and reports expected recall, missed expected paths, unexpected hits, and top hits.
|
|
53
53
|
- `export`: writes redacted `llms.txt`, `llms-full.txt`, and `llm-wiki.json` manifests for agent onboarding, handoff, retrieval eval, and external consumption. `llms.txt` is not treated as a passive SEO artifact.
|
|
@@ -42,11 +42,11 @@ when no project `CLAUDE.md` exists. Existing `CLAUDE.md` files are not overwritt
|
|
|
42
42
|
|
|
43
43
|
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.
|
|
44
44
|
|
|
45
|
-
At `SessionStart`/`InstructionsLoaded`, the hook first attempts a safe managed-template refresh, recovers stale turn state into `outputs/maintenance/queue.md`, applies deterministic maintenance lifecycle hygiene for the current workspace, performs a cached npm update notice check for npm installs, then injects functional compact context. The context still uses `llm-wiki/wiki/memory.md`, `llm-wiki/wiki/index.md`, relevant wiki/search state, operating rules, maintenance signals, passive runtime update status, and managed-template cleanup notes; the hook formats those signals so they are usable if shown in the Claude Code UI. At `UserPromptSubmit`, it recovers stale turn state, searches wiki pages with MiniSearch or substring fallback, expands one-hop wikilinks, redacts context fields, performs the same cached update notice check, and injects the smallest useful functional compact context set. Verbose `llm-wiki context` can explain `why selected`, `rankReason`, `matchedFields`, and `evidenceRefs`, but hook context keeps those details compact. Update notice cache is scoped by npm command, and maintenance reminders are shown for wiki/maintenance prompts,
|
|
45
|
+
At `SessionStart`/`InstructionsLoaded`, the hook first attempts a safe managed-template refresh, recovers stale turn state into `outputs/maintenance/queue.md`, applies deterministic maintenance lifecycle hygiene for the current workspace, performs a cached npm update notice check for npm installs, then injects functional compact context. The context still uses `llm-wiki/wiki/memory.md`, `llm-wiki/wiki/index.md`, relevant wiki/search state, operating rules, maintenance signals, passive runtime update status, and managed-template cleanup notes; the hook formats those signals so they are usable if shown in the Claude Code UI. At `UserPromptSubmit`, it recovers stale turn state, searches wiki pages with MiniSearch or substring fallback, expands one-hop wikilinks, redacts context fields, performs the same cached update notice check, and injects the smallest useful functional compact context set. Verbose `llm-wiki context` can explain `why selected`, `rankReason`, `matchedFields`, and `evidenceRefs`, but hook context keeps those details compact. Update notice cache is scoped by npm command, and maintenance reminders are shown only for wiki/maintenance prompts, approved items, explicit durable requests, recovered items, or batch review threshold pressure.
|
|
46
46
|
|
|
47
47
|
Hook-visible language is selected from the current real user prompt first. Korean prompts get Korean guidance, English prompts get English guidance. Neutral prompts can reuse remembered session language or project `preferredLanguage`; then the hook checks Claude Code `settings.json` `language` when it exists, local `CLAUDE.md`/`AGENTS.md` language signals, and finally English. The kit does not require Claude Code to expose a language setting.
|
|
48
48
|
|
|
49
|
-
`PostToolUse` and `PostToolBatch` record redacted tool summaries in the same turn buffer. `PreCompact` classifies the current turn before compaction: simple turns record only a context note, work-evidence, structured-decision, explicit durable, or
|
|
49
|
+
`PostToolUse` and `PostToolBatch` record redacted tool summaries in the same turn buffer. `PreCompact` classifies the current turn before compaction: simple turns record only a context note, work-evidence, structured-decision, explicit durable, or recovered turns write a chunked live Q&A checkpoint, and explicit/structured durable candidates write a maintenance queue item only when no durable wiki update is detected. Queue items carry `signal_level` and may carry safe `evidence_refs` candidates from actual repo files and verification commands. The checkpoint can include only a bounded redacted transcript tail, never the full raw transcript or raw `transcript_path`. Compaction is not blocked; if checkpoint storage fails, the hook records a compact recovery packet for the next legal context-injection event. `PostCompact` stores the redacted compact summary as a context note and prepares any pending recovery packet without returning model-visible context directly. In the default `answer-first` mode, `SubagentStop` does not create live Q&A, query, decision, or maintenance files. `Stop` and `SessionEnd` append chunked live Q&A only for work-evidence, structured-decision, or explicit durable turns and do not auto-create `wiki/queries/` or `wiki/decisions/`. If the user explicitly asked to record durable knowledge, or the turn contains a structured durable conclusion, and no durable wiki update is detected, `Stop`/`SessionEnd` queues a pending maintenance item for batch review. The lifecycle keeps candidates pending for batch review, skips stale low-signal items, and archives old reviewed items, but it never creates durable wiki pages automatically or auto-approves promotion. Prompt-time reminders are limited to explicit durable requests, recovered state, maintenance prompts, approved items, or batch thresholds. `Stop` and `SessionEnd` then clear the per-session turn buffer; `SubagentStop` does not.
|
|
50
50
|
|
|
51
51
|
For handoff or retrieval verification, use `llm-wiki export --workspace <project> --format all` and `llm-wiki eval --workspace <project>`. The generated `llms.txt`/`llms-full.txt`/`llm-wiki.json` files are redacted durable manifests, not raw transcripts.
|
|
52
52
|
|
|
@@ -30,14 +30,14 @@ Handled events:
|
|
|
30
30
|
Expected behavior:
|
|
31
31
|
|
|
32
32
|
- `SessionStart` first attempts a safe managed-template refresh, removes Codex-facing legacy `oh-my-codex:wiki`/`omx_wiki` surfaces when they reappear, recovers stale turn state into `outputs/maintenance/queue.md`, applies deterministic maintenance lifecycle hygiene for the current workspace, performs a cached npm update notice check for npm installs, then injects functional compact context. The context still uses `llm-wiki/wiki/memory.md`, `llm-wiki/wiki/index.md`, relevant wiki/search state, operating rules, maintenance signals, passive runtime update status, and managed-template cleanup notes; the hook formats those signals so they are usable if shown in the Codex UI.
|
|
33
|
-
- `UserPromptSubmit` recovers stale turn state, searches project wiki pages with MiniSearch or substring fallback, expands one-hop wikilinks, redacts context fields, performs the same cached update notice check, and injects the smallest useful functional compact context set. Verbose `llm-wiki context` can explain `why selected`, `rankReason`, `matchedFields`, and `evidenceRefs`, but hook context keeps those details compact. Update notice cache is scoped by npm command, and maintenance reminders are shown for wiki/maintenance prompts,
|
|
33
|
+
- `UserPromptSubmit` recovers stale turn state, searches project wiki pages with MiniSearch or substring fallback, expands one-hop wikilinks, redacts context fields, performs the same cached update notice check, and injects the smallest useful functional compact context set. Verbose `llm-wiki context` can explain `why selected`, `rankReason`, `matchedFields`, and `evidenceRefs`, but hook context keeps those details compact. Update notice cache is scoped by npm command, and maintenance reminders are shown only for wiki/maintenance prompts, approved items, explicit durable requests, recovered items, or batch review threshold pressure.
|
|
34
34
|
- Hook-visible language is selected from the current real user prompt first. Korean prompts get Korean guidance, English prompts get English guidance. Codex synthetic plan execution prompts such as `Implement the plan.` are treated as neutral, so they reuse remembered session language or project `preferredLanguage` instead of forcing English. If no prompt language is clear, Codex falls back to local `CLAUDE.md`/`AGENTS.md` language signals, then English.
|
|
35
35
|
- `PreToolUse` records redacted tool summaries without blocking tool calls.
|
|
36
36
|
- `PostToolUse` records redacted tool summaries in a turn buffer.
|
|
37
|
-
- `PreCompact` classifies the current turn before compaction. Simple turns record only a context note; work-evidence, structured-decision, explicit durable, or
|
|
37
|
+
- `PreCompact` classifies the current turn before compaction. Simple turns record only a context note; work-evidence, structured-decision, explicit durable, or recovered turns write a chunked live Q&A checkpoint; explicit/structured durable candidates write a maintenance queue item only when no durable wiki update is detected. The checkpoint can include only a bounded redacted transcript tail, never the full raw transcript or raw `transcript_path`. Compaction is not blocked; if checkpoint storage fails, the hook records a compact recovery packet for the next legal context-injection event.
|
|
38
38
|
- `PostCompact` stores the redacted compact summary as a context note and prepares any pending compact recovery packet. It does not return `hookSpecificOutput.additionalContext`, because Codex `PostCompact` only supports common output fields.
|
|
39
39
|
- In the default `answer-first` mode, `SubagentStop` does not create live Q&A, query, decision, or maintenance files. `Stop` appends chunked live Q&A only for work-evidence, structured-decision, or durable-candidate turns and does not auto-create `wiki/queries/` or `wiki/decisions/`.
|
|
40
|
-
- If the user explicitly asked to record durable knowledge, or the turn contains
|
|
40
|
+
- If the user explicitly asked to record durable knowledge, or the turn contains a structured durable conclusion, and no durable wiki update is detected, `Stop` queues a pending maintenance item for batch review. Queue items carry `signal_level` and may carry safe `evidence_refs` candidates from actual repo files and verification commands. The lifecycle keeps candidates pending for batch review, skips stale low-signal items, and archives old reviewed items, but it never creates durable wiki pages automatically or auto-approves promotion. Prompt-time reminders are limited to explicit durable requests, recovered state, maintenance prompts, approved items, or batch thresholds.
|
|
41
41
|
- `Stop` clears the per-session turn buffer after recording. `SubagentStop` leaves the parent turn buffer available for the final stop event.
|
|
42
42
|
|
|
43
43
|
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. Functional compact context is a presentation policy, not a feature reduction: Codex still receives the wiki memory, search, maintenance, and passive update signals needed for the hook workflow.
|
package/docs/manual.md
CHANGED
|
@@ -74,10 +74,10 @@ Use Codex or Claude Code normally. Installed hooks:
|
|
|
74
74
|
- use `wiki/memory.md`, `wiki/index.md`, relevant wiki search, maintenance signals, update notices, and compact recovery packets;
|
|
75
75
|
- record redacted prompt/tool/result summaries in per-turn state;
|
|
76
76
|
- preserve safe evidence pointers as `evidence_refs` when changed files or verification commands are available;
|
|
77
|
-
- archive only meaningful work turns, structured decision/debugging turns, or
|
|
77
|
+
- archive only meaningful work turns, structured decision/debugging turns, or explicit durable requests into chunked `outputs/questions/YYYY-MM-DD/live-qa-001.md` files;
|
|
78
78
|
- avoid automatic `wiki/queries/` and `wiki/decisions/` promotion in the default answer-first mode;
|
|
79
|
-
- queue durable cleanup candidates for explicit documentation requests,
|
|
80
|
-
- apply deterministic queue lifecycle hygiene at session start so
|
|
79
|
+
- queue durable cleanup candidates for explicit documentation requests, structured durable conclusions, or recovered stale turn state that were not reflected in durable wiki files;
|
|
80
|
+
- apply deterministic queue lifecycle hygiene at session start so candidates stay pending for batch review, stale low-signal candidates can be skipped, and old reviewed items can be archived without creating wiki pages automatically;
|
|
81
81
|
- refresh clearly managed rules/templates for older projects at session start;
|
|
82
82
|
- remove legacy Codex-facing `oh-my-codex:wiki`/`omx_wiki` surfaces when they reappear.
|
|
83
83
|
|
|
@@ -91,7 +91,7 @@ Default:
|
|
|
91
91
|
LLM_WIKI_KIT_CAPTURE_MODE=answer-first
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
`answer-first` keeps simple Q&A, status checks, and keyword-only replies out of durable wiki and live Q&A by default. It archives work turns with tool evidence, changed-file evidence, verification, structured `Decision:`/`Root cause:` style conclusions
|
|
94
|
+
`answer-first` keeps simple Q&A, status checks, and keyword-only replies out of durable wiki and live Q&A by default. It archives work turns with tool evidence, changed-file evidence, verification, or structured `Decision:`/`Root cause:` style conclusions. Explicit durable requests and structured durable conclusions create maintenance queue candidates only when no durable wiki update is detected.
|
|
95
95
|
|
|
96
96
|
Deprecated compatibility mode:
|
|
97
97
|
|
|
@@ -231,7 +231,7 @@ Missing fixtures exit successfully with `no fixture found`. Present fixtures rep
|
|
|
231
231
|
|
|
232
232
|
## Maintenance
|
|
233
233
|
|
|
234
|
-
`llm-wiki maintenance` reports queue state and review health. It does not merge pages automatically. The active agent should merge reusable
|
|
234
|
+
`llm-wiki maintenance` reports queue state and review health. It does not merge pages automatically. The active agent should batch-review candidates, merge only explicit, repeated, or clearly reusable facts into existing durable pages, and mark queue items through `pending`, `approved`, `done`, or `skipped`.
|
|
235
235
|
|
|
236
236
|
```bash
|
|
237
237
|
llm-wiki maintenance --workspace <project> --apply-lifecycle --dry-run
|
|
@@ -242,12 +242,12 @@ llm-wiki maintenance --workspace <project> --skip <id> --note "duplicate"
|
|
|
242
242
|
|
|
243
243
|
`approved` means durable promotion is accepted but not yet merged. `done` means the durable page has been updated. `skipped` means the item was duplicate or not reusable enough. Approved reminders are shown before pending reminders.
|
|
244
244
|
|
|
245
|
-
Lifecycle hygiene applies when pending reaches 15:
|
|
245
|
+
Lifecycle hygiene applies when pending reaches 15: candidates remain pending for batch review, old low-signal candidates may move to `skipped`, explicit requests and recovered `result_missing` items are not auto-skipped, and old reviewed items beyond the latest 10 move to `outputs/maintenance/archive/YYYY-MM.md`. Hooks apply this only on `SessionStart`/`InstructionsLoaded`; `UserPromptSubmit` only reminds.
|
|
246
246
|
|
|
247
247
|
Hook reminders are soft:
|
|
248
248
|
|
|
249
249
|
- session start and instructions loaded may show a one-item summary;
|
|
250
|
-
- prompt submit shows one compact reminder for wiki/maintenance prompts,
|
|
250
|
+
- prompt submit shows one compact reminder for wiki/maintenance prompts, approved items, explicit durable requests, recovered items, or the batch review threshold.
|
|
251
251
|
|
|
252
252
|
## PreCompact
|
|
253
253
|
|
package/docs/operations.md
CHANGED
|
@@ -147,7 +147,7 @@ After a plain `npm install -g llm-wiki-kit@latest`, existing hooks keep working
|
|
|
147
147
|
|
|
148
148
|
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 context automatically, but the current user answer takes priority over wiki cleanup. The active agent updates durable wiki pages when reusable project knowledge appears and the turn's importance or user consent justifies persistence. Hook context policy is function-first: memory, search, maintenance, and update signals remain available, while user-visible context is formatted as functional compact context instead of a raw dump.
|
|
149
149
|
|
|
150
|
-
In the default `LLM_WIKI_KIT_CAPTURE_MODE=answer-first` mode, `Stop` and `SessionEnd` append live Q&A only for meaningful work evidence, structured decision turns, or
|
|
150
|
+
In the default `LLM_WIKI_KIT_CAPTURE_MODE=answer-first` mode, `Stop` and `SessionEnd` append live Q&A only for meaningful work evidence, structured decision turns, or explicit durable requests. Simple answers, status checks, keyword-only responses, and ordinary durable keywords such as "root cause" inside work summaries are not promoted into durable review by themselves. Live Q&A uses chunked files under `llm-wiki/outputs/questions/YYYY-MM-DD/` and rolls over by line/byte budget. Hooks do not auto-create `wiki/queries/` or `wiki/decisions/`. If the user explicitly asked for recording/documentation, or the turn contains a structured durable conclusion such as `Decision:` or `Root cause:`, and no durable wiki update is detected, a pending cleanup candidate is written to `llm-wiki/outputs/maintenance/queue.md` with a local `signal_level` such as `explicit`, `high`, `low`, or `recovered`. `PreCompact` performs the same answer-first classification before context compaction: simple turns get only a context note, archive-worthy turns get a live Q&A checkpoint, and explicit/structured durable candidates get a checkpoint plus queue item only when needed. If checkpoint storage fails, compaction still proceeds and the hook prepares an important-only compact recovery packet for the next legal context-injection event. `SessionStart` and `UserPromptSubmit` also recover stale per-turn state into the same queue when the previous stop hook did not complete. `SessionStart` injects a one-item queue summary and applies deterministic queue lifecycle hygiene; `UserPromptSubmit` injects a compact soft reminder only for wiki/maintenance prompts, approved items, explicit durable requests, recovered items, or when the queue crosses the batch review threshold. This is a recovery and reminder layer, not a full transcript capture path.
|
|
151
151
|
|
|
152
152
|
Use `llm-wiki archive-questions --workspace <project> --dry-run` to review splitting legacy `outputs/questions/YYYY-MM-DD-live-qa.md` files into the chunked layout. Running it without `--dry-run` preserves the original under `outputs/questions/archive/originals/` with a checksum sidecar and replaces the legacy file with a pointer stub.
|
|
153
153
|
|
|
@@ -210,11 +210,11 @@ Broken links, invalid source IDs, and secret-like content are errors and return
|
|
|
210
210
|
|
|
211
211
|
Agents may run `consolidate` after meaningful wiki growth. Users should not need to run it after every turn.
|
|
212
212
|
|
|
213
|
-
`llm-wiki maintenance --workspace <project>` prints queue counts, review due status, and the first pending items. It does not merge wiki pages by itself; the active agent should review pending or approved items, update the closest existing durable wiki document, then mark the queue item `done` or `skipped`. Periodic maintenance is an agent-side task, not something users need to run after every turn.
|
|
213
|
+
`llm-wiki maintenance --workspace <project>` prints queue counts, review due status, and the first pending items. It does not merge wiki pages by itself; the active agent should batch-review pending or approved items, update the closest existing durable wiki document only for explicit, repeated, or clearly reusable facts, then mark the queue item `done` or `skipped`. Periodic maintenance is an agent-side task, not something users need to run after every turn.
|
|
214
214
|
|
|
215
|
-
`llm-wiki maintenance --workspace <project> --apply-lifecycle --dry-run` previews automatic queue hygiene. Running it without `--dry-run`
|
|
215
|
+
`llm-wiki maintenance --workspace <project> --apply-lifecycle --dry-run` previews automatic queue hygiene. Running it without `--dry-run` keeps explicit/high-signal pending candidates pending for batch review when pending reaches 15, skips low-signal pending candidates older than 14 days, never auto-skips explicit requests or recovered `result_missing` items, and moves old `done`/`skipped` items beyond the latest 10 into `outputs/maintenance/archive/YYYY-MM.md`. The lifecycle never writes durable wiki pages automatically and never auto-approves page promotion; it only keeps the review queue bounded and prioritized. Hooks run the same lifecycle on `SessionStart`/`InstructionsLoaded`, while `UserPromptSubmit` only surfaces reminders.
|
|
216
216
|
|
|
217
|
-
`llm-wiki maintenance --workspace <project> --json` includes `reviewDue`, `reviewReasons`, `pendingCount`, `stalePendingCount`, `health`, `recommendedCommands`, and lifecycle action counts when lifecycle is applied. Review is due when the last review is older than 14 days, pending queue size reaches
|
|
217
|
+
`llm-wiki maintenance --workspace <project> --json` includes `reviewDue`, `reviewReasons`, `pendingCount`, `stalePendingCount`, `health`, `recommendedCommands`, and lifecycle action counts when lifecycle is applied. Review is due when the last review is older than 14 days, pending queue size reaches 15, stale or result-missing pending items exist, lint has warnings/errors, `memory.md` is near budget, or wiki page count reaches 80% of the search cap. Hook reminders are soft: `SessionStart`/`InstructionsLoaded` may show a short due note, while `UserPromptSubmit` shows one compact item only for wiki/maintenance prompts, approved items, explicit durable requests, recovered items, or batch review threshold pressure. The reminder never blocks the current answer.
|
|
218
218
|
|
|
219
219
|
Recommended agent checklist:
|
|
220
220
|
|
package/docs/troubleshooting.md
CHANGED
|
@@ -229,7 +229,7 @@ Check:
|
|
|
229
229
|
|
|
230
230
|
## Maintenance Queue Is Empty Or Stale
|
|
231
231
|
|
|
232
|
-
In the default answer-first mode, `llm-wiki/outputs/maintenance/queue.md` is created when a user explicitly asked for durable recording/documentation, a turn
|
|
232
|
+
In the default answer-first mode, `llm-wiki/outputs/maintenance/queue.md` is created when a user explicitly asked for durable recording/documentation, a turn has a structured durable conclusion, or stale per-turn state is recovered, and no durable wiki update was detected. It is not expected to grow after every normal `Stop`, and ordinary durable words inside a work summary are not enough by themselves.
|
|
233
233
|
|
|
234
234
|
Check the queue and health warnings:
|
|
235
235
|
|
|
@@ -239,7 +239,7 @@ llm-wiki maintenance --workspace /path/to/project --apply-lifecycle --dry-run
|
|
|
239
239
|
llm-wiki lint --workspace /path/to/project
|
|
240
240
|
```
|
|
241
241
|
|
|
242
|
-
If the queue is always empty during ordinary Q&A, that is normal. If you expected an explicit documentation request or durable
|
|
242
|
+
If the queue is always empty during ordinary Q&A, that is normal. If you expected an explicit documentation request or structured durable conclusion to queue, confirm hooks run and that the turn had a captured `UserPromptSubmit`. If pending items stay around, the active agent should batch-review them, merge only explicit, repeated, or clearly reusable content into existing durable wiki pages, and mark each item `done` or `skipped` without delaying unrelated answers. When pending reaches the lifecycle threshold, `--apply-lifecycle` keeps candidates pending for batch review, skips stale low-signal items, and archives old reviewed entries; it does not create durable wiki pages automatically or auto-approve promotion.
|
|
243
243
|
|
|
244
244
|
## Authentication Values Were Redacted
|
|
245
245
|
|
package/package.json
CHANGED
package/src/capture-policy.js
CHANGED
|
@@ -123,7 +123,8 @@ export function classifyTurn(entry, eventName = '') {
|
|
|
123
123
|
const hasVerification = Boolean(verification);
|
|
124
124
|
const hasWorkEvidence = hasWork || hasFiles || hasVerification;
|
|
125
125
|
const durableConclusion = hasDurableConclusion(text);
|
|
126
|
-
const
|
|
126
|
+
const durableKeyword = hasDurableKeyword(text);
|
|
127
|
+
const durableSignal = durableConclusion || durableKeyword;
|
|
127
128
|
const durableUpdated = hasDetectedDurableWikiChange(entry);
|
|
128
129
|
|
|
129
130
|
if (hasWorkEvidence) {
|
|
@@ -135,7 +136,7 @@ export function classifyTurn(entry, eventName = '') {
|
|
|
135
136
|
queueIfMissingDurable: false,
|
|
136
137
|
};
|
|
137
138
|
}
|
|
138
|
-
if (
|
|
139
|
+
if (durableConclusion) {
|
|
139
140
|
return {
|
|
140
141
|
kind: 'suggest-durable',
|
|
141
142
|
archive: true,
|
|
@@ -144,6 +145,14 @@ export function classifyTurn(entry, eventName = '') {
|
|
|
144
145
|
signalLevel: durableSignalLevel({ durableConclusion, hasFiles, hasVerification, durableSignal }),
|
|
145
146
|
};
|
|
146
147
|
}
|
|
148
|
+
if (durableKeyword) {
|
|
149
|
+
return {
|
|
150
|
+
kind: 'work',
|
|
151
|
+
archive: true,
|
|
152
|
+
suggestDurable: false,
|
|
153
|
+
queueIfMissingDurable: false,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
147
156
|
return {
|
|
148
157
|
kind: 'work',
|
|
149
158
|
archive: true,
|
package/src/compact-capture.js
CHANGED
|
@@ -204,7 +204,7 @@ export async function handlePreCompactCapture(projectRoot, provider, eventName,
|
|
|
204
204
|
followUp: appendToField(
|
|
205
205
|
entry.followUp,
|
|
206
206
|
classification.suggestDurable
|
|
207
|
-
? 'PreCompact saved this checkpoint and queued durable
|
|
207
|
+
? 'PreCompact saved this checkpoint and queued batch durable review; merge only if it remains reusable with related candidates.'
|
|
208
208
|
: 'PreCompact saved this checkpoint before context compaction; reusable facts should be merged only when appropriate.'
|
|
209
209
|
),
|
|
210
210
|
};
|
|
@@ -220,7 +220,7 @@ export async function handlePreCompactCapture(projectRoot, provider, eventName,
|
|
|
220
220
|
const result = await recordMaintenanceForEntry(projectRoot, entry, {
|
|
221
221
|
source: liveQaPath,
|
|
222
222
|
eventName,
|
|
223
|
-
reason: 'PreCompact durable
|
|
223
|
+
reason: 'PreCompact structured durable checkpoint is waiting for batch review after context compaction.',
|
|
224
224
|
signalLevel: classification.signalLevel,
|
|
225
225
|
});
|
|
226
226
|
if (result.created === false && result.reason) {
|
package/src/hook.js
CHANGED
|
@@ -90,12 +90,12 @@ function durableQueueReason(classification) {
|
|
|
90
90
|
if (classification.kind === 'explicit-durable') {
|
|
91
91
|
return 'Explicit durable documentation request did not have a detected durable wiki update.';
|
|
92
92
|
}
|
|
93
|
-
return '
|
|
93
|
+
return 'Structured durable conclusion is waiting for batch review.';
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
function durableFollowUp(entry, classification) {
|
|
97
97
|
if (!classification.suggestDurable) return entry.followUp;
|
|
98
|
-
const message = 'This turn
|
|
98
|
+
const message = 'This turn has a structured durable conclusion. Keep it in the maintenance queue for batch review; merge only if it remains reusable with related candidates, otherwise mark it skipped.';
|
|
99
99
|
const current = String(entry.followUp || '').trim();
|
|
100
100
|
if (!current || current === '(not captured)') return message;
|
|
101
101
|
if (current.includes(message)) return current;
|
package/src/maintenance.js
CHANGED
|
@@ -11,7 +11,7 @@ export const MAINTENANCE_QUEUE_REL = 'llm-wiki/outputs/maintenance/queue.md';
|
|
|
11
11
|
const DEFAULT_STALE_TURN_MS = 10 * 60 * 1000;
|
|
12
12
|
const DEFAULT_STALE_PENDING_DAYS = 7;
|
|
13
13
|
const DEFAULT_PENDING_LIMIT = 20;
|
|
14
|
-
const DEFAULT_REVIEW_PENDING_LIMIT =
|
|
14
|
+
const DEFAULT_REVIEW_PENDING_LIMIT = 15;
|
|
15
15
|
const DEFAULT_REVIEW_INTERVAL_DAYS = 14;
|
|
16
16
|
const DEFAULT_LIFECYCLE_PENDING_THRESHOLD = 15;
|
|
17
17
|
const DEFAULT_LOW_SIGNAL_SKIP_DAYS = 14;
|
|
@@ -27,10 +27,10 @@ function queueHeader() {
|
|
|
27
27
|
return [
|
|
28
28
|
'# LLM Wiki Maintenance Queue',
|
|
29
29
|
'',
|
|
30
|
-
'Candidates
|
|
30
|
+
'Candidates for batch durable wiki review. Hooks only create candidates; the active agent merges only explicit, repeated, or clearly reusable facts into existing durable wiki documents.',
|
|
31
31
|
'',
|
|
32
32
|
'Status values: pending, approved, done, skipped.',
|
|
33
|
-
'Lifecycle keeps
|
|
33
|
+
'Lifecycle keeps candidates pending until batch review, may skip old low-signal candidates, and archives old reviewed items.',
|
|
34
34
|
'',
|
|
35
35
|
].join('\n');
|
|
36
36
|
}
|
|
@@ -70,6 +70,7 @@ function inferSignalLevelFromReason(reason, resultMissing = false) {
|
|
|
70
70
|
if (resultMissing || text.includes('recovered from stale turn state')) return 'recovered';
|
|
71
71
|
if (text.includes('explicit durable documentation request')) return 'explicit';
|
|
72
72
|
if (text.includes('precompact durable candidate')) return 'high';
|
|
73
|
+
if (text.includes('structured durable conclusion')) return 'high';
|
|
73
74
|
if (text.includes('suggested durable wiki candidate')) return 'high';
|
|
74
75
|
if (text.includes('durable wiki review')) return 'high';
|
|
75
76
|
return 'high';
|
|
@@ -293,29 +294,6 @@ export async function applyMaintenanceLifecycle(projectRoot, options = {}) {
|
|
|
293
294
|
nextItems = nextItems.map((item) => {
|
|
294
295
|
if (item.status !== 'pending') return item;
|
|
295
296
|
const signal = signalLevelForItem(item);
|
|
296
|
-
if (signal === 'explicit' || signal === 'high') {
|
|
297
|
-
approvedByLifecycle += 1;
|
|
298
|
-
actions.push(lifecycleAction('approve', item, { reason: `pending threshold ${defaults.pendingThreshold} reached` }));
|
|
299
|
-
const target = item.target || item.suggested_target || '';
|
|
300
|
-
const reviewNote = sanitizeField('Auto-approved by lifecycle because the pending queue reached the review threshold.', 500);
|
|
301
|
-
return {
|
|
302
|
-
...item,
|
|
303
|
-
status: 'approved',
|
|
304
|
-
signal_level: signal,
|
|
305
|
-
target,
|
|
306
|
-
reviewed_at: now,
|
|
307
|
-
last_seen_at: now,
|
|
308
|
-
review_note: item.review_note || reviewNote,
|
|
309
|
-
fields: {
|
|
310
|
-
...(item.fields || {}),
|
|
311
|
-
signal_level: signal,
|
|
312
|
-
...(target ? { target } : {}),
|
|
313
|
-
reviewed_at: now,
|
|
314
|
-
last_seen_at: now,
|
|
315
|
-
review_note: item.review_note || reviewNote,
|
|
316
|
-
},
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
297
|
if (signal === 'low' && isStaleByDays(item, defaults.lowSignalSkipDays)) {
|
|
320
298
|
skippedByLifecycle += 1;
|
|
321
299
|
actions.push(lifecycleAction('skip', item, { reason: `low-signal item older than ${defaults.lowSignalSkipDays} days` }));
|
|
@@ -403,7 +381,7 @@ export function summarizeMaintenanceQueue(queue, options = {}) {
|
|
|
403
381
|
.filter(Number.isFinite);
|
|
404
382
|
const lastReviewMs = reviewTimes.length > 0 ? Math.max(...reviewTimes) : null;
|
|
405
383
|
const reviewReasons = [];
|
|
406
|
-
if (approved.length > 0) reviewReasons.push(`approved queue has ${approved.length} item(s) ready for durable wiki
|
|
384
|
+
if (approved.length > 0) reviewReasons.push(`approved queue has ${approved.length} item(s) ready for manual durable wiki review`);
|
|
407
385
|
if (pending.length >= reviewPendingLimit) reviewReasons.push(`pending queue has ${pending.length} items (threshold ${reviewPendingLimit})`);
|
|
408
386
|
if (stalePending.length > 0) reviewReasons.push(`${stalePending.length} pending item(s) older than ${staleDays} days`);
|
|
409
387
|
if (pending.some((item) => item.result_missing)) reviewReasons.push('pending recovered turn state needs review');
|
|
@@ -622,28 +600,30 @@ export async function recoverStaleTurnStates(projectRoot, options = {}) {
|
|
|
622
600
|
return output;
|
|
623
601
|
}
|
|
624
602
|
|
|
625
|
-
function
|
|
626
|
-
|
|
603
|
+
function isExplicitDurableCandidate(item) {
|
|
604
|
+
const signal = signalLevelForItem(item);
|
|
605
|
+
if (signal === 'explicit') return true;
|
|
627
606
|
const text = `${item?.reason || ''} ${item?.fields?.reason || ''}`.toLowerCase();
|
|
628
|
-
return /
|
|
607
|
+
return /explicit durable documentation/.test(text);
|
|
629
608
|
}
|
|
630
609
|
|
|
631
610
|
function shouldSurfacePromptMaintenance(summary, query, reviewCandidates) {
|
|
632
611
|
if (isMaintenanceRelatedQuery(query || '', reviewCandidates)) return true;
|
|
633
612
|
if ((summary.approvedCount || 0) > 0) return true;
|
|
634
|
-
if (reviewCandidates.some(
|
|
613
|
+
if (reviewCandidates.some(isExplicitDurableCandidate)) return true;
|
|
635
614
|
if ((summary.pendingCount || 0) >= (summary.reviewPendingLimit || DEFAULT_REVIEW_PENDING_LIMIT)) return true;
|
|
636
|
-
if ((summary.stalePendingCount || 0) > 0) return true;
|
|
637
615
|
return reviewCandidates.some((item) => item.result_missing);
|
|
638
616
|
}
|
|
639
617
|
|
|
640
618
|
export function formatMaintenanceContext(summary, options = {}) {
|
|
641
|
-
if (!summary.reviewDue) return '';
|
|
642
619
|
const language = options.language === 'ko' ? 'ko' : 'en';
|
|
643
620
|
const eventName = options.eventName || '';
|
|
644
621
|
const defaultLimit = eventName === 'SessionStart' || eventName === 'InstructionsLoaded' ? 1 : 5;
|
|
645
622
|
const limit = options.limit || defaultLimit;
|
|
646
623
|
const reviewCandidates = [...(summary.approved || []), ...(summary.pending || [])];
|
|
624
|
+
const maintenancePrompt = eventName === 'UserPromptSubmit' &&
|
|
625
|
+
isMaintenanceRelatedQuery(options.query || '', reviewCandidates);
|
|
626
|
+
if (!summary.reviewDue && !maintenancePrompt) return '';
|
|
647
627
|
let pending = reviewCandidates.slice(0, limit);
|
|
648
628
|
|
|
649
629
|
if (eventName === 'UserPromptSubmit') {
|
|
@@ -654,16 +634,19 @@ export function formatMaintenanceContext(summary, options = {}) {
|
|
|
654
634
|
}
|
|
655
635
|
|
|
656
636
|
const reviewCount = (summary.approvedCount || 0) + (summary.pendingCount || 0);
|
|
637
|
+
const reviewDueText = summary.reviewDue
|
|
638
|
+
? `yes (${(summary.reviewReasons || []).slice(0, 2).join('; ') || 'periodic review threshold met'})`
|
|
639
|
+
: 'no (maintenance prompt)';
|
|
657
640
|
const lines = language === 'ko'
|
|
658
641
|
? [
|
|
659
642
|
'LLM Wiki maintenance status:',
|
|
660
|
-
`- review due:
|
|
661
|
-
`- approved/pending review items: ${reviewCount}. 현재 요청이
|
|
643
|
+
`- review due: ${reviewDueText}.`,
|
|
644
|
+
`- approved/pending review items: ${reviewCount}. 현재 요청이 우선이다. 후보는 충분히 쌓인 뒤 batch review에서 관련 항목만 durable wiki에 병합하고, 나머지는 skipped로 표시한다.`,
|
|
662
645
|
]
|
|
663
646
|
: [
|
|
664
647
|
'LLM Wiki maintenance status:',
|
|
665
|
-
`- review due:
|
|
666
|
-
`- approved/pending review items: ${reviewCount}. The current request comes first
|
|
648
|
+
`- review due: ${reviewDueText}.`,
|
|
649
|
+
`- approved/pending review items: ${reviewCount}. The current request comes first. Review candidates in batches after enough have accumulated, merge only relevant durable facts, and mark the rest skipped.`,
|
|
667
650
|
];
|
|
668
651
|
for (const item of pending) {
|
|
669
652
|
const target = item.target || item.suggested_target;
|
package/src/templates.js
CHANGED
|
@@ -16,9 +16,9 @@ This repository uses llm-wiki-kit as a hook-first living Markdown wiki for Codex
|
|
|
16
16
|
- Keep \`llm-wiki/wiki/memory.md\` short. Link to important documents instead of copying long explanations.
|
|
17
17
|
- Use hook-injected context when helpful, but answer the current user request first. Use \`llm-wiki context\`, \`llm-wiki lint\`, and \`llm-wiki consolidate\` only as agent maintenance helpers.
|
|
18
18
|
- Hooks safely store redacted raw envelopes and work/decision-focused live Q&A. Simple answers, status checks, and keyword-only turns should not be promoted to live Q&A or durable wiki by default.
|
|
19
|
-
- Hooks may queue durable cleanup candidates in \`llm-wiki/outputs/maintenance/queue.md\` at stop/start boundaries.
|
|
19
|
+
- Hooks may queue durable cleanup candidates in \`llm-wiki/outputs/maintenance/queue.md\` at stop/start boundaries. Lifecycle keeps candidates pending for batch review, skips stale low-signal candidates, and archives old reviewed items, but it never creates durable wiki pages automatically. Treat maintenance as a soft agent-side reminder; merge only explicit, repeated, or clearly reusable facts after enough candidates accumulate, then mark items \`done\` or \`skipped\`.
|
|
20
20
|
- Before creating new wiki pages, search existing pages and update the right one when possible. Reusable facts should not stay only in chunked \`outputs/questions/\`.
|
|
21
|
-
- Store one-off work or decision records in \`llm-wiki/outputs/questions/YYYY-MM-DD/live-qa-001.md\` when needed. Merge reusable knowledge into \`wiki/architecture/\`, \`wiki/debugging/\`, \`wiki/decisions/\`, \`wiki/concepts/\`, or \`procedures/\` when
|
|
21
|
+
- Store one-off work or decision records in \`llm-wiki/outputs/questions/YYYY-MM-DD/live-qa-001.md\` when needed. Merge reusable knowledge into \`wiki/architecture/\`, \`wiki/debugging/\`, \`wiki/decisions/\`, \`wiki/concepts/\`, or \`procedures/\` only when explicitly requested, repeated across related candidates, or clearly important.
|
|
22
22
|
- Record verification commands, evidence files, and uncertainty. Mark inference explicitly and preserve contradictions in Open Questions or Contradictions.
|
|
23
23
|
- Never store credentials, tokens, passwords, private keys, or raw \`.env\` contents. Store only redacted summaries when needed.
|
|
24
24
|
|
|
@@ -65,10 +65,10 @@ These rules replace older OMX/OMC/\`omx_wiki/\` rules for this project.
|
|
|
65
65
|
- Important claims should include at least one of: \`source_ids\`, file paths, or verification commands.
|
|
66
66
|
- When durable knowledge appears, search existing \`wiki/\` pages before creating a new page.
|
|
67
67
|
- Do not promote simple answers, status checks, keyword-only replies, or one-off chat into live Q&A, \`wiki/queries\`, or maintenance.
|
|
68
|
-
- Hooks may flag
|
|
69
|
-
- Merge reusable knowledge into \`wiki/architecture/\`, \`wiki/debugging/\`, \`wiki/decisions/\`, \`wiki/concepts/\`, or \`procedures/\`
|
|
70
|
-
- Review \`outputs/maintenance/queue.md\` pending or approved items when surfaced by hook context, related to the current request, or review is due.
|
|
71
|
-
- Periodic maintenance is agent review, not automatic page creation. Session-start lifecycle
|
|
68
|
+
- Hooks may flag explicit documentation requests, structured conclusions, and recovered work as durable wiki candidates. Treat those as batch review prompts, not automatic page creation.
|
|
69
|
+
- Merge reusable knowledge into \`wiki/architecture/\`, \`wiki/debugging/\`, \`wiki/decisions/\`, \`wiki/concepts/\`, or \`procedures/\` only when explicitly requested, repeated across related candidates, or clearly important.
|
|
70
|
+
- Review \`outputs/maintenance/queue.md\` pending or approved items when surfaced by hook context, related to the current request, or review is due. Batch related candidates, merge only durable reusable facts into existing wiki pages, then mark items \`done\` or \`skipped\`.
|
|
71
|
+
- Periodic maintenance is agent review, not automatic page creation. Session-start lifecycle keeps candidates pending for batch review, skips stale low-signal items, and archives old reviewed items. Show only short reminders at \`SessionStart\`/\`InstructionsLoaded\`, and compact prompt-time reminders only for explicit documentation, recovered state, maintenance prompts, or batch review thresholds.
|
|
72
72
|
- Keep \`wiki/memory.md\` short. Use links to current state and important documents instead of long explanations.
|
|
73
73
|
- Preserve contradictions in \`Contradictions\` or \`Open Questions\`; do not overwrite them silently.
|
|
74
74
|
- Do not store credentials, tokens, passwords, private keys, or raw \`.env\` contents in wiki.
|
|
@@ -107,7 +107,7 @@ superseded_by: []
|
|
|
107
107
|
- query: use hook-injected context when useful, but answer the current request first. Manual commands are diagnostics, not required daily workflow.
|
|
108
108
|
- lint: agent helper for user-requested or wiki maintenance work. Do not run it every turn.
|
|
109
109
|
- consolidate: safely refresh generated blocks in \`memory.md\`/\`index.md\`. Do not overwrite handwritten sections or curated document bodies.
|
|
110
|
-
- maintenance: \`outputs/maintenance/queue.md\` stores stop/start cleanup candidates. Review surfaced durable candidates without delaying the current user request, then mark
|
|
110
|
+
- maintenance: \`outputs/maintenance/queue.md\` stores stop/start cleanup candidates. Review surfaced durable candidates in batches without delaying the current user request, merge only durable reusable facts, then mark items \`done\` or \`skipped\`. Use \`llm-wiki maintenance --workspace <project> --apply-lifecycle --dry-run\` when queue hygiene needs inspection.
|
|
111
111
|
`;
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -200,7 +200,7 @@ export function procedure(name) {
|
|
|
200
200
|
3. Create or update \`wiki/sources/<slug>.md\` only when a source summary is useful.
|
|
201
201
|
4. Before creating a new page, look for related concept/entity/decision/architecture/debugging/context pages and update those first.
|
|
202
202
|
5. Do not create duplicates. Merge facts into existing pages when they already exist.
|
|
203
|
-
6. Do not promote simple answers or one-off chat into durable wiki
|
|
203
|
+
6. Do not promote simple answers or one-off chat into durable wiki. Let queued candidates accumulate for batch review unless the user explicitly requested documentation.
|
|
204
204
|
7. Important claims should record source references, confidence, memory type, importance, and verification status.
|
|
205
205
|
8. When durable entry points change, update \`wiki/memory.md\` briefly or use \`llm-wiki consolidate\`.
|
|
206
206
|
9. Add a short entry to \`wiki/log.md\` for meaningful wiki changes.
|
|
@@ -213,8 +213,8 @@ export function procedure(name) {
|
|
|
213
213
|
4. Inspect raw sources only when exact evidence matters.
|
|
214
214
|
5. Separate verified facts from inference.
|
|
215
215
|
6. Use \`llm-wiki context "<query>"\` only when manual inspection is useful. Add \`--include-episodic\` only for historical query/context pages, and \`--include-archived\` only for archived/superseded pages.
|
|
216
|
-
7. Do not promote one-off answers, status checks, or keyword-only replies to durable wiki or live Q&A. Archive
|
|
217
|
-
8. Merge reusable facts into \`wiki/architecture/\`, \`wiki/debugging/\`, \`wiki/decisions/\`, \`wiki/concepts/\`, or \`procedures/\`
|
|
216
|
+
7. Do not promote one-off answers, status checks, or keyword-only replies to durable wiki or live Q&A. Archive work turns with tool evidence, changed-file evidence, verification, structured decision/debugging conclusions, or explicit durable requests.
|
|
217
|
+
8. Merge reusable facts into \`wiki/architecture/\`, \`wiki/debugging/\`, \`wiki/decisions/\`, \`wiki/concepts/\`, or \`procedures/\` only when explicitly requested, repeated across related candidates, or clearly important.
|
|
218
218
|
`,
|
|
219
219
|
'lint.md': `# Lint Procedure
|
|
220
220
|
|
|
@@ -227,7 +227,7 @@ Periodic maintenance is an agent-side task, not a per-turn user command. When ne
|
|
|
227
227
|
1. \`llm-wiki lint --workspace <project>\`
|
|
228
228
|
2. \`llm-wiki maintenance --workspace <project>\`
|
|
229
229
|
3. \`llm-wiki maintenance --workspace <project> --apply-lifecycle --dry-run\`
|
|
230
|
-
4.
|
|
230
|
+
4. Review pending or approved durable candidates in batches; merge only explicit, repeated, or clearly reusable facts into existing durable pages, then mark items \`done\` or \`skipped\`.
|
|
231
231
|
5. \`llm-wiki consolidate --workspace <project> --dry-run\`
|
|
232
232
|
6. Run \`llm-wiki consolidate --workspace <project>\` when the dry run is acceptable.
|
|
233
233
|
|