Instruction Anchor Guard
name: instruction-anchor-guard
by dalomeve · published 2026-03-22
$ claw add gh:dalomeve/dalomeve-instruction-anchor-guard---
name: instruction-anchor-guard
version: 1.1.0
description: Preserve user-critical instructions across long sessions and context compaction. Use when users mark constraints as important/must/always/never/highest-priority/rules, and enforce anchor checks before and after compaction to prevent plan drift.
metadata:
openclaw:
emoji: "[ANCHOR]"
category: resilience
---
# 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:
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: <id>
- **source**: <session-id|message-id|user>
- **instruction**: <canonical instruction text>
- **verbatim**: <short quote from user>
- **priority**: P0 | P1 | P2
- **scope**: global | session | task:<id> | channel:<id>
- **createdAt**: <ISO-8601 timestamp>
- **expiresAt**: <ISO-8601 timestamp or "never">
- **status**: active | paused | expired | superseded
- **signature**: <stable hash of canonical instruction>
- **supersedes**: <anchor-id or none>Workflow
1) Capture
- 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
3) Persist
4) Rehydrate (each turn and after compaction)
5) Drift Check (before final answer and before destructive actions)
- P0 conflict: stop and correct plan immediately
- P1 conflict: auto-correct and note adjustment
- P2 conflict: continue only if no user-level contradiction
Conflict Resolution
Priority order:
1. System and safety policy
2. User anchors (P0 > P1 > P2)
3. Current-turn temporary preferences
Tie-breakers:
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: <action>
- Conflicts: none | <anchor ids>
- Decision: clear | corrected | paused-awaiting-user
DRIFT_CHECK
- Last anchor sync: <timestamp>
- Drift: no | yes
- Fix applied: <none|what changed>Safety Boundaries
Expiry and Maintenance
- `/anchors list`
- `/anchors pause <id>`
- `/anchors resume <id>`
- `/anchors delete <id>`
- `/anchors pin <id> never`
Integration Notes
More tools from the same signal band
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
Sign plugins, rotate agent credentials without losing identity, and publicly attest to plugin behavior with verifiable claims and authenticated transfers.
The philosophical layer for AI agents. Maps behavior to Spinoza's 48 affects, calculates persistence scores, and generates geometric self-reports. Give your...