-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdomain.yaml
More file actions
365 lines (325 loc) · 9.5 KB
/
domain.yaml
File metadata and controls
365 lines (325 loc) · 9.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# domain.yaml — Strategic Domain Design for Funny
# ------------------------------------------------
# This file defines the DDD strategic architecture.
# Tactical annotations remain in source code (@domain JSDoc tags).
#
# Validate: bun packages/domain-map/src/cli.ts --domain-file domain.yaml --validate packages/runtime/src
# Diagram: bun packages/domain-map/src/cli.ts --domain-file domain.yaml --format context-map packages/runtime/src
$schema: "./packages/domain-map/domain-schema.json"
version: "1.0"
# -- Top-Level Domain --
domain:
name: Funny
description: >
Web UI for orchestrating multiple Claude Code agents in parallel
using git worktrees for isolation.
# -- Subdomains --
subdomains:
# === CORE — Competitive differentiators ===
Agent Execution:
type: core
description: >
Orchestrates Claude CLI agents, manages their lifecycle (start, stop,
resume), handles NDJSON message streams, and tracks agent state.
bounded-context: AgentExecution
publishes:
- agent:started
- agent:completed
- agent:error
- agent:stopped
- agent:tool_call
- agent:result
exposes:
- startAgent
- stopAgent
- resumeAgent
- isAgentRunning
Thread Management:
type: core
description: >
Thread CRUD, message persistence, status machine, stage transitions,
search, tool call tracking, and comment management.
bounded-context: ThreadManagement
publishes:
- thread:created
- thread:stage-changed
- thread:deleted
exposes:
- createThread
- getThread
- deleteThread
- getThreadWithMessages
- searchThreads
# === SUPPORTING — Essential but not differentiators ===
Git Operations:
type: supporting
description: >
Git diff, stage, unstage, revert, commit, push, pull, merge, stash,
PR creation, and worktree management.
bounded-context: GitOps
publishes:
- git:staged
- git:unstaged
- git:reverted
- git:committed
- git:pushed
- git:pulled
- git:merged
- git:stashed
- git:stash-popped
- git:reset-soft
- git:changed
- git:status
exposes:
- stageFiles
- unstageFiles
- commit
- push
- pull
- createPR
- createWorktree
- removeWorktree
Project Management:
type: supporting
description: >
Project CRUD with git repo validation, filesystem browsing,
and file operations.
bounded-context: ProjectMgmt
exposes:
- createProject
- getProject
- listProjects
- deleteProject
Automation:
type: supporting
description: >
Scheduled cron-based and triggered automation workflows.
Automations spawn agent runs on a schedule.
bounded-context: AutomationEngine
exposes:
- createAutomation
- triggerRun
- scheduleAutomation
Real-time Communication:
type: supporting
description: >
WebSocket pub/sub broker for broadcasting events
to connected UI clients.
bounded-context: RealtimeComms
exposes:
- emit
- emitToUser
- broadcast
Process Management:
type: supporting
description: >
PTY management for interactive terminal sessions,
startup commands, project hooks, and command execution.
bounded-context: ProcessMgmt
publishes:
- command:status
- command:output
- hook:executed
exposes:
- runCommand
- startPty
- stopPty
- listHooks
- runHook
External Integration:
type: supporting
description: >
Ingest API for external systems (GitHub Actions, CI/CD).
Translates webhook payloads into thread operations.
bounded-context: ExternalIngest
exposes:
- handleIngestEvent
# === GENERIC — Could be replaced with off-the-shelf ===
Authentication:
type: generic
description: >
Dual-mode auth. Local mode: bearer token.
Multi-user mode: Better Auth with cookie sessions.
bounded-context: Auth
exposes:
- authenticate
- createUser
- getSession
Extensions:
type: generic
description: >
MCP server management, plugin discovery/execution,
and skills (Claude Code slash commands).
bounded-context: ExtensionPlatform
exposes:
- listMcpServers
- addMcpServer
- listPlugins
- listSkills
Analytics:
type: generic
description: >
Usage tracking, cost metrics, and reporting.
bounded-context: AnalyticsEngine
exposes:
- trackUsage
- getAnalytics
User Profile:
type: generic
description: >
Per-user git identity, GitHub PAT (encrypted at rest),
and user settings.
bounded-context: UserProfile
exposes:
- getProfile
- updateProfile
- getGitIdentity
- getGithubToken
# -- Shared Kernel --
shared-kernel:
name: Shared Kernel
description: >
Database (SQLite/Drizzle), ThreadEventBus, logger, validation schemas,
middleware, type contracts, handler registry, and shutdown manager.
includes:
- ThreadEventBus
- Database
- Schema
- Logger
- HandlerRegistry
- ValidationSchemas
- HonoEnv
- ServerInterfaces
- ShutdownManager
- ErrorHandler
- RateLimit
- RouteHelpers
- DataDir
# -- Context Map --
context-map:
- upstream: AgentExecution
downstream: ThreadManagement
relationship: customer-supplier
upstream-role: supplier
downstream-role: customer
description: >
AgentRunner creates/updates threads and messages.
Thread Management evolves its API to serve Agent Execution.
implemented-by:
- "AgentRunner -> ThreadManager.insertMessage"
- "AgentMessageHandler -> MessageRepository, ToolCallRepository"
- upstream: AgentExecution
downstream: GitOps
relationship: partnership
description: >
Agent completion triggers git status refresh.
Git change detection feeds back into agent message handling.
implemented-by:
- "AgentCompletedGitStatusHandler (consumes agent:completed)"
- "GitStatusHandler (consumes git:changed)"
- upstream: GitOps
downstream: ThreadManagement
relationship: conformist
description: >
Git events update thread stage history.
Thread Management conforms to git event payloads.
implemented-by:
- "GitEventPersistenceHandler -> StageHistory"
- upstream: AgentExecution
downstream: RealtimeComms
relationship: published-language
via: SharedKernel.ThreadEventBus
description: >
Agent events broadcast to WebSocket clients
through the shared event bus.
implemented-by:
- "ThreadEventBus -> WSBroker.emit"
- upstream: ExternalIngest
downstream: ThreadManagement
relationship: anti-corruption-layer
description: >
IngestMapper translates external webhook payloads
into thread/message operations.
implemented-by:
- "IngestMapper (ACL)"
- upstream: ExtensionPlatform
downstream: AgentExecution
relationship: conformist
description: >
MCP servers and plugins configure agent tool availability.
Extensions conform to the agent's tool interface.
- upstream: AgentExecution
downstream: AutomationEngine
relationship: customer-supplier
upstream-role: supplier
downstream-role: customer
description: >
AutomationScheduler triggers agent runs via startAgent.
implemented-by:
- "AutomationScheduler -> AgentRunner.startAgent"
- upstream: Auth
downstream: "*"
relationship: open-host-service
description: >
Auth middleware provides standard authentication protocol
for all route handlers.
implemented-by:
- "auth middleware (Hono middleware chain)"
- upstream: UserProfile
downstream: GitOps
relationship: customer-supplier
upstream-role: supplier
downstream-role: customer
description: >
GitService retrieves git identity and GitHub PAT
from ProfileService for commits and pushes.
implemented-by:
- "GitService -> ProfileService.getGitIdentity"
- upstream: ThreadManagement
downstream: AutomationEngine
relationship: conformist
description: >
AutomationScheduler creates threads via ThreadManager,
conforming to the thread creation interface.
implemented-by:
- "AutomationScheduler -> ThreadManager.createThread"
- upstream: ProcessMgmt
downstream: ProjectMgmt
relationship: customer-supplier
upstream-role: supplier
downstream-role: customer
description: >
Project routes consume Process Management services
for hooks, startup commands, and command execution.
implemented-by:
- "projects.ts routes -> ProjectHooksService"
- "projects.ts routes -> StartupCommandsService, CommandRunner"
# -- Team Ownership --
teams:
Core:
description: >
Owns the competitive differentiators — agent orchestration
and thread management.
owns:
- AgentExecution
- ThreadManagement
Platform:
description: >
Owns developer-facing infrastructure — git integration,
project management, process execution, real-time communication.
owns:
- GitOps
- ProjectMgmt
- ProcessMgmt
- RealtimeComms
- ExternalIngest
Foundation:
description: >
Owns generic and cross-cutting concerns — authentication,
extensions, analytics, user profiles, automation.
owns:
- Auth
- ExtensionPlatform
- AnalyticsEngine
- UserProfile
- AutomationEngine