Explore phase of EPCC workflow - understand thoroughly before acting
Autonomously explore and document a codebase area before implementation. Use this to thoroughly understand existing patterns, architecture, and constraints without writing code. Supports quick, medium, or deep exploration levels with intelligent session resumption.
/plugin marketplace add aws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock/plugin install epcc-workflow@aws-claude-code-plugins[area-to-explore] [--deep|--quick|--refresh]You are in the EXPLORE phase of the Explore-Plan-Code-Commit workflow. Your mission is to understand thoroughly before taking any action.
Opening Principle: High-quality exploration reveals not just what exists, but why it exists—enabling confident forward decisions without re-discovery.
@../docs/EPCC_BEST_PRACTICES.md - Comprehensive guide covering clarification strategies, error handling patterns, sub-agent delegation, and EPCC workflow optimization
⚠️ IMPORTANT: This phase is for EXPLORATION ONLY. Do NOT write any implementation code. Focus exclusively on:
All implementation will happen in the CODE phase.
On entry, check for existing session state:
if epcc-progress.md exists:
Parse last exploration session for this area
# Check if this exploration target was explored recently
for session in epcc_progress.sessions:
if session.phase == "EXPLORE" and session.target matches ARGUMENTS:
age = days_since(session.timestamp)
if age < 7:
# Recent exploration found
trigger_reuse_prompt(session)
If prior exploration found within 7 days:
📋 **Prior exploration found from [date]**:
Area: [exploration target]
Findings: [brief summary from EPCC_EXPLORE.md]
Files examined: [count]
Use existing exploration? [Y/n/refresh]
- Y: Load existing EPCC_EXPLORE.md, skip to recommendations
- n: Start fresh exploration (overwrites existing)
- refresh: Quick delta check (only new/changed files since last exploration)
Use AskUserQuestion tool:
{
"questions": [{
"question": "Prior exploration for this area found from [date]. How do you want to proceed?",
"header": "Prior Found",
"multiSelect": false,
"options": [
{
"label": "Use existing",
"description": "Load prior EPCC_EXPLORE.md findings, skip re-exploration"
},
{
"label": "Start fresh",
"description": "Full re-exploration from scratch (overwrites existing)"
},
{
"label": "Refresh delta",
"description": "Quick check for changes since last exploration"
}
]
}]
}
git diff --stat [last_exploration_commit]..HEAD to identify changed files, explore only those$ARGUMENTS
Parse thoroughness level from arguments:
--quick: Fast surface-level exploration (key areas, basic patterns)--deep or --thorough: Comprehensive analysis (multiple locations, cross-referencing, detailed patterns)This command operates as an autonomous exploration agent, similar to Claude Code's Explore subagent:
This phase is designed to be autonomous - you should explore independently without frequent user interaction.
✅ Only ask when:
❌ Don't ask when:
Instead of asking, try:
grep authentication fails, try grep auth, find . -name "*auth*", check common directoriesAlmost never in EXPLORE phase. This phase is autonomous by design.
Rare exception: If exploration target is ambiguous AND you've tried reasonable interpretations:
User: "explore the payment system"
You've searched: payment*, billing*, transaction*, checkout*, stripe*, paypal*
Found: Nothing related to payments
Then ask: "I searched extensively but found no payment-related code. Should I:
- Explore a different area?
- Treat this as greenfield (no existing payment code)?
- Search with different terms?"
Pattern: Try → Try → Try → Document
1. Try search approach A → No results
2. Try search approach B → No results
3. Try search approach C → No results
4. Document: "Searched for X using [approaches]. No matches found. This appears greenfield."
NOT: Try once → Ask user
Remember: You're an autonomous explorer. Be persistent, try multiple approaches, and document what you find (or don't find). Save questions for genuine blockers, not first obstacles.
EXPLORE phase is autonomous by design - avoid asking questions unless truly blocked.
Before escalating to AskUserQuestion, ensure you've exhausted autonomous exploration:
Try multiple interpretations first:
User: "explore the payment system"
Step 1: Try broad searches
- grep -r "payment" .
- find . -name "*payment*"
- grep -r "billing\|transaction\|checkout" .
Step 2: Try platform-specific patterns
- Stripe: grep -r "stripe"
- PayPal: grep -r "paypal"
- Generic: grep -r "charge\|invoice\|subscription"
Step 3: Check configuration
- Look for API keys in .env files
- Check package.json/requirements.txt for payment libraries
Step 4: Document findings
If nothing found: "Searched extensively (payment*, billing*, stripe*, etc.). No payment code found. This appears to be a greenfield area."
If multiple found: "Found two payment implementations: legacy (src/billing/) and new (src/payments/). Both appear active."
Only ask if genuinely blocked:
Use AskUserQuestion tool with proper format:
{
"questions": [{
"question": "I found no payment-related code after extensive searching. How should I proceed?",
"header": "Next Step",
"multiSelect": false,
"options": [
{
"label": "Treat as greenfield",
"description": "Document that no payment code exists yet"
},
{
"label": "Different search terms",
"description": "Provide specific terms or file paths to search"
},
{
"label": "Different feature area",
"description": "Explore a different part of the codebase instead"
}
]
}]
}
Document all patterns, don't ask which to choose:
## 8. Multiple Patterns Found
**Authentication Implementation:**
Pattern A: JWT-based (src/auth/jwt/)
- Used in: API endpoints (3 files)
- Last modified: 2025-10-15
- Pros: Stateless, scalable
- Status: Appears to be current standard
Pattern B: Session-based (src/auth/sessions/)
- Used in: Legacy admin panel (2 files)
- Last modified: 2024-03-20
- Pros: Simpler
- Status: Possibly deprecated (no recent changes)
**Recommendation**: Pattern A (JWT) appears to be the current standard based on recent activity.
See Also: EPCC_BEST_PRACTICES.md → "Clarification Decision Framework"
BE SYSTEMATIC AND THOROUGH:
Try multiple search approaches if first attempt yields no results:
Follow the trail:
Be comprehensive:
Document as you go:
Stop exploring when objectives are met, not when you hit arbitrary file counts.
Stop when you understand:
Typical indicators you're done:
Stop when you understand:
Typical indicators you're done:
Stop when you've exhaustively documented:
Typical indicators you're done:
Heuristic Rule: If reading another file of the same type teaches you nothing new, you're done with that pattern.
For very large codebases or complex exploration tasks, you MAY deploy specialized exploration agents in parallel to save time.
Launch simultaneously (all in same response):
# ✅ GOOD: Parallel exploration (agents explore different aspects)
@code-archaeologist Analyze authentication system architecture and data flow.
Target: Authentication implementation across codebase
Focus areas:
- Token generation and validation flow
- Session management approach
- Password hashing implementation
- Rate limiting mechanisms
Trace: User login → token creation → validation → protected endpoint access
Document: Component interactions, data flow, security patterns, technical debt areas.
@system-designer Document authentication system architecture and component design.
Target: Authentication system structure
Analyze:
- Component boundaries and responsibilities
- Service layer architecture
- Database schema for auth
- API endpoint design
Generate: Architecture diagram, component relationships, data models, integration points.
@business-analyst Identify authentication business requirements and user workflows.
Target: Authentication feature scope and purpose
Analyze:
- User registration and login flows
- Password reset mechanisms
- Multi-factor authentication support
- Role-based access control
Document: User stories, business rules, workflow diagrams, requirement gaps.
# All three explore different aspects concurrently
Available agents: @code-archaeologist @system-designer @business-analyst @test-generator @documentation-agent
Full agent reference: See ../docs/EPCC_BEST_PRACTICES.md → "Agent Capabilities Overview" for agents in other phases (CODE, PLAN, COMMIT).
IMPORTANT: Only use subagents for codebases with 100+ files or highly complex systems. For typical projects, handle exploration directly and autonomously.
ALWAYS START HERE:
Check for CLAUDE.md files in this order:
Document ALL instructions found - these are mandatory requirements for the project.
Use multiple approaches to understand structure:
Adapt if one approach fails - try another.
Systematically check for different project types:
Document frameworks, libraries, versions, and tools found.
Use persistent, multi-attempt searching:
Example: Finding authentication patterns
find . -name "*auth*"grep -r "authenticate|login|session"grep -r "class.*Auth|def.*login"grep -r "from.*auth import"ls src/auth/ app/auth/Document what you tried and what worked:
Look for common patterns systematically:
Document each pattern with:
Trace both external and internal dependencies:
Create dependency graphs showing relationships.
Actively search for constraints:
If exploring a specific feature, find similar existing code:
Generate exploration report in EPCC_EXPLORE.md with depth matching scope.
Forbidden patterns:
Document these dimensions (depth varies by scope):
# Exploration: [Area/Feature]
**Date**: [Date] | **Scope**: [Quick/Medium/Deep] | **Status**: ✅ Complete
## 1. Foundation (What exists)
**Tech stack**: [Language, framework, versions]
**Architecture**: [Pattern family - "Express REST API", "Django monolith", "React SPA + FastAPI"]
**Structure**: [Entry points, key directories with purpose]
**CLAUDE.md instructions**: [Critical requirements found]
## 2. Patterns (How it's built)
[Name pattern families, not every instance]
**Architectural patterns**:
- [Pattern name]: [Where used - file:line], [When to use]
**Testing patterns**:
- [Test framework + approach]: [Fixture patterns, mock strategies]
- **Coverage**: [X%], **Target**: [Y%]
**Error handling**: [Exit codes, stderr usage, agent compatibility - see EPCC_BEST_PRACTICES.md]
## 3. Constraints (What limits decisions)
**Technical**: [Language versions, platform requirements]
**Quality**: [Test coverage targets, linting rules, type checking]
**Security**: [Auth patterns, input validation, known gaps]
**Operational**: [Deployment requirements, CI/CD, monitoring]
## 4. Reusability (What to leverage)
[Only if implementing similar feature]
**Similar implementations**: [file:line references]
**Reusable components**: [What can be copied vs adapted]
**Learnings**: [What worked, what to avoid]
## 5. Handoff (What's next)
**For PLAN**: [Key constraints, existing patterns to follow]
**For CODE**: [Tools/commands to use - test runner, linter, formatter]
**For COMMIT**: [Quality gates - coverage target, security checks]
**Gaps**: [Unclear areas requiring clarification]
Adaptation heuristic:
Completeness heuristic: Report is complete when you can answer:
Anti-patterns:
End of template guidance
Important: Fill each section with actual findings from your exploration, not placeholders or examples. Include:
Don't: Search once, ask user → Do: Try 3-5 search strategies before concluding
Don't: Read 10 files because target says "~10" → Do: Stop when pattern is understood
Don't: Jump straight to code → Do: Read CLAUDE.md first (critical project requirements)
Don't: Document only what works well → Do: Document edge cases, error handling, constraints
Don't: Judge code quality → Do: Document what exists objectively
Don't: "What do you mean by authentication?" → Do: Try auth*, login*, session*, JWT patterns first
Even with this guidance, you may default to:
Before finalizing EPCC_EXPLORE.md:
Context & Instructions:
Structure & Technology:
Patterns & Conventions:
Code Quality:
Constraints & Risks:
Similar Implementations:
Completeness:
# Quick exploration of entire codebase
/epcc-explore --quick
# Medium exploration (default) of specific area
/epcc-explore authentication
# Deep exploration of specific feature
/epcc-explore payment-processing --deep
# Thorough exploration of multiple areas
/epcc-explore "API routes and database models" --thorough
Before completing exploration, update the progress log:
If epcc-progress.md exists (long-running project):
## Session: EXPLORE - [timestamp]
**Target**: [exploration area from ARGUMENTS]
**Thoroughness**: [quick|medium|deep]
**Duration**: [approximate time spent]
### Areas Explored
- [area 1]: [brief finding]
- [area 2]: [brief finding]
### Key Patterns Found
- [pattern]: [location]
### Files Examined
[count] files across [count] directories
### Handoff Notes
- Ready for: [PLAN/CODE phase]
- Blockers: [any issues encountered]
- Follow-up: [anything to investigate further]
### Git State
- Commit: [current HEAD short hash]
- Branch: [current branch]
- Clean: [yes/no]
# Pseudo-code for progress update
session_entry = {
"timestamp": now(),
"phase": "EXPLORE",
"target": ARGUMENTS,
"thoroughness": detected_level,
"output_file": "EPCC_EXPLORE.md",
"files_examined": count,
"patterns_found": count,
"git_commit": HEAD_short
}
append_to_progress_log(session_entry)
✅ Exploration complete!
📄 **Output**: EPCC_EXPLORE.md
📊 **Coverage**: [X] files examined, [Y] patterns documented
📋 **Progress**: Session logged to epcc-progress.md
**Recommended next phase**: /epcc-plan [feature-based-on-exploration]
Time spent exploring saves time coding!
🚫 DO NOT: Write code, create files, implement features, fix bugs, or modify anything
✅ DO: Be persistent, try multiple approaches, follow the trail, document thoroughly, save to EPCC_EXPLORE.md
This command integrates with the EPCC long-running project tracking system:
| Artifact | Role in EXPLORE |
|---|---|
epcc-features.json | Read to understand feature context |
epcc-progress.md | Read prior sessions, write completion log |
EPCC_EXPLORE.md | Primary output document |
Session continuity: If context runs low during exploration:
/epcc-resume then continue with /epcc-explore --refresh