Context
RemoteClaw is middleware that delegates LLM execution to CLI agents (Claude Code, Gemini, Codex, OpenCode). The CLI agents own LLM API communication, including per-provider message-transcript formatting (how to sanitize tool_call_ids for Google, how to order turns for Gemini, how to preserve thinking signatures for Anthropic, etc.).
src/agents/transcript-policy.ts contains resolveTranscriptPolicy(...) — a function that returns a TranscriptPolicy object describing how to sanitize a transcript for a specific LLM API protocol. Its input parameters (modelApi, provider, modelId) are concerns middleware doesn't have: RemoteClaw doesn't speak LLM API protocols. It relays messages to CLI subprocesses that speak their own CLI-stdio protocols (ACP, Claude Code JSON stream, etc.), which are already abstracted over LLM-API specifics.
This is platform concern masquerading as middleware code. Leftover from the pre-fork embedded execution path.
Problem
Live-by-attestation, dead-by-consumption
src/agents/transcript-policy.ts:10-12 declares MODULE_ATTESTATIONS = { resolveTranscriptPolicy: "live" } (enforced by scripts/check-attestations.mjs — the attestation-gate CI check).
src/agents/transcript-policy.test.ts exercises resolveTranscriptPolicy with 13+ test scenarios.
- Zero production callers. Exhaustive search:
rg -n "resolveTranscriptPolicy" src/ ui/ extensions/ apps/ --type ts -g '!*.test.ts'
# Returns only the declaration itself
- The gateway, middleware, and auto-reply paths have zero references to
transcript-policy or resolveTranscriptPolicy.
The attestation says "live" but no production code consumes the function. This is an inconsistency: the attestation system records intent, not actual wiring, and here intent has outlived relevance.
The isGoogleModelApi stub at line 14 makes Google policies unreachable
transcript-policy.ts:14 defines a module-local stub:
const isGoogleModelApi = (..._args: unknown[]): boolean => false;
Introduced in #2303 / merge #2333 (gut(stubs): sweep gutted CLI/command/agent stubs and clean up consumers). This stub shadows the REAL isGoogleModelApi function in src/agents/agent-helpers/google.ts (which agent-helpers.ts re-exports). Because the local stub always returns false, every Google-specific branch in resolveTranscriptPolicy is permanently dead:
isGoogle = false always → applyGoogleTurnOrdering, validateGeminiTurns, Gemini thought-signature sanitization never activate for Google models.
This would be a genuine bug if the function were wired — but it isn't. It's bug-free-by-death. No need to fix the stub because the whole function goes away.
Imports are shared utilities, NOT orphaned by removal
import { normalizeProviderId } from "./provider-utils.js" → provider-utils.ts has 20+ importers across auth/, agents/, commands/, cron/. Not orphaned.
import type { ToolCallIdMode } from "./tool-call-id.js" → tool-call-id.ts has 5+ importers (agent-helpers, session-transcript-repair, agent-helpers/images). Not orphaned.
Scope is cleanly bounded to the file + its test.
Non-goals
- Don't fix the
isGoogleModelApi stub by importing the real function. The file is being deleted; repairing the stub would be dead work.
- Don't preserve the attestation entry. Removing the file removes its attestation declaration;
scripts/check-attestations.mjs scans dynamically and won't complain about a non-existent file.
- No
LEGACY_CONFIG_RULES / migration. This is not a config field — it's a source module. File deletion is the migration.
- No backward-compat shim. No code depends on the exported symbol.
Tasks
- Delete
src/agents/transcript-policy.ts (146 lines).
- Delete
src/agents/transcript-policy.test.ts.
- Run
pnpm tsgo and pnpm lint to confirm no broken imports (expected: none, since no production code imports from this file).
- If the post-build scripts (
scripts/post-build.mjs or similar) reference transcript-policy specifically, remove those references. Verify via rg -n "transcript-policy" scripts/.
Acceptance Criteria
src/agents/transcript-policy.ts does not exist.
src/agents/transcript-policy.test.ts does not exist.
rg -n "transcript-policy" src/ ui/ extensions/ apps/ scripts/ returns only references in this issue's body (none in code).
rg -n "resolveTranscriptPolicy" src/ returns no hits.
rg -n "TranscriptPolicy\\b" src/ returns no hits (the exported type also dies with the file; nothing consumes it).
pnpm tsgo clean.
pnpm lint clean.
pnpm test passes with fewer tests (the 13+ test cases in transcript-policy.test.ts are gone; net decrease expected).
- All required CI gates pass:
rebrand-gate, zombie-import-gate, stub-debt-gate, throwing-stub-callers-gate, obsolescence-audit-gate, attestation-gate (the attestation-gate should be happy because the file's MODULE_ATTESTATIONS is gone along with its exports), docs, build, test, lint.
Out of scope
References
Context
RemoteClaw is middleware that delegates LLM execution to CLI agents (Claude Code, Gemini, Codex, OpenCode). The CLI agents own LLM API communication, including per-provider message-transcript formatting (how to sanitize tool_call_ids for Google, how to order turns for Gemini, how to preserve thinking signatures for Anthropic, etc.).
src/agents/transcript-policy.tscontainsresolveTranscriptPolicy(...)— a function that returns aTranscriptPolicyobject describing how to sanitize a transcript for a specific LLM API protocol. Its input parameters (modelApi,provider,modelId) are concerns middleware doesn't have: RemoteClaw doesn't speak LLM API protocols. It relays messages to CLI subprocesses that speak their own CLI-stdio protocols (ACP, Claude Code JSON stream, etc.), which are already abstracted over LLM-API specifics.This is platform concern masquerading as middleware code. Leftover from the pre-fork embedded execution path.
Problem
Live-by-attestation, dead-by-consumption
src/agents/transcript-policy.ts:10-12declaresMODULE_ATTESTATIONS = { resolveTranscriptPolicy: "live" }(enforced byscripts/check-attestations.mjs— the attestation-gate CI check).src/agents/transcript-policy.test.tsexercisesresolveTranscriptPolicywith 13+ test scenarios.transcript-policyorresolveTranscriptPolicy.The attestation says "live" but no production code consumes the function. This is an inconsistency: the attestation system records intent, not actual wiring, and here intent has outlived relevance.
The
isGoogleModelApistub at line 14 makes Google policies unreachabletranscript-policy.ts:14defines a module-local stub:Introduced in #2303 / merge #2333 (
gut(stubs): sweep gutted CLI/command/agent stubs and clean up consumers). This stub shadows the REALisGoogleModelApifunction insrc/agents/agent-helpers/google.ts(whichagent-helpers.tsre-exports). Because the local stub always returnsfalse, every Google-specific branch inresolveTranscriptPolicyis permanently dead:isGoogle = falsealways →applyGoogleTurnOrdering,validateGeminiTurns, Gemini thought-signature sanitization never activate for Google models.This would be a genuine bug if the function were wired — but it isn't. It's bug-free-by-death. No need to fix the stub because the whole function goes away.
Imports are shared utilities, NOT orphaned by removal
import { normalizeProviderId } from "./provider-utils.js"→provider-utils.tshas 20+ importers acrossauth/,agents/,commands/,cron/. Not orphaned.import type { ToolCallIdMode } from "./tool-call-id.js"→tool-call-id.tshas 5+ importers (agent-helpers, session-transcript-repair, agent-helpers/images). Not orphaned.Scope is cleanly bounded to the file + its test.
Non-goals
isGoogleModelApistub by importing the real function. The file is being deleted; repairing the stub would be dead work.scripts/check-attestations.mjsscans dynamically and won't complain about a non-existent file.LEGACY_CONFIG_RULES/ migration. This is not a config field — it's a source module. File deletion is the migration.Tasks
src/agents/transcript-policy.ts(146 lines).src/agents/transcript-policy.test.ts.pnpm tsgoandpnpm lintto confirm no broken imports (expected: none, since no production code imports from this file).scripts/post-build.mjsor similar) referencetranscript-policyspecifically, remove those references. Verify viarg -n "transcript-policy" scripts/.Acceptance Criteria
src/agents/transcript-policy.tsdoes not exist.src/agents/transcript-policy.test.tsdoes not exist.rg -n "transcript-policy" src/ ui/ extensions/ apps/ scripts/returns only references in this issue's body (none in code).rg -n "resolveTranscriptPolicy" src/returns no hits.rg -n "TranscriptPolicy\\b" src/returns no hits (the exported type also dies with the file; nothing consumes it).pnpm tsgoclean.pnpm lintclean.pnpm testpasses with fewer tests (the 13+ test cases intranscript-policy.test.tsare gone; net decrease expected).rebrand-gate,zombie-import-gate,stub-debt-gate,throwing-stub-callers-gate,obsolescence-audit-gate,attestation-gate(the attestation-gate should be happy because the file'sMODULE_ATTESTATIONSis gone along with its exports),docs,build,test,lint.Out of scope
src/agents/provider-utils.tsandsrc/agents/tool-call-id.ts— both remain actively used by unrelated code paths. Separate decisions if/when those become orphaned.References
gut(config): remove remaining LLM-platform z.unknown() stubs) — discovered during the same middleware-not-platform reviewisGoogleModelApistubgut(agents): remove model-selection.ts) — precedent for removing LLM-selection-layer files under MBP (middleware-not-platform)scripts/check-attestations.mjs, introduced by ci(fork-sync): MODULE_ATTESTATIONS manifest for src/agents/* (Option 6) #2437 / merge ci(fork-sync): MODULE_ATTESTATIONS manifest for src/agents/* (#2437) #2446