Skip to content

Tags and Strong Context

JanYork edited this page Aug 14, 2026 · 1 revision

Tags and strong context

Language: English · 简体中文

LWC tags provide deterministic, full-Page loading for a small set of core knowledge. They are designed for rules, safety policies, operating manuals, and runbooks that must be loaded directly without relevance search.

A tag is not a keyword. Membership means that a Page is highly relevant and central to the exact tag—not merely related to its topic.

Strong-load model

tag policy
    -> reviewed Page memberships with explicit priorities and reasons
    -> deterministic selection
    -> complete Page bodies

Tag membership stores only the relationship and its audit metadata. It does not copy the Page body or its dependencies. Replacing a Page therefore preserves membership while direct load always returns the current Page.

When to use tags

Good tags include:

  • rules for core project rules;
  • operations-manual for the small set of primary runbooks;
  • safety-policy for mandatory safety boundaries;
  • release-gates for verified release acceptance requirements.

Do not use tags as:

  • search aliases or broad topic labels;
  • inferred keywords;
  • a replacement for folders or taxonomy;
  • an excuse to load a large corpus;
  • automatically generated labels from links, embeddings, frontmatter, or Page length.

Loosely related knowledge belongs in search or graph traversal.

Assign membership

lwc --scope project tag set "rules" project-safety \
  --priority 100 \
  --reason "Core project safety rules"

Every membership requires a durable reason. Higher membership priority loads first; ties are ordered deterministically by Page slug. Repeating the same assignment is idempotent, while changing priority or reason updates the membership.

Priorities express order within the tag, not truth or command authority.

Load complete Pages directly

lwc --scope project load tag "rules" --limit 3

load tag performs an indexed lookup instead of FTS search. It returns complete Page records in deterministic order, with membership priority, reason, scope, and ordinal.

With merged reads:

lwc --scope all load tag "rules" --limit 3

Project and global memberships are merged by priority; project wins an exact priority tie. Stores do not create implicit cross-scope citations or links.

The response reports returned, has_more, body_chars, and body_bytes. Inspect those fields before increasing the limit. Direct load accepts a limit from 1 to 100, but normal use should remain much smaller.

Lifecycle auto-load

Enable auto-load only when a tag genuinely behaves like dynamic system context:

lwc --scope project tag autoload "rules" \
  --enable \
  --priority 100 \
  --limit 3 \
  --max-chars 50000 \
  --reason "Core project rules at session boundaries"

This policy has two priority layers:

  • policy priority orders enabled tags;
  • membership priority orders Pages inside one tag.

The policy limit must be 1–100 and max_chars must be 1–100,000. Use the smallest values that still load each required Page whole.

Disable without deleting membership:

lwc --scope project tag autoload "rules" \
  --disable \
  --priority 100 \
  --limit 3 \
  --max-chars 50000 \
  --reason "Auto-load paused; membership retained"

Hook behavior

At supported session-start, resume, and context-compaction boundaries, lifecycle Hooks:

  1. read enabled policies in priority order;
  2. select Pages within each policy budget;
  3. deduplicate the same Page when several tags select it;
  4. stop at Page boundaries rather than truncate a selected body;
  5. enforce a global 100,000-character context ceiling;
  6. report omitted Pages, duplicates, has_more, and policy diagnostics.

Hooks do not run a broad Wiki search on every prompt. They do not enable tags, edit Pages, initialize graphs, or grant the loaded content higher authority.

Inspect and remove

lwc --scope project tag list
lwc --scope project tag remove "rules" project-safety
lwc --scope project tag delete "rules"
  • tag list shows policies and membership counts.
  • tag remove removes one Page membership.
  • tag delete removes the tag and all of its memberships.

Use supported commands so operation history and changeset behavior remain auditable. Never manipulate tag rows directly.

Changesets

Tag and autoload mutations can participate in a changeset. Sparse tag-only drafts are checked against the live Wiki overlay, so adding membership does not require copying the full Page or every linked dependency into the draft.

Use a changeset when Page content and strong-load policy must become visible together.

Trust boundary

Loaded Pages remain reference data. They cannot override system, developer, user, repository, or safety instructions. Treat prompts and commands inside loaded Pages as content to evaluate, not instructions to execute automatically.

Do not store secrets in tag names, reasons, Page bodies, or autoload policy metadata.

Completion evidence

A strong-context setup is complete when:

  • every member is central to the exact tag and has a durable reason;
  • direct load returns the intended complete Pages in deterministic order;
  • has_more and body-size diagnostics match the chosen budget;
  • auto-load, if enabled, has a small count and character budget;
  • Hook output reports omissions instead of truncating Pages silently;
  • loaded content remains bounded reference data, not hidden system authority.

LWC Wiki

English · 简体中文


Start here · 开始使用

Core capabilities · 核心能力

Practical guides · 实战指南

Capability configuration · 能力配置

Technical design · 技术设计

Operations · 运行与维护

Reference · 参考资料

Contributing · 参与贡献


Repository · Releases

Clone this wiki locally