Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,14 @@ Here is the directory overview:

### Dependency Flow

The dependency flow proceeds inward: `infrastructure` depends on `model`, which depends on `application`, which depends on `domain`.
Each outer layer depends only on the inner layers (e.g., infrastructure → model → application → domain), ensuring clean separation and maintainability.
Source-code dependencies **only point inward** (outer → inner). Inner layers know nothing about outer ones—this is the core *“dependency rule”* of DDD ([DDD Reference, PDF](https://www.domainlanguage.com/wp-content/uploads/2016/05/DDD_Reference_2015-03.pdf)).

- The `domain` layer is independent.
- The `application` layer depends on `domain` and exposes use cases.
Comment on lines +209 to +212
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation states that "The domain layer is independent" and that "Source-code dependencies only point inward (outer → inner)," but this is inconsistent with the actual codebase.

The domain layer currently imports from both application (e.g., core/domain/base/vector.py line 14: from core.application.networks.embeddings import EmbeddingModelSingleton) and infrastructure (e.g., core/domain/base/vector.py line 17: from core.infrastructure.db.qdrant import connection and core/domain/base/nosql.py line 10: from core.infrastructure.db.mongo import connection).

This violates the DDD dependency rule described in the documentation. Either the documentation should accurately reflect the current architecture, or the code should be refactored to comply with the described dependency flow.

Suggested change
Source-code dependencies **only point inward** (outer → inner). Inner layers know nothing about outer ones—this is the core *“dependency rule”* of DDD ([DDD Reference, PDF](https://www.domainlanguage.com/wp-content/uploads/2016/05/DDD_Reference_2015-03.pdf)).
- The `domain` layer is independent.
- The `application` layer depends on `domain` and exposes use cases.
Source-code dependencies generally point inward (outer → inner), following the *“dependency rule”* of DDD ([DDD Reference, PDF](https://www.domainlanguage.com/wp-content/uploads/2016/05/DDD_Reference_2015-03.pdf)). However, in this codebase, the domain layer may import from application and infrastructure layers where necessary for practical reasons.
- The `domain` layer is not strictly independent; it may depend on `application` and `infrastructure` in some cases.
- The `application` layer depends on `domain` and may also interact with `infrastructure`.

Copilot uses AI. Check for mistakes.
- The `model` layer (LLM training/tuning/inference) may depend on `application` and `domain` as needed. *(Note: `model/` here refers to ML/LLM codes, not the DDD _"domain model"_.)*
- The `infrastructure` layer depends on inner layers (`application`, `domain`, and, where applicable, `model`).



┌────────────────────────────┐
│ configs/ │
Expand Down