onto-mcp 0.3.1 → 0.3.2
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.
- package/.onto/authority/core-lexicon.yaml +1 -0
- package/.onto/domains/software-engineering/competency_qs.md +192 -63
- package/.onto/domains/software-engineering/concepts.md +67 -5
- package/.onto/domains/software-engineering/conciseness_rules.md +22 -2
- package/.onto/domains/software-engineering/dependency_rules.md +78 -8
- package/.onto/domains/software-engineering/domain_scope.md +181 -150
- package/.onto/domains/software-engineering/extension_cases.md +318 -542
- package/.onto/domains/software-engineering/logic_rules.md +75 -3
- package/.onto/domains/software-engineering/problem_framing_profile.md +29 -2
- package/.onto/domains/software-engineering/prompt_interface.md +122 -0
- package/.onto/domains/software-engineering/structure_spec.md +53 -4
- package/.onto/principles/llm-native-development-guideline.md +20 -0
- package/.onto/principles/productization-charter.md +6 -0
- package/.onto/processes/reconstruct/reconstruct-boundary-contract.md +278 -91
- package/.onto/processes/reconstruct/reconstruct-execution-ux-contract.md +45 -12
- package/.onto/processes/reconstruct/source-profile-contract.md +39 -6
- package/.onto/processes/reconstruct/top-level-concept-discovery-contract.md +387 -0
- package/.onto/processes/review/lens-registry.md +16 -0
- package/.onto/processes/shared/target-material-kind-contract.md +18 -2
- package/.onto/roles/axiology.md +7 -2
- package/AGENTS.md +3 -2
- package/README.md +39 -33
- package/dist/core-api/reconstruct-api.js +22 -5
- package/dist/core-api/review-api.js +1288 -533
- package/dist/core-runtime/cli/mock-review-unit-executor.js +17 -0
- package/dist/core-runtime/cli/review-invoke.js +23 -48
- package/dist/core-runtime/cli/run-review-prompt-execution.js +122 -0
- package/dist/core-runtime/path-boundary.js +58 -0
- package/dist/core-runtime/reconstruct/artifact-types.js +5 -0
- package/dist/core-runtime/reconstruct/materialize-preparation.js +54 -4
- package/dist/core-runtime/reconstruct/pipeline-execution-ledger.js +38 -2
- package/dist/core-runtime/reconstruct/post-seed-validation.js +13 -0
- package/dist/core-runtime/reconstruct/record.js +11 -0
- package/dist/core-runtime/reconstruct/run.js +1133 -26
- package/dist/core-runtime/reconstruct/seed-candidate-validation.js +29 -0
- package/dist/core-runtime/review/execution-plan-boundary.js +123 -0
- package/dist/core-runtime/review/materializers.js +8 -3
- package/dist/core-runtime/review/review-artifact-utils.js +15 -2
- package/dist/core-runtime/review/review-invocation-runner.js +604 -0
- package/dist/core-runtime/target-material-kind.js +43 -5
- package/dist/mcp/server.js +158 -39
- package/dist/mcp/tool-schemas.js +22 -2
- package/package.json +3 -1
- package/.onto/domains/llm-native-development/competency_qs.md +0 -430
- package/.onto/domains/llm-native-development/concepts.md +0 -242
- package/.onto/domains/llm-native-development/conciseness_rules.md +0 -163
- package/.onto/domains/llm-native-development/dependency_rules.md +0 -216
- package/.onto/domains/llm-native-development/domain_scope.md +0 -197
- package/.onto/domains/llm-native-development/extension_cases.md +0 -474
- package/.onto/domains/llm-native-development/logic_rules.md +0 -123
- package/.onto/domains/llm-native-development/prompt_interface.md +0 -49
- package/.onto/domains/llm-native-development/structure_spec.md +0 -245
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
version:
|
|
3
|
-
last_updated: "2026-
|
|
2
|
+
version: 8
|
|
3
|
+
last_updated: "2026-05-28"
|
|
4
4
|
source: bundled-domain-baseline
|
|
5
5
|
status: established
|
|
6
6
|
---
|
|
@@ -38,7 +38,7 @@ Layer 1 defines what the language/runtime provides. Layer 2 encodes design wisdo
|
|
|
38
38
|
- [L2] Saga = distributed transactions as a sequence of local transactions with compensating actions. Choreography-based (events) or orchestration-based (coordinator)
|
|
39
39
|
- [L2] Hexagonal (Ports and Adapters) = application logic at center, surrounded by ports (interfaces) and adapters (implementations). Domain independent of infrastructure
|
|
40
40
|
- [L2] Clean Architecture = concentric layers where dependencies point inward. The Dependency Rule: source code dependencies point toward higher-level policies
|
|
41
|
-
- [L2] Layered Architecture =
|
|
41
|
+
- [L2] Layered Architecture = separation by technical layers such as Presentation, Business/Application, and Data Access. This is distinct from Vertical Slice Architecture, which organizes by feature. Layer direction rules depend on the declared architecture pattern and dependency kind
|
|
42
42
|
- [L2] Microservices = independently deployable services communicating via network. Benefits: independent scaling/deployment. Costs: distributed system complexity
|
|
43
43
|
- [L2] Monolith = single deployable unit. Not inherently bad — simpler deployment, no network latency, easier debugging
|
|
44
44
|
- [L2] Modular Monolith = monolith with enforced module boundaries. Monolith simplicity with microservice-like modularity
|
|
@@ -104,6 +104,7 @@ Layer 1 defines what the language/runtime provides. Layer 2 encodes design wisdo
|
|
|
104
104
|
- [L2] Deprecation = maintaining while announcing future removal. Must specify: what, when removed, and replacement
|
|
105
105
|
- [L2] Semantic Versioning (SemVer) = MAJOR.MINOR.PATCH. MAJOR: breaking. MINOR: backward-compatible features. PATCH: bug fixes. A communication contract — violating it erodes consumer trust
|
|
106
106
|
- [L2] Feature Toggle = enable/disable features at runtime without deployment. Risk: toggle debt from unremoved toggles
|
|
107
|
+
- [L2] Technical Debt = a deliberate shortcut with known future cost, owner, and remediation expectation. It differs from accidental complexity or a defect because the tradeoff is acknowledged and tracked
|
|
107
108
|
- [L2] Trunk-based Development = all developers commit to main with short-lived branches. Requires strong CI and feature toggles
|
|
108
109
|
- [L2] Branch-by-Abstraction = large changes without long-lived branches: introduce abstraction, implement new version behind it, switch, remove old
|
|
109
110
|
|
|
@@ -139,6 +140,10 @@ Layer 1 defines what the language/runtime provides. Layer 2 encodes design wisdo
|
|
|
139
140
|
- [L3] CSP (Content Security Policy) = HTTP header specifying allowed content sources. Primary defense against XSS
|
|
140
141
|
- [L3] RBAC (Role-Based Access Control) = permissions assigned to roles, users assigned to roles. Simple but coarse-grained
|
|
141
142
|
- [L3] ABAC (Attribute-Based Access Control) = access decisions based on user/resource/environment attributes. More flexible than RBAC, harder to audit
|
|
143
|
+
- [L3] Data Classification = labeling data by sensitivity, regulatory exposure, tenant/user boundary, and handling obligations
|
|
144
|
+
- [L3] Retention Policy = rule defining how long data or artifacts are kept, why they are kept, and when they must be deleted or archived
|
|
145
|
+
- [L3] Deletion/Erasure Path = implemented path that removes or anonymizes data across primary stores, derived stores, indexes, caches, logs, backups, and downstream processors according to the retention/privacy obligation
|
|
146
|
+
- [L3] Data Minimization = collecting, storing, and exposing only the data needed for the declared purpose
|
|
142
147
|
|
|
143
148
|
## Testing Terms
|
|
144
149
|
|
|
@@ -162,11 +167,59 @@ Layer 1 defines what the language/runtime provides. Layer 2 encodes design wisdo
|
|
|
162
167
|
## DevOps Terms
|
|
163
168
|
|
|
164
169
|
- [L3] CI/CD = CI: build and test on every commit. CD: automatically deploy verified builds. The pipeline is the automated sequence of these stages
|
|
165
|
-
- [L3] Artifact = versioned, immutable build output (JAR, Docker image, npm package). Never modified — only replaced
|
|
170
|
+
- [L3] Build Artifact = versioned, immutable build output (JAR, Docker image, npm package). Never modified — only replaced
|
|
171
|
+
- [L3] SBOM = Software Bill of Materials. Machine-readable inventory of components and dependency versions included in a build or release
|
|
172
|
+
- [L3] Artifact Attestation = signed or otherwise verifiable statement about how a build/release artifact was produced, by whom/what, from which inputs, and with which verification results
|
|
173
|
+
- [L3] Release Artifact Traceability = ability to trace a deployed artifact back to source revision, build pipeline, dependency set, verification results, approval gate, and deployment environment
|
|
166
174
|
- [L3] Blue-Green Deployment = two identical environments, switch traffic between them. Instant rollback. Cost: double infrastructure
|
|
167
175
|
- [L3] Canary Deployment = route small traffic percentage to new version, increase gradually if healthy
|
|
168
176
|
- [L3] Rolling Deployment = replace instances one at a time. Both versions coexist during rollout
|
|
169
177
|
|
|
178
|
+
## LLM-Native Engineering Terms
|
|
179
|
+
|
|
180
|
+
Domain-local definitions in this section own software-engineering usage. Onto/productization core concepts are marked as **domain projections**: the canonical seat remains in `.onto/authority/`, `.onto/principles/`, or `.onto/processes/`, while this file records how the software-engineering domain uses the concept during review.
|
|
181
|
+
|
|
182
|
+
- [L3] LLM-Native Development = software development where LLMs, agents, prompt/context contracts, retrieval, model providers, semantic evaluation, or AI-assisted workflows materially affect product behavior or engineering workflow. It is now a sub-area of software engineering, not a separate review domain
|
|
183
|
+
- [L3] Behavior-Affecting Artifact = any artifact whose change can alter software behavior, engineering workflow, review outcome, trust status, or release decision. Includes code, config, schemas, prompts, context assembly rules, tool schemas, retrieval policies, eval rubrics, model routes, and generated authority artifacts
|
|
184
|
+
- [L3] Model Provider = an external or local system that serves model inference. Provider identity, API contract, auth mode, rate limits, pricing, and model version are runtime dependencies
|
|
185
|
+
- [L3] Model Version = a specific model release used for inference. Version aliases such as `latest` reduce reproducibility; pinned versions make behavior changes diagnosable
|
|
186
|
+
- [L3] Model Route = the runtime decision that selects a model/provider/profile for a task. A model route must expose the selected provider/model facts, capability requirements, fallback policy, and diagnostic behavior
|
|
187
|
+
- [L3] Prompt Template = a versioned instruction artifact with placeholders filled at runtime. A prompt template change is a behavior change, comparable to code or configuration changes
|
|
188
|
+
- [L3] Context Assembly = the runtime or agent process that selects and orders the information sent to the model. Context assembly owns token budget, provenance, relevance, and omission behavior
|
|
189
|
+
- [L3] LLM Boundary (domain projection) = software-engineering use of the LLM/runtime interface principles in `.onto/principles/llm-runtime-interface-principles.md` and `.onto/principles/llm-native-development-guideline.md`. In this domain, reviews ask which semantic interpretation or judgment is delegated to the LLM and which runtime-owned gates must receive its output
|
|
190
|
+
- [L3] Runtime Boundary (domain projection) = software-engineering use of runtime-owned deterministic authority: binding, validation, state transition, persistence, audit, cost/security gates, idempotency, and authority artifact assembly. The canonical boundary principles live in `.onto/principles/llm-runtime-interface-principles.md`
|
|
191
|
+
- [L3] Middleware Boundary (domain projection) = software-engineering use of middleware-owned transport/adaptation responsibilities: envelope conversion, routing plumbing, auth/context propagation, retry envelopes, and observability plumbing. Middleware must remain a bounded adapter, not a second semantic or policy authority
|
|
192
|
+
- [L3] Ownership Non-Interference (domain projection) = software-engineering review rule derived from the LLM/runtime interface principles: boundary crossings must declare owner, input/output, enforcement profile, artifact or trust status, and diagnostic behavior
|
|
193
|
+
- [L3] Retrieved Context = external material selected for model input by search, RAG, graph traversal, or direct file selection. It must carry provenance when used as evidence
|
|
194
|
+
- [L3] Prompt Injection Boundary = the boundary that treats external content, user text, retrieved text, tool output, and webpages as data rather than instruction authority. Prompt instructions are not a security boundary
|
|
195
|
+
- [L3] RAG Permission Boundary = the requirement that retrieval preserve access control, tenancy, source validation, poisoning checks, provenance, and auditability before content influences model context
|
|
196
|
+
- [L3] Embedding Index Compatibility = the rule that vectors produced by different embedding models, dimensions, preprocessing, or chunking policies are not interchangeable without a declared migration or dual-index strategy
|
|
197
|
+
- [L3] Output Zero-Trust = the rule that LLM output is untrusted until runtime validates it for shape, policy, authorization, provenance, and the specific downstream sink
|
|
198
|
+
- [L3] Sink Validation = validation/encoding/authorization performed for the concrete place where output will be used: shell, SQL, HTML, file path, email, API call, artifact write, or user-facing decision
|
|
199
|
+
- [L3] LLM Agent = an LLM-powered system that observes state, chooses actions, invokes tools, and updates progress toward a goal. It differs from a simple prompt-response call by having an action loop
|
|
200
|
+
- [L3] Agent Functionality = what an agent is technically able to do through tools and runtime capabilities
|
|
201
|
+
- [L3] Agent Permission = what an agent is authorized to do for the current user, tenant, scope, and operation
|
|
202
|
+
- [L3] Agent Autonomy = what an agent may do without human approval. Functionality, permission, and autonomy are separate axes
|
|
203
|
+
- [L3] Tool Schema = the machine-readable contract that tells an agent how to call a tool. It must include name, description, parameter schema, required fields, and result semantics sufficient for agent selection
|
|
204
|
+
- [L3] MCP Tool Boundary = the protocol boundary where an MCP server exposes tools/resources/prompts and a host or agent invokes them. The model requests a tool call; runtime code executes and validates it
|
|
205
|
+
- [L3] Semantic Evaluation = evaluation of usefulness, faithfulness, specificity, actionability, calibration, or other qualities that cannot be proven by deterministic tests alone
|
|
206
|
+
- [L3] Evaluation Baseline = a recorded set of expected examples, rubrics, scores, or comparative outputs used to detect semantic regression and production drift
|
|
207
|
+
- [L3] Production Drift = behavior or quality movement after release caused by data changes, provider/model changes, prompt/context changes, corpus changes, traffic shifts, or external environment changes
|
|
208
|
+
- [L3] Fail-Loud = a diagnostic posture where contract failures stop or surface with explicit failure location, cause, and artifact refs. In LLM-native development, fail-loud reduces exploration cost by making the failing prompt/context/model/tool/schema boundary visible
|
|
209
|
+
- [L3] Fail-Close = a gate posture where contract-missing or unsafe output is blocked from becoming trusted output. Fail-close is a safety gate; fail-loud is the diagnostic visibility expected when the gate closes
|
|
210
|
+
- [L3] Silent Degradation = a fallback, repair, default, or graceful-degradation path that hides the original failure or omits visible loss markers. Silent degradation is usually more costly in LLM-native development because it forces later investigators to rediscover the hidden failure
|
|
211
|
+
- [L3] Graceful Degradation = an intentional product behavior that serves a reduced result when full behavior is unavailable. It is acceptable only when the loss is explicit, logged, and compatible with the user's task
|
|
212
|
+
- [L3] Artifact Truth (domain projection) = software-engineering use of the productization principle that durable artifacts, not transient responses, own process truth. Canonical review artifact seats are defined by `.onto/principles/productization-charter.md` and `.onto/processes/review/record-contract.md`
|
|
213
|
+
- [L3] Provenance = the recorded source, builder/agent, input set, transformation path, verification state, and time/version facts needed to explain why a software artifact, generated artifact, release artifact, or claim should be trusted
|
|
214
|
+
- [L3] Generated Artifact = an artifact authored or transformed by an LLM, agent, generator, build step, or automation. It needs provenance when it affects authority, release, security, or user decisions
|
|
215
|
+
- [L3] AI Supply Chain = the dependency chain for AI behavior: model/provider, dataset/corpus, embedding model/index, prompt framework, tool runtime, eval judge, safety layer, and generated artifacts
|
|
216
|
+
- [L3] AI Governance = accountable management of AI behavior through owner assignment, risk treatment, approval gates, transparency, audit evidence, incident response, and continuous improvement
|
|
217
|
+
- [L3] AI Risk Owner = the accountable role or team that accepts, mitigates, transfers, or rejects material risk introduced by AI behavior
|
|
218
|
+
- [L3] Human Approval Gate = a runtime or process gate requiring human authorization before high-impact AI output, tool execution, release, or user-visible action becomes authoritative
|
|
219
|
+
- [L3] Red-Team/Eval Loop = the feedback loop that turns adversarial findings, incidents, semantic eval results, and production drift into updated prompts, policies, tests, controls, and release gates
|
|
220
|
+
- [L3] AI Incident Disclosure = the operator/user/internal communication path used when AI behavior materially fails, exposes data, misleads users, causes unsafe action, or breaks a trust claim
|
|
221
|
+
- [L3] Context-Isolated Reasoning Unit (domain projection) = software-engineering use of the review/lens execution property defined in `.onto/processes/review/lens-prompt-contract.md`: the reasoning unit receives contracted input, does not share main-context state, and returns contracted output when independent judgment or disagreement preservation matters
|
|
222
|
+
|
|
170
223
|
## Document Design Terms
|
|
171
224
|
|
|
172
225
|
- [L3] Contract Document = specification with 1:1 code correspondence. Violation is a defect
|
|
@@ -192,11 +245,20 @@ Layer 1 defines what the language/runtime provides. Layer 2 encodes design wisdo
|
|
|
192
245
|
## Homonyms Requiring Attention
|
|
193
246
|
|
|
194
247
|
- "service": service class (business logic) != microservice (deployment unit) != domain service (DDD, stateless operation) != OS service (daemon)
|
|
248
|
+
- "domain": review/domain-document namespace != business or problem domain != DDD bounded-context domain != Clean Architecture domain/entities layer != ontology property domain
|
|
249
|
+
- "artifact": build artifact (deployable/package output) != authority artifact (truth-bearing record/contract) != generated artifact (authored/transformed by automation) != provenance record (trust evidence) != documentation artifact
|
|
195
250
|
- "model": domain model (business object) != ML/LLM model != MVC model != data model (DB schema)
|
|
251
|
+
- "model version": package/library version != LLM model version != database schema version
|
|
252
|
+
- "agent": LLM agent != software agent (generic autonomous program) != user agent (browser HTTP header)
|
|
253
|
+
- "tool": MCP tool (agent-invocable function) != development tool (IDE/linter) != CLI tool
|
|
254
|
+
- "prompt": system prompt != user prompt != prompt template != MCP prompt primitive
|
|
255
|
+
- "token": authentication token / API key != LLM token (subword unit)
|
|
196
256
|
- "controller": MVC controller != hardware controller != Kubernetes controller (reconciliation loop)
|
|
197
257
|
- "context": execution context (runtime) != Bounded Context (DDD) != React Context != context window (LLM)
|
|
258
|
+
- "memory": process memory (RAM) != agent memory != persistence store != conversation history
|
|
259
|
+
- "alignment": model behavior alignment != UI text alignment != ontology alignment
|
|
198
260
|
- "migration": DB migration (schema change) != system migration (infrastructure move) != data migration (format transform)
|
|
199
|
-
- "validation": input validation (user data) != design validation (architecture review) !=
|
|
261
|
+
- "validation": input validation (user data) != schema validation (data vs schema) != sink validation (safe use at a downstream sink) != design validation (architecture review) != semantic evaluation (quality judgment)
|
|
200
262
|
- "constraint": data constraint (DB) != design constraint (architecture) != business rule != type constraint (generic bounds)
|
|
201
263
|
- "event": domain event (business) != browser event (click) != system event (OS signal) != CloudEvents (format)
|
|
202
264
|
- "client": HTTP client != client application (frontend) != client (customer) != OAuth client (registered app)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
version:
|
|
3
|
-
last_updated: "2026-
|
|
2
|
+
version: 5
|
|
3
|
+
last_updated: "2026-05-28"
|
|
4
4
|
source: bundled-domain-baseline
|
|
5
5
|
status: established
|
|
6
6
|
---
|
|
@@ -49,6 +49,17 @@ Each rule is tagged with a strength level:
|
|
|
49
49
|
|
|
50
50
|
- [MAY-ALLOW] Application-level and infrastructure-level metrics for the same quantity — application metrics (e.g., handler-measured latency, per-endpoint) and infrastructure metrics (e.g., load-balancer-measured latency, per-host) measure the same thing at different granularity and observation points. Retain when the difference matters for diagnosis; consolidate when identical and only one consumer uses them.
|
|
51
51
|
|
|
52
|
+
### LLM-Native Runtime and Evaluation
|
|
53
|
+
|
|
54
|
+
- [MUST-ALLOW] Safety policy in both prompt instructions and runtime guardrails — prompt instructions reduce unsafe generation; guardrails block unsafe output. This defense-in-depth duplication is justified when both copies point to the same authority.
|
|
55
|
+
- [MAY-ALLOW] Evaluation criteria in both an eval rubric and a release gate — the rubric defines semantic quality; the gate enforces release policy. Retain only when the gate references the rubric instead of redefining criteria.
|
|
56
|
+
|
|
57
|
+
### Review Concern Case Overlap
|
|
58
|
+
|
|
59
|
+
- [MUST-ALLOW] The same case evidence may appear under multiple review concerns when each concern asks a different question. Example: prompt injection can support logic (instruction authority), structure (context assembly seat), dependency (retrieval/source boundary), security (exfiltration), pragmatics (answerable CQ), and axiology (user/operator harm). Domain concern labels are not lens-addition proposals.
|
|
60
|
+
- [MUST-ALLOW] A principle may have separate CQ forms for deterministic correctness, semantic quality, dependency impact, and value tradeoff. Merge only when the questions have the same pass/fail evidence.
|
|
61
|
+
- [MAY-ALLOW] Repeating a short inference path across CQ and case docs is acceptable when it lets a lens use the case without loading a long narrative. Prefer references over copied definitions.
|
|
62
|
+
|
|
52
63
|
### Cross-cutting Concerns
|
|
53
64
|
|
|
54
65
|
- [MAY-ALLOW] Cross-cutting concerns (security, logging, authentication) appearing in multiple modules. Allowed under the separation of concerns (SoC) principle, but copy-paste of identical logic is a removal target.
|
|
@@ -86,6 +97,15 @@ Each rule is tagged with a strength level:
|
|
|
86
97
|
- [SHOULD-REMOVE] Single-implementation interfaces — an interface with exactly one implementing class, created "for testability" or "future flexibility," that has remained single-implementation for an extended period. The interface adds indirection without providing polymorphism. Remove and depend on the concrete class; re-extract when a genuine second implementation arises (YAGNI principle).
|
|
87
98
|
- [SHOULD-REMOVE] Redundant null checks after type-system verification — when the type system guarantees non-null (e.g., non-optional type in TypeScript strict mode, `@NonNull` in Java), a runtime null check duplicates the guarantee without adding safety. Exception: retain checks at system boundaries (external API responses, deserialized data) where the type system cannot verify the actual value.
|
|
88
99
|
|
|
100
|
+
### LLM-Native Context Noise
|
|
101
|
+
|
|
102
|
+
- [MUST-REMOVE] Historical migration notes, deprecated domain split rationale, or old LLM-native domain instructions from active execution context — they inflate model context with non-current behavior. Keep them in development-records or archive paths and link only when needed.
|
|
103
|
+
- [MUST-REMOVE] Duplicate prompt templates in agent instructions and prompt-template files — the agent's behavior diverges when one copy changes. Keep one source of truth and reference it.
|
|
104
|
+
- [MUST-REMOVE] Multiple tools with overlapping descriptions and identical practical capability — agents choose non-deterministically unless routing rules distinguish the tools.
|
|
105
|
+
- [MUST-REMOVE] Hidden fallback descriptions that are not connected to diagnostic artifacts — they make failures look successful and increase investigation cost.
|
|
106
|
+
- [MUST-REMOVE] Multiple active definitions of LLM/runtime/middleware ownership, output trust, RAG permission, agent autonomy, or provenance. Keep the definition in concepts.md and express operational consequences in rules/CQs.
|
|
107
|
+
- [MUST-REMOVE] Case-study prose that does not yield a guideline, CQ seed, PASS, and FAIL criterion. Move historical narrative to archive/development records if it remains useful.
|
|
108
|
+
|
|
89
109
|
---
|
|
90
110
|
|
|
91
111
|
## 3. Minimum Granularity Criteria
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
version:
|
|
3
|
-
last_updated: "2026-
|
|
2
|
+
version: 6
|
|
3
|
+
last_updated: "2026-05-28"
|
|
4
4
|
source: bundled-domain-baseline
|
|
5
5
|
status: established
|
|
6
6
|
---
|
|
@@ -25,19 +25,45 @@ The dependency graph of packages/modules must be a Directed Acyclic Graph (DAG).
|
|
|
25
25
|
When a circular dependency is detected, apply one of the following strategies:
|
|
26
26
|
|
|
27
27
|
- **Dependency Inversion**: If module A depends on module B and B depends on A, extract an interface from the dependency direction that should be reversed. Module A defines the interface; module B implements it. The dependency direction reverses: B now depends on A's interface, breaking the cycle. Cross-reference: 'Direction Rules' (Dependency Inversion Principle)
|
|
28
|
-
- **Event-based decoupling**: Replace direct calls with events. Module A publishes an event; module B subscribes. Neither module imports the other. The event schema becomes the contract. Appropriate when the interaction is asynchronous or fire-and-forget
|
|
28
|
+
- **Event-based decoupling**: Replace direct calls with events. Module A publishes an event; module B subscribes. Neither module imports the other. The event schema becomes the contract and must follow §Event Schema Contract Dependencies. Appropriate when the interaction is asynchronous or fire-and-forget
|
|
29
29
|
- **Shared kernel**: Extract the shared types/functions that both modules need into a third module. Both A and B depend on the shared module, but not on each other. Appropriate when the cycle is caused by shared type definitions. Cross-reference: 'Package/Module Dependency Patterns' (Shared Kernel pattern)
|
|
30
30
|
- Real example: npm detects circular dependencies at install time and logs a warning. Go prohibits import cycles entirely — the compiler rejects them. Python allows circular imports but they cause `ImportError` at runtime if the cycle involves module-level code execution
|
|
31
31
|
|
|
32
32
|
## Direction Rules
|
|
33
33
|
|
|
34
|
+
Direction rules apply to a specific dependency kind and architecture pattern. Do not use
|
|
35
|
+
one global "upper/lower" vocabulary for every architecture.
|
|
36
|
+
|
|
37
|
+
### Dependency Direction Vocabulary
|
|
38
|
+
|
|
39
|
+
- **Source-code dependency**: import, reference, build, type, package, or generated-code edge. This is the edge most architecture rules constrain.
|
|
40
|
+
- **Runtime call/data-flow direction**: request, command, query, event, or data movement at runtime. Runtime flow may move opposite to source-code dependency.
|
|
41
|
+
- **Policy/detail direction**: high-level policy/business rules versus low-level implementation detail. This is the axis governed by DIP and Clean/Hexagonal architecture.
|
|
42
|
+
- **Layer order direction**: presentation/application/service/data-access placement in a conventional layered architecture. This is not the same axis as policy/detail.
|
|
43
|
+
- **Contract dependency**: dependence on a schema, port, interface, message format, or published language. Contract dependency can break direct implementation cycles only when the contract has explicit ownership and compatibility rules.
|
|
44
|
+
|
|
45
|
+
### Pattern Selection Rule
|
|
46
|
+
|
|
47
|
+
- If a codebase declares Clean Architecture or Hexagonal Architecture, source-code dependencies must follow the inward/port-oriented rule for that pattern.
|
|
48
|
+
- If a codebase declares conventional Layered Architecture, source-code dependencies may flow from presentation/application layers toward lower service/data-access layers, but business policy should still depend on abstractions for replaceable infrastructure.
|
|
49
|
+
- If no architecture pattern is declared, reviews must first classify the intended pattern before applying direction rules. A reviewer must not mix Clean/Hexagonal and conventional layered direction rules on the same edge without an explicit adapter/port explanation.
|
|
50
|
+
|
|
51
|
+
### Conventional Layered Architecture Direction
|
|
52
|
+
|
|
53
|
+
- Presentation/API layer -> application/service layer: allowed.
|
|
54
|
+
- Application/service layer -> data-access layer: allowed only through repository/service contracts when replacement, testing, or policy isolation matters.
|
|
55
|
+
- Data-access/infrastructure layer -> application/business layer: prohibited unless it is a callback, plugin, or dependency-injection registration with an explicit boundary.
|
|
56
|
+
- Runtime data flow from lower layers back to upper layers as returned values or events does not imply source-code dependency in that direction.
|
|
57
|
+
|
|
34
58
|
### Dependency Inversion Principle (DIP)
|
|
35
59
|
|
|
36
60
|
High-level modules must not depend on low-level modules. Both must depend on abstractions. Abstractions must not depend on details. Details must depend on abstractions.
|
|
37
61
|
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
62
|
+
- High-level and low-level describe policy/detail roles, not directory height or UI/data-access layer position.
|
|
63
|
+
- Policy/business logic -> concrete infrastructure detail: prohibited unless explicitly accepted as a small/simple-system tradeoff.
|
|
64
|
+
- Policy/business logic -> abstraction/port: allowed.
|
|
65
|
+
- Infrastructure detail -> abstraction/port it implements: allowed.
|
|
66
|
+
- Business logic -> direct dependency on external library: discouraged; abstract via interface/port when replacement, testing, security, or policy isolation matters.
|
|
41
67
|
- Test -> production code: allowed
|
|
42
68
|
- Production code -> test: prohibited
|
|
43
69
|
|
|
@@ -45,6 +71,10 @@ High-level modules must not depend on low-level modules. Both must depend on abs
|
|
|
45
71
|
|
|
46
72
|
Source code dependencies must point inward. The innermost layer (Entities/Domain) depends on nothing. The outermost layer (Frameworks/Drivers) depends on everything inward. No inner layer may import, reference, or name anything from an outer layer. Cross-reference: structure_spec.md 'Architectural Patterns' (Clean Architecture)
|
|
47
73
|
|
|
74
|
+
### Hexagonal Architecture Dependency Rule
|
|
75
|
+
|
|
76
|
+
Domain/application logic owns or depends on ports. Adapters depend on the ports and implement or call them. Domain/application logic must not depend on concrete adapter implementations. Runtime calls may enter through inbound adapters or leave through outbound adapters, but source-code dependencies remain toward the domain/ports side.
|
|
77
|
+
|
|
48
78
|
### Stable Dependencies Principle (SDP)
|
|
49
79
|
|
|
50
80
|
Depend in the direction of stability. A module should depend only on modules that are more stable (harder to change) than itself. Stability is measured by the ratio of incoming dependencies (afferent coupling) to total dependencies. A module with many dependents and few dependencies is stable — changing it would break many consumers, so it resists change.
|
|
@@ -82,7 +112,7 @@ A package should be as abstract as it is stable. Stable packages (many dependent
|
|
|
82
112
|
|
|
83
113
|
### Anti-corruption Layer
|
|
84
114
|
|
|
85
|
-
- When integrating with an external system whose model does not match the internal domain, create an adapter layer that translates between the two.
|
|
115
|
+
- When integrating with an external system whose model does not match the internal domain, create an adapter layer that translates between the two. Policy/domain code depends on an internal port or translated internal model; the adapter depends on the external model and performs translation at the boundary. Runtime flow may cross the adapter, but source-code dependency from policy/domain code to a concrete adapter is prohibited in Clean/Hexagonal designs
|
|
86
116
|
- Real example: Stripe SDK wraps Stripe's REST API with typed objects matching the consumer's language idioms
|
|
87
117
|
|
|
88
118
|
### Published Language
|
|
@@ -90,6 +120,14 @@ A package should be as abstract as it is stable. Stable packages (many dependent
|
|
|
90
120
|
- When two systems exchange data, define a shared contract (schema, message format) that both agree to. Neither side's internal model leaks through the contract. Versioned independently
|
|
91
121
|
- Real example: Protocol Buffers `.proto` files — both client and server generate code from the same definition
|
|
92
122
|
|
|
123
|
+
### Event Schema Contract Dependencies
|
|
124
|
+
|
|
125
|
+
- Event producer and consumer must depend on a versioned event/message schema or published language, not on each other's implementation details
|
|
126
|
+
- The event schema must have an owner, versioning policy, compatibility rules, and decommissioning path
|
|
127
|
+
- Producers must not shape events around consumer-only implementation needs. Consumers must tolerate compatible additions and ignore unknown fields where the format permits
|
|
128
|
+
- Breaking event schema changes require consumer impact analysis, migration or dual-publish/dual-read window, and stale-subscriber detection
|
|
129
|
+
- Event schema dependencies should be represented as contract dependencies in dependency graphs so event-based decoupling does not hide a semantic cycle
|
|
130
|
+
|
|
93
131
|
### Conformist
|
|
94
132
|
|
|
95
133
|
- When a dependency's model cannot be changed (third-party API, legacy system), the consumer adopts the dependency's model as-is. Simplest pattern but creates tight coupling
|
|
@@ -188,6 +226,13 @@ Cross-reference: logic_rules.md 'Type System Logic' (enum/union breaking changes
|
|
|
188
226
|
- **Supply chain security**: Verify integrity via checksums (go.sum), signatures (Sigstore), and SBOM generation. Real example: `event-stream` npm incident (2018) — malicious dependency added by compromised maintainer
|
|
189
227
|
- **Update strategy**: Dependabot/Renovate create PRs for updates. Auto-merge patches (semver-compatible), manual review for minor/major. Full test suite required on every update PR
|
|
190
228
|
|
|
229
|
+
### Release Artifact Provenance
|
|
230
|
+
|
|
231
|
+
- Build and release artifacts must be traceable to source revision, build workflow, dependency inventory, verification result, approval gate, and deployment environment
|
|
232
|
+
- SBOMs and attestations are release dependencies when downstream consumers, operators, compliance, incident response, or security review depend on reconstructing what was shipped
|
|
233
|
+
- Provenance for conventional build/release artifacts is not optional merely because the system also records AI-generated artifact provenance. AI provenance and release provenance answer different trust questions and both must be present when both artifact types affect authority or release
|
|
234
|
+
- A release gate that verifies only package installation or test success is incomplete when the release claim requires signed artifacts, dependency inventory, vulnerability status, or reproducible build evidence
|
|
235
|
+
|
|
191
236
|
## Referential Integrity
|
|
192
237
|
|
|
193
238
|
- A module referenced by import/require must actually exist
|
|
@@ -204,11 +249,36 @@ Cross-reference: logic_rules.md 'Type System Logic' (enum/union breaking changes
|
|
|
204
249
|
## External Dependency Management
|
|
205
250
|
|
|
206
251
|
- Production dependencies and development-only dependencies must be distinguished (dependencies vs devDependencies)
|
|
207
|
-
- External API calls must
|
|
252
|
+
- External API calls must declare failure semantics: retry, timeout, circuit breaker, explicit degraded behavior, or fail-loud/fail-close behavior. A fallback is required only when the product contract promises continued reduced service
|
|
208
253
|
- The license of external dependencies must be compatible with the project license
|
|
209
254
|
- For detecting changes from external-service-based sources, using service-provided metadata (lastModified, etc.) is advantageous for preventing false positives
|
|
210
255
|
- A pattern that concentrates external interface definitions in a single file (like MCP tool definitions) is prone to growing into a God Module. A distributed registration pattern maintains correct dependency directions
|
|
211
256
|
|
|
257
|
+
### LLM/Agent Dependency Management
|
|
258
|
+
|
|
259
|
+
- Model provider APIs are external dependencies. Breaking changes include model deprecation, behavior changes between pinned versions, pricing changes, rate-limit changes, auth changes, and response-format changes
|
|
260
|
+
- Model/provider migration requires impact analysis across prompt templates, tool schemas, retrieval policy, evaluation baselines, production dashboards, and cost budgets
|
|
261
|
+
- MCP server schemas are API contracts. New required tool parameters, result-shape changes, removed tools, or changed failure semantics are breaking changes for agents and hosts
|
|
262
|
+
- Embedding model changes require re-indexing stored vectors. Embeddings from different models are not comparable, so partial migration must keep old and new indexes separated until cutover
|
|
263
|
+
- LLM framework upgrades can change default prompts, chunking, routing, retry, or output parsing behavior. Treat framework defaults as behavior-affecting dependencies and verify against the semantic evaluation suite
|
|
264
|
+
- If an LLM dependency is unavailable during a development/review/authority path, the default is fail-loud. A fallback may run only if the contract declares its lost capability, diagnostic artifact, and trust status
|
|
265
|
+
|
|
266
|
+
### AI Supply Chain and Provenance
|
|
267
|
+
|
|
268
|
+
- AI supply chain dependencies include model/provider, model version or alias, dataset/corpus, embedding model, embedding index, prompt framework, eval judge, tool runtime, safety layer, generated artifact builder, and generated artifact inputs
|
|
269
|
+
- Generated artifacts that affect authority, release, security, user decisions, or review outcomes must preserve provenance: source refs, builder/agent, input set, transformation path, verification state, and relevant model/provider facts
|
|
270
|
+
- Evaluation datasets, rubrics, AI-as-judge prompts, and judge models are dependencies. Changing any of them can change apparent quality without changing product behavior
|
|
271
|
+
- Retrieval corpora are dependencies, not passive content. Corpus ingestion, source lifecycle, tenant/user permissions, poisoning controls, and deletion/retention rules affect behavior and trust
|
|
272
|
+
- Prompt packages, system instructions, and tool descriptions are behavior dependencies. If they are injected from host configuration, the host route must be treated as a dependency boundary
|
|
273
|
+
- A dependency update that changes LLM behavior must be evaluated with semantic regression evidence or an explicit risk acceptance. Package version success alone is insufficient
|
|
274
|
+
|
|
275
|
+
### Dependency Direction for AI Boundaries
|
|
276
|
+
|
|
277
|
+
- Runtime may depend on prompt/context/tool configuration as input artifacts, but prompt text must not become the runtime authority for validation, authorization, persistence, or idempotency
|
|
278
|
+
- Middleware may depend on runtime schemas for transport and envelope conversion, but middleware must not become the source of truth for semantic policy or artifact authority
|
|
279
|
+
- Agents may depend on tool schemas and capability descriptions, but tool implementations must not depend on agent natural-language reasoning for security or data integrity
|
|
280
|
+
- Retrieval output may depend on source corpora and indexes, but authority claims must depend on provenance-bearing refs, not on generated text alone
|
|
281
|
+
|
|
212
282
|
## Related Documents
|
|
213
283
|
- concepts.md — term definitions for dependency, source of truth, contract, API versioning, etc.
|
|
214
284
|
- structure_spec.md — layer structure principles, module structure rules, architectural patterns
|