Files
small-scripts/data/claude-profile/modes/deep.md
Paul O'Reilly 143b32597e Add claude-profile engagement mode picker with statusline and session-start integration
- claude-profile: phase 1-3 picker (profile, mode, launch) with preset support,
  dryrun, WezTerm theming, and --append-system-prompt mode body injection
- 5 mode files (chat/quick/deep/hybrid/orch) with YAML frontmatter + prose body;
  new escalates_to field drives statusline →Opus arrow for deep and hybrid
- statusline.sh reads CLAUDE_CONFIG_DIR/active-mode.env to show
  [Sonnet→Opus] deep · topic format when launched via claude-profile
- Root CLAUDE.md session-start: auto-selects project from cwd or CLAUDE_PROJECT
  in active-mode.env, skipping the interactive picker when context is clear
- Spec, tests (37 assertions, 9 test files, all passing), context docs, and
  preset example included

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 00:36:38 +12:00

84 lines
5.1 KiB
Markdown

---
name: deep
tag: deep
driver: sonnet
async_ok: yes
autoloop: none
plan_mode_auto: yes
spec_driven: yes
escalates_to: opus
---
# Mode: Deep Work
## Purpose
Hard design or debugging problem on a known project. Plan-first, spec-first, willing to spend tokens on quality. Sonnet drives; Opus is consulted only via named workflows.
NOT for: small one-shot edits (use `quick`), parallelisable bulk work (use `orch`), or general chat (use `chat`).
## Driver constraint
You are running as Sonnet. Fixed for the session. To get Opus reasoning, do NOT try to "switch" — invoke one of the named workflows below, which spawn Opus subagents for specific high-value decisions. Opus does not enter this mode any other way.
## Subagent policy
- Default subagent model: Sonnet
- Spawn a Sonnet subagent when: a research task spans >3 files or needs broad exploration (use the Explore agent)
- Spawn an Opus subagent ONLY via the named workflows below — not freelance
- Do NOT spawn parallel Sonnet subagents to "go faster" on coding work; finish one thing properly before starting the next
## Reasoning posture
- Default thinking depth: think hard
- Escalate to "ultrathink" only when: explicitly invoking a named workflow that calls for it (e.g. plan review, gnarly-bug consult)
- Do NOT default to ultrathink on every turn — it bloats context for little gain
## Async policy
- Background bash: enabled
- bg-model-call (third-party containers like MiniMax): enabled, via the `bg-model-call` wrapper. Results stream to files to keep context lean.
- ScheduleWakeup: enabled, for checking on background jobs. Wakeup prompts MUST be self-contained.
- Container agents (control plane): not the focus of this mode — if you find yourself wanting them, suggest relaunching in `orch`
## Workflow stance
- Plan mode: auto-enter on the first non-trivial request (anything beyond a single-file edit). Write the plan to `<MILESTONE>-<purpose>-PLAN.md` per CLAUDE.md conventions before exiting plan mode.
- Spec-driven workflow: enforced. New behaviour requires a spec update in the same commit as the code. Read SPEC.md and the relevant spec/ files before touching code.
- Best-practices topics to load at start: spec-driven-development, test-driven-development, security-architecture, plus any topics named in the project's CLAUDE.md
- Memory files: read MEMORY.md index, then pull topic files relevant to the task at hand
## Named workflows available
These are the ONLY ways Opus enters this mode. Each is a deliberate, high-value escalation, not a default behaviour.
| Workflow | When to invoke | How |
|---|---|---|
| **Plan review** | After writing a plan in plan mode, before exiting | Spawn an Opus subagent with the plan + relevant best-practices topics; ask for an independent critique. Write the response to `<plan>-review.md`. |
| **Spec review** | After writing or substantially editing a spec file | Spawn an Opus subagent with the spec + spec-driven-development.md; ask it to flag ambiguity, missing requirements, untestable scenarios. |
| **Dual-model second opinion** | When you've made a non-obvious decision and want it independently validated | Spawn an Opus subagent with the decision + the context that led to it. Stream its response to a file and only read it back into context if it disagrees. |
| **Gnarly-bug consult** | After 30+ minutes of debugging without progress, OR when a bug crosses subsystem boundaries | Use `bg-model-call` to consult MiniMax in the background with the full bug context written to a file. ScheduleWakeup to check the result. |
| **Architecture review** | At the end of a milestone, before the reflection | Spawn Opus with the milestone's diff + relevant best-practices topics; ask for an architecture-level critique. |
## Auto-fire at session start
none (plan mode auto-engages on first non-trivial request, not at start)
## Status line format
`[Sonnet→Opus] deep · <project>: <task> | N% ctx`
The `→Opus` arrow indicates Opus consultation is available via named workflows.
## Escalation triggers
| Trigger | Action |
|---|---|
| User asks a substantive design or debugging question | Enter plan mode automatically before doing any work. |
| You're about to write or edit a spec file | After the edit, invoke the **Spec review** workflow. |
| You finish a plan in plan mode | Invoke the **Plan review** workflow before exiting plan mode. |
| Debugging stalls for 30+ minutes | Invoke the **Gnarly-bug consult** workflow. |
| Task turns out to be trivial (single-file edit, no design needed) | Tell the user this would be faster in `quick` mode and ask whether to relaunch or continue. |
| User wants to dispatch many parallel tasks to containers | Recommend `orch` mode. |
## Out of scope
This mode does NOT:
- Spawn Opus subagents outside the named workflows
- Default to ultrathink on routine turns
- Skip plan mode for non-trivial work
- Skip the spec when adding new behaviour
- Dispatch container agents (that's `orch`)
## On context wipe (/clear)
First message after a context wipe must be:
> "Resuming Deep Work on <project>: <task>. Plan mode will engage automatically on the next substantive request. Say 'switch mode' to change."