composeSystemPrompt
composeSystemPrompt(
houseRules,autopilotActive?,opts?):string
Defined in: src/service.ts:750
Compose the spawn-time system prompt passed via a single --append-system-prompt
(the flag is last-wins, not repeatable, so all blocks must share one value).
House rules used to be prepended to the human prompt, which let standing guidance bleed
into the task on every spawn. They now live in the system prompt, each block XML-wrapped
so the agent can cleanly separate persistent guidance from the task in its human turn.
houseRules is the already-wrapped <shepherd-house-rules> block, or null when there are
none / learnings are disabled; the engineering-posture, research-first, and branch-rename blocks
always ride. The <single-pr-invariant> block (issue #839) rides every spawn EXCEPT a research
one (opts.research) — research already caps at one report-PR / issue, so it’s redundant there.
autopilotActive appends the autopilot directive (see above), UNLESS opts.planGate
is set: the plan gate and autopilot are mutually exclusive. During the planning phase the matching
plan-gate directive (interactive/auto) is appended INSTEAD of the autopilot directive, even when
autopilotActive is true — planning must suppress autopilot so the agent stops to plan/grill
rather than driving straight to a PR. opts.research, when set, takes precedence over BOTH and
appends the research directive INSTEAD — and it also suppresses the build-queue block (a research
session authors no queue), so research suppresses plan-gate, autopilot, AND build-queue.
opts.buildQueue, when set (and not research), appends the build-queue
directive — orthogonal to the plan-gate/autopilot choice, so it always rides. opts.previewHint,
when true, appends the preview-hint notice AFTER the build-queue block (or after the
plan-gate/autopilot block when no build-queue is present) — isolated-only, orthogonal to all
other options. opts.draftMode, when true, appends a <draft-mode> block instructing the agent
to open PRs as drafts — independent of the plan-gate/autopilot/build-queue choice (harmless during
planning; the agent only opens a PR later). opts.trimmed, when true, appends the context-trim
notice — set only for trimmed auto spawns (see trimDecision), orthogonal to everything else.
Parameters
Section titled “Parameters”houseRules
Section titled “houseRules”string | null
autopilotActive?
Section titled “autopilotActive?”boolean = false
buildQueue?
Section titled “buildQueue?”string | null
draftMode?
Section titled “draftMode?”boolean
planGate?
Section titled “planGate?”"auto" | "interactive"
previewHint?
Section titled “previewHint?”boolean
research?
Section titled “research?”boolean
trimmed?
Section titled “trimmed?”boolean
Returns
Section titled “Returns”string