Skip to content

docs(agents): load nested AGENTS.md in Claude Code and trim unused rules - #60

Merged
kixelated merged 6 commits into
mainfrom
quest/m1/audit-instructions
Nov 27, 2026
Merged

kixelated merged 6 commits into
mainfrom
quest/m1/audit-instructions

Conversation

@kixelated

@kixelated kixelated commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

First run of the m1 instructions audit, over 2026-10-25 to 2026-11-25. Sources: PR ## Models and ## Review records, quest messages on five hosts, 34 Claude Code, 22 Codex, and 1 Antigravity session in hang.live checkouts, and every guidance page quest guide prompting links.

Changes

  • Delete the root CLAUDE.md (@AGENTS.md). Because a CLAUDE.md exists, Claude Code skips the AGENTS.md files under app/ and api/, so neither had ever loaded. Without it, Claude reads the root AGENTS.md at start and nested ones on demand, as in moq, which has no CLAUDE.md. CONTRIBUTING.md now says why there is none.
  • Delete the repository's SessionStart direnv hook (.claude/hooks/direnv.sh and .claude/settings.json, which held only that hook), as moq-dev/moq#8183 did. It exec'd moq's direnv.sh, which that PR deleted, so it failed at every session start. The user-level dev-shell hook already loads the dev shell. AGENTS.md's keep rule and CONTRIBUTING.md's hook sentences go with it.
  • AGENTS.md: refresh the Quests: line to the pinned quest's wording, which tells agents not to rerun quest context when a hook already loaded it. Cut "Prefer ESM namespace imports and explicit types", and cut the quest pin note.
  • CONTRIBUTING.md and the flake.nix comment: describe the quest input as untagged and pinned by flake.lock alone, as the bump bot writes it since #67, with nix flake update quest for a manual bump. Drop the copies of the just dev rule and the quest context line; AGENTS.md keeps both.
  • app/package.json: test no longer hardcodes src, so bun run --cwd app test <path> runs one file. Ten sessions retyped the script's full flags to do that.
  • Plan the next run as quest/m2/audit-instructions.md, scheduled 2026-12-02, after m1.

Public API and wire impact: none.

Decisions

From the maintainer's decision comment:

  1. Root CLAUDE.md: ✅ keep the deletion (rejected: restore it plus app/ and api/ CLAUDE.md stubs).
  2. Quests: line: ✅ keep the refreshed AGENTS.md line and drop CONTRIBUTING.md's copy (rejected: keep both).
  3. "Prefer ESM namespace imports and explicit types": ✅ keep the cut (rejected: restore it; move it to REVIEW.md).
  4. "quest binary pinned by tag in flake.nix": ✅ keep the cut, and align the flake.nix comment and docs with the bot's untagged, lock-pinned input (rejected: restore the line and make the bot write a tag).
  5. CONTRIBUTING.md's copy of the just dev rule: ✅ keep the removal (rejected: restore).
  6. SessionStart direnv hook: ✅ delete it, copying moq (rejected: inline moq's old script; keep as is).

Choices made while the maintainer was away, for review:

  • Delete .claude/settings.json outright rather than keep a schema-only file: the hook was its only content, and quest init does not recreate it.
  • Update the m2 audit quest's baseline sizes to this head (root AGENTS.md 549 B, app/AGENTS.md 1,004 B, api/AGENTS.md 1,017 B after main's changes), and change its hook check to "no repository SessionStart hook has come back".

Findings

Measured loaded sets, all far under each harness's limits:

  • Claude Code: root AGENTS.md is 549 B. app/AGENTS.md (1,004 B) and api/AGENTS.md (1,017 B) now load on demand; before this PR they never loaded.
  • Codex: root AGENTS.md against a 32 KiB project_doc_max_bytes.
  • Antigravity: root AGENTS.md only.
  • Skill descriptions: 857 characters across 8 stubs.

Kept as is:

Caused by

Follow-ups

  • kixel-ai/quest, for /quest-plan there:
    • quest init keeps an outdated Quests: reference line once its marker exists, which is how Hang's copy went stale. Refresh the line, or have quest check flag the drift.
    • The quest hook SessionStart context is 8,890 characters, 89% of Claude Code's 10,000-character hook cap. quest skill run prints 27,210 characters, 91% of the roughly 30,000-character inline Bash limit. Past either limit, Claude gets a file path and a 2,000-character preview instead of the text.
  • Machine level (dotfiles): in 5 sessions nix failed because the session's TMPDIR under /tmp/agent-1000 didn't exist. Agents then moved TMPDIR into .tmp/, which broke Chromium in test:media ("socket path too long") in 5 sessions. $XDG_RUNTIME_DIR worked.

Validation

  • Merged main at 4f30924 (feat(room): live MoQ telemetry HUD in Debug mode #64 through chore: add Dependabot for bun and GitHub Actions #75) without conflicts into fb81ed6; quest check, fallow, TypeScript, Biome, and the API and app tests (79) pass locally on it; the media browser tests are left to CI. The AGENTS.md sizes in the m2 baseline are unchanged.
  • quest gate just check passes on the merged head: quest check, fallow, TypeScript, Biome, and the API (45), app (74), and media (4) tests.
  • bun run --cwd app test src/room/metadata.test.ts runs that file alone.
  • Real surface: a headless Claude Code session (claude -p, Haiku) in this worktree loaded the root AGENTS.md as Project instructions and app/AGENTS.md as PostToolUse context after reading app/src/api.ts (previous head). On this head, the same session runs only the two user-level SessionStart hooks; the repository hook and its exit 127 are gone.
  • quest init with the current quest recreates neither .claude/settings.json nor the hook.

Models

Size: XL
Implementer: Claude Code, claude-opus-5-5, xhigh
Implementer: Claude Code, claude-opus-5-5, high effort (iterate, S)
Implementer: Claude Code, claude-opus-5-5, medium effort (iterate, XS)

(Written by Claude Opus 5.5 with high)

Review

Rewritten by quest review after each round.

  • Head: 2c994c9

  • Base: origin/main at 212ddf5

  • Risk: medium, it adds to plans under quest/, which agents start without a person reading them

  • Classified: medium by default

  • Risk file: none

  • Reviewer: Codex, gpt-6.2-sol, xhigh effort

  • Session: 01a21a80-5452-7f72-8d7f-67c4fa32ab1e, round 1

  • Score: 10/10, Repository consumers follow the updated contracts, and Bun unit-test discovery keeps the browser suite separate.

  • Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

kixelated and others added 2 commits November 25, 2026 22:52
Run the m1 instructions audit:

- Delete the root CLAUDE.md. As a CLAUDE.md it stopped Claude Code from
  loading app/AGENTS.md and api/AGENTS.md; without it, Claude reads the root
  AGENTS.md at start and nested ones on demand, as in moq.
- Refresh the Quests reference line to the pinned quest's wording, which skips
  rerunning quest context once a hook has loaded it.
- Cut the unenforced namespace-import rule and the quest pin note that
  CONTRIBUTING already covers; drop CONTRIBUTING's copy of the just dev rule.
- Let `bun run --cwd app test <path>` run one file.
- Plan the next run under quest/m2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Audit agent instructions docs(agents): load nested AGENTS.md in Claude Code and trim unused rules Nov 26, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Maintainer decision (via /quest-run):

  1. Root CLAUDE.md: ✅ keep the deletion (rejected: restore it plus app/ and api/ CLAUDE.md stubs).
  2. Quests line: ✅ keep the refreshed AGENTS.md line and drop CONTRIBUTING.md's copy (rejected: keep both).
  3. "Prefer ESM namespace imports and explicit types": ✅ keep the cut (rejected: restore it; move it to REVIEW.md).
  4. "quest binary pinned by tag in flake.nix": ✅ keep the cut, and align the flake.nix comment and docs with how the quest bump bot now pins (untagged input, locked by flake.lock, since chore: bump quest to v0.28.0 #67) (rejected: restore the line and make the bot write a tag).
  5. CONTRIBUTING.md's copy of the just dev rule: ✅ keep the removal (rejected: restore).
  6. SessionStart direnv hook: ✅ delete it, copying moq (chore: drop the repository's dev-shell session hooks moq#8183): remove .claude/hooks/direnv.sh, the hook in .claude/settings.json, the keep rule in AGENTS.md, and CONTRIBUTING.md's hook sentences (rejected: inline moq's old script; keep as is).

(Written by Claude Opus 5.5)

kixelated and others added 2 commits November 26, 2026 16:46
… quest's lock-only pin

Applies the maintainer's decisions on #60: drop the repository hook that
exec'd moq's deleted direnv.sh (as moq-dev/moq#8183 did), and describe the
quest input as untagged and pinned by flake.lock, as the bump bot writes it
since #67.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 27, 2026 00:57
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 25 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e75d0448-d489-481a-ad2b-b2fbb958237f
Commits

Reviewing files that changed from the base of the PR and between 4f30924 and fb81ed6.

Files selected for processing: 9

  • .claude/hooks/direnv.sh
  • .claude/settings.json
  • AGENTS.md
  • CLAUDE.md
  • CONTRIBUTING.md
  • app/package.json
  • flake.nix
  • quest/m1/audit-instructions.md
  • quest/m2/audit-instructions.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@kixelated

Copy link
Copy Markdown
Collaborator Author

Maintainer decision (via /quest-run): ✅ /quest-merge this PR (rejected: iterate, skip). Its follow-ups for kixel-ai/quest and dotfiles go to /quest-plan in those repos.

(Written by Claude Opus 5.5)

@kixelated

Copy link
Copy Markdown
Collaborator Author

Applying the /quest-merge decision: merged main into the branch without conflicts (head fb81ed6), so the existing review still covers the content; local checks pass, CI running. Not queued.

(Written by Claude Opus 5.5 with medium)

@kixelated
kixelated merged commit 10e0bbe into main Nov 27, 2026
3 checks passed
@kixelated
kixelated deleted the quest/m1/audit-instructions branch November 27, 2026 02:50
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