Work with doc gen
Use doc gen when you need to generate documentation from source code — docstrings, readme sections, or API references.
Set up your environment
-
Navigate to the document generation module
cd src/attune/workflows/document_gen/ -
Review the workflow structure Examine the main entry point to understand the current generation pipeline:
DocumentGenerationWorkfloworchestrates three specialized subagents- Each subagent handles outline planning, content writing, or final polish
- The workflow produces structured markdown output
Modify generation behavior
-
Choose the right mixin for your change Each mixin handles a specific stage:
OutlineStageMixin— controls documentation structure planningWriteStageMixin— handles content generationPolishStageMixin— manages final review and formattingChunkedGenerationMixin— breaks large codebases into manageable piecesDocGenCostMixin— tracks token usage and generation costs
-
Update the workflow configuration Modify
default_context()inDocumentGenerationWorkflowto change:- Which subagents run in the pipeline
- Default parameters for each generation stage
- Cost limits or chunking thresholds
-
Customize the output format Edit
format_doc_gen_report()inreport_formatter.pyto change:- Report structure and sections
- How generation results are displayed
- Progress indicators or completion status
Test your changes
-
Run the doc generation tests
pytest -k "doc_gen" -v -
Verify workflow execution Test the complete pipeline by running:
python -m attune.workflows.document_gen --path ./test_module
You know the changes work when the workflow executes without errors and produces documentation in the expected format with your modifications applied.
Key files to modify
src/attune/workflows/document_gen/workflow.py— Main workflow orchestrationsrc/attune/workflows/document_gen/report_formatter.py— Output formatting- Individual mixin files for stage-specific behavior changes