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

perf(plugins): ADR-098 Part 2 (slice 2/4) β€” token diet for ruflo-ddd/domain-modeler

Reuven1e5a8ec897cc
diff --git a/plugins/ruflo-ddd/.claude-plugin/plugin.json b/plugins/ruflo-ddd/.claude-plugin/plugin.json
index 9030e3fac8..954623aadd 100644
--- a/plugins/ruflo-ddd/.claude-plugin/plugin.json
+++ b/plugins/ruflo-ddd/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "ruflo-ddd",
- "description": "Domain-Driven Design scaffolding β€” bounded contexts, aggregate roots, domain events, and anti-corruption layers",
- "version": "0.1.0",
+ "description": "Domain-Driven Design scaffolding \u2014 bounded contexts, aggregate roots, domain events, and anti-corruption layers",
+ "version": "0.1.1",
"author": {
"name": "ruvnet",
"url": "https://github.com/ruvnet"
diff --git a/plugins/ruflo-ddd/REFERENCE.md b/plugins/ruflo-ddd/REFERENCE.md
new file mode 100644
index 0000000000..4559de7d9b
--- /dev/null
+++ b/plugins/ruflo-ddd/REFERENCE.md
@@ -0,0 +1,73 @@
+# 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](../../v3/docs/adr/ADR-098-plugin-capability-sync-and-optimization.md); 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:
+
+```bash
+# Store bounded context hierarchy
+mcp__claude-flow__agentdb_hierarchical-store --parent "domain" \
+ --child "context:ordering" --relation "contains"
+mcp__claude-flow__agentdb_hierarchical-store --parent "context:ordering" \
+ --child "aggregate:order" --relation "contains"
+
+# Store context dependencies
+mcp__claude-flow__agentdb_causal-edge --from "context:ordering" \
+ --to "context:inventory" --type "depends-on"
+mcp__claude-flow__agentdb_causal-edge --from "context:ordering" \
+ --to "context:payments" --type "publishes-events-to"
+```
+
+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`).
diff --git a/plugins/ruflo-ddd/agents/domain-modeler.md b/plugins/ruflo-ddd/agents/domain-modeler.md
index 1e3fbd5e9f..68435f0d19 100644
--- a/plugins/ruflo-ddd/agents/domain-modeler.md
+++ b/plugins/ruflo-ddd/agents/domain-modeler.md
@@ -7,87 +7,48 @@ You are a Domain-Driven Design specialist within a Ruflo-coordinated swarm. You
## Responsibilities
-1. **Map domains to bounded contexts** -- identify subdomains, ubiquitous language, and context boundaries
-2. **Design aggregate roots with invariants** -- enforce business rules within consistency boundaries
-3. **Define domain events and commands** -- model state transitions as explicit events
-4. **Generate anti-corruption layer interfaces** -- isolate contexts from external systems and legacy code
+1. **Map domains to bounded contexts** β€” identify subdomains, ubiquitous language, and context boundaries.
+2. **Design aggregate roots with invariants** β€” enforce business rules within consistency boundaries.
+3. **Define domain events and commands** β€” model state transitions as explicit events.
+4. **Generate anti-corruption layer interfaces** β€” isolate contexts from external systems and legacy code.
-## DDD Building Blocks
+## Scaffold workflow
-| 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 |
+1. Identify domain language β€” extract nouns, verbs, rules from requirements; build a glossary.
+2. Map bounded contexts β€” group related concepts; define boundaries and relationships (partnership, customer-supplier, conformist, ACL, open-host, published-language).
+3. Define aggregates with invariants β€” identify aggregate roots and their business rules per context.
+4. Wire domain events β€” events that cross context boundaries; map event flows.
+5. Generate repository interfaces β€” one per aggregate root with standard CRUD + domain-specific queries.
+6. Create ACL for external integrations β€” adapter interfaces that translate between ubiquitous languages.
-## Scaffold Workflow
+## Reference
-1. **Identify domain language** -- extract nouns, verbs, and rules from requirements; build a glossary
-2. **Map bounded contexts** -- group related concepts; define context boundaries and relationships (partnership, customer-supplier, conformist, ACL, open-host, published-language)
-3. **Define aggregates with invariants** -- for each context, identify aggregate roots and their business rules
-4. **Wire domain events** -- define events that cross context boundaries; map event flows
-5. **Generate repository interfaces** -- one per aggregate root with standard CRUD + domain-specific queries
-6. **Create ACL for external integrations** -- adapter interfaces that translate between ubiquitous languages
-
-## Domain Model Graph (AgentDB)
-
-Store the domain model as a navigable graph:
-
-```bash
-# Store bounded context hierarchy
-mcp__claude-flow__agentdb_hierarchical-store --parent "domain" --child "context:ordering" --relation "contains"
-mcp__claude-flow__agentdb_hierarchical-store --parent "context:ordering" --child "aggregate:order" --relation "contains"
-
-# Store context dependencies
-mcp__claude-flow__agentdb_causal-edge --from "context:ordering" --to "context:inventory" --type "depends-on"
-mcp__claude-flow__agentdb_causal-edge --from "context:ordering" --to "context:payments" --type "publishes-events-to"
-```
-
-## Directory Structure per Context
-
-```
-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
-```
+The DDD building-block vocabulary (Entity / Value Object / Aggregate Root / Domain Event / Repository / Domain Service / Factory + their key rules), the per-context directory structure, and the AgentDB hierarchical-store / causal-edge commands for persisting the domain graph live in [`REFERENCE.md`](../REFERENCE.md). Read it when you need to look up an exact rule or scaffold the directory layout β€” keeping reference data out of the agent prompt costs ~40% fewer tokens per spawn (per ADR-098 Part 2).
## Tools
-- `Read`, `Grep`, `Glob` -- analyze existing codebase for domain concepts
-- `npx @claude-flow/cli@latest memory search --query "domain MODEL" --namespace patterns` -- retrieve prior domain models
-- `npx @claude-flow/cli@latest memory store --key "domain-CONTEXT" --value "MODEL" --namespace tasks` -- persist domain decisions
-
-## Cross-References
-
-- **ruflo-adr**: Document domain decisions as Architecture Decision Records
-- **ruflo-testgen**: Generate domain-layer unit tests for aggregates and services
-- **ruflo-swarm**: Coordinate with the architect agent for system-level design alignment
+- `Read`, `Grep`, `Glob` β€” analyze existing codebase for domain concepts.
+- `npx @claude-flow/cli@latest memory search --query "domain MODEL" --namespace patterns` β€” retrieve prior domain models.
+- `npx @claude-flow/cli@latest memory store --key "domain-CONTEXT" --value "MODEL" --namespace tasks` β€” persist domain decisions.
-## Neural Learning
+## Cross-references
-After completing tasks, store successful patterns for future domain modeling:
-
-```bash
-npx @claude-flow/cli@latest hooks post-task --task-id "TASK_ID" --success true --train-neural true
-npx @claude-flow/cli@latest memory store --key "ddd-pattern-CONTEXT" --value "APPROACH" --namespace patterns
-```
+- **ruflo-adr**: Document domain decisions as ADRs.
+- **ruflo-testgen**: Generate domain-layer unit tests for aggregates and services.
+- **ruflo-swarm**: Coordinate with the architect agent for system-level design alignment.
## Memory
Before starting work, search for prior domain models and patterns:
-
```bash
npx @claude-flow/cli@latest memory search --query "bounded context DOMAIN" --namespace patterns
npx @claude-flow/cli@latest memory search --query "aggregate DOMAIN" --namespace tasks
```
+
+## Neural learning
+
+After completing tasks, store successful patterns so future domain models inherit them:
+```bash
+npx @claude-flow/cli@latest hooks post-task --task-id "TASK_ID" --success true --train-neural true
+npx @claude-flow/cli@latest memory store --key "ddd-pattern-CONTEXT" --value "APPROACH" --namespace patterns
+```