Skip to content

feat(claude-code): verified organic embedding for data-returning built-ins - #181

Open
saichandrapandraju wants to merge 2 commits into
feat/claude-code-conditional-injectionfrom
feat/claude-code-builtin-shapes
Open

saichandrapandraju wants to merge 2 commits into
feat/claude-code-conditional-injectionfrom
feat/claude-code-builtin-shapes

Conversation

@saichandrapandraju

@saichandrapandraju saichandrapandraju commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Stacked on #180. Make the common built-ins embed organically (not just fall back to a note), using shapes captured from a live Claude Code 2.1.x run.

Verified shapes → handling

Tool content field how
Read file.content (nested string) explicit shape map
Bash stdout (top-level string) generic fallback (no entry needed)
WebFetch result (top-level string) generic fallback (no entry needed)
WebSearch results (list of strings) new: _embed_dict embeds into a list-of-strings leaf (rides the last result)
MCP JSON string existing parse/embed/re-serialise

Changes

  • _CONTENT_PATH now holds only verified, non-top-level shapes: Read (nested) and WebSearch (list).
  • _embed_dict handles a list-of-strings leaf (for WebSearch.results).
  • Dropped the previousBash/Grep/Glob entries: Bash is covered identically by the generic fallback; Grep/Glob aren't exposed in the tested build, so their shapes are unverified — the fallback still embeds them if their result is a top-level string, else they degrade gracefully to additionalContext.

Verification

Shapes were captured from a live claude -p run (a full-dump PostToolUse probe); embedding is unit-tested against those exact shapes. The top-level-string fallback path (now covering WebFetch) is already E2E-proven by the Bash/Read gateway runs — same code, different field. WebSearch's new list path is unit-tested. 334 tests pass; ruff + pyright clean.

Sequence

#171 → #177 → #180 → this → [#3 input-poisoning] → #179 (subagents, rebased last).

🤖 Generated with Claude Code

…built-ins

Make the common built-ins embed organically out of the box, based on shapes
captured from a live Claude Code 2.1.x run rather than guessed:

- Read  -> file.content (nested string): explicit shape map (kept).
- Bash  -> stdout, WebFetch -> result (top-level strings): already handled by
  the generic fallback -- no explicit entry needed.
- WebSearch -> results (a list of result strings): new handling; the payload
  rides the last result. _embed_dict now embeds into a list-of-strings leaf.

Drop the previously guessed Bash/Grep/Glob entries: Bash is covered by the
fallback identically, and Grep/Glob are not exposed in the tested build so their
shapes are unverified -- the fallback still embeds them if their result is a
top-level string, else they degrade to the additionalContext note. The README
gains a "targeting built-in tools" table and notes the set is version/config
dependent (confirm names via a baseline run's recorded calls).

Shapes verified via a live run; embedding unit-tested against them. The
top-level-string fallback path (now covering WebFetch) is already E2E-proven by
the Bash/Read gateway runs. 334 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: saichandrapandraju <saichandrapandraju@gmail.com>
@saichandrapandraju
saichandrapandraju added this pull request to stack #178 October 15, 2026 14:12
@saichandrapandraju saichandrapandraju changed the title feat(claude-code): verified organic embedding for data-returning built-ins (stacked on #180) feat(claude-code): verified organic embedding for data-returning built-ins Oct 15, 2026

This branch has not been deployed

No deployments
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