Raw is kept forever (MemHub dropped its retention; lite stores nothing else),
so trim it once when it is written instead of on every history read.
- hy_memory/utils/raw_trim.py: one idempotent rule per speaker label.
user/system kept; assistant and other speakers cut to 500 chars + "...";
tool head/tail with coding.tool_result_max_bytes (default 2048).
- writer: L1_RAW (lite/pro/ultra) is flattened from trimmed messages and
flagged custom.raw_trimmed; request.messages (extractor input) untouched.
- _get_recent_history concatenates flagged raws as stored; legacy unflagged
raws are trimmed with the same rule on read.
- client: memory_history ADD record uses the same trimmed messages.
- coding preproc: tool/assistant truncation made idempotent so re-trimming
coding_trace history no longer rewrites omitted-count markers.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>