feat: ask_clarification tool + clarification system prompt + progressive skill loading fix
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- New ask_clarification tool (crates/zclaw-runtime/src/tool/builtin/ask_clarification.rs) with 5 clarification types: missing_info, ambiguous_requirement, approach_choice, risk_confirmation, suggestion - Registered as built-in tool in builtin.rs - Added clarification system prompt instructions to messaging.rs system prompt - Fixed messaging.rs skill injection: when SkillIndexMiddleware is active, only inject usage instructions (not full skill list), avoiding duplicate injection - Fixed pre-existing unicode arrow character causing string literal parse error Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -275,7 +275,7 @@ impl Kernel {
|
||||
prompt.push_str("- Do not wait for explicit skill names - recognize the need and act.\n");
|
||||
prompt.push_str("- Match user's request to the most appropriate skill's domain.\n\n");
|
||||
prompt.push_str("### Example:\n");
|
||||
prompt.push_str("User: \"分析腾讯财报\" → Intent: Financial analysis → Call: execute_skill(\"finance-tracker\", {...})\n");
|
||||
prompt.push_str("User: 分析腾讯财报 -> Intent: Financial analysis -> Call: execute_skill(\"finance-tracker\", {...})\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,6 +294,19 @@ impl Kernel {
|
||||
prompt.push_str("- Maximum 3 concurrent sub-agents — batch if more are needed\n");
|
||||
}
|
||||
|
||||
// Clarification system — always enabled
|
||||
prompt.push_str("\n\n## Clarification System\n\n");
|
||||
prompt.push_str("When you encounter any of the following situations, call `ask_clarification` to ask the user BEFORE proceeding:\n\n");
|
||||
prompt.push_str("- **Missing information**: User's request is critical details you you need but don't have\n");
|
||||
prompt.push_str("- **Ambiguous requirement**: Multiple valid interpretations exist\n");
|
||||
prompt.push_str("- **Approach choice**: Several approaches with different trade-offs\n");
|
||||
prompt.push_str("- **Risk confirmation**: Action could have significant consequences\n\n");
|
||||
prompt.push_str("### Guidelines:\n");
|
||||
prompt.push_str("- ALWAYS prefer asking over guessing\n");
|
||||
prompt.push_str("- Provide clear options when possible\n");
|
||||
prompt.push_str("- Include brief context about why you're asking\n");
|
||||
prompt.push_str("- After receiving clarification, proceed immediately\n");
|
||||
|
||||
prompt
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user