Skip to content

Commit ba94872

Browse files
Alex Holmbergclaude
authored andcommitted
feat(agent): add plan mode, plan resumption, and context overflow fixes
## Plan Mode & Planning Workflow - Add PlanMode state (Standard/Planning) with Shift+Tab toggle - Add plan tools: plan_create, plan_next, plan_update, plan_list - Add plan_menu.rs for interactive post-plan action selection - Execute with auto-accept changes - Execute with review for each change - Modify plan with feedback - Add plan resumption on startup - shows incomplete plans and suggests "continue" - Add /plans command to list incomplete plans with progress info - Update prompts with plan_execution_protocol explaining resumable plans ## Context Overflow Fix ("Input Too Long" Error) - Fixed critical bug: was compacting empty conversation_history instead of raw_chat_history - Add estimate_raw_history_tokens() to estimate tokens from rig::Message directly - Truncate raw_chat_history directly when context too large (10→6→4 messages progressively) - Add pre-request check to detect large context before hitting API limits - Add find_most_recent_plan_file() for reliable plan path detection ## Auto-Accept Mode Improvements - Show full code diff in auto-accept mode (same as confirmation prompts) - Use render_diff() for existing files, render_new_file() for new files - Apply to both WriteFileTool and WriteFilesTool ## Rate Limiting Mitigation - Reduce extended thinking budget from 16000 to 8000 tokens - Helps avoid API rate limits during heavy tool-use sessions ## New Modules - src/agent/tools/plan.rs - Plan creation and execution tools - src/agent/tools/truncation.rs - Output truncation utilities - src/agent/tools/diagnostics.rs - Diagnostic tools - src/agent/ui/plan_menu.rs - Plan action menu UI ## Vendor Changes - Move rig-bedrock from patches/ to vendor/ directory - Clean up obsolete patch files ## Prompts Updates - Add is_plan_continuation_query() to detect "continue" requests - Update plan_execution_protocol with resumption instructions - Explain that plan_next automatically finds where you left off 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2c5b27e commit ba94872

58 files changed

Lines changed: 3474 additions & 3424 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ node_modules/
1616

1717
# MSVC Windows builds of rustc generate these, which store debugging information
1818
*.pdb
19+
docs/**
1920

2021
# Generated by cargo mutants
2122
# Contains mutation testing data

Cargo.lock

Lines changed: 27 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ futures-util = "0.3"
7373

7474
# Agent dependencies (using Rig - LLM application framework)
7575
rig-core = { version = "0.27", features = ["derive"] }
76-
rig-bedrock = "0.3" # AWS Bedrock provider for Rig
76+
rig-bedrock = { path = "vendor/rig-bedrock" } # Vendored with fix for extended thinking + tool calls
7777

7878
# Diff rendering for file confirmation UI
7979
similar = "2.6"
@@ -104,10 +104,4 @@ path = "examples/check_vulnerabilities.rs"
104104

105105
[[example]]
106106
name = "security_analysis"
107-
path = "examples/security_analysis.rs"
108-
109-
# Patch rig-bedrock to fix extended thinking support with tool use
110-
# The upstream version drops Reasoning blocks when a tool call is present.
111-
# See: patches/rig-bedrock/src/types/assistant_content.rs for the fix.
112-
[patch.crates-io]
113-
rig-bedrock = { path = "patches/rig-bedrock" }
107+
path = "examples/security_analysis.rs"

patches/rig-bedrock/.cargo-ok

Lines changed: 0 additions & 1 deletion
This file was deleted.

patches/rig-bedrock/.cargo_vcs_info.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)