Agent::new_session(dir), new_session_here(), resume(path), compact_now(), session_dir(). TUI /new, /clear, /resume and RPC new, clear, resume all go through them.
One constant KEEP_MESSAGES = 6 replaces the hard-coded 4 (manual, TUI + RPC) and 6 (auto).
Behavior changes: RPC clear is now an alias of new (new session file, old one stays resumable) as in the TUI; Agent::clear is removed. RPC new writes next to the current session file (was: startup dir). /compact and RPC compact keep 6 messages instead of 4.
ContextPolicy (hx-core/window.rs)
ContextPolicy::{Fixed(n), FromModel{window}}; the threshold is computed from policy + reserve (max_tokens), so set_max_tokens and the policy can be set in any order.
Removed: Agent::set_compact_at, fit_window, Switcher's auto_compact flag/arg. Switcher calls Agent::set_model_window, which a Fixed policy ignores.
Tests: new session_ops_share_one_path, policy_is_order_independent; existing compaction/switch tests ported. fmt, clippy -D warnings, tests/all.sh green. Token counts of the prefix are unchanged (no tool or prompt change), so no hx prefix run.
Candidates 1+2 from the architecture feedback.
**Session ops (hx-core)**
- `Agent::new_session(dir)`, `new_session_here()`, `resume(path)`, `compact_now()`, `session_dir()`. TUI `/new`, `/clear`, `/resume` and RPC `new`, `clear`, `resume` all go through them.
- One constant `KEEP_MESSAGES = 6` replaces the hard-coded 4 (manual, TUI + RPC) and 6 (auto).
- Behavior changes: RPC `clear` is now an alias of `new` (new session file, old one stays resumable) as in the TUI; `Agent::clear` is removed. RPC `new` writes next to the current session file (was: startup dir). `/compact` and RPC `compact` keep 6 messages instead of 4.
**ContextPolicy (hx-core/window.rs)**
- `ContextPolicy::{Fixed(n), FromModel{window}}`; the threshold is computed from policy + reserve (`max_tokens`), so `set_max_tokens` and the policy can be set in any order.
- Removed: `Agent::set_compact_at`, `fit_window`, `Switcher`'s `auto_compact` flag/arg. Switcher calls `Agent::set_model_window`, which a Fixed policy ignores.
**Tests**: new `session_ops_share_one_path`, `policy_is_order_independent`; existing compaction/switch tests ported. fmt, clippy -D warnings, `tests/all.sh` green. Token counts of the prefix are unchanged (no tool or prompt change), so no `hx prefix` run.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Candidates 1+2 from the architecture feedback.
Session ops (hx-core)
Agent::new_session(dir),new_session_here(),resume(path),compact_now(),session_dir(). TUI/new,/clear,/resumeand RPCnew,clear,resumeall go through them.KEEP_MESSAGES = 6replaces the hard-coded 4 (manual, TUI + RPC) and 6 (auto).clearis now an alias ofnew(new session file, old one stays resumable) as in the TUI;Agent::clearis removed. RPCnewwrites next to the current session file (was: startup dir)./compactand RPCcompactkeep 6 messages instead of 4.ContextPolicy (hx-core/window.rs)
ContextPolicy::{Fixed(n), FromModel{window}}; the threshold is computed from policy + reserve (max_tokens), soset_max_tokensand the policy can be set in any order.Agent::set_compact_at,fit_window,Switcher'sauto_compactflag/arg. Switcher callsAgent::set_model_window, which a Fixed policy ignores.Tests: new
session_ops_share_one_path,policy_is_order_independent; existing compaction/switch tests ported. fmt, clippy -D warnings,tests/all.shgreen. Token counts of the prefix are unchanged (no tool or prompt change), so nohx prefixrun.