-
Notifications
You must be signed in to change notification settings - Fork 4
Maintenance and Diagnostics
Language: English · 简体中文
Diagnostics identifies whether a defect belongs to canonical knowledge, durable Work, or a derived projection. Maintenance rebuilds or compacts derived artifacts without changing Source or Page knowledge; recovery restores an intended state after failure. Start with the narrowest command that repairs the demonstrated problem.
Use this order:
- Wait or resume Work when canonical state is correct and execution stopped.
- Rebuild one derived projection when Markdown, FTS, document graph, or CodeGraph is stale.
- Changeset rollback to undo one committed logical update while preserving unrelated later writes.
- Checkpoint restore to return the complete Wiki database to an earlier point.
Do not jump to full restore for a missing generated file or stale graph edge.
lwc --scope project lint --limit 100
lwc --scope project work list
lwc --scope project graph status
lwc --scope project graph verify
lwc --scope project cg status
lwc --scope project checkpoint listRecord current revision, operation ID, active Work, graph engine, and the exact inconsistent artifact. A repair without a precondition and acceptance check is not auditable.
Use when .lwc/wiki/, .lwc/raw/, schema.md, purpose.md, index.md, overview.md, or log.md is missing or stale while SQLite reads are correct:
lwc --scope project maintenance materialize
lwc --scope project work watch <work-id>
lwc --scope project lintMaterialization rebuilds the complete owned projection. It replaces or removes only manifest-owned artifacts; user files and raw assets outside LWC ownership are preserved.
Never edit generated files as the repair.
Use only when lint reports missing, duplicate, or orphan FTS rows, or after a documented tokenizer migration:
lwc --scope project maintenance reindex
lwc --scope project work watch <work-id>
lwc --scope project lint
lwc --scope project search "known answer" --limit 5 --explainReindex transactionally recreates document FTS and span indexes from immutable Sources and current Pages, then refreshes the Markdown operation log. It does not rewrite Page knowledge or retrieval adjustments.
Run during an idle maintenance window:
lwc --scope project maintenance compact
lwc --scope project work watch <work-id>Compaction optimizes FTS and attempts a WAL TRUNCATE checkpoint. Inspect busy, before_bytes, and after_bytes in the Work result. busy=true means an active reader prevented complete truncation; it is not permission to kill the reader or delete WAL files.
When canonical Wiki and search are healthy but graph verify reports drift, set the intended engine explicitly to queue a full projection:
lwc --scope project config set --graph grafeo
lwc --scope project work watch <work-id>
lwc --scope project graph verifyUse surrealdb in all three decisions if that is the selected engine. Do not switch engines merely to repair one; rebuild and verify the intended engine.
Draft graph recovery must keep the same changeset selector. Live and draft Work roots and graph sidecars are intentionally isolated.
lwc --scope project work status <work-id>
lwc --scope project work resume <work-id>
lwc --scope project work watch <work-id>Resume only after fixing the cause. It is allowed for failed, cancelled, or stale interrupted Work. Succeeded or fresh active Work returns work_not_resumable.
If the parent command returned a canonical partial-success recovery command, follow that command instead of resuming blindly. It may need to reconstruct missing graph documents or finish cleanup before Work can proceed.
A failed commit can be in one of two broad states:
- no canonical merge: fix conflict or draft issue, then commit again;
-
canonical_committed=true: do not restage writes; repeat the documented idempotent commit recovery and retain the draft until cleanup succeeds.
For an already committed update:
lwc --scope project changeset rollback <changeset-id>
lwc --scope project work watch <graph-work-id>
lwc --scope project graph verifyRollback refuses touched entities changed by later writes. There is no force option. If rollback reports canonical partial success, repeat the exact rollback command from details.
Use checkpoint restore only when the whole database must return to a known boundary:
lwc --scope project checkpoint restore <checkpoint-name>
lwc --scope project work watch <graph-work-id>
lwc --scope project lint
lwc --scope project graph verifyRestore first creates a pre-restore-* safety checkpoint. Keep it until canonical, Markdown, retrieval, and graph acceptance all pass.
A prepared checkpoint that is invalid returns checkpoint_restored=false. If canonical restore succeeds but projection fails, details contain checkpoint_restored=true, safety checkpoint, and exact recovery commands.
lwc --scope project cg status
lwc --scope project cg syncUse cg sync for normal project-file changes. If the project index was never initialized, use cg init with explicit consent. LWC reuses the verified global runtime and keeps project index ownership local.
Do not invoke blocked CodeGraph global lifecycle commands through lwc cg, move .codegraph state into the project, or register CodeGraph as a separate MCP server.
Opening an older supported Store may queue or run a migration before the requested operation. Long migrations use shadow-copy Work and preserve a safety checkpoint.
Watch the returned Work and inspect its result. An unknown newer format returns unsupported_store_version; use a compatible LWC version rather than editing PRAGMA user_version.
Every recovery should finish with the checks relevant to the incident:
lwc --scope project lint
lwc --scope project search "expected wording" --limit 5
lwc --scope project search "natural paraphrase" --limit 5
lwc --scope project graph verify
lwc --scope project work listAlso read back the affected Page, Source path head, tag membership, or checkpoint state directly. A command exit status is not enough when the incident involved partial success.
- deleting
wiki.db-walorwiki.db-shm; - editing SQLite, FTS, Work JSON, graph sidecars, or generated Markdown;
- discarding a failed draft before diagnosis;
- using lint override to hide new issues;
- force-copying one draft's runtime into another;
- restoring a checkpoint without preserving and recording the automatic safety checkpoint;
- running repeated full rebuilds without identifying the drift source.
Next: Security and privacy
LWC Wiki
- Home · 首页
- Project overview · 项目简介
- Basic concepts · 基本概念
- Use cases · 应用场景
- Installation and upgrades · 安装与升级
- Quick start · 快速开始
- Persistent memory · 持久记忆体系
- Agent workflow and memory policy · Agent 工作流与主动记忆策略
- Sources and ingestion · 来源与知识整合
- Wiki pages and provenance · Wiki 页面与来源证明
- Search and context · 搜索与上下文载入
- Document knowledge graph · 文档知识图(记忆图网)
- Code graph · 代码图
- Word graph · 词图
- Tags and strong context · 标签与强上下文
- Document conversion · 文档转换
-
MCP server and
lwc_explore· MCP 服务与lwc_explore - Skills, Hooks, and Instructions · Skills、Hooks 与 Instructions
- AgentTarget installation · AgentTarget 安装与集成
- Changesets · Changeset 原子变更
- Work system · Work 任务系统
- Checkpoints and rollback · Checkpoint、恢复与回滚
- Read-only Viewer · 只读可视化界面
- Architecture overview · 总体架构
- Storage and data model · 存储与数据模型
- Retrieval and indexing · 检索与索引设计
- Graph projection and performance · 图投影与性能设计
- MCP, Hooks, and AgentTarget design · MCP、Hook 与 AgentTarget 设计
- Safety and trust boundaries · 安全模型与信任边界
- Maintenance and diagnostics · 维护与诊断
- Troubleshooting and FAQ · 故障排查与常见问题
- Migration and compatibility · 迁移与版本兼容
- Support and issue reporting · 获取帮助与问题反馈
- CLI and configuration reference · CLI 与配置参考
- JSON output and error contract · JSON 输出与错误契约
- Limits and glossary · 系统限制与术语表
- Contributing and development · 贡献与开发指南
- Testing and release process · 测试与发布流程
- Wiki style guide · Wiki 编写规范