feat(adr): convert agent-memory patterns into enforced ADR rules#376
Merged
Conversation
Consolidate the archgate-developer agent memory (fix stale Bun version, remove a dead pointer, correct skill names) and codify enforceable "Patterns & Fixes" entries as machine-checkable ADR rules. - GEN-003: enable rules - ban bunx/npx of lint/format tools and bare `bun test` in CI; fix smoke-test-windows.yml accordingly - ARCH-001: add no-top-level-await-in-entry rule for src/cli.ts - ARCH-017: enable rules - forbid an npm `main` field on the thin shim - ARCH-018: new ADR - lazy-load heavy deps (inquirer, @sentry, posthog) - ARCH-019: new ADR - wrap inquirer prompts in withPromptFix() - ARCH-020: new ADR - Bun.Glob.scan must pass { dot: true } - ARCH-021: new ADR - PowerShell scripts must be ASCII-only - Route the format-on-save hook through `bun run format:file` (no bunx) archgate check: 39/39 rules pass. Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Deploying archgate-cli with
|
| Latest commit: |
cd92699
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://63045a87.archgate-cli.pages.dev |
| Branch Preview URL: | https://claude-reverent-mendel-cb8c8.archgate-cli.pages.dev |
Contributor
Code Coverage
Full HTML report available in workflow artifacts. Per-directory breakdown
|
The enforced "Patterns & Fixes" entries duplicated the rationale now owned by their ADRs. Replace ~9 verbose bullets with a one-line "Enforced by ADRs" map and keep only the non-enforceable env/CI/platform lessons in "Patterns & Fixes". Net: 22.4KB -> 17.7KB. Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Drop the "Enforced by ADRs" pointer map entirely — enforced conventions live in their ADRs (which the agent reads before coding), so duplicating even a one-liner is redundant. Memory now keeps only non-enforceable lessons. 22.4KB -> 16.7KB. Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Remove entries that no longer earn their place: git-identity-in-tests and mock.module/fetch (fully covered in ARCH-005 Do's/Don'ts/examples), SLSA tag-pin (stale line/version; owned by an in-repo comment + CI-001 carve-out), telemetry eager/lazy init (derivable from cli.ts comments), smoke-test asset finding and CodeQL setup (settled one-time CI changes; codeql.yml now exists). Trim the GITHUB_TOKEN entry to its generalizable lesson, dropping the PR-history narrative. Memory now keeps only recurring, non-enforceable hazards. 22.4KB -> 12.1KB. Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Resolve MEMORY.md conflict in "Patterns & Fixes": keep main's new non-enforceable lessons (custom oxlint plugins, unicorn/no-array-callback- reference, require-unicode-regexp, oxfmt-formats-markdown) and our pruned structure. Drop main's three bullets that are already captured in ARCH-005 (assert-does-not-throw, injectable thresholds, per-test timeout), keeping memory free of ADR duplication. Post-merge validation: lint 0/0, typecheck clean, archgate check 39/39, 1218 tests pass. Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Replace the process-global mock.module() on the first-party registry module with per-test spyOn (ARCH-005): mock.module leaks across files in the same Bun process and risked contaminating registry.test.ts. Fakes are typed as `typeof registryMod.fn` so they check against the real signatures, and are restored via mock.restore() in afterEach. All 20 tests pass; full suite green (1218 pass) with no cross-file leakage. Memory slimming: - Remove the "mock.module + require macOS" entry — obsolete now that the one file using it is migrated, and superseded by ARCH-005's spyOn guidance. - Trim project_shim_publishing.md to the durable, non-enforceable gotchas; drop ephemeral incident details (run IDs, deploymentId, v0.40.0 narrative). Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
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
Consolidates the
archgate-developeragent memory and converts its enforceable "Patterns & Fixes" entries into machine-checkable ADR rules, so conventions previously living only in memory are now enforced byarchgate check.Memory consolidation (
.claude/agent-memory/archgate-developer/MEMORY.md):1.3.8→1.3.14)project_telemetry_strategy.md@architect/@quality-manager→@reviewer/@lessons-learned)(ENFORCED: <rule>)Existing ADRs upgraded to enforced rules:
rules:false→true— bansbunx/npxof lint/format tools (prettier, oxfmt, oxlint, eslint, biome) and barebun testin CI workflows. Fixed the one real violation insmoke-test-windows.yml(bun test→bun run test).no-top-level-await-in-entry(scanssrc/cli.ts;build:checkremains authoritative).rules:false→true—no-npm-main-fieldkeeps the thin npm shim from bundling the CLI entry point.New ADRs (+ companion rules):
inquirer,@sentry/*,posthog-node);import typeis exempt.inquirer.prompt()must be wrapped inwithPromptFix()(Windows newline corruption).Bun.Glob.scan()must pass{ dot: true }(dotfile/cross-platform correctness, ctx.glob() in .rules.ts does not match dot-prefixed directories (e.g. .github/) on Windows #222)..ps1files must be ASCII-only (Windows PowerShell 5.1 mis-decodes BOM-less UTF-8).Tooling consistency:
.claude/settings.jsonthrough a newformat:filepackage.json script (bun run format:file) instead ofbunx oxfmt.CLAUDE.md:bun test→bun run testto match GEN-003.All new rules were verified against the real codebase first (no false positives —
bunx --bun astrostays legal,import typeexempt), then hardened with try/catch per the ARCH-013 convention after self-review.Test plan
bun run cli check— 39/39 rules pass, 0 rule errorsbun run lint— 0 warnings, 0 errorsbun run typecheck— cleanbun run format:check— cleanbun test— 1231 tests pass (0 fail)bun run format:file <file>verified on a single fileknipreports pre-existing unused-devDependency warnings (oxfmt/oxlint/czg/conventional-changelog) unrelated to this PR (reproduces on unmodifiedpackage.json; proto-managed binaries knip can't resolve locally)