1
---
2
name: compaction-control-profiling
3
description: "This skill should be used when deciding, for a specific model and workload, whether the harness or the model should control compaction, and when qualifying or calibrating that choice with measurements: context-budget sweeps that compare harness-driven and model-driven compaction on one harness, the context-pressure regime where delegation pays, a per-model compaction behavior profile (interface uptake, compression factor per call, reopen rate of archived content, context fill at first compaction, response to pressure warnings), context anxiety and timing-instruction calibration, reversible collapse-and-archive interfaces, and re-qualification after a model or prompt change. Route the editable-file protocol, harness invariants, and edit-position cache cost of self-editing agents to self-managed-context, summary content to context-compression, harness thresholds and cache layout to context-optimization, and general evaluation design to evaluation."
4
---
5
6
# Compaction Control Profiling
7
8
This skill covers the decision that comes before any self-compacting agent design: for this model, on this workload, should the harness or the model decide when and what to compact? The answer is measured, not assumed. In a cross-model study that gave four current models one compaction interface and one set of instructions, one model nearly tripled its score at a tight context budget while another called the interface in a small minority of tasks and trailed the harness baseline until budgets were large (claim-compaction-control-tight-budget-gain, claim-compaction-control-uptake-variance).
9
10
The operating rule: treat compaction control as a property of one model at one context pressure under one prompt. The study saw the outcome change across models, across budgets, and with a single timing sentence. It did not test model versions or alternative wordings, so re-qualifying on those changes is a precaution this skill adds, not a measured result. Qualify the model with a budget sweep and a behavior profile, calibrate the timing instruction, assign control per model and pressure regime, and re-qualify when the model or the prompt changes.
11
12
## When to Activate
13
14
Activate this skill when:
15
16
- Choosing between a harness threshold, a model-called compaction interface, or a hybrid for a specific model and workload
17
- Onboarding a new model, model version, or system prompt into a harness that exposes compaction to the model
18
- Designing an experiment that compares compaction policies across context budgets
19
- An agent with a compaction interface never calls it, calls it at low fill, or returns an answer when warned that context is filling
20
- Calibrating a compaction timing instruction or the wording of a context-pressure warning
21
- Specifying the telemetry of a reversible compaction interface: range collapse, archived originals, retrieval by tag
22
- Checking whether a run that used fewer tokens was cheaper to serve
23
24
Do not activate this skill for adjacent work owned by other skills:
25
26
- Building the self-editing harness (context as an editable file and the invariants around it), edit-position cache cost, and training a context-editing strategy: `self-managed-context`. This skill decides whether a model qualifies for that control and at which settings.
27
- What the summary written at a collapse must preserve: `context-compression`.
28
- Harness-side threshold policy, masking, and cache-stable layout: `context-optimization`.
29
- Diagnosing why output quality degrades inside a long context: `context-degradation`.
30
- General evaluation design, rubrics, and regression suites: `evaluation`.
31
- Early stopping that traces to the task brief instead of a context warning: `long-horizon-prompting`.
32
33
## Core Concepts
34
35
### Control Is a Per-Model Property
36
37
Read a model's compaction behavior on four axes together, never one alone: whether it calls the interface, how much each call removes, whether it goes back for what it removed, and when it starts. Models given an identical interface diverge on all four (claim-compaction-control-uptake-variance, claim-compaction-control-compression-reopen, claim-compaction-control-context-anxiety). In the study, uptake was similar across the three models that used the interface, yet their gains differed; the one that gained most had the largest shrink per call and the highest reopen rate. Uptake alone is not the goal.
38
39
The table below is an operating rule derived from those results. The study observed the signals; it did not test the actions.
40
41
| Signal | Reading | Action |
42
| --- | --- | --- |
43
| Low uptake, score at or below the harness baseline at tight budgets | The model is declining control | Keep harness-driven, or hybrid with a harness fallback |
44
| Low uptake, tasks end below the timing threshold | Compaction was never needed | Not a failure; the budget is loose for this task |
45
| First compaction far below the instructed threshold, or at low fill with no instruction | Context anxiety | Compare accuracy at large budgets with and without a timing floor. Add or raise the floor where early compaction costs accuracy; where accuracy holds, the floor is optional |
46
| Uptake collapses when a timing instruction is added | The instruction may be suppressing use | Check whether those tasks reach the warning or the fallback; if they do, lower the threshold or pair the floor with an explicit expectation to act |
47
| Large shrink per call with a high reopen rate | Aggressive, recovering through the archive | Acceptable; count the tokens spent on reopens |
48
| Large shrink per call, low reopen rate, score drop | State lost and not recovered | Require richer summaries; route summary content to context-compression |
49
| First pressure warning resolves as a returned answer | Warning read as a stop signal | Reword the warning to name compaction as the expected action |
50
51
### Context Pressure Sets the Payoff
52
53
Estimate context pressure, the ratio of what the task needs to what the window holds, before choosing a policy. Delegated control pays where pressure is high: the strongest gains appeared at tight budgets and shrank as budgets grew, and the one model that trailed the harness baseline caught up only at large budgets. On a second benchmark, whose tasks the authors believe need far less context, the effect was much smaller and confined to the tightest budgets (claim-compaction-control-tight-budget-gain, claim-compaction-control-low-demand-benchmark). When an unconstrained run peaks well inside the window, keep the harness policy: delegation has little to buy and an anxious model can only lose state.
54
55
### The Budget Sweep
56
57
Qualify a model with a sweep, never a single budget, because the ranking of policies changes with pressure. Run both policies on the same harness, model, tools, tasks, and grader across a ladder of hard context budgets that brackets the task's natural peak (claim-compaction-control-study-setup).
58
59
| Condition | Definition |
60
| --- | --- |
61
| Harness-driven | At a fixed fraction of the budget, the harness summarizes earlier history and keeps the initial instructions and a fixed number of recent events verbatim |
62
| Model-driven | The model receives the compaction interface, a live usage readout, a timing instruction, and a pressure warning near the limit |
63
| Overflow fallback, both conditions | A request over the hard budget drops the oldest events and retries; after a fixed number of failures the task scores as failed |
64
65
Shrinking the budget stands in for longer tasks. It is a proxy, and the fallback that keeps runs alive at the smallest budgets is a context policy of its own that can move scores.
66
67
### The Behavior Profile
68
69
Log five metrics per budget. Definitions follow the study so results stay comparable with it.
70
71
| Metric | Definition | What it separates |
72
| --- | --- | --- |
73
| Uptake | Share of tasks with at least one compaction call | Using control from declining it |
74
| Compression factor | Input tokens of the request in which the model decided to compact, divided by input tokens of the next request | Aggressive from timid calls; below one means the context grew |
75
| Reopen rate | Share of compaction calls whose archived events were later retrieved | Recovered state from state that was unneeded or lost; a lower bound |
76
| First-compaction fill | Fraction of the budget in use at the first compaction call in a task; median over tasks | Timely from anxious |
77
| Warning resolution | From the first pressure warning to episode end: returned an answer, compacted at once, read interface docs then compacted, inspected history then compacted, other | Compacting from wrapping up |
78
79
### Context Anxiety and the Timing Instruction
80
81
Calibrate the timing instruction per model, in both directions. Context anxiety is compaction that starts while ample space remains. With an instruction to consider compacting only past a high usage threshold, most models in the study waited until near it. Without it, two models started at under half of the budget and scored below the harness baseline at large budgets, and a third, which almost never compacted with the instruction, compacted early and regularly (claim-compaction-control-context-anxiety). The timing instruction is therefore a per-model dial that can err in two directions: absent, some models over-compact; present, one model in the study all but stopped compacting. The study reports no accuracy change for that model either way, so treat suppressed uptake as a signal to investigate, not as a demonstrated loss. One hypothesized cause of early compaction is training that penalizes long rollouts (claim-compaction-control-rollout-penalty). Treat the cause as conjecture and the behavior as measurable. Early compaction is the signal; its accuracy cost is a separate measurement, and the study found that cost in two of the three models that compacted early.
82
83
### Reversible Collapse Is the Interface Under Test
84
85
Profile against an interface where compaction is reversible: the model replaces a tagged range of events with a summary it writes, the harness archives the originals, and any archived event stays retrievable by its original tag (claim-compaction-control-reference-interface). Reversibility is what makes aggressive compaction safe to allow, and it makes the cost observable once the harness logs every read of an archived event. The reference harness does not log those reads itself; the study counted them from traces. A delete-only interface hides the same loss inside repeated tool calls.
86
87
Interface properties that keep the measurements clean:
88
89
- Tags are stable and visible in the transcript; a summary carries its range tag and a one-line retrieval hint.
90
- A collapse that overlaps existing summaries flattens into one summary; rewriting a summary is an explicit operation, not a side effect.
91
- Interface documentation is short and reachable on demand. One model read it before compacting in most first-warning episodes (claim-compaction-control-warning-response); every lookup is a full-context turn spent under pressure.
92
- The usage readout refreshes at least as often as the model is expected to act on it. A readout refreshed every few turns makes first-compaction fill measure refresh cadence.
93
- Every collapse logs its range, tokens before and after, and fill. Every read path that can return an archived event (lookup by tag, index access, history query) logs a reopen.
94
95
### Tokens Are Not Cost
96
97
Price a compaction policy in recomputed tokens, not only in tokens sent. A model-driven run can reach equal or better accuracy with fewer cumulative input tokens (claim-compaction-control-token-savings), but cumulative input counts every input token on every turn, cached or not. Under prefix caching an edit invalidates everything after it, so a shorter context is not automatically cheaper. A serving prototype that reused the cached state of the unchanged suffix reduced prefill per request with no measurable accuracy change, most where the surviving suffix was large (claim-compaction-control-suffix-kv-reuse). Report tokens and, where the serving stack is observable, prefill compute. Route edit placement and suffix reuse mechanics to self-managed-context.
98
99
## Practical Guidance
100
101
### Qualification Workflow
102
103
1. Estimate pressure. Run the task set at the largest available budget and record peak and cumulative context per task.
104
2. Fix the comparison. Use the same harness, model, tools, tasks, and grader for both policies. Write down the harness threshold and retention rule, and the model-driven interface docs, readout, timing instruction, and warning text. Version the prompt text; it is part of the result.
105
3. Sweep budgets. Use a geometric ladder of hard request limits that brackets the natural peak from step 1, with at least two rungs below it. Define the overflow fallback, count its firings, and score errors as failures.
106
4. Replicate each cell and report the spread. Treat differences inside the spread as no difference.
107
5. Log the behavior profile per budget. Never pool timing metrics across budgets.
108
6. Ablate the timing instruction at one tight and one loose budget: with it, without it, and at a second threshold if uptake collapses.
109
7. Classify with the signal table and assign control per model and pressure regime.
110
8. Price the result in cumulative input tokens, and in prefill compute where serving is observable.
111
9. Record the assignment with the model version and a hash of the prompt surfaces. Re-qualify when either changes.
112
113
### Control Assignment
114
115
These assignments, including hybrid layering, are design inferences from the study's results. The study compared the two policies separately and tested none of them as interventions.
116
117
| Regime | Profile | Assignment |
118
| --- | --- | --- |
119
| Low pressure | Any | Harness threshold as backstop; if the interface is exposed, keep a timing floor so an anxious model does not compact needlessly |
120
| High pressure | Calls the interface near the threshold and recovers what it needs | Model-driven, with the overflow fallback kept |
121
| High pressure | Declines control or wraps up on the warning | Harness-driven, or hybrid once a reworded warning restores uptake |
122
| Any | Compacts early without a timing instruction | Model-driven with a calibrated timing floor wherever early compaction costs accuracy at large budgets; where accuracy holds, the floor is optional and the extra edits are priced instead |
123
124
For a hybrid, order the triggers so they cannot race: the model's timing threshold sits below the pressure warning, the warning below the harness fallback threshold, and the fallback below the hard limit. The harness then acts only when the model has declined to. Check that order at every budget: at tight budgets one large tool output is a large share of the window, which can push the warning and the fallback below a floor calibrated as a fraction of the budget. Lower the floor, cap tool output size, or run a single policy at that budget.
125
126
### Wording Under Test
127
128
The study's instruction and warning text are not reproduced in the report or its companion post, so treat wording as an experimental variable and re-measure after every change.
129
130
- State the threshold in the unit the readout reports, so the model can check it.
131
- When uptake collapses under a floor-only instruction, test a paired form: do not compact before the threshold; at or past it, compacting settled work is expected.
132
- When warnings resolve as returned answers, test a warning that names the action and rules out the misreading: compact and continue; this is not a request to finish.
133
- Keep compaction how-to text out of low-fill messages; tiered nudges belong to self-managed-context.
134
135
### Reporting
136
137
- Plot score against budget for both policies with replicate ranges, one panel per model.
138
- Tabulate the five profile metrics per budget and the fallback firings per condition.
139
- State task count, replicate count, and which gaps exceed the replicate spread.
140
- Attach the prompt surfaces, model version, and harness commit. A profile without them cannot be re-run or compared.
141
142
## Examples
143
144
**Example 1: Behavior profile from run traces**
145
146
```python
147
def behavior_profile(tasks, budget):
148
calls = [c for t in tasks for c in t.compactions]
149
idle = [t for t in tasks if not t.compactions]
150
med = lambda values: median(values) if values else None # no calls at a budget is a result
151
return {
152
"uptake": len([t for t in tasks if t.compactions]) / len(tasks),
153
"declined": len([t for t in idle if t.warned or t.fallback_fired]) / len(tasks),
154
"never_needed": len([t for t in idle if not (t.warned or t.fallback_fired)]) / len(tasks),
155
"compression_factor": med(
156
[c.input_tokens_at_decision / c.input_tokens_next_request for c in calls]
157
),
158
"reopen_rate": (
159
len([c for c in calls if c.archived_tags & c.tags_retrieved_later]) / len(calls) if calls else None
160
),
161
"first_compaction_fill": med(
162
[t.compactions[0].input_tokens_at_decision / budget for t in tasks if t.compactions]
163
),
164
"warning_resolution": Counter(t.first_warning_outcome for t in tasks if t.warned),
165
"fallback_firings": sum(t.fallback_count for t in tasks),
166
}
167
```
168
169
**Example 2: Reversible collapse with reopen telemetry**
170
171
```python
172
class Events:
173
def collapse(self, start_tag, end_tag, summary_text=None):
174
span = self.active_range(start_tag, end_tag) # inclusive; flattens nested summaries
175
for event in span:
176
self.archive[event.tag] = event # archived, never deleted
177
tag = f"{span[0].first}..{span[-1].last}"
178
self.replace(span, Summary(tag, summary_text, children=[e.tag for e in span]))
179
self.log("collapse", tag=tag, fill=self.fill(), tokens_removed=count(span))
180
return tag
181
182
def get(self, tag):
183
if tag in self.archive:
184
self.log("reopen", tag=tag, fill=self.fill()) # numerator of reopen rate
185
return self.archive[tag]
186
return self.active.get(tag)
187
```
188
189
**Example 3: Instruction pair under test**
190
191
Authored for this skill as a starting point for the ablation, not quoted from the study. `{floor}` is set per model from the sweep.
192
193
```text
194
Timing instruction (floor plus expectation):
195
The context readout shows usage as a share of the budget. Do not compact below {floor}.
196
At or above {floor}, collapse settled work into a summary and continue the task.
197
198
Pressure warning:
199
Context is at {fill} of the budget. Collapse completed work now and keep working.
200
This is not a request to finish early. Archived events stay retrievable by tag.
201
```
202
203
**Example 4: Assignment record**
204
205
```yaml
206
model: <model id and version>
207
prompt_hash: <hash of interface docs, timing instruction, warning text>
208
workload: document research; natural peak several times the production budget
209
profile: # illustrative values
210
uptake: 0.44
211
declined: 0.03
212
first_compaction_fill: 0.83
213
compression_factor: 2.4
214
reopen_rate: 0.08
215
timing_ablation: without the floor, first compaction moves to low fill and the large-budget score drops
216
assignment: model-driven with timing floor; harness fallback above the warning
217
requalify_on: [model version, prompt_hash, interface change]
218
```
219
220
## Guidelines
221
222
1. Qualify per model, per model version, and per prompt; never carry an assignment across any of the three.
223
2. Compare policies on the same harness, tools, tasks, and grader, across a ladder of hard budgets that brackets the natural peak.
224
3. Estimate context pressure first; do not delegate control where the task fits the window.
225
4. Log all five profile metrics per budget and read them together.
226
5. Split zero-compaction tasks into never needed and declined before interpreting uptake.
227
6. Ablate the timing instruction in both directions before fixing a threshold.
228
7. Expose compaction as a reversible collapse with archived originals, and log every reopen.
229
8. Refresh the usage readout at least as often as the model is expected to act on it.
230
9. Keep an overflow fallback under every policy, count its firings, and score errors as failures.
231
10. Report replicate spread and benchmark size beside every difference.
232
11. Report cumulative input tokens and, where observable, prefill compute; never context length alone.
233
12. Record model version and prompt hash with the assignment, and re-qualify on change.
234
235
## Gotchas
236
237
1. **Reputation is not disposition**: One of the four models in the study called the interface in a small minority of tasks and trailed the harness baseline at tight budgets, under the same instructions the others used (claim-compaction-control-uptake-variance). Nothing about a model's general standing says which way it will go; do not assign control from leaderboard position or from another model's profile.
238
2. **Zero uptake has two causes**: A task can end before compaction is needed, or the model can reach the warning and decline. Only the second is a control failure. Split them with the warning and fallback logs.
239
3. **One instruction, opposite effects**: The timing floor that held two models back from compacting at under half of the budget coincided with near-zero use in another, which compacted early and regularly once the floor was removed (claim-compaction-control-context-anxiety). Test both directions per model.
240
4. **Warning read as a stop signal**: One model mostly returned an answer after the first pressure warning instead of compacting (claim-compaction-control-warning-response). A premature answer scores as a normal completion, so inspect warning resolution, not only the task score.
241
5. **Compression factor is not summary size**: The denominator is the next request, which also carries the output of the call that compacted. The factor understates the edit and can fall below one.
242
6. **Reopen rate is a lower bound**: The study's authors say so of their own count without giving the reason. Two reasons a harness should expect: a model can recover lost state by re-running a search or re-reading a file, and archived events can be reachable through a read path the reopen counter does not instrument. Instrument every such path, and pair reopen rate with repeated-tool-call counts after each compaction.
243
7. **The fallback writes part of the score**: Drop-oldest at the hard limit is a third policy running under both conditions, and the study's authors note it can affect scores. Report firings per condition before attributing a gap to the policy under test.
244
8. **A shrunken budget is not a long task**: It reproduces pressure, not the drift, staleness, or multi-session structure of real long-horizon work. Confirm the assignment on at least one task at natural length.
245
9. **Pooling hides timing**: First-compaction fill is relative to the budget. Pooled across budgets it mixes regimes; report it per budget.
246
10. **Small benchmarks, large-looking gaps**: With tens of tasks, small differences between strategies or models may not be significant, as the study's authors say of their own results (claim-compaction-control-study-setup). Report the replicate spread and treat gaps inside it as no difference.
247
11. **Fewer tokens, same bill**: Cumulative input counts cached tokens, and each edit invalidates the cached suffix. Token savings become cost savings only where re-prefill is small or the suffix cache is reused (claim-compaction-control-suffix-kv-reuse).
248
12. **Stale readout, false anxiety**: A usage readout refreshed every few turns lets a model act on an old value. Verify the refresh cadence before reading first-compaction fill.
249
13. **Documentation lookup tax**: Models may read interface documentation before the first call. Under pressure that is a full-context turn; keep the essential signature in the readout line.
250
14. **Profiles expire**: The explanation offered for the strongest model's results is a conjecture about training, not a tested claim. Expect a model update or a prompt edit to move every metric.
251
252
## Integration
253
254
This skill connects to:
255
256
- self-managed-context - Owns the self-editing harness protocol, edit-position cost, and strategy training; this skill decides whether a model qualifies for that control and supplies the profile that tells its scheduled fallback when to engage
257
- context-compression - Owns what the summary written at a collapse must preserve
258
- context-optimization - Owns the harness threshold policy that serves as baseline and fallback
259
- evaluation - Owns general experiment design; this skill supplies the compaction-specific conditions and metrics
260
- harness-engineering - The compaction interface, timing instruction, and warning text are versioned harness surfaces
261
- tool-design - Owns the quality of the interface documentation the model reads on demand
262
- long-horizon-prompting - Owns stop and return conditions in the brief; this skill covers stops induced by context warnings
263
- context-degradation - Explains why a full window hurts; high pressure is the regime where this skill's decision matters
264
265
## References
266
267
Internal references:
268
- [Evidence](./references/evidence.md) - Read when: citing a number, checking an experimental setup, or reading the study's limitations
269
- [Profiling protocol](./references/profiling-protocol.md) - Read when: implementing the sweep, the trace schema, the metric formulas, the report, or the collapse interface
270
271
Related skills in this collection:
272
- self-managed-context - Read when: the model qualifies and the self-editing harness must be built
273
- context-compression - Read when: designing what a collapse summary preserves
274
- evaluation - Read when: building the surrounding regression suite and quality gates
275
276
External resources:
277
- Paper: [Letting Models Manage Their Own Context: Where We Stand](https://arxiv.org/abs/2611.34147)
278
- Companion post: [Model-driven context management](https://nvidia-nemo.github.io/Applied-Research/dev-notes/posts/2026-11-23-model-driven-context-management/)
279
- Code: [NVIDIA-NeMo/labs-OO-Agents](https://github.com/NVIDIA-NeMo/labs-OO-Agents)
280
281
---
282
283
## Skill Metadata
284
285
**Created**: 2026-11-26
286
**Last Updated**: 2026-11-26
287
**Author**: Agent Skills for Context Engineering Contributors; primary technical source Devoto et al., Letting Models Manage Their Own Context: Where We Stand (arXiv 2611.34147) and the public NOOA harness code
288
**Version**: 1.0.0
289