Repository navigation
docs: trim the agent instruction files to the rules nothing else enforces - #1197
Merged
Merged
Conversation
Ports #1194's Docs impact rule into the trimmed root AGENTS.md.
mforce
marked this pull request as ready for review
October 10, 2026 22:04
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.
What and why
Agents load the six agent instruction files into every session. Together they had grown to about 15,300 words. Most of that text repeated one of three things. Some repeated what a guard already prints when it fails. Some repeated what
CONTRIBUTING.mdor a decision record already explains. The rest was the history of how a rule was earned. This PR keeps the rules that nothing else states where an agent will meet them, and it keeps the condition, exception or "never" that each one depends on. Where a guard carries a rule, the scoped file keeps one line that names the guard and links the decision record. Every record that the old files linked is still linked.After the trim was drafted,
mainchanged these files six times. Each change is ported by the same classes:.github/AGENTS.md. No repo test can see the ruleset (K), so the trimmed rule keeps every condition: update the ruleset in the same PR when renaming a required job or adding a path filter, the summary-job prerequisite, the never-require list, nostatuses: write, and merge rather than force-push.usinga build error (G).src/AGENTS.mdnames IDE0005 beside IDE0065 and IDE0161, with the migrations exemption.useLatestLoadand its lint rule. The lint's blind spots are kept (K): an async helper defined outside the effect, and a write followed by a refresh. So is the suppressions exception for a newly applied rule.SPEC_ONLYrow for every term.web/AGENTS.mdkeeps how to add one and how to clear aNOT_YETrow.Word counts
AGENTS.mdCLAUDE.md@AGENTS.md)src/AGENTS.md.github/AGENTS.mdweb/AGENTS.mdsrc/Cluckwork.Infrastructure/Persistence/AGENTS.md"Before" is
mainat6502603e.What was dropped, by class
Each original rule was classified as one of four kinds.
src/AGENTS.mdor the Persistence file names the guard and links the record. Examples include the proxy-trust, Postgres TLS and JWT-key boot guards, GSS negotiation, the design-time migration connection, and theInitialCreatefreeze, whose guard prints thedotnet ef migrations addcommand.CONTRIBUTING.md, a README, a runbook or the code. Examples include the run commands for the full stack, the frontend and the debug API, the pre-commit hook, the CI audit gates and their exception file, themigrateandhealthcheckverbs, phase context and epic bookkeeping, and the table of contents.SolutionTestProjectSplitTestscatches a missing test-matrix leg, but nothing catchesif:,continue-on-errororfail-fast: falseon that job, so that line stays in.github/AGENTS.md.The root file's build command also named
Cluckwork.sln, which no longer exists. It now namesCluckwork.slnx.New lines in the trimmed text
These five lines are new rules, not shortened ones. Reviewers should judge each one on its own.
--filter. CI runs the full suite.K rules kept
Root
AGENTS.md.file:line, and assert uniqueness when a stable key can collide.verifyskill and its shared-stack hazard. Run/maintain-verification-skillafter a screen slice lands.inertthrough CDP.ghfor PRs. Never commit tomain.Closes #Nin the body.src/AGENTS.md..editorconfig:warningrules are a decision. Never name a namespace segment after a type.Kindyourself and never widen a reason.IReportQueriesorIExportQueriesintoContracts/.IFarmDirectorynever behind a forwarding helper.ICurrencyBoundRowSourceand keep the registration order.Versionand gets a race test.AccountIdand the tenant query filter.Account.Rename, withlist-accountsimmediately before.AuditEvents.Sequenceis global.GETandPUTareOwnerOnly, and so is the navigation gate.IsNullOrWhiteSpace.openid, step-up and shared-limiter rules.ClientMetadataFetcheris the only fetch path.ICurrentUseris an authorization input. Seeders load real roles.McpCallContext. Every tool method carries a role and a scope[Authorize], never[AllowAnonymous].<OAuth:Issuer>/mcp. A second endpoint needs its own resource and audience.AllowConnectedAppsdefault and the Data Protection certificate..github/AGENTS.md.ubuntu-latest.build-and-testnever gated,continue-on-errorkept, a self-test with no dependents.--prefer-index=falseand the post-retag digest check, reads the run artifact, and keepspublish.needscomplete.--source-refis derived.Release-As:timing and its one exception.web/AGENTS.md.SPEC_ONLYrow.useLatestLoadorusePagedList, never an asyncuseEffect.exhaustive-deps.src/Cluckwork.Infrastructure/Persistence/AGENTS.md.AuditEvents.Pointer fixes
Code comments that cited removed text now point to where that text lives. Only comment lines changed.
ci.ymlanddocs/decisions/782-ci-job-gating.mdcited.github/AGENTS.mdfor the tj-actions compromise. They now cite146-ci-security-gates.md.tools/simulation/ui/src/env.tscitesREADME.mdfor "single container".ProductionLogFormatTestscites404-production-logs.mdfor the@tr/@spfield names.RecoverAdminCommandTestscites the break-glass runbook for the least-privilege role.AccountMaxDiscountMigrationTestscites732-farm-code-rename.mdfor rawUPDATEs onAccounts.AppDbContext,NamedEntityDiscoveryTestsandDefaultResponseCachingnamesrc/AGENTS.md, where the tenancy and no-MediatR rules now live.These pointers were already broken on
main, and this PR fixes them too:ExportQueriescited an "AGENTS.md money rule" that never existed. It now citestech_spec.md§3.2.SimulationDataSeederquoted "no silent caps" from AGENTS.md, which never said it. It now cites fix(seed): seeded audit events carry "(unresolved)" as the actor, now visible on record History columns #500 review round 2, finding 6, where the phrase came from.ServingGuardCoverageTestsattributed a quote to AGENTS.md. The quote comes from347-process-role.md, and the comment now cites that record.VoidPaymentHandlerandAdjustExpenseHandlerpointed at the root file for theVersionrule, which lives insrc/AGENTS.md.Decision records and indexes:
src/AGENTS.mdlists the rule under Enforced rules and their records. Record 318 says the same of the Persistence file.CONTRIBUTING.mdcarry the audit gates, and that its remaining compact constraint, SHA-pinned Actions, lives in.github/AGENTS.md. Record 852 names its remaining constraint,IMortalityLedger.AppendAsyncnever saves.src/AGENTS.md.docs/decisions/README.md, the "Rule lives in" column is regenerated from where each record is linked today. The introduction now describes the two places a rule can appear.README.mdanddocs/README.mdno longer describeAGENTS.mdas "every invariant".271-single-serving-instance.mdkeeps its history paragraphs (the old counts, "wrong in AGENTS.md until 2026-08-16") as written, because they describe the past.Review round 1
Round 1 compared every shortened rule with the base text and checked every claim that a guard enforces a rule against that guard's code. Each finding below was fixed by restoring the original condition as one short sentence.
IFarmDirectoryis never behind a forwarding helper, becauseFarmDirectoryCallerTestschecks names, not calls.DailyEntryGradeandEggInventoryMovementgate through a filtered parent or a policy. Each new one needs a rationale and a causal mutation test.build-and-testis never gated,changeskeepscontinue-on-error, and the self-test has no dependents. Only apull_requestrun gets a docs-only verdict.SingleAttemptExecutionwhen replay is observable, and a durability probe when replay writes nothing.FOR UPDATEordering is exempt. Action timestamps andVersionare preserved.list-accountsimmediately before a rename.--prefer-index=falseand the post-retag digest check.GITHUB_TOKEN.--source-refis never taken fromimage.jsonor a wildcard.Add*/With*registrations at the resolved version.GETandPUTareOwnerOnly, and the navigation entry checks the exactAdminrole.SystemActors. Seeders load the Owner's real roles./maintain-verification-skillis back, and so are the graphify obligations.??rule applies only to the JWT key settings, and the "never disable" rule only to fixing the sim harness.Release-As:line explains its one exception, release-please's override block.ghfor GitHub PRs" is back. The mirror remote is gone, because no tracked file mentions it.The #806 rules from #1195 are folded into
src/AGENTS.md. The OAuth bullet gains the/mcpaudience binding. The MCP bullet gains the per-method role and scope[Authorize]requirement and links806-mcp-endpoint.md. F22's line no longer names the dormant MCP assertion, which #1195 removed.The same round flagged three rules that the trim had widened. They are narrowed back. The issue-state rule covers these files only. The registry-key rule no longer bans namespaces. The AppHost update applies only to a new required config key, as before.
How it was verified
dotnet test tests/Cluckwork.Application.Tests --filter "FullyQualifiedName~RenameAccountDocsTests|FullyQualifiedName~TenancyDocsFreshnessTests"passed 19 of 19 at the head.dotnet test tests/Cluckwork.Api.IntegrationTests --filter "FullyQualifiedName~ImagePin|FullyQualifiedName~SolutionTestProjectSplitTests"passed 3 of 3 at the head. The integration project does not build onmainat6502603e:Mcp/McpConnection.csfrom feat(mcp): map /mcp for connected apps, with role and scope gates on tools #1195 has three unused usings that build: make an unused using a build error (IDE0005) #1199 now rejects. This PR does not touch that file, so these tests ran with-p:EnforceCodeStyleInBuild=false, and CI's integration and build jobs will fail here untilmainis fixed.node --test .github/scripts/changed-paths.test.mjspassed 16 of 16.image-scan.ymlturned out to report findings without gating, so its line says that.docs/schema/text changed.