Repository navigation
feat(install): install Cursor tool-dedupe hooks - #1213
minhhung2556 wants to merge 19 commits into
Conversation
Cursor dedupe-hook token measurement
A denied repeat replaces the tool payload with a short
10 denied repeats: 1,001,418 characters, about 250,355 tokens. Without the full |
Node 20+ npx.cmd sets NPX_CLI_JS instead of a node line the portable resolver already understood, so Windows installs failed to spawn skills. Co-authored-by: Cursor <cursoragent@cursor.com>
Repeated unchanged Read and shell calls stay in context. Install writes the hook under ~/.cursor; uninstall removes it. Co-authored-by: Cursor <cursoragent@cursor.com>
Detached installs ship bin/ alone. Requiring the hook script from that package made every provider install fail before Cursor was even selected. Signed-off-by: Hung Luong Do Minh <minhhung2556@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Deny repeat tool calls in the same chat when the tree or file is unchanged. Register Grep and Glob preToolUse matchers and cap hook state by conversation count. Co-authored-by: Cursor <cursoragent@cursor.com>
Detached installs have no checkout to copy the script from. A real copy fails Cursor install on that path. Co-authored-by: Cursor <cursoragent@cursor.com>
Windows can keep the same mtime after an append, so an unchanged mtime still denied a new Grep. Co-authored-by: Cursor <cursoragent@cursor.com>
Local reinstall + output-token A/B (Cursor)Ran from a full clone on Windows after Install observed
Three read-only tasks, two arms (same prompts against this repo; no edits)
Output tokens (tiktoken
Caveats (per HONEST-NUMBERS): input, cache, and rule injection are excluded; this is not an invoice %. Complements the dedupe-hook table in the PR comment (tool payload not re-entering context) — different layer (response style vs repeated tool output). Happy to re-run with this branch’s installer once dedupe install is no longer pilot-only, or with provider-billed A/B on the same tasks. |
db18a97 to
ccccd9e
Compare
Uninstall always named .cursor/hooks.json, so a Codex uninstall that never wrote hooks failed doesNotMatch. Also skip the pilot after a failed skills add and on --no-hooks. Signed-off-by: Hung Luong Do Minh <minhhung2556@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Hung Luong Do Minh <minhhung2556@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
CI has no user.name, so the temp commit never landed and the fingerprint stayed empty. The repeat status was allowed. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Reviewed now that it's out of draft. Needs changes — not adopted. Thanks for the volume of test coverage here; the review below is about two separable halves.
Downstream The dedupe hook — four repo invariants block it as written (
Beyond the invariants, a hook that returns Generated by Claude Code |
The early NPX_CLI_JS match returned before the launch-line and .js checks, so unused assignments and non-js targets were accepted. Co-authored-by: Cursor <cursoragent@cursor.com>
A direct writeFileSync on ~/.caveman/cursor-dedupe-tools-state.json is the symlink-clobber path that helper exists to refuse. Co-authored-by: Cursor <cursoragent@cursor.com>
An EOF read waits out a lagging Windows pipe close after the payload is already complete. Co-authored-by: Cursor <cursoragent@cursor.com>
verify_repo fails the build when a new src/hooks file is missing from the closed allowlist. Co-authored-by: Cursor <cursoragent@cursor.com>
The pilot installer only printed a plan beside the live Cursor hooks.json writer, so two hook paths could inject twice. Co-authored-by: Cursor <cursoragent@cursor.com>
checksums.sha256 pins cursor-dedupe-tools.js for Cursor/Copilot payload; Claude detached install never copies it. Refs JuliusBrussee#1213 Co-authored-by: Cursor <cursoragent@cursor.com>
A permanent deny on the same full Read traps the agent. One deny, then allow. Drop offset/limit from the deny text. Co-authored-by: Cursor <cursoragent@cursor.com>
Mixed session checks fresh calls stay allowed. Repo table subtracts the deny message from each repeated payload. Co-authored-by: Cursor <cursoragent@cursor.com>
Cursor dedupe-hook token measurement
A denied repeat replaces the tool payload with a short
10 denied repeats: 1,043,311 characters, about 260,831 tokens without dedupe, about 235 tokens with dedupe (deny messages only), saved 260,596 tokens (100%). Without the full |
Hook edit in ae24619 left verify_repo failing on macos and root-surfaces. Refs JuliusBrussee#1213 Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Test plan