diff --git a/context/claude-profile-modes.md b/context/claude-profile-modes.md index 98e0f38..c667a9c 100644 --- a/context/claude-profile-modes.md +++ b/context/claude-profile-modes.md @@ -2,16 +2,16 @@ ## Status -**Provider selection removed. Model config embedded in profiles via `provider.env`. 41 dryrun assertions passing.** +**Provider selection removed. Model config embedded in profiles via `provider.env`. 47 dryrun assertions passing.** ## What's done | Component | State | |---|---| | Profile + mode picker (phases 1-2) | Done, 41 dryrun assertions passing | -| 5 mode files with `escalates_to` frontmatter | Done | +| 6 mode files with `escalates_to` frontmatter | Done (chat, quick, deep, deep-fable, hybrid, orch) | | `provider.env` for non-Anthropic profiles | Done (`~/.claude-oreillyit-minimax/provider.env`) | -| Driver→model_id hardcoded for Anthropic | Done (haiku/sonnet/opus/opus-1m) | +| Driver→model_id hardcoded for Anthropic | Done (haiku/sonnet/opus/opus-1m/fable); opus bumped to 4.8, fable added (claude-fable-5) | | `active-mode.env` written on every launch | Done (no longer includes `CLAUDE_PROVIDER` or `CLAUDE_TIME_HORIZON`) | | statusline.sh — `[Sonnet→Opus] deep · topic` format | Done (reads `CLAUDE_CONFIG_DIR/active-mode.env`) | | Root CLAUDE.md — auto-select project from cwd or `CLAUDE_PROJECT` | Done | @@ -43,8 +43,9 @@ Previously, provider selection was a separate interactive phase (profile → mod ## Remaining follow-ups (from FUTURE.md) -1. **`bg-model-call` wrapper** — `deep` and `hybrid` modes reference it but it doesn't exist yet. Own spec + script entry. +1. **`bg-model-call` wrapper** — `deep` and `hybrid` modes previously referenced it; now replaced by the `/ask-minimax` skill with Opus-subagent fallback. A `bg-model-call` draft remains as an untracked script in small-scripts but is out of scope for the mode files. 2. **`switch mode` skill** — mid-session re-pick writes new `active-mode.env` for the next `/clear`. Lower priority. +3. **`deep-fable` mode** — new mode using `claude-fable-5` driver; same plan-first/spec-first discipline as `deep`. ## Key gotchas diff --git a/data/claude-profile/modes/deep-fable.md b/data/claude-profile/modes/deep-fable.md new file mode 100644 index 0000000..e677a93 --- /dev/null +++ b/data/claude-profile/modes/deep-fable.md @@ -0,0 +1,84 @@ +--- +name: deep-fable +tag: deep-fable +driver: fable +async_ok: yes +autoloop: none +plan_mode_auto: yes +spec_driven: yes +escalates_to: opus +--- + +# Mode: Deep Work (Fable) + +## Purpose +The hardest design or debugging problems — top-model driver, token cost accepted. Same plan-first, spec-first discipline as deep. Fable 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 Fable 5. 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: Fable +- Spawn a Fable 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 Fable 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 +- Third-party delegation: the /ask-minimax skill (file-heavy grunt work, second opinions); on MiniMax failure, fall back to an Opus subagent. +- 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 `--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 +- Before any git push: confirm the repo's SSH key is loaded (`ssh-add -l`) — see claude/source-control.md § SSH agent pre-flight. + +## 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 `-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 | Run the `/ask-minimax` skill with the full bug context (pass file paths, not contents); if MiniMax errors (`invalid system role` or otherwise), fall back to an Opus subagent with the same brief — see `claude/ask-minimax-usage.md` § Failure handling. | +| **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 +`[Fable→Opus] deep-fable · : | 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 (Fable) on : . Plan mode will engage automatically on the next substantive request. Say 'switch mode' to change." diff --git a/data/claude-profile/modes/deep.md b/data/claude-profile/modes/deep.md index a92ef1e..67dab75 100644 --- a/data/claude-profile/modes/deep.md +++ b/data/claude-profile/modes/deep.md @@ -31,7 +31,7 @@ You are running as Sonnet. Fixed for the session. To get Opus reasoning, do NOT ## 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. +- Third-party delegation: the /ask-minimax skill (file-heavy grunt work, second opinions); on MiniMax failure, fall back to an Opus subagent. - 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` @@ -40,6 +40,7 @@ You are running as Sonnet. Fixed for the session. To get Opus reasoning, do NOT - 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 +- Before any git push: confirm the repo's SSH key is loaded (`ssh-add -l`) — see claude/source-control.md § SSH agent pre-flight. ## Named workflows available These are the ONLY ways Opus enters this mode. Each is a deliberate, high-value escalation, not a default behaviour. @@ -49,7 +50,7 @@ These are the ONLY ways Opus enters this mode. Each is a deliberate, high-value | **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 `-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. | +| **Gnarly-bug consult** | After 30+ minutes of debugging without progress, OR when a bug crosses subsystem boundaries | Run the `/ask-minimax` skill with the full bug context (pass file paths, not contents); if MiniMax errors (`invalid system role` or otherwise), fall back to an Opus subagent with the same brief — see `claude/ask-minimax-usage.md` § Failure handling. | | **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 diff --git a/data/claude-profile/modes/hybrid.md b/data/claude-profile/modes/hybrid.md index ef790d4..3d8c56a 100644 --- a/data/claude-profile/modes/hybrid.md +++ b/data/claude-profile/modes/hybrid.md @@ -48,7 +48,7 @@ You are running as Haiku. Fixed for the session. You are smart enough to drive t ## Async policy - Background bash: enabled -- bg-model-call (third-party containers): enabled — useful for second opinions from MiniMax when an Opus subagent's answer feels uncertain +- Third-party delegation: the /ask-minimax skill (file-heavy grunt work, second opinions from MiniMax when an Opus subagent's answer feels uncertain); on MiniMax failure (`invalid system role` or otherwise), fall back to an Opus subagent with the same brief — see `claude/ask-minimax-usage.md` § Failure handling. - ScheduleWakeup: enabled — use it after firing background jobs so you remember to check them. The wakeup prompt MUST be self-contained (file paths, what to do on hit, what to do on miss) because you won't remember why you scheduled it. - Container agents (control plane): not the focus — recommend `orch` if needed diff --git a/data/claude-profile/modes/orch.md b/data/claude-profile/modes/orch.md index 7eefbec..cf4a5e3 100644 --- a/data/claude-profile/modes/orch.md +++ b/data/claude-profile/modes/orch.md @@ -48,8 +48,18 @@ You are running as Sonnet. Fixed for the session. Your job is orchestration, not | **Monitor** | Always running in a background bash from session start | `agent-monitor --filter "project=" --filter "age<1h"` — gives a live view of task states | | **Triage failed runs** | When the monitor shows a task in failed state | Read the agent's branch/logs, decide: retry / fix the task definition / cancel and reassign | +## Pre-flight gate (before the autoloop) +Run the following checklist before firing `/loop 2m /orchestrate`. **Do not start the loop until every check passes — report failures to the user instead.** + +1. CP health endpoint responds (e.g. `curl -s /health` returns 200). +2. A dispatcher is actually polling (check via `agent-monitor` or the CP status endpoint). +3. `.agent-tasks.json` exists in the repo root and passes `jq empty` (valid JSON). +4. Auth has been completed this session (token is live, not expired). + +See `~/dev/claude/claude/agent-dispatch-preflight.md` for the full checklist. + ## Auto-fire at session start -1. `/loop 2m /orchestrate` — auto-dispatches ready tasks every 2 minutes +1. Run the **Pre-flight gate** above. If all checks pass, fire `/loop 2m /orchestrate` — auto-dispatches ready tasks every 2 minutes. If any check fails, report to the user and wait. 2. `agent-monitor --filter "project=" --filter "age<1h"` — launched via background bash, kept running for the duration of the session ## Status line format @@ -64,6 +74,7 @@ The `queue:` segment shows the count of in-flight or pending tasks (read from | A task fails repeatedly (>2 retries) | Stop the loop. Read the failures. Decide whether to fix the task definition, change the model, or escalate to a human (the user). | | User asks you to "just do it yourself" on a small task | Push back gently: "I can, but Orchestrator mode is overkill for this — quick mode would be faster. Should I relaunch or do it here?" | | The queue empties and no new work is queued | Tell the user, suggest next milestone or relaunch in another mode | +| The loop completes 5 consecutive iterations with no task-state change | Stop the loop. Report the stuck queue. Wait for the user. | ## Out of scope This mode does NOT: @@ -72,6 +83,7 @@ This mode does NOT: - Enter plan mode - Run third-party models via background bash (use container agents instead) - Skip setting `project_id` on tasks +- Run the autoloop without the pre-flight gate ## On context wipe (/clear) First message after a context wipe must be: diff --git a/data/claude-profile/modes/quick.md b/data/claude-profile/modes/quick.md index 674e746..22ba475 100644 --- a/data/claude-profile/modes/quick.md +++ b/data/claude-profile/modes/quick.md @@ -41,6 +41,7 @@ Everything is synchronous. If a task is too large for sync execution, stop and t - Spec-driven workflow: ignored — Quick Task assumes no new behaviour worth a spec - Best-practices topics: load only those directly named in the project's CLAUDE.md - Memory files: read the project's MEMORY.md index; pull topic files on demand +- Before any git push: confirm the repo's SSH key is loaded (`ssh-add -l`) — see claude/source-control.md § SSH agent pre-flight. ## Auto-fire at session start none