pub mod compression;
pub mod core;
pub mod memory_storage;
pub mod storage;
pub use compression::{
has_pending_compression, has_pending_project_compression, process_pending_compression,
process_pending_phase_compression, process_pending_project_compression,
set_pending_compression_range, CompressionMetrics, PhaseCompression, ProjectCompression,
};
pub use core::{
clear_plan_data, clear_task_start_index, execute_plan, get_and_clear_start_index,
get_completed_task_count, get_current_plan_display, get_current_task_start_index,
get_last_completed_task_for_compression, has_active_plan, set_current_task_start_index,
set_last_task_message_range,
};
pub use memory_storage::MemoryPlanStorage;
pub use storage::{ExecutionPlan, MessageRange, PlanStatus, PlanStorage, PlanTask, TaskStatus};
use crate::mcp::McpFunction;
use serde_json::json;
pub fn get_plan_function() -> McpFunction {
McpFunction {
name: "plan".to_string(),
description: "Structured step-by-step task tracker for COMPLEX, MULTI-STEP work spanning multiple files or components.
Use for: multi-file implementations, long-running work that may be interrupted, tasks needing sequencing and checkpoints.
Skip for: single-step changes, quick fixes, anything completable in one focused pass without losing context.
Commands:
- start: Create plan with tasks array (ERROR if plan already exists — use 'done' or 'reset' first)
- step: Add progress note to current task (does NOT advance it)
- next: Mark current task DONE and advance to next
- list: Show all tasks with status
- done: Complete the plan with final summary
- reset: Clear all plan data
Each task requires `title` (short) and `description` (detailed: file paths, commands, expected outcomes, validation steps).".to_string(),
parameters: json!({
"type": "object",
"properties": {
"command": {
"type": "string",
"description": "The operation to perform",
"enum": ["start", "step", "next", "list", "done", "reset"]
},
"tasks": {
"type": "array",
"items": {
"type": "object",
"required": ["title", "description"],
"properties": {
"title": {
"type": "string",
"description": "Short, clear task title"
},
"description": {
"type": "string",
"description": "Comprehensive explanation of exactly what needs to be done. Include: specific file paths, exact commands to run, configuration details, expected outcomes, error handling steps, validation criteria, and any dependencies. Write as if someone else needs to complete this task from scratch with zero context. Minimum 2-3 sentences with technical specifics."
}
}
},
"description": "Array of detailed task objects with titles and comprehensive descriptions (REQUIRED for 'start' command). Each task description must include specific technical details, file paths, commands, expected outcomes, and validation steps - write as if someone else needs to complete the task from scratch."
},
"content": {
"type": "string",
"description": "REQUIRED for 'start' (plan goal/title), 'step' (progress details), 'next' (task completion summary), and 'done' (final summary). NOT required for 'list' or 'reset'."
}
},
"required": ["command"],
"additionalProperties": false
}),
}
}