You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Responsibilities identified: 4 distinct concerns in a single module
Evidence
The file bundles four unrelated transform features under one module:
Concern
Functions
Lines
ANSI stripping
stripAnsi, applyAnsiStrip
40–135 (~95 lines)
Cache breakpoint injection
withCacheControl, injectCacheBreakpoints
53–264 (~75 lines)
Ephemeral TTL upgrading
upgradeEphemeralTtl
265–343 (~78 lines)
Tool scrubbing
buildToolScrubPattern, applyToolDrop
68–190 (~122 lines)
Transform composition
loadCustomTransform, makeAnthropicTransform
344–459 (~115 lines)
The ANSI stripping concern is entirely orthogonal to cache management and tool dropping — these are three independent data-transformation pipelines that happen to be assembled by makeAnthropicTransform. The 78-line upgradeEphemeralTtl function alone has an outer: label and nested loop with 5+ levels of indentation, making it hard to review in context.
No public API change required — makeAnthropicTransform, loadCustomTransform, and EXTENDED_CACHE_BETA continue to be exported from anthropic-transforms.js. Sub-module internals are not re-exported.
Effort Estimate
Low
Benefits
ANSI stripping is a generic utility that could be reused by other providers (e.g., OpenAI); extracting it enables reuse
Cache control logic is independently testable without constructing a full transform pipeline
upgradeEphemeralTtl's complex nested loop is easier to review in isolation
Reduces cognitive load when reviewing Anthropic-specific proxy behavior
Detected by Refactoring Scanner workflow. Run date: 2026-05-20
Note
🔒 Integrity filter blocked 2 items
The following items were blocked because they don't meet the GitHub integrity level.
#135search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#1376search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
To allow these resources, lower min-integrity in your GitHub frontmatter:
Refactoring Opportunity
Summary
containers/api-proxy/anthropic-transforms.jsEvidence
The file bundles four unrelated transform features under one module:
stripAnsi,applyAnsiStripwithCacheControl,injectCacheBreakpointsupgradeEphemeralTtlbuildToolScrubPattern,applyToolDroploadCustomTransform,makeAnthropicTransformThe ANSI stripping concern is entirely orthogonal to cache management and tool dropping — these are three independent data-transformation pipelines that happen to be assembled by
makeAnthropicTransform. The 78-lineupgradeEphemeralTtlfunction alone has anouter:label and nested loop with 5+ levels of indentation, making it hard to review in context.Proposed Split
containers/api-proxy/anthropic-transforms.js→ 3 focused modules:containers/api-proxy/transforms/ansi-strip.js—stripAnsi,applyAnsiStrip(~50 lines; reusable across providers)containers/api-proxy/transforms/cache-control.js—withCacheControl,injectCacheBreakpoints,upgradeEphemeralTtl(~160 lines; cache-specific logic)containers/api-proxy/transforms/tool-drop.js—buildToolScrubPattern,applyToolDrop(~80 lines)containers/api-proxy/anthropic-transforms.js—loadCustomTransform,makeAnthropicTransformcomposition only (~80 lines; imports from sub-modules)Affected Callers
No public API change required —
makeAnthropicTransform,loadCustomTransform, andEXTENDED_CACHE_BETAcontinue to be exported fromanthropic-transforms.js. Sub-module internals are not re-exported.Effort Estimate
Low
Benefits
upgradeEphemeralTtl's complex nested loop is easier to review in isolationDetected by Refactoring Scanner workflow. Run date: 2026-05-20
Note
🔒 Integrity filter blocked 2 items
The following items were blocked because they don't meet the GitHub integrity level.
search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter: