Documentation Bot plugin
Documentation Bot plugin
Overview
The Documentation Bot plugin automatically updates project documentation whenever
code changes during a Claude Code session. It uses a Stop event hook that fires
when a session ends, detects what files were modified via git diff, and invokes
a documentation agent to update architecture docs, API references, READMEs, and
changelogs.
The plugin is universal -- it works with any Claude Code session, not just Dr. Zero iterations. It integrates with Dr. Zero when both are installed, coordinating to avoid duplicate documentation updates.
Version: 7.3.0 Author: Thomas Hudak
Installation
claude plugin install documentation-bot@otc-awesome-llm
No additional dependencies are required. The plugin uses a shell script hook
that relies only on git and the Claude Code agent system.
How it works
The plugin operates through a lifecycle hook bound to the Stop event:
Claude Code session ends
|
v
Stop event fires
|
v
Hook checks: Were Write or Edit tools used?
|-- No --> Exit (no documentation needed)
|-- Yes
v
Run git diff to identify changed files
|
v
Filter trivial changes (<5 lines by default)
|-- Trivial --> Exit (skip documentation)
|-- Significant
v
Prompt user for confirmation (or auto-run if configured)
|
v
Invoke meeseeks-documentation agent with git diff context
|
v
Agent updates: architecture.md, API docs, README.md, CHANGELOG.md
Trigger condition
The hook fires when the session's tool usage includes Write or Edit,
indicating that code was modified during the session:
event: Stop
when: '${CONTEXT.tools_used} includes "Write" or ${CONTEXT.tools_used} includes "Edit"'
Smart filtering
The plugin skips documentation updates for:
- Trivial changes (fewer than 5 lines modified by default).
- Documentation-only file types (
.md,.txt,.json,.yaml). - Sessions where fewer than the minimum number of files were changed.
Configuration
Create a configuration file at ~/.claude/plugins/documentation-bot/config.yaml:
# Documentation Bot configuration
auto_run: false # true = auto-run without prompting, false = ask first
skip_trivial: true # Skip if fewer than 5 lines changed
skip_extensions: # File types that do not trigger documentation updates
- .md
- .txt
- .json
- .yaml
min_files_changed: 1 # Minimum number of files changed to trigger
Auto-run mode
Set auto_run: true to update documentation without prompting:
auto_run: true
In auto-run mode, the bot updates documentation silently after every qualifying session.
Adjusting the trivial-change threshold
To document all changes regardless of size:
skip_trivial: false
Or lower the threshold:
min_lines_changed: 3
Custom documentation agent
The plugin invokes the meeseeks-documentation agent by default. To use a
custom agent:
agent_name: my-custom-doc-agent
Your custom agent should be defined as a standard Claude Code agent markdown file with instructions for how to update documentation based on code changes.
Usage examples
Interactive mode (default)
$ claude "Add user authentication"
... (Claude writes auth code) ...
Session complete! 8 files changed.
Documentation Bot
----------------------------------------------------
Files changed: 8
Lines changed: 245 insertions(+), 12 deletions(-)
Code files modified:
- src/auth/login.py
- src/auth/session.py
- src/models/user.py
Update documentation? (y/n): y
Invoking documentation agent...
Documentation updated successfully!
Documentation files updated:
- docs/architecture.md
- docs/api/auth.md
- README.md
- CHANGELOG.md
Auto-run mode
$ claude "Refactor user service"
... (Claude refactors code) ...
Session complete! 3 files changed.
Documentation bot auto-updating...
Documentation updated: docs/architecture.md, CHANGELOG.md
Trivial change (skipped)
$ claude "Fix null pointer in user login"
... (Claude fixes bug, 3 lines changed) ...
Session complete! 1 file changed.
Trivial changes (3 lines) - skipping documentation bot
Integration with Dr. Zero
When both Documentation Bot and Dr. Zero are installed, they coordinate to avoid running duplicate documentation updates:
- The Dr. Zero post-iteration hook runs first (for high-quality iterations with a solver reward above 0.7).
- The universal Documentation Bot hook checks whether Dr. Zero already handled documentation.
- If Dr. Zero ran, the universal hook skips. Otherwise, it provides fallback documentation for low-quality iterations or non-Dr. Zero sessions.
This coordination ensures that every qualifying code change gets documented exactly once.
Security
The hook implementation includes:
- Command injection protection -- Uses HERE-documents with single quotes to prevent variable expansion attacks.
- Path traversal validation -- Checks for
..in file paths. - Bash arrays -- Proper quoting to handle filenames with spaces.
- Input sanitization -- All git command inputs are sanitized.
Disabling the plugin
Temporarily disable without uninstalling:
# ~/.claude/plugins/documentation-bot/config.yaml
enabled: false
Or uninstall completely:
claude plugin remove documentation-bot
Debugging
Enable debug logging to troubleshoot hook behavior:
export CLAUDE_PLUGIN_DEBUG=1
claude "Make some changes"
# Check logs
cat ~/.claude/logs/plugin-documentation-bot.log
Common issues
| Symptom | Cause | Fix |
|---|---|---|
| Hook not firing | Stop event not triggering | Check that Write or Edit tools were used; enable CLAUDE_PLUGIN_DEBUG=1 |
| Agent not found | meeseeks-documentation agent missing | Install the Dr. Zero plugin (claude plugin install drzero@otc-awesome-llm) which includes the agent |
| No git repository | Hook requires git context | Ensure you are working inside an initialized git repository |
| Trivial changes ignored | Threshold too high | Set skip_trivial: false or lower min_lines_changed in config |
Related
- Plugin catalog -- Overview of all available plugins
- Dr. Zero plugin -- Autonomous improvement system that coordinates with Documentation Bot