feat(channel): add capabilities to system prompt (#531)
* feat(channels): add channel capabilities to system prompt Add channel capabilities section to system prompt so the agent knows it can send Discord messages directly without asking permission. Also reminds agent not to repeat or echo credentials. Co-authored-by: Vernon Stinebaker <vernon.stinebaker@gmail.com> * chore: fix formatting and clippy warnings
This commit is contained in:
parent
5b5d9fe77f
commit
efa6e5aa4a
2 changed files with 31 additions and 0 deletions
|
|
@ -484,6 +484,16 @@ pub fn build_system_prompt(
|
|||
std::env::consts::OS,
|
||||
);
|
||||
|
||||
// ── 8. Channel Capabilities ─────────────────────────────────────
|
||||
prompt.push_str("## Channel Capabilities\n\n");
|
||||
prompt.push_str(
|
||||
"- You are running as a Discord bot. You CAN and do send messages to Discord channels.\n",
|
||||
);
|
||||
prompt.push_str("- When someone messages you on Discord, your response is automatically sent back to Discord.\n");
|
||||
prompt.push_str("- You do NOT need to ask permission to respond — just respond directly.\n");
|
||||
prompt.push_str("- NEVER repeat, describe, or echo credentials, tokens, API keys, or secrets in your responses.\n");
|
||||
prompt.push_str("- If a tool output contains credentials, they have already been redacted — do not mention them.\n\n");
|
||||
|
||||
if prompt.is_empty() {
|
||||
"You are ZeroClaw, a fast and efficient AI assistant built in Rust. Be helpful, concise, and direct.".to_string()
|
||||
} else {
|
||||
|
|
@ -1569,6 +1579,25 @@ mod tests {
|
|||
assert!(truncated.is_char_boundary(truncated.len()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn prompt_contains_channel_capabilities() {
|
||||
let ws = make_workspace();
|
||||
let prompt = build_system_prompt(ws.path(), "model", &[], &[], None, None);
|
||||
|
||||
assert!(
|
||||
prompt.contains("## Channel Capabilities"),
|
||||
"missing Channel Capabilities section"
|
||||
);
|
||||
assert!(
|
||||
prompt.contains("running as a Discord bot"),
|
||||
"missing Discord context"
|
||||
);
|
||||
assert!(
|
||||
prompt.contains("NEVER repeat, describe, or echo credentials"),
|
||||
"missing security instruction"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn prompt_workspace_path() {
|
||||
let ws = make_workspace();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue