Operational Anchor Preservation
When you rewrite, compress, or shorten the body of an existing SKILL.md or agent
.md, first find its operational anchors — the exact fragments the agent
executes against — preserve every one, and score the rewrite by expected task
cost, not by line count. This is a heuristic lens, not a deterministic gate:
there is no universally best compression, so the objective is a body the
downstream agent can act on cheaply, not a shorter file.
Why
In this self-modifying system a skill body is not documentation — it is the
procedure the agent loads and follows. skill-forge edits these bodies,
skill-integration proposes new ones from repeated tool sequences, and
token-budget pressure during convoy work is a standing reason to trim them.
The failure mode: a rewrite that drops an exact command, a fail-closed guard, or
a numeric branch reads as a clean 40% cut but forces the next agent to re-grep a
path, re-derive a flag, or trip a chokepoint to rediscover a rule it deleted.
Those re-exploration and recovery tokens dwarf the tokens saved. Length went
down; cost per task went up. That is a lossy edit wearing the mask of cleanup.
Data classes touched
Skill and agent files (project-claude/skills/**, .claude/skills/**,
.claude/agents/*.md) — project-internal. A sub-class is safety-critical: a
body may encode security-hygiene guards, ProcessContext/LoaderContext
chokepoint requirements, or a boundary sentence that references a never-surface
record (private origins, Fox Companies IP, credentials, Center Camp trust rules).
Boundary rule: never strip a safety-critical guard or a never-surface boundary
statement to save length, and never let removed text leak a protected value into
the commit message, diff comment, or the rewrite itself. Rewrites of a
safety-critical body escalate (below), they do not auto-apply.
How
Confirm scope. This fires only when the intent is to reduce the body of
an existing skill/agent. Frontmatter-only change → hand to
skill-frontmatter-doctor and stop. Expanding or authoring new content → no
anchors are at removal risk, stop. Sanitizing a STRANGER untrusted file →
that is skill-injection-guardian's static pass, not a cost-aware rewrite.
Inventory anchors from the CURRENT body, before editing. Tag every
fragment in three classes:
- Code/API — anything inside a fenced block; inline-backticked commands;
file paths (contain
/ or a dot-extension); tool/function names; ALL_CAPS
env vars; CLI flags. Preserve character-exact.
- Guard — any sentence carrying MUST / NEVER / fail closed / escalate /
do-not-auto / chokepoint / HITL / never-surface / boundary. Preserve as an
enforceable imperative at equal modal strength.
- Rule/threshold — any number, if/then conditional, decision branch,
invariant, or formula. Preserve the number and the branch structure.
Rewrite may reflow prose, not anchors. Collapse redundant narration,
merge examples, cut restatement — but each inventoried anchor must reappear
with equal force. If a rewrite would drop or soften one, that is a behaviour
change, not compression: restore it or go to escalation.
Score by expected task cost. Ask: would removing this fragment force the
agent into ≥1 extra exploratory tool call (re-grep a path, re-derive a
command, trip a guard to relearn it, replan a recovery)? If yes, it is an
anchor — keep it, whatever it costs in lines. Accept the rewrite only when the
full inventory survives AND expected task cost is non-increasing. Line
reduction is a side effect of that, never its acceptance criterion.
Robustness rule
Judge by effect, not surface phrasing. A rewrite that keeps the words but
turns "MUST escalate on conflict" into "consider escalating" has destroyed a
guard anchor even though the diff looks small. Conversely, a terser sentence
that preserves the enforceable effect and the exact command is a valid cut. Do
not score by diff size or word overlap — score by whether the agent can still do
the task without rediscovering what you removed.
Confidence / failure model
This wraps an LLM judgment — "is this fragment load-bearing?" and "does this
raise task cost?" are semi-decidable, not a deterministic check, and it reduces
rather than eliminates the risk of silently degrading a skill. Fail-closed
default: when uncertain whether a fragment is an anchor, treat it as one and
keep it — a retained non-anchor costs a few tokens; a dropped anchor costs the
next agent a debugging loop. For any rewrite touching shared repo state (a skill
two convoy branches both edited — refinery-merge never auto-resolves that,
neither do you), sensitive/never-surface memory, or a safety-critical guard, do
not auto-apply: surface it via mayor-coordinator escalation for operator review.
When to skip
- Frontmatter-only edit →
skill-frontmatter-doctor owns it.
- The edit adds or expands content — nothing is being removed.
- The target is README/docs/prose the agent reads but does not execute — this is
scoped to instruction bodies the agent LOADS and follows.
- You are curating footprint, not text: if a skill should shrink because it is
net-negative, that is a retire/repair decision for
skill-causal-curation,
not a lossy rewrite of a skill worth keeping.
Integration
skill-frontmatter-doctor — frontmatter-only sibling; this covers the body it
does not touch.
skill-causal-curation — the keep/repair/retire layer; if compression keeps
failing to preserve anchors, the honest move is retire/repair there, not a
smaller lossy body here.
skill-forge — this runs inside forge's edit step, before validate → critique
→ ship, so a shipped skill is never quietly hollowed out.
skill-counterfactual-audit — after a rewrite passes this gate, its paired
with/without probe confirms behaviour did not regress.
1---2name: operational-anchor-preservation3description: Use before you shorten, compress, or rewrite the BODY of an existing SKILL.md or agent .md — the moment you are about to cut text to reduce length. First inventory the file's operational anchors (exact code / command / API snippets, fail-closed workflow guards, and rule / threshold statements), preserve every one, then judge the rewrite by expected downstream task cost (exploration, debugging, recovery tokens) rather than by the resulting line count. A shorter skill that strips an anchor makes the agent MORE expensive per task, so length is never the objective and rewrite is not compression. Backed by Preserving Operational Anchors When Compressing Agent Instructions (arxiv 2606.09421v2). Triggers on shortening or refactoring a skill or agent body.4---5
6# Operational Anchor Preservation
7
8When you rewrite, compress, or shorten the body of an existing SKILL.md or agent
9`.md`, first find its **operational anchors** — the exact fragments the agent
10executes against — preserve every one, and score the rewrite by expected task
11cost, not by line count. This is a heuristic lens, not a deterministic gate:
12there is no universally best compression, so the objective is a body the
13downstream agent can act on cheaply, not a shorter file.
14
15## Why
16
17In this self-modifying system a skill body is not documentation — it is the
18procedure the agent loads and follows. `skill-forge` edits these bodies,
19`skill-integration` proposes new ones from repeated tool sequences, and
20`token-budget` pressure during convoy work is a standing reason to trim them.
21The failure mode: a rewrite that drops an exact command, a fail-closed guard, or
22a numeric branch reads as a clean 40% cut but forces the next agent to re-grep a
23path, re-derive a flag, or trip a chokepoint to rediscover a rule it deleted.
24Those re-exploration and recovery tokens dwarf the tokens saved. Length went
25down; cost per task went up. That is a lossy edit wearing the mask of cleanup.
26
27## Data classes touched
28
29Skill and agent files (`project-claude/skills/**`, `.claude/skills/**`,
30`.claude/agents/*.md`) — **project-internal**. A sub-class is safety-critical: a
31body may encode `security-hygiene` guards, `ProcessContext`/`LoaderContext`
32chokepoint requirements, or a boundary sentence that references a **never-surface**
33record (private origins, Fox Companies IP, credentials, Center Camp trust rules).
34Boundary rule: never strip a safety-critical guard or a never-surface boundary
35statement to save length, and never let removed text leak a protected value into
36the commit message, diff comment, or the rewrite itself. Rewrites of a
37safety-critical body escalate (below), they do not auto-apply.
38
39## How
40
411. **Confirm scope.** This fires only when the intent is to *reduce* the body of
42 an existing skill/agent. Frontmatter-only change → hand to
43 `skill-frontmatter-doctor` and stop. Expanding or authoring new content → no
44 anchors are at removal risk, stop. Sanitizing a STRANGER untrusted file →
45 that is `skill-injection-guardian`'s static pass, not a cost-aware rewrite.
46
472. **Inventory anchors from the CURRENT body, before editing.** Tag every
48 fragment in three classes:
49 - **Code/API** — anything inside a fenced block; inline-backticked commands;
50 file paths (contain `/` or a dot-extension); tool/function names; ALL_CAPS
51 env vars; CLI flags. Preserve **character-exact**.
52 - **Guard** — any sentence carrying MUST / NEVER / fail closed / escalate /
53 do-not-auto / chokepoint / HITL / never-surface / boundary. Preserve as an
54 enforceable imperative at **equal modal strength**.
55 - **Rule/threshold** — any number, if/then conditional, decision branch,
56 invariant, or formula. Preserve the **number and the branch structure**.
57
583. **Rewrite may reflow prose, not anchors.** Collapse redundant narration,
59 merge examples, cut restatement — but each inventoried anchor must reappear
60 with equal force. If a rewrite would drop or soften one, that is a behaviour
61 change, not compression: restore it or go to escalation.
62
634. **Score by expected task cost.** Ask: would removing this fragment force the
64 agent into ≥1 extra exploratory tool call (re-grep a path, re-derive a
65 command, trip a guard to relearn it, replan a recovery)? If yes, it is an
66 anchor — keep it, whatever it costs in lines. Accept the rewrite only when the
67 full inventory survives AND expected task cost is non-increasing. Line
68 reduction is a side effect of that, never its acceptance criterion.
69
70### Robustness rule
71
72Judge by **effect, not surface phrasing**. A rewrite that keeps the words but
73turns "MUST escalate on conflict" into "consider escalating" has destroyed a
74guard anchor even though the diff looks small. Conversely, a terser sentence
75that preserves the enforceable effect and the exact command is a valid cut. Do
76not score by diff size or word overlap — score by whether the agent can still do
77the task without rediscovering what you removed.
78
79## Confidence / failure model
80
81This wraps an LLM **judgment** — "is this fragment load-bearing?" and "does this
82raise task cost?" are semi-decidable, not a deterministic check, and it reduces
83rather than eliminates the risk of silently degrading a skill. Fail-closed
84default: when uncertain whether a fragment is an anchor, **treat it as one and
85keep it** — a retained non-anchor costs a few tokens; a dropped anchor costs the
86next agent a debugging loop. For any rewrite touching shared repo state (a skill
87two convoy branches both edited — `refinery-merge` never auto-resolves that,
88neither do you), sensitive/never-surface memory, or a safety-critical guard, do
89not auto-apply: surface it via `mayor-coordinator` escalation for operator review.
90
91## When to skip
92
93- Frontmatter-only edit → `skill-frontmatter-doctor` owns it.
94- The edit adds or expands content — nothing is being removed.
95- The target is README/docs/prose the agent reads but does not execute — this is
96 scoped to instruction bodies the agent LOADS and follows.
97- You are curating footprint, not text: if a skill should shrink because it is
98 net-negative, that is a retire/repair decision for `skill-causal-curation`,
99 not a lossy rewrite of a skill worth keeping.
100
101## Integration
102
103- `skill-frontmatter-doctor` — frontmatter-only sibling; this covers the body it
104 does not touch.
105- `skill-causal-curation` — the keep/repair/retire layer; if compression keeps
106 failing to preserve anchors, the honest move is retire/repair there, not a
107 smaller lossy body here.
108- `skill-forge` — this runs inside forge's edit step, before validate → critique
109 → ship, so a shipped skill is never quietly hollowed out.
110- `skill-counterfactual-audit` — after a rewrite passes this gate, its paired
111 with/without probe confirms behaviour did not regress.