2026-02-19 21:36:06 +00:00
# TODO.md -- go-agentic
2026-02-19 18:28:36 +00:00
2026-02-19 21:36:06 +00:00
## Phase 1: Test Coverage
2026-02-19 18:28:36 +00:00
2026-02-20 00:59:58 +00:00
- [x] Verify all 5 test files pass standalone after split (`go test ./...` )
- [x] Add integration test for full task lifecycle: claim -> process -> complete
- [x] Add edge-case tests for allowance exhaustion mid-task
- [x] Fill coverage gaps: embed, service types, git operations, config YAML/env paths, error store mock
2026-02-20 01:00:13 +00:00
- [x] Target 85%+ coverage achieved: 85.6% (from 70.1%) — `23aa635`
2026-02-19 18:28:36 +00:00
2026-02-19 21:36:06 +00:00
## Phase 2: Allowance Persistence
2026-02-19 18:28:36 +00:00
2026-02-20 07:07:49 +00:00
- [x] MemoryStore is in-memory only -- state lost on restart
2026-02-19 21:36:06 +00:00
- [ ] Add Redis backend for `AllowanceStore` interface (multi-process safe)
2026-02-20 07:07:49 +00:00
- [x] Add SQLite backend for `AllowanceStore` interface (single-node fallback)
- [x] Config already supports YAML -- wire backend selection into config loader
2026-02-19 21:36:06 +00:00
2026-02-20 07:17:09 +00:00
## Phase 3: Multi-Agent Coordination — `646cc02`
2026-02-19 21:36:06 +00:00
2026-02-20 07:16:53 +00:00
### 3.1 Agent Registry
2026-02-19 21:36:06 +00:00
2026-02-20 07:16:53 +00:00
- [x] **Create `registry.go`** — `AgentInfo` struct (ID, Name, Capabilities []string, Status enum, LastHeartbeat, CurrentLoad int, MaxLoad int), `AgentStatus` enum (Available/Busy/Offline)
- [x] ** `AgentRegistry` interface** — `Register(AgentInfo) error` , `Deregister(id string) error` , `Get(id string) (AgentInfo, error)` , `List() []AgentInfo` , `Heartbeat(id string) error` , `Reap(ttl time.Duration) []string` (returns IDs of reaped agents)
- [x] ** `MemoryRegistry` implementation** — `sync.RWMutex` guarded map, `Reap()` marks agents offline if heartbeat older than TTL
- [x] **Tests** — registration, deregistration, heartbeat updates, reap stale agents, concurrent access
2026-02-19 21:36:06 +00:00
2026-02-20 07:16:53 +00:00
### 3.2 Task Router
- [x] **Create `router.go`** — `TaskRouter` interface with `Route(task *Task, agents []AgentInfo) (string, error)` returning agent ID
- [x] ** `DefaultRouter` implementation** — capability matching (task.Labels ⊆ agent.Capabilities), then least-loaded agent (CurrentLoad / MaxLoad ratio), priority weighting (critical tasks skip load balancing)
- [x] ** `ErrNoEligibleAgent` ** sentinel error when no agents match capabilities or all are at capacity
- [x] **Tests** — capability matching, load distribution, critical priority bypass, no eligible agent error, tie-breaking by agent ID (deterministic)
### 3.3 Dispatcher
- [x] **Create `dispatcher.go`** — `Dispatcher` struct wrapping `AgentRegistry` , `TaskRouter` , `AllowanceService` , and `Client`
- [x] ** `Dispatch(ctx, task) (string, error)` ** — Route → allowance check → claim via client → record usage. Returns assigned agent ID
- [x] ** `DispatchLoop(ctx, interval)` ** — polls client.ListTasks(pending) → dispatches each. Respects context cancellation
- [x] **Tests** — full dispatch flow with mock client, allowance rejection path, no-agent-available path, loop cancellation
2026-02-20 07:22:16 +00:00
## Phase 4: CLI Backing Functions — `ef81db7`
2026-02-20 07:16:53 +00:00
Phase 4 provides the data-fetching and formatting functions that `core agent` CLI commands will call. The CLI commands themselves live in `core/cli` .
### 4.1 Status Summary
2026-02-20 07:22:16 +00:00
- [x] **Create `status.go`** — `StatusSummary` struct (Agents []AgentInfo, PendingTasks int, InProgressTasks int, AllowanceRemaining map[string]int64)
- [x] ** `GetStatus(ctx, registry, client, allowanceSvc) (*StatusSummary, error)` ** — aggregates registry.List(), client.ListTasks counts, allowance remaining per agent
- [x] ** `FormatStatus(summary) string` ** — tabular text output for CLI rendering
- [x] **Tests** — with mock registry + nil client, full summary with mock client
2026-02-20 07:16:53 +00:00
### 4.2 Task Submission
2026-02-20 07:22:16 +00:00
- [x] ** `SubmitTask(ctx, client, title, description, labels, priority) (*Task, error)` ** — creates a new task via client (requires new Client.CreateTask method)
- [x] **Add `Client.CreateTask(ctx, task) (*Task, error)`** — POST /api/tasks
- [x] **Tests** — creation with all fields, validation (empty title), httptest mock
2026-02-20 07:16:53 +00:00
### 4.3 Log Streaming
2026-02-20 07:22:16 +00:00
- [x] **Create `logs.go`** — `StreamLogs(ctx, client, taskID, writer) error` — polls task updates and writes progress to io.Writer
- [x] **Tests** — mock client with progress updates, context cancellation
2026-02-19 18:28:36 +00:00
---
## Workflow
1. Virgil in core/go writes tasks here after research
2026-02-19 21:36:06 +00:00
2. This repo's dedicated session picks up tasks in phase order
2026-02-19 18:28:36 +00:00
3. Mark `[x]` when done, note commit hash