diff --git a/docs/system-specs/modules/crew-mode.md b/docs/system-specs/modules/crew-mode.md index 0aefc8bb2e7d..e771f5e3855e 100644 --- a/docs/system-specs/modules/crew-mode.md +++ b/docs/system-specs/modules/crew-mode.md @@ -3946,9 +3946,9 @@ every assembled prompt, offline; the fixtures and their goldens are in A member-mode slot's transcript is the Bot's whole working record: the `[auto-nudge cycle N]` turns of its patrol loop, `[Cron notification …]` and `[Subagent completion event]` envelopes, every tool call, and the say-nothing -reply a quiet Heartbeat or `[Worker report]` turn ends on. A work-ledger patrol -wake with nothing for the user ends on one visible line of what the Bot did -(`patrol_reply`), which the chat pane shows. The Members page's chat pane shows **only what +reply a quiet Heartbeat, `[Worker report]` or work-ledger patrol turn ends on: a +patrol wake with no news for the user says nothing, and a finished task is +reported in full (the Bot's own patrol rule in `conductor.patrol`). The Members page's chat pane shows **only what the Bot says to the user** and the user's own messages. Everything else stays in the slot's history and is filtered at render time by `filterCrewmateChat` (`website/src/components/chat/crewmateBubbles.ts`), which `ChatPane` applies when its host passes `crewmate`. Ordinary chats never pass it and are drawn @@ -4746,11 +4746,16 @@ compaction, and the long-task and team rules every turn needs: the item budget, one owner per file and one integrator per output, merging two lines, reusing a finished worker only for the next step of its own line, the plan reviewer, the `pr_merged` bar, -the hourly check on a quiet wake, routine incidents, reporting before a park, and -the one-line reply on a patrol wake that has nothing the person must see) are written once, +the hourly check on a quiet wake, routine incidents, and reporting before a park) are written once, in `agent_parts/spec_prompts.py` `_LEDGER_CONDUCTOR_RULES`: the root charter is assembled from them (`_CONDUCTOR_PROMPT_SECTIONS`) and `conductor.patrol` names each as a placeholder (`context_assembly.member.ledger_rules_block`). +How each conductor replies to a patrol wake is NOT shared: conductor mode, +watched live, gets one line (`_CONDUCTOR_PATROL_REPLY`, also in the team lead's +`_SHARED_CONDUCTOR_RULES_BLOCK`), while a Bot, read once or twice a day, says +nothing unless there is news (its own rule in `conductor.patrol`). The shared +`wake_check` and goal-conductor step 6 point at "your patrol-reply rule", so each +side reads its own. `test/test_mate_conductor_parity.py` roots at `crew_mode.crew_mode_agent()`, the agent conductor mode runs, checks that every shared rule is in both installed prompts, and compares the effective agents, not the spec diff --git a/src/kiro_crew/agent.py b/src/kiro_crew/agent.py index e09c1d646075..0ea547e3eb0a 100644 --- a/src/kiro_crew/agent.py +++ b/src/kiro_crew/agent.py @@ -180,6 +180,7 @@ session_agent_spec_path, ) from kiro_crew.agent_parts.spec_prompts import ( + _CONDUCTOR_PATROL_REPLY, _CONDUCTOR_PROMPT_SECTIONS, _CONDUCTOR_SYSTEM_PROMPT, _CONDUCTOR_WORK_LEDGER_PROTOCOL, diff --git a/src/kiro_crew/agent_parts/spec_prompts.py b/src/kiro_crew/agent_parts/spec_prompts.py index 83cd0d6d6e39..400d9c0d26f2 100644 --- a/src/kiro_crew/agent_parts/spec_prompts.py +++ b/src/kiro_crew/agent_parts/spec_prompts.py @@ -313,7 +313,7 @@ re-read the board: for each open item, compare its elapsed time with its `budget: m` and look for the files its brief named. Re-plan now, and say why, any item that is stalled, past budget with nothing to show, or on a wrong brief. -With nothing wrong, the one line a patrol wake gets says so. +With nothing wrong, reply as your patrol-reply rule says. """, "routine_incidents": """**Handle routine incidents from the goal, then report them.** A worker out of @@ -330,7 +330,17 @@ nobody where the goal stands. """, - "patrol_reply": """**A patrol wake gets one line.** On a turn your work-ledger patrol opened + "skill_first": """The `goal-conductor` skill carries the operating procedure — the work-item +tests, the dispatch steps, the patrol cycle, the stop conditions. Read it before +acting on a goal. When a turn carries a REINJECTED AFTER COMPACTION block, the +skill text you read is gone: read it again before you act. """, +} + +#: Conductor mode's reply to a patrol wake. Not a shared rule: a person watches a +#: conductor-mode chat live, while a Bot's thread is read once or twice a day, so +#: a Bot's ``conductor.patrol`` carries its own rule (a wake with no news says +#: nothing). The team lead runs conductor mode, so it carries this one. +_CONDUCTOR_PATROL_REPLY = """**A patrol wake gets one line.** On a turn your work-ledger patrol opened (a `[work-ledger wake]` or an `[auto-nudge cycle N]`, its forced hourly wake included) that has nothing the person must see, reply with ONE short line saying what you did, never `nothing_to_do`: "Extended the docs task's budget to 300m." @@ -341,12 +351,7 @@ is reported in full. A Heartbeat or `[Worker report]` turn keeps its own quiet end. -""", - "skill_first": """The `goal-conductor` skill carries the operating procedure — the work-item -tests, the dispatch steps, the patrol cycle, the stop conditions. Read it before -acting on a goal. When a turn carries a REINJECTED AFTER COMPACTION block, the -skill text you read is gone: read it again before you act. """, -} +""" #: ``_CONDUCTOR_SYSTEM_PROMPT`` in reading order, one ``(name, text)`` per section. @@ -546,7 +551,7 @@ ("wake_check", _LEDGER_CONDUCTOR_RULES["wake_check"]), ("routine_incidents", _LEDGER_CONDUCTOR_RULES["routine_incidents"]), ("report_before_park", _LEDGER_CONDUCTOR_RULES["report_before_park"]), - ("patrol_reply", _LEDGER_CONDUCTOR_RULES["patrol_reply"]), + ("patrol_reply", _CONDUCTOR_PATROL_REPLY), ( "tracker", """**Add a tracker when one patrol read no longer fits.** Your `compact` ledger @@ -728,6 +733,8 @@ "The dispatch steps are 1. `work_ledger_record` `action=create`, 2. " "`session_create` with `agent` set explicitly, 3. `bind`, 4. the seed.\n\n" + "\n\n".join(rule.strip() for rule in _LEDGER_CONDUCTOR_RULES.values()) + + "\n\n" + + _CONDUCTOR_PATROL_REPLY.strip() + "\n" ) diff --git a/src/kiro_crew/builtin_skills/goal-conductor/SKILL.md b/src/kiro_crew/builtin_skills/goal-conductor/SKILL.md index aec9d3db2829..7d43c10a9650 100644 --- a/src/kiro_crew/builtin_skills/goal-conductor/SKILL.md +++ b/src/kiro_crew/builtin_skills/goal-conductor/SKILL.md @@ -575,8 +575,8 @@ Each cycle: **When the lines show the item itself is wrong** (already done on main, mis-scoped, needing a split, a bar that cannot be met), re-plan that item now (Close the round). -6. **A patrol wake gets one line**, as your prompt's patrol-reply rule says, - and more only in the cases it names. Never stop bare after your tool +6. **Reply to a patrol wake as your prompt's patrol-reply rule says**, and + write more only in the cases it names. Never stop bare after your tool calls: that keeps the empty-response recovery. ### Close the round diff --git a/src/kiro_crew/crewmate_prompts.json b/src/kiro_crew/crewmate_prompts.json index 2e7cd54d19e1..08863d26a285 100644 --- a/src/kiro_crew/crewmate_prompts.json +++ b/src/kiro_crew/crewmate_prompts.json @@ -194,7 +194,7 @@ " People read this thread once or twice a day, so report in it", " rarely and in one message: an outcome and its evidence (\"re: \"), several finished things together, never a stream of small", - " updates (a work-ledger patrol wake gets its one line, as item 5 says).", + " updates.", "3. When stuck, climb this ladder in order, and genuinely try each rung:", " (a) try a genuinely DIFFERENT approach — another tool, entry point, or", " strategy, not the same command again;", @@ -209,9 +209,7 @@ " waiting costs. Keep it short. Before sending, reread the draft as a", " stranger with no context would, and rewrite until they could act on it.", "5. A quiet cycle is a successful cycle. Report real signals — results, walls,", - " threshold crossings — never \"nothing new\". When you run a work-ledger", - " patrol, its wakes are the one exception: each gets the one line your", - " patrol rule asks for.", + " threshold crossings — never \"nothing new\".", " Every word you write as text is shown to the user: before a tool", " call, between tool calls, and after them. Text is never a private", " scratchpad. So when you have nothing to say to the user, write", @@ -274,7 +272,16 @@ "{wake_check}", "{routine_incidents}", "{report_before_park}", - "{patrol_reply}", + "**On a patrol wake, speak only for news.** A turn your work-ledger patrol", + "opened (a `[work-ledger wake]` or an `[auto-nudge cycle N]`, its forced hourly", + "wake included) speaks only when there is news for the person: a task finished,", + "got stuck or was dropped, a pull request merged, the person must act or decide,", + "or you decided something on their behalf (a trust boundary, scope, product", + "shape). A finished task is always reported in full, in that same turn, before", + "you close its item or call `autonudge_stop`. Anything else is not news: a wait", + "you already reported, \"still running\", \"on track\", \"checked, nothing changed\".", + "Then write no text at all and end with `nothing_to_do`.", + "", "{close_item}", "", "" diff --git a/test/test_context_composition_contract.py b/test/test_context_composition_contract.py index 85bb0bc0b7eb..99bb34084b89 100644 --- a/test/test_context_composition_contract.py +++ b/test/test_context_composition_contract.py @@ -108,8 +108,8 @@ def _transcript(turns: int, *, size: int) -> list[dict]: "critical_rules_channel": "a55668069ebcf5a45055d59028c2b57f39e86546b2639fe88385f765e7ef6257", "critical_rules_subagent": "89db6c776715d0b6358e140b8b13afba64bfe287e6e862e57b978baa09844d1b", "docs_section": "971b6008afbd9ff048c498c06cffecc6dafc7a58b0df75ff9db0b15cf9e26c09", - "member_how_you_work": "55f0c5287f910b65f2709ab7cd736ceb84036d73e814b31d5a1b976edc12ce5f", - "member_how_you_work_unavailable": "64639dfa262f98a68a7aa60140384ef5476edf25ea62eb1b2b9364618a43c2a8", + "member_how_you_work": "1e03ce13c439da54cd97e4555ad9353cc19fb1208a8f2e0e64cdf856fe23ef3b", + "member_how_you_work_unavailable": "a16008defce445de4721140a9b305a7c97f03270e7c797f4c04ae4bd7ff7644d", "reply_answer_only": "f0bd694165ff81cdbe123048042070588b846bd43a224b31adc79d9f8768bfce", "reply_concise": "5d3e25d89e682469332237e46373f0e9aac8516eefd63047134d1ec0575aac2a", "response_preferences_frame": "08ee149ae459c828213d47643f1cdbd6661d8a77a2223b8be5d0aa6fbb6cdc18", diff --git a/test/test_mate_conductor_parity.py b/test/test_mate_conductor_parity.py index d39ef1d32ee3..787eff7e86bb 100644 --- a/test/test_mate_conductor_parity.py +++ b/test/test_mate_conductor_parity.py @@ -80,6 +80,7 @@ "prompt:sealed_crew_paths": "a crewmate's conductor runs on the default contract, config/prompt.md, which states the same sealed-path rule", "prompt:tool_inventory": "lists the root conductor's narrowed tool set; a crewmate has the default tools and its member pieces name the crewmate-only ones", "prompt:goal_changes": "round-boundary goal changes; a crewmate's goal is set through set_goal (member pieces)", + "prompt:patrol_reply": "a person watches a conductor-mode chat live, so a patrol wake there gets one line; a Bot's thread is read once or twice a day, so conductor.patrol carries its own rule: a wake with no news says nothing", "prompt:tracker": "a tracker is for a fleet one compact read cannot hold; a crewmate's ledger is one level on one machine and its [Worker report] turns carry each worker's state", } @@ -499,27 +500,32 @@ def test_the_long_task_and_team_rules_are_shared() -> None: assert set(_NEW_SHARED) <= crewmate_prompts.placeholders(_MATE_PIECE) -def test_a_patrol_wake_gets_one_line_on_both_conductors(specs) -> None: - """The one-line patrol reply is a shared rule both installed conductors carry, and - no quiet-end wording tells a patrol wake to stay silent, so neither side is told - two things.""" +def test_a_patrol_wake_gets_one_line_in_conductor_mode_and_none_on_a_bot(specs) -> None: + """Each conductor replies to a patrol wake its own way: conductor mode, watched + live, gets one line; a Bot, whose thread is read once or twice a day, says + nothing unless there is news. Neither carries the other's rule.""" root_spec, _mate = specs - rule = agent._LEDGER_CONDUCTOR_RULES["patrol_reply"].strip() - assert "patrol_reply" in crewmate_prompts.placeholders(_MATE_PIECE) - for side, text in ( - (_ROOT, root_spec["prompt"]), - ("kirocrew-mate-conductor", _mate_ledger_text()), - ): - assert rule in text, f"{side} lacks the patrol_reply rule" - assert "nothing_to_do" not in agent._LEDGER_CONDUCTOR_RULES["wake_check"] - assert "its wakes are the one exception" in _words( + root_rule = agent._CONDUCTOR_PATROL_REPLY.strip() + assert "patrol_reply" not in agent._LEDGER_CONDUCTOR_RULES + assert "patrol_reply" not in crewmate_prompts.placeholders(_MATE_PIECE) + assert root_rule in root_spec["prompt"] + assert root_rule in agent._SHARED_CONDUCTOR_RULES_BLOCK + mate_text = _mate_ledger_text() + assert root_rule not in mate_text + mate_words = _words(mate_text) + assert "on a patrol wake, speak only for news." in mate_words + assert "a finished task is always reported in full" in mate_words + assert "then write no text at all and end with nothing_to_do." in mate_words + assert "its wakes are the one exception" not in _words( crewmate_prompts.text("conductor.how_you_work") ) - assert 'never post "nothing changed"' not in _skill_text("goal-conductor") - # The one line is for a wake with no news only: milestones keep their full - # report (and the root's in-chat board), and the Bot's Heartbeat and - # [Worker report] turns keep their own quiet end. - words = _words(rule) + # Both rule sets point at "your patrol-reply rule", so one shared wake check + # and one skill step serve both. + assert "reply as your patrol-reply rule says" in _words( + agent._LEDGER_CONDUCTOR_RULES["wake_check"] + ) + assert "as your prompt's patrol-reply rule says" in _skill_text("goal-conductor") + words = _words(root_rule) assert "a task starting, finishing or getting stuck is reported in full" in words assert "a heartbeat or [worker report] turn keeps its own quiet end" in words talking = dict(agent._CONDUCTOR_PROMPT_SECTIONS)["talking_to_the_person"] @@ -659,7 +665,6 @@ def test_the_team_lead_check_sees_a_lost_rule( "bar_pr_merged": "as your prompt's rule on landed code says", "plan_reviewer": "as your prompt's plan-reviewer rule says", "wake_check": "a wake with no news is a check, as your prompt's rule says", - "patrol_reply": "as your prompt's patrol-reply rule says", "reuse_worker": "your prompt's worker-reuse rule", "read_message_detail": "as your prompt's read-message rule says", "patrol_final_report": "end the patrol as your prompt's patrol rules say",