← 返回 Skills 市场
dalomeve

Instruction Anchor Guard

作者 Dalomeve · GitHub ↗ · v1.0.0
cross-platform ✓ 安全检测通过
326
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install instruction-anchor-guard
功能描述
Preserve user-critical instructions across long sessions and context compaction. Use when users mark constraints as important/must/always/never/highest-prior...
使用说明 (SKILL.md)

Instruction Anchor Guard

Prevent loss or drift of user-critical constraints during compaction, session restart, or long multi-turn tasks.

When To Trigger

Trigger when any of these appear:

  • User marks an instruction as important, critical, must, always, never, highest priority, rule, or constraint
  • A task has more than 3 steps and spans multiple turns
  • Compaction happened (or is likely) and the task has non-negotiable requirements
  • Agent behavior shows possible drift from prior explicit user constraints

Anchor Ledger Schema

Store anchors in first available path:

  1. memory/anchors.md
  2. memory/instruction-anchors.md
  3. .anchors.md (workspace root fallback only)

Entry schema (append-only, one section per anchor):

## Anchor: \x3Cid>
- **source**: \x3Csession-id|message-id|user>
- **instruction**: \x3Ccanonical instruction text>
- **verbatim**: \x3Cshort quote from user>
- **priority**: P0 | P1 | P2
- **scope**: global | session | task:\x3Cid> | channel:\x3Cid>
- **createdAt**: \x3CISO-8601 timestamp>
- **expiresAt**: \x3CISO-8601 timestamp or "never">
- **status**: active | paused | expired | superseded
- **signature**: \x3Cstable hash of canonical instruction>
- **supersedes**: \x3Canchor-id or none>

Workflow

1) Capture

  • Parse latest user message for candidate anchor statements
  • Keep only instruction/constraint content; remove examples/chatter
  • Assign default values:
    • priority: P1 (unless user says critical/highest -> P0)
    • scope: session (unless user explicitly asks global/task scope)
    • expiresAt: session end (unless user explicitly sets never/date)

2) Confirm for Broad Anchors

  • If scope is global or priority is P0, ask a one-line confirmation before persisting
  • Do not auto-promote P2/P1 to P0 without explicit user intent

3) Persist

  • Append anchor entry to ledger
  • If new anchor conflicts with old same-scope anchor, mark old one superseded
  • Never rewrite history silently; keep audit trail

4) Rehydrate (each turn and after compaction)

  • Load active anchors (status=active and not expired)
  • Build an in-memory ANCHOR_SET sorted by priority and recency
  • Inject ANCHOR_SET into planning phase before tool execution

5) Drift Check (before final answer and before destructive actions)

  • Compare current plan against active anchors
  • On conflict:
    • P0 conflict: stop and correct plan immediately
    • P1 conflict: auto-correct and note adjustment
    • P2 conflict: continue only if no user-level contradiction
  • Emit DRIFT_CHECK block in response

Conflict Resolution

Priority order:

  1. System and safety policy
  2. User anchors (P0 > P1 > P2)
  3. Current-turn temporary preferences

Tie-breakers:

  • More specific scope wins (task > session > global) if same priority
  • Newer anchor wins if same priority and same scope
  • Explicit user override wins only when safety is not violated

Output Template

When anchors exist, include this compact block:

ANCHORS_ACTIVE
| ID | P | Scope | Expires | Instruction |
|----|---|-------|---------|-------------|
| anchor-001 | P0 | global | never | Never perform destructive data deletion without confirmation |

PLAN_GUARD
- Current action: \x3Caction>
- Conflicts: none | \x3Canchor ids>
- Decision: clear | corrected | paused-awaiting-user

DRIFT_CHECK
- Last anchor sync: \x3Ctimestamp>
- Drift: no | yes
- Fix applied: \x3Cnone|what changed>

Safety Boundaries

  • Never store tokens, API keys, passwords, cookies, or auth headers
  • Never store raw personal data unless strictly required by user instruction
  • Redact sensitive literals as [REDACTED]
  • Store constraints, not datasets
  • Do not execute destructive commands solely because an anchor exists; still require explicit confirmation for destructive actions

Expiry and Maintenance

  • Mark expired when expiresAt \x3C now
  • Support control intents:
    • /anchors list
    • /anchors pause \x3Cid>
    • /anchors resume \x3Cid>
    • /anchors delete \x3Cid>
    • /anchors pin \x3Cid> never
  • Rotate ledger when > 200 entries into memory/anchors-archive-YYYY-MM.md

Integration Notes

  • Pair with memory-self-heal for retry/fallback after drift correction
  • Pair with task-execution-guard to enforce anchor checks at each milestone
  • Keep this skill deterministic and concise; avoid free-form interpretation when conflict exists\r
安全使用建议
This skill appears coherent, but before installing consider: (1) Confirm where anchor files will be written (workspace/memory paths) and whether those files are accessible to other processes or backups. (2) Test the confirmation flow for global/P0 anchors so high-impact rules require explicit consent. (3) Verify the agent actually redacts or refuses to persist secrets (tokens, passwords, PII) as the spec requires—don't assume enforcement. (4) Decide retention and deletion policy (expiry, archive, and /anchors delete) so anchors don't accumulate unexpectedly. (5) Run initial trials in a non-production environment to observe how anchors affect behavior, and ensure you can override or remove anchors when needed. (6) If multiple agents or users share the workspace, be aware global anchors may affect them too.
功能分析
Type: OpenClaw Skill Name: instruction-anchor-guard Version: 1.0.0 The OpenClaw AgentSkills bundle 'instruction-anchor-guard' is designed to preserve user-critical instructions and constraints across sessions. The `SKILL.md` explicitly defines 'Safety Boundaries' that forbid storing sensitive data (tokens, API keys, passwords, PII) and executing destructive commands without confirmation. While it involves file write operations (`memory/anchors.md`, `.anchors.md`), these are for its stated purpose of persisting user constraints and are governed by the explicit safety rules, showing no intent for data exfiltration or malicious execution.
能力评估
Purpose & Capability
Name/description (preserve critical instructions across compaction) align with the runtime instructions: parsing user messages for constraints, persisting them to a local ledger, and injecting them into planning. No unrelated credentials, binaries, or installs are requested.
Instruction Scope
SKILL.md directs the agent to parse user messages, create canonical anchor entries, and append them to files under workspace/memory (memory/anchors.md, memory/instruction-anchors.md, or .anchors.md). That behavior is appropriate for the stated purpose, but it does create persistent on-disk artifacts and places the agent in charge of redaction and not storing secrets—so operators should verify the agent enforces those safeguards in practice.
Install Mechanism
No install spec and no code files; instruction-only skills carry minimal install risk since nothing is downloaded or executed beyond the agent's normal behavior.
Credentials
No environment variables, credentials, or external service tokens are requested. The SKILL.md explicitly forbids storing tokens, API keys, passwords, and similar secrets in the ledger, which is consistent and proportional.
Persistence & Privilege
The skill persists anchors to local files and supports global/P0 anchors that can influence future agent behavior across turns/sessions. It does not set always:true, but the persistent ledger and support for global anchors means it can have long-lived influence; operators should confirm consent/confirmation flows for global or P0 anchors.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install instruction-anchor-guard
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /instruction-anchor-guard 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
instruction-anchor-guard 1.1.0 - Adds persistent anchor ledger to track user-critical instructions across compaction and long sessions. - Introduces anchor parsing, confirmation, and conflict resolution workflow. - Ensures user-marked "must/never/critical" constraints survive context loss and are enforced before/after plan steps. - Includes new drift-detection and correction routines, safety boundaries, and expiry controls. - Provides output templates and user control commands for managing anchors.
元数据
Slug instruction-anchor-guard
版本 1.0.0
许可证
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Instruction Anchor Guard 是什么?

Preserve user-critical instructions across long sessions and context compaction. Use when users mark constraints as important/must/always/never/highest-prior... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 326 次。

如何安装 Instruction Anchor Guard?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install instruction-anchor-guard」即可一键安装,无需额外配置。

Instruction Anchor Guard 是免费的吗?

是的,Instruction Anchor Guard 完全免费(开源免费),可自由下载、安装和使用。

Instruction Anchor Guard 支持哪些平台?

Instruction Anchor Guard 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Instruction Anchor Guard?

由 Dalomeve(@dalomeve)开发并维护,当前版本 v1.0.0。

💬 留言讨论