Skip to content

feat(tools): opt-in tool-catalog shrink via tok; bump submodule to #83 - #236

Merged
Patel230 merged 2 commits into
mainfrom
feat/toolschema-wiring
Aug 23, 2026
Merged

feat(tools): opt-in tool-catalog shrink via tok; bump submodule to #83#236
Patel230 merged 2 commits into
mainfrom
feat/toolschema-wiring

Conversation

@Patel230

Copy link
Copy Markdown
Contributor

Summary

Phase 2 of the approved compression plan: wires tok's new toolschema compressor (GrayCodeAI/tok#83) into the outgoing request path behind HAWK_TOOL_SHRINK=1 (default off → request bytes unchanged).

Stacked on #235 (invariant markers); submodule pointer here is tok main at #83.

Changes

  • ChatService.BuildOptions: after assembling options, tools pass through shrinkEyrieTools — converted to the OpenAI function-catalog wire shape, shrunk, converted back.
  • Fail-open guarantees: marshal/unmarshal error, tool-count drift, or name mismatch at any position ⇒ original list returned untouched; disabled or not-smaller catalogs are no-ops.
  • Recovery: when shrink lands, the exact pre-shrink catalog persists to state/tool-catalog-originals/<sha256-8>.json; one-time info log reports before/after bytes.
  • Facades: internal/token aliases tok.ToolShrinkStats, exposes ShrinkToolCatalog/LintToolCatalog; engine token facade re-exports.

Testing

4 new tests: disabled-by-default no-op; enabled reduction preserving names/constraints/required through BuildOptions; recovery-file persistence. Full engine suite green; lint 0 issues.

Wires tok's new toolschema compressor (GrayCodeAI/tok#83) into the
outgoing request path behind HAWK_TOOL_SHRINK=1 (default off, request
bytes unchanged).

At ChatService.BuildOptions the tool list converts to the OpenAI
function-catalog wire shape, shrinks, and converts back. Fail-open
guarantees: any marshal/unmarshal error, tool-count drift, or name
mismatch at any position returns the original list untouched; disabled
or not-smaller catalogs are no-ops. When compression lands, the exact
pre-shrink catalog persists under state/tool-catalog-originals/<sha>.json
keyed by content hash for recovery and diffing, and a one-time info log
reports before/after byte counts.

Facades extended: internal/token aliases tok.ToolShrinkStats and exposes
ShrinkToolCatalog/LintToolCatalog; internal/engine/token re-exports.

Submodule bump includes tok#82 invariants (already wired separately on
feat/invariant-markers; this branch stacks on it for the pointer).

New tests: disabled-by-default no-op, enabled reduction with name/
constraint/required preservation through BuildOptions, and recovery-file
persistence.
Rebase onto post-#235 main; update the tok require directive to the
toolschema merge and align the gitlink, satisfying release parity.
@Patel230
Patel230 force-pushed the feat/toolschema-wiring branch from 9403599 to b51a7ab Compare August 23, 2026 03:41
@Patel230
Patel230 merged commit 673529e into main Aug 23, 2026
26 checks passed
@Patel230
Patel230 deleted the feat/toolschema-wiring branch August 23, 2026 03:55
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