@@ -151,9 +151,11 @@ def load_context_files(context_dir: "Path | str | None") -> str | None:
151151def load_task_completion_rules () -> str | None :
152152 """Load ``prompts/task-completion-rules.txt``, or None if unavailable.
153153
154- These rules are injected automatically into every agent system
155- prompt (main agent, sub-agents, and session commands), so the model
156- never stops before the task is fully completed and verified.
154+ These rules are injected automatically into the main agent and
155+ session-command system prompts, so the model never stops before the
156+ task is fully completed and verified. Sub-agents are intentionally
157+ excluded: they get ONLY their own prompt (subagent.txt) with no
158+ extra context injected.
157159 """
158160 p = Path (__file__ ).parent / "prompts" / "task-completion-rules.txt"
159161 try :
@@ -177,8 +179,11 @@ def assemble_agent_prompt(
177179 context piece, immediately before the agent prompt, so they read as
178180 global ground rules rather than part of the task instructions.
179181
180- ``include_context=False`` drops the project context files (used for
181- sub-agents, which get the rules but not the parent's context).
182+ ``include_context=False`` drops the project context files (rules are
183+ still included). This function is NOT used for sub-agents: their
184+ system prompt is their own prompt file (subagent.txt) only, with no
185+ context files and no task-completion rules (see
186+ ``cli.make_session`` and ``subagent._subagent_system_prompt``).
182187 ``context_path`` overrides the default context directory discovery.
183188 Returns None if every part is empty/missing.
184189 """
0 commit comments