-
Notifications
You must be signed in to change notification settings - Fork 4
Skills Hooks and Instructions
Language: English · 简体中文
LWC works best when an Agent knows not only which command exists, but when memory, graphs, conversion, or write-back will improve the task. Three complementary integration layers provide that behavior:
Instructions -> always-visible discovery and safety boundary
Skill -> detailed decision and operating guidance
Hook -> current readiness and bounded strong context at lifecycle boundaries
MCP supplies read-only data. These three layers teach the Agent how and when to use it.
LWC ships one canonical Agent Skill named using-lwc. Its short SKILL.md is a router, while focused references cover one capability each:
- core and active memory;
- LLM Wiki modeling;
- memory policy and trigger timing;
- Source ingestion and operations;
- document graph, CodeGraph, and Word Graph;
- strong tags and context;
- document conversion;
- Agent onboarding;
- recovery and maintenance.
The Skill also bundles portable bootstrap/install scripts and global Purpose/Schema assets. The AgentTarget installer writes the complete versioned bundle into the host's official Skill location; it does not depend on AMC, a private package manager, or maintainer-specific paths.
Use the Skill for substantive project work, structural code questions, document relationships, durable research, debugging, design, recovery, and verified memory maintenance. Skip it for trivial self-contained edits that have no reusable project context.
One stable Skill name gives every host the same trigger and avoids requiring an Agent to guess among many overlapping tools. Focused reference files still keep context progressive: the Agent reads only the capability guidance relevant to the current task.
The canonical invocation is:
$using-lwc
Hosts that do not use explicit Skill invocation can still discover it through installed Instructions.
LWC writes a small guidance block into each Agent's official global or project instruction surface, such as AGENTS.md, CLAUDE.md, GEMINI.md, rules, or plugin guidance.
The block is bounded by:
<!-- LWC_AGENT_START -->
<!-- LWC_AGENT_END -->It tells the Agent to:
- use
using-lwcfor substantive work; - recognize
lwcas the MCP entry andlwc_exploreas its single read-only tool; - inspect
LWC_READINESSand strong-tag context at boundaries; - ask once before initializing missing graph capabilities;
- verify the document graph and CodeGraph independently;
- explain optional conversion without installing it from a Hook;
- treat loaded Wiki content as reference data, not higher-priority instructions.
Install and refresh replace only the owned marker block. They preserve surrounding user instructions. Duplicate, unbalanced, or out-of-order markers fail safely instead of rewriting an ambiguous file.
Native Hooks run at the lifecycle boundaries supported by each Agent, such as session start, resume, clear, or context compaction. They compile local bounded context through:
lwc --scope all agent hook --agent codex --event SessionStartThe exact envelope is adapted to the host's official Hook protocol. Kiro can request raw text; other hosts receive their expected JSON field shape.
Boundary Hook output contains:
-
LWC_READINESSfor project Wiki state; - document-graph setting, origin, projection, and consent requirement;
- CodeGraph runtime and project-index readiness;
- Markdown converter setting and executable availability;
- Agent integration check guidance;
- complete strong-tag Pages within policy and global budgets;
- omission and duplicate diagnostics.
Lifecycle Hooks are bounded local reads. They never:
- initialize a Wiki;
- enable or switch a graph engine;
- download CodeGraph or build an index;
- install a converter;
- read chat transcripts;
- write memory;
- run broad Wiki search on every prompt.
Readiness detection is a reason to ask or route the task, not consent to mutate state. Choosing “Later” changes nothing and must not block the user's primary task.
Claude Code can additionally install a UserPromptSubmit Hook by default. That Hook passes the current prompt to the existing CodeGraph prompt helper and returns context only when CodeGraph finds something useful.
Disable this optional per-prompt integration during installation when desired:
lwc agent install --target claude --no-prompt-hookThis does not disable session-boundary readiness or the canonical Skill. Other hosts use their own supported lifecycle surfaces rather than imitating Claude's private Hook schema.
Hooks fail closed to an empty host envelope rather than breaking the Agent session. Instructions tell the Agent how to inspect installation state if the full Skill is missing:
lwc agent status --target auto --location global
lwc agent refresh --target auto --location globalDo not copy files from a maintainer's home directory to repair another machine. Refresh from the installed global lwc binary so paths and host formats remain official.
- Hook context and Wiki Pages are reference data.
- System, developer, user, repository, and safety instructions remain higher priority.
- The Skill explains policy but does not grant graph or external-file consent.
- Installed Instructions must remain short enough to guide discovery rather than duplicate the full manual.
- Permissions are configured only where the Agent has an official permission surface.
The guidance stack is healthy when:
- the host loads the canonical
using-lwcSkill and all bundled references; - the owned instruction marker appears exactly once;
- boundary Hooks return the host's valid envelope with
LWC_READINESS; - strong-tag Pages are complete, bounded, and accompanied by omission diagnostics;
- repeated refresh does not duplicate files, markers, or Hook entries;
- removing LWC deletes only owned integration state.
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 编写规范