Skip to content

Code Analysis Flow

Availability

OSS

TL;DR

When To Use This Workflow

When Not To Use This Workflow

Before You Start

Prepare only the workflow specific inputs:

Results improve when these Rosetta context files already describe the project well:

For shared setup and general Rosetta usage, use Usage Guide and Overview.

How To Start

"Explain how the authentication system works."
"Analyze the payment module and document its components, data flow, and external dependencies."
"Reverse engineer the billing API into architecture docs without proposing changes."
"Extract requirements from the reporting module and document the current behavior first."

How Rosetta Shapes This Workflow

Rosetta changes the experience in ways you can see from the outside:

Workflow At A Glance

Phase What you provide What agents do What artifacts appear Review gate
1. Context load Analysis request Load project context and identify entry points Workflow state update No
2. Scope and classify Scope boundaries and non goals when needed Classify SMALL or LARGE and define module list for large work Workflow state update No
3. Clarify unknowns Answers to high impact questions Resolve critical or high unknowns and record assumptions Workflow state update and documented assumptions Yes
4. Requirements branch Explicit request for requirements recovery Extract intent from code, then enter the requirements workflow with its own approvals docs/<feature>/REQUIREMENTS/ Requirements workflow
5. Analyze small Small scoped target Produce one grounded analysis document docs/<feature>/analysis.md No
6. Analyze large parallel Large scoped target Partition modules and analyze each one in parallel docs/<feature>/module-<module>.md No
7. Summarize Module analysis documents Produce one cross module summary docs/<feature>/summary.md No
8. Review Analysis artifacts Check groundedness, accuracy, scope coverage, and diagram readability Review findings No
9. User review Feedback or explicit approval Present artifacts and iterate if needed Approved analysis or revision request Yes
10. Finalize Explicit approval Close workflow state and record artifact pointers Completed state and implementation pointer No

Workflow Overview

flowchart TD
    A["User requests code analysis"] --> B["Load context and entry points"]
    B --> C["Classify scope as SMALL or LARGE"]
    C --> D{"Critical or high unknowns"}
    D -- "Yes" --> E["Ask targeted questions and record assumptions"]
    D -- "No" --> F{"Requirements recovery requested"}
    E --> F
    F -- "Yes" --> G["Enter requirements workflow and create requirements artifacts"]
    F -- "No" --> H{"Scope size"}
    G --> H
    H -- "SMALL" --> I["Create analysis artifact"]
    H -- "LARGE" --> J["Partition modules and analyze in parallel"]
    J --> K["Create per-module analysis artifacts"]
    K --> L["Create cross-module summary"]
    I --> M["Review groundedness, coverage, and diagrams"]
    L --> M
    M --> N{"User review"}
    N -- "Feedback" --> O["Return to owning analysis phase"]
    O --> M
    N -- "Approve" --> P["Finalize workflow state"]

Interaction Flow

sequenceDiagram
    autonumber
    participant U as User
    participant R as Rosetta instructions
    participant A as Coding agent
    participant S as Subagents
    participant F as Artifacts

    Note over R: Rosetta provides instructions only
    U->>A: Request code analysis for a scoped area
    R->>A: Load workflow and guardrails
    A->>S: Load context and classify scope
    S-->>A: Entry points, scope, size, unknowns
    A->>U: Ask only critical or high impact questions if needed
    U-->>A: Clarifications or accepted assumptions
    alt Requirements recovery requested
        A->>S: Run reverse engineering, then enter requirements authoring with its own approval gates
        S-->>F: Requirements artifacts
    end
    alt SMALL scope
        A->>S: Produce one analysis document
        S-->>F: Analysis artifact
    else LARGE scope
        A->>S: Partition modules
        S-->>F: Per-module analysis artifacts
        A->>S: Summarize cross module findings
        S-->>F: Summary artifact
    end
    A->>S: Review groundedness and coverage
    S-->>A: Review findings
    A->>U: Present analysis and review findings
    U-->>A: Explicit approval or feedback
    A->>F: Finalize workflow state

Phases

1. Context load

Goal: start from project reality instead of isolated files.

2. Scope and classify

Goal: choose the correct analysis shape.

3. Clarify unknowns

Goal: resolve only the unknowns that materially affect analysis accuracy.

4. Requirements branch

Goal: recover requirements from code only when you explicitly asked for that outcome.

5. Analyze small

Goal: produce one grounded document for a contained scope.

6. Analyze large parallel

Goal: keep large analysis reliable by partitioning the workspace.

7. Summarize

Goal: turn module analysis into one cross module explanation.

8. Review

Goal: inspect the analysis artifacts before handoff.

9. User review

Goal: let the human owner confirm the analysis matches real system intent.

10. Finalize

Goal: close the workflow with traceable state.

How To Review Results

Check these items before you approve:

Reject or send feedback when you see:

For general review expectations, see Review Standards.

Workflow-Specific Customization

These customizations materially improve this workflow:

Artifacts You Will Get

Always:

For SMALL scope:

For LARGE scope:

Only when you explicitly request requirements recovery:

At workflow close:

Common Mistakes

Source Files

Authoritative workflow sources used for this page:

Shared public docs consulted to avoid duplication and keep wording aligned:

The workflow defines its phases inline. No separate phase files are referenced by this workflow source.