Skip to content

TAP-1988: opt into Tool Search BETA in build_claude_command#23

Merged
wtthornton merged 1 commit into
mainfrom
tap-1988-tool-search-beta
May 17, 2026
Merged

TAP-1988: opt into Tool Search BETA in build_claude_command#23
wtthornton merged 1 commit into
mainfrom
tap-1988-tool-search-beta

Conversation

@wtthornton
Copy link
Copy Markdown
Owner

Summary

TAP-1988 — Without the advanced-tool-use-2025-11-20 Anthropic beta header, the API hides every tool annotated defer_loading: true from the catalog entirely — the agent has no way to discover or fetch them via Tool Search. Adding the header turns deferral into "lazy load on demand," which is the recovery path the deferred-loading work in the parent TAP-1983 epic depends on.

build_claude_command now exports ANTHROPIC_BETA before every Claude CLI invocation (read by the Anthropic SDK, forwarded as the anthropic-beta HTTP header). Behavior is operator-friendly:

  • Default on: RALPH_BETA_TOOL_SEARCH=true (unset = true) → header exported.
  • Escape hatch: RALPH_BETA_TOOL_SEARCH=false → no export.
  • Compose-safe: an operator-set ANTHROPIC_BETA="some-other-beta" is preserved; the tool-search token is appended with a comma. If the token is already present, the env var is left untouched (no duplication across repeated build_claude_command calls).

templates/ralphrc.template gains an "ANTHROPIC BETA FEATURES" section documenting the override.

Test plan

  • bats tests/unit/test_build_claude_command.bats6 cases pass: default-on export, RALPH_BETA_TOOL_SEARCH=false skip, operator-set value preserved + appended, no-duplication across repeated calls, already-present-token noop, ralphrc.template documents the override
  • bats tests/unit/test_plan_mode_high_risk.bats — 13 cases pass (no regression in the other build_claude_command surface area)
  • bats tests/unit/test_hooks.bats — 94 cases pass (HOOKS-6 build_claude_command --agent assertions still green)
  • Operator validation: one end-to-end Ralph loop demonstrates a deferred tool getting fetched via Tool Search (AC requires; defer to operator run since Tool Search depends on tools that ship in later TAP-1983 stories)

🤖 Generated with Claude Code

Without the `advanced-tool-use-2025-11-20` beta header, the Anthropic
API hides every tool annotated `defer_loading: true` from the catalog
entirely — the agent has no way to discover or fetch them via Tool
Search. Adding the header turns deferral into "lazy load on demand,"
which is the recovery path the deferred-loading work in the parent
TAP-1983 epic depends on.

build_claude_command now exports ANTHROPIC_BETA before every Claude
CLI invocation (read by the Anthropic SDK, forwarded as the
`anthropic-beta` HTTP header). Multi-value betas are comma-separated,
so any operator-set ANTHROPIC_BETA is preserved and the tool-search
token is appended; if the token is already present, the env var is
left untouched. RALPH_BETA_TOOL_SEARCH=false skips the export entirely
(operator rollback).

templates/ralphrc.template gains an ANTHROPIC BETA FEATURES section
documenting RALPH_BETA_TOOL_SEARCH=true as the default and the
escape-hatch value.

Coverage: 6 new BATS cases in tests/unit/test_build_claude_command.bats
following the same `awk + eval` function-extraction pattern as
test_plan_mode_high_risk.bats — default-on export, RALPH_BETA_TOOL_SEARCH=false
skip, operator-set value preserved, no-duplication across repeated calls,
already-present-token noop, ralphrc.template documents the override.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wtthornton wtthornton merged commit 211a757 into main May 17, 2026
5 checks passed
@wtthornton wtthornton deleted the tap-1988-tool-search-beta branch May 17, 2026 18:49
wtthornton added a commit that referenced this pull request May 17, 2026
… BETA, branch hygiene)

Bumps RALPH_VERSION + package.json to 2.15.2. CHANGELOG entry covers
the seven tickets shipped via PRs #22, #23, #24:

* TAP-1881 / TAP-1882 / TAP-1883 — .gitignore allowlist + idempotent
  upgrade backfill, single source-of-truth helper, 14-pattern leak
  fix originating from TAP-1682 (Fixed)
* TAP-1988 — Tool Search BETA opt-in via ANTHROPIC_BETA header (Added)
* TAP-1878 / TAP-1879 / TAP-1880 — branch hygiene epic (prompt-side
  delete + harness-side janitor with git cherry detection) (Added)

Unit suite: 1751 → 1778 cases (+27) across 4 new BATS files.
All green; full suite still 100% pass.

Real-world post-merge validation of the new janitor (TAP-1880):
deleted 2 stale tap-1838-* branches in this repo on first run with
no manual intervention.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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