← Back to PRs

#7975: feat(commands): add /reset-context command

by sergi039 open 2026-02-03 12:07 View on GitHub →
docs stale
## Summary - Adds `/reset-context` text-only command that provides a "panic button" for context overflow - Runs compaction, checks usage %, and advises `/new` if still >70% ## Behavior 1. Runs `/compact` on current session 2. Checks context usage percentage after compaction 3. If ≤70%: `✅ Сжато. Текущая загрузка: 45%` 4. If >70%: `⚠️ Контекст слишком большой (82%). Отправьте /new` ## Files - `src/auto-reply/reply/commands-reset-context.ts` - handler - `src/auto-reply/reply/commands-reset-context.test.ts` - 5 tests - `src/auto-reply/commands-registry.data.ts` - command registration - `src/auto-reply/reply/commands-core.ts` - handler import - `docs/tools/slash-commands.md` - docs EN - `docs/zh-CN/tools/slash-commands.md` - docs ZH ## Test plan - [x] `pnpm vitest run commands-reset-context.test.ts` - 5/5 passed - [x] `pnpm build` - success - [ ] Manual test in Telegram 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> Adds a new text-only `/reset-context` slash command that aborts any active embedded PI run, triggers a compaction, then reports post-compaction context usage and suggests `/new` when usage remains above 70%. Wires the handler into the command dispatch list, registers the command in the chat command registry, adds Vitest coverage for core behaviors, and documents the command in EN and zh-CN slash-command docs. <h3>Confidence Score: 3/5</h3> - This PR is likely safe to merge, but has a couple behavior inconsistencies that could surprise users on some surfaces. - Core changes are localized (new command handler + registry/docs/tests) and follow existing compaction patterns, but `/reset-context` currently ignores the `allowTextCommands` gate and always stops further processing even when compaction fails, which can change behavior in restricted surfaces or failure modes. - src/auto-reply/reply/commands-reset-context.ts (text command gating, failure-mode behavior, usage% calculation); tests lock in Russian responses. <!-- greptile_other_comments_section --> <sub>(5/5) You can turn off certain types of comments like style [here](https://app.greptile.com/review/github)!</sub> <!-- /greptile_comment -->

Most Similar PRs