Skip to content

feat: add docs-sync hook and agents for automatic doc updates#1098

Open
iamcxa wants to merge 8 commits intomainfrom
feature/docs-sync
Open

feat: add docs-sync hook and agents for automatic doc updates#1098
iamcxa wants to merge 8 commits intomainfrom
feature/docs-sync

Conversation

@iamcxa
Copy link
Contributor

@iamcxa iamcxa commented Feb 3, 2026

Summary

Add a Claude Code hook + agent system that detects CLI code changes and automatically triggers documentation updates for recce-docs.

How it works:

  1. Stop hook detects when recce/ or recce_cloud/ files are modified (especially cli.py)
  2. Hook outputs a trigger message that activates the docs-sync-scanner agent
  3. Scanner analyzes changes and asks user if docs need updating
  4. If approved, docs-sync-writer agent updates docs and creates a PR

Key features:

  • Uses auto-invoked agents (no plugin installation required)
  • Team members get functionality automatically via git pull
  • CLI changes (cli.py) trigger mandatory docs review
  • Other code changes trigger optional review

User Setup

  1. Set export RECCE_DOCS_PATH=/path/to/recce-docs in shell profile or .envrc
  2. Ensure gh CLI is authenticated

If RECCE_DOCS_PATH is unset, the feature is silently disabled.

Files

Core:

  • .claude/settings.json — Stop hook configuration
  • .claude/hooks/docs-sync-check.sh — Bash script that detects code changes
  • .claude/agents/docs-sync-scanner.md — Haiku agent for change triage
  • .claude/agents/docs-sync-writer.md — Sonnet agent for writing docs and creating PR

Optional plugin (for Task tool integration):

  • .claude/plugins/docs-sync/ — Plugin structure if explicit Task invocation is preferred

Test Plan

  • Set RECCE_DOCS_PATH to local recce-docs repo
  • Make a change to recce/cli.py (e.g., add a command)
  • End the conversation to trigger Stop hook
  • Verify scanner agent activates and analyzes changes
  • Approve docs update when prompted
  • Verify writer agent creates PR in recce-docs

🤖 Generated with Claude Code

@iamcxa iamcxa force-pushed the feature/docs-sync branch from 6a6a983 to 91bbb8a Compare February 3, 2026 09:12
Add a Claude Code hook + skill system that detects recce_cloud/ changes
and creates PRs to update recce-docs:

- Hook: NotificationShown trigger checks for recce_cloud/ changes
- Scanner skill: haiku-based triage to assess if docs need updating
- Writer skill: sonnet-based writer that edits docs and opens PR

Requires RECCE_DOCS_PATH env var to be set. If unset, the feature
is silently disabled.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Kent <iamcxa@gmail.com>
@iamcxa iamcxa force-pushed the feature/docs-sync branch from 91bbb8a to 3a4b474 Compare February 3, 2026 09:15
iamcxa and others added 5 commits February 3, 2026 18:06
- Replace skills with agents that run autonomously via Task tool
- Scanner subagent (haiku) for lightweight triage
- Writer subagent (sonnet) with pre-approved git permissions
- Update settings.json with default permissions for git/gh operations
- Update hook to instruct spawning subagent instead of running skill

This reduces user prompts during routine documentation updates.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Kent <iamcxa@gmail.com>
NotificationShown is not a valid Claude Code hook event.
Use Stop event which fires when Claude finishes responding.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Kent <iamcxa@gmail.com>
Claude Code hooks require nested structure:
- matcher: {} (empty for all events)
- hooks: [{type: "command", command: "..."}]

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Kent <iamcxa@gmail.com>
Stop event doesn't support matchers - it always fires.
Correct format: hooks array without matcher field.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Kent <iamcxa@gmail.com>
- recce/ contains the recce CLI (OSS)
- recce_cloud/ contains the recce-cloud CLI

Both directories contain user-facing code that may need documentation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Kent <iamcxa@gmail.com>
@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 54.54545% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
recce/cli.py 54.54% 5 Missing ⚠️
Files with missing lines Coverage Δ
recce/cli.py 49.42% <54.54%> (+<0.01%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@iamcxa iamcxa force-pushed the feature/docs-sync branch from d5998f7 to e113846 Compare February 3, 2026 11:22
iamcxa and others added 2 commits February 3, 2026 22:36
- Convert agents to YAML frontmatter format for Claude Code compatibility
- Enhance hook to require docs update when CLI files are modified
- Add docs-sync plugin structure for Task tool integration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Kent <iamcxa@gmail.com>
- Remove Task tool dependency from hook
- Simplify agent descriptions for auto-triggering
- Hook now outputs message that triggers agent description
- Team members get functionality automatically via git pull

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Kent <iamcxa@gmail.com>
@iamcxa iamcxa marked this pull request as ready for review February 4, 2026 01:05
@kiloconnect
Copy link

kiloconnect bot commented Feb 4, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (7 files)
  • .claude/agents/docs-sync-scanner.md
  • .claude/agents/docs-sync-writer.md
  • .claude/hooks/docs-sync-check.sh
  • .claude/plugins/docs-sync/.claude-plugin/plugin.json
  • .claude/plugins/docs-sync/agents/docs-sync-scanner.md
  • .claude/plugins/docs-sync/agents/docs-sync-writer.md
  • .claude/settings.json
  • docs/plans/2026-02-03-docs-sync-design.md

@iamcxa iamcxa requested a review from even-wei February 4, 2026 01:21
@iamcxa iamcxa self-assigned this Feb 4, 2026
@iamcxa iamcxa changed the title feat: add docs-sync hook and skills for automatic doc updates feat: add docs-sync hook and agents for automatic doc updates Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant