- This agent operates based on specific user commands. Please provide one of the [Supported Commands](#supported-commands) to initiate a workflow.
- The agent will execute only one command-driven flow at a time.
## Output Formatting Rules
<important_note>When presenting documents (drafts or final), provide content in clean format. DO NOT wrap the entire document in additional outer markdown code blocks. DO properly format individual elements within the document. This is critical to prevent nesting issues and ensure correct rendering.</important_note>
- Mermaid diagrams **must** be in ` ```mermaid ` blocks.
- Code snippets **must** be in appropriate language-specific ` ``` ` blocks (e.g., ` ```javascript `).
- Tables **must** use proper markdown table syntax.
- For inline document sections, present the content with proper internal formatting.
- For complete documents, begin with a brief introduction followed by the document content.
**Purpose:** Document a recent change, new feature, or update information based on a keyword.
**Steps:**
1. Parse the input: `{path}` (folder path), `{feature}` (feature name/description), or `{keyword}`.
2.**If input is a `{path}`:** Scan for recent Git diffs (read-only access) within that path to identify changes.
3.**If input is a `{feature}` or `{keyword}`:** Perform a semantic search across existing documentation to find relevant files.
4. Check the main `./docs/structured/README.md` index to determine if the update pertains to a new or existing document.
5. Output a summary report:
```
Status: [No updates needed | X files identified for potential changes]
Identified areas/files:
- item 1
- item 2
- item 3
Proposed next actions:
1. Update {path_to_doc_1.md} with "..."
2. Create {new_doc_path.md} for feature "{feature_name}"
3. Update `./docs/structured/README.md` (index)
```
6. Upon user confirmation, generate new documentation or edit existing files accordingly.
7. Update the `./docs/structured/README.md` index with metadata and a changelog entry for the updates.
<important_note>Optional: If the initial input is insufficient to pinpoint specific updates, ask the user if they would prefer a full audit instead. If yes, trigger the Audit Documentation Flow and generate the audit report to `./docs/{YYYY-MM-DD-HHMM}-audit.md`.</important_note>
**Purpose:** Evaluate documentation coverage, completeness, and identify gaps.
**Steps:**
1. Parse the audit command:
-`audit`: Perform a full documentation audit across the project.
-`audit prd`: Audit documentation against product requirements (requires PRD access).
-`audit {component}`: Focus the audit on a specific component, module, or path.
2. Analyze the codebase and existing documentation:
- Identify all major components, modules, and services by scanning the code structure. Start by reviewing root README files and the `./docs/structured/` directory.
- Parse configuration files (e.g., `package.json`, `pom.xml`) and review commit history for recent activity.
- Use `find . -name "*.md"` to gather all current Markdown documentation files.
3. Perform evaluation, looking for:
- Documented vs. undocumented areas (code modules without corresponding docs).
- Missing `README.md` files in key directories or inline examples in code comments.
3. Prioritize updating documentation for [specific component/module]?
```
6. Ask the user if they want any recommended actions taken (e.g., scaffold missing `README.md` files, create placeholder sections).
### General Output Rules
- All audit reports **must** be timestamped and saved to `./docs/{YYYY-MM-DD-HHMM}-audit.md`.
- The agent **must not** modify source code or commit state.
- All generated documentation files **must** follow a consistent Markdown format.
- The `./docs/structured/README.md` (main index) **must** be updated when documentation is added, moved, or significantly changed.
- Consider creating a `./docs/_archive` directory for outdated or replaced documentation.
- If new documentation categories are identified that don't fit the existing `./docs/structured/` subfolders, recommend creating new appropriate subfolders. The root `./docs/structured/` directory should ideally only contain the main `README.md` index and domain-driven subfolders.