Skip to content

The agent that grows with you

feat(kanban): add split-brain decision-ownership contract to orchestrator guidance

Teknium11b0271243ac
diff --git a/agent/prompt_builder.py b/agent/prompt_builder.py
index 16f2db287f3..666c620f721 100644
--- a/agent/prompt_builder.py
+++ b/agent/prompt_builder.py
@@ -268,6 +268,13 @@ KANBAN_GUIDANCE = (
"of the decomposition. Do NOT execute the work yourself; your job is "
"routing, not implementation.\n"
"\n"
+ "**Decision ownership.** Design decisions belong to you, the orchestrator, "
+ "not to workers — settle naming schemes, schemas, file formats, and API "
+ "shapes before fanning out. Never let two subtree cards decide the same "
+ "question: if two tasks would each pick one, decide it yourself and write "
+ "the decision into BOTH card bodies. Every child card body must carry the "
+ "decisions it depends on, because workers cannot see sibling context.\n"
+ "\n"
"## Reference details that change outcomes\n"
"\n"
"- **Workspace.** `cd $HERMES_KANBAN_WORKSPACE` first. For a `worktree` kind "
diff --git a/tests/tools/test_kanban_tools.py b/tests/tools/test_kanban_tools.py
index 476d14dd325..5031098fd82 100644
--- a/tests/tools/test_kanban_tools.py
+++ b/tests/tools/test_kanban_tools.py
@@ -551,6 +551,34 @@ def test_worker_lifecycle_through_tools(worker_env):
# ---------------------------------------------------------------------------
+def test_kanban_guidance_prompt_size_bounded():
+ """KANBAN_GUIDANCE is injected into every kanban-capable process's system
+ prompt and resolved once at agent init, so its size is a per-worker token
+ tax paid on every spawn. Bound it as an invariant, not a change-detector:
+ the ceiling (8000 chars, roughly 2000 tokens) leaves headroom above the
+ current ~6.2k chars for tight additions, while catching accidental bloat
+ (pasted docs, duplicated sections) before it ships to every worker.
+ """
+ from agent.prompt_builder import KANBAN_GUIDANCE
+
+ assert len(KANBAN_GUIDANCE) < 8000, (
+ f"KANBAN_GUIDANCE is {len(KANBAN_GUIDANCE)} chars; it is injected into "
+ "every kanban worker's system prompt — trim it or consciously re-bound "
+ "this invariant with justification."
+ )
+
+
+def test_kanban_guidance_orchestrator_decision_ownership():
+ """The orchestrator section must carry the split-brain prevention
+ contract: decisions are made by the orchestrator before fan-out and
+ stamped into every dependent card body."""
+ from agent.prompt_builder import KANBAN_GUIDANCE
+
+ assert KANBAN_GUIDANCE.count("Decision ownership.") == 1
+ assert "Never let two subtree cards decide the same question" in KANBAN_GUIDANCE
+ assert "workers cannot see sibling context" in KANBAN_GUIDANCE
+
+
# ---------------------------------------------------------------------------
# Worker task-ownership enforcement (regression tests for #19534)
# ---------------------------------------------------------------------------
diff --git a/website/docs/user-guide/features/kanban.md b/website/docs/user-guide/features/kanban.md
index f308248daf7..1cc7194b43e 100644
--- a/website/docs/user-guide/features/kanban.md
+++ b/website/docs/user-guide/features/kanban.md
@@ -553,6 +553,8 @@ kanban_complete(
The orchestrator guidance ships in the worker's system prompt automatically — there is nothing to install or sync per profile.
+**Decide before you fan out.** Design decisions belong to the orchestrator, not to the workers. If two parallel cards would each have to pick the same thing — a naming scheme, a schema, a file format, an API shape — the orchestrator decides it once and stamps the decision into **both** card bodies. Workers cannot see sibling cards, so every child card body must carry every decision it depends on. Example: for the parallel cards "build the exporter" and "build the importer", don't let each worker invent its own file format — pick one up front (say, newline-delimited JSON with a `version` field) and write it into both bodies, or the two halves will never round-trip.
+
For best results, pair it with a profile whose toolsets are restricted to board operations (`kanban`, `gateway`, `memory`) so the orchestrator literally cannot execute implementation tasks even if it tries.
## Dashboard (GUI)
diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/kanban.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/kanban.md
index 8a1a9524555..e7f417ec5c2 100644
--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/kanban.md
+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/kanban.md
@@ -377,6 +377,8 @@ kanban_complete(
编排器指引随 worker 的系统 prompt 自动提供 —— 无需按配置文件安装或同步任何东西。
+**先决策,再扇出。** 设计决策属于编排器,而不是 worker。如果两张并行卡片都需要选择同一件事 —— 命名方案、schema、文件格式、API 形态 —— 编排器应当一次性做出决定,并把该决定写入**两张**卡片的正文。Worker 看不到兄弟卡片,因此每张子卡片的正文必须携带它所依赖的全部决策。示例:对于并行卡片"构建导出器"和"构建导入器",不要让每个 worker 各自发明文件格式 —— 应预先选定一种(比如带 `version` 字段的换行分隔 JSON)并写入两张卡片的正文,否则两半工作永远无法互通。
+
为获得最佳效果,将其与工具集限制为看板操作(`kanban`、`gateway`、`memory`)的配置文件配对,这样编排器即使尝试也无法执行实现任务。
## 仪表盘(GUI)