terraphim_orchestrator 1.16.34

AI Dark Factory orchestrator wiring spawner, router, supervisor into a reconciliation loop
Documentation
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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
# orchestrator.example.toml -- AI Dark Factory Agent Fleet
#
# Copy to orchestrator.toml and adjust paths for your environment.
# Full 13-agent fleet with persona-specific knowledge graphs,
# terraphim-agent pre-checks, and disciplined engineering skill chains.

working_dir = "/opt/ai-dark-factory/workspace"
persona_data_dir = "/opt/ai-dark-factory/personas"
skill_data_dir = "/opt/ai-dark-factory/skills"
role_config_path = "/opt/ai-dark-factory/persona_roles_config.json"

[nightwatch]
eval_interval_secs = 300
minor_threshold = 0.10
moderate_threshold = 0.20
severe_threshold = 0.40
critical_threshold = 0.70

[compound_review]
schedule = "0 2 * * *"
max_duration_secs = 1800
repo_path = "/opt/ai-dark-factory/workspace"
create_prs = false

# =============================================================================
# ROUTING (telemetry-aware model selection)
# =============================================================================
# Uncomment to enable KG-driven and telemetry-aware model routing.
# Requires taxonomy markdown files in the taxonomy_path directory.
# When use_routing_engine is true, the control-plane routing engine
# combines KG routing, keyword routing, provider health, budget pressure,
# and live telemetry signals for model selection.
#
# [routing]
# taxonomy_path = "/opt/ai-dark-factory/kg/routing"
# probe_ttl_secs = 300
# probe_on_startup = true
# use_routing_engine = false

# =============================================================================
# SAFETY LAYER (always running)
# =============================================================================

[[agents]]
name = "security-sentinel"
layer = "Safety"
cli_tool = "claude"
persona = "vigil"
terraphim_role = "Vigil Security"
skill_chain = ["disciplined-verification", "disciplined-validation"]
task = """Continuously scan for CVEs and security vulnerabilities in dependencies.
Run cargo audit, check for OWASP Top 10 issues, and report findings.

## Domain Knowledge Search
When you need security context, use:
  terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "<query>" --role "Vigil Security"

## MANDATORY: Post verdict to Gitea
Post your security verdict to the relevant Gitea issue.
- PASS if no critical security issues found
- FAIL if critical vulnerabilities or issues found

Post verdict with @adf:merge-coordinator trigger.
Replace ISSUE_NUMBER with the issue from mention context, or the default tracking issue if no mention context.
"""
capabilities = ["security", "vulnerability-scanning", "supply-chain"]
max_memory_bytes = 2147483648

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "CVE vulnerability dependency audit supply chain" --role "Vigil Security" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

[[agents]]
name = "drift-detector"
layer = "Safety"
cli_tool = "claude"
persona = "echo"
terraphim_role = "Echo QA"
skill_chain = ["disciplined-verification", "disciplined-validation"]
task = """Monitor for configuration drift, test failures, and quality regressions.
Compare current state against known-good baselines and report deviations.

## Domain Knowledge Search
When you need QA context, use:
  terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "<query>" --role "Echo QA"
"""
capabilities = ["drift-detection", "quality-monitoring", "regression-detection"]
max_memory_bytes = 2147483648

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "regression drift quality baseline test failure" --role "Echo QA" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

# =============================================================================
# CORE LAYER (scheduled)
# =============================================================================

[[agents]]
name = "test-guardian"
layer = "Core"
cli_tool = "claude"
persona = "echo"
terraphim_role = "Echo QA"
skill_chain = ["disciplined-verification", "disciplined-validation", "testing", "acceptance-testing"]
schedule = "15 */8 * * *"
capabilities = ["testing", "coverage", "quality"]
max_cpu_seconds = 3600
grace_period_secs = 30
task = """Run comprehensive test suite and quality analysis:
1. cd to the workspace
2. cargo test --workspace 2>&1 | tee /tmp/test-guardian-results.txt
3. Identify failing or flaky tests
4. Check for untested critical code paths
5. Run: cargo clippy -- -D warnings 2>&1
6. Summarise findings as a test report

## MANDATORY: Post verdict to Gitea
Post your verdict to the relevant Gitea issue. Use:
- PASS if all tests pass and no critical quality issues
- FAIL if tests fail or critical quality issues found

Post verdict with @adf:merge-coordinator trigger.
Replace ISSUE_NUMBER with the issue from mention context, or the default tracking issue if no mention context.

## Domain Knowledge Search
When you need QA context, use:
  terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "<query>" --role "Echo QA"
"""

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "test quality regression flaky coverage" --role "Echo QA" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

[[agents]]
name = "implementation-swarm"
layer = "Core"
cli_tool = "claude"
persona = "ferrox"
terraphim_role = "Ferrox Rust"
skill_chain = ["disciplined-research", "disciplined-design", "disciplined-implementation", "disciplined-verification", "disciplined-validation"]
task = """Implement the highest-priority unblocked Gitea issue:
1. Run: gitea-robot ready --owner terraphim --repo terraphim-ai
2. Pick the highest PageRank unblocked issue (is_blocked=false)
3. Read the full issue details
4. Create branch: git checkout -b task/<IDX>-<short-title>
5. Implement following the issue spec
6. Run: cargo check && cargo clippy -- -D warnings && cargo fmt --all -- --check
7. Run: cargo test (for the affected package)
8. Quality check the changes for correctness, security, and idiomatic Rust
9. If quality check passes, commit with Refs #<IDX> and push branch:
   git add -A && git commit -m "feat: implement #<IDX> - <short-title> Refs #<IDX>" && git push -u origin task/<IDX>-<short-title>
10. Create PR:
   gitea-robot create-pull --owner terraphim --repo terraphim-ai --title "Fix #<IDX>: <short-title>" --base main --head task/<IDX>-<short-title>
11. Post comment to trigger review chain:
   gitea-robot comment --owner terraphim --repo terraphim-ai --index <IDX> --body "Implementation complete. Quality check passed. PR created from branch task/<IDX>-<short-title>.
   @adf:quality-coordinator please review this implementation for issue #<IDX>"
12. DO NOT close the issue. The merge-coordinator will close it after all reviews pass.

If quality check fails, fix the issues and re-run steps 6-8.

## Domain Knowledge Search
When you need Rust context, use:
  terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "<query>" --role "Ferrox Rust"
"""
schedule = "0 1 * * *"
capabilities = ["implementation", "rust-development", "tdd"]

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "implementation async ownership error handling" --role "Ferrox Rust" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

[[agents]]
name = "product-development"
layer = "Core"
cli_tool = "claude"
persona = "ferrox"
terraphim_role = "Ferrox Rust"
skill_chain = ["disciplined-research", "disciplined-design", "disciplined-implementation", "disciplined-verification", "disciplined-validation"]
task = """Develop new product features based on roadmap priorities.
Focus on user-facing functionality, integration points, and API design.

## Domain Knowledge Search
When you need Rust context, use:
  terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "<query>" --role "Ferrox Rust"
"""
schedule = "0 2 * * *"
capabilities = ["product-development", "feature-implementation", "api-design"]

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "feature api service integration" --role "Ferrox Rust" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

[[agents]]
name = "meta-coordinator"
layer = "Core"
cli_tool = "claude"
persona = "carthos"
terraphim_role = "Carthos Architecture"
skill_chain = ["disciplined-research", "disciplined-verification"]
task = """Coordinate agent activities, review architectural decisions, ensure
bounded contexts are respected, and maintain system coherence.

## Domain Knowledge Search
When you need architecture context, use:
  terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "<query>" --role "Carthos Architecture"
"""
schedule = "0 0 * * *"
capabilities = ["coordination", "architecture-review", "system-design"]

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "bounded context architecture decision API design" --role "Carthos Architecture" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

[[agents]]
name = "spec-validator"
layer = "Core"
cli_tool = "claude"
persona = "carthos"
terraphim_role = "Carthos Architecture"
skill_chain = ["disciplined-research", "disciplined-verification"]
task = """Validate specifications and design documents against implementation.
Ensure requirements traceability and design consistency.

## Domain Knowledge Search
When you need architecture context, use:
  terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "<query>" --role "Carthos Architecture"

## MANDATORY: Post verdict to Gitea
Post your spec validation verdict to the relevant Gitea issue.
- PASS if specs match implementation
- FAIL if spec violations found

Post verdict with @adf:merge-coordinator trigger.
Replace ISSUE_NUMBER with the issue from mention context, or the default tracking issue if no mention context.
"""
schedule = "0 4 * * *"
capabilities = ["specification-validation", "requirements-traceability", "design-review"]

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "specification requirement invariant domain model" --role "Carthos Architecture" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

[[agents]]
name = "compliance-watchdog"
layer = "Core"
cli_tool = "claude"
persona = "vigil"
terraphim_role = "Vigil Security"
skill_chain = ["disciplined-research", "disciplined-verification"]
task = """Monitor compliance with security policies, coding standards, and
regulatory requirements. Flag violations and suggest remediation.

## Domain Knowledge Search
When you need security/compliance context, use:
  terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "<query>" --role "Vigil Security"

## MANDATORY: Post verdict to Gitea
Post your compliance verdict to the relevant Gitea issue.
- PASS if no compliance issues found
- FAIL if compliance violations found

Post verdict with @adf:merge-coordinator trigger.
Replace ISSUE_NUMBER with the issue from mention context, or the default tracking issue if no mention context.
"""
schedule = "0 5 * * *"
capabilities = ["compliance", "policy-enforcement", "standards-checking"]

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "compliance policy secrets credential authentication" --role "Vigil Security" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

[[agents]]
name = "upstream-synchronizer"
layer = "Core"
cli_tool = "claude"
persona = "conduit"
terraphim_role = "Conduit DevOps"
skill_chain = ["disciplined-implementation", "disciplined-verification"]
task = """Sync with upstream repositories. Check for new releases of key
dependencies, update lockfiles, and verify compatibility.

## Domain Knowledge Search
When you need DevOps context, use:
  terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "<query>" --role "Conduit DevOps"
"""
schedule = "0 3 * * *"
capabilities = ["sync", "dependency-management", "upstream-tracking"]

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "deployment dependency container infrastructure" --role "Conduit DevOps" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

[[agents]]
name = "documentation-generator"
layer = "Core"
cli_tool = "claude"
persona = "mneme"
terraphim_role = "Mneme Knowledge"
skill_chain = ["disciplined-implementation", "disciplined-verification"]
task = """Generate and maintain documentation. Update API docs, README files,
and knowledge base entries based on recent code changes.

## Domain Knowledge Search
When you need knowledge management context, use:
  terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "<query>" --role "Mneme Knowledge"
"""
schedule = "0 6 * * *"
capabilities = ["documentation", "knowledge-management", "api-docs"]

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "documentation knowledge management learning pattern" --role "Mneme Knowledge" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

# =============================================================================
# GROWTH LAYER (on-demand / scheduled)
# =============================================================================

[[agents]]
name = "compound-review"
layer = "Growth"
cli_tool = "claude"
persona = "carthos"
terraphim_role = "Carthos Architecture"
skill_chain = ["disciplined-research", "disciplined-verification"]
task = """Perform compound reviews of recent changes across the codebase.
Identify cross-cutting concerns, architectural drift, and integration issues.

## Domain Knowledge Search
When you need architecture context, use:
  terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "<query>" --role "Carthos Architecture"
"""
schedule = "0 2 * * *"
capabilities = ["code-review", "architecture-review", "cross-cutting-analysis"]

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "architecture review quality attribute trade-off" --role "Carthos Architecture" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

[[agents]]
name = "quality-coordinator"
layer = "Growth"
cli_tool = "claude"
persona = "carthos"
terraphim_role = "Carthos Architecture"
skill_chain = ["disciplined-research", "disciplined-verification"]
task = """Run compound code review for the issue referenced in Mention Context.
Post verdict as "compound-review verdict: GO" or "compound-review verdict: NO-GO".

If GO, trigger the 4 remaining reviewers via @adf: mentions:
@adf:test-guardian, @adf:security-sentinel, @adf:spec-validator, @adf:compliance-watchdog.

Replace ISSUE_NUMBER with the issue from mention context.
"""
capabilities = ["code-review", "quality-gate", "review-coordination"]

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "code review quality gate architecture" --role "Carthos Architecture" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

[[agents]]
name = "browser-qa"
layer = "Growth"
cli_tool = "claude"
persona = "lux"
terraphim_role = "Lux Frontend"
skill_chain = ["disciplined-research", "disciplined-verification"]
task = """Test frontend features in the browser. Verify accessibility,
responsive design, and visual consistency across viewports.

## Domain Knowledge Search
When you need frontend context, use:
  terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "<query>" --role "Lux Frontend"
"""
capabilities = ["browser-testing", "accessibility-audit", "visual-qa"]

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "accessibility component responsive visual Svelte" --role "Lux Frontend" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

[[agents]]
name = "merge-coordinator"
layer = "Growth"
cli_tool = "claude"
persona = "conduit"
terraphim_role = "Conduit DevOps"
skill_chain = ["disciplined-research", "disciplined-verification"]
task = """Evaluate whether all 5 required code reviews have been posted on a Gitea issue,
and if all reviews are positive, merge the linked PR.

Required reviewers: compound-review, test-guardian, spec-validator, compliance-watchdog, security-sentinel.
Read all comments, parse verdicts (GO/PASS = positive, NO-GO/FAIL = negative).
If all 5 passed: merge PR and close issue.
If any missing or failed: post status summary and wait.

Replace ISSUE_NUMBER with the issue from mention context.
"""
capabilities = ["merge-coordination", "ci-cd", "conflict-resolution"]

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "deployment pipeline CI merge release" --role "Conduit DevOps" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

[[agents]]
name = "market-analyst"
layer = "Growth"
cli_tool = "claude"
persona = "meridian"
terraphim_role = "Meridian Research"
skill_chain = ["disciplined-research"]
task = """Research market trends, competitive landscape, and user needs.
Produce insights for product roadmap decisions.

## Domain Knowledge Search
When you need market research context, use:
  terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "<query>" --role "Meridian Research"
"""
schedule = "0 7 * * *"
capabilities = ["market-research", "competitive-analysis", "user-research"]

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "market research product strategy competitive analysis" --role "Meridian Research" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

[[agents]]
name = "knowledge-curator"
layer = "Growth"
cli_tool = "claude"
persona = "mneme"
terraphim_role = "Mneme Knowledge"
skill_chain = ["disciplined-research"]
task = """Curate and improve the knowledge graph. Identify gaps in domain
terminology, add new synonyms, and maintain KG quality.

## Domain Knowledge Search
When you need knowledge management context, use:
  terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "<query>" --role "Mneme Knowledge"
"""
schedule = "0 8 * * *"
capabilities = ["knowledge-curation", "kg-maintenance", "terminology-management"]

[agents.pre_check]
kind = "shell"
script = """terraphim-agent --config /opt/ai-dark-factory/persona_roles_config.json search "knowledge graph learning pattern decision framework" --role "Mneme Knowledge" --limit 5 2>/dev/null || echo '[]'"""
timeout_secs = 30

# =============================================================================
# FLOW DAG -- Compound Review v2
# =============================================================================

[[flows]]
name = "compound-review-v2"
schedule = "0 2 * * *"
repo_path = "/opt/ai-dark-factory/workspace"
base_branch = "main"
timeout_secs = 7200

[[flows.steps]]
name = "gather-changes"
kind = "action"
command = "git diff main..HEAD --name-only > /tmp/changed_files.txt && cat /tmp/changed_files.txt"
timeout_secs = 300
on_fail = "abort"

[[flows.steps]]
name = "analyze-architecture"
kind = "agent"
cli_tool = "claude"
model = "sonnet"
task = "Review the architecture changes in the modified files. Focus on design patterns, API contracts, and system boundaries."
timeout_secs = 900
on_fail = "skip_failed"

[[flows.steps]]
name = "check-security"
kind = "agent"
cli_tool = "claude"
model = "sonnet"
task = "Perform a security audit on the changed code. Look for injection vulnerabilities, unsafe deserialization, and authentication bypasses."
timeout_secs = 600
on_fail = "continue"

[[flows.steps]]
name = "gate-approval"
kind = "gate"
condition = "{{steps.analyze-architecture.exit_code}} == 0"

[[flows.steps]]
name = "checkpoint-completed"
kind = "checkpoint"