Skip to content

feat: v0.46.0 — UserPromptSubmit per-turn reinforcement hook#48

Merged
Shahinyanm merged 2 commits into
masterfrom
claude/current-project-status-ar43ft
Jun 13, 2026
Merged

feat: v0.46.0 — UserPromptSubmit per-turn reinforcement hook#48
Shahinyanm merged 2 commits into
masterfrom
claude/current-project-status-ar43ft

Conversation

@Shahinyanm

@Shahinyanm Shahinyanm commented Jun 13, 2026

Copy link
Copy Markdown
Member

Что это

Добавляет hook-user-prompt (UserPromptSubmit) — реинжектит короткий якорь с правилами token-pilot в каждое сообщение пользователя.

Зачем: SessionStart инжектит полный ruleset один раз (старт//clear//compact). За долгую сессию он уплывает из внимания, конкурирующие инструкции вытесняют — сессия скатывается обратно к сырым Read/Grep даже при хуках + CLAUDE.md. Caveman чинит ту же беду тем же приёмом. Теперь так же делает token-pilot.

Поведение

  • Каждый ход → одна короткая строка MINIMAL_ANCHOR (~30 токенов) — пол, удерживающий token-pilot в рабочем наборе.
  • Сознательно одна строка: тяжёлый ruleset остаётся в SessionStart, поэтому per-turn-канал не подрывает собственный токен-бюджет инструмента (ноль чтения event-log, нулевой рост стоимости на ход).
  • Только additionalContext, никогда не блокирует промпт, обёрнут в safe-runner.
  • Тумблеры: sessionStart.enabled, TOKEN_PILOT_BYPASS=1, отдельный TOKEN_PILOT_PROMPT_REMINDER=0.
  • Разведён в hooks/hooks.json, install-hook installer, allowlist typo-guard.

/simplify review

Прогнан /simplify (4 агента: reuse, simplification, efficiency, altitude). Главный finding (сошлись efficiency + simplification): исходная escalation-ветка читала весь event-log (потолок 10 MB) на каждый ход ради смены формулировки якоря — растущая per-turn стоимость в инструменте экономии токенов. Escalation вырезана; остался чистый always-on минимальный якорь. Altitude — 0 findings (структура по конвенциям проекта).

Версия

Bump → 0.46.0 (minor, фича): package.json, lock, server.json, plugin.json, marketplace.json, перегенерированы agents/.

Проверка

  • npm run build
  • npm run lint (tsc --noEmit) ✅
  • новые тесты tests/hooks/user-prompt.test.ts 4/4 ✅
  • полный сьют: 1397/1402; 5 фейлов — пред-существующие/флэйки окружения (3× context-mode-detector из-за реального .mcp.json в рабочей папке; 2× index.test.ts git-root таймаут субпроцесса под параллельной нагрузкой, изолированно 3/3 зелёные), не из этого изменения.

🤖 Generated with Claude Code

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>
@Shahinyanm Shahinyanm force-pushed the claude/current-project-status-ar43ft branch from e9d94e1 to d7782b2 Compare June 13, 2026 15:24
@Shahinyanm Shahinyanm changed the title feat: UserPromptSubmit per-turn reinforcement hook (caveman-style awa… feat: v0.46.0 — UserPromptSubmit per-turn reinforcement hook Jun 13, 2026
`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>
@Shahinyanm Shahinyanm merged commit b45f6c8 into master Jun 13, 2026
2 checks passed
@Shahinyanm Shahinyanm deleted the claude/current-project-status-ar43ft branch June 13, 2026 15:33
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.

2 participants