Skip to content

Commit e56a587

Browse files
author
Alex
committed
2 parents 82df0d4 + 6946e31 commit e56a587

10 files changed

Lines changed: 1032 additions & 7 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Summary: terraphim_orchestrator/src/lib.rs
2+
3+
**Purpose:** Multi-agent orchestration with scheduling, budgeting, and compound review for the "dark factory" pattern.
4+
5+
**Core Components:**
6+
- **AgentOrchestrator**: Main orchestrator running dark factory pattern
7+
- **DualModeOrchestrator**: Real-time and batch processing with fairness scheduling
8+
- **CompoundReviewWorkflow**: Multi-agent review swarm with persona-based specialization
9+
- **Scheduler**: Time-based and event-driven task scheduling
10+
- **HandoffBuffer**: Inter-agent state transfer with TTL management
11+
- **CostTracker**: Budget enforcement and spending monitoring
12+
- **NightwatchMonitor**: Drift detection and rate limiting
13+
- **MetaCoordinator**: Cross-project issue-driven agent dispatch with PageRank prioritisation
14+
15+
**Key Modules:**
16+
- `adf_commands`: ADF-specific command handling
17+
- `compound`: Compound review workflow with swarm config
18+
- `control_plane`: Routing and fleet management
19+
- `cost_tracker`: Metrics, verdicts, budget tracking
20+
- `dispatcher`: Task dispatch with stats
21+
- `evolution`: Agent evolution with memory snapshots
22+
- `handoff`: Inter-agent state transfer
23+
- `kg_router`: Knowledge graph-based routing
24+
- `pr_dispatch`, `pr_gate`, `pr_review`: PR lifecycle management
25+
- `provider_probe`: LLM provider health monitoring
26+
27+
**Key Exports:**
28+
- `AgentRunRecord`, `ExitClass`, `ExitClassification`
29+
- `CompoundReviewResult`, `SwarmConfig`
30+
- `DualModeOrchestrator`
31+
- `CostTracker`, `AgentMetrics`, `BudgetVerdict`
32+
- `Dispatcher`, `DispatchTask`
33+
- `HandoffBuffer`, `HandoffContext`
34+
- `MentionTracker`, `MentionChainTracker`
35+
- `OrchestratorConfig`, `AgentDefinition`, `AgentLayer`
36+
37+
**Configuration:**
38+
- OrchestratorConfig for main settings
39+
- AgentDefinition with evolution, model, capabilities
40+
- CompoundReviewConfig for review workflows
41+
- NightwatchConfig for rate limiting
42+
- WebhookConfig for output posting
43+
44+
**Features:**
45+
- PageRank-based issue prioritisation
46+
- Token budget tracking with time limits
47+
- Agent learning capture and evolution
48+
- Multi-provider LLM routing (kimi, opencode-go, minimax, claude, etc.)
49+
- Quickwit integration for log search
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Summary: terraphim_rlm/src/lib.rs
2+
3+
**Purpose:** Recursive Language Model (RLM) orchestration with isolated Firecracker VM execution, sub-500ms allocation, and knowledge graph validation.
4+
5+
**Architecture:**
6+
```
7+
TerraphimRlm (public API)
8+
├── SessionManager (VM affinity, context, snapshots, extensions)
9+
├── QueryLoop (command parsing, execution, result handling)
10+
├── BudgetTracker (token counting, time tracking, depth limits)
11+
└── KnowledgeGraphValidator (term matching, retry, strictness)
12+
13+
ExecutionEnvironment trait
14+
├── FirecrackerExecutor (primary, full isolation)
15+
├── DockerExecutor (fallback, gVisor/runc)
16+
└── E2bExecutor (cloud option)
17+
```
18+
19+
**Core Modules:**
20+
- `config`: BackendType, KgStrictness, RlmConfig, SessionModel
21+
- `executor`: Execution environment abstraction
22+
- `budget`: BudgetTracker for token/time limits
23+
- `session`: Session management with VM affinity
24+
- `llm_bridge`: LLM invocation from within VMs
25+
- `parser`: Command parsing
26+
- `query_loop`: Query execution loop
27+
- `rlm`: Main RLM orchestration
28+
- `logger`: Trajectory logging
29+
30+
**Key Types:**
31+
- `RlmConfig`: Configuration with timeout, model, strictness settings
32+
- `RlmError`: Error types
33+
- `ExecutionResult`: Command/code execution result
34+
- `SnapshotId`: VM snapshot identifier
35+
- `ValidationResult`: KG validation result
36+
- `QueryRequest`, `QueryResponse`: LLM bridge types
37+
- `TrajectoryEvent`: Logging event
38+
39+
**Features:**
40+
- Firecracker microVM isolation with sub-500ms boot
41+
- Dual budget system (tokens + time)
42+
- VM snapshots and resume
43+
- SSH executor for remote execution
44+
- Knowledge graph command validation
45+
- Trajectory logging for audit
46+
47+
**Cargo Features:**
48+
- `kg-validation`: Enable KG validation
49+
- `mcp`: MCP tools support
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Summary: terraphim_symphony/src/lib.rs
2+
3+
**Purpose:** Long-running orchestration service that reads from issue trackers, creates per-issue workspaces, and runs coding agent sessions.
4+
5+
**Core Components:**
6+
- **OrchestratorRuntimeState**: Runtime state management
7+
- **SymphonyOrchestrator**: Main orchestrator
8+
- **WorkspaceManager**: Per-issue workspace lifecycle
9+
- **IssueTracker**: Issue tracking integration (Gitea)
10+
- **Worker**: Agent execution with outcome tracking
11+
12+
**Key Modules:**
13+
- `api`: HTTP API endpoints
14+
- `config`: Configuration management
15+
- `error`: Error types
16+
- `orchestrator`: Main orchestration logic
17+
- `runner`: Agent execution with CodexSession
18+
- `tracker`: Issue tracking (Gitea)
19+
- `workspace`: Workspace lifecycle
20+
21+
**Key Exports:**
22+
- `SymphonyOrchestrator`, `OrchestratorRuntimeState`, `StateSnapshot`
23+
- `WorkerOutcome`, `AgentEvent`, `CodexSession`
24+
- `ReviewAgentOutput`, `ReviewFinding`, `FindingCategory`, `FindingSeverity`
25+
- `TokenCounts`, `TokenTotals`
26+
- `Issue`, `IssueTracker`
27+
- `WorkspaceManager`
28+
29+
**Features:**
30+
- Isolated per-issue workspaces
31+
- Agent session management (Codex)
32+
- Finding deduplication
33+
- Token tracking and budgets
34+
- Gitea issue integration

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
- **terraphim_rlm CLI binary** with 6 commands (code, bash, query, context, snapshot, status) for stateless RLM execution (Refs #RLM-CLI, 2026-05-18)
13+
- **MCP server RLM integration** via process spawning — 6 new tools exposed without linking terraphim_rlm (avoids static init hang) (Refs #RLM-CLI, 2026-05-18)
1214
- **Session search capability** enabled in `terraphim_agent` binary (2026-05-17)
1315
- **Evolution integration** `terraphim_agent_evolution` wired into ADF orchestrator (Refs #1487, 2026-05-15)
1416
- **Ranking regression gate** Kendall-tau snapshot tests added to prevent ranking regressions (Refs #1454, 2026-05-16)

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)