# Ultrathink Deep Dive Loop

> Full deep-dive audit loop — bugs, edge cases, backlog, current competitive web research, TDD fix waves, council-reviewed plans, re-audit until clean. Use for ultrathink mandates, /deep-dive, security audits, complete backlog, competitive analysis. Routes orchestrator by provider (Claude Opus vs Fable, Codex gpt-5.5, Cursor Auto vs Opus, agy Gemini 3.5/3.1). Spawns workflows + subagents; a peer-review council audits plans.

- Skill: `oimiragieo/ultrathink-deep-dive-loop` (Agent Skill)
- Install (CLI): `npx skillmds@latest add oimiragieo/ultrathink-deep-dive-loop`
- Raw SKILL.md: https://api.skillmd.com/api/skills/oimiragieo/ultrathink-deep-dive-loop/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Product & Planning
- Author: oimiragieo (https://skillmd.com/u/oimiragieo)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/oimiragieo/ultrathink-deep-dive-loop

---


# ultrathink-deep-dive-loop

Provider-agnostic procedure. Read the **appendix for your active CLI** before Phase 0.

| Provider | Appendix |
|----------|----------|
| Claude Code | [Claude](#appendix-claude) |
| OpenAI Codex | [Codex](#appendix-codex) |
| Cursor | [Cursor](#appendix-cursor) |
| agy (Antigravity) | [agy](#appendix-agy) |

Trigger phrases: `ultrathink`, `deep dive`, `complete backlog`, `security audit`,
`competitive analysis`, `/deep-dive`, `/security-audit`, `/audit-loop`.

---

## Phase 0 — Route orchestrator

Classify the mandate:

- **Security / audit / vuln / money / auth** → top-tier orchestrator, security council (no Fable on Claude).
- **Feature / design / writing** → Fable OK on Claude; Codex gpt-5.5; Cursor Auto OK for mechanical.
- **Mechanical fix-loop** → mid-tier orchestrator + cheap scan seats.

Read `core/prompts/principles/09-orchestrator-routing.md`.

---

## Phase 1 — Scan (cheap seats)

1. **Local inventory** — `tg doctor`, `tg map` or `tg orient`, scoped `tg search`.
2. **Backlog** — open issues, TODO/FIXME, failing CI, `docs/` audit queues.
3. **External truth** — available web-research tools and authoritative current sources for:
   - competitor / prior-art (T-72h freshness)
   - library behavior you would otherwise trust from training data
   - novel edge-case ideas for this product surface
4. **Competitive pass** — document 3+ alternatives + differentiation + untested edge cases.

Cap fan-out. Log dropped agents (no silent caps).

---

## Phase 2 — Plan (top-tier orchestrator)

1. Load **superpowers:writing-plans** (install superpowers plugin if absent).
2. TDD-shaped plan: failing test → fix → green per item.
3. Decide workflow vs inline subagents:
   - \>3 independent files OR cross-verify → `Workflow` tool
   - Template: `core/workflows/deep-dive-bughunt.js` (pass `repo`, `root`, `lenses`)
4. **Council audit the plan** (before any code):
   - Security: a peer-review council + codex (+ sonnet-5 seat; **no Fable**)
   - Else: Fable + codex + council
   - Background council → `CronCreate` follow-up per the council mandate
5. **Risky fixes** → a fix-approach review pass on proposed fixes (not findings).

---

## Phase 3 — Build (mid-tier, one-writer-per-repo)

1. **sonnet / gpt-5.5-medium / Cursor Auto+inherit** for implementation subagents.
2. Verify subagent output (receipts, commit, tests) on every multi-phase dispatch.
3. Large reads → gotcontext MCP; local symbols → `tg callers` / `tg blast-radius`.
4. **agy seat** for parallel read-only audit lenses (bulk: 3.5 Flash High).

---

## Phase 4 — Review diff

1. Security: codex + thinktank + sonnet-5 (**no Fable**).
2. Else: Fable + codex (+ thinktank on load-bearing).
3. **Merge gate** (Opus / gpt-5.5-high): verify EACH finding at `file:line` yourself.
4. Full suite green + lint + format.
5. Engine/API/MCP change → dogfood live gotcontext MCP.

---

## Phase 5 — Re-audit loop

Until clean:

1. `/audit-loop` or re-run `deep-dive-bughunt` on changed paths.
2. Competitive edge-case retest (current authoritative web research if external).
3. Stop only with evidence — not self-report.

---

## Workflow: deep-dive-bughunt

```js
// Invoke via Workflow tool — customize lenses for your repo
Workflow({
  name: 'deep-dive-bughunt',
  args: {
    repo: 'my-app',
    root: '/path/to/repo',
    lenses: [
      { key: 'api', focus: 'api/ handlers auth billing', maxFiles: 12 },
      { key: 'web', focus: 'frontend routes + hooks', maxFiles: 12 },
    ],
  },
})
```

Output: ranked fix queue → fix-approach review → TDD waves.

---

## Appendix: Claude

| Phase | Model | Notes |
|-------|-------|-------|
| Orchestrator security | `/model opus` persist | NEVER Fable |
| Orchestrator feature | Fable OK | |
| Scan | haiku `Agent` | |
| Build | sonnet `Agent` worktree isolation | |
| Council | thinktank + codex | Security: drop Fable |
| Merge | Opus | Always |

Commands: `/deep-dive`, `/security-audit`, `/audit-loop`, `/competitive-exa`

Hooks: `ultrathink_orchestrator_gate` injects routing on trigger phrases.

---

## Appendix: Codex

| Phase | Model | Command |
|-------|-------|---------|
| Orchestrator | gpt-5.5 | `model = "gpt-5.5"` in config.toml |
| Plan effort | high | `model_reasoning_effort = "high"` |
| Scan subagent | gpt-5.4-mini | `codex exec -m gpt-5.4-mini -p "..."` |
| Build | gpt-5.5 medium | `model_reasoning_effort = "medium"` |
| Cross-review | Claude Opus CLI | separate CLI session / `claude -p` |
| Gemini seat | agy | `conpty-run.exe` + `use-gemini` |

Profiles: copy `providers/codex/profiles/security.toml` vs `feature.toml`.

No hooks — you are the enforcement. MCP via
`npx --yes gotcontext@1.0.1 wrap codex`.

Prompt macro: `@deep-dive` from `~/.codex/prompts/deep-dive.md` (after install).

---

## Appendix: Cursor

| Phase | Model | Setting |
|-------|-------|---------|
| Default mechanical | **Auto** | Composer subagents — cheap |
| Security orchestrator | **Claude Opus 4.6** explicit | Enable **Max Mode** |
| Subagents | `model: inherit` | `.cursor/agents/*.md` |
| External seats | codex exec + agy | Parallel verification |
| Merge | Opus or pinned gpt-5.5 | Not Auto |

**Auto trap:** Auto picks Composer 2.x; fine for explore/bash, wrong for security synthesis.
Pin Opus for ultrathink security; Max Mode so subagents don't silently downgrade.

Commands: `.cursor/commands/deep-dive.md` (project) or `~/.cursor/commands/`.

Hook: `beforeSubmitPrompt` → `ultrathink_prompt.sh` (after cursor install).

Tri-stack pattern: Cursor builds → codex reviews diff → agy third opinion on claims.

---

## Appendix: agy (Antigravity CLI)

When **agy is the active orchestrator** (not just a third seat):

| Phase | Model | Command / path |
|-------|-------|----------------|
| Orchestrator (bulk) | Gemini 3.5 Flash (High) | `agy --model "Gemini 3.5 Flash (High)"` |
| Orchestrator (security) | Gemini 3.1 Pro (High) | `agy --model "Gemini 3.1 Pro (High)"` |
| Parallel scan lenses | 3.5 Flash (High) | `saddle-agy-headless.sh` (ConPTY) |
| Cross-review | codex gpt-5.5 + Claude Opus | codex CLI / a separate CLI session |
| Merge / synthesis | 3.1 Pro or defer to Opus | agy alone does not auto-merge security |

Profiles: `providers/agy/profiles/security.json` vs `feature.json` →
`~/.gemini/profiles/` (copy `model` into `settings.json`).

No native hooks — **GEMINI.md** + `~/.gemini/prompts/` are binding law.
MCP: `~/.gemini/config/mcp_config.json` (remote uses **`serverUrl`**). Verify: `/mcp`.

Prompt macros (after `./install.sh agy`):

- `~/.gemini/prompts/deep-dive.md`
- `~/.gemini/prompts/security-audit.md`
- `~/.gemini/prompts/audit-loop.md`

Read-only audits: `agy --sandbox -p "..."` + spec under `.agents/tasks/`.

When agy is **third seat** in Claude/Codex/Cursor sessions, keep the primary
orchestrator on Opus/gpt-5.5; agy runs parallel read lenses only.

---

## Cross-provider agy dispatch

All providers share the same headless path:

```bash
export SADDLE_HOME=/path/to/gotcontext-saddle
"$SADDLE_HOME/providers/agy/bin/saddle-agy-headless.sh" \
  --model "Gemini 3.5 Flash (High)" \
  --add-dir /path/to/repo \
  "Your audit prompt"
```

Windows direct (if `conpty-run.exe` on PATH):

```bash
conpty-run.exe "$HOME/AppData/Local/agy/bin/agy.exe" -p "PROMPT" \
  --model "Gemini 3.5 Flash (High)" --print-timeout 120s
```

See `use-gemini` for WSL tmux fallback and council seat wiring.

---

## Skills index (load on demand)

| Skill | Phase |
|-------|-------|
| Available web-research tools | 1, 5 competitive |
| `tensor-grep-code-audit` | 1, 3 local code |
| `use-gotcontext` | 3 compression |
| `use-gemini` | 3–4 agy seats |

Superpowers plugin: `writing-plans`, `test-driven-development`, `verification-before-completion`.

