Document Project Workflow
The Document Project workflow generates comprehensive documentation for existing (brownfield) projects. It automatically scans your codebase, understands the architecture, and creates AI-friendly documentation.Purpose
This workflow serves two primary purposes:- AI Context Generation: Create documentation that AI agents can use to understand your project
- Team Knowledge: Provide human-readable project documentation
When to Use
Use Document Project when:- Starting work on an existing codebase
- Onboarding new team members
- Project lacks current documentation
- Need to refresh outdated documentation
- Preparing for AI-assisted development
Trigger Commands
Workflow Modes
The Document Project workflow has three modes:Initial Scan
First-time documentation of a project
Full Rescan
Update all documentation with latest changes
Deep Dive
Detailed documentation of specific area
Initial Scan
Trigger: No existing documentation found Process:- Detect project type
- Scan codebase structure
- Generate comprehensive documentation
- Create project overview
- Document key areas
{project_knowledge}/
Full Rescan
Trigger: Existing documentation found, user chooses “Re-scan entire project” Process:- Load existing documentation
- Re-scan codebase for changes
- Update all documentation
- Preserve manual additions
- Track what changed
Deep Dive
Trigger: Existing documentation found, user chooses “Deep-dive into specific area” Process:- User specifies area (folder, feature, module)
- Exhaustive scan of that area
- Generate detailed documentation
- Link to existing docs
- Update index
Workflow Process
Step 1: Mode Detection
The workflow checks for existing documentation and determines the mode:Step 2: Project Type Detection
Purpose: Understand what kind of project this is to generate relevant documentation. Detection Process:-
Examine project structure
- Look for framework indicators (package.json, requirements.txt, etc.)
- Identify build tools and configs
- Detect languages used
-
Load documentation requirements
- Uses
documentation-requirements.csvto map project type to documentation needs - Determines what should be documented
- Uses
-
Architecture detection
- Identifies architectural patterns
- Detects folder structure conventions
- Finds entry points
- Web Applications (React, Vue, Angular, etc.)
- Backend APIs (Node.js, Python, etc.)
- Full-stack applications
- Mobile apps
- Libraries and SDKs
- CLI tools
- Microservices
Step 3: Codebase Scanning
Scan Levels:- Standard Scan (Initial/Rescan): Covers main areas
- Exhaustive Scan (Deep Dive): Every detail of specific area
-
Structure Discovery
- Map folder structure
- Identify key directories
- Find configuration files
-
Entry Points
- Locate main files
- Find routing definitions
- Identify API endpoints
-
Dependencies
- External packages
- Internal modules
- Third-party services
-
Patterns & Conventions
- Code organization
- Naming conventions
- Architectural patterns
-
Key Features
- Main functionality areas
- User-facing features
- Background processes
Step 4: Documentation Generation
Generated Documents:1. Project Overview
File:{project_knowledge}/project-overview.md
Contains:
- Project description
- Technology stack
- Architecture overview
- Key features
- Getting started guide
- Development workflow
2. Source Tree
File:{project_knowledge}/source-tree.md
Contains:
- Complete folder structure
- Purpose of each directory
- Key files and their roles
- Organization principles
3. Deep Dive Documents
Files:{project_knowledge}/deep-dive-[area].md
Contains (for specific area):
- Detailed component breakdown
- Data flow
- API documentation
- State management
- Code examples
- Integration points
4. Index
File:{project_knowledge}/index.md
Contains:
- Table of contents
- Document links
- Quick navigation
- Last updated dates
Step 5: State Management
State File:{project_knowledge}/project-scan-report.json
Tracks:
- Scan progress
- Completed steps
- Project classification
- Timestamps
- Resume capability
Initial Scan Workflow
Full Scan Process
File:src/bmm/workflows/document-project/workflows/full-scan.yaml
Steps:
-
Project Discovery
- Detect project type
- Load requirements CSV
- Configure scan scope
-
Structure Mapping
- Scan folder structure
- Identify key directories
- Map file organization
-
Entry Point Analysis
- Find application entry points
- Identify routing files
- Locate configuration
-
Feature Detection
- Identify feature areas
- Map user-facing functionality
- Document API endpoints
-
Documentation Generation
- Generate project overview
- Create source tree
- Write index
-
State Persistence
- Save scan state
- Enable resume
- Track completion
Example Invocation
Deep Dive Workflow
Purpose
Generate exhaustive documentation for a specific feature, module, or folder.Deep Dive Process
File:src/bmm/workflows/document-project/workflows/deep-dive.yaml
Steps:
-
Area Selection
- User specifies area
- Validate area exists
- Determine scope
-
Exhaustive Scan
- Read all files in area
- Analyze all components
- Map all dependencies
- Trace data flow
-
Pattern Analysis
- Identify patterns used
- Document conventions
- Note architectural decisions
-
Documentation Generation
- Create deep-dive document
- Include code examples
- Add diagrams (text-based)
- Link to related areas
-
Index Update
- Add to main index
- Create cross-references
- Update navigation
Example Invocation
Documentation Templates
Project Overview Template
File:src/bmm/workflows/document-project/templates/project-overview-template.md
Sections:
- Project Description
- Technology Stack
- Architecture Overview
- Folder Structure
- Getting Started
- Development Workflow
- Key Features
- External Dependencies
- Configuration
- Deployment
Source Tree Template
File:src/bmm/workflows/document-project/templates/source-tree-template.md
Format:
Deep Dive Template
File:src/bmm/workflows/document-project/templates/deep-dive-template.md
Sections:
- Area Overview
- Architecture
- Component Breakdown
- Data Flow
- API Integration
- State Management
- Code Examples
- Patterns & Conventions
- Testing Strategy
- Related Areas
Configuration
Documentation Requirements CSV
File:src/bmm/workflows/document-project/documentation-requirements.csv
Maps project types to documentation requirements:
Workflow Configuration
File:src/bmm/workflows/document-project/workflow.yaml
Key Settings:
Output Files
All documentation is generated in{project_knowledge}/ directory:
Best Practices
Initial Documentation
- Run Initial Scan Early: Document projects before starting work
- Review Generated Docs: Verify accuracy, add manual notes
- Deep Dive Key Areas: Document complex features in detail
- Keep Updated: Re-scan when major changes occur
Using Documentation
- Load for Context: AI agents use docs for context
- Reference in Specs: Link to deep-dive docs in quick specs
- Onboarding: Share with new team members
- Architecture Decisions: Use as input for ADRs
Maintenance
- Periodic Rescans: Run full rescan monthly or after major features
- Deep Dive New Features: Document new major features
- Archive Old Scans: Keep history in .archive/
- Manual Additions: Add notes to generated docs (preserved on rescan)
Integration with BMad Method
Document Project workflow integrates with other BMad workflows:For Greenfield Projects
- After Phase 3: Document initial architecture
- After Each Epic: Update documentation
- Before Handoff: Generate complete docs
For Brownfield Projects
- Start Here: Document before planning changes
- Use in Planning: Reference in PRD and Architecture
- Use in Development: Provide context for story implementation
- Correct Course: Update docs when changing direction
Source Files
- Main Workflow:
src/bmm/workflows/document-project/workflow.yaml - Instructions:
src/bmm/workflows/document-project/instructions.md - Full Scan:
src/bmm/workflows/document-project/workflows/full-scan.yaml - Deep Dive:
src/bmm/workflows/document-project/workflows/deep-dive.yaml - Templates:
src/bmm/workflows/document-project/templates/ - Requirements CSV:
src/bmm/workflows/document-project/documentation-requirements.csv
Next Steps
- Overview - All workflows
- Phase 1: Analysis - Start planning with documented project context
- Quick Flow - Use project docs for quick development
