Files
DeepSeek-Reasonix/internal/cli/context_command.go
T
esengine 2036a47005 feat(context): /context shows the window, the thresholds, and the last pass
Every compaction decision divides by the context window, so a window that
is too small is indistinguishable from a context that is genuinely full:
both just compact. Nothing exposed the number, and nothing exposed why a
maintenance pass did or did not run.

/context reports the window and its usable ceiling, the latest prompt (the
last request's shape, never the billable retry aggregate), canonical vs
model-visible size, the snip/fold/force thresholds as absolute tokens, the
last pass's mode and what it reclaimed, and the blocked reason when one is
recorded. The one-line summary names what happens next rather than only
how full the context is.

Thresholds come from compactThresholds and forceCompactThreshold, the same
helpers the decision uses, so the report cannot drift from the behavior.

Adding a command to two files already at their size budget would have
widened the baseline, so the routing pays for itself: /new and /clear were
two copies of the same goroutine-and-report block and now share
runSessionVerb, and /remember moves out of the switch alongside the new
/context handler. Notice texts are unchanged.
2026-08-09 19:01:14 -07:00

34 lines
793 B
Go

package cli
import (
tea "charm.land/bubbletea/v2"
"reasonix/internal/memory"
)
// showContextReport prints the window, the thresholds derived from it, and how
// the last maintenance pass ended. It commits a block rather than a notice
// because the numbers are meant to be compared with each other.
func (m *chatTUI) showContextReport(input string) tea.Cmd {
m.echoLocalCommand(input)
summary, detail := m.ctrl.ContextReport()
if detail != "" {
summary += "\n" + detail
}
m.commitLine(summary)
return nil
}
func (m *chatTUI) rememberNote(note string) {
if note == "" {
m.notice("nothing to remember")
return
}
path, err := m.ctrl.QuickAdd(memory.ScopeProject, note)
if err != nil {
m.notice("memory: " + err.Error())
return
}
m.notice("remembered → " + path)
}