Skip to content

docs: rewrite AGENTS.md for clarity and density#821

Open
jeremyeder wants to merge 1 commit into
mostlygeek:mainfrom
jeremyeder:worktree-improve-claude-md
Open

docs: rewrite AGENTS.md for clarity and density#821
jeremyeder wants to merge 1 commit into
mostlygeek:mainfrom
jeremyeder:worktree-improve-claude-md

Conversation

@jeremyeder

@jeremyeder jeremyeder commented Jun 6, 2026

Copy link
Copy Markdown

Restructure AGENTS.md to be more scannable and adopt a progressive disclosure approach: keep high-frequency instructions (architecture, testing, workflow) inline, and move reference material (commit format, code review guidelines) into dedicated files under docs/.

Changes:

  • Add architecture section with directory layout map
  • Add prerequisites and local run command
  • Fix stale UI path (ui/ui-svelte/)
  • Consolidate testing commands into compact bullet list
  • Extract commit format rules into docs/commit-format.md
  • Extract code review guidelines into docs/code-review.md
  • Reference docs/ from AGENTS.md so agents load details on demand

Progressive disclosure:

AGENTS.md is loaded into every agent context window. By keeping it lean and linking to docs/ for less-frequently-needed reference material, agents get the essentials immediately and can read the detailed docs only when relevant (e.g., before committing or reviewing code). This reduces baseline token cost while preserving all the information.

Context window impact:

Tokens (est.) Notes
AGENTS.md before ~514 everything inlined
AGENTS.md after ~424 essentials only
docs/ files ~206 loaded on demand
Baseline reduction ~90 (17.5%) saved per agent session

The 32.6% word count reduction (340 → 229 words) also improves information density — more actionable content per token for the model to attend to.

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR updates the repository's contributor documentation by restructuring the main AGENTS.md guide and introducing two new focused documentation files. The new docs/commit-format.md defines commit message structure and pull request rules, while docs/code-review.md codifies code review severity levels and practices. AGENTS.md is comprehensively reorganized with clearer sections and updated command/path references, and now links to these new documentation files rather than inlining their content.

Changes

Contributor Workflow Documentation

Layer / File(s) Summary
Commit format, code review guidelines, and contributor guide
docs/commit-format.md, docs/code-review.md, AGENTS.md
New docs/commit-format.md defines structured commit message template and pull request rules (concise summaries, no test plans). New docs/code-review.md prescribes severity levels (High/Medium/Low), tagging format (H1/M2/L3), suggestion requirements, item limits, and verification steps. Restructured AGENTS.md with new sections (Project, Tech Stack, Architecture, Prerequisites, Running Locally, Testing, Workflow, Contributing), updated repository paths (ui-svelte/, proxy/..., internal/...), normalized build and test commands (go, npm, staticcheck, make test-all, make test-ui), and explicit links to the new commit and code-review documentation files.

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'docs: rewrite AGENTS.md for clarity and density' accurately describes the main change: restructuring and optimizing the AGENTS.md documentation file.
Description check ✅ Passed The description clearly explains the rationale, changes, and impact of restructuring AGENTS.md with progressive disclosure, including specific modifications and token-cost benefits.
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.

Restructure AGENTS.md with progressive disclosure: keep high-frequency
instructions inline, move reference material to docs/.

- Add architecture section with directory layout
- Add prerequisites and local run command
- Fix stale UI path (ui/ -> ui-svelte/)
- Consolidate testing commands into compact list
- Extract commit format rules into docs/commit-format.md
- Extract code review guidelines into docs/code-review.md
- Add contributing guidance to maintain the pattern
@jeremyeder jeremyeder force-pushed the worktree-improve-claude-md branch from 16f065e to 2bc0d7c Compare June 6, 2026 12:26
@jeremyeder

Copy link
Copy Markdown
Author

@coderabbitai review this is a small change but it has a larger impact as things expand.

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== AGENTS.md ==="
cat AGENTS.md

echo ""
echo "=== docs/commit-format.md ==="
cat docs/commit-format.md 2>/dev/null || echo "FILE NOT FOUND"

echo ""
echo "=== docs/code-review.md ==="
cat docs/code-review.md 2>/dev/null || echo "FILE NOT FOUND"

echo ""
echo "=== docs/ directory listing ==="
ls -la docs/ 2>/dev/null || echo "docs/ directory not found"

echo ""
echo "=== ui directory check ==="
ls -d ui 2>/dev/null && echo "ui/ EXISTS" || echo "ui/ NOT FOUND"
ls -d ui-svelte 2>/dev/null && echo "ui-svelte/ EXISTS" || echo "ui-svelte/ NOT FOUND"

Length of output: 4236



@jeremyeder: The progressive-disclosure approach is well-executed and the architecture map + ui-svelte/ path fix are both immediately valuable. Here's my review using the severity format from docs/code-review.md:


M1 — Missing trigger hints for the docs/ links

AGENTS.md, last line of the Workflow section:

See [docs/commit-format.md](docs/commit-format.md) and [docs/code-review.md](docs/code-review.md).

The PR objective says agents should load these files "only when relevant (e.g., before committing or reviewing code)," but that cue isn't surfaced in AGENTS.md itself. Without an explicit trigger, agents may either always load both files (defeating the token savings) or never load them.

Suggestion:

Before committing: read [docs/commit-format.md](docs/commit-format.md).
Before reviewing code: read [docs/code-review.md](docs/code-review.md).

L2 — Scope prefix rule missing from docs/commit-format.md

The example commit shows proxy: add new feature but the Rules section never explains how to select the scope prefix (proxy:, internal:, docs:, ui:, etc.). Agents will guess or be inconsistent.

Suggestion — add one bullet to the Rules:

- Prefix with the primary area changed: `proxy:`, `internal:`, `ui:`, `docs:`, `cmd:`, or `config:`

L3 — Hard cap of 3 items in docs/code-review.md can silently drop High-severity issues

- Limit your code review to three items with the highest priority first

If a diff has 4+ High-severity issues the agent will silently discard them. A small escape hatch preserves safety without breaking the density goal.

Suggestion:

- Limit your code review to three items (highest priority first); if there are more than three High-severity issues, list all of them before trimming Medium/Low items

Overall: This is a clean, well-reasoned change. The meta-section "Contributing to This File" is particularly good for long-term maintenance hygiene. The issues above are minor polish on an otherwise solid foundation.


🧠 Learnings used
Learnt from: CR
Repo: mostlygeek/llama-swap PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-02-16T05:31:10.887Z
Learning: Applies to **/*agent*.{ts,tsx,js,jsx,py,md,markdown,json} : Use consistent naming conventions for agent files and agent identifiers

Learnt from: CR
Repo: mostlygeek/llama-swap PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-02-16T05:31:10.887Z
Learning: Applies to **/*agent*.{md,markdown,json,yaml,yml} : Document agent capabilities, inputs, and outputs in agent definition files
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
docs/commit-format.md (1)

15-20: ⚡ Quick win

Add explicit scope-prefix guidance for commit subjects.

The example uses proxy: but the rules don’t define how to choose allowed prefixes, which can cause inconsistent commit subjects. Add a short rule listing accepted scopes (for example: proxy, internal, ui, docs, cmd, config) and when to use each.

Suggested patch
 ## Rules for Pull Requests
 
 - Keep them short and focused on changes
 - Never include a test plan
 - Write the summary using the same style rules as commit messages
+- Use a scope prefix that matches the primary area changed (e.g., `proxy:`, `internal:`, `ui:`, `docs:`, `cmd:`, `config:`)
🤖 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 `@docs/commit-format.md` around lines 15 - 20, Add an explicit rule in the
commit/PR section that lists allowed commit subject scopes and short guidance
for choosing them (e.g., allowed scopes: proxy, internal, ui, docs, cmd,
config), require lowercase single-word scopes followed by a colon (example:
"proxy: fix request routing"), and map each scope to when to use it (proxy =
networking/proxy code, internal = non-public library changes, ui = frontend/UX,
docs = documentation-only, cmd = CLI/commands, config = build/config changes);
update the existing example that uses "proxy:" to include a couple more example
subjects demonstrating the format and choice of scope.
🤖 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 `@AGENTS.md`:
- Line 48: Add explicit trigger cues in AGENTS.md next to each linked doc
(docs/commit-format.md and docs/code-review.md) that state the precise
conditions when the agent should load them — e.g., "Load docs/commit-format.md
when composing or validating commit messages or PR descriptions" and "Load
docs/code-review.md when performing or summarizing code reviews or evaluating PR
diffs." Update the AGENTS.md link lines to include these short, actionable
triggers so the agent only fetches each document under the specified contexts to
save tokens and avoid ambiguous behavior.
- Line 12: The fenced code block in AGENTS.md (the directory map block that
starts with ``` and lists files like "llama-swap.go" and "config-schema.json")
lacks a language specifier; update that opening fence to ```text so the block
becomes a ```text fenced code block to satisfy markdownlint MD040 and keep
formatting explicit.

In `@docs/code-review.md`:
- Around line 5-9: The guidance line "Limit your code review to three items with
the highest priority first" incorrectly caps High-severity findings; update the
documentation text so High items are reported without the three-item cap while
keeping the "top three" limit only for Medium and Low findings — edit the
sentence that currently reads "Limit your code review to three items with the
highest priority first" (and any related bullets) to explicitly exempt
High-severity issues and clarify the ordering rules.

In `@docs/commit-format.md`:
- Line 3: The fenced code block starting with ``` and containing the example
commit message (lines showing "proxy: add new feature" and "fixes `#123`") lacks a
language tag; update the opening fence to include a language such as text (e.g.
change ``` to ```text) so markdownlint rule MD040 passes and the snippet renders
consistently.

---

Nitpick comments:
In `@docs/commit-format.md`:
- Around line 15-20: Add an explicit rule in the commit/PR section that lists
allowed commit subject scopes and short guidance for choosing them (e.g.,
allowed scopes: proxy, internal, ui, docs, cmd, config), require lowercase
single-word scopes followed by a colon (example: "proxy: fix request routing"),
and map each scope to when to use it (proxy = networking/proxy code, internal =
non-public library changes, ui = frontend/UX, docs = documentation-only, cmd =
CLI/commands, config = build/config changes); update the existing example that
uses "proxy:" to include a couple more example subjects demonstrating the format
and choice of scope.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4882dd96-dd52-4d34-8c0f-dc95f77ad17b

📥 Commits

Reviewing files that changed from the base of the PR and between ccfba0d and 2bc0d7c.

📒 Files selected for processing (3)
  • AGENTS.md
  • docs/code-review.md
  • docs/commit-format.md

Comment thread AGENTS.md
- keep them short and focused on changes.
- never include a test plan
- write the summary using the same style rules as commit message
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Specify a language for the architecture fenced block (MD040).

Use text for the directory map fence to satisfy markdownlint and keep formatting explicit.

Suggested patch
-```
+```text
 llama-swap.go          # entry point, flag parsing, server startup
@@
 config-schema.json     # JSON schema for config validation
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 12-12: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 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 `@AGENTS.md` at line 12, The fenced code block in AGENTS.md (the directory map
block that starts with ``` and lists files like "llama-swap.go" and
"config-schema.json") lacks a language specifier; update that opening fence to
```text so the block becomes a ```text fenced code block to satisfy markdownlint
MD040 and keep formatting explicit.

Source: Linters/SAST tools

Comment thread AGENTS.md
- Just say "Done." when there is no further action
- Use the GitHub CLI `gh` to create pull requests and work with GitHub

See [docs/commit-format.md](docs/commit-format.md) and [docs/code-review.md](docs/code-review.md).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add trigger cues for when to load each linked doc.

Linking both files is good, but explicit “when to read” cues are needed to preserve token savings and avoid ambiguous agent behavior.

Suggested patch
-See [docs/commit-format.md](docs/commit-format.md) and [docs/code-review.md](docs/code-review.md).
+- Before committing or writing a PR summary, read [docs/commit-format.md](docs/commit-format.md).
+- Before performing a code review, read [docs/code-review.md](docs/code-review.md).
🤖 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 `@AGENTS.md` at line 48, Add explicit trigger cues in AGENTS.md next to each
linked doc (docs/commit-format.md and docs/code-review.md) that state the
precise conditions when the agent should load them — e.g., "Load
docs/commit-format.md when composing or validating commit messages or PR
descriptions" and "Load docs/code-review.md when performing or summarizing code
reviews or evaluating PR diffs." Update the AGENTS.md link lines to include
these short, actionable triggers so the agent only fetches each document under
the specified contexts to save tokens and avoid ambiguous behavior.

Comment thread docs/code-review.md
Comment on lines +5 to +9
- High: must fix (security, race conditions, critical bugs)
- Medium: recommended improvements (coding style, missing functionality, inconsistencies)
- Low: nice to have changes and nits
- Include a suggestion with each discovered item
- Limit your code review to three items with the highest priority first

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Do not cap High-severity findings at three.

The current limit can hide additional must-fix issues. Keep the “top three” cap for Medium/Low, but always report all High-severity items first.

Suggested patch
-- Limit your code review to three items with the highest priority first
+- Report all High-severity items. For Medium/Low items, limit to the top three by priority.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- High: must fix (security, race conditions, critical bugs)
- Medium: recommended improvements (coding style, missing functionality, inconsistencies)
- Low: nice to have changes and nits
- Include a suggestion with each discovered item
- Limit your code review to three items with the highest priority first
- High: must fix (security, race conditions, critical bugs)
- Medium: recommended improvements (coding style, missing functionality, inconsistencies)
- Low: nice to have changes and nits
- Include a suggestion with each discovered item
- Report all High-severity items. For Medium/Low items, limit to the top three by priority.
🧰 Tools
🪛 LanguageTool

[grammar] ~7-~7: Use a hyphen to join words.
Context: ...ctionality, inconsistencies) - Low: nice to have changes and nits - Include a sugges...

(QB_NEW_EN_HYPHEN)

🤖 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 `@docs/code-review.md` around lines 5 - 9, The guidance line "Limit your code
review to three items with the highest priority first" incorrectly caps
High-severity findings; update the documentation text so High items are reported
without the three-item cap while keeping the "top three" limit only for Medium
and Low findings — edit the sentence that currently reads "Limit your code
review to three items with the highest priority first" (and any related bullets)
to explicitly exempt High-severity issues and clarify the ordering rules.

Comment thread docs/commit-format.md
@@ -0,0 +1,19 @@
# Commit Message Format

```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Specify a language for the fenced code block (MD040).

Set the fence to text (or markdown) so markdownlint passes consistently.

Suggested patch
-```
+```text
 proxy: add new feature
@@
 fixes `#123`
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 3-3: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 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 `@docs/commit-format.md` at line 3, The fenced code block starting with ``` and
containing the example commit message (lines showing "proxy: add new feature"
and "fixes `#123`") lacks a language tag; update the opening fence to include a
language such as text (e.g. change ``` to ```text) so markdownlint rule MD040
passes and the snippet renders consistently.

Source: Linters/SAST tools

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