2
0

refactor(agent): reduce context size limits for AI communication and git diff

This commit is contained in:
2026-03-24 15:10:05 +09:00
parent 5de89b16b9
commit 12faa891e7

View File

@@ -221,7 +221,7 @@ impl Agent {
/// Compact JSON for AI communication. Includes result for integration.
pub fn to_ai_json(&self) -> serde_json::Value {
let result = truncate_middle(&self.output, 2000);
let result = truncate_middle(&self.output, 800);
let error = if let AgentStatus::Error(ref e) = self.status {
Some(e.clone())
} else {
@@ -345,7 +345,7 @@ pub fn git_context(cwd: &str) -> Option<String> {
let diff_stat = run(&["diff", "--stat", "HEAD"]);
// Actual diff content (truncated)
let diff_content = run(&["diff", "HEAD"]);
let diff_short: String = diff_content.lines().take(100).collect::<Vec<_>>().join("\n");
let diff_short: String = diff_content.lines().take(30).collect::<Vec<_>>().join("\n");
let mut ctx = format!("branch: {branch}");
if !status.is_empty() {