A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
prompt: drop the stale 'await commands before ending the turn' rule (#3511)
Seth Karten1d9daf73b994
diff --git a/.changes/async-turn-contract.md b/.changes/async-turn-contract.mdnew file mode 100644index 0000000000..eef89feafd--- /dev/null+++ b/.changes/async-turn-contract.md@@ -0,0 +1 @@+- The static usage layer no longer tells agents to await commands before ending the turn: since #3580 daemonless sessions also wake on a queued `[bash-done]` turn, every session kind has completion notifications, and the no-polling rule (end the turn and collect the result on the done notification) is the one turn-end contract.diff --git a/crates/pa-core/src/prompts/layers/usage.md b/crates/pa-core/src/prompts/layers/usage.mdindex 1bfdf70fe4..deb1762f7a 100644--- a/crates/pa-core/src/prompts/layers/usage.md+++ b/crates/pa-core/src/prompts/layers/usage.md@@ -5,7 +5,6 @@ The following are mandatory rules, only to be overridden by clear user intent.- Goals must only be created at a user's request.- Agents run shell commands with `bash()`, not `subprocess`/`os.system`: subprocess calls block the kernel, show the user nothing while they run, and spawn processes the harness cannot see or stop.- `bash("""...""")` should be used over `bash("...")` because it makes using quotation marks inside bash easy.-- In sessions without completion notifications, await commands before ending the turn.- Shell state does not persist between calls, but agents can use `os.chdir(...)` for the working directory and `os.environ[...]` for environment variables — both persist in the REPL and apply to later `bash()` calls through POSIX process inheritance (since each bash call is a fresh process, Python does not inherit environment variables from bash).- Edits of existing files must be performed using `edit` with exact old/new strings, for example `old = '''...'''; new = '''...'''; await edit(path="pkg/file.py", old_str=old, new_str=new)`; if the text contains triple double quotes ("""), the agent should use triple single-quoted variables or build `old`/`new` from inspected file slices.- Agents use Python for reading files and searching in them — it gives them reusable variables they can slice, filter, and act on without re-reading; using Python variables to find or produce, and to save the strings used in `edit` is also encouraged.diff --git a/crates/pa-core/tests/prompt_guards.rs b/crates/pa-core/tests/prompt_guards.rsindex c19d8d972a..810af9b759 100644--- a/crates/pa-core/tests/prompt_guards.rs+++ b/crates/pa-core/tests/prompt_guards.rs@@ -614,3 +614,22 @@ fn generic_mcp_skill_renders_in_the_prompt_inventory() {.assembled.contains("await mcp.list_tools(\"notion\")"));}++// Async turn discipline++/// Since #3580 every session kind wakes on bash completion: daemonless runs+/// get a queued `[bash-done]` turn, so the static usage layer must not carry+/// the pre-#3580 rule to await commands before ending the turn — the+/// no-polling rule right below it already ends turns on the done+/// notification, and an unscoped await rule would contradict that wake.+#[test]+fn usage_layer_ends_turns_on_the_done_notification_not_an_await_rule() {+ assert!(+ !USAGE_LAYER.contains("await commands before ending the turn"),+ "every session kind has completion notifications: the await-before-turn-end rule is stale"+ );+ assert!(+ USAGE_LAYER.contains("end the turn and collect the result on the done notification"),+ "the no-polling rule keeps the collect-on-notice turn-end contract"+ );+}