@ryuenn3123/agentic-senior-core 3.0.26 → 3.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/.agent-context/prompts/bootstrap-design.md +1 -1
  2. package/.agent-context/prompts/refactor.md +2 -0
  3. package/.agent-context/prompts/review-code.md +2 -2
  4. package/.agent-context/review-checklists/architecture-review.md +12 -0
  5. package/.agent-context/review-checklists/pr-checklist.md +9 -1
  6. package/.agent-context/rules/api-docs.md +4 -0
  7. package/.agent-context/rules/architecture.md +3 -3
  8. package/.agent-context/rules/database-design.md +9 -0
  9. package/.agent-context/rules/error-handling.md +8 -0
  10. package/.agent-context/rules/event-driven.md +3 -0
  11. package/.agent-context/rules/microservices.md +2 -0
  12. package/.agent-context/rules/security.md +11 -0
  13. package/.agent-context/rules/testing.md +8 -0
  14. package/.agent-context/state/memory-continuity-benchmark.json +1 -1
  15. package/.agent-context/state/weekly-governance-report.json +234 -31
  16. package/.cursorrules +1 -1
  17. package/.gemini/instructions.md +3 -2
  18. package/.github/copilot-instructions.md +3 -2
  19. package/.instructions.md +16 -1
  20. package/.windsurfrules +1 -1
  21. package/AGENTS.md +4 -3
  22. package/lib/cli/commands/init.mjs +1 -0
  23. package/lib/cli/commands/upgrade.mjs +1 -0
  24. package/lib/cli/compiler.mjs +9 -8
  25. package/package.json +1 -1
  26. package/scripts/governance-weekly-report.mjs +138 -1
  27. package/scripts/release-gate/audit-checks.mjs +1 -1
  28. package/scripts/release-gate/constants.mjs +11 -0
  29. package/scripts/rules-guardian-audit.mjs +1 -1
  30. package/scripts/single-source-lazy-loading-audit.mjs +10 -8
  31. package/scripts/sync-thin-adapters.mjs +7 -4
@@ -15,7 +15,7 @@ The agent must:
15
15
  2. If `docs/DESIGN.md` or `docs/design-intent.json` exists, refine them instead of replacing them blindly.
16
16
  3. If either design doc is missing, create it before UI implementation.
17
17
  4. Use current repo evidence, product copy, route names, component names, user goals, and existing constraints as the source of truth.
18
- 5. Treat prior-chat visuals, unrelated project memory, benchmark screenshots, and famous-product aesthetics as tainted unless the user explicitly asks for continuity.
18
+ 5. Treat prior-chat visuals, unrelated project memory, benchmark screenshots, and famous-product aesthetics as tainted context unless the user explicitly asks for continuity.
19
19
  6. When choosing a new UI, animation, styling, or component library, research current official docs and choose the latest stable compatible option for this project. Do not rely on offline defaults.
20
20
  7. Keep external references non-copying: extract constraints and reasoning only, never clone the surface.
21
21
 
@@ -13,6 +13,8 @@ Before editing:
13
13
  5. If the change touches a dependency, framework, Docker, runtime, or ecosystem claim, verify current official docs before choosing.
14
14
  6. Enforce Universal SOP hard gate: stop implementation if `docs/architecture-decision-record.md` is missing, and for UI scope stop if `docs/DESIGN.md` or `docs/design-intent.json` is missing.
15
15
  7. Enforce backend universal principles: no clever hacks, no premature abstraction, readability over brevity.
16
+ 8. For backend/API scope, enforce layered boundaries, zero-trust input validation, safe centralized error responses, bounded list reads, transaction safety for multi-write mutations, idempotency for sensitive mutations, and behavior-focused API tests.
17
+ 9. Backend/API governance is global and stack-agnostic. Do not create stack-specific adapters or framework-specific rule branches; apply the global rules through the framework already present in the target project.
16
18
 
17
19
  Refactor rules:
18
20
  - Improve clarity, boundaries, naming, validation, error handling, tests, and docs.
@@ -12,7 +12,7 @@ Before reviewing:
12
12
  4. Load only the rules relevant to the changed scope.
13
13
  5. For UI changes, load .agent-context/prompts/bootstrap-design.md, .agent-context/rules/frontend-architecture.md, docs/DESIGN.md, and docs/design-intent.json when present.
14
14
  6. Enforce Universal SOP hard gate: block coding flow when required project docs are missing (`docs/architecture-decision-record.md`, and for UI scope `docs/DESIGN.md` plus `docs/design-intent.json`).
15
- 7. Enforce single-source and lazy-loading policy: canonical rule source must be explicitly enforced, language-specific guidance must load lazily based on detected scope, and conflicting duplicate rule instructions must not appear during normal flow.
15
+ 7. Enforce single-source and lazy-loading policy: canonical rule source must be explicitly enforced, global domain governance must load lazily based on touched scope, and conflicting duplicate rule instructions must not appear during normal flow.
16
16
 
17
17
  Prioritize findings in this order:
18
18
  1. Correctness, data loss, security, privacy, auth, and permission risks.
@@ -27,5 +27,5 @@ For every finding:
27
27
  - reference the rule or contract only when it materially supports the finding
28
28
  - propose the smallest safe fix
29
29
 
30
- Do not invent stack-specific concerns unless the repo or changed files prove they apply.
30
+ Do not create stack-specific governance concerns. Use project framework details only for concrete implementation risks proven by changed code, docs, or current official documentation.
31
31
  ```
@@ -6,6 +6,10 @@ Use this when module structure, feature shape, public contracts, topology, or re
6
6
 
7
7
  - [ ] The changed code has clear transport, application, domain, and infrastructure boundaries where those layers exist.
8
8
  - [ ] Business policy is not hidden in transport handlers, UI adapters, database queries, framework glue, or generated code.
9
+ - [ ] Controllers and route handlers only translate protocol input/output, enforce edge checks, and delegate business flow.
10
+ - [ ] Service or use-case code owns orchestration, transactions, state transitions, and idempotency decisions.
11
+ - [ ] Repository or adapter code owns persistence and external IO details without hiding product policy in queries.
12
+ - [ ] Global backend/API governance is used directly; no stack-specific adapter or framework-specific rule fork was introduced.
9
13
  - [ ] Internal models do not leak across public API, event, CLI, library, or UI contracts without a deliberate mapping.
10
14
  - [ ] Modules import through public entrypoints instead of deep internal paths.
11
15
  - [ ] Circular dependencies are absent or explicitly removed.
@@ -35,6 +39,10 @@ Use this when module structure, feature shape, public contracts, topology, or re
35
39
  - [ ] API, event, CLI, library, data, and UI contracts are documented before or alongside implementation.
36
40
  - [ ] Schema and validation strategy matches the project’s chosen runtime and official docs.
37
41
  - [ ] Error contracts are safe, stable, and do not leak internals.
42
+ - [ ] List endpoints have bounded pagination, limits, or streaming behavior documented.
43
+ - [ ] Sensitive mutations have documented idempotency, retry, and duplicate-submit behavior.
44
+ - [ ] Error contracts document stable codes, safe trace or correlation identifiers, and any Problem Details-style fields when exposed.
45
+ - [ ] Async/event contracts document retry, ordering, duplicate handling, and dead-letter or recovery behavior.
38
46
  - [ ] Migration and rollback plans exist for risky data or public contract changes.
39
47
 
40
48
  ## Operational Review
@@ -43,3 +51,7 @@ Use this when module structure, feature shape, public contracts, topology, or re
43
51
  - [ ] Observability, logging, and health checks match the project’s runtime and risk level.
44
52
  - [ ] Security assumptions are documented and enforced at trust boundaries.
45
53
  - [ ] Performance-sensitive paths avoid avoidable repeated work, unbounded lists, and hidden blocking operations.
54
+ - [ ] Relational reads avoid N+1 patterns or include an explicit query-shape rationale.
55
+ - [ ] Multi-table or cross-resource writes are transactional or include a documented compensating recovery path.
56
+ - [ ] Dual-write database plus message flows use an outbox or equivalent atomicity and replay strategy.
57
+ - [ ] Cross-service consistency avoids default two-phase commit and defines saga, compensation, or recovery behavior when needed.
@@ -24,6 +24,10 @@ Run this before declaring a task done. Apply only the sections relevant to the c
24
24
  - [ ] No clever hacks in backend and shared core modules
25
25
  - [ ] No premature abstraction (base classes/util layers created only after repeated stable patterns)
26
26
  - [ ] Readability over brevity for maintainability
27
+ - [ ] Controllers, route handlers, and transport adapters do not contain business policy, raw queries, or cross-resource orchestration.
28
+ - [ ] Services or use cases own business flow, transaction boundaries, and mutation safety.
29
+ - [ ] Repositories or adapters own persistence/external IO details without hiding business decisions.
30
+ - [ ] Backend/API governance was applied through global domain rules, not stack-specific adapters or framework-only branches.
27
31
  - [ ] Code is grouped by feature/domain where that improves maintainability.
28
32
  - [ ] Cross-module access uses public contracts instead of internal file reach-through.
29
33
  - [ ] Files above roughly 1000 lines were split or explicitly justified.
@@ -32,14 +36,18 @@ Run this before declaring a task done. Apply only the sections relevant to the c
32
36
  ## 4. Security And Privacy
33
37
 
34
38
  - [ ] External input is validated at trust boundaries using the project’s chosen validation approach.
39
+ - [ ] Body, query, params, headers, cookies, uploads, webhooks, and job payloads are treated as untrusted until validated and normalized.
35
40
  - [ ] Secrets, tokens, credentials, and private data are not committed or logged.
36
41
  - [ ] Authorization is enforced at a trusted boundary.
37
42
  - [ ] Error responses and logs do not leak internals.
43
+ - [ ] Least privilege, resource-level authorization, and secret handling are preserved where sensitive data or privileged actions are touched.
38
44
  - [ ] Dependency or platform security claims are based on current official docs or repo evidence.
39
45
 
40
46
  ## 5. Testing
41
47
 
42
48
  - [ ] Changed behavior has appropriate tests at the smallest useful level.
49
+ - [ ] API changes cover validation, authorization, documented error shape, pagination defaults, and empty states where relevant.
50
+ - [ ] Sensitive mutations include idempotency or duplicate-submit coverage where duplicate side effects would be harmful.
43
51
  - [ ] Tests assert behavior and contracts, not implementation trivia.
44
52
  - [ ] Critical flows include failure-path coverage.
45
53
  - [ ] Test fixtures are readable and do not hide the behavior under test.
@@ -88,7 +96,7 @@ Run this before declaring a task done. Apply only the sections relevant to the c
88
96
  - [ ] State internals are exposed only on explicit request.
89
97
  - [ ] Diagnostic mode can explain relevant state decisions when needed.
90
98
  - [ ] Canonical rule source is explicitly defined and enforced
91
- - [ ] Language-specific guidance is loaded lazily based on detected scope
99
+ - [ ] Global domain governance is loaded lazily based on touched scope
92
100
  - [ ] No conflicting duplicate rule instructions during normal flow
93
101
  - [ ] Canonical rule source is explicit and duplicate/conflicting instructions are avoided.
94
102
 
@@ -9,6 +9,10 @@ If a change affects an API, CLI command, exported library behavior, schema, even
9
9
  - Document the public surface before or alongside implementation.
10
10
  - Machine-readable API contracts should use the current project standard. If unresolved, the LLM must recommend a current maintained option from official docs.
11
11
  - HTTP APIs should prefer OpenAPI 3.1 when no stronger project standard exists.
12
+ - List endpoints must document pagination, limits, filtering, sorting, and empty-state behavior.
13
+ - Sensitive mutation endpoints must document idempotency behavior, retry safety, duplicate-submit handling, and any required idempotency key or request fingerprint.
14
+ - Public error contracts must document stable machine-readable codes and any RFC 9457 Problem Details-style fields the project exposes, including safe trace or correlation identifiers when present.
15
+ - Async, webhook, and event contracts must document idempotency, retry, ordering, dead-letter or recovery behavior, and duplicate-message handling.
12
16
  - Event APIs should define producer, consumer, payload, versioning, retry, and failure behavior.
13
17
  - CLI/library public behavior must update README, help text, changelog, or docs as appropriate.
14
18
  - Do not write "see code" as the contract.
@@ -50,9 +50,9 @@ The `.agent-context/rules/` directory is the default guidance source for impleme
50
50
 
51
51
  - Canonical rule source is .instructions.md.
52
52
  - Adapter entry files stay thin and must point to the canonical source.
53
- - Load language-specific stack guidance lazily based on detected scope.
54
- - Load language-specific or framework-specific guidance lazily based on changed files, explicit constraints, and repo evidence.
55
- - Do not preload unrelated stack profiles during normal flow.
53
+ - Load global domain rules lazily based on touched scope.
54
+ - Do not create or load stack-specific governance adapters as the baseline.
55
+ - Runtime or framework evidence can clarify implementation details, but it must not replace the global architecture, security, data, API, error, event, and testing boundaries.
56
56
  - Keep rule-loading output deterministic for init and release validation.
57
57
 
58
58
  ## Architecture Decision Boundary
@@ -10,4 +10,13 @@ Reject these bad habits:
10
10
  - raw query construction that bypasses safe parameterization
11
11
  - destructive data changes without backup, migration, or deployment sequencing notes
12
12
 
13
+ Backend data access rules:
14
+ - Relational reads must avoid N+1 query patterns. Use eager loading, joins, batching, or explicit query-shape rationale based on the project's ORM or database driver.
15
+ - List endpoints and exports must paginate, limit, stream, or otherwise bound growable datasets by default.
16
+ - Use cursor pagination for large or frequently changing datasets when the project contract allows it; offset pagination is acceptable for small, stable, explicitly bounded collections.
17
+ - Define maximum page size, payload size, and export limits so list responses cannot exhaust memory or connection pools.
18
+ - Mutations that write more than one table, aggregate, queue, or external consistency boundary must run inside a transaction or document the compensating recovery path.
19
+ - Repository and data-access layers own persistence mechanics. They must not hide business policy that belongs in application or domain logic.
20
+ - Cross-domain persistence must respect ownership boundaries. Independent services must not share database tables as an integration contract; modular monoliths may share one database only when module ownership and access paths stay explicit.
21
+
13
22
  Docs must record entity ownership, relationships, constraints, data lifecycle, migration risk, and assumptions to validate.
@@ -9,4 +9,12 @@ Reject these failure patterns:
9
9
  - retries without transient-failure evidence, limits, backoff, and a clear final outcome
10
10
  - logs that say only "something failed" without action, target, actor, or trace context
11
11
 
12
+ Backend API error rules:
13
+ - Use the framework's normal centralized error boundary or middleware for HTTP/API responses.
14
+ - Do not return raw exception messages, stack traces, SQL, provider payloads, file paths, secrets, or infrastructure details to callers.
15
+ - Public API errors must use a stable JSON shape with at least `code` and `message`; include `details` only when the data is safe, documented, and useful to the caller. HTTP APIs may use an RFC 9457 Problem Details-style shape when it fits the project contract.
16
+ - Domain and validation errors should keep machine-readable codes so tests, clients, and operators can distinguish expected failures from defects.
17
+ - API boundary errors should include a safe correlation or trace identifier when observability exists, while protected logs keep the internal exception, actor, target, and trace context.
18
+ - Distributed systems should preserve trace context across ingress and egress using the project's tracing standard, such as W3C Trace Context or OpenTelemetry propagation.
19
+
12
20
  At boundaries, validate early, return safe user-facing errors, and keep machine-readable error context for operators and callers.
@@ -17,6 +17,9 @@ Hard rules:
17
17
  - consumers are idempotent
18
18
  - retries are bounded and dead-letter or recovery behavior is defined
19
19
  - transactional publishing uses an outbox or equivalent safety pattern when data consistency matters
20
+ - dual-write flows that update local state and publish a message must use a transactional outbox or document an equivalent atomicity and replay strategy
21
+ - distributed transactions and two-phase commit are not the default recovery model; prefer local transactions plus saga, choreography, orchestration, or explicit compensating actions when consistency crosses service boundaries
22
+ - message handlers must record processed message identifiers or use another duplicate-detection strategy when the delivery model can retry or redeliver
20
23
  - event catalogs or docs identify producer, consumers, ownership, and schema evolution rules
21
24
 
22
25
  If event tooling is unresolved, the LLM must recommend a current project-fit broker or managed service from official docs before implementation.
@@ -35,7 +35,9 @@ Hard rules:
35
35
  - Each service owns its data boundary.
36
36
  - Public service contracts must be documented before implementation or extraction.
37
37
  - Cross-service calls need timeout, retry, idempotency, observability, and recovery behavior.
38
+ - Independent services must not use shared tables as their integration contract; communicate through documented APIs, events, or async workflows owned by the source domain.
38
39
  - Avoid synchronous call chains that turn services into a distributed monolith.
40
+ - Critical cross-service mutations should prefer local transactions plus outbox, saga, choreography, orchestration, or compensating actions over two-phase commit by default.
39
41
  - Prefer incremental extraction over rewrites.
40
42
 
41
43
  If the evidence is unclear, document the uncertainty and keep the topology agent-recommended instead of pretending an offline default is correct.
@@ -10,5 +10,16 @@ Hard rules:
10
10
  - enforce authorization at the server or trusted boundary, not only in UI state
11
11
  - return safe client-facing errors and keep sensitive detail in protected logs
12
12
  - document auth, permission, data exposure, rate-limit, and abuse assumptions before changing sensitive flows
13
+ - apply least privilege to service accounts, API tokens, database users, background jobs, and operator/admin actions
14
+ - retrieve secrets through environment, runtime secret injection, or the project's secret manager; do not store static secrets in source or plaintext config
15
+ - keep `.env` and local secret files covered by `.gitignore`; commit only safe examples such as `.env.example`
16
+ - treat transport encryption, secure cookies, and trusted proxy boundaries as deployment assumptions that must be documented when sensitive traffic is involved
17
+
18
+ Zero-trust API input rules:
19
+ - Treat body, query, params, headers, cookies, uploaded files, webhook payloads, and background job payloads as untrusted until validated.
20
+ - Validate and normalize input at the outer boundary before it reaches service, use-case, repository, or domain logic.
21
+ - Services should receive typed, already-validated values and still enforce domain invariants for security-sensitive rules.
22
+ - Sanitization must match the sink: SQL, shell, file path, log, HTML, template, and URL contexts need different protections.
23
+ - Authorization must be resource-aware when data ownership matters. Prefer row, tenant, account, organization, or resource-level checks over role-only checks for sensitive records.
13
24
 
14
25
  For high-risk changes, check current framework security docs and record the relevant source or assumption in the implementation notes.
@@ -8,6 +8,14 @@ Test what can break:
8
8
  - regressions around bugs being fixed
9
9
  - critical accessibility or responsive behavior when UI is in scope
10
10
 
11
+ Backend/API test rules:
12
+ - API tests must cover request validation, authorization boundaries, success responses, documented error shapes, pagination defaults, and empty states for touched endpoints.
13
+ - Sensitive mutations such as payments, orders, status changes, inventory adjustments, and account/security changes must include duplicate-submit or retry tests when idempotency is required.
14
+ - Data-access changes must include evidence for query shape, transaction behavior, rollback or recovery paths, and N+1 prevention when relational reads are touched.
15
+ - Event or worker changes must test retry, duplicate-message handling, dead-letter or recovery behavior, and outbox relay semantics when those paths exist.
16
+ - Distributed consistency changes must test the local transaction, publish/retry behavior, and compensating action or recovery path rather than only the happy path.
17
+ - Tests should make the API contract obvious from the fixture names, inputs, and expected response shape.
18
+
11
19
  Do not test framework internals, third-party library behavior, private implementation trivia, or snapshots that only freeze noise.
12
20
 
13
21
  Tests should describe behavior, keep setup readable, and mock only at real boundaries such as network, filesystem, clock, database, or external services.
@@ -1,5 +1,5 @@
1
1
  {
2
- "generatedAt": "2026-04-25T03:25:49.150Z",
2
+ "generatedAt": "2026-04-25T10:16:51.159Z",
3
3
  "reportName": "memory-continuity-benchmark",
4
4
  "schemaVersion": "1.0.0",
5
5
  "passed": true,
@@ -1,16 +1,27 @@
1
1
  {
2
- "generatedAt": "2026-04-11T12:21:37.776Z",
2
+ "generatedAt": "2026-04-25T09:59:20.980Z",
3
3
  "reportName": "weekly-governance-report",
4
4
  "methodology": {
5
5
  "qualityTrendSource": "state-file",
6
6
  "qualityTrendGeneratedAt": "2026-04-11T12:21:35.779Z",
7
7
  "commitWindowDays": 7,
8
8
  "requiredVerifiedDomains": [
9
- "cli",
10
- "frontend",
11
- "fullstack",
12
- "distribution",
13
- "review-quality"
9
+ "canonical-instructions",
10
+ "frontend-design-contract",
11
+ "frontend-architecture",
12
+ "backend-architecture",
13
+ "backend-security",
14
+ "backend-data-access",
15
+ "backend-error-handling",
16
+ "backend-api-contract",
17
+ "backend-testing",
18
+ "backend-performance",
19
+ "backend-idempotency",
20
+ "backend-risk-map",
21
+ "pr-checklist",
22
+ "architecture-review",
23
+ "mcp-server",
24
+ "state-continuity"
14
25
  ]
15
26
  },
16
27
  "qualitySignals": {
@@ -31,64 +42,236 @@
31
42
  "skillTrust": {
32
43
  "domains": [
33
44
  {
34
- "domain": "backend",
35
- "tier": "experimental",
36
- "score": 25
45
+ "domain": "architecture-review",
46
+ "tier": "verified",
47
+ "score": 100,
48
+ "sourcePath": ".agent-context/review-checklists/architecture-review.md"
49
+ },
50
+ {
51
+ "domain": "backend-api-contract",
52
+ "tier": "verified",
53
+ "score": 100,
54
+ "sourcePath": ".agent-context/rules/api-docs.md"
55
+ },
56
+ {
57
+ "domain": "backend-architecture",
58
+ "tier": "verified",
59
+ "score": 100,
60
+ "sourcePath": ".agent-context/rules/architecture.md"
61
+ },
62
+ {
63
+ "domain": "backend-data-access",
64
+ "tier": "verified",
65
+ "score": 100,
66
+ "sourcePath": ".agent-context/rules/database-design.md"
67
+ },
68
+ {
69
+ "domain": "backend-error-handling",
70
+ "tier": "verified",
71
+ "score": 100,
72
+ "sourcePath": ".agent-context/rules/error-handling.md"
73
+ },
74
+ {
75
+ "domain": "backend-idempotency",
76
+ "tier": "verified",
77
+ "score": 100,
78
+ "sourcePath": ".agent-context/rules/event-driven.md"
37
79
  },
38
80
  {
39
- "domain": "cli",
81
+ "domain": "backend-performance",
40
82
  "tier": "verified",
41
- "score": 100
83
+ "score": 100,
84
+ "sourcePath": ".agent-context/rules/performance.md"
42
85
  },
43
86
  {
44
- "domain": "distribution",
87
+ "domain": "backend-risk-map",
45
88
  "tier": "verified",
46
- "score": 100
89
+ "score": 100,
90
+ "sourcePath": ".agent-context/state/architecture-map.md"
47
91
  },
48
92
  {
49
- "domain": "frontend",
93
+ "domain": "backend-security",
50
94
  "tier": "verified",
51
- "score": 100
95
+ "score": 100,
96
+ "sourcePath": ".agent-context/rules/security.md"
52
97
  },
53
98
  {
54
- "domain": "fullstack",
99
+ "domain": "backend-testing",
55
100
  "tier": "verified",
56
- "score": 100
101
+ "score": 100,
102
+ "sourcePath": ".agent-context/rules/testing.md"
57
103
  },
58
104
  {
59
- "domain": "review-quality",
105
+ "domain": "canonical-instructions",
60
106
  "tier": "verified",
61
- "score": 100
107
+ "score": 100,
108
+ "sourcePath": ".instructions.md"
109
+ },
110
+ {
111
+ "domain": "frontend-architecture",
112
+ "tier": "verified",
113
+ "score": 100,
114
+ "sourcePath": ".agent-context/rules/frontend-architecture.md"
115
+ },
116
+ {
117
+ "domain": "frontend-design-contract",
118
+ "tier": "verified",
119
+ "score": 100,
120
+ "sourcePath": ".agent-context/prompts/bootstrap-design.md"
121
+ },
122
+ {
123
+ "domain": "mcp-server",
124
+ "tier": "verified",
125
+ "score": 100,
126
+ "sourcePath": "scripts/mcp-server.mjs"
127
+ },
128
+ {
129
+ "domain": "pr-checklist",
130
+ "tier": "verified",
131
+ "score": 100,
132
+ "sourcePath": ".agent-context/review-checklists/pr-checklist.md"
133
+ },
134
+ {
135
+ "domain": "state-continuity",
136
+ "tier": "verified",
137
+ "score": 100,
138
+ "sourcePath": ".agent-context/state"
62
139
  }
63
140
  ],
64
141
  "tierCounts": {
65
- "verified": 5,
142
+ "verified": 16,
66
143
  "community": 0,
67
- "experimental": 1
144
+ "experimental": 0
68
145
  },
69
146
  "requiredVerifiedDomains": [
70
- "cli",
71
- "frontend",
72
- "fullstack",
73
- "distribution",
74
- "review-quality"
147
+ "canonical-instructions",
148
+ "frontend-design-contract",
149
+ "frontend-architecture",
150
+ "backend-architecture",
151
+ "backend-security",
152
+ "backend-data-access",
153
+ "backend-error-handling",
154
+ "backend-api-contract",
155
+ "backend-testing",
156
+ "backend-performance",
157
+ "backend-idempotency",
158
+ "backend-risk-map",
159
+ "pr-checklist",
160
+ "architecture-review",
161
+ "mcp-server",
162
+ "state-continuity"
75
163
  ],
76
164
  "requiredVerifiedDomainFailures": [],
77
165
  "allRequiredVerified": true
78
166
  },
167
+ "backendGovernance": {
168
+ "status": "verified",
169
+ "summary": "Backend governance is verified across architecture, security, data access, error handling, API contracts, testing, performance, idempotency, and risk-map surfaces.",
170
+ "requiredSurfaceCount": 9,
171
+ "verifiedSurfaceCount": 9,
172
+ "missingSurfaceNames": [],
173
+ "coverage": [
174
+ {
175
+ "constraint": "Layered architecture and separation of concerns",
176
+ "status": "covered",
177
+ "sourcePaths": [
178
+ ".agent-context/rules/architecture.md",
179
+ ".agent-context/review-checklists/architecture-review.md"
180
+ ],
181
+ "signal": "Transport, application, domain, and infrastructure boundaries are explicit."
182
+ },
183
+ {
184
+ "constraint": "Global backend/API rule routing",
185
+ "status": "strengthened",
186
+ "sourcePaths": [
187
+ ".instructions.md",
188
+ ".agent-context/rules/architecture.md",
189
+ ".agent-context/prompts/refactor.md"
190
+ ],
191
+ "signal": "Backend/API governance routes by problem domain and stays stack-agnostic; no stack-specific governance adapters are created."
192
+ },
193
+ {
194
+ "constraint": "Zero-trust input validation",
195
+ "status": "strengthened",
196
+ "sourcePaths": [
197
+ ".agent-context/rules/security.md",
198
+ ".agent-context/review-checklists/pr-checklist.md"
199
+ ],
200
+ "signal": "User-controlled body, query, params, headers, cookies, files, webhooks, and job payloads must be validated before service logic."
201
+ },
202
+ {
203
+ "constraint": "Data access performance and integrity",
204
+ "status": "strengthened",
205
+ "sourcePaths": [
206
+ ".agent-context/rules/database-design.md",
207
+ ".agent-context/rules/performance.md",
208
+ ".agent-context/state/architecture-map.md"
209
+ ],
210
+ "signal": "Backend reads must avoid N+1 and unbounded list responses; multi-write mutations need transaction or recovery evidence."
211
+ },
212
+ {
213
+ "constraint": "Distributed consistency and outbox safety",
214
+ "status": "strengthened",
215
+ "sourcePaths": [
216
+ ".agent-context/rules/event-driven.md",
217
+ ".agent-context/rules/database-design.md",
218
+ ".agent-context/rules/microservices.md"
219
+ ],
220
+ "signal": "Dual-write flows need outbox or equivalent replay safety, and cross-service consistency must define saga, compensation, or recovery behavior instead of defaulting to two-phase commit."
221
+ },
222
+ {
223
+ "constraint": "Safe centralized API errors",
224
+ "status": "strengthened",
225
+ "sourcePaths": [
226
+ ".agent-context/rules/error-handling.md",
227
+ ".agent-context/rules/api-docs.md"
228
+ ],
229
+ "signal": "HTTP/API responses use safe machine-readable error shapes, may align with RFC 9457 Problem Details, and preserve safe trace/correlation identifiers without leaking internals."
230
+ },
231
+ {
232
+ "constraint": "Sensitive mutation idempotency",
233
+ "status": "strengthened",
234
+ "sourcePaths": [
235
+ ".agent-context/rules/api-docs.md",
236
+ ".agent-context/rules/testing.md",
237
+ ".agent-context/rules/event-driven.md"
238
+ ],
239
+ "signal": "Payments, orders, status changes, and other risky mutations must document and test duplicate-submit behavior."
240
+ },
241
+ {
242
+ "constraint": "API contract and behavior testing",
243
+ "status": "strengthened",
244
+ "sourcePaths": [
245
+ ".agent-context/rules/testing.md",
246
+ ".agent-context/review-checklists/pr-checklist.md"
247
+ ],
248
+ "signal": "API tests cover validation, auth, documented error shapes, pagination defaults, empty states, and mutation retry safety."
249
+ }
250
+ ],
251
+ "developmentFocus": [
252
+ {
253
+ "focus": "Keep backend guidance global and stack-agnostic.",
254
+ "reason": "The repo should enforce architecture, security, API, data, error, event, and testing thinking without building Nest, Laravel, FastAPI, Express, Go, or other stack-specific governance adapters."
255
+ },
256
+ {
257
+ "focus": "Use framework facts only when implementing inside an existing project.",
258
+ "reason": "LLMs can apply current ecosystem knowledge directly; governance should route the relevant global constraints instead of acting as a stack detector."
259
+ }
260
+ ]
261
+ },
79
262
  "commitSignals": {
80
263
  "windowDays": 7,
81
- "commitCount": 18,
82
- "releaseCommitCount": 7,
264
+ "commitCount": 30,
265
+ "releaseCommitCount": 18,
83
266
  "rollbackCommitCount": 1,
84
- "releaseFrequencyPercent": 38.89,
85
- "rollbackFrequencyPercent": 5.56,
267
+ "releaseFrequencyPercent": 60,
268
+ "rollbackFrequencyPercent": 3.33,
86
269
  "error": null
87
270
  },
88
271
  "releaseReadiness": {
89
272
  "isReady": true,
90
273
  "blockers": [],
91
- "summary": "Weekly governance posture is ready for maintenance releases."
274
+ "summary": "Weekly governance posture is ready for maintenance releases with frontend and backend governance surfaces verified."
92
275
  },
93
276
  "artifact": {
94
277
  "path": "E:\\Project\\Agentic-Senior-Core\\.agent-context\\state\\weekly-governance-report.json",
@@ -121,6 +304,26 @@
121
304
  "verifiedSkillDomainCount": 5,
122
305
  "releaseFrequencyPercent": 38.89,
123
306
  "rollbackFrequencyPercent": 5.56
307
+ },
308
+ {
309
+ "generatedAt": "2026-04-25T06:41:17.654Z",
310
+ "readinessStatus": "ready",
311
+ "blockerCount": 0,
312
+ "gatePassRatePercent": 100,
313
+ "verifiedSkillDomainCount": 16,
314
+ "backendVerifiedSurfaceCount": 9,
315
+ "releaseFrequencyPercent": 60,
316
+ "rollbackFrequencyPercent": 3.33
317
+ },
318
+ {
319
+ "generatedAt": "2026-04-25T09:59:20.980Z",
320
+ "readinessStatus": "ready",
321
+ "blockerCount": 0,
322
+ "gatePassRatePercent": 100,
323
+ "verifiedSkillDomainCount": 16,
324
+ "backendVerifiedSurfaceCount": 9,
325
+ "releaseFrequencyPercent": 60,
326
+ "rollbackFrequencyPercent": 3.33
124
327
  }
125
328
  ]
126
329
  }
package/.cursorrules CHANGED
@@ -1,6 +1,6 @@
1
1
  # AGENTIC-SENIOR-CORE DYNAMIC GOVERNANCE RULESET
2
2
 
3
- Generated by Agentic-Senior-Core CLI v3.0.26
3
+ Generated by Agentic-Senior-Core CLI v3.0.27
4
4
  Timestamp: 2026-04-24T06:02:48.303Z
5
5
  Selected policy file: .agent-context/policies/llm-judge-threshold.json
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Adapter Mode: thin
4
4
  Adapter Source: .instructions.md
5
- Canonical Snapshot SHA256: e6984d32169e98e32c9e6b6d6209bb2613b63b22d1e66af63a70788be00c55d5
5
+ Canonical Snapshot SHA256: 11eeafb3ff6a0977785e3668a704c6bba543b515d2828c02de8276f6cf1c391c
6
6
 
7
7
  Canonical policy source: [.instructions.md](../.instructions.md).
8
8
 
@@ -10,6 +10,7 @@ If your host stops at this file, follow this minimum floor:
10
10
  - Read `.agent-instructions.md` next when it exists.
11
11
  - For UI or redesign requests, load [.agent-context/prompts/bootstrap-design.md](../.agent-context/prompts/bootstrap-design.md) and [.agent-context/rules/frontend-architecture.md](../.agent-context/rules/frontend-architecture.md) before coding.
12
12
  - If UI scope and `docs/DESIGN.md` or `docs/design-intent.json` is missing, materialize them before UI implementation.
13
+ - For backend/API/data/auth/event requests, load relevant global rules from [.agent-context/rules/](../.agent-context/rules) and do not create stack-specific governance adapters.
13
14
  - Memory continuity is host-dependent project memory and does not replace bootstrap loading.
14
15
 
15
16
  ## Bootstrap Sequence
@@ -20,7 +21,7 @@ If your host stops at this file, follow this minimum floor:
20
21
  4. Load request templates from [.agent-context/prompts/](../.agent-context/prompts).
21
22
  5. Apply review contracts from [.agent-context/review-checklists/](../.agent-context/review-checklists).
22
23
  6. Apply state awareness from [.agent-context/state/](../.agent-context/state) and policy thresholds from [.agent-context/policies/](../.agent-context/policies).
23
- 7. Resolve stack, structure, and dependency choices from project context docs plus live evidence.
24
+ 7. Resolve runtime, structure, and dependency choices from project context docs plus live evidence.
24
25
 
25
26
  ## Completion Gate
26
27
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Adapter Mode: thin
4
4
  Adapter Source: .instructions.md
5
- Canonical Snapshot SHA256: e6984d32169e98e32c9e6b6d6209bb2613b63b22d1e66af63a70788be00c55d5
5
+ Canonical Snapshot SHA256: 11eeafb3ff6a0977785e3668a704c6bba543b515d2828c02de8276f6cf1c391c
6
6
 
7
7
  The canonical policy source for this repository is [.instructions.md](../.instructions.md).
8
8
 
@@ -10,6 +10,7 @@ If your host stops at this file, follow this minimum floor:
10
10
  - Read `.agent-instructions.md` next when it exists.
11
11
  - For UI or redesign requests, load [.agent-context/prompts/bootstrap-design.md](../.agent-context/prompts/bootstrap-design.md) and [.agent-context/rules/frontend-architecture.md](../.agent-context/rules/frontend-architecture.md) before coding.
12
12
  - If UI scope and `docs/DESIGN.md` or `docs/design-intent.json` is missing, materialize them before UI implementation.
13
+ - For backend/API/data/auth/event requests, load relevant global rules from [.agent-context/rules/](../.agent-context/rules) and do not create stack-specific governance adapters.
13
14
  - Memory continuity is host-dependent project memory and does not replace bootstrap loading.
14
15
 
15
16
  ## Required Load Order
@@ -20,7 +21,7 @@ If your host stops at this file, follow this minimum floor:
20
21
  4. Load request templates from [.agent-context/prompts/](../.agent-context/prompts).
21
22
  5. Apply review contracts from [.agent-context/review-checklists/](../.agent-context/review-checklists).
22
23
  6. Apply state awareness from [.agent-context/state/](../.agent-context/state) and thresholds from [.agent-context/policies/](../.agent-context/policies).
23
- 7. Resolve stack, structure, and dependency choices from project context docs plus live evidence.
24
+ 7. Resolve runtime, structure, and dependency choices from project context docs plus live evidence.
24
25
 
25
26
  ## Completion Gate
26
27
 
package/.instructions.md CHANGED
@@ -40,12 +40,27 @@ Available engineering rule files:
40
40
 
41
41
  **What to do**: Resolve only the rule files relevant to the current task. Do not read the entire rule directory by default. For UI-only work, start with `bootstrap-design.md` and `frontend-architecture.md` and keep backend or DevOps rules unloaded unless the task explicitly crosses those boundaries. For Docker or Compose work, load `docker-runtime.md` and verify the latest official Docker docs before authoring container assets. For framework or package setup work, use the latest stable compatible dependency set and official setup flow unless a documented compatibility constraint blocks it.
42
42
 
43
+ ### Global Backend/API Governance Routing
44
+
45
+ This is global governance, not a stack-specific adapter system. Do not create Nest, Laravel, FastAPI, Express, Go, Ruby, PHP, Java, or framework-specific baseline adapters from this repository. The LLM may use its general knowledge and current official docs when a concrete project already uses a tool, but the governance layer stays architecture- and runtime-agnostic.
46
+
47
+ When backend/API work is in scope, load only the relevant global rule files:
48
+
49
+ - Data, schema, repository, ORM, query, transaction, migration, pagination, or persistence scope: load `architecture.md`, `database-design.md`, `performance.md`, and `testing.md`.
50
+ - Endpoint, controller, route handler, public API, request/response contract, validation failure, or API error scope: load `architecture.md`, `api-docs.md`, `error-handling.md`, `security.md`, and `testing.md`.
51
+ - Authentication, authorization, secrets, user input, webhook, upload, session, token, or permission scope: load `security.md`, `error-handling.md`, and `testing.md`.
52
+ - Queue, worker, cron, event stream, message broker, async workflow, retry, or cross-system mutation scope: load `event-driven.md`, `database-design.md`, `error-handling.md`, `performance.md`, and `testing.md`.
53
+ - Multi-service, distributed consistency, service boundary, or cross-domain data ownership scope: load `microservices.md`, `event-driven.md`, `database-design.md`, `api-docs.md`, and `architecture.md`.
54
+
55
+ If multiple bullets match, load the union once, then implement against the project framework already present. Do not expand into unrelated stack guides just because a runtime name appears.
56
+
43
57
  ### Layer 2: Runtime Decision Signals (Dynamic)
44
58
 
45
59
  **Location**: dynamic runtime intelligence from project context, repository evidence, and live research.
46
60
 
47
61
  Runtime signals are evidence gates, not style cues or popularity rankings.
48
62
  Do not force the project into a listed stack when repository evidence, delivery constraints, or ecosystem reality require another shape.
63
+ Runtime evidence must not become per-stack governance. Use it to understand the project that already exists, not to choose or inject framework-specific rule adapters.
49
64
 
50
65
  **What to do**: For fresh projects, recommend the runtime/framework from the first brief, current constraints, and live official documentation before coding. For existing projects, inspect repo evidence directly and treat detected markers as evidence only, not migration or design direction. Ignore pattern frequency, external rankings, and remembered defaults.
51
66
 
@@ -203,7 +218,7 @@ Why Required: [why the boundary protects the project]
203
218
  Verify that all nine layers are reachable:
204
219
 
205
220
  - Layer 1: Rules
206
- - Layer 2: Stack Strategy Signals
221
+ - Layer 2: Runtime Decision Signals
207
222
  - Layer 3: Structural Planning Signals
208
223
  - Layer 4: Execution Contracts
209
224
  - Layer 5: Prompts
package/.windsurfrules CHANGED
@@ -1,6 +1,6 @@
1
1
  # AGENTIC-SENIOR-CORE DYNAMIC GOVERNANCE RULESET
2
2
 
3
- Generated by Agentic-Senior-Core CLI v3.0.26
3
+ Generated by Agentic-Senior-Core CLI v3.0.27
4
4
  Timestamp: 2026-04-24T06:02:48.303Z
5
5
  Selected policy file: .agent-context/policies/llm-judge-threshold.json
6
6
 
package/AGENTS.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Adapter Mode: thin
4
4
  Adapter Source: .instructions.md
5
- Canonical Snapshot SHA256: e6984d32169e98e32c9e6b6d6209bb2613b63b22d1e66af63a70788be00c55d5
5
+ Canonical Snapshot SHA256: 11eeafb3ff6a0977785e3668a704c6bba543b515d2828c02de8276f6cf1c391c
6
6
 
7
7
  This file is an adapter entrypoint for agent discovery.
8
8
  The canonical policy source is [.instructions.md](.instructions.md).
@@ -15,8 +15,9 @@ If your host stops at this file instead of following the full chain, obey the Cr
15
15
  - Memory continuity does not replace bootstrap loading. It is host-dependent project memory, not a guarantee that instructions were reloaded for this session.
16
16
  - For UI, UX, layout, screen, tailwind, frontend, or redesign requests: load [.agent-context/prompts/bootstrap-design.md](.agent-context/prompts/bootstrap-design.md) and [.agent-context/rules/frontend-architecture.md](.agent-context/rules/frontend-architecture.md) before editing code.
17
17
  - For UI scope: if `docs/DESIGN.md` or `docs/design-intent.json` is missing, materialize or refine them before implementing UI changes.
18
+ - For backend, API, data, auth, error, event, queue, worker, or distributed-system requests: load the relevant global rules from [.agent-context/rules/](.agent-context/rules); do not create stack-specific governance adapters.
18
19
  - For refactor, improve, clean up, or fix requests: inspect the active rules and propose a plan before editing.
19
- - For new project or module requests: clarify constraints, stack decisions, and required docs before generating code.
20
+ - For new project or module requests: clarify constraints, runtime decisions, and required docs before generating code.
20
21
  - For ecosystem, framework, dependency, or Docker claims: perform live web research instead of relying on stale local heuristics.
21
22
 
22
23
  ## Mandatory Bootstrap Chain
@@ -28,7 +29,7 @@ If your host stops at this file instead of following the full chain, obey the Cr
28
29
  5. Enforce review contracts from [.agent-context/review-checklists/](.agent-context/review-checklists).
29
30
  6. Read change-risk maps and continuity state from [.agent-context/state/](.agent-context/state).
30
31
  7. Enforce policy thresholds from [.agent-context/policies/](.agent-context/policies).
31
- 8. Use dynamic stack, structure, and live research signals from project context docs.
32
+ 8. Use runtime evidence, structure, and live research signals from project context docs.
32
33
 
33
34
  ## Trigger Rules
34
35
 
@@ -429,6 +429,7 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
429
429
  '.github/copilot-instructions.md',
430
430
  ],
431
431
  stackLoadingMode: 'lazy',
432
+ domainRuleLoadingMode: 'lazy',
432
433
  selectedProfile: selectedPolicyProfileName,
433
434
  selectedProfileDisplayName: selectedPolicyProfile.displayName,
434
435
  blockingSeverities: selectedPolicyProfile.blockingSeverities,
@@ -253,6 +253,7 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
253
253
  canonicalSource: '.instructions.md',
254
254
  compiledEntrypoints: ['.cursorrules', '.windsurfrules'],
255
255
  stackLoadingMode: 'lazy',
256
+ domainRuleLoadingMode: 'lazy',
256
257
  selectedProfile: selectedProfileName,
257
258
  selectedProfileDisplayName: toTitleCase(selectedProfileName),
258
259
  blockingSeverities: PROFILE_PRESETS[selectedProfileName]?.blockingSeverities || [],
@@ -88,6 +88,7 @@ export async function writeOnboardingReport({
88
88
  ruleLoadingPolicy: {
89
89
  canonicalSource: '.instructions.md',
90
90
  stackLoadingMode: 'lazy',
91
+ domainRuleLoadingMode: 'lazy',
91
92
  loadedOnDemand: true,
92
93
  primaryStack: hasExplicitRuntimeDecision ? selectedStackFileName : null,
93
94
  additionalStacks: hasExplicitRuntimeDecision ? selectedAdditionalStackFileNames : [],
@@ -241,14 +242,14 @@ export async function buildCompiledRulesContent({
241
242
  if (hasExplicitRuntimeDecision && normalizedAdditionalStackFileNames.length > 0) {
242
243
  contextBlocks.push(
243
244
  [
244
- '## LAYER 2B: ADDITIONAL STACK PROFILES',
245
- 'This project uses multiple stacks. Load all additional stack profiles below:',
245
+ '## LAYER 2B: ADDITIONAL RUNTIME EVIDENCE',
246
+ 'This project has multiple runtime constraints. Load additional runtime evidence below only when the task touches that runtime:',
246
247
  ...normalizedAdditionalStackFileNames.map((stackFileName, stackIndex) => {
247
248
  if (availableStackProfileFileNames.has(stackFileName)) {
248
249
  return `${stackIndex + 1}. stack-profile:${stackFileName}`;
249
250
  }
250
251
 
251
- return `${stackIndex + 1}. ${stackFileName} (dynamic stack signal)`;
252
+ return `${stackIndex + 1}. ${stackFileName} (runtime evidence signal)`;
252
253
  }),
253
254
  ].join('\n')
254
255
  );
@@ -261,16 +262,16 @@ export async function buildCompiledRulesContent({
261
262
  ? `Primary runtime constraint: ${selectedStackFileName}`
262
263
  : 'Primary runtime constraint: unresolved until agent recommendation is approved',
263
264
  normalizedAdditionalStackFileNames.length > 0
264
- ? `Additional stack profiles load on demand: ${normalizedAdditionalStackFileNames.map((stackFileName) => {
265
+ ? `Additional runtime evidence loads on demand: ${normalizedAdditionalStackFileNames.map((stackFileName) => {
265
266
  if (availableStackProfileFileNames.has(stackFileName)) {
266
267
  return `stack-profile:${stackFileName}`;
267
268
  }
268
269
 
269
- return `${stackFileName} (dynamic signal)`;
270
+ return `${stackFileName} (runtime evidence signal)`;
270
271
  }).join(', ')}`
271
- : 'Additional runtime guidance loads only when explicitly selected by the user or required by touched code.',
272
- 'Load runtime-specific guidance only when task scope touches that runtime.',
273
- 'Avoid eager loading unrelated runtime guidance to prevent instruction conflicts.',
272
+ : 'No stack-specific governance adapter is loaded by default.',
273
+ 'Load global domain rules only when task scope touches that domain.',
274
+ 'Avoid eager loading unrelated runtime or domain guidance to prevent instruction conflicts.',
274
275
  ].join('\n')
275
276
  );
276
277
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuenn3123/agentic-senior-core",
3
- "version": "3.0.26",
3
+ "version": "3.0.27",
4
4
  "type": "module",
5
5
  "description": "Force your AI Agent to code like a Staff Engineer, not a Junior.",
6
6
  "bin": {
@@ -22,8 +22,22 @@ const ARGUMENT_FLAGS = new Set(process.argv.slice(2));
22
22
  const isStdoutOnlyMode = ARGUMENT_FLAGS.has('--stdout-only');
23
23
  const WEEKLY_WINDOW_DAYS = 7;
24
24
  const HISTORY_LIMIT = 26;
25
+ const BACKEND_REQUIRED_DOMAIN_NAMES = new Set([
26
+ 'backend-architecture',
27
+ 'backend-security',
28
+ 'backend-data-access',
29
+ 'backend-error-handling',
30
+ 'backend-api-contract',
31
+ 'backend-testing',
32
+ 'backend-performance',
33
+ 'backend-idempotency',
34
+ 'backend-risk-map',
35
+ ]);
25
36
  const REQUIRED_VERIFIED_DOMAINS = new Set([
26
37
  'canonical-instructions',
38
+ 'frontend-design-contract',
39
+ 'frontend-architecture',
40
+ ...Array.from(BACKEND_REQUIRED_DOMAIN_NAMES),
27
41
  'pr-checklist',
28
42
  'architecture-review',
29
43
  'mcp-server',
@@ -31,11 +45,100 @@ const REQUIRED_VERIFIED_DOMAINS = new Set([
31
45
  ]);
32
46
  const GOVERNANCE_SURFACE_PATHS = {
33
47
  'canonical-instructions': '.instructions.md',
48
+ 'frontend-design-contract': '.agent-context/prompts/bootstrap-design.md',
49
+ 'frontend-architecture': '.agent-context/rules/frontend-architecture.md',
50
+ 'backend-architecture': '.agent-context/rules/architecture.md',
51
+ 'backend-security': '.agent-context/rules/security.md',
52
+ 'backend-data-access': '.agent-context/rules/database-design.md',
53
+ 'backend-error-handling': '.agent-context/rules/error-handling.md',
54
+ 'backend-api-contract': '.agent-context/rules/api-docs.md',
55
+ 'backend-testing': '.agent-context/rules/testing.md',
56
+ 'backend-performance': '.agent-context/rules/performance.md',
57
+ 'backend-idempotency': '.agent-context/rules/event-driven.md',
58
+ 'backend-risk-map': '.agent-context/state/architecture-map.md',
34
59
  'pr-checklist': '.agent-context/review-checklists/pr-checklist.md',
35
60
  'architecture-review': '.agent-context/review-checklists/architecture-review.md',
36
61
  'mcp-server': 'scripts/mcp-server.mjs',
37
62
  'state-continuity': '.agent-context/state',
38
63
  };
64
+ const BACKEND_GOVERNANCE_COVERAGE = [
65
+ {
66
+ constraint: 'Layered architecture and separation of concerns',
67
+ status: 'covered',
68
+ sourcePaths: [
69
+ '.agent-context/rules/architecture.md',
70
+ '.agent-context/review-checklists/architecture-review.md',
71
+ ],
72
+ signal: 'Transport, application, domain, and infrastructure boundaries are explicit.',
73
+ },
74
+ {
75
+ constraint: 'Global backend/API rule routing',
76
+ status: 'strengthened',
77
+ sourcePaths: [
78
+ '.instructions.md',
79
+ '.agent-context/rules/architecture.md',
80
+ '.agent-context/prompts/refactor.md',
81
+ ],
82
+ signal: 'Backend/API governance routes by problem domain and stays stack-agnostic; no stack-specific governance adapters are created.',
83
+ },
84
+ {
85
+ constraint: 'Zero-trust input validation',
86
+ status: 'strengthened',
87
+ sourcePaths: [
88
+ '.agent-context/rules/security.md',
89
+ '.agent-context/review-checklists/pr-checklist.md',
90
+ ],
91
+ signal: 'User-controlled body, query, params, headers, cookies, files, webhooks, and job payloads must be validated before service logic.',
92
+ },
93
+ {
94
+ constraint: 'Data access performance and integrity',
95
+ status: 'strengthened',
96
+ sourcePaths: [
97
+ '.agent-context/rules/database-design.md',
98
+ '.agent-context/rules/performance.md',
99
+ '.agent-context/state/architecture-map.md',
100
+ ],
101
+ signal: 'Backend reads must avoid N+1 and unbounded list responses; multi-write mutations need transaction or recovery evidence.',
102
+ },
103
+ {
104
+ constraint: 'Distributed consistency and outbox safety',
105
+ status: 'strengthened',
106
+ sourcePaths: [
107
+ '.agent-context/rules/event-driven.md',
108
+ '.agent-context/rules/database-design.md',
109
+ '.agent-context/rules/microservices.md',
110
+ ],
111
+ signal: 'Dual-write flows need outbox or equivalent replay safety, and cross-service consistency must define saga, compensation, or recovery behavior instead of defaulting to two-phase commit.',
112
+ },
113
+ {
114
+ constraint: 'Safe centralized API errors',
115
+ status: 'strengthened',
116
+ sourcePaths: [
117
+ '.agent-context/rules/error-handling.md',
118
+ '.agent-context/rules/api-docs.md',
119
+ ],
120
+ signal: 'HTTP/API responses use safe machine-readable error shapes, may align with RFC 9457 Problem Details, and preserve safe trace/correlation identifiers without leaking internals.',
121
+ },
122
+ {
123
+ constraint: 'Sensitive mutation idempotency',
124
+ status: 'strengthened',
125
+ sourcePaths: [
126
+ '.agent-context/rules/api-docs.md',
127
+ '.agent-context/rules/testing.md',
128
+ '.agent-context/rules/event-driven.md',
129
+ ],
130
+ signal: 'Payments, orders, status changes, and other risky mutations must document and test duplicate-submit behavior.',
131
+ },
132
+ {
133
+ constraint: 'API contract and behavior testing',
134
+ status: 'strengthened',
135
+ sourcePaths: [
136
+ '.agent-context/rules/testing.md',
137
+ '.agent-context/review-checklists/pr-checklist.md',
138
+ ],
139
+ signal: 'API tests cover validation, auth, documented error shapes, pagination defaults, empty states, and mutation retry safety.',
140
+ },
141
+ ];
39
142
 
40
143
  function readJsonOrNull(filePath) {
41
144
  if (!existsSync(filePath)) {
@@ -194,6 +297,37 @@ async function collectSkillTrustSignals() {
194
297
  };
195
298
  }
196
299
 
300
+ function buildBackendGovernancePosture(skillTrustSignals) {
301
+ const backendSurfaceRows = skillTrustSignals.domains.filter((trustRow) => {
302
+ return BACKEND_REQUIRED_DOMAIN_NAMES.has(trustRow.domain);
303
+ });
304
+ const missingBackendSurfaceNames = backendSurfaceRows
305
+ .filter((trustRow) => trustRow.tier !== 'verified')
306
+ .map((trustRow) => trustRow.domain);
307
+ const verifiedSurfaceCount = backendSurfaceRows.length - missingBackendSurfaceNames.length;
308
+
309
+ return {
310
+ status: missingBackendSurfaceNames.length === 0 ? 'verified' : 'needs-attention',
311
+ summary: missingBackendSurfaceNames.length === 0
312
+ ? 'Backend governance is verified across architecture, security, data access, error handling, API contracts, testing, performance, idempotency, and risk-map surfaces.'
313
+ : 'Backend governance is missing one or more required surfaces.',
314
+ requiredSurfaceCount: backendSurfaceRows.length,
315
+ verifiedSurfaceCount,
316
+ missingSurfaceNames: missingBackendSurfaceNames,
317
+ coverage: BACKEND_GOVERNANCE_COVERAGE,
318
+ developmentFocus: [
319
+ {
320
+ focus: 'Keep backend guidance global and stack-agnostic.',
321
+ reason: 'The repo should enforce architecture, security, API, data, error, event, and testing thinking without building Nest, Laravel, FastAPI, Express, Go, or other stack-specific governance adapters.',
322
+ },
323
+ {
324
+ focus: 'Use framework facts only when implementing inside an existing project.',
325
+ reason: 'LLMs can apply current ecosystem knowledge directly; governance should route the relevant global constraints instead of acting as a stack detector.',
326
+ },
327
+ ],
328
+ };
329
+ }
330
+
197
331
  function buildBlockers(qualityTrendReport, skillTrustSignals, commitSignals) {
198
332
  const blockers = [];
199
333
 
@@ -222,6 +356,7 @@ function buildHistoryEntry(weeklyReport) {
222
356
  blockerCount: weeklyReport.releaseReadiness.blockers.length,
223
357
  gatePassRatePercent: weeklyReport.qualitySignals.governanceHealth.gatePassRatePercent,
224
358
  verifiedSkillDomainCount: weeklyReport.skillTrust.tierCounts.verified,
359
+ backendVerifiedSurfaceCount: weeklyReport.backendGovernance?.verifiedSurfaceCount ?? null,
225
360
  releaseFrequencyPercent: weeklyReport.commitSignals.releaseFrequencyPercent,
226
361
  rollbackFrequencyPercent: weeklyReport.commitSignals.rollbackFrequencyPercent,
227
362
  };
@@ -243,6 +378,7 @@ async function runWeeklyGovernanceReport() {
243
378
  const qualityTrendReport = qualityTrendState.report;
244
379
 
245
380
  const skillTrustSignals = await collectSkillTrustSignals();
381
+ const backendGovernance = buildBackendGovernancePosture(skillTrustSignals);
246
382
  const commitSignals = collectCommitSignals(WEEKLY_WINDOW_DAYS);
247
383
  const blockers = buildBlockers(qualityTrendReport, skillTrustSignals, commitSignals);
248
384
 
@@ -267,12 +403,13 @@ async function runWeeklyGovernanceReport() {
267
403
  tokenEfficiency: qualityTrendReport?.tokenEfficiency || null,
268
404
  },
269
405
  skillTrust: skillTrustSignals,
406
+ backendGovernance,
270
407
  commitSignals,
271
408
  releaseReadiness: {
272
409
  isReady: blockers.length === 0,
273
410
  blockers,
274
411
  summary: blockers.length === 0
275
- ? 'Weekly governance posture is ready for maintenance releases.'
412
+ ? 'Weekly governance posture is ready for maintenance releases with frontend and backend governance surfaces verified.'
276
413
  : 'Weekly governance posture is blocked by unresolved readiness signals.',
277
414
  },
278
415
  artifact: {
@@ -312,7 +312,7 @@ export function runAuditReleaseChecks(results, diagnostics) {
312
312
  singleSourceLazyLoadingAuditExecution.report?.lazyRuleLoading?.enforced === true,
313
313
  'lazy-rule-loading-hard-rule',
314
314
  singleSourceLazyLoadingAuditExecution.report?.lazyRuleLoading?.enforced === true
315
- ? 'Language-specific guidance is loaded lazily by detected scope'
315
+ ? 'Global domain governance is loaded lazily by touched scope'
316
316
  : 'Lazy rule loading enforcement failed in single-source lazy-loading audit'
317
317
  );
318
318
  pushResult(
@@ -32,17 +32,24 @@ export const REQUIRED_BACKEND_ARCHITECTURE_RULE_SNIPPETS = [
32
32
  'No premature abstraction.',
33
33
  'Readability over brevity.',
34
34
  'backend and shared core modules',
35
+ 'Do not create or load stack-specific governance adapters as the baseline.',
35
36
  ];
36
37
 
37
38
  export const REQUIRED_BACKEND_REVIEW_CHECKLIST_SNIPPETS = [
38
39
  'No clever hacks in backend and shared core modules',
39
40
  'No premature abstraction (base classes/util layers created only after repeated stable patterns)',
40
41
  'Readability over brevity for maintainability',
42
+ 'Controllers, route handlers, and transport adapters do not contain business policy',
43
+ 'Sensitive mutations include idempotency or duplicate-submit coverage',
44
+ 'Backend/API governance was applied through global domain rules',
41
45
  ];
42
46
 
43
47
  export const REQUIRED_REFACTOR_PROMPT_SNIPPETS = [
44
48
  'Enforce backend universal principles: no clever hacks, no premature abstraction, readability over brevity.',
45
49
  'Prioritize maintainability over compressed one-liners.',
50
+ 'zero-trust input validation',
51
+ 'idempotency for sensitive mutations',
52
+ 'Backend/API governance is global and stack-agnostic.',
46
53
  ];
47
54
 
48
55
  export const REQUIRED_ARCHITECTURE_REVIEW_CHECKLIST_SNIPPETS = [
@@ -50,4 +57,8 @@ export const REQUIRED_ARCHITECTURE_REVIEW_CHECKLIST_SNIPPETS = [
50
57
  'No clever hacks in backend and shared core modules',
51
58
  'No premature abstraction',
52
59
  'Readability over brevity',
60
+ 'Service or use-case code owns orchestration',
61
+ 'Relational reads avoid N+1 patterns',
62
+ 'Global backend/API governance is used directly',
63
+ 'Dual-write database plus message flows use an outbox',
53
64
  ];
@@ -67,7 +67,7 @@ const REQUIRED_PR_CHECKLIST_SNIPPETS = [
67
67
 
68
68
  const REQUIRED_REVIEW_PROMPT_SNIPPETS = [
69
69
  'Review the code with a production-risk mindset.',
70
- 'Do not invent stack-specific concerns unless the repo or changed files prove they apply.',
70
+ 'Do not create stack-specific governance concerns.',
71
71
  ];
72
72
 
73
73
  function pushResult(results, isPassed, checkName, details) {
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Enforces V3.0-010 policy:
7
7
  * - One canonical rule source is explicitly defined and enforced.
8
- * - Language-specific rule guidance loads lazily by detected scope.
8
+ * - Global domain governance loads lazily by touched scope.
9
9
  * - Conflicting duplicate instruction paths are prevented.
10
10
  */
11
11
 
@@ -60,24 +60,24 @@ const MAX_EAGER_STACK_MENTIONS = 4;
60
60
  const REQUIRED_ARCHITECTURE_RULE_SNIPPETS = [
61
61
  '## Single Source of Truth and Lazy Rule Loading',
62
62
  'Canonical rule source is .instructions.md.',
63
- 'Load language-specific stack guidance lazily based on detected scope.',
64
- 'Do not preload unrelated stack profiles during normal flow.',
63
+ 'Load global domain rules lazily based on touched scope.',
64
+ 'Do not create or load stack-specific governance adapters as the baseline.',
65
65
  ];
66
66
 
67
67
  const REQUIRED_PR_CHECKLIST_SNIPPETS = [
68
68
  'Canonical rule source is explicitly defined and enforced',
69
- 'Language-specific guidance is loaded lazily based on detected scope',
69
+ 'Global domain governance is loaded lazily based on touched scope',
70
70
  'No conflicting duplicate rule instructions during normal flow',
71
71
  ];
72
72
 
73
73
  const REQUIRED_REVIEW_PROMPT_SNIPPETS = [
74
- 'Enforce single-source and lazy-loading policy: canonical rule source must be explicitly enforced, language-specific guidance must load lazily based on detected scope, and conflicting duplicate rule instructions must not appear during normal flow.',
74
+ 'Enforce single-source and lazy-loading policy: canonical rule source must be explicitly enforced, global domain governance must load lazily based on touched scope, and conflicting duplicate rule instructions must not appear during normal flow.',
75
75
  ];
76
76
 
77
77
  const REQUIRED_COMPILER_SNIPPETS = [
78
78
  '## LAYER 2 POLICY: LAZY RULE LOADING',
79
- 'Load runtime-specific guidance only when task scope touches that runtime.',
80
- 'Avoid eager loading unrelated runtime guidance to prevent instruction conflicts.',
79
+ 'Load global domain rules only when task scope touches that domain.',
80
+ 'Avoid eager loading unrelated runtime or domain guidance to prevent instruction conflicts.',
81
81
  "stackLoadingMode: 'lazy'",
82
82
  ];
83
83
 
@@ -377,6 +377,7 @@ function runAudit() {
377
377
  if (lazyPolicy
378
378
  && lazyPolicy.canonicalSource === CANONICAL_SOURCE_PATH
379
379
  && lazyPolicy.stackLoadingMode === 'lazy'
380
+ && (lazyPolicy.domainRuleLoadingMode === 'lazy' || typeof lazyPolicy.domainRuleLoadingMode === 'undefined')
380
381
  && lazyPolicy.loadedOnDemand === true) {
381
382
  onboardingLazyPolicyMode = 'explicit-lazy-policy';
382
383
  onboardingLazyPolicyValidated = true;
@@ -478,7 +479,7 @@ function runAudit() {
478
479
  && !eagerLoadingDetected;
479
480
 
480
481
  if (lazyRuleLoadingEnforced) {
481
- pushResult(results, true, 'lazy-rule-loading-hard-rule', 'Language-specific guidance is loaded lazily by detected scope');
482
+ pushResult(results, true, 'lazy-rule-loading-hard-rule', 'Global domain governance is loaded lazily by touched scope');
482
483
  } else {
483
484
  failures.push('Lazy rule loading hard-rule is not fully enforced');
484
485
  pushResult(results, false, 'lazy-rule-loading-hard-rule', 'Lazy loading enforcement failed');
@@ -514,6 +515,7 @@ function runAudit() {
514
515
  onboardingPolicyValidated: onboardingLazyPolicyValidated,
515
516
  eagerLoadingDetected,
516
517
  maxAllowedStackMentions: MAX_EAGER_STACK_MENTIONS,
518
+ globalDomainGovernance: true,
517
519
  },
518
520
  duplicationPolicy: {
519
521
  noConflictingDuplicates,
@@ -44,8 +44,9 @@ If your host stops at this file instead of following the full chain, obey the Cr
44
44
  - Memory continuity does not replace bootstrap loading. It is host-dependent project memory, not a guarantee that instructions were reloaded for this session.
45
45
  - For UI, UX, layout, screen, tailwind, frontend, or redesign requests: load [.agent-context/prompts/bootstrap-design.md](.agent-context/prompts/bootstrap-design.md) and [.agent-context/rules/frontend-architecture.md](.agent-context/rules/frontend-architecture.md) before editing code.
46
46
  - For UI scope: if \`docs/DESIGN.md\` or \`docs/design-intent.json\` is missing, materialize or refine them before implementing UI changes.
47
+ - For backend, API, data, auth, error, event, queue, worker, or distributed-system requests: load the relevant global rules from [.agent-context/rules/](.agent-context/rules); do not create stack-specific governance adapters.
47
48
  - For refactor, improve, clean up, or fix requests: inspect the active rules and propose a plan before editing.
48
- - For new project or module requests: clarify constraints, stack decisions, and required docs before generating code.
49
+ - For new project or module requests: clarify constraints, runtime decisions, and required docs before generating code.
49
50
  - For ecosystem, framework, dependency, or Docker claims: perform live web research instead of relying on stale local heuristics.
50
51
 
51
52
  ## Mandatory Bootstrap Chain
@@ -57,7 +58,7 @@ If your host stops at this file instead of following the full chain, obey the Cr
57
58
  5. Enforce review contracts from [.agent-context/review-checklists/](.agent-context/review-checklists).
58
59
  6. Read change-risk maps and continuity state from [.agent-context/state/](.agent-context/state).
59
60
  7. Enforce policy thresholds from [.agent-context/policies/](.agent-context/policies).
60
- 8. Use dynamic stack, structure, and live research signals from project context docs.
61
+ 8. Use runtime evidence, structure, and live research signals from project context docs.
61
62
 
62
63
  ## Trigger Rules
63
64
 
@@ -82,6 +83,7 @@ If your host stops at this file, follow this minimum floor:
82
83
  - Read \`.agent-instructions.md\` next when it exists.
83
84
  - For UI or redesign requests, load [.agent-context/prompts/bootstrap-design.md](../.agent-context/prompts/bootstrap-design.md) and [.agent-context/rules/frontend-architecture.md](../.agent-context/rules/frontend-architecture.md) before coding.
84
85
  - If UI scope and \`docs/DESIGN.md\` or \`docs/design-intent.json\` is missing, materialize them before UI implementation.
86
+ - For backend/API/data/auth/event requests, load relevant global rules from [.agent-context/rules/](../.agent-context/rules) and do not create stack-specific governance adapters.
85
87
  - Memory continuity is host-dependent project memory and does not replace bootstrap loading.
86
88
 
87
89
  ## Required Load Order
@@ -92,7 +94,7 @@ If your host stops at this file, follow this minimum floor:
92
94
  4. Load request templates from [.agent-context/prompts/](../.agent-context/prompts).
93
95
  5. Apply review contracts from [.agent-context/review-checklists/](../.agent-context/review-checklists).
94
96
  6. Apply state awareness from [.agent-context/state/](../.agent-context/state) and thresholds from [.agent-context/policies/](../.agent-context/policies).
95
- 7. Resolve stack, structure, and dependency choices from project context docs plus live evidence.
97
+ 7. Resolve runtime, structure, and dependency choices from project context docs plus live evidence.
96
98
 
97
99
  ## Completion Gate
98
100
 
@@ -113,6 +115,7 @@ If your host stops at this file, follow this minimum floor:
113
115
  - Read \`.agent-instructions.md\` next when it exists.
114
116
  - For UI or redesign requests, load [.agent-context/prompts/bootstrap-design.md](../.agent-context/prompts/bootstrap-design.md) and [.agent-context/rules/frontend-architecture.md](../.agent-context/rules/frontend-architecture.md) before coding.
115
117
  - If UI scope and \`docs/DESIGN.md\` or \`docs/design-intent.json\` is missing, materialize them before UI implementation.
118
+ - For backend/API/data/auth/event requests, load relevant global rules from [.agent-context/rules/](../.agent-context/rules) and do not create stack-specific governance adapters.
116
119
  - Memory continuity is host-dependent project memory and does not replace bootstrap loading.
117
120
 
118
121
  ## Bootstrap Sequence
@@ -123,7 +126,7 @@ If your host stops at this file, follow this minimum floor:
123
126
  4. Load request templates from [.agent-context/prompts/](../.agent-context/prompts).
124
127
  5. Apply review contracts from [.agent-context/review-checklists/](../.agent-context/review-checklists).
125
128
  6. Apply state awareness from [.agent-context/state/](../.agent-context/state) and policy thresholds from [.agent-context/policies/](../.agent-context/policies).
126
- 7. Resolve stack, structure, and dependency choices from project context docs plus live evidence.
129
+ 7. Resolve runtime, structure, and dependency choices from project context docs plus live evidence.
127
130
 
128
131
  ## Completion Gate
129
132