Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

4.0 KB
Raw Blame

ruflo-ddd β€” DDD Reference

Companion reference for domain-modeler and other agents in this plugin. The agent prompt deliberately stays lean per ADR-098 Part 2; this file collects the vocabulary tables, scaffolding catalogs, and AgentDB graph-storage recipes the agent reads on-demand.

DDD building blocks

Building block Purpose Key rule
Entity Object with identity and lifecycle Identity-based equality; mutable state
Value Object Immutable descriptor without identity Equality by value; side-effect free
Aggregate Root Consistency boundary with invariants All mutations go through the root
Domain Event Record of something that happened Immutable; past-tense named; carries payload
Repository Persistence abstraction per aggregate One repository per aggregate root
Domain Service Stateless cross-entity operations Used when logic spans multiple aggregates
Factory Complex object creation Encapsulates construction invariants

Bounded-context relationships

Relationship Use when
Partnership Two contexts succeed or fail together; coordinate releases
Customer-Supplier Upstream context provides; downstream consumes; downstream needs are honored
Conformist Downstream conforms to upstream's model verbatim (no translation)
Anti-Corruption Layer (ACL) Downstream protects itself by translating between ubiquitous languages
Open Host Service Upstream publishes a stable protocol for many downstream consumers
Published Language Shared interchange format (often paired with Open Host Service)

Per-context directory structure

src/<context-name>/
  domain/
    entities/         # Entities and aggregate root
    value-objects/    # Value objects
    events/           # Domain events
    services/         # Domain services
    repositories/     # Repository interfaces
  application/        # Use cases / application services
  infrastructure/     # Repository implementations, ACL adapters
  index.ts            # Public API of the context

AgentDB graph storage

Persist the domain model as a navigable graph so subsequent sessions can traverse it via the pathfinder agent:

# Store bounded context hierarchy (hierarchical-store takes key/value/tier)
mcp__plugin_ruflo-core_ruflo__agentdb_hierarchical-store({ key: "domain/context-ordering", value: "Bounded context ordering (parent: domain)", tier: "semantic" })
mcp__plugin_ruflo-core_ruflo__agentdb_hierarchical-store({ key: "domain/context-ordering/aggregate-order", value: "Aggregate order (parent: context-ordering)", tier: "semantic" })

# Store context dependencies (causal-edge takes domain-prefixed sourceId/targetId, relation, optional weight)
mcp__plugin_ruflo-core_ruflo__agentdb_causal-edge({ sourceId: "entity:context-ordering", targetId: "entity:context-inventory", relation: "depends-on" })
mcp__plugin_ruflo-core_ruflo__agentdb_causal-edge({ sourceId: "entity:context-ordering", targetId: "entity:context-payments", relation: "publishes-events-to" })

# Traverse later with agentdb_graph-query({ nodeId: "entity:context-ordering", mode: "k-hop", depth: 2, relation: "depends-on" })

Edge types worth standardizing across a project:

  • depends-on β€” context needs the other to exist (sync coupling)
  • publishes-events-to β€” fire-and-forget event flow
  • translates-via-acl-to β€” anti-corruption layer mediates
  • conforms-to β€” downstream adopts upstream model verbatim

Naming conventions

  • Aggregate roots: PascalCase singular noun (Order, Customer, Invoice).
  • Domain events: PascalCase past-tense (OrderPlaced, InvoiceVoided, CustomerEmailChanged).
  • Commands: PascalCase imperative (PlaceOrder, VoidInvoice).
  • Repository interfaces: <Aggregate>Repository (OrderRepository).
  • Domain services: <Verb><Noun>Service (PriceQuoteService, InventoryAllocationService).