Skip to content

docs: add codebase docs and agent guidance - #612

Open
lessthanjacob wants to merge 10 commits into
mainfrom
js/agent-context-docs
Open

lessthanjacob wants to merge 10 commits into
mainfrom
js/agent-context-docs

Conversation

@lessthanjacob

@lessthanjacob lessthanjacob commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds documentation to improve context for agents (and humans) working in the codebase.

Written by the author.

Changes

Added

  • Codebase docs: docs/ adds an architecture explanation, configuration and extension-point references, and how-tos for making changes, testing, releasing, and writing docs, indexed in docs/index.md.
  • Agent guidance: AGENTS.md sets hard rules, verification gates, and gotchas, and points agents to docs/index.md first.
  • Doc trust fields: each doc carries a Diátaxis type plus OKF generated / verified frontmatter, so a reader can tell whether a person checked it against the code since its last change.

Changed

  • Public API by tag: Transformer and AutoExtractor drop their @api private tags, and the private AutoExtractor#extractor is tagged @api public, since the README has users subclass both and override extractor.

Fixed

  • Red CI on main: the Metrics/ClassLength exemption for ViewCollection moves from an inline disable/enable pair, which Style/DirectiveScope now flags, to .rubocop.yml.

Context

Why This Approach
  • Docs
    • Design rationale sits next to the mechanism it explains in architecture.md, not in separate decision records, so it changes in the same edit as the mechanism.
    • docs/index.md is a hand-maintained table rather than generated, so there is no task or script to maintain for seven docs.
    • No directory-structure listing: it goes stale with every new file, and the index plus architecture.md cover where things live.
  • Public API tags
    • Public API is defined by @api tags and the README, not Ruby visibility: nearly everything in Ruby is reachable, so visibility can't mark a compatibility boundary.
    • Retagging Transformer and AutoExtractor avoids carrying a "documented beats tagged" exception in the docs.
  • Lint fix
    • It ships here because Test on main has failed on Style/DirectiveScope since d1e407b, so no PR can go green without it.
    • The exemption moves to .rubocop.yml instead of a # rubocop:disable-next directive: the Gemfile allows rubocop ~> 1.44, and the installed 1.88.2 doesn't recognize disable-next (1.91.0 does).
Testing: CI green on fa9a100 (Ruby 3.1–4.0, CodeQL, DCO); all three diagrams render
  • ✅ CI on fa9a100: test passes on Ruby 3.1, 3.2, 3.3, and 4.0; CodeQL and DCO pass.
  • ✅ bundle exec rake locally on 4fdf9b9 (later commits touch only CHANGELOG.md and Markdown under docs/ and AGENTS.md): 395 examples, 0 failures; RuboCop reports no offenses.
  • ✅ Each Mermaid diagram in architecture.md renders with @mermaid-js/mermaid-cli@11 at 6322b47. Before that commit, the sequence diagram failed to parse because ; in a message label ends the statement.
  • ✅ Every relative link and anchor in AGENTS.md and docs/ resolves, each docs/index.md row matches its doc's frontmatter, and all frontmatter loads with plain YAML.safe_load.
  • ✅ Every path, symbol, behavior claim, and code example in docs/ was checked against the code, with each example run. Wrong claims were corrected and unsupported rationale removed.
  • ✅ The author reviewed all seven docs against the code, recorded in each doc's verified field.

Checklist

  • I have updated the necessary documentation
  • I have signed off all my commits as required by DCO
  • My build is green

current as of fa9a100

🤖 Generated with Claude Code

lessthanjacob and others added 7 commits October 21, 2026 18:29
A recent RuboCop release added Style/DirectiveScope, which flags the
disable/enable pair wrapping ViewCollection. The Gemfile allows any
1.x RuboCop and .rubocop.yml enables new cops, so CI picked it up and
has failed on main since the #603 dependency bump.

Excluding the file in .rubocop.yml instead of using the newer
disable-next directive keeps the exemption working on older RuboCop
versions the Gemfile still allows.

Co-authored-by: claude-code/claude-opus-5-5 <noreply@anthropic.com>
Signed-off-by: Jacob Sheehy <jacobjsheehy@gmail.com>
Contributors and coding agents had only the README and CONTRIBUTING.md
to go on, neither of which explains how a render works internally or
what a change to lib/ has to preserve. The new docs cover the
definition/compilation/render model, configuration timing, extension
contracts, where each kind of change belongs, testing, and releasing.

AGENTS.md (loaded via CLAUDE.md) carries the rules and verification
gates an agent must follow. Each doc under docs/ has Diataxis type
frontmatter plus OKF generated/verified trust fields, so readers can
tell whether a person has checked it against the code since its last
change.

Co-authored-by: claude-code/claude-opus-5-5 <noreply@anthropic.com>
Signed-off-by: Jacob Sheehy <jacobjsheehy@gmail.com>
The docs under docs/ serve anyone working in the codebase, including
maintainers and agents, not only outside contributors. The README
already covers users, so no qualifier is needed.

Co-authored-by: claude-code/claude-opus-5-5 <noreply@anthropic.com>
Signed-off-by: Jacob Sheehy <jacobjsheehy@gmail.com>
Mermaid's sequence-diagram parser treats ";" as a statement separator,
so four message labels split mid-line and mermaid-cli 11 failed to
render the diagram. Commas keep the same meaning and parse everywhere.

Co-authored-by: claude-code/claude-opus-5-5 <noreply@anthropic.com>
Signed-off-by: Jacob Sheehy <jacobjsheehy@gmail.com>
Ruby visibility doesn't mark a compatibility boundary, and two classes
the README tells users to subclass, Transformer and AutoExtractor, were
tagged @api private. Untag both, and tag the private
AutoExtractor#extractor @api public since the README has subclasses
override it. The docs and AGENTS.md now define public API as everything
not tagged @api private that users call, subclass, or override.

Co-authored-by: claude-code/claude-opus-5-5 <noreply@anthropic.com>
Signed-off-by: Jacob Sheehy <jacobjsheehy@gmail.com>
Co-authored-by: claude-code/claude-opus-5-5 <noreply@anthropic.com>
Signed-off-by: Jacob Sheehy <jacobjsheehy@gmail.com>
Co-authored-by: claude-code/claude-opus-5-5 <noreply@anthropic.com>
Signed-off-by: Jacob Sheehy <jacobjsheehy@gmail.com>
AutoExtractor#extractor gained an @api public tag; it never had an @api private one to remove.

Co-authored-by: claude-code/claude-opus-5-5 <noreply@anthropic.com>
Signed-off-by: Jacob Sheehy <jacobjsheehy@gmail.com>
@lessthanjacob
lessthanjacob marked this pull request as ready for review October 21, 2026 23:36
@lessthanjacob
lessthanjacob requested review from a team and ritikesh as code owners October 21, 2026 23:36
lessthanjacob and others added 2 commits October 21, 2026 19:37
An append-only verified list grows with every re-review without adding
information the trust rule uses, which only reads each reviewer's
latest date. A re-review now updates the reviewer's existing entry, and
git history keeps the earlier dates.

Co-authored-by: claude-code/claude-opus-5-5 <noreply@anthropic.com>
Signed-off-by: Jacob Sheehy <jacobjsheehy@gmail.com>
Co-authored-by: claude-code/claude-opus-5-5 <noreply@anthropic.com>
Signed-off-by: Jacob Sheehy <jacobjsheehy@gmail.com>

This branch has not been deployed

No deployments
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