Skip to content

Age-based synthetic reclaim can silently discard still-relevant tool output #239

Description

@tracycam

Problem

Magic Context currently has a positional two-pass reclaim path for tool results:

  1. an execute-class pass advances tool_reclaim_watermark /
    last_execute_ordinal to the current frontier;
  2. a later mutating execute or hard-fold pass selects every older tool arc at or
    below that frontier;
  3. those arcs are dropped even when there was no explicit ctx_reduce request,
    no semantic supersession, and no emergency context pressure.

This makes tool output disappear as a side effect of an otherwise unrelated
context mutation. Age alone is not a reliable indication that a tool result is no
longer useful, so the behavior can remove evidence the model still needs and make
context changes difficult to attribute or debug.

The same policy exists in the OpenCode plugin, Pi plugin, and Rust module selector.

Expected behavior

Normal tool-result removal should have an attributable trigger:

  • an explicit agent ctx_reduce request;
  • a configured smart_drops supersession rule; or
  • emergency context-pressure protection.

A previous execute watermark should not silently select a tool result for removal.

Proposed change

  • Remove the age/watermark synthetic reclaim selector and watermark advancement
    from OpenCode and Pi.
  • Remove the equivalent selector from the Rust module.
  • Keep explicit ctx_reduce, smart_drops, Historian/Dreamer behavior, and
    emergency cleanup unchanged.
  • Retain the legacy storage fields as inert compatibility data so existing
    databases and serialized state do not require a migration.
  • Update documentation and generated schema/reference wording so smart_drops
    no longer implies general age-based cleanup.

Compatibility / trade-off

No schema migration is required. Context may retain more old tool output when
neither explicit reduction nor a supersession rule applies; emergency cleanup
remains the final pressure guard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions