Skip to content

T2: Claude adapter capture-seam drop for .hypignore#207

Merged
philcunliffe merged 1 commit into
integration/hypignore-usage-policyfrom
task/hypignore-usage-policy/T2
Jun 30, 2026
Merged

T2: Claude adapter capture-seam drop for .hypignore#207
philcunliffe merged 1 commit into
integration/hypignore-usage-policyfrom
task/hypignore-usage-policy/T2

Conversation

@philcunliffe

Copy link
Copy Markdown
Contributor

Implements task T2 of hypignore-usage-policy.

Wires the shared usage-policy resolver (src/core/usage-policy, LLP 0050) into both Claude capture-seam drop-sites so an exchange whose resolved cwd is governed by an ancestor .hypignore is never written to the cache, for live capture and backfill (LLP 0049 R1/R2):

  • claude/src/projector.js: createClaudeExchangeProjector holds one resolver per projector; once the exchange cwd is resolved it returns no rows before building any, so the ai-gateway/src/source.js write guard persists nothing. Returns undefined (this projector's existing no-rows signal) rather than a literal [] which is an invalid projection. Live LLM call untouched (already streamed).
  • claude/src/backfill.js: createClaudeBackfillProvider holds one resolver per run and skips ignored sessions before projecting/writing, keyed on the same cwd the row would carry.
  • Both emit a structured usage_policy_drop event; resolver is injectable for hermetic tests.

Tests: test/plugins/claude-usage-policy-drop.test.js (ignored cwd => no rows / session skipped; clean and no-cwd unaffected).

Checks: npm run lint, npm run typecheck, npm run build:types, npm test (1503 pass / 1 skip) all green.

@ref LLP 0050 [implements]

Task-Id: T2

Wire the shared usage-policy resolver (LLP 0050 / src/core/usage-policy)
into both Claude capture-seam drop-sites so an exchange whose resolved
cwd is governed by an ancestor `.hypignore` is never written to the
cache, for live capture and backfill alike (LLP 0049 R1/R2):

- projector.js: createClaudeExchangeProjector holds one resolver per
  projector. Once the exchange cwd is resolved from the session-context
  record, an ignored cwd returns no rows BEFORE building any, so the
  ai-gateway source write guard persists nothing. Returning `undefined`
  is the projector's existing no-rows signal (a literal `[]` is an
  invalid projection that would log a spurious warning); the live LLM
  call already streamed, so it is untouched.
- backfill.js: createClaudeBackfillProvider holds one resolver per run
  and skips ignored sessions before projecting/writing, keyed on the
  same cwd the row would carry (record cwd, else first transcript line).
- Both drop-sites emit a structured usage_policy_drop event.
- Resolver is injectable on both factories for hermetic tests.

New test/plugins/claude-usage-policy-drop.test.js drives the real
matcher (injected fs) through the gateway dispatcher and the backfill
provider: ignored cwd => no rows / session skipped; clean cwd and
no-cwd unaffected.

@ref LLP 0050 [implements]
@ref LLP 0049#requirements [constrained-by]

Task-Id: T2
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@philcunliffe philcunliffe merged commit c33dd29 into integration/hypignore-usage-policy Jun 30, 2026
6 checks passed
@philcunliffe philcunliffe deleted the task/hypignore-usage-policy/T2 branch June 30, 2026 03:48
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