feat: enhance system prompt handling and input key actions

This commit is contained in:
asepharyana
2026-07-11 22:16:47 +07:00
parent 3dee2a1427
commit 1f182021fb
4 changed files with 23 additions and 3 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ Core principles:
5. For simple tasks, handle them directly with read/grep/write/edit. 5. For simple tasks, handle them directly with read/grep/write/edit.
6. For complex tasks (multi-file changes, parallel analysis, independent verification), use workflow_run to orchestrate sub-agents. 6. For complex tasks (multi-file changes, parallel analysis, independent verification), use workflow_run to orchestrate sub-agents.
7. Every write or edit must have a clear reason — include it in the reason parameter. 7. Every write or edit must have a clear reason — include it in the reason parameter.
8. When you're uncertain about requirements, ask clarifying questions before acting. 8. For greetings or conversation that doesn't require code changes, respond naturally WITHOUT calling any tools.
9. After making changes, verify they work by running builds or tests. 9. After making changes, verify they work by running builds or tests.
10. Respect the agent mode: Auto (full autonomy), Normal (review risky ops), Plan (no mutations), Yolo (full autonomy + no classifier). 10. Respect the agent mode: Auto (full autonomy), Normal (review risky ops), Plan (no mutations), Yolo (full autonomy + no classifier).
+9
View File
@@ -521,6 +521,15 @@ fn run_agent_turn(
let mut msgs = messages.to_vec(); let mut msgs = messages.to_vec();
let mut edits_this_turn = 0u32; let mut edits_this_turn = 0u32;
let system_text = format!(
"{}\n\n{}",
crate::resources::SYSTEM_PROMPT,
crate::resources::SYSTEM_TOOLS,
);
if !msgs.iter().any(|m| matches!(m.role, crate::dto::chat::message::Role::System)) {
msgs.insert(0, ChatMessage::system(system_text));
}
for _step in 0..MAX_AGENT_STEPS { for _step in 0..MAX_AGENT_STEPS {
let response = tc let response = tc
.client .client
+10 -2
View File
@@ -38,10 +38,18 @@ pub fn handle_key(key: KeyEvent, state: &mut AppStateRest) -> Vec<Action> {
vec![Action::CursorRight] vec![Action::CursorRight]
} }
KeyCode::Up => { KeyCode::Up => {
vec![Action::HistoryUp] if key.modifiers.contains(KeyModifiers::CONTROL) {
vec![Action::HistoryUp]
} else {
vec![Action::ScrollUp]
}
} }
KeyCode::Down => { KeyCode::Down => {
vec![Action::HistoryDown] if key.modifiers.contains(KeyModifiers::CONTROL) {
vec![Action::HistoryDown]
} else {
vec![Action::ScrollDown]
}
} }
KeyCode::PageUp => { KeyCode::PageUp => {
vec![Action::ScrollUp] vec![Action::ScrollUp]
+3
View File
@@ -1,3 +1,6 @@
pub const SYSTEM_PROMPT: &str = include_str!("../src-misc/system-prompt.txt");
pub const SYSTEM_TOOLS: &str = include_str!("../src-misc/system-tools.txt");
pub const BANNER: &str = r" pub const BANNER: &str = r"