You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mod API: cmd.prompt.submit('/clear') is not reliable; add cmd.sessions.clear() #1182
Interactive TUI in tmux; a project mod at .commandcode/mods/context-cut.ts.
Model: deepseek/deepseek-v4.1-flash.
What I am building
A mod that, at 50% of the context and with no helper process alive, asks the model to write a handoff
and then clears the session so the next conversation starts from the handoff (the SessionStart hook
injects it). Everything is programmatic: no keyboard.
The problem cmd.prompt.submit('/clear') does not always execute the built-in /clear:
In one isolated probe (a mod with only cmd.clock.after(8000, () => cmd.prompt.submit('/clear')),
session idle) it cleared: the SessionStart hook logged source=clear.
In the same situation inside a fuller mod, the text /clear was submitted as a normal prompt:
the model ran a turn and no source=clear appeared.
In a third run it was a no-op: no clear and no new turn.
There is no cmd.sessions.clear(); cmd.sessions exposes only compact, tree, leafId, navigateTree and setLabel.
Run an interactive session in tmux, let the first turn finish, and wait. Observed: sometimes the
session clears, sometimes a normal turn starts with /clear as its text, sometimes nothing happens.
What would fix it
cmd.sessions.clear(): a programmatic, atomic session clear that never becomes a user prompt and
is gated on the session being idle.
A confirmation event/callback with the old and new session ids, so a mod can prove the clear
happened (and not just read a shared log line written by another instance).
Documented guarantees for cmd.store (persistence and atomicity across /clear) and for mod
timers (are they kept or cancelled after the session switch?).
If (1) is not possible, make cmd.prompt.submit('/clear') always execute the built-in command
instead of sometimes turning it into a prompt.
Why it matters
Without a reliable clear, any automated handoff-and-clear must fall back to typing keystrokes into
the TUI, which cannot atomically exclude a draft or a concurrent message. The mod API is the only
seam that can do this safely.
Activity