Skip to content

cscript: rename skill, add cscript mine, harden matcher#19

Open
datashaman wants to merge 2 commits into
mainfrom
cscript-rename-and-hook
Open

cscript: rename skill, add cscript mine, harden matcher#19
datashaman wants to merge 2 commits into
mainfrom
cscript-rename-and-hook

Conversation

@datashaman
Copy link
Copy Markdown
Owner

@datashaman datashaman commented May 20, 2026

Summary

  • Rename /compile-task/cscript so the slash command, binary, and skill directory share one name.
  • Drop per-prompt hook in favour of cscript mine. A UserPromptSubmit hook would pay ~60ms on every turn and can only surface already-registered scripts — it can never propose new ones. Instead, every cscript which call appends to a local which.log, and cscript mine aggregates the log to rank repeated catalogue misses. That's direct "I tried to reuse and nothing fit" signal, and it costs zero ambient latency.
  • Tighten cscript which matching. Filter stopwords + min-4-char tokens (no more "is" substring-matching "isolate"); use string.punctuation for the translation table.
  • Add cscript version. Plus a bootstrap step that compares installed version against the source's VERSION and re-installs the dispatcher on mismatch — existing users on the previous binary upgrade automatically.

Deferred to a follow-up PR

A smarter miner that reads Claude Code session JSONLs and (with first-run consent) shell history. Holding off so the invocation-log data accumulates first — that gives ground truth to validate any clustering algorithm against.

Test plan

  • Smoke test green (skills/cscript/scripts/smoke-test.sh) — now also covers version, which.log append, mine ranking, and the empty-log message
  • cscript mine output verified manually with seeded queries
  • Existing users with ~/bin/cscript from cscript: Windows + PowerShell support #18 confirm the auto-reinstall path works

🤖 Generated with Claude Code

datashaman and others added 2 commits May 20, 2026 15:35
- Rename the skill from compile-task to cscript so the slash command,
  binary, and skill directory all share one name.
- Add scripts/cscript-hook: a Claude Code UserPromptSubmit hook that
  runs `cscript which` on every prompt and injects a catalogue-hint
  block when matches exist. Without it, the catalogue is only
  consulted when /cscript is invoked explicitly.
- Tighten `cscript which` token matching: filter out stopwords and
  tokens shorter than 4 chars so noise like "is" no longer
  substring-matches "isolate". Use `string.punctuation` for the
  punctuation translation table.
- Add `cscript version` (and a VERSION constant) so the bootstrap
  step can detect a stale installed binary and re-copy the dispatcher
  on upgrade.
- SKILL.md bootstrap step 2 now compares installed version against
  source version and re-installs on mismatch.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The UserPromptSubmit hook added in the previous commit paid ~60ms on
every prompt and could only surface already-registered scripts — it
could never propose new ones. Replace it with a batch approach:

- `cscript which` appends every query to `which.log` under the data dir
  (best-effort; never raises). The query text and the top matched name
  (or null on miss) are recorded.
- New `cscript mine` aggregates the log, ranks repeated catalogue
  misses, and prints candidates with sample queries. `--min N` controls
  the repeat threshold (default 2); `--include-hits` also surfaces
  matched queries; `--limit` caps the output.
- Empty-log and no-pattern cases print friendly guidance to stderr.
- Delete `scripts/cscript-hook` and the bootstrap step that wired it
  into `~/.claude/settings.json`. The catalogue-mining workflow is now
  on-demand only.
- Bump VERSION to 0.3.0 (subcommand surface changed).
- Smoke test covers version, which-logs-to-disk, mine-ranks-misses,
  and the empty-log message.

A smarter miner that reads Claude Code session transcripts and shell
history (with first-run consent) is planned but deliberately deferred
until the invocation log has enough real data to validate the
clustering algorithm.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@datashaman datashaman changed the title cscript: rename skill, add prompt-submit hook, harden matcher cscript: rename skill, add , harden matcher May 20, 2026
@datashaman datashaman changed the title cscript: rename skill, add , harden matcher cscript: rename skill, add cscript mine, harden matcher May 20, 2026
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.

1 participant