Skip to content

feat(media): strip copied sent-media history notes from final replies - #46

Merged
offendingcommit merged 2 commits into
fix/media-delivery-visible-ackfrom
feat/strip-media-mirror-lines
Oct 30, 2026
Merged

offendingcommit merged 2 commits into
fix/media-delivery-visible-ackfrom
feat/strip-media-mirror-lines

Conversation

@offendingcommit

Copy link
Copy Markdown
Owner

Stacked on #43, which adds MEDIA_DELIVERED_REPLY.

Problem

After each media send, Hermes's send_message writes an assistant line into the history so the model remembers what it sent (_describe_media_for_mirror): [Sent voice message], [Sent image attachment], [Sent audio attachment] and so on. Models copy these lines into real replies, and users receive them as text. The private members' final replies contain 142 such lines, and every one sits on its own line.

Change

New strip_media_mirror_lines(text):

  • removes whole lines matching those shapes, and leaves a mention inside a sentence alone;
  • returns None when there is nothing to remove;
  • a reply left empty, or holding only NO_REPLY, becomes MEDIA_DELIVERED_REPLY.

memory-sync's composable transform_llm_output will call it, because memory-sync runs on all 14 members and persona-voice skips the Discord ones. Calling it from memory-sync also avoids Hermes's first-hook-wins rule.

Proof

  • Unit cases pass. Contract test: every shape the host's own _describe_media_for_mirror produces is stripped. It passes on the v0.21.2 pin and on v0.22.5 (bf0203a7).
  • Falsifier: removing audio from the pattern fails the contract subtest note='[Sent audio attachment]'.

https://claude.ai/code/session_01B6XeAU5Gn7ZaLQJVSg4AKC

Hermes' send_message records each media send as an assistant line
("[Sent voice message]", "[Sent audio attachment]", ...) so the model
remembers it. Models copy those lines into real replies and users
receive them as text: 142 such lines in the private members' final
replies, every one on its own line.

strip_media_mirror_lines removes whole matching lines and returns None
when there are none; a reply left empty or bare NO_REPLY becomes
MEDIA_DELIVERED_REPLY. A contract test feeds it every shape the host's
own _describe_media_for_mirror produces.

Claude-Session: https://claude.ai/code/session_01B6XeAU5Gn7ZaLQJVSg4AKC
…irror-lines

# Conflicts:
#	tests/test_hermes_contract.py
@offendingcommit
offendingcommit added this pull request to stack #47 October 30, 2026 19:23
@offendingcommit
offendingcommit merged commit 369c388 into main Oct 30, 2026
6 checks passed
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