Skip to content

Feature/docs updater workflow#117

Open
csoceanu wants to merge 17 commits into
ambient-code:mainfrom
csoceanu:feature/docs-updater-workflow
Open

Feature/docs updater workflow#117
csoceanu wants to merge 17 commits into
ambient-code:mainfrom
csoceanu:feature/docs-updater-workflow

Conversation

@csoceanu
Copy link
Copy Markdown

Summary

Add a new workflow that analyzes code changes and discovers which documentation files need updating. It extracts identifiers from the diff, searches docs for matches, evaluates staleness through a two-pass review, generates minimal format-aware updates, and opens a docs PR.

  • Works with any text-based doc format
  • Docs can live in a separate repo or a subfolder alongside the code
  • Optional /index command builds semantic indexes for large docs locations so future runs are faster and use fewer tokens

Files

  • .ambient/ambient.json — workflow config
  • .claude/skills/controller/SKILL.md — phase management (setup → review → update → PR)
  • .claude/skills/discovery/SKILL.md — identifier extraction, grep-based search, two-pass evaluation
  • .claude/skills/generation/SKILL.md — format-aware content generation with decision logic
  • .claude/skills/pr/SKILL.md — PR creation (copied from bugfix workflow)
  • .claude/commands/index.md — standalone command for building semantic indexes
  • CLAUDE.md — behavioral guidelines
  • README.md — user documentation

Testing

Load as a Custom Workflow in ACP:

Field Value
URL https://github.com/csoceanu/workflows.git
Branch feature/docs-updater-workflow
Path workflows/docs-updater

csoceanu and others added 15 commits May 11, 2026 14:25
Add a new ACP workflow that analyzes code changes and discovers which
documentation files need updating. Uses identifier matching and grep
for discovery, with optional semantic indexing for large repos.

Includes skills for discovery, generation, PR creation, and a
controller for phase management.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Discovery: exclude auto-generated files (DO NOT EDIT markers, generator
scripts) from candidates to reduce false positives.

Generation: read source code for context when the diff alone is
insufficient, flag for human review when behavior is unclear.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use recursive find for hashing files in subdirectories
- Split folders with 50+ files into sub-indexes (firm rule, not suggestion)
- Support configurable output path for indexes
- Use Agent tool explicitly for subagent dispatch (3+ folders)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Generation skill now explicitly shows the diff of each change in apply
mode so users see what was modified without having to ask.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Controller: explain indexing trade-off upfront (takes time, only worth
it if committed for reuse).

Discovery: when indexes exist, use file summaries to narrow to specific
files instead of reading all files or falling back to grep.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Strengthen controller instructions to require AskUserQuestion (not
plain text) after setup. Add explanation of what indexing creates
so users can make an informed choice.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add CRITICAL prefix and explicit instructions to read and follow the
controller skill before doing anything else. Prevents Claude from
improvising its own flow or using plain text instead of AskUserQuestion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Indexing is only worth the cost on large repos (10+ doc folders).
Update controller to explain the benefit clearly: faster future runs
when indexes are committed, not just "takes time and tokens."

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add /index as a command so it shows up in ACP command picker and can
  be run independently
- Remove index-build mode from discovery skill (now in the command)
- Remove slash notation from controller phases — present as plain
  descriptive options in AskUserQuestion
- Update all files for consistency

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Make the manifest schema explicit: must store individual file hashes,
not just file counts. This enables incremental rebuilds — only folders
with changed files get re-indexed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add /index to the startupPrompt so users know it exists. Explain
benefits (faster, fewer tokens, conceptual matches) and note it's
only recommended for large docs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Change from "mention" to "include in the list" so /index appears as
a bullet point alongside the other capabilities, not as a separate
"About" section.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Description no longer implies indexes are always used
- Remove hardcoded format list (md/adoc/rst) — supports any text format
- Generation skill uses "Review"/"Update" not slash notation
- Troubleshooting no longer limits to specific file types

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove remaining slash notation from generation skill and README
- Use "docs locations" instead of "repos" for consistency
- Remove misplaced indexing advice from discovery skill

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

Warning

Rate limit exceeded

@csoceanu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 44 minutes and 45 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: f207d2e1-93d9-45a0-b418-e41b9a94fc6e

📥 Commits

Reviewing files that changed from the base of the PR and between 4fa511e and 592bdf1.

📒 Files selected for processing (4)
  • workflows/docs-updater/.claude/commands/index.md
  • workflows/docs-updater/.claude/skills/discovery/SKILL.md
  • workflows/docs-updater/.claude/skills/generation/SKILL.md
  • workflows/docs-updater/.claude/skills/pr/SKILL.md

Walkthrough

Introduces a complete documentation automation workflow ("Docs Updater") with orchestration, discovery, generation, and PR-creation skills. Includes workflow specification, skill definitions, configuration, and supporting commands for discovering stale docs, updating them based on code changes, and creating pull requests.

Changes

Docs Updater Workflow

Layer / File(s) Summary
Workflow overview and configuration
workflows/docs-updater/README.md, workflows/docs-updater/CLAUDE.md, workflows/docs-updater/.ambient/ambient.json
README explains end-to-end phases (Review → Update → Open PR), supported formats, directory structure, and troubleshooting. CLAUDE.md defines three-phase workflow principles (targeted/minimal, format-aware), hard limits (no new files, no code changes), and safety rules (user confirmation, no uncertain updates). ambient.json provides assistant configuration with system/startup prompts and tool rules.
Controller phase orchestration
workflows/docs-updater/.claude/skills/controller/SKILL.md
Defines the controller skill that manages phase flow (Setup, Review, Update, Open PR), specifies Setup procedures for gathering code diff and docs location, prescribes standard phase execution (announce → run skill → present results → gate with AskUserQuestion), and lists required context payloads and controller rules (no auto-advance, track current directory).
Discovery phase: identifying stale docs
workflows/docs-updater/.claude/skills/discovery/SKILL.md
Specifies default discovery mode: receive diff and changed files, build identifier checklist from modified lines, enumerate candidate docs, grep for identifiers, evaluate candidates in two passes (quick scan, deep read), present confirmed results via user selection. Includes optional index-assisted mode using .doc-index/ to narrow which folders to inspect. Returns user-selected doc file paths to controller.
Generation phase: updating docs
workflows/docs-updater/.claude/skills/generation/SKILL.md
Defines documentation update logic: Preview vs Apply modes, formatting constraints (match existing format, raw file output only), per-file decision rules for whether and how to update, and precedence for user/global vs per-file instructions.
PR phase: creating and pushing
workflows/docs-updater/.claude/skills/pr/SKILL.md
Comprehensive PR creation skill covering auth detection, fork creation/sync (with workflow-file permission handling), feature branch creation, conventional commit staging, draft PR creation via gh pr create, and a multi-rung fallback ladder (GitHub compare URLs → manual workflows → patch files) plus error-recovery reference table.
Optional semantic indexing command
workflows/docs-updater/.claude/commands/index.md
Documents /index command for building semantic indexes per documentation folder, including per-file SHA256 hash tracking in .doc-index/manifest.json, sub-index generation, folder summaries, and index persistence upon commit/push.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Feature/docs updater workflow' directly describes the main change: a new workflow for updating documentation based on code changes.
Description check ✅ Passed The description clearly explains the workflow's purpose, key features, files added, and testing instructions, all directly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
workflows/docs-updater/.claude/commands/index.md (1)

6-53: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add required command sections (Purpose, Prerequisites, Output).

This command spec is missing required structural sections, and the output section should explicitly state artifact locations (for example .doc-index/manifest.json and folder index files under .doc-index/).

As per coding guidelines: “Command Markdown files must include: heading with command name and short description, Purpose section, Prerequisites section, Process section with numbered steps, and Output section specifying artifact locations”.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@workflows/docs-updater/.claude/commands/index.md` around lines 6 - 53, The
command spec is missing required sections; add a Purpose section briefly
describing what the command does, a Prerequisites section listing required
context (e.g., repository access, target docs path, write permissions), and an
Output section that explicitly states produced artifacts and locations (for
example: .doc-index/manifest.json and per-folder index files under
.doc-index/<folder>/...), while preserving the existing Process steps and
ensuring the manifest format and per-file SHA256 requirement
(.doc-index/manifest.json, "folders", and "doc_hashes") are mentioned in the
Output description.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@workflows/docs-updater/.claude/commands/index.md`:
- Around line 37-51: The JSON fenced code block in the markdown (the
triple-backtick ```json ... ``` block) lacks blank lines before and after;
update the markdown in workflows/docs-updater/.claude/commands/index.md by
adding one blank line immediately before the opening ```json fence and one blank
line immediately after the closing ``` fence so the code block is separated from
surrounding text and satisfies Markdown linting rules.
- Around line 23-31: When .doc-index/manifest.json exists the incremental logic
only compares hashes for folders already listed and misses newly added doc
folders; after loading and comparing manifest entries (Step 2) run the same docs
scan used in Step 3 to collect current folders and add any folders not present
in manifest.json to the rebuild set so they are rebuilt, then proceed with
subfolder indexing (Step 4) and dispatching (Step 5); ensure the manifest
(manifest.json) is updated after rebuild to include the new folder entries and
their hashes.

In `@workflows/docs-updater/.claude/skills/discovery/SKILL.md`:
- Around line 74-76: The grep call inside the for loop (for id in "identifier1"
...) uses regex matching which misinterprets identifiers containing
metacharacters; update the grep invocation in that block (the line assigning
matches=$(grep -rl "$id" {docs_root} ... 2>/dev/null)) to use fixed-string
matching by adding -F (and add -w if you want to restrict to whole-word matches)
while preserving -r -l and the existing --include patterns and stderr
redirection.

In `@workflows/docs-updater/.claude/skills/generation/SKILL.md`:
- Around line 35-37: The decision gate text "Does the diff add something NEW
that should be documented?" and its NO_UPDATE_NEEDED branch is too narrow and
must be changed: update the gate logic (the decision label and any code that
references NO_UPDATE_NEEDED) to detect not only additive changes but also
removals, renames, and behavior/API changes that would make existing docs
incorrect; specifically, replace the check that only looks for added files/lines
with a broader predicate that flags deleted/renamed files, changed public APIs,
or behavioral changes referenced by docs, and ensure the downstream path that
currently skips updates (NO_UPDATE_NEEDED) only applies when the diff truly has
no impact on documentation accuracy.

In `@workflows/docs-updater/.claude/skills/pr/SKILL.md`:
- Around line 490-492: The PR body artifact path is hard-coded as
"docs/pr-description.md" which can resolve to the repo docs folder instead of
the workflow artifact directory; update all occurrences that reference the
literal "docs/pr-description.md" to construct the path from the workflow
artifact directory variable (e.g., artifactsDirectory or artifactDir) using a
normalized join (eg. path.join(artifactDir, 'pr-description.md') or
actions/core/normalizePath equivalent) so the code reads/writes the file inside
the workflow artifact directory; apply this change for every mention of
"docs/pr-description.md" (the instances called out and any others) and ensure
the code checks existence against the computed artifact path before appending.
- Around line 378-380: The fenced code block containing the text "refusing to
allow a GitHub App to create or update workflow `.github/workflows/foo.yml`
without `workflows` permission`" should be updated to include a language tag
(e.g., ```text or ```bash) and be surrounded by blank lines before and after the
fenced block; apply the same change to the other identical/unlabeled fenced
block later in the file (the one referenced at lines showing the same quoted
string) so both blocks conform to the markdown linting rules.

---

Outside diff comments:
In `@workflows/docs-updater/.claude/commands/index.md`:
- Around line 6-53: The command spec is missing required sections; add a Purpose
section briefly describing what the command does, a Prerequisites section
listing required context (e.g., repository access, target docs path, write
permissions), and an Output section that explicitly states produced artifacts
and locations (for example: .doc-index/manifest.json and per-folder index files
under .doc-index/<folder>/...), while preserving the existing Process steps and
ensuring the manifest format and per-file SHA256 requirement
(.doc-index/manifest.json, "folders", and "doc_hashes") are mentioned in the
Output description.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 7aff8f64-5cb0-4e9c-8b81-b0b29990591e

📥 Commits

Reviewing files that changed from the base of the PR and between 65b811e and 4fa511e.

📒 Files selected for processing (8)
  • workflows/docs-updater/.ambient/ambient.json
  • workflows/docs-updater/.claude/commands/index.md
  • workflows/docs-updater/.claude/skills/controller/SKILL.md
  • workflows/docs-updater/.claude/skills/discovery/SKILL.md
  • workflows/docs-updater/.claude/skills/generation/SKILL.md
  • workflows/docs-updater/.claude/skills/pr/SKILL.md
  • workflows/docs-updater/CLAUDE.md
  • workflows/docs-updater/README.md

Comment thread workflows/docs-updater/.claude/commands/index.md
Comment thread workflows/docs-updater/.claude/commands/index.md
Comment thread workflows/docs-updater/.claude/skills/discovery/SKILL.md
Comment thread workflows/docs-updater/.claude/skills/generation/SKILL.md Outdated
Comment thread workflows/docs-updater/.claude/skills/pr/SKILL.md Outdated
Comment thread workflows/docs-updater/.claude/skills/pr/SKILL.md
csoceanu and others added 2 commits May 13, 2026 13:23
- index command: add Purpose/Prerequisites/Output sections, detect
  newly added folders not in manifest, fix blank lines around JSON block
- discovery skill: use grep -rFl for fixed-string matching to avoid
  regex metacharacter issues
- generation skill: broaden decision gate to cover removals, renames,
  and behavior changes (not just additions)
- pr skill: add language tag to unlabeled code block

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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