Skip to content

capture(claudecode): each message body is JSON-parsed twice #37

Description

@JumpTechCode

recordToTurn calls blocksOf(rec.Message.Content), and then toolIDs(&rec)
calls it again on the same bytes to collect tool-call identifiers. The largest
line in a local store is 4.3 MB, so that is a second multi-megabyte unmarshal
for a result already computed.

The duplication is also the only place where the two walks could be made to
diverge by a later edit — they agree today because both select tool_use blocks
from the same slice in the same order.

Fix

Have recordToTurn return the identifiers alongside the turn, and delete
toolIDs.

Activity

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

    capture-adapterThe Claude Code capture adapterenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions