A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
Ship the first per-model prompt rule: bash() over subprocess for glm-5.3 (#3475)
Sebastian Müllere41c9c4c6cca
diff --git a/crates/pa-core/src/prompts/layers/bash-over-subprocess.md b/crates/pa-core/src/prompts/layers/bash-over-subprocess.mdnew file mode 100644index 0000000000..e2c4d17acd--- /dev/null+++ b/crates/pa-core/src/prompts/layers/bash-over-subprocess.md@@ -0,0 +1 @@+Never run shell commands through `subprocess`, `os.system`, or a helper that wraps them, even when you need the output. Start the command with `h = bash(cmd)`; in a later `ipython` call, collect `r = await h` (this returns instantly if the command already finished) and use `r.output` and `r.exit_code`. Only commands that finish in under a second may be awaited inline.diff --git a/crates/pa-core/src/prompts/layers/model_prompts.toml b/crates/pa-core/src/prompts/layers/model_prompts.tomlindex 7b5918cff3..9ca3e70f82 100644--- a/crates/pa-core/src/prompts/layers/model_prompts.toml+++ b/crates/pa-core/src/prompts/layers/model_prompts.toml@@ -1,9 +1,9 @@# Per-model system-prompt additions.#-# [[rule]]-# match = ["glm-5.3*"]-# files = ["tier-2-models.md", "glm-5.3-identity.md"]-## File names resolve inside the agent dir; absolute paths and ".." are rejected.# The user map is <agent_dir>/model-prompts.toml; matching, order, and# error rules live in pa_core::prompts::model_prompts.++[[rule]]+match = ["glm-5.3*"]+files = ["bash-over-subprocess.md"]diff --git a/crates/pa-core/src/prompts/model_prompts.rs b/crates/pa-core/src/prompts/model_prompts.rsindex 5d14bd2d6b..69d2adb174 100644--- a/crates/pa-core/src/prompts/model_prompts.rs+++ b/crates/pa-core/src/prompts/model_prompts.rs@@ -11,7 +11,10 @@ use serde::Deserialize;pub const MODEL_PROMPTS_TOML: &str = include_str!("layers/model_prompts.toml");-const MODEL_PROMPT_FILES: &[(&str, &str)] = &[];+const MODEL_PROMPT_FILES: &[(&str, &str)] = &[(+ "bash-over-subprocess.md",+ include_str!("layers/bash-over-subprocess.md"),+)];const USER_MODEL_PROMPTS_TOML: &str = "model-prompts.toml";@@ -467,6 +470,23 @@ files = ["shared.md", "user-only.md"]assert!(resolution.errors.is_empty());}+ #[test]+ fn shipped_glm_bash_rule_applies_to_glm_models_only() {+ let empty = tempfile::tempdir().unwrap();+ let resolution =+ load_model_prompts(Some("prime-inference/internal/glm-5.3-fast"), empty.path());+ assert!(resolution.errors.is_empty(), "{:#?}", resolution.errors);+ let expected = MODEL_PROMPT_FILES+ .iter()+ .find(|(name, _)| *name == "bash-over-subprocess.md")+ .map(|(_, content)| (*content).trim())+ .expect("the shipped file table names bash-over-subprocess.md");+ assert_eq!(resolution.extras.as_deref(), Some(expected));++ let other = load_model_prompts(Some("anthropic/claude-sonnet-4"), empty.path());+ assert_eq!(other, ModelPromptResolution::default());+ }+#[test]fn file_entries_outside_the_agent_dir_are_rejected() {let root = tempfile::tempdir().unwrap();