Skip to content

feat: capture thinking blocks from Claude Code (#78) - #156

Merged
NehharShah merged 1 commit into
mainfrom
feat/thinking-blocks
Nov 20, 2026
Merged

NehharShah merged 1 commit into
mainfrom
feat/thinking-blocks

Conversation

@NehharShah

Copy link
Copy Markdown
Collaborator

What changed and why

claude.ts read only text and tool_use blocks; thinking blocks — where the agent shows where it got confused or changed approach — were dropped, so a recovered session was indistinguishable from a lucky one. They are now captured as one redacted, truncated excerpt on the session (NormalizedSession.thinking → WorkflowTrace.thinking).

The shape: each block is redacted and truncated at parse time (400 characters per block, via the same redactTruncated pass as assistant text); the blocks join into one excerpt capped at 2,000 characters for the whole session. Verified against real transcripts first: thinking blocks are {type: "thinking", thinking, signature} — the signature is ignored.

"Used for analysis only", enforced: the excerpt lives on the trace as analysis input. Nothing displays it, and by construction nothing generates from it — skills, memory and the handbook are built from steps, commands and corrections, none of which touch the new field. docs/architecture.md states both the capture and the guarantee. The obvious consumer (telling a genuinely recovered session apart from a lucky one, per the issue's motivation) is a follow-up: the data is now there for it.

Docs

docs/architecture.md (the Claude Code paragraph: the excerpt, its caps, and the never-generated-from guarantee).

Testing

pnpm lint, pnpm typecheck, pnpm build, pnpm test: 752 passed, 18 skipped.

New test: thinking blocks with an embedded npm token come out redacted (REDACTED present, the raw token absent), eight blocks join into one excerpt capped at 2,000 characters.

)

thinking blocks - where an agent shows confusion or a change of approach -
were dropped. They are now captured as one redacted, truncated excerpt on
the session (400 characters per block, 2,000 total), for analysis only:
nothing displays it and no skill, memory entry or handbook practice is
generated from it.
@NehharShah
NehharShah merged commit c29a774 into main Nov 20, 2026
23 checks passed
@NehharShah
NehharShah deleted the feat/thinking-blocks branch November 20, 2026 20:28
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