Skip to content

feat(messages): detect pasted content in user messages #405

Closed

Description

@Sinity

Problem

User messages in the archive frequently contain large paste content (prior chatlogs being handed forward, AI tool output, code blocks, command output). When trying to surface what the user actually wrote — e.g. extracting their original framing of a project or their captured intent across many sessions — these pastes dominate by byte volume and bury the typed prose.

Concrete example: dumping all user messages across 35 sessions in one project yielded 906 KB total. The top 10 messages accounted for 69 % of that and were chatlog pastes (> previous chatlog attached below, > showing you last chatlog, etc.). The remaining ~280 KB was real user prose.

A coarse heuristic filter (length > 4 KB + content-shape markers) caught the worst offenders, but doesn't solve the general case: small embedded code pastes, tool-output pastes, structured documents pasted into otherwise-typed messages.

What success looks like

Per-message metadata distinguishing typed-by-human content from pasted/inserted content. Enables:

  • A polylogue --typed-only filter that strips paste segments
  • A "what did the user actually write" query mode for analysis / retrospective intent extraction
  • Stats grouped by paste-ratio for understanding session shapes

Activity

  1. Sinity commented on Apr 25, 2026

    @Sinity
    OwnerAuthor

    Detection method (portable)

    Content-shape classifier as default — works on any provider's archive, no external data needed:

    • Length cutoff: > ~4000 chars near-certainly contains paste; < 200 chars near-certainly typed; in between, content-shape decides.
    • Provider-specific markers: <task-notification>, ● Bash(, claude-code tool-output prefixes, shell-prompt patterns (~ ❯, /realm/...), bracketed system reminders, fenced code with shell language hint.
    • Resumption pastes: messages starting with > previous chatlog, showing you last chatlog, tail end of, here's tail end of recent session.
    • Structural uniformity: long contiguous paragraphs with no typo / consistent capitalization / consistent markdown formatting are paste-shaped.
    • AI-output telltales: `✓`, `⎿`, … +N lines (ctrl+o to expand), "### Key insight" headings.

    Produce per-message: { paste_likelihood: 0..1, paste_segments: [{start, end, source: 'shape', confidence}], shape_signals: {...} }.

    Some providers (claude.ai web, codex) may also persist paste-event metadata on submit (timestamped paste actions, attachment vs typed). Worth checking what's in the raw conversation JSON before computing — if the provider already marks pastes, use that as ground truth.

  2. Sinity commented on Apr 25, 2026

    @Sinity
    OwnerAuthor

    Personal-dataset side-channels (not for upstream)

    For my own setup (Wayland + Hyprland + clipse + scribe-tap), I have stronger ground-truth signals available:

    • clipse history — verbatim match of message segments against recent clipboard entries gives high-precision paste detection
    • scribe-tap keylog — counting keystrokes during message-compose window gives the typed/pasted ratio directly

    These are too idiosyncratic to integrate into polylogue itself, but a plugin / external-enrichment hook (polylogue enrich --plugin <path>) would let me layer them on locally without polluting the main project.

  3. added
    type:feat
    area:core
    on Apr 26, 2026
  4. changed the title [-]Detect paste content in user messages[/-] [+]feat(messages): detect pasted content in user messages[/+] on Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corearea:parsertype:feat

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions