Skip to content
Claude Code Mods

Claude Code mod sweet-spot

Source verified. Source URL responded on 2026-10-16. Not a security review.Community listing. Not published by Anthropic.Pinned install
  • Optimization
  • Workflow
Publisher
Patrick Müller (opens in a new tab)Community listing. Not published by Anthropic; a maintainer read the entry, not the code.
License
MIT

Hands a long session over before the context gets too big: to a fresh session that starts from a handoff, or by Claude Code's own /compact.

Notice

Developed against Claude Code 2.1.296; older versions are not tested, and versions before 2.1.271 cannot load the mod at all. It installs from its own repository's marketplace, not from Anthropic's.

On this page

What it does

At the end of an answer it looks at the context size. Past the threshold, and when nothing else is going on, a line above the prompt counts down countdown_seconds (10 by default). Key 1 in an empty prompt moves the handover back; typing or sending a message stops the countdown without moving anything, and the next pause counts down again.

/sweet-spot status shows the context against the window, where the next handover comes and the emergency brake. /sweet-spot later 50k moves one handover back by 50k tokens, /sweet-spot asap hands over at the next pause wherever the context stands, and /sweet-spot redeliver submits a held message again if delivering it failed.

Handoff or compact

handoff_method picks the way and handoff_fallback the one tried when it fails before it changed the session. internal-handoff (the default) writes a handoff with a built-in prompt, which ~/.claude/sweet-spot/handoff-prompt.md replaces. builtin-compact is Claude Code's own /compact, and the session stays. external-command runs a handoff command of your own and reads its file.

Measured in real handovers, a fresh session starts at 62k to 98k tokens. A threshold below 130000 is refused with the reason, and the mod stays off.

How it works

ui.render draws the countdown above the prompt and command.run answers /sweet-spot. The other events tell it when a turn starts, steps and completes, what is typed and submitted, which tools run, and when a session starts, ends or is compacted: turn.start, turn.step, turn.complete, prompt.edit, prompt.submit, tool.call, session.start, session.end and session.compact. It also registers the classic events Stop, UserPromptSubmit, SessionStart, PermissionRequest and PostModelSwitch.

It reads the session transcript to learn how long its prompt cache lives, the handoff file, the optional handoff prompt, a listing of the temp directory to find a handoff, and the environment variables HOME and TMPDIR. To check this against the code, run claude plugin validate . in the repository: it lists every call the hooks make and every environment variable they read.

Set up

Inside Claude Code, add the marketplace and install the mod, then run /reload-plugins. The settings are in the /config menu under sweet-spot. To watch first, turn dry_run on: then it only says when it would hand over.

/plugin marketplace add muellerei/sweet-spot

/plugin install sweet-spot@muellerei-sweet-spot

Download the source

Clone the repository and load it as a plugin folder. To run its tests, run claude plugin test . in that folder.

git clone https://github.com/muellerei/sweet-spot

claude --plugin-dir sweet-spot

Hooks it registers

What the badge means

Source verified means the source URL for this entry responded with HTTP 200 on . That is the whole claim. Nobody has read, scanned or run this code on your behalf, and the badge does not mean Anthropic or anyone else endorses it.

Sources change after the check date. Read the code and the publisher page before you install. How to check an extension

  • Mod

    Built inSource verified. Source URL responded on 2026-10-10. Not a security review.

    agents-md

    Reads AGENTS.md as project instructions the way Claude Code reads CLAUDE.md, chosen by one option, instructionFiles, with four values.

    • Workflow
    • Development
  • Mod

    Built inSource verified. Source URL responded on 2026-10-10. Not a security review.

    diff

    Adds /diff: the session's uncommitted changes in a pane beside the transcript, file by file with their hunks, refreshed as Claude edits files and runs commands.

    • Development
    • Workflow
  • Command

    Source verified. Source URL responded on 2026-09-20. Not a security review.

    /clean_gone

    A slash command from commit-commands that deletes local git branches whose remote branch is gone, removing their worktrees first.

    • Workflow