Skip to content

Common Workflows and Recipes

JanYork edited this page Aug 14, 2026 · 1 revision

Common Workflows and Recipes

Language: English · 简体中文

This page turns LWC's individual commands into repeatable Agent workflows. Choose the smallest recipe that matches the task, preserve explicit scope, and finish with evidence rather than assuming that a queued action completed.

Choose LWC at the right time

Use LWC when work produces knowledge that should survive the current conversation: a verified architectural conclusion, an operational rule, a source-backed explanation, a recurring investigation, or a relationship that future tasks will need.

Skip durable writes for transient command output, unverified guesses, raw chain-of-thought, secrets, and results that are already clear from one cheap source lookup.

Recipe: start a project memory

Use once when the project has no Wiki:

lwc --scope project init
lwc --scope project purpose show
lwc --scope project schema show
lwc --scope project lint

Run from the project root or a descendant. Initialization does not enable document graph, install CodeGraph, or select a conversion engine. Offer those separately when the project will benefit from them.

Acceptance: lint completes, scope resolves to the intended project, and no unrelated repository file was added to Git.

Recipe: turn one document into maintained knowledge

lwc --scope project source add docs/design.md --title "Design source"
lwc --scope project ingest claim <source-id> --source-max-chars 100000
lwc --scope project ingest analyze <source-id> --file analysis.md
lwc --scope project page put source-<source-id> \
  --title "Design source summary" --kind source \
  --file source-summary.md --source <source-id>
lwc --scope project page put project-design \
  --title "Project design" --kind concept \
  --file project-design.md --source <source-id>
lwc --scope project ingest complete <source-id>
lwc --scope project lint

Read every Source window before writing conclusions. The source-summary Page answers “what does this evidence say?”; the shared Page answers “what does the project currently know?” Update an existing shared Page instead of creating one Page per document when the topic is the same.

Acceptance: the ingest job is completed, the shared Page cites the Source, lint is clean, and two fixed natural-language searches return the Page near the top.

Recipe: recall before investigating again

lwc --scope project context --limit 25
lwc --scope project search "how does release recovery work" --limit 5 --explain
lwc --scope project page show release-recovery

Search first, then open the exact Page and cited Sources needed for the decision. Use --scope all only when reusable global knowledge is relevant. Do not load the entire Wiki into the prompt.

If existing knowledge is stale, correct it after verifying current evidence; do not merely answer around it.

Recipe: preserve a verified answer

Use a query Page when an investigation is likely to recur and its answer is not already a stable concept Page:

lwc --scope project page put why-release-retries-are-safe \
  --title "Why release retries are safe" --kind query \
  --summary "Verified retry and idempotence boundaries" \
  --file verified-answer.md --source <source-id>
lwc --scope project lint

Record the conclusion, evidence, conditions, and known uncertainty. Do not preserve a transcript of the investigation.

Recipe: load mandatory rules without search

lwc --scope project tag set rules release-policy \
  --priority 100 --reason "Mandatory release boundary"
lwc --scope project tag autoload rules --enable \
  --priority 100 --limit 10 --max-chars 50000 \
  --reason "Load reviewed project rules at lifecycle boundaries"
lwc --scope project load tag rules --limit 10

Use a strong tag only for a small set of highly relevant core Pages. Tag membership is not a substitute for search taxonomy, and autoload is not a place for entire handbooks.

Acceptance: returned Pages are complete, ordered by membership priority, inside the character budget, and safe to include in every intended session.

Recipe: investigate document relationships

lwc --scope project graph status
lwc --scope project graph verify
lwc --scope project graph neighbors page:project-design --limit 50
lwc --scope project graph path page:project-design source:<source-id> --max-depth 4
lwc --scope project graph impact page:project-design --max-depth 4 --limit 100

Enable the document graph only with user consent. Verify it before relying on traversal. Use explicit semantic relations only for reviewed meaning that citations and Wiki links cannot express.

Recipe: investigate code structure

lwc --scope project cg status
lwc --scope project cg init
lwc --scope project cg status

Then use the Agent-facing lwc_explore tool in code mode for symbol search, callers, callees, dependencies, or blast radius. The runtime is reused globally; the index remains project-local. Reinitialize when status reports that the index is missing or invalid, not before every query.

Recipe: convert a reviewed external document

lwc --scope project config show
lwc --scope project config set --trans markitdown
lwc --scope project trans docs/report.docx --output converted/report.md

Conversion creates a Markdown file; it does not ingest it. Review the output, then add it as a Source only if it is authorized, useful, and free of secrets. Existing outputs are never overwritten.

Recipe: publish an atomic knowledge update

lwc --scope project changeset begin operations-update
lwc --scope project --changeset operations-update page put operations-policy \
  --title "Operations policy" --kind policy \
  --file operations-policy.md --source <source-id>
lwc --scope project --changeset operations-update lint
lwc --scope project changeset show operations-update
lwc --scope project changeset commit operations-update
lwc --scope project graph verify

Use a changeset when several commands must become visible together. A sparse draft reads untouched live knowledge through an overlay. Resolve conflicts from the current live baseline; do not bypass lint to hide an overlay bug.

Recipe: recover a derived projection

lwc --scope project lint --limit 100
lwc --scope project work list
lwc --scope project maintenance materialize
lwc --scope project work watch <work-id>
lwc --scope project lint

Choose maintenance reindex for search-index drift or reapply the selected graph configuration for graph drift. Use checkpoint restore only when canonical Wiki state itself must move backward.

Completion pattern

Every recipe ends with the same four questions:

  1. Did the command operate on the intended scope or draft?
  2. Did every returned Work reach succeeded?
  3. Does canonical readback show the intended state?
  4. Do lint, fixed retrieval checks, and graph verification pass where applicable?

For command details, continue with CLI and configuration reference. For failures, use Troubleshooting and FAQ.

LWC Wiki

English · 简体中文


Start here · 开始使用

Core capabilities · 核心能力

Practical guides · 实战指南

Capability configuration · 能力配置

Technical design · 技术设计

Operations · 运行与维护

Reference · 参考资料

Contributing · 参与贡献


Repository · Releases

Clone this wiki locally