Updates CLAUDE.md based on recent project changes. Use when user says "update docs", "add to CLAUDE.md", "document this", or runs /update-docs command.
Maintains project documentation by analyzing git history and syncing CLAUDE.md, help.md, botfather_commands.txt, and other docs with code changes.
git log -1 --format="%H" -- CLAUDE.md → find baselinegit diff <hash>..HEAD --name-only → list changed files# Find last CLAUDE.md commit
git log -1 --format="%H" -- CLAUDE.md
# Get all changes since then
git diff <last-claude-commit>..HEAD --name-only
git log <last-claude-commit>..HEAD --oneline
If CLAUDE.md not in git (new file or untracked):
Ask user: "CLAUDE.md isn't tracked in git. How long since it was last updated?"
Options:
git log --since="1 week ago" --oneline --name-onlygit log --since="1 month ago" --oneline --name-onlygit log --since="YYYY-MM-DD" --oneline --name-onlyRead the actual CLAUDE.md first. Extract:
## and ### section headingsBuild a dynamic mapping: changed file → relevant section(s)
Example discovery:
Sections found:
- "## Configuration" mentions: config.py, .env, environment variables
- "## Middleware System" mentions: middlewares.py, filters.py
- "## Project Structure" lists: all module files
→ If middlewares.py changed, update "Middleware System" + "Project Structure"
For each affected area:
When analyzing changes, also check these files:
| Changed Files | Documentation to Update |
|---|---|
New /command handler in auth.py, agent.py, etc. |
notes/help.md, deploy/botfather_commands.txt |
| New user-facing agent tool | notes/help.md (if users need to know about it) |
| Authorization or onboarding flow changes | notes/about.md |
| User-facing features | notes/changelog.md ([Latest additions] section) |
Detection hints:
@router.message(Command('...')) → likely needs help.md + botfather_commands.txtcustom_tools/ → check if user-facing or agent-internalPresent to engineer:
Changes detected since last CLAUDE.md update (<commit>):
**Files changed:**
• path/to/file.py - <brief description of change>
• path/to/new_module.py - NEW FILE
**Sections to UPDATE:**
• [Section Name] - reason
└─ files: x.py, y.py
**Potential NEW sections:**
• [Proposed Title] - would document X
└─ files: new_module.py
**Other docs to update:**
• notes/help.md - new /command added
• deploy/botfather_commands.txt - new /command added
• notes/changelog.md - user-facing feature
Which changes should I document?
Wait for engineer confirmation before proceeding.
After engineer approval:
git diff master -- CLAUDE.md
IMPORTANT: Run AFTER applying updates to catch:
If master differs:
git show master:CLAUDE.md → fetch master versionConflict strategy:
Before finalizing: