Skip to content

feat(sandbox): opt-in Costwise model routing hooks + ADR 0090 (POC) - #6361

Draft
guyoron1 wants to merge 4 commits into
fullsend-ai:mainfrom
guyoron1:feat/costwise-sandbox-routing
Draft

feat(sandbox): opt-in Costwise model routing hooks + ADR 0090 (POC)#6361
guyoron1 wants to merge 4 commits into
fullsend-ai:mainfrom
guyoron1:feat/costwise-sandbox-routing

Conversation

@guyoron1

Copy link
Copy Markdown

Draft / POC for the 2026-08-19 contributors meeting — not ready for review.

Phase 1 of cost-aware model routing (see ADR 0090 in this PR):

  • images/sandbox/Containerfile: install Costwise + its hook scripts under /opt/costwise/hooks
  • internal/security/hooks.go: when FULLSEND_COSTWISE=1, GenerateClaudeSettings adds UserPromptSubmit / PreToolUse(Agent|Task) routing hooks. Default output is byte-identical (tested).
  • docs/ADRs/0090-cost-aware-model-routing.md: context (July-12 30-issue benchmark on the full pipeline: RTK+Ponytail 15.7% total, triage 52.6%, code 24.2%, Wilcoxon p=0.00006), Phase 1 hooks vs Phase 2 native internal/routing Go port.

Known gaps (why draft): Costwise pinned to mutable main (no release tag yet); sandbox CLAUDE_CONFIG_DIR vs where Costwise writes the model switch is unverified; ADR status set to Accepted only to satisfy the frontmatter linter — should be Proposed. Companion: fullsend-ai/agents PR flipping triage→haiku / review→sonnet defaults.

Verified: go build ./..., go test ./internal/security/ ./internal/scaffold/, ADR linters.

Pip-install costwise from guyoron1/costwise and copy its Claude Code hook
scripts to /opt/costwise/hooks. Not wired into settings.json by default;
see internal/security for the FULLSEND_COSTWISE=1 opt-in (ADR 0090).

Signed-off-by: guy oron <goron@redhat.com>
When FULLSEND_COSTWISE=1, GenerateClaudeSettings adds a UserPromptSubmit
hook and an Agent|Task PreToolUse hook pointing at /opt/costwise/hooks.
Default output is unchanged.

Signed-off-by: guy oron <goron@redhat.com>
Phase 1: costwise hooks in the sandbox image (opt-in). Phase 2: native
internal/routing port. Records the 2026-07-12 RTK+Ponytail benchmark.

Signed-off-by: guy oron <goron@redhat.com>
@github-actions

Copy link
Copy Markdown

E2E tests did not run

E2E tests run automatically for org/repo members and collaborators on pull requests.

For other contributors, a maintainer must add the ok-to-test label after the latest push.

See E2E testing guide for details.

@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown

Site preview

Preview: https://3f0da899-site.fullsend-ai.workers.dev

Commit: e89635e9273d7ff8ec3298fb54f4aef2b6e66dd7

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

… 3 models)

39/39 trials complete with metrics.json; haiku $0.20-0.75/issue vs opus
$0.33-4.30. No-op detection proved model-insensitive (#340, #365). Grid
measures cost/completion only - quality judgment over the 13x3 outputs is
the stated gate before routing defaults change.

Co-Authored-By: Claude Fable 5 <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