You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Record how each Symphony Section 4 entity maps onto the current Colony task tables, task-plan lifecycle, MCP tools, and live planner surfaces so later run-attempt and reconcile slices can consume one documented model.
Constraint: Docs-only Agent 201 lane; code behavior remains unchanged
Rejected: Add placeholder schema fields now | Wave 3-4 agents 208-217 own missing Colony surfaces
Confidence: high
Scope-risk: narrow
Directive: Keep NEW gaps linked to Agents 208-217 until those surfaces are implemented
Tested: openspec validate --specs
Not-tested: Runtime behavior, intentionally docs-only
Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>
| safety | Sections 9 and 15: workspace management, safety invariants, security, and operational safety |
44
+
45
+
## Domain Model
46
+
47
+
This section maps Symphony Section 4 entities to the current Colony task model.
48
+
`NEW` marks missing Colony surfaces that later Wave 3-4 agents must land before
49
+
run-attempt and reconcile behavior can treat Colony as the single source of
50
+
truth.
51
+
52
+
### Issue
53
+
54
+
| Symphony field | Colony field/file/MCP tool |
55
+
| --- | --- |
56
+
|`id`|`tasks.id` in `packages/storage/src/schema.ts` and `TaskRow.id` in `packages/storage/src/types.ts`; exposed as `task_id` by task tools. |
57
+
|`identifier`| Existing human/routing identifiers are `tasks.branch`, plan branch `spec/<plan_slug>/sub-<index>`, and live planner display id from `subtask_index + 1`; NEW (Agent 208) durable issue identifier field when imported from an external tracker. |
58
+
|`title`|`tasks.title`; plan subtask `metadata.title`; `task_plan_publish.subtasks[].title`; rendered by `apps/frontend/src/features/cave-hivemind/data/colony-live-planner.ts`. |
59
+
|`description`| Plan subtask `metadata.description` and `task_plan_publish.subtasks[].description`; task-thread notes via `task_post`; NEW (Agent 208) first-class task description outside plan subtasks. |
60
+
|`priority`|`task_ready_for_agent` response `priority` and ranking `fit_score` are computed surfaces, not stored issue priority; NEW (Agent 209). |
61
+
|`state`|`tasks.status`; plan subtask lifecycle status `available`, `claimed`, `completed`, or `blocked` in `packages/core/src/plan.ts`; `task_plan_claim_subtask` and `task_plan_complete_subtask`. |
62
+
|`branch_name`|`tasks.branch`; Guardex branch/worktree from `gx branch start`; plan branch `spec/<plan_slug>/sub-<index>`. |
63
+
|`url`| NEW (Agent 209) external issue URL/link metadata; current task links relate Colony task IDs only. |
64
+
|`labels`| NEW (Agent 209) labels/tags on tasks or plan subtasks. |
65
+
|`blocked_by`| Plan subtask `depends_on`, `blocked_by`, and `blocked_by_count` in `packages/core/src/plan.ts`; cross-task dependencies/coordination via `task_links` and `task_link`/`task_unlink`. |
66
+
|`created_at`|`tasks.created_at`. |
67
+
|`updated_at`|`tasks.updated_at`, touched by task-thread writes. |
68
+
69
+
### Workflow Definition
70
+
71
+
| Symphony field | Colony field/file/MCP tool |
72
+
| --- | --- |
73
+
|`config`|`task_plan_publish` input (`problem`, `acceptance_criteria`, `subtasks`, `waves`, `auto_archive`) and queen goal input in `apps/mcp-server/src/tools/queen.ts`; NEW (Agent 210) persisted workflow-front-matter config. |
74
+
|`prompt_template`| Live plan subtask prompt builder in `apps/frontend/src/features/cave-hivemind/data/colony-live-planner.ts`; NEW (Agent 210) persisted workflow prompt template separate from generated live-plan prompts. |
| workspace root |`tasks.repo_root`, `sessions.cwd`, `task_plan_publish.repo_root`, and `queen_plan_goal.repo_root`. |
82
+
| active and terminal issue states |`tasks.status`; plan subtask lifecycle in `plan-subtask-claim` observations; NEW (Agent 210) configurable active/terminal state sets. |
83
+
| concurrency limits | NEW (Agent 211) global and per-workflow concurrency limits. |
| workspace hooks | Guardex/OMX hooks exist outside the Colony task store; NEW (Agent 211) workflow-owned workspace hook config. |
86
+
87
+
### Workspace
88
+
89
+
| Symphony field | Colony field/file/MCP tool |
90
+
| --- | --- |
91
+
|`path`|`sessions.cwd` for live sessions; `tasks.repo_root` for repo scope; quota handoff metadata may carry `worktree_path`; NEW (Agent 211) durable workspace path on task/run attempt. |
92
+
|`workspace_key`| Current routing key is `tasks.branch`; plan routing key is `spec/<plan_slug>/sub-<index>`; claim paths normalize to repo-relative paths in `packages/storage/src/claim-path.ts`. |
93
+
|`created_now`| NEW (Agent 211) workspace creation bookkeeping for hook gating. |
94
+
95
+
### Run Attempt
96
+
97
+
| Symphony field | Colony field/file/MCP tool |
98
+
| --- | --- |
99
+
|`issue_id`|`task_id` / `tasks.id`; for plan work, `task_id` plus `plan_slug` and `subtask_index`. |
100
+
|`issue_identifier`|`tasks.branch`, plan `plan_slug` + `subtask_index`, and live planner display id; NEW (Agent 208) imported issue identifier parity. |
101
+
|`attempt`| NEW (Agent 212) durable run-attempt ordinal. |
102
+
|`workspace_path`|`sessions.cwd` and handoff `quota_context.worktree_path` when present; NEW (Agent 212) run-attempt workspace path. |
103
+
|`started_at`|`sessions.started_at`; claim/attempt-like events use `observations.ts`. |
104
+
|`status`|`tasks.status`, plan subtask lifecycle status, and active/paused lane state in `lane_states`. |
105
+
|`error`|`task_post` kinds `blocker`, `failed_approach`, `blocked_path`, and `conflict_warning`; NEW (Agent 212) structured run-attempt error field. |
106
+
107
+
### Live Session
108
+
109
+
| Symphony field | Colony field/file/MCP tool |
110
+
| --- | --- |
111
+
|`session_id`|`sessions.id`, MCP `session_id`, `task_participants.session_id`, and `observations.session_id`. |
112
+
|`thread_id`| NEW (Agent 213) Codex/runner thread id metadata. |
113
+
|`turn_id`| NEW (Agent 213) Codex/runner turn id metadata. |
114
+
|`codex_app_server_pid`| NEW (Agent 213) runner process metadata; process liveness currently lives outside task rows. |
115
+
|`last_codex_event`| NEW (Agent 214) latest runner event type. |
116
+
|`last_codex_timestamp`| NEW (Agent 214) latest runner event timestamp. |
117
+
|`last_codex_message`|`observations.content` can store summarized messages; NEW (Agent 214) typed latest runner message. |
118
+
|`codex_input_tokens`| NEW (Agent 217) coding-agent token counters. |
119
+
|`codex_output_tokens`| NEW (Agent 217) coding-agent token counters. |
120
+
|`codex_total_tokens`| NEW (Agent 217) coding-agent token counters. |
121
+
|`last_reported_input_tokens`| NEW (Agent 217) delta-report bookkeeping. |
122
+
|`last_reported_output_tokens`| NEW (Agent 217) delta-report bookkeeping. |
123
+
|`last_reported_total_tokens`| NEW (Agent 217) delta-report bookkeeping. |
124
+
|`turn_count`| NEW (Agent 214) runner turn count. |
125
+
126
+
### Retry Entry
127
+
128
+
| Symphony field | Colony field/file/MCP tool |
129
+
| --- | --- |
130
+
|`issue_id`|`task_id` / `tasks.id`. |
131
+
|`identifier`|`tasks.branch` or plan `plan_slug` + `subtask_index`; NEW (Agent 208) imported issue identifier parity. |
132
+
|`attempt`| NEW (Agent 215) retry attempt ordinal. |
133
+
|`due_at_ms`| Handoffs/messages/wakes have `expires_at`; NEW (Agent 215) retry due time. |
134
+
|`timer_handle`| NEW (Agent 215) runtime retry handle. |
|`poll_interval_ms`| NEW (Agent 216) orchestrator poll interval state. |
142
+
|`max_concurrent_agents`| NEW (Agent 216) runtime concurrency state. |
143
+
|`running`| Active `sessions`, `task_participants`, `lane_states`, and claimed plan subtasks from `task_plan_claim_subtask`. |
144
+
|`claimed`|`task_claims` table; `task_claim_file`; plan subtask claim observations. |
145
+
|`retry_attempts`| NEW (Agent 215) retry queue/state. |
146
+
|`completed`|`tasks.status`; plan subtask `completed` lifecycle via `task_plan_complete_subtask`. |
147
+
|`codex_totals`| NEW (Agent 217) aggregate coding-agent token/runtime totals; current `mcp_metrics` covers MCP call receipts only. |
148
+
|`codex_rate_limits`| NEW (Agent 217) latest coding-agent rate-limit snapshot. |
149
+
150
+
### Normalization Rules
151
+
152
+
| Symphony rule | Colony alignment |
153
+
| --- | --- |
154
+
| Issue ID is the internal lookup key. | Use `tasks.id` / `task_id` as the Colony-native internal key. For plan work, treat `task_id` as authoritative and `plan_slug` + `subtask_index` as the stable plan-coordinate alias. Do not use titles as IDs. |
155
+
| Issue Identifier is human-readable. | Use `tasks.branch` for current routing, and render plan subtasks as `plan_slug#NN` or `spec/<plan_slug>/sub-<index>` when a compact human identifier is needed. NEW (Agent 208) should add/import a separate issue identifier when external issues arrive. |
156
+
| Workspace Key is sanitized from `issue.identifier` by replacing characters outside `[A-Za-z0-9._-]` with `_`. | Existing Colony work uses branch slugs and repo-relative claim paths. Imported Symphony workspaces should compute the same sanitized key before creating durable workspace/run-attempt rows. This is separate from `tasks.id`. |
157
+
| Normalized Issue State compares lowercased states. | Existing plan lifecycle states are already lower-case literals. Future imported issue states should lowercase before comparing and then map to `tasks.status` or plan subtask lifecycle. |
158
+
| Session ID is `<thread_id>-<turn_id>`. | Current Colony accepts caller-provided `sessions.id`. If Symphony runner metadata is adopted, Agent 213 should either store `<thread_id>-<turn_id>` as `sessions.id` or persist `thread_id` and `turn_id` metadata with a generated `session_id` that preserves this composition. |
0 commit comments