Skip to content

feat(task): subagents inherit the goal; the loop waits for them - #144

Merged
filipeforattini merged 1 commit into
mainfrom
feat/goal-subagents
Sep 6, 2026
Merged

feat(task): subagents inherit the goal; the loop waits for them#144
filipeforattini merged 1 commit into
mainfrom
feat/goal-subagents

Conversation

@filipeforattini

@filipeforattini filipeforattini commented Sep 5, 2026

Copy link
Copy Markdown

Increment 2 of the /goal plan, stacked on #143.

  • Inherited goal: with an active goal on the parent, task opens the child's prompt with a synthetic <goal> block — objective and contract only. No budget, no goal_complete (the child cannot call it anyway): the child does one part, the parent's turn is what gets judged. Read fresh on every run, so a dropped or paused goal stays home.
  • WAIT: the judge already sees the session's running background jobs and decide parks the turn while one runs (landed in feat(session): /goal — a definition of done the harness pursues until it holds #142). This PR adds the round-trip proof: a background subagent under a goal → the parent's turn ends on WAIT with no turn spent → the child reports → its result re-enters the parent → the judge runs on that turn and closes the goal.
  • experimentalBackgroundSubagents is on in the prompt test layer (it defaults on in increment 3).

Tests: goal 17, task 36, prompt 99 + the new round trip. One pre-existing test in prompt.test.ts (leaves a turn alone while a tool is still running) sleeps 5 s and only passes under bun run test's --timeout 30000, which is what CI runs; untouched here.

https://claude.ai/code/session_014XwJPDhq1ahcm3rd454WzQ


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…for it instead of spinning

Children are blank by design, so the goal is copied, never shared: when the parent has an
active goal, the task tool opens the child's prompt with a synthetic <goal> block carrying the
objective and the contract. Not the turn budget, and not goal_complete — the child does one
part, and only the parent's turn is judged. It is read fresh on every run, resumed tasks
included, because the goal may have been dropped or changed since the child was created.

The WAIT half was already in the loop: the judge sees the running background jobs and decide()
parks the turn while one runs. What was missing was the proof — the new test launches a
background subagent under a goal, holds its answer, checks the parent's turn parks with no turn
spent and the child's first message carries the objective, then releases the child and watches
its report re-enter the parent and the judge close the goal.

Claude-Session: https://claude.ai/code/session_014XwJPDhq1ahcm3rd454WzQ
@filipeforattini
filipeforattini merged commit 6c71717 into main Sep 6, 2026
12 checks passed
@filipeforattini
filipeforattini deleted the feat/goal-subagents branch September 6, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant