Repository navigation
Fix capture hook dropping drafts and leaking injected context - #5
Merged
Merged
Conversation
- Without an extraction model every hook capture used the same placeholder summary, and the duplicate fingerprint covered only that summary, so every capture after the first in a scope was dropped as a duplicate. Hook payloads now mark themselves evidence_only, and those drafts are fingerprinted on the summary plus the redacted excerpt. Explicitly proposed facts still dedupe on the fact alone. - Claude Code transcripts include api-request-blob records that repeat each user turn together with harness-injected <system-reminder> context (account email, workspace details). The Claude reader now keeps only user and assistant turns, skips isMeta records, and strips system-reminder blocks; the server strips them from captured summaries and excerpts as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two bugs in automatic (hook) capture, found while running a real Claude Code (Opus 5.5) session against a local Hindsight.
1. Every hook capture after the first was dropped
Without an extraction model, hook captures all send the placeholder summary "Captured agent evidence; requires human review." The duplicate fingerprint covered only the summary, so the server returned
extraction_state: duplicatefor every capture after the first in a scope. Automatic capture effectively saved one draft, ever.Fix: hook payloads set
evidence_only: true; those drafts are fingerprinted on summary + redacted excerpt. Explicitly proposed facts (MCPpropose_clue, CLI) still dedupe on the fact alone, so rejection suppression is unchanged.2. Harness-injected context leaked into clue evidence
Current Claude Code transcripts contain
api-request-blobrecords that repeat each user turn together with injected<system-reminder>context (account email, workspace details). The hook read them as user messages, so drafts contained that context (the email was redacted, but other workspace details need not be) and each prompt appeared twice.Fix: the Claude reader keeps only
user/assistantrecords, skipsisMeta, and strips<system-reminder>blocks. The server also strips them from captured summaries and excerpts, since any client can send them.Tests
test_transcript_drafts_dedupe_on_evidence_and_drop_injected_context(integration) andtest_claude_capture_skips_request_copies_and_injected_context(agent contract). Both fail onmainand pass here.type: "assistant").pytest(87),ruff check,ruff format --check,mypypass.🤖 Generated with Claude Code