Skip to content

refactor: remove KEEP/REF marker system - #33

Merged
ranxianglei merged 1 commit into
masterfrom
2026-08-02_remove-keep-ref-markers
Aug 2, 2026
Merged

refactor: remove KEEP/REF marker system#33
ranxianglei merged 1 commit into
masterfrom
2026-08-02_remove-keep-ref-markers

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Why remove it

The [[KEEP:mNNNNN]] / [[REF:mNNNNN|desc]] marker system (src/keep-markers.ts) is being removed.

KEEP is semantically contradictory with compression. Its purpose is to re-inject verbatim original content into a summary — but if a message is important enough to keep verbatim, it should be excluded from the compress range, not compressed then padded back. In a fine-grained adapter (pai-acp supports per-message ranges) there is no "must compress a big block but save one gem inside" scenario that justifies it. Worse, expanding verbatim content can blow the context budget — compressing to save space, then un-expanding to spend it again.

REF added nothing. The expansion result [→ m00005: desc] is no better than the model writing (see m00005). The acp tags already expose refs on every message, so a dedicated syntax + resolver is dead weight.

Removed

  • src/keep-markers.ts (resolveKeepMarkers, KeepMarkerResult)
  • index.ts exports of resolveKeepMarkers / KeepMarkerResult
  • marker bullet from COMPRESS_PHILOSOPHY
  • "KEEP MARKERS" paragraph from HOW_TO_COMPRESS_RULES
  • 3 resolveKeepMarkers tests + their now-unused imports
  • README standalone-modules table row

Effect

The four compression-rule constants are now marker-free. Adapters can import them without inheriting marker teaching — eliminating the drift risk that motivated keeping a hardcoded copy. This is a breaking change (removed exports) but pai-acp is the only consumer and is updated in lockstep.

Test plan

  • 208 tests pass (was 211; 3 marker tests removed)
  • typecheck + build clean
  • dist no longer exports resolveKeepMarkers; no marker teaching text remains

The [[KEEP:mNNNNN]] and [[REF:mNNNNN|desc]] marker system is removed.

KEEP is semantically contradictory with compression: its purpose is to
re-inject verbatim original content into a summary, but if a message is
important enough to keep verbatim it should be excluded from the compress
range (pai-acp supports per-message ranges), not compressed then padded
back. In a fine-grained adapter like pai-acp there is no 'must compress
a big block but save one gem inside' scenario that justifies it, and
expanding verbatim content risks blowing the context budget.

REF added nothing over the model writing (see m00005) — the acp tags
already expose refs, so a dedicated syntax and resolver is dead weight.

Removed:
- src/keep-markers.ts (resolveKeepMarkers, KeepMarkerResult)
- index.ts exports of resolveKeepMarkers / KeepMarkerResult
- KEEP marker bullet from COMPRESS_PHILOSOPHY
- KEEP MARKERS paragraph from HOW_TO_COMPRESS_RULES
- 3 resolveKeepMarkers tests + their now-unused imports
- README standalone-modules table row

The four compression-rule constants are now marker-free, so adapters can
import them without inheriting marker teaching (no drift risk).
@ranxianglei
ranxianglei merged commit 5b0a3d2 into master Aug 2, 2026
5 of 6 checks passed
@ranxianglei ranxianglei mentioned this pull request Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant