compact on tool call if > 90%

This commit is contained in:
Dhanji Prasanna
2025-11-04 14:35:11 +11:00
parent 1f9fef5f18
commit 631f3c16ca
3 changed files with 48 additions and 0 deletions

View File

@@ -184,6 +184,10 @@ pub struct Cli {
#[arg(short, long)]
pub verbose: bool,
/// Enable manual control of context compaction (disables auto-compact at 90%)
#[arg(long = "manual-compact")]
pub manual_compact: bool,
/// Show the system prompt being sent to the LLM
#[arg(long)]
pub show_prompt: bool,
@@ -338,6 +342,11 @@ pub async fn run() -> Result<()> {
config.webdriver.enabled = true;
}
// Apply no-auto-compact flag override
if cli.manual_compact {
config.agent.auto_compact = false;
}
// Validate provider if specified
if let Some(ref provider) = cli.provider {
let valid_providers = ["anthropic", "databricks", "embedded", "openai"];
@@ -558,6 +567,11 @@ async fn run_accumulative_mode(
config.webdriver.enabled = true;
}
// Apply no-auto-compact flag override
if cli.manual_compact {
config.agent.auto_compact = false;
}
// Create agent for interactive mode with requirements context
let ui_writer = ConsoleUiWriter::new();
let agent = Agent::new_with_readme_and_quiet(
@@ -635,6 +649,11 @@ async fn run_accumulative_mode(
config.webdriver.enabled = true;
}
// Apply no-auto-compact flag override
if cli.manual_compact {
config.agent.auto_compact = false;
}
// Create agent for this autonomous run
let ui_writer = ConsoleUiWriter::new();
let agent = Agent::new_autonomous_with_readme_and_quiet(