cscript: rename skill, add cscript mine, harden matcher#19
Open
datashaman wants to merge 2 commits into
Open
Conversation
- 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>
cscript mine, harden matcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/compile-task→/cscriptso the slash command, binary, and skill directory share one name.cscript mine. AUserPromptSubmithook would pay ~60ms on every turn and can only surface already-registered scripts — it can never propose new ones. Instead, everycscript whichcall appends to a localwhich.log, andcscript mineaggregates the log to rank repeated catalogue misses. That's direct "I tried to reuse and nothing fit" signal, and it costs zero ambient latency.cscript whichmatching. Filter stopwords + min-4-char tokens (no more "is" substring-matching "isolate"); usestring.punctuationfor the translation table.cscript version. Plus a bootstrap step that compares installed version against the source'sVERSIONand 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
skills/cscript/scripts/smoke-test.sh) — now also coversversion,which.logappend,mineranking, and the empty-log messagecscript mineoutput verified manually with seeded queries~/bin/cscriptfrom cscript: Windows + PowerShell support #18 confirm the auto-reinstall path works🤖 Generated with Claude Code