Commit b45f6c8
feat: v0.46.0 — UserPromptSubmit per-turn reinforcement hook (#48)
* feat: v0.46.0 — UserPromptSubmit per-turn reinforcement hook
SessionStart injects the full mandatory-tool ruleset once; over a long
conversation it decays out of attention and competing instructions crowd it
out, so sessions drift back to raw Read/Grep even with hooks + CLAUDE.md in
place. Caveman fixes the same failure with a UserPromptSubmit hook that
re-injects a tiny anchor every turn.
Add hook-user-prompt (UserPromptSubmit):
- emits a one-line ~30-token minimal anchor on every prompt — the floor that
keeps token-pilot in the working set. Deliberately a single short line: the
heavy ruleset stays in SessionStart, so the per-turn channel never undercuts
the tool's own token budget (no event-log reads, no per-turn cost growth).
- additionalContext only, never blocks the prompt; safe-runner wrapped.
- respects sessionStart.enabled, TOKEN_PILOT_BYPASS, TOKEN_PILOT_PROMPT_REMINDER=0.
- wired into hooks.json, install-hook installer, and typo-guard allowlist.
- pure builder in src/hooks/user-prompt.ts + unit tests.
Bump to 0.46.0 across package.json, lock, server.json, plugin.json,
marketplace.json, regenerated agents.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore(security): npm audit fix transitive deps + scope CI audit to prod
`npm audit fix` (no major bumps) patches the transitive runtime advisories
pulled in via @modelcontextprotocol/sdk's HTTP stack — hono (×15),
@hono/node-server, express-rate-limit, path-to-regexp, qs, ip-address,
fast-uri. token-pilot speaks stdio, so that HTTP path is unreachable, but the
lockfile bump clears the dependabot alerts (was 1 critical / 8 high / 23 mod /
2 low → production audit now reports 0).
Scope the CI Audit gate to production deps (`--omit=dev`): a published package
should gate on what it ships, not on its test runner. The 6 remaining high
advisories are all in the dev-only vitest/vite chain and need a deliberate
vitest 4.x major bump, tracked separately.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: shahinyanm <mher.shahinyan@12go.asia>1 parent 01eea6b commit b45f6c8
38 files changed
Lines changed: 333 additions & 144 deletions
File tree
- .claude-plugin
- .github/workflows
- agents
- hooks
- src
- cli
- hooks
- tests/hooks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
8 | 31 | | |
9 | 32 | | |
10 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
0 commit comments