Skip to content

feat(docs): prose says only what the code cannot - #284

Merged
Ardnived merged 5 commits into
mainfrom
claude/docs-intent
Nov 20, 2026
Merged

Ardnived merged 5 commits into
mainfrom
claude/docs-intent

Conversation

@Ardnived

Copy link
Copy Markdown
Contributor

Summary

  • Docs sync stops asking for new prose on every change. Guides keep only what the code cannot say.
  • One shared rule, docs/documentation.md; review flags breaches as should-fix; the audit weighs docs.

Change outline

The rule — docs/documentation.md (new), story in docs/why.md#docs-say-what-the-code-cannot

One home per fact. Each sentence takes a three-question test:

  1. A behaviour-preserving refactor would change it → mechanism (symbols, constant values, file listings, retold tests, SHAs). Delete, or move a real why into a code comment.
  2. A bug fix or new edge case would change it → a list of conditions. Replace with a pointer to the code or test.
  3. Only a change of purpose would change it → keep: intent, invariants, ownership, contracts, gotchas, commands.

A never-delete list guards what auto-fix must not touch: ⚠ lines, sync pointers and #NNN, commands, embedding.md and CHANGELOG.md, a condition list without its replacement pointer, rejected alternatives.

No per-repo copies, unlike code-comments.md: a copy is a second home for a fact. Only skills apply this rule, and they read the claude-workflow checkout.

Where it bites

Step Before After
finalize-pr step 5 "Update what the diff makes stale, and document what it introduces." Fix or delete what is stale; add prose only for a new intent, contract or gotcha.
review-pr lens 1 Doc additions were not a finding. Restated fact, mechanism, or a test's condition list in added prose → should-fix on its line. address-review adopts it as it does any critic thread, so it is fixed before merge.
audit-code hygiene, docs vs reality Checked commands and paths only. Also runs doc-weight.mjs per repo, journals the number, and opens a doc-fix PR against the most-touched docs.

workflow/lib/doc-weight.mjs (new)

Doc share of changed lines over first-parent commits on origin/main, excluding lockfiles, binaries and each repo's generatedFiles; plus the most-touched docs and the heaviest commits. Local git only. Exits 1 only when git cannot answer.

Preview

No preview surface — prose and one lib script.

Test results

  • Lean gate: ✓ claude plugin validate ./workflow --strict, node --test workflow/lib/*.test.mjs — 147 pass (4 new)
  • rule-delta.mjs --base origin/main workflow/skills: 92 → 92, no directive disappeared
  • doc-weight.mjs against SahajAtlasWordpress, 10 weeks: DOC WEIGHT 9%, root AGENTS.md touched in 30 of 55 commits

Notes for reviewer

  • Failure this prevents: a fact restated across several docs, one copy missed, and an agent trusting the stale one. Evidence in why.md.
  • Security review: the diff touches securityReview.triggerPattern (skills, workflow/lib). No allowed-tools change; the script runs git log and git rev-parse read-only and reads .claude/workflow.json.
  • Sibling pilot: a SahajCloud PR applies the rule to its nested AGENTS.md guides, to test the rule on real text before the loop enforces it.
  • WeMeditateApp is out of scope. The loop does not work it, and its doc contract is its own.
  • The metric is tracked in the audit journal only, with no per-PR threshold, by the owner's choice.
Detail

Sample behind the change (last 40 merged PRs per repo, 2026-11-19): docs touched in 22–27 of 40 PRs in each product repo. Most-edited guides: WordPress AGENTS.md 21/40; SahajCloud src/AGENTS.md and scripts/AGENTS.md 8/40 each (largely file listings); SahajCloud#1203 explained a timer constant's restart logic in docs/rules/clients.md.

Rejected: stripping only mechanism and keeping condition lists. Feature and fix PRs change conditions by definition, so most of the churn would stay.

Rejected: a new audit angle. That is a loop-config.json change, and docs vs reality already owns docs.

🤖 Generated with Claude Code

Ardnived and others added 5 commits November 19, 2026 18:02
Docs sync only ever added prose. The rule gives it the other direction: one
home per fact, and a three-question test for what earns a sentence. No
per-repo copies: the rule is read from this checkout by the skills that apply
it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
"Document what it introduces" asked for prose on every change, so guides grew
with each PR and restated the code. Failure prevented: a fact copied into a
second doc that the next change misses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A should-fix on the line, so address-review adopts it and the restatement is
removed before merge. Failure prevented: over-documentation passing review
because nothing counted it as a defect.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
doc-weight.mjs reports the doc share of changed lines on main and the docs
touched most often. The audit journals the number and cleans up the hot docs
against the rule. Failure prevented: doc churn growing unseen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sydevs-bot

sydevs-bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running
✋ handed back: review-pr did not finish after 3 attempts

recent dispatches
  • 16:03Z review-pr · attempt 3 · session · timed out
  • 16:03Z review-pr · attempt 3 · session
  • 08:00Z review-pr · attempt 2 · session · timed out
  • 08:00Z review-pr · attempt 2 · session
  • 01:03Z review-pr · attempt 1 · session · timed out

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 20, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 20, 2026
@Ardnived
Ardnived merged commit ec2621f into main Nov 20, 2026
8 checks passed
@Ardnived
Ardnived deleted the claude/docs-intent branch November 20, 2026 01:25
@sydevs-bot sydevs-bot moved this from Working to Done in SYDevelopers Technical Roadmap Nov 20, 2026
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 20, 2026
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 20, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor

The session for review-pr did not finish after 3 attempts. I have stopped retrying. A @sydevs-bot verb or mention from you starts me again.

🤖 sydevs dispatcher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants