Summary
Remove dead model/thinking/reasoning/elevated/exec infrastructure — inline directive type fields, model directive parser, thinking-level types and normalization, help text references, and the stop command registry entry with its stub handlers.
Infrastructure to remove: model directive parser (model.ts), thinking types and normalization (thinking.ts), dead InlineDirectives type fields (hasThinkDirective, hasReasoningDirective, hasElevatedDirective, hasExecDirective + associated data fields), stop command registry entry, help text for /compact, /stop, /think, /model, /context, /skill.
Why
This infrastructure is non-functional in RemoteClaw:
- Model directive (
/model <id>, /models): extractModelDirective() parser still runs during parseInlineDirectives(), but the result is never acted on — persistInlineDirectives() has the model handling gutted (line 24: "Model directive handling gutted in RemoteClaw — CLI runtimes own model selection").
- Thinking/reasoning/elevated (
/think, /reasoning, /elevated): Type fields (hasThinkDirective, hasReasoningDirective, hasElevatedDirective) defined on InlineDirectives but never populated to true — the upstream parsing code that would set them was gutted. get-reply-directives.ts checks these fields but they are always undefined. The thinking.ts types (ThinkLevel, ElevatedLevel, ReasoningLevel) and normalization functions (normalizeThinkLevel, normalizeElevatedLevel, normalizeReasoningLevel) are imported across ~10 files but serve no middleware purpose — CLI agents manage their own thinking/reasoning levels.
- Exec (
hasExecDirective, execAsk, execHost, execNode, execSecurity): Dead type fields on InlineDirectives, never populated. No execution handler exists.
- Stop (
/stop): Registry entry at commands-registry.data.ts:458-464, but its handler in commands-session.ts:23-24 is a no-op stub returning null. The real abort mechanism lives in abort.ts (a separate code path triggered by the abort infrastructure, not the command registry).
- Help text:
buildHelpMessage() in status.ts:649-678 references /compact, /stop, /think <level>, /model <id>, /context, /skill <name> [input] — all non-functional.
Context
Part of the /remoteclaw command subtree refactor. All surviving RemoteClaw commands will move under /remoteclaw <subcommand> so the agent CLI owns the bare / namespace. Removing dead infrastructure first clears noise before the restructure.
Scope
Section 1: Remove stop command registry entry + stub handlers
| File |
Change |
src/auto-reply/commands-registry.data.ts:458-464 |
Delete the stop defineChatCommand() block |
src/auto-reply/reply/commands-session.ts:21-24 |
Delete handleAbortTrigger and handleStopCommand stub stubs + line 474 export |
src/auto-reply/reply/commands-core.ts:19,24,149-150 |
Remove imports and array entries for handleStopCommand, handleAbortTrigger |
Note: abort.ts, abort-cutoff.ts, and their test remain untouched — the real abort mechanism is separate from the command registry stub.
Section 2: Remove model directive parser
| File |
Change |
src/auto-reply/model.ts (56 lines) |
Delete entire file — extractModelDirective() parser |
src/auto-reply/model.test.ts (181 lines) |
Delete entire file — tests for model directive |
src/auto-reply/reply/directive-handling.parse.ts:2 |
Remove import { extractModelDirective } |
src/auto-reply/reply/directive-handling.parse.ts:67-74 |
Remove extractModelDirective() call, simplify parseInlineDirectives() |
After removal, hasModelDirective / rawModelDirective / rawModelProfile still exist on InlineDirectives but will always be false/undefined. Full InlineDirectives type cleanup is Section 3.
Section 3: Remove dead InlineDirectives type fields
Remove fields from the InlineDirectives type in directive-handling.parse.ts:11-48 that are never meaningfully populated:
Model fields (populated by parser being deleted in Section 2):
hasModelDirective (line 17)
rawModelDirective (line 18)
rawModelProfile (line 19)
Think/reasoning/elevated/exec fields (never populated to true — upstream parsing was gutted):
thinkLevel (line 32), hasThinkDirective (line 33)
reasoningLevel (line 35), hasReasoningDirective (line 36)
elevatedLevel (line 38), rawElevatedLevel (line 39), hasElevatedDirective (line 40)
execAsk (line 42), execHost (line 43), execNode (line 44), execSecurity (line 45), hasExecDirective (line 47)
Cascade: remove all reads of these fields from consuming files:
get-reply-directives.ts — checks on hasModelDirective, hasThinkDirective, hasReasoningDirective, hasElevatedDirective, hasExecDirective
get-reply-directives-apply.ts:182 — directives.hasModelDirective check
get-reply-directives-utils.ts:11 — hasModelDirective: false in clearInlineDirectives()
get-reply-run.ts:391 — directives.hasThinkDirective check
directive-handling.parse.ts:124 — directives.hasModelDirective in isDirectiveOnly()
Section 4: Remove thinking types and normalization
| File |
Change |
src/auto-reply/thinking.ts (231 lines) |
Remove ThinkLevel, ElevatedLevel, ReasoningLevel types and their normalization functions (normalizeThinkLevel, normalizeElevatedLevel, normalizeReasoningLevel, listThinkingLevels, formatThinkingLevels, supportsXHighThinking, resolveElevatedMode, etc.). Keep VerboseLevel, normalizeVerboseLevel, NoticeLevel, normalizeNoticeLevel, UsageDisplayLevel, normalizeUsageDisplay, resolveResponseUsageMode — these are alive. |
src/auto-reply/reply/directive-handling.levels.ts (41 lines) |
Delete entire file — resolves current think/reasoning/elevated levels from session, dead without the types |
src/auto-reply/reply/get-reply-directives.ts |
Remove ThinkLevel/ElevatedLevel/ReasoningLevel imports and all resolved*Level logic |
src/auto-reply/reply/get-reply-run.ts |
Remove think/reasoning/elevated level resolution and propagation |
src/auto-reply/reply/get-reply.ts |
Remove resolved*Level destructuring and passing |
src/auto-reply/status.ts:67,95-98 |
Remove ThinkLevel/ElevatedLevel/ReasoningLevel imports and type usage |
src/auto-reply/reply/get-reply-inline-actions.ts:50-53 |
Remove resolved*Level optional fields |
src/auto-reply/reply/get-reply-run.media-only.test.ts:112-114 |
Remove resolved*Level from test fixtures |
src/auto-reply/reply/get-reply.reset-hooks-fallback.test.ts:133-136 |
Remove resolved*Level from test fixtures |
src/agents/model-selection.ts:15,58 |
Remove duplicate ThinkLevel type and resolveThinkingDefault() |
src/agents/subagent-spawn.ts:4,407 |
Remove formatThinkingLevels, normalizeThinkLevel imports and usage |
src/cron/isolated-agent/run.test-harness.ts:115 |
Remove normalizeThinkLevel mock |
Section 5: Remove help text references
| File |
Change |
src/auto-reply/status.ts:652-673 |
In buildHelpMessage(): remove /compact, /stop from Session line; remove /think <level>, /model <id> from Options line; remove /context from Status line; remove /skill <name> [input] Skills section |
Section 6: Remove directive-handling.persist.ts model handling comment
| File |
Change |
src/auto-reply/reply/directive-handling.persist.ts:24 |
Remove gutted model directive comment — no model directive fields exist after Section 3 |
Files affected
Delete entirely
src/auto-reply/model.ts (56 lines)
src/auto-reply/model.test.ts (181 lines)
src/auto-reply/reply/directive-handling.levels.ts (41 lines)
Modify
src/auto-reply/thinking.ts — remove think/elevated/reasoning types and functions (~165 lines removed, ~66 lines kept)
src/auto-reply/commands-registry.data.ts — delete stop definition
src/auto-reply/reply/commands-session.ts — delete handleAbortTrigger/handleStopCommand stubs + export
src/auto-reply/reply/commands-core.ts — remove stop/abort imports and array entries
src/auto-reply/reply/directive-handling.parse.ts — remove model parser import, call, and dead type fields
src/auto-reply/reply/directive-handling.persist.ts — remove gutted comment
src/auto-reply/reply/directive-handling.ts — barrel re-exports may need update
src/auto-reply/reply/get-reply-directives.ts — remove dead directive field checks and think/reasoning/elevated level resolution
src/auto-reply/reply/get-reply-directives-apply.ts — remove hasModelDirective check
src/auto-reply/reply/get-reply-directives-utils.ts — remove hasModelDirective from clearInlineDirectives()
src/auto-reply/reply/get-reply-run.ts — remove think/reasoning/elevated level resolution
src/auto-reply/reply/get-reply.ts — remove resolved*Level destructuring
src/auto-reply/reply/get-reply-inline-actions.ts — remove resolved*Level optional fields
src/auto-reply/status.ts — remove ThinkLevel/ElevatedLevel/ReasoningLevel imports + help text
src/auto-reply/reply/get-reply-run.media-only.test.ts — update test fixtures
src/auto-reply/reply/get-reply.reset-hooks-fallback.test.ts — update test fixtures
src/agents/model-selection.ts — remove duplicate ThinkLevel + resolveThinkingDefault
src/agents/subagent-spawn.ts — remove thinking imports and usage
src/cron/isolated-agent/run.test-harness.ts — remove normalizeThinkLevel mock
src/auto-reply/commands-registry.test.ts — update/remove tests referencing model/stop/think
Acceptance criteria
Summary
Remove dead model/thinking/reasoning/elevated/exec infrastructure — inline directive type fields, model directive parser, thinking-level types and normalization, help text references, and the
stopcommand registry entry with its stub handlers.Infrastructure to remove: model directive parser (
model.ts), thinking types and normalization (thinking.ts), deadInlineDirectivestype fields (hasThinkDirective,hasReasoningDirective,hasElevatedDirective,hasExecDirective+ associated data fields),stopcommand registry entry, help text for/compact,/stop,/think,/model,/context,/skill.Why
This infrastructure is non-functional in RemoteClaw:
/model <id>,/models):extractModelDirective()parser still runs duringparseInlineDirectives(), but the result is never acted on —persistInlineDirectives()has the model handling gutted (line 24: "Model directive handling gutted in RemoteClaw — CLI runtimes own model selection")./think,/reasoning,/elevated): Type fields (hasThinkDirective,hasReasoningDirective,hasElevatedDirective) defined onInlineDirectivesbut never populated totrue— the upstream parsing code that would set them was gutted.get-reply-directives.tschecks these fields but they are alwaysundefined. Thethinking.tstypes (ThinkLevel,ElevatedLevel,ReasoningLevel) and normalization functions (normalizeThinkLevel,normalizeElevatedLevel,normalizeReasoningLevel) are imported across ~10 files but serve no middleware purpose — CLI agents manage their own thinking/reasoning levels.hasExecDirective,execAsk,execHost,execNode,execSecurity): Dead type fields onInlineDirectives, never populated. No execution handler exists./stop): Registry entry atcommands-registry.data.ts:458-464, but its handler incommands-session.ts:23-24is a no-op stub returningnull. The real abort mechanism lives inabort.ts(a separate code path triggered by the abort infrastructure, not the command registry).buildHelpMessage()instatus.ts:649-678references/compact,/stop,/think <level>,/model <id>,/context,/skill <name> [input]— all non-functional.Context
Part of the
/remoteclawcommand subtree refactor. All surviving RemoteClaw commands will move under/remoteclaw <subcommand>so the agent CLI owns the bare/namespace. Removing dead infrastructure first clears noise before the restructure.Scope
Section 1: Remove
stopcommand registry entry + stub handlerssrc/auto-reply/commands-registry.data.ts:458-464stopdefineChatCommand()blocksrc/auto-reply/reply/commands-session.ts:21-24handleAbortTriggerandhandleStopCommandstub stubs + line 474 exportsrc/auto-reply/reply/commands-core.ts:19,24,149-150handleStopCommand,handleAbortTriggerNote:
abort.ts,abort-cutoff.ts, and their test remain untouched — the real abort mechanism is separate from the command registry stub.Section 2: Remove model directive parser
src/auto-reply/model.ts(56 lines)extractModelDirective()parsersrc/auto-reply/model.test.ts(181 lines)src/auto-reply/reply/directive-handling.parse.ts:2import { extractModelDirective }src/auto-reply/reply/directive-handling.parse.ts:67-74extractModelDirective()call, simplifyparseInlineDirectives()After removal,
hasModelDirective/rawModelDirective/rawModelProfilestill exist onInlineDirectivesbut will always befalse/undefined. FullInlineDirectivestype cleanup is Section 3.Section 3: Remove dead
InlineDirectivestype fieldsRemove fields from the
InlineDirectivestype indirective-handling.parse.ts:11-48that are never meaningfully populated:Model fields (populated by parser being deleted in Section 2):
hasModelDirective(line 17)rawModelDirective(line 18)rawModelProfile(line 19)Think/reasoning/elevated/exec fields (never populated to true — upstream parsing was gutted):
thinkLevel(line 32),hasThinkDirective(line 33)reasoningLevel(line 35),hasReasoningDirective(line 36)elevatedLevel(line 38),rawElevatedLevel(line 39),hasElevatedDirective(line 40)execAsk(line 42),execHost(line 43),execNode(line 44),execSecurity(line 45),hasExecDirective(line 47)Cascade: remove all reads of these fields from consuming files:
get-reply-directives.ts— checks onhasModelDirective,hasThinkDirective,hasReasoningDirective,hasElevatedDirective,hasExecDirectiveget-reply-directives-apply.ts:182—directives.hasModelDirectivecheckget-reply-directives-utils.ts:11—hasModelDirective: falseinclearInlineDirectives()get-reply-run.ts:391—directives.hasThinkDirectivecheckdirective-handling.parse.ts:124—directives.hasModelDirectiveinisDirectiveOnly()Section 4: Remove thinking types and normalization
src/auto-reply/thinking.ts(231 lines)ThinkLevel,ElevatedLevel,ReasoningLeveltypes and their normalization functions (normalizeThinkLevel,normalizeElevatedLevel,normalizeReasoningLevel,listThinkingLevels,formatThinkingLevels,supportsXHighThinking,resolveElevatedMode, etc.). KeepVerboseLevel,normalizeVerboseLevel,NoticeLevel,normalizeNoticeLevel,UsageDisplayLevel,normalizeUsageDisplay,resolveResponseUsageMode— these are alive.src/auto-reply/reply/directive-handling.levels.ts(41 lines)src/auto-reply/reply/get-reply-directives.tssrc/auto-reply/reply/get-reply-run.tssrc/auto-reply/reply/get-reply.tssrc/auto-reply/status.ts:67,95-98src/auto-reply/reply/get-reply-inline-actions.ts:50-53src/auto-reply/reply/get-reply-run.media-only.test.ts:112-114src/auto-reply/reply/get-reply.reset-hooks-fallback.test.ts:133-136src/agents/model-selection.ts:15,58ThinkLeveltype andresolveThinkingDefault()src/agents/subagent-spawn.ts:4,407formatThinkingLevels,normalizeThinkLevelimports and usagesrc/cron/isolated-agent/run.test-harness.ts:115normalizeThinkLevelmockSection 5: Remove help text references
src/auto-reply/status.ts:652-673buildHelpMessage(): remove/compact,/stopfrom Session line; remove/think <level>,/model <id>from Options line; remove/contextfrom Status line; remove/skill <name> [input]Skills sectionSection 6: Remove
directive-handling.persist.tsmodel handling commentsrc/auto-reply/reply/directive-handling.persist.ts:24Files affected
Delete entirely
src/auto-reply/model.ts(56 lines)src/auto-reply/model.test.ts(181 lines)src/auto-reply/reply/directive-handling.levels.ts(41 lines)Modify
src/auto-reply/thinking.ts— remove think/elevated/reasoning types and functions (~165 lines removed, ~66 lines kept)src/auto-reply/commands-registry.data.ts— deletestopdefinitionsrc/auto-reply/reply/commands-session.ts— deletehandleAbortTrigger/handleStopCommandstubs + exportsrc/auto-reply/reply/commands-core.ts— remove stop/abort imports and array entriessrc/auto-reply/reply/directive-handling.parse.ts— remove model parser import, call, and dead type fieldssrc/auto-reply/reply/directive-handling.persist.ts— remove gutted commentsrc/auto-reply/reply/directive-handling.ts— barrel re-exports may need updatesrc/auto-reply/reply/get-reply-directives.ts— remove dead directive field checks and think/reasoning/elevated level resolutionsrc/auto-reply/reply/get-reply-directives-apply.ts— removehasModelDirectivechecksrc/auto-reply/reply/get-reply-directives-utils.ts— removehasModelDirectivefromclearInlineDirectives()src/auto-reply/reply/get-reply-run.ts— remove think/reasoning/elevated level resolutionsrc/auto-reply/reply/get-reply.ts— remove resolved*Level destructuringsrc/auto-reply/reply/get-reply-inline-actions.ts— remove resolved*Level optional fieldssrc/auto-reply/status.ts— remove ThinkLevel/ElevatedLevel/ReasoningLevel imports + help textsrc/auto-reply/reply/get-reply-run.media-only.test.ts— update test fixturessrc/auto-reply/reply/get-reply.reset-hooks-fallback.test.ts— update test fixturessrc/agents/model-selection.ts— remove duplicate ThinkLevel + resolveThinkingDefaultsrc/agents/subagent-spawn.ts— remove thinking imports and usagesrc/cron/isolated-agent/run.test-harness.ts— remove normalizeThinkLevel mocksrc/auto-reply/commands-registry.test.ts— update/remove tests referencing model/stop/thinkAcceptance criteria
grep -r "extractModelDirective" src/returns zero matchesgrep -r "hasThinkDirective\|hasReasoningDirective\|hasElevatedDirective\|hasExecDirective" src/returns zero matchesgrep -r "ThinkLevel\|ElevatedLevel\|ReasoningLevel" src/returns zero matches (excluding Telegram's localTelegramReasoningLeveltype inbot-message-dispatch.ts— that is a separate local type, not the dead upstream one)grep -r "normalizeThinkLevel\|normalizeElevatedLevel\|normalizeReasoningLevel" src/returns zero matchesstopentry incommands-registry.data.tshandleStopCommand/handleAbortTriggerincommands-session.tsbuildHelpMessage()does not reference/compact,/stop,/think,/model,/context,/skillabort.tsandabort-cutoff.tsremain untouched (real abort mechanism)VerboseLevel,normalizeVerboseLevel,UsageDisplayLevel,resolveResponseUsageModeremain inthinking.ts(alive infrastructure)InlineDirectives(alive infrastructure)npm run buildsucceedsnpm testpasses