feat(ultraplan-local)!: v2.4.0 — commands default to foreground

Remove background-transition phases from /ultraresearch-local,
/ultraplan-local, /ultra-cc-architect-local, /ultrabrief-local.
All four commands now run their full pipelines inline in main
context; --fg is retained as a no-op alias for backwards
compatibility.

The Claude Code harness does not expose the Agent tool to
sub-agents, so orchestrators launched with run_in_background:true
cannot spawn their documented swarms (docs-researcher,
community-researcher, architecture-mapper, plan-critic, etc.) and
silently degrade to single-context reasoning. Foreground execution
keeps the swarms intact.

Source: github.com/anthropics/claude-code/issues/19077
Confirmed empirically 2026-04-19.

BREAKING CHANGE: Default execution is foreground — the session
blocks until the brief/plan is ready. Use `claude -p` in a
separate terminal for long-running headless work.
This commit is contained in:
Kjell Tore Guttormsen 2026-04-19 21:23:02 +02:00
commit 4bba65cddf
4 changed files with 105 additions and 173 deletions

View file

@ -479,7 +479,7 @@ Ask the user via `AskUserQuestion`:
| Option | Description |
|--------|-------------|
| **Manual (default)** | Print the commands. You run `/ultraresearch-local` and `/ultraplan-local` yourself, choosing depth per topic. |
| **Auto (managed by Claude Code)** | I run all {N} research topics in parallel, then automatically trigger `/ultraplan-local` when research completes. Foreground — this session blocks until the plan is ready. |
| **Auto (managed by Claude Code)** | I run all {N} research topics sequentially in foreground, then automatically trigger `/ultraplan-local` when research completes. This session blocks until the plan is ready. |
### Manual path (default)
@ -516,62 +516,50 @@ Proceed to Phase 6.
**Runs only when user opted into auto mode.**
### Step 6a — Billing safety check
### Step 6a — Confirm proceed
Run via Bash:
```bash
echo "${ANTHROPIC_API_KEY:+SET}"
```
Tell the user auto mode will run in foreground and block the session, then
confirm via `AskUserQuestion`:
If `SET`, warn via `AskUserQuestion`:
**Question:** "`ANTHROPIC_API_KEY` is set. Running {N} parallel research
jobs in background will bill your API account (not your Claude
subscription). Continue?"
**Question:** "Auto mode runs {N} research topic(s) sequentially and then
the plan — all in foreground. This session blocks until the plan is ready.
Continue?"
| Option | Action |
|--------|--------|
| **Continue — API billing** | Proceed. |
| **Switch to sequential** | Run topics one at a time in foreground instead of parallel background. Stays on subscription for this session. |
| **Continue — auto** | Proceed. |
| **Cancel — do manual** | Revert to manual path (print commands, stop). |
If cancelled → fall back to manual path output and stop.
If sequential → note and proceed (Step 6b runs foreground, one at a time).
If continue → proceed with parallel background.
### Step 6b — Launch research jobs
### Step 6b — Run research topics sequentially (inline)
Set `research_status: in_progress` in the brief's frontmatter.
For each research topic (index i = 1 .. N):
Launch the **research-orchestrator** agent with this prompt:
For each research topic (index i = 1 .. N), invoke `/ultraresearch-local`
inline in this main-context session:
```
Research question: {topic i question}
Dimensions: {infer 3-5 dimensions from topic confidence + cost hints}
Mode: {default if cost=standard or deep; quick if cost=quick}
Scope: {topic i scope hint: local | external | both}
Brief destination: {PROJECT_DIR}/research/{NN}-{topic-slug}.md
Plugin root: ${CLAUDE_PLUGIN_ROOT}
/ultraresearch-local --project {PROJECT_DIR} {--external | --local | (none)} "{topic i question}"
```
Where `{NN}` is zero-padded index (`01`, `02`, ...) and `{topic-slug}` is
the topic title slugified.
Pass the scope flag that matches the topic's scope hint. Wait for each
invocation to finish writing the research brief at
`{PROJECT_DIR}/research/{NN}-{topic-slug}.md` before moving to the next
topic.
**Parallel (default auto path):** launch all N research-orchestrator agents
in parallel via a single message with multiple Agent tool calls, all
`run_in_background: true`. **Do not wait** in the same message — return
control. You will be notified when each completes.
> **Why sequential inline instead of parallel background?** Background
> orchestrator-agents cannot spawn the research swarm — the Claude Code
> harness does not expose the Agent tool to sub-agents, so a background
> run silently degrades to single-context reasoning without WebSearch /
> Tavily / WebFetch / Gemini (see v2.4.0 release notes). Running each
> research pass inline in main context keeps the swarm intact. For true
> parallel execution, use `claude -p` invocations in separate terminal
> windows.
**Sequential (if user chose sequential):** launch one research-orchestrator
at a time, foreground (no `run_in_background`), wait for completion, then
launch the next.
### Step 6c — Verify all briefs landed
### Step 6c — Wait for all research to complete
Wait for all research agent notifications. When all {N} have completed,
verify each research brief file exists:
After the last topic completes, verify each research brief file exists:
```bash
ls -1 {PROJECT_DIR}/research/*.md | wc -l
@ -582,24 +570,17 @@ proceed (retry, skip missing topic, cancel).
Update brief frontmatter: `research_status: complete`.
### Step 6d — Auto-trigger planning
### Step 6d — Auto-trigger planning (inline foreground)
Launch the **planning-orchestrator** agent with this prompt:
Invoke the planning command inline in this session:
```
Brief file: {PROJECT_DIR}/brief.md
Project dir: {PROJECT_DIR}
Task: {task description from brief}
Mode: default
Plan destination: {PROJECT_DIR}/plan.md
Plugin root: ${CLAUDE_PLUGIN_ROOT}
Research briefs: {list of {PROJECT_DIR}/research/*.md files}
Read the brief file and every research brief. Execute your full planning
workflow. Write the plan to the destination path.
/ultraplan-local --project {PROJECT_DIR}
```
Launch foreground (wait for completion — user asked for full auto).
The planning pipeline runs all phases (exploration, synthesis, review) in
main context. Wait for the plan to be written to `{PROJECT_DIR}/plan.md`
before continuing.
### Step 6e — Report completion
@ -618,7 +599,7 @@ When the planning-orchestrator finishes, present:
| Step | Status |
|------|--------|
| Brief | Complete ({interview_turns} interview turns) |
| Research | Complete ({N} topics, {P} parallel / {S} sequential) |
| Research | Complete ({N} topics, sequential foreground) |
| Plan | Complete ({steps} steps, critic: {verdict}) |
Next: