Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions agent/prompt_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ def build_memory_guidance(
"comment thread, and a pre-formatted `worker_context` you can treat as ground truth.\n"
"2. **Work inside the workspace.** `cd $HERMES_KANBAN_WORKSPACE` before any file operations. The workspace is "
"yours for this run. Don't modify files outside it unless the task explicitly asks.\n"
"**Terminal envelopes.** For foreground `terminal` calls, omit `notify` and `heartbeat` entirely; "
"they apply only to `background=true`. If a terminal call is rejected, correct its arguments once; "
"never repeat an unchanged rejected call. Do not retry a security denial through another tool or worker.\n"
"3. **Heartbeat on long operations.** Call `kanban_heartbeat(note=...)` every few minutes during long subprocesses "
"(training, encoding, crawling). Skip heartbeats for short tasks. **If your task may run longer than 1 hour, you "
"MUST call `kanban_heartbeat` at least once an hour** — the dispatcher reclaims tasks running past "
Expand Down
10 changes: 10 additions & 0 deletions tests/agent/test_prompt_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ def _drain_truncation_warnings():
# =========================================================================


def test_kanban_worker_terminal_envelope_guidance():
import json

from agent.prompt_builder import KANBAN_GUIDANCE
from tools.terminal_tool import _handle_terminal

assert "foreground `terminal` calls, omit `notify` and `heartbeat`" in KANBAN_GUIDANCE
assert "never repeat an unchanged rejected call" in KANBAN_GUIDANCE
rejected = json.loads(_handle_terminal({"command": "true", "background": False, "heartbeat": 60}))
assert "background commands" in rejected["error"]


# =========================================================================
Expand Down