20f5f43fb3
- Use acp-go-sdk for all ACP communication in agentctl - Mark agent as completed when Prompt() returns successfully - Update task state to COMPLETED when agent completes - Update task state to FAILED when agent fails and retries exhausted - Enhanced E2E test to verify agent actually creates files - E2E test now validates full flow: task creation -> agent work -> file creation -> task completion
4.4 KiB
4.4 KiB
Kandev Backend - Next Steps
Current State (2026-01-10)
The backend is a unified Go binary (cmd/kandev/main.go) that runs:
- Task Service: Kanban board/column/task management (SQLite persistence)
- Agent Manager: Docker container lifecycle for AI agents
- Orchestrator: Coordinates task execution with agents
Working Features
-
SQLite Persistence
- Database file:
./kandev.db(configurable viaKANDEV_DB_PATH) - Stores boards, columns, and tasks with metadata
- WAL mode enabled for concurrent reads
- Data survives server restarts
- Database file:
-
Augment Agent Integration
- Docker image:
kandev/augment-agent:latest - Uses Auggie CLI with
--print --output-format json - ACP (Agent Communication Protocol) message streaming
- Session ID extraction and storage in task metadata
- Docker image:
-
Session Resumption
- Sessions persist in
~/.augment/sessions/(mounted into containers) - Task metadata stores
auggie_session_id - Follow-up agents can resume with
AUGGIE_SESSION_IDenv var
- Sessions persist in
-
Real-time Streaming
- Container logs parsed for ACP JSON messages
- Events published to in-memory event bus
- WebSocket endpoints available for frontend
Immediate Next Steps
1. Agent Run History
Track all agent executions:
- Add
agent_runstable to SQLite schema - Store task_id, session_id, started_at, completed_at, exit_code
- Link runs to tasks for history viewing
- Store ACP messages for replay
2. Frontend Integration
- Create React/Vue frontend for Kanban board
- WebSocket client for real-time agent progress
- Task detail view with agent history and session resumption
3. Automatic Task Orchestration
- Configure tasks with
agent_typefield - Auto-launch agents when tasks move to specific columns
- Handle agent failures with retry logic
API Reference
Task Management
POST /api/v1/boards - Create board
GET /api/v1/boards - List boards
POST /api/v1/boards/:id/columns - Create column
POST /api/v1/tasks - Create task (requires board_id, column_id, title)
GET /api/v1/tasks/:id - Get task (includes metadata.auggie_session_id)
Agent Management
POST /api/v1/agents/launch - Launch agent
GET /api/v1/agents/:id/status - Get agent status
GET /api/v1/agents/:id/logs - Get agent logs
DELETE /api/v1/agents/:id - Stop agent
Launch Agent Request
{
"task_id": "uuid",
"agent_type": "augment-agent",
"workspace_path": "/path/to/project",
"env": {
"AUGMENT_SESSION_AUTH": "{...session json...}",
"TASK_DESCRIPTION": "Your task here",
"AUGGIE_SESSION_ID": "optional-for-resumption"
}
}
Development Commands
# Build
cd backend && make build
# Run server
./bin/kandev
# Build Docker image
cd dockerfiles/augment-agent && docker build -t kandev/augment-agent:latest .
# Get Augment session auth
cat ~/.augment/session.json
Key Files
| File | Purpose |
|---|---|
cmd/kandev/main.go |
Unified entry point, ACP handlers |
internal/task/repository/interface.go |
Repository interface definition |
internal/task/repository/sqlite.go |
SQLite implementation with schema |
internal/task/repository/memory.go |
In-memory implementation (for testing) |
internal/agent/lifecycle/manager.go |
Container lifecycle, mount templates |
internal/agent/registry/defaults.go |
Agent type definitions |
internal/agent/streaming/reader.go |
ACP message parsing from logs |
dockerfiles/augment-agent/agent.sh |
Container entrypoint script |
dockerfiles/augment-agent/Dockerfile |
Agent Docker image |
Architecture Decisions
- SQLite with WAL mode for simple, file-based persistence
- In-memory event bus instead of NATS for simpler development
- One agent per task constraint (prevents conflicts)
- Session files mounted from host for persistence across container runs
- ACP protocol for structured agent-to-server communication
- Repository interface allows swapping storage backends (SQLite, Memory, PostgreSQL)
Configuration
Environment variables:
KANDEV_DB_PATH- SQLite database file path (default:./kandev.db)KANDEV_LOGGING_LEVEL- Log level: debug, info, warn, error (default: info)KANDEV_CREDENTIALS_FILE- Path to credentials file for agents