Summary
The proactive auto-compaction trigger is currently a hardcoded constant contextThreshold = 0.9 in pkg/compaction. Make it configurable, and expose an explicit on/off knob for session compaction.
Motivation
Roo Code exposes a configurable condense threshold. docker-agent's threshold is not tunable, and the existing WithSessionCompaction(bool) runtime option is not surfaced in YAML/CLI at all.
Proposed behavior
- New
compaction_threshold config key, range 0 < x <= 1, default 0.9 (behavior unchanged unless set).
- Decision: place it per-agent, with an optional per-model override (next to
compaction_model).
- Also surface an explicit enable/disable knob (e.g.
session_compaction: false) mapping to the existing WithSessionCompaction runtime opt.
Implementation notes (starting points)
- Replace the package const in
pkg/compaction/compaction.go; thread the value as a parameter through ShouldCompact
pkg/runtime/loop.go (~line 501 proactive trigger; ~1107-1122 compactIfNeeded), pkg/runtime/runtime.go (opts)
pkg/agent/agent.go + pkg/agent/opts.go, pkg/teamloader wiring
- Config additions go ONLY to
pkg/config/latest/types.go + validate.go (schema is versioned), plus agent-schema.json and a new example YAML
- Extend
pkg/runtime/compaction_trigger_test.go
Complexity: S–M.
Background: shared plan context-management-gap-analysis (Phase 1, item 2).
Dependencies / Relationships
Summary
The proactive auto-compaction trigger is currently a hardcoded constant
contextThreshold = 0.9inpkg/compaction. Make it configurable, and expose an explicit on/off knob for session compaction.Motivation
Roo Code exposes a configurable condense threshold. docker-agent's threshold is not tunable, and the existing
WithSessionCompaction(bool)runtime option is not surfaced in YAML/CLI at all.Proposed behavior
compaction_thresholdconfig key, range0 < x <= 1, default0.9(behavior unchanged unless set).compaction_model).session_compaction: false) mapping to the existingWithSessionCompactionruntime opt.Implementation notes (starting points)
pkg/compaction/compaction.go; thread the value as a parameter throughShouldCompactpkg/runtime/loop.go(~line 501 proactive trigger; ~1107-1122 compactIfNeeded),pkg/runtime/runtime.go(opts)pkg/agent/agent.go+pkg/agent/opts.go,pkg/teamloaderwiringpkg/config/latest/types.go+validate.go(schema is versioned), plusagent-schema.jsonand a new example YAMLpkg/runtime/compaction_trigger_test.goComplexity: S–M.
Background: shared plan
context-management-gap-analysis(Phase 1, item 2).Dependencies / Relationships