Repository navigation
docs(agents): move guidance beside its code, and fix the hooks in worktrees - #1172
Merged
Merged
Conversation
…lready shows AGENTS.md said code-style.md, environment.md and architecture.md were "loaded every session", but each import sat inside backticks, and an `@` import in a code span is plain text. None of the three ever loaded. code-style.md now imports for real, minus its Import Order section, which ESLint's import/order rule enforces and the eslint-fix hook applies on every edit. environment.md and architecture.md stay on demand: architecture.md alone is past Claude Code's large-memory-file threshold. Four file trees go too. Each repeated what ls shows, and two had drifted: seeds/ was missing nine entries, and the OpenAPI module list two files. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…space root Both PostToolUse hooks were addressed as $CLAUDE_PROJECT_DIR/.claude/hooks/…, and respond() handed the scripts the same variable as their project. A session started at the WeMeditate workspace root and working in a SahajCloud worktree has CLAUDE_PROJECT_DIR naming the workspace, so the command was not found: 69 of 72 runs exited 127 over the last two weeks, and neither types nor unit specs ran after those edits. The command still prefers CLAUDE_PROJECT_DIR, so a session started in the repo runs exactly what it did. Only when the project holds no hook does it fall back to the checkout the session is in (git rev-parse --show-toplevel). The other order would run the hook script of any checkout the session moved into. respond() now leaves each script on its own REPO_ROOT. Co-Authored-By: Claude Opus 5.5 <[email protected]>
architecture.md was 52k characters that no session loaded on its own, so its warnings reached nobody unless they went looking. Each section now lives where it loads for the work it describes: - Logging, Sentry and the three capture rules (#670, #734, #1039) -> src/plugins/sentry/AGENTS.md - Scheduled jobs -> src/jobs/AGENTS.md - The Atlas SEO, sitemap and Wix contracts -> src/endpoints/atlas/AGENTS.md - The Atlas event feed and registration gate -> src/collections/Events/AGENTS.md - The custom endpoint list -> docs/rules/endpoints.md The text moves verbatim. What stays is the whole-app view, read on demand: storage, collections, the Payload config settings (#684's error body, slow-query logging, the pool and depth caps), and a table of where each subsystem's guide now is. The route layout and the config file list went, since ls answers both. Every code comment citing a moved section points at its new home. Co-Authored-By: Claude Opus 5.5 <[email protected]>
admin-ui.md loaded its whole 59k characters on any edit under src/collections/, src/fields/ or src/globals/, past Claude Code's large-memory-file threshold, though most of it is about writing a component. It is now four rules plus three component guides, each loading where its work is: - admin-ui.md (28k) — writing a component; src/components/admin/ - admin-config.md (11k) — admin settings a collection, global or field config owes: conditions, live preview, previewTargetField, project visibility, the import map; collections, fields, globals, blocks - admin-navigation.md (10k) — the project selector, the Atlas sidebar and the dashboards; only those folders, src/lib/atlasOverview and currentProject.ts - WorkflowButtons, JobStageView and FrameEditor each get an AGENTS.md beside the component A collection edit now loads 11k of admin guidance instead of 59k. The text moves verbatim; "above" and "below" that crossed a new file boundary name the file instead, and every citation of a moved section points at its new home. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🚅 Deployed to the SahajCloud-pr-1172 environment in sahajcloud
1 service not affected by this PR
|
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-1172
November 16, 2026 17:37
Destroyed
Ardnived
marked this pull request as ready for review
November 16, 2026 17:45
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
code-style.mdreally loads.architecture.mdandadmin-ui.mdare split beside their code.Change outline
Files — where each guide now loads
architecture.md(52k) never loaded at all, because its import sat in a code span.admin-ui.md(59k) loaded whole on any collection, field or global edit. Each section now lives where it loads for the work it describes. The text moves verbatim.Behaviour — which hook script a session runs
$CLAUDE_PROJECT_DIRnames the workspace in a session started at the workspace root, so the hook path did not exist there. The fallback only applies when the project directory holds no hook. The opposite order would run the hook script of any checkout the session moved into.Preview
No runtime change. The preview behaves exactly like
main.Test results
tests/unit/ics-builder.spec.ts, which depends on timezone. It fails on a machine set to MST and passes withTZ=UTC. This branch does not touch it, andclaude/fix-1158-ics-utc-timestampscovers it.hook-run,doc-citations,payload-types-hook,unit-test-hook,sanitized-config-rules: 52 passed.CLAUDE_PROJECT_DIRset to the workspace root, to the worktree, and outside any checkout. All three exit 0.Manual verification
/memory.docs/code-style.mdshould be listed as loaded.admin-config.mdshould load, andadmin-ui.mdshould not.Notes for reviewer
code-style.md, about 0.9k extra tokens, which the guide always said it did.doc-citationspasses./simplifyand/code-reviewwere not run. The diff is moved text plus pointer comments. The security review ran because admin components and aUserSubmissionshook comment are in the trigger paths, and it found nothing..claude/(the hook commands and two.claude/rulessymlinks), so it can't be changed by an unattended run.Detail
/doctorrun. In the 50 most recent sessions, both project hooks failed 69 of 72 times, each with/bin/sh: …/WeMeditate/.claude/hooks/<hook>.mjs: No such file or directory.admin-ui.mdandaccess.mdwere each over Claude Code's large-memory-file threshold of 50k characters, which applies at a 1M context.access.mdis still over it. Its sections are rationale and warnings rather than anything a session can derive from the code, so it is left for a separate split.lsanswers them. Two had drifted:seeds/was missing nine entries, and the OpenAPI module list was missingbasicAuth.tsandendpointAuthPlugin.ts.code-style.mdlost its Import Order section. ESLint'simport/orderrule enforces it, and the workflow plugin's eslint-fix hook applies it on every edit.🤖 Generated with Claude Code