Repository navigation
chore(agents): enforce mechanical invariants in lint and slim AGENTS.md - #1471
Merged
Merged
Conversation
realcodesiman
force-pushed
the
chore/agent-instructions-lint
branch
from
November 2, 2026 03:33
264add1 to
04bb0ec
Compare
- Move the mechanical AGENTS.md invariants into lint: a Biome
noRestrictedImports rule bans `db` imports in apps/ and integrations/ (13
legacy files exempt), and scripts/check-invariants.mjs (run by pnpm lint)
checks dynamic import() in tsdown code, the `{ err }` log key, Prisma
imports, and the relations/index.ts double edit.
- Condense the invariants in AGENTS.md to one line each. The full text moves
verbatim to docs/agents/invariants.md, cutting AGENTS.md from 29.6k to
15.9k characters.
- Add the diagnosing-bugs skill, a gated debugging loop.
- Add a PreToolUse hook that blocks destructive git commands and
`git add -A`/`.`.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
realcodesiman
force-pushed
the
chore/agent-instructions-lint
branch
from
November 2, 2026 07:33
ff48b5a to
91c4ffb
Compare
hello-jackytruong
referenced
this pull request
in hello-jackytruong/ChatWorkAI
Nov 22, 2026
…md (#1471)
* chore(agents): enforce mechanical invariants in lint and slim AGENTS.md
- Move the mechanical AGENTS.md invariants into lint: a Biome
noRestrictedImports rule bans `db` imports in apps/ and integrations/ (13
legacy files exempt), and scripts/check-invariants.mjs (run by pnpm lint)
checks dynamic import() in tsdown code, the `{ err }` log key, Prisma
imports, and the relations/index.ts double edit.
- Condense the invariants in AGENTS.md to one line each. The full text moves
verbatim to docs/agents/invariants.md, cutting AGENTS.md from 29.6k to
15.9k characters.
- Add the diagnosing-bugs skill, a gated debugging loop.
- Add a PreToolUse hook that blocks destructive git commands and
`git add -A`/`.`.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* chore(agents): split shared skills into references
* chore(agents): split specialist skills into references
---------
Co-authored-by: Deathgiver <[email protected]>
Co-authored-by: Real Codesiman <[email protected]>
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
This PR applies three ideas from mattpocock/skills.
1. Rules a machine can check now live in lint, not in prose.
AGENTS.mdloads into every agent session, so each line there costs context on every turn..devin/and.github/copilot-instructions.mdare regenerated bypnpm sync:agent-instructions.docs/agents/invariants.md.invariant-guardrunspnpm check:invariantsfirst. It treats any new allowlist entry as a HIGH finding.docs/developer/codegraph.md.2. New
diagnosing-bugsskill (.agents/skills/diagnosing-bugs/). It is a gated loop:It is adapted to ChatbotX: Vitest per workspace, the public API, and replaying webhook or job payloads. It is registered in the CLAUDE.md routing table.
3. Git guardrail hook (
.claude/hooks/block-dangerous-git.mjs, aPreToolUsehook on Bash in.claude/settings.json).push --force/-f,reset --hard,clean -f,branch -D,checkout ./restore ., andgit add -A/./--all.--force-with-lease,reset --soft,branch -d, and staging named files.jq.Evidence
check:invariantspasses on 6,083 tracked source files. Planting a runtimeimport("node:fs")inpackages/utilsand an unspreadfooRelationsimport makes it fail with both errors.import { db }inapps/worker/src. It passes for the legacy files and for__tests__, and ultracite's own test overrides still apply.Merge Danger
Door: two-way. Everything here is guidance, lint, and a local hook. No runtime code changes.
Blast Radius: CI lint and the Claude Code sessions of everyone on the team.
check:invariantsflagsintegrations/whatsapp/src/api/waba-setup.ts:80, which fix(whatsapp): log the credit line error under err so the stack survives #1470 fixes. Until then, this branch's lint fails.Test plan
pnpm lint(together with the fix(whatsapp): log the credit line error under err so the stack survives #1470 fix)check:invariants🤖 Generated with Claude Code