Skip to content

feat(context-compression): add CLI flags, init wizard, debug dumps, TUI spinners (#1904)#1928

Merged
bug-ops merged 3 commits intomainfrom
feat-context-compression-add-m
Mar 16, 2026
Merged

feat(context-compression): add CLI flags, init wizard, debug dumps, TUI spinners (#1904)#1928
bug-ops merged 3 commits intomainfrom
feat-context-compression-add-m

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 16, 2026

Closes #1904.

Summary

Adds four integration points for the context compression subsystem, making Focus Agent, SideQuest eviction, and pruning strategy configurable without editing config.toml.

  • CLI flags: --focus/--no-focus, --sidequest/--no-sidequest, --pruning-strategy <reactive|task_aware|mig|task_aware_mig> override agent.focus.enabled, memory.sidequest.enabled, and memory.compression.pruning_strategy per session. Mutually-exclusive pairs enforced by clap conflicts_with. PruningStrategy implements FromStr (snake_case + kebab-case) in zeph-core — no clap dependency added to the library crate.

  • --init wizard: new step_context_compression() step between step_memory and step_channel, asking about Focus Agent interval, SideQuest interval (both validated ≥ 1), and pruning strategy via a Select menu.

  • Debug dumps: three new DebugDumper methods: dump_pruning_scores (feature-gated, fires before eviction loop), dump_focus_knowledge (after append_knowledge()), dump_sidequest_eviction (cursor list with per-entry evicted flag). All follow the existing Trace-skip / next_id() / write() pattern.

  • TUI spinners: Agent gains an optional status_tx field (cloned from build_provider() before set_status_tx() consumes it). Sends "Extracting task goal..." on background task spawn and clears on all completion paths. Sends "SideQuest: scoring tool outputs..." on eviction spawn; clears on no-cursors / panic / freed==0 paths; sends "SideQuest evicted N tokens" on success.

Changes

File Change
src/cli.rs 5 new flags + 11 tests
src/runner.rs wire flags into config; wire status_tx to agent
src/init.rs step_context_compression() + build_config wiring + 7 tests
src/acp.rs, src/commands/ingest.rs, src/daemon.rs update build_provider() 3-tuple destructure
crates/zeph-core/src/config/types/memory.rs FromStr + Copy for PruningStrategy
crates/zeph-core/src/debug_dump/mod.rs 3 new dump methods
crates/zeph-core/src/agent/mod.rs status_tx field; SideQuest spinners; evicted_indices rename
crates/zeph-core/src/agent/builder.rs with_status_tx() builder method
crates/zeph-core/src/bootstrap/mod.rs build_provider() returns 3-tuple
crates/zeph-core/src/agent/context/summarization.rs spinner lifecycle; UTF-8-safe truncation; pruning score dumps
crates/zeph-core/src/agent/tool_execution/native.rs focus knowledge dump after append_knowledge()
CHANGELOG.md [Unreleased] entries

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace --features full -- -D warnings — 0 warnings
  • cargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins — 6071 passed, 12 skipped
  • Manual: cargo run --features full -- --focus --pruning-strategy task_aware enables Focus Agent for the session
  • Manual: cargo run --features full -- --init shows the "Context Compression" step
  • Manual: cargo run --features full -- --debug-dump .local/debug produces *-pruning-scores.json / *-focus-knowledge.txt / *-sidequest-eviction.json files during a compressed session

bug-ops added 2 commits March 16, 2026 20:14
…UI spinners (#1904)

Add four integration points for context compression features:

- CLI: --focus/--no-focus, --sidequest/--no-sidequest, --pruning-strategy flags
  override agent.focus.enabled, memory.sidequest.enabled, and
  memory.compression.pruning_strategy per session without editing config.
  --focus/--no-focus and --sidequest/--no-sidequest are mutually exclusive.
  PruningStrategy implements FromStr (snake_case + kebab-case variants) in
  zeph-core with no clap dependency added to the library crate.

- Init wizard: step_context_compression() inserts between step_memory and
  step_channel, asking 5 questions about Focus Agent, SideQuest, and pruning
  strategy. Interval inputs validated >= 1 via validate_with().

- Debug dumps: dump_pruning_scores (context-compression gated), dump_focus_knowledge,
  dump_sidequest_eviction added to DebugDumper. Pruning scores captured before
  eviction loop; focus knowledge after append_knowledge(); sidequest eviction with
  cursor list and evicted-flag per entry.

- TUI spinners: Agent gains optional status_tx field (cloned from build_provider()
  before provider.set_status_tx() consumes it). Sends "Extracting task goal..." on
  background task spawn, clears on all completion paths (success, None, Err).
  Sends "SideQuest: scoring tool outputs..." on spawn, clears on no-cursors/panic/
  freed==0 paths, sends "SideQuest evicted N tokens" on success.
@github-actions github-actions bot added enhancement New feature or request size/XL Extra large PR (500+ lines) documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate and removed enhancement New feature or request size/XL Extra large PR (500+ lines) labels Mar 16, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 16, 2026 19:18
@github-actions github-actions bot added enhancement New feature or request size/XL Extra large PR (500+ lines) labels Mar 16, 2026
@bug-ops bug-ops merged commit 49dc559 into main Mar 16, 2026
20 checks passed
@bug-ops bug-ops deleted the feat-context-compression-add-m branch March 16, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation enhancement New feature or request rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(context-compression): add missing integration points for Focus Agent, SideQuest, and SWE-Pruner

1 participant