Skip to content

docs(roadmap): add #453 — slash-command guard fires only on bare token; any extra arg falls through to prompt dispatch#3066

Closed
Yeachan-Heo wants to merge 1 commit into
mainfrom
docs/roadmap-453-slash-command-guard-bare-only
Closed

docs(roadmap): add #453 — slash-command guard fires only on bare token; any extra arg falls through to prompt dispatch#3066
Yeachan-Heo wants to merge 1 commit into
mainfrom
docs/roadmap-453-slash-command-guard-bare-only

Conversation

@Yeachan-Heo
Copy link
Copy Markdown
Contributor

ROADMAP pinpoint #453 — slash-command guard is shape-blind to subcommand args

Dogfooded for the 2026-05-24 06:00 Clawhip pinpoint nudge (message 1507986539538419863).

Repro (clean isolated env, ANTHROPIC_* unset)

Bare form caught by guard (good):

$ claw cost
[error-kind: unknown] error: `claw cost` is a slash command. Use `claw --resume SESSION.jsonl /cost` ...

Add ONE argument → guard breaks, prompt dispatched to Claude (bug):

$ claw cost list
[error-kind: missing_credentials] error: missing Anthropic credentials; export ANTHROPIC_AUTH_TOKEN ...

The missing_credentials envelope proves "cost list" was sent to the LLM as a user prompt.

Affected spellings (all currently fall through to CliAction::Prompt)

Spelling Bare form With extra arg
cost ✅ guard cost list → prompt
tokens ✅ guard tokens list → prompt
model ✅ guard model openai/gpt-4 → prompt
permissions ✅ guard permissions show → prompt
context ✅ guard context show → prompt
providers ✅ guard providers list → prompt
history ✅ guard history list → prompt
cache ✅ guard cache list → prompt
models (plural) ❌ falls through ❌ falls through
aliases ❌ falls through ❌ falls through
profiles ❌ falls through ❌ falls through
logs ❌ falls through ❌ falls through
settings ❌ falls through ❌ falls through

Code location

rust/crates/rusty-claude-cli/src/main.rs:1120-1149:

fn bare_slash_command_guidance(command_name: &str) -> Option<String> {
    if matches!(command_name, "dump-manifests" | "bootstrap-plan" | ... | "export") {
        return None;
    }
    let slash_command = slash_command_specs()
        .iter()
        .find(|spec| spec.name == command_name)?;
    ...
}

The guard is only consulted from the bare parse arm — never from the subcommand-args path. Adding any positional arg routes the entire argv to CliAction::Prompt.

Why distinct from #78 / #145 / #452

Why it matters

Prompt misdelivery is the Clawhip top-of-list category. With creds set, every operator/claw typo in this cluster burns provider tokens on a meaningless completion. Without creds, the wrong-shaped missing_credentials envelope is even more confusing — operators see auth error when they meant local CLI dispatch.

Required fix shape (full detail in ROADMAP entry)

(a) Widen bare_slash_command_guidance to fire from the subcommand-args parse arm too. (b) Extend known-slash-command set to include natural CLI discovery spellings (models, aliases, profiles, logs, settings) and emit did_you_mean suggestions. (c) Structured kind:"argv_misroute_prevented" JSON envelope. (d) Regression coverage for every spelling in the table above, asserting never CliAction::Prompt.

Acceptance check (one-liner)

env -u ANTHROPIC_API_KEY -u ANTHROPIC_AUTH_TOKEN claw model openai/gpt-4 should NOT exit with missing_credentials; it should exit with a typed CLI dispatch error mentioning --model openai/gpt-4 prompt … or /model.


[repo owner's gaebal-gajae (clawdbot) 🦞]

…n; any extra arg falls through to prompt dispatch (incl. claw model openai/gpt-4)
@code-yeongyu
Copy link
Copy Markdown
Collaborator

Content merged to main via batch commit c881069. Closing PR.

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.

3 participants