diff --git a/crates/pod/src/prompt/catalog.rs b/crates/pod/src/prompt/catalog.rs index d61b1fd9..702fa392 100644 --- a/crates/pod/src/prompt/catalog.rs +++ b/crates/pod/src/prompt/catalog.rs @@ -507,6 +507,18 @@ mod tests { assert!(rendered.contains("mark_read_required")); } + #[test] + fn internal_worker_prompts_do_not_include_default_memory_guidance() { + let cat = PromptCatalog::builtins_only().unwrap(); + let compact = cat.compact_system().unwrap(); + let extract = cat.memory_extract_system("Japanese").unwrap(); + let consolidate = cat.memory_consolidation_system("Japanese").unwrap(); + for rendered in [compact, extract, consolidate] { + assert!(!rendered.contains("### Memory and knowledge")); + assert!(!rendered.contains("Do not query memory every turn")); + } + } + #[test] fn memory_worker_prompts_include_language() { let cat = PromptCatalog::builtins_only().unwrap(); diff --git a/crates/pod/src/prompt/system.rs b/crates/pod/src/prompt/system.rs index 700dd06c..3b2f8465 100644 --- a/crates/pod/src/prompt/system.rs +++ b/crates/pod/src/prompt/system.rs @@ -440,7 +440,11 @@ mod tests { let rendered = tmpl .render(&ctx(dir.path(), &scope, vec!["Read".into()], None)) .unwrap(); - // Builtin default body must expose the language policy. + // Builtin default body must expose the tool and language policies. + assert!(rendered.contains("### Memory and knowledge")); + assert!(rendered.contains("MemoryQuery")); + assert!(rendered.contains("MemoryRead(kind=summary)")); + assert!(rendered.contains("Do not query memory every turn")); assert!(rendered.contains("## Language")); assert!(rendered.contains("`language`: `match the user's language")); // Trailing section must be present. diff --git a/resources/prompts/common/tool-usage.md b/resources/prompts/common/tool-usage.md index 73b29ac9..d0524197 100644 --- a/resources/prompts/common/tool-usage.md +++ b/resources/prompts/common/tool-usage.md @@ -5,3 +5,10 @@ When searching, use grep/glob primitives rather than shell pipelines. You can run multiple tools simultaneously by calling them within a single response. It is recommended to run tools that handle asynchronous processing, such as queries and readings, in batches. + +### Memory and knowledge + +For past decisions, prior requests, durable preferences, project history, or why something was done, use targeted lookup instead of guessing from vague recollection. +Use `MemoryQuery` for durable memory records (summary, decisions, requests), `KnowledgeQuery` for project knowledge, `MemoryRead(kind=summary)` for the full memory summary, and `MemoryRead` on returned slugs when excerpts are insufficient. +Resident memory and knowledge are helpful context but may be stale; current user instructions, repository files, tickets, git history, and session logs are authoritative for exact current state. +Do not query memory every turn, and normally prefer read/query tools; use `MemoryWrite`, `MemoryEdit`, or `MemoryDelete` only when explicitly asked or in a memory maintenance worker.