/spec-anchor:spec-anchorfrom spec-anchor
Loads coding standards, module contracts, and active tasks from anchor.yaml or .specanchor/ before substantive code changes or reviews. Useful for projects with explicit engineering context files.
Ships in spec-anchor. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
SpecAnchor compiles bounded, auditable, sedimentable engineering context for coding agents. It does not own the agent loop.
SpecAnchor 为 AI coding agent 编译有边界、可审计、可沉淀的工程上下文。它不拥有 agent 执行循环。
Spec 是 cold context 来源之一,代码是船,Context Bundle 是 SpecAnchor 的核心交付物。SpecAnchor 把工作记忆显式分为四类产物——Spec / Decision / Evidence / Finding——按 inclusion / budget / freshness / staleness 装配成 Bundle 交给 agent。Agent 在执行中产生的新发现回写为 Finding,经 Sediment Proposal 由人 batch review 后才进入长期 Spec。跨 session 通过 specanchor_handoff 导出 handoff packet 重启。
主 SKILL.md 只负责入口和 boot;详细协议下沉到 references/:
references/agents/context-utilities.mdreferences/workflow-gates.mdreferences/commands-quickref.mdreferences/reference-index.mdSkill 脚本位于 Skill 根目录的 scripts/ 下,运行时必须站在用户项目根目录。
# $SA_SKILL_DIR = SKILL.md 所在目录
SPECANCHOR_SKILL_DIR="$SA_SKILL_DIR" bash "$SA_SKILL_DIR/scripts/<script-name>.sh" [args]
Keep long options as a single shell argument: use --format=summary, never -- format=summary.
specanchor-boot.sh 加载项目配置、模块结构和活跃任务(详见 Boot Requirement)specanchor-assemble.sh --files=... --intent=...(详见 Loading Strategy)specanchor-finding.sh 记录步骤 1-2 在 session 开始时执行一次;步骤 3-7 在每个编码任务中按需循环。
当任务需要 SpecAnchor 上下文时,Boot 是第一步——实质性代码分析/修改前先 boot;琐碎或纯只读操作可跳过。 判定需要后先运行:
SPECANCHOR_SKILL_DIR="$SA_SKILL_DIR" bash "$SA_SKILL_DIR/scripts/specanchor-boot.sh"
--format=summary:人类可读摘要--format=full:额外附带 Global Spec 正文--format=json:机器可读 JSONBoot 完成后立即输出 Assembly Trace(见下节),然后再进入任何代码分析或修改。
Boot 是 session-start / preflight,同一 session 原则上只运行一次。 同 session 内后续的上下文需求不要重复 boot——改用 targeted specanchor-assemble.sh --files=...(见 Loading Strategy)。
Boot 完成后必须立即输出 Assembly Trace,格式如下:
Assembly Trace:
- Global: summary|full|none|skipped -> <files or reason>
- Module: full|summary|deferred|sources-only|none -> <files or reason>
Assembly Trace 是 boot 的可视确认——没有它,用户无法验证上下文已正确加载。完整规则见 references/assembly-trace.md。
full:始终加载 anchor.yaml + 全部 Global Spec;Module Spec 按需加载。parasitic:只加载 anchor.yaml 与外部 sources;不创建 full-only Spec。Available Commands: / Available Modules: 段;boot 不可用时 fallback 到 references/commands-quickref.md。specanchor-assemble.sh --files=... --intent=...,先拿到 bounded read plan,再进入编辑。完成实质性代码修改后,依次执行以下检查链(改动规模越大越应完整执行;琐碎/局部改动可按需简化或跳过):
对齐检查(Alignment Check) — 触及 Spec 治理模块的改动应按下述决策树挑合适入口执行。verdict tools 与 read-plan tools 分工明确:verdict 走 check,read-plan 走 assemble。
| 手上有什么 | 入口 | 说明 |
|---|---|---|
| 一组改动文件路径 | specanchor-check.sh files <path...> | Post-coding verdict 超集:coverage + module freshness + optional task alignment,输出 overall: pass|warning|fail |
| 具体 task spec | specanchor-check.sh task <spec-file> 或 check files <path...> --task-spec=<path> | 前者判定 committed-diff vs plan;后者做 candidate-only 弱声明 |
| 只想知道是否被 Module Spec 覆盖 | specanchor-check.sh coverage <path...> | 纯覆盖查询(不含 freshness / task diff) |
| 需要 bounded context bundle | specanchor-assemble.sh --files=... --intent=... | read-plan 工具,不产 verdict;输出含 Uncovered Targets 段列出未覆盖路径 |
| assemble 超时 / 缺覆盖 | 显式报告 "partial context",不要伪造 verdict | 缺 module spec 时创建 Task Spec 或跑 specanchor_infer,不要凭空发明业务规则 |
check files --format=json 输出 specanchor.check.v1 envelope(top-level schema_version / mode / status / inputs / warnings / verdict)。记录发现(Record Findings) — 若发现新事实、矛盾、风险或 Spec 漂移,通过以下命令记录:SPECANCHOR_SKILL_DIR="$SA_SKILL_DIR" bash "$SA_SKILL_DIR/scripts/specanchor-finding.sh" new --topic=<slug> --summary=<单行摘要>。无新发现则跳过。
评估沉淀(Evaluate Sediment) — 若发现揭示了 Spec 漂移或缺失约束,起草 Sediment Proposal(references/concepts/sediment-proposal.md)将热上下文回流为冷 Spec。无漂移则跳过。
脚本失败时:
anchor.yaml + .specanchor/spec-index.md 获取最小上下文。迭代上限:
降级策略:
.specanchor/ 下的文件作为上下文。anchor.yaml 且无 .specanchor/,skill 不激活——这是预期行为,不视为错误。What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub linziyanleo/spec-anchor --plugin spec-anchorOther plugins' skills for the same job