Skip to content

Make incremental analysis the default behavior for docimp analyze #381

@nikblanchet

Description

@nikblanchet

Summary

Make incremental analysis the default behavior for docimp analyze to improve performance and user experience without requiring users to remember the --incremental flag.

Current Behavior

Users must explicitly use the --incremental flag to benefit from faster incremental analysis:

docimp analyze ./src --incremental

This requires users to:

  • Know the feature exists
  • Remember they ran analysis before
  • Manually add the flag each time
  • Understand when it will help

Proposed Behavior

Auto-detect and use incremental mode by default:

docimp analyze ./src
# Automatically detects previous analysis
# Uses incremental mode if applicable
# Shows message explaining what happened

User-facing message:

Analysis complete

I noticed you had previously run analysis on this codebase. To improve performance, 
I only re-analyzed the 3 files that changed (97 files reused from previous analysis).

If you want to force a complete re-analysis, run:
  docimp analyze --force-full-analysis ./src

Time saved: ~27 seconds (90% faster)

Implementation Details

Changes Required

  1. Auto-detection logic in analyzeCore():

    • Check for previous analysis in .docimp/session-reports/analyze-latest.json
    • Check for workflow state in .docimp/workflow-state.json
    • If both exist, automatically use incremental mode
  2. New flag: --force-full-analysis (or --no-incremental):

    • Overrides auto-incremental behavior
    • Forces full analysis of all files
    • Useful for benchmarking or debugging
  3. Keep --incremental for backwards compatibility:

    • Make it a no-op (incremental is now default)
    • Update documentation to note it's redundant
    • Keep for users who like being explicit
  4. Enhanced messaging:

    • Show when incremental mode was used
    • Display file counts (changed vs reused)
    • Show estimated time savings
    • Provide clear opt-out instructions

Files to Modify

  • cli/src/commands/analyze.ts - Auto-detection logic
  • cli/src/index.ts - Add --force-full-analysis flag, document --incremental as redundant
  • cli/src/display/terminal-display.ts - Enhanced analysis result messaging
  • CLAUDE.md - Update documentation
  • README.md - Update user-facing docs

Benefits

  • Better UX: Optimal performance without cognitive load
  • Education: Users learn about incremental analysis through messages
  • Backwards compatible: Existing --incremental usage still works
  • Discoverable: Users see performance improvements automatically

Related

Priority

High - This significantly improves UX for all users with minimal implementation effort. Makes a powerful feature accessible without requiring flag knowledge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliCLI layer issueseffort-mediumMedium effort: 2-4 hoursenhancementNew feature or requestimpact-highHigh impact on users or systempriority-highHigh priority - should be fixed soonuxUser experience issuesworkflowWorkflow state and validation features

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions