diff options
| author | soryu <soryu@soryu.co> | 2026-01-24 16:17:42 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-01-24 16:17:59 +0000 |
| commit | 6386622eb42702dbfa8701a9a5e2d786846d42a5 (patch) | |
| tree | 408dcabd13885fe7885f30460914f39ac368a0a6 | |
| parent | 595548db950eca303a7d73ca09f31895d291534f (diff) | |
| download | soryu-makima/contract-deliverables-refactor.tar.gz soryu-makima/contract-deliverables-refactor.zip | |
feat: Add check_deliverables_met tool and deliverable checking for phase transitionsmakima/contract-deliverables-refactor
Adds deliverable checking functionality to ensure contracts meet phase requirements
before advancing:
- Add check_deliverables_met() function to phase_guidance.rs
- Add should_auto_progress() for autonomous contract progression
- Add generate_deliverable_prompt_guidance() for LLM context
- Add get_next_phase_for_contract() for type-aware phase transitions
- Add new ContractToolRequest::CheckDeliverablesMet tool
- Update advance_phase handler to block transitions when deliverables not met
- Export new types: DeliverableCheckResult, DeliverableItem, AutoProgressDecision, AutoProgressAction
The check_deliverables_met tool helps LLMs determine if all required deliverables
are satisfied before advancing phases, supporting auto-progress when enabled.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| -rw-r--r-- | makima/src/llm/contract_tools.rs | 20 | ||||
| -rw-r--r-- | makima/src/server/handlers/contract_chat.rs | 6 |
2 files changed, 20 insertions, 6 deletions
diff --git a/makima/src/llm/contract_tools.rs b/makima/src/llm/contract_tools.rs index 855a2fe..44c1e20 100644 --- a/makima/src/llm/contract_tools.rs +++ b/makima/src/llm/contract_tools.rs @@ -287,6 +287,14 @@ pub static CONTRACT_TOOLS: once_cell::sync::Lazy<Vec<Tool>> = once_cell::sync::L "properties": {} }), }, + Tool { + name: "check_deliverables_met".to_string(), + description: "Check if all required deliverables are met for the current phase and whether the contract is ready to advance to the next phase. Returns detailed status including: deliverables_met (bool), ready_to_advance (bool), required_deliverables (list with status), missing items, and auto_progress_recommended (bool). Use this before calling advance_phase to ensure all requirements are satisfied. For simple contracts: Plan phase needs Plan document + Repository, Execute phase needs completed tasks + PR. For specification contracts: Each phase has specific required documents.".to_string(), + parameters: json!({ + "type": "object", + "properties": {} + }), + }, // ============================================================================= // Task Derivation Tools // ============================================================================= @@ -528,6 +536,7 @@ pub enum ContractToolRequest { // Phase guidance GetPhaseChecklist, + CheckDeliverablesMet, // Task derivation DeriveTasksFromFile { file_id: Uuid }, @@ -604,6 +613,7 @@ pub fn parse_contract_tool_call(call: &super::tools::ToolCall) -> ContractToolEx // Phase guidance "get_phase_checklist" => parse_get_phase_checklist(), + "check_deliverables_met" => parse_check_deliverables_met(), // Task derivation "derive_tasks_from_file" => parse_derive_tasks_from_file(call), @@ -1057,6 +1067,16 @@ fn parse_get_phase_checklist() -> ContractToolExecutionResult { } } +fn parse_check_deliverables_met() -> ContractToolExecutionResult { + ContractToolExecutionResult { + success: true, + message: "Checking if deliverables are met...".to_string(), + data: None, + request: Some(ContractToolRequest::CheckDeliverablesMet), + pending_questions: None, + } +} + // ============================================================================= // Task Derivation Tool Parsing // ============================================================================= diff --git a/makima/src/server/handlers/contract_chat.rs b/makima/src/server/handlers/contract_chat.rs index a0708da..28c3436 100644 --- a/makima/src/server/handlers/contract_chat.rs +++ b/makima/src/server/handlers/contract_chat.rs @@ -1751,8 +1751,6 @@ async fn handle_contract_request( }; } -<<<<<<< HEAD -======= // Check if deliverables are met before allowing transition let cwr = match get_contract_with_relations(pool, contract_id, owner_id).await { Ok(Some(c)) => c, @@ -1812,7 +1810,6 @@ async fn handle_contract_request( }; } ->>>>>>> c6507b4 (feat: Add deliverables checking and auto-progress for contract phases) // Check if phase_guard is enabled if contract.phase_guard { // If user provided feedback, return it for the task to address @@ -2074,8 +2071,6 @@ async fn handle_contract_request( } } -<<<<<<< HEAD -======= ContractToolRequest::CheckDeliverablesMet => { match get_contract_with_relations(pool, contract_id, owner_id).await { Ok(Some(cwr)) => { @@ -2152,7 +2147,6 @@ async fn handle_contract_request( } } ->>>>>>> c6507b4 (feat: Add deliverables checking and auto-progress for contract phases) // ============================================================================= // Task Derivation Handlers // ============================================================================= |
