Deep analysis

From sequenzia/agent-alchemy · View interactive version

Deep analysis is an AI agent skill from the GitHub repository sequenzia/agent-alchemy. Deep exploration and synthesis workflow with dynamic planning and hub-and-spoke coordination. Use for deep analysis, codebase understanding, or thorough investigation of a focus area.

How to use this skill

Skill file

Deep Analysis Workflow

Execute a structured exploration + synthesis workflow using hub-and-spoke coordination. The lead performs rapid reconnaissance to generate dynamic focus areas, composes a team plan for review, workers explore independently, and a synthesizer merges findings with deep investigation.

This skill can be invoked standalone or loaded by other skills as a reusable building block. Approval behavior is configurable.

Settings Check

Goal: Determine whether the team plan requires user approval before execution.

  1. Read settings file:
  1. Determine invocation mode:
  1. Resolve settings:
  1. Set REQUIRE_APPROVAL:
  1. Parse session settings (also under the deep-analysis section):

Phase 0: Session Setup

Goal: Check for cached exploration results, detect interrupted sessions, and initialize the session directory.

Skip this phase entirely if cache TTL is 0 AND checkpointing is disabled.

Step 1: Exploration Cache Check

If cache TTL > 0:

  1. Check if .agents/sessions/exploration-cache/manifest.md exists
  2. If found, read the manifest and verify:
  1. If cache is valid:
  1. If cache is invalid or absent: Proceed normally

Step 2: Interrupted Session Check

If checkpointing is enabled:

  1. Check if .agents/sessions/__da_live__/checkpoint.md exists
  2. If found, read the checkpoint to determine last_completed_phase
  3. Prompt the user to choose:
  1. If not found: proceed normally

Step 3: Initialize Session Directory

If checkpointing is enabled and no cache hit:

  1. Create .agents/sessions/__da_live__/ directory
  2. Write a checkpoint.md with session metadata (analysis context, codebase path, start timestamp, current phase)
  3. Write a progress.md to track phase completions

Phase 1: Reconnaissance & Planning

Goal: Perform codebase reconnaissance, generate dynamic focus areas, and compose a team plan.

  1. Determine analysis context:
  1. Rapid codebase reconnaissance:

Search for files, read config files, and map the codebase structure. This should take 1-2 minutes, not deep investigation.

Fallback: If reconnaissance fails (empty project, unusual structure, errors), use static focus area templates from Step 3b.

  1. Generate dynamic focus areas:

Based on reconnaissance findings, create focus areas tailored to the actual codebase. Default to 3 focus areas, but adjust based on codebase size and complexity (2 for small projects, up to 4 for large ones).

Each focus area should include:

  1. Compose the team plan:

Assemble a structured plan document:

  1. Checkpoint (if enabled):

Phase 2: Review & Approval

Goal: Present the team plan for user review and approval before allocating resources.

If approval is not required

Skip to Phase 3 with a brief note: "Auto-approving team plan (skill-invoked mode). Proceeding with N explorers and 1 synthesizer."

If approval is required

  1. Present the team plan, then prompt the user to choose:
  1. If "Modify" (up to 3 cycles): Apply modifications, re-present for approval
  2. If "Regenerate" (up to 2 cycles): Re-run Phase 1 Step 2 with feedback, re-compose and re-present

Phase 3: Team Assembly

Goal: Create the team, delegate to agents, create tasks, and assign work using the approved plan.

  1. Set up the team for the analysis session
  1. Delegate exploration work:
  1. Create tasks for tracking:
  1. Assign exploration tasks with status guards — only assign if status is pending and unowned. Never re-assign a completed or in-progress task.

Phase 4: Focused Exploration

Goal: Workers explore their assigned areas independently.

After assigning exploration tasks, monitor progress:

  1. When an explorer completes, record its findings. If checkpointing is enabled, persist findings to the session directory.
  2. Workers explore independently — no cross-worker messaging (hub-and-spoke topology)
  3. Workers can respond to follow-up questions from the synthesizer
  4. Wait for all exploration tasks to complete before proceeding to Phase 5

Phase 5: Evaluation and Synthesis

Goal: Verify exploration completeness, launch synthesis with deep investigation.

Step 1: Structural Completeness Check

  1. Verify all exploration tasks are completed
  2. Check that each worker produced a report with content
  3. If a worker failed completely, create a follow-up exploration task and wait for it
  4. If all produced content, proceed to Step 2

Step 2: Launch Synthesis

  1. Assign the synthesis task to the synthesizer
  2. Provide the synthesizer with all exploration results and recon findings
  3. The synthesizer can message explorers with follow-up questions to resolve conflicts and gaps
  4. The synthesizer has shell command access for git history analysis, dependency trees, and static analysis
  5. Wait for synthesis to complete

Phase 6: Completion + Cleanup

Goal: Collect results, present to user, and tear down the team.

  1. Collect synthesis output from the synthesizer's report
  1. Write exploration cache (if cache TTL > 0):
  1. Present or return results:
  1. Shut down all agents and archive/clean up the session

Error Handling

Settings Check Failure

Planning Phase Failure

Partial Worker Failure

Synthesizer Failure

Session Recovery

When resuming from an interrupted session, use per-phase strategy:

| Interrupted At | Recovery Strategy |

|----------------|-------------------|

| Phase 1 | Restart from Phase 1 (reconnaissance is fast) |

| Phase 2 | Load saved team plan, re-present for approval |

| Phase 3 | Load approved plan, restart team assembly |

| Phase 4 | Read completed explorer findings from session dir, only assign missing explorers |

| Phase 5 | Load all explorer findings, launch fresh synthesis |

| Phase 6 | Load synthesis, proceed to present results and cleanup |


Agent Coordination

Integration Notes

What this component does: Orchestrates a multi-agent codebase exploration and synthesis workflow with dynamic focus area planning, caching, and session recovery.

Capabilities needed:

Adaptation guidance:

Configurable parameters:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.