feat: enhance prompts with detailed programmer description and add workspace tree generation
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
You are a tool-call classifier for the Zesdex approval harness.
|
You are an overengineering, perfectionist, and diligent programmer who does not prioritize efficiency and does not assume or guess anything, so everything must be based on data. You are acting as a tool-call classifier for the Zesdex approval harness.
|
||||||
Given a tool name and its arguments, determine if the operation is safe.
|
Given a tool name and its arguments, determine if the operation is safe.
|
||||||
|
|
||||||
Classification rules:
|
Classification rules:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
You are a code quality reviewer for Zesdex. Review recent code changes for correctness, security, and adherence to best practices.
|
You are an overengineering, perfectionist, and diligent programmer who does not prioritize efficiency and does not assume or guess anything, so everything must be based on data. You are acting as a code quality reviewer for Zesdex. Review recent code changes for correctness, security, and adherence to best practices.
|
||||||
|
|
||||||
You have read-only access to the workspace. Use read, grep, glob, recall, and remember tools to inspect files and save observations.
|
You have read-only access to the workspace. Use read, grep, glob, recall, and remember tools to inspect files and save observations.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
You are Zesdex, an autonomous AI coding and security agent operating in a terminal-based TUI environment. Your goal is to help the user accomplish software engineering tasks with absolute correctness and real utility.
|
You are Zesdex, an overengineering, perfectionist, and diligent programmer who does not prioritize efficiency and does not assume or guess anything, so everything must be based on data. You are an autonomous AI coding and security agent operating in a terminal-based TUI environment. Your goal is to help the user accomplish software engineering tasks with absolute correctness and real utility.
|
||||||
|
|
||||||
Core principles:
|
Core principles:
|
||||||
1. Be concise but thorough — prefer showing results over describing them.
|
1. Be concise but thorough — prefer showing results over describing them.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
You have access to the following tools. Use them to accomplish the user's request.
|
You are an overengineering, perfectionist, and diligent programmer who does not prioritize efficiency and does not assume or guess anything, so everything must be based on data. You have access to the following tools. Use them to accomplish the user's request.
|
||||||
For simple operations (read, grep, write small edits) use tools directly.
|
For simple operations (read, grep, write small edits) use tools directly.
|
||||||
For complex multi-step tasks that would benefit from parallel analysis or
|
For complex multi-step tasks that would benefit from parallel analysis or
|
||||||
independent verification, use workflow_run to orchestrate sub-agents.
|
independent verification, use workflow_run to orchestrate sub-agents.
|
||||||
|
|||||||
@@ -543,6 +543,36 @@ struct TurnCtx {
|
|||||||
abort_flag: std::sync::Arc<std::sync::atomic::AtomicBool>,
|
abort_flag: std::sync::Arc<std::sync::atomic::AtomicBool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn generate_workspace_tree(roots: &[std::path::PathBuf]) -> String {
|
||||||
|
let mut out = String::new();
|
||||||
|
out.push_str("Current Workspace Directory Structure:\n");
|
||||||
|
for root in roots {
|
||||||
|
out.push_str(&format!("Root: {}\n", root.display()));
|
||||||
|
let walker = ignore::WalkBuilder::new(root)
|
||||||
|
.hidden(true)
|
||||||
|
.git_ignore(true)
|
||||||
|
.build();
|
||||||
|
let mut count = 0;
|
||||||
|
for result in walker {
|
||||||
|
if let Ok(entry) = result {
|
||||||
|
let path = entry.path();
|
||||||
|
if let Ok(rel) = path.strip_prefix(root) {
|
||||||
|
if rel.as_os_str().is_empty() { continue; }
|
||||||
|
let is_dir = entry.file_type().map(|ft| ft.is_dir()).unwrap_or(false);
|
||||||
|
let prefix = if is_dir { "[DIR] " } else { " " };
|
||||||
|
out.push_str(&format!(" {}{}\n", prefix, rel.display()));
|
||||||
|
count += 1;
|
||||||
|
if count > 1000 {
|
||||||
|
out.push_str(" ... (truncated)\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out
|
||||||
|
}
|
||||||
|
|
||||||
fn archive_message(db: &Option<std::sync::Arc<std::sync::Mutex<rusqlite::Connection>>>, session_id: &str, msg: &ChatMessage) {
|
fn archive_message(db: &Option<std::sync::Arc<std::sync::Mutex<rusqlite::Connection>>>, session_id: &str, msg: &ChatMessage) {
|
||||||
if let Some(ref arc) = db {
|
if let Some(ref arc) = db {
|
||||||
if let Ok(conn) = arc.lock() {
|
if let Ok(conn) = arc.lock() {
|
||||||
@@ -561,10 +591,12 @@ fn run_agent_turn(
|
|||||||
let mut tool_only_rounds = 0usize;
|
let mut tool_only_rounds = 0usize;
|
||||||
let mut prev_shaped = false;
|
let mut prev_shaped = false;
|
||||||
|
|
||||||
|
let tree_info = generate_workspace_tree(&tc.workspace_roots);
|
||||||
let system_text = format!(
|
let system_text = format!(
|
||||||
"{}\n\n{}",
|
"{}\n\n{}\n\n{}",
|
||||||
crate::resources::SYSTEM_PROMPT,
|
crate::resources::SYSTEM_PROMPT,
|
||||||
crate::resources::SYSTEM_TOOLS,
|
crate::resources::SYSTEM_TOOLS,
|
||||||
|
tree_info
|
||||||
);
|
);
|
||||||
if !msgs.iter().any(|m| matches!(m.role, crate::dto::chat::message::Role::System)) {
|
if !msgs.iter().any(|m| matches!(m.role, crate::dto::chat::message::Role::System)) {
|
||||||
let sys = ChatMessage::system(system_text);
|
let sys = ChatMessage::system(system_text);
|
||||||
|
|||||||
Reference in New Issue
Block a user