| name | dig |
| description | Clarify ambiguities in plans with structured questions and auto-decide rules |
| user-invocable | true |
| allowed-tools | ["ToolSearch"] |
Dig — Structured Ambiguity Resolution
Resolve ambiguities before implementation by generating structured questions with options. Auto-decides choices that follow established project patterns.
When to Use
- After investigation is complete but before decomposition
- When there are design choices, trade-offs, or unclear requirements
- When the approach could go multiple valid directions
Process
Step 1: Extract Ambiguities
From the investigation results, identify every decision point:
| # | Ambiguity | Category | Auto-decidable? |
|---|
| 1 | ... | architecture / api-design / data-flow / concurrency / error-handling / naming / testing | yes/no |
Step 2: Apply Auto-Decide Rules
For auto-decidable ambiguities, check the project's CLAUDE.md, rules/*.md, and existing codebase patterns to determine the answer.
How to auto-decide:
- Check if CLAUDE.md or rules/ explicitly defines a convention for this decision
- Check if the codebase has an established pattern (Grep for similar implementations)
- If a clear, consistent pattern exists → auto-decide and record the rule
Common decision categories:
- Architecture: Where does this code belong? (Check CLAUDE.md architecture section)
- API Design: Public or internal? What return type? (Check existing public API patterns)
- Data Flow: Sync or async? Callback or stream? (Check established patterns)
- Concurrency: Thread safety approach? (Check existing locking/synchronization patterns)
- Error Handling: Exception, Result type, or null? (Check existing error patterns)
- Naming: Follow project naming conventions (Check CLAUDE.md or rules/)
- Testing: Unit, integration, or both? (Check existing test patterns)
Step 3: Investigate Remaining Unknowns
For non-auto-decidable ambiguities:
- Use Explore agent to find existing patterns in the codebase
- Check if similar features already exist and how they handle the same decision
- Read relevant documentation or ADRs
Step 3.5: Codex Design Review (Optional)
For non-auto-decidable ambiguities in the architecture, api-design, or concurrency categories, consult Codex for alternative approaches before asking the user.
Skip this step for: naming, testing, error-handling, data-flow categories (these are resolved by codebase patterns or user preference).
Load Codex
ToolSearch("select:mcp__codex__codex")
Call Codex (if available)
mcp__codex__codex(
prompt: "Given these unresolved design decisions, explore alternatives:
## Ambiguities
{list of non-auto-decidable architecture/api-design/concurrency ambiguities with their options}
## Codebase Context
{relevant patterns from Step 2, existing conventions}
For each ambiguity:
1. Evaluate the proposed options
2. Suggest any additional alternatives not yet considered
3. Recommend the best option with reasoning
4. Flag any risks or trade-offs"
)
Incorporate Codex recommendations into the options presented to the user in Step 4.
Fallback (Codex unavailable)
If ToolSearch fails to find Codex or the call errors:
- Skip this step — proceed to Step 4 with Step 3 results only (traditional flow)
Step 4: Ask User (max 3 rounds, max 4 questions per round)
Present remaining unknowns with AskUserQuestion:
- Context from investigation
- 2-4 concrete options with trade-offs
- Recommend the option matching existing codebase patterns
Step 5: Output Decision Matrix
## Dig Results: {requirement}
### Auto-Decided
| # | Decision | Rule | Result |
|---|----------|------|--------|
| 1 | Where to place X | CLAUDE.md: "feature code in src/features/" | src/features/x/ |
### Investigated
| # | Decision | Finding | Result |
|---|----------|---------|--------|
| 2 | Error handling approach | Existing pattern in src/api/client.kt uses Result<T> | Result<T> |
### User-Decided
| # | Decision | Choice | Reason |
|---|----------|--------|--------|
| 3 | Public API surface | Option A: minimal | user preference |
### Assumptions (if any)
| # | Assumption | Risk |
|---|-----------|------|