-
Notifications
You must be signed in to change notification settings - Fork 4
Basic Concepts
Language: English · 简体中文
This page defines the terms used throughout the LWC documentation. Understanding the separation between canonical knowledge, derived indexes, and Agent workflow prevents most operational mistakes.
An LWC Wiki is one SQLite database plus its rebuildable local projections. It stores immutable Sources, Agent-maintained Pages, citations, provenance, links, ingest state, retrieval state, and operation history.
The database is canonical. Do not edit wiki.db, its WAL files, generated Markdown, Work records, changeset databases, or graph sidecars by hand.
Scope answers where knowledge belongs.
| Scope | Meaning | Typical content |
|---|---|---|
project |
The nearest initialized project Wiki discovered from the current directory | Repository architecture, local decisions, runbooks, project sources |
global |
The current user's cross-project Wiki | Stable preferences and reusable practices |
all |
A merged read view of project and global memory | Bounded search and context only |
all is never a write target. In normal project work, run lwc from the project directory. Set LWC_PROJECT_ROOT only when one command must target an explicitly selected project boundary; do not export it for routine use.
Every Wiki has two durable governance documents:
- Purpose states the Wiki's goal, important questions, and scope.
- Schema defines page types, provenance rules, linking conventions, and maintenance expectations.
Agents receive both documents during bounded context recall and source ingestion. They guide maintenance, but they never override system, user, repository, or host security instructions.
A Source is an immutable UTF-8 snapshot of curated evidence. LWC identifies identical content by SHA-256 and separately records each observed path revision.
Adding a Source does not mean its knowledge has been integrated. It creates a pending ingest job. The Agent must read the complete source, analyze it, update the Wiki, and complete the job.
A Page is maintained knowledge written by an Agent. It has:
- a stable slug;
- a title and one-line summary;
- a kind such as
source,concept,entity,query,comparison, orsynthesis; - a Markdown body;
- citations to Sources;
- explicit provenance for knowledge that does not come from an immutable Source;
- outgoing Wiki links.
A kind=source page summarizes one Source for navigation. Shared knowledge belongs in non-source pages so that later evidence can revise the same concept instead of creating another detached summary.
Provenance explains why a page may make a claim.
| Value | Meaning |
|---|---|
source-grounded |
Derived automatically when the Page cites one or more Source IDs |
user-provided |
The user stated the durable fact or decision |
agent-observed |
The Agent verified the fact from current authorized evidence |
hypothesis |
A useful but unverified possibility, clearly labelled as such |
Never invent a Source citation. Do not store secrets, raw hidden reasoning, or unsupported guesses as facts.
An ingest job is the durable state machine that turns one Source into maintained knowledge:
pending -> analyzing -> generating -> completed
\-> failed -> pending (retry)
Completion normally requires both a cited source-summary Page and a cited non-source Page. If a Source genuinely adds no shared knowledge, the Agent records a specific audited reason instead of creating filler.
-
contextreturns the Purpose, Schema, Page index, and recent operations within a fixed limit. -
searchuses deterministic lexical retrieval and returns maintained Pages before raw Sources by default. -
spanresolves exact sentence or passage locators and expands nearby context.
Span locators include a document fingerprint. When a Page changes, an old locator fails with stale_span; LWC does not silently map it to similar text.
Wiki links express maintained page-to-page relationships. Citations connect Pages to Sources. LWC can project these facts, plus explicit semantic relations, into an optional document graph.
The graph is a derived index. Enable it only when traversal, path, neighborhood, impact, or visual exploration is useful. graph verify compares the projection with canonical SQLite state.
CodeGraph is a separate project-local index for checked-out code. It answers questions about files, symbols, definitions, callers, callees, dependencies, and impact. It is not the document graph and it is never registered as a second Agent MCP.
The runtime is downloaded once per user and version; each project keeps its own index under .lwc/codegraph.
Word Graph connects documents through shared tokenized terms. Token relationships are extremely dense, so LWC never loads the complete word network in one request. Queries require bounded terms, document limits, pagination, and server-side clamping. Treat the result as an exploratory sample, not a complete semantic graph.
A strong tag is an explicit membership list for a small set of core Pages. lwc load tag selects the highest-priority memberships up to a limit and returns each selected Page in full.
Strong tags are appropriate for rules and runbooks that must load deterministically. They are not search keywords and are not inferred from token frequency.
A changeset is an isolated sparse draft for a logical update that spans several mutations. The Agent can inspect, search, and lint the draft before publishing it atomically.
Commit records a guarded inverse patch and returns a changeset ID. Immediate rollback is allowed only while touched live entities remain unchanged. There is no force option.
Work is a durable background task record used for graph projection and maintenance. A command that returns a Work ID has queued activity; process exit does not prove the operation is complete.
Use work status or work watch and require state=succeeded. Failed or cancelled Work remains inspectable and may support an explicit resume.
A checkpoint is a validated full SQLite backup. Restore first preserves the current Wiki as a safety checkpoint, then restores and rebuilds derived material. Use checkpoints for large direct maintenance operations that cannot fit in a changeset.
LWC Agent integration has four main surfaces:
-
MCP: one read-only
lwc_exploretool for bounded memory, code, or combined exploration; - Skill: detailed guidance about when and how an Agent should use LWC;
- Hooks: bounded readiness and strong-tag context at supported lifecycle events;
- Instructions: a marked guidance block in the host's official global or project instruction file.
AgentTarget adapters install only surfaces officially supported by each host and report UI-owned, preview, or unavailable capabilities explicitly.
Next: Use cases
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 编写规范