You compress MEMORY.md aggressively while preserving facts.

INPUT MEMORY (currently {total_chars} chars; recommended total is 8 KB / 8192 chars and the file is approaching/over that cap):
Section sizes: {size_summary}. Worst section: {worst}.

HARD TARGETS for the output:
- Total <= 6000 chars (leaves room for the next consolidation cycle)
- Each Facts entry <= 200 chars (prefer ~120)
- Facts: target 15-25 entries, HARD MAX 25. If input has more content,
  MERGE clusters of similar items (repeated test/probe results, endpoints,
  tickets, version bumps, related metrics) into 1-3 summary entries
  instead of one per item. If splitting an oversized fact would push
  total above 25, SHORTEN/MERGE other entries first.
- Recent Activity: if `worst` above is **not** Recent Activity, copy
  it verbatim. If `worst` IS Recent Activity, you may also compress
  this section (dedup near-duplicate entries; never reduce below 12).

COMPRESSION RULES:
- Merge Facts entries that share a tag and topic into ONE entry
- If a single Facts entry is too long, SPLIT into 2-3 short tagged entries
- Drop redundant detail (verbose context, dev notes, exact byte counts)
- PRESERVE VERBATIM: OIDs, GUIDs, emails, ICM/PR/ADO/MSRC/SIR numbers,
  file paths, URLs, ports, version numbers — do NOT modify any identifier
- Facts MUST be written in English (cross-session consistency).
  Recent Activity may stay in whichever language the input used.
- `Nx` prefix on Facts entries (e.g. `5x pref: dark theme`) is the
  AFFIRMED COUNT — number of past consolidations where the LLM
  EXPLICITLY re-emitted this fact (not just survived carry-over).
  Same shape as `3x improvement` in English. Only present when count
  >= 2.

  - HIGH counts (4x, 5x, 10x...) mark facts the LLM has repeatedly
    affirmed across sessions — strong importance signal. Keep intact,
    never replace with weaker variants.
  - When a fact is both STALE (see Fact Usage Signals) AND has low or
    no Nx, treat it as a strong eviction candidate.
  - Code maintains the count automatically. You MAY copy the prefix
    verbatim or omit it; either way it is refreshed on write. Do NOT
    manually change the number — edits will be overwritten.
  - Do NOT remove the italic legend line under `## Facts`. Code
    re-applies it on every write; LLM edits to it are discarded.

TAG SEMANTICS (use the most specific tag; 'note' is LAST RESORT):
  pref     - user preferences (style, language, response format)
  tech     - tech stack, tools, versions, infra topology
  proj     - project metadata (workspace, config, architecture)
  user     - user role, team, responsibilities
  decision - design decisions WITH rationale
  workflow - work patterns and processes
  contact  - people, teams, emails
  note     - LAST RESORT, only if nothing else fits

OUTPUT FORMAT (the H1 '# Memory' line is REQUIRED):

```memory
# Memory

[optional `doing: <task>` line if present in input — copy verbatim]

## Facts

<tag: short content — one entry per line, <=200 chars>
...

## Recent Activity

<YYYY-MM-DD entries; copy verbatim unless Recent Activity was the
 worst-over-budget section>
```

ESCAPE HATCH: if you genuinely cannot compress without losing facts,
output the literal token IMPOSSIBLE inside the memory block instead of
a memory body. Do NOT echo the input back unchanged.
