Architecture
Bounded Contexts & Rules
Conceptual foundation of Domain-Driven Design (DDD) domain ownership and dependency governance in Septum.
In growing repositories, AI coding agents often fix a bug or implement a feature by importing whatever internal helper or database model is closest at hand. Over time, direct cross-module imports blur module ownership, create circular dependencies, and turn isolated features into tightly coupled monoliths.
Septum brings Bounded-Context Architecture Governance into the agent workflow.
Theoretical Model
Drawing from Domain-Driven Design (DDD) and modular architecture principles, Septum models a codebase as a collection of named domains, each owning a physical root directory inside the workspace:
┌────────────────────────┐
│ apps/web (Consumer) │ ── allowed ──► [shared]
└───────────┬────────────┘
│ forbidden
▼
┌────────────────────────┐
│ internal-billing │ ◄── cycle check ──► [orders]
└────────────────────────┘
- Explicit Domain Ownership: Every source file inside a domain root belongs to that domain (nested domain roots resolve to the most specific matching root).
- Directional Dependency Policies: Each domain can declare:
allowed_dependencies: Which sibling or shared domains it is permitted to import from (enforced when operating instrictmode).forbidden_dependencies: Which domains it must never import from (enforced in bothwarnandstrictmodes).
- Cycle Prevention: Even when individual imports appear locally reasonable, circular domain dependencies (
A → B → A) undermine clean layering and independent testing. Septum runs static cycle detection across resolved domain and file graphs.
Benefits for AI-Assisted Software Engineering
- Predictable Architectural Boundaries: Before an agent writes a new import,
septum_boundary(scope: "file")orseptum hook pre-writeinforms the agent whether that dependency crosses a forbidden boundary. - Reviewable Policy Ownership: Rules live explicitly in
septum.config.json(or SQLite), making architectural intent visible to both human engineers and AI coding agents. - Frozen Pre-Commit Gate: Running
septum check --stagedevaluates the exact Git index snapshot rather than relying on unstaged working-tree files.
Boundaries of Domain Rules
- Import Topology, Not Runtime Contracts: Domain rules govern static import edges between mapped roots; they do not govern HTTP calls, shared database tables, or runtime event buses.
- Policy Accuracy Depends on Configuration: Auto-discovered domains from
septum initare heuristic starting points. Reviewing and curatingseptum.config.jsonensures rules match your real architectural intent.