Skip to Content
FeaturesData Flow

Data Flow

How Projects, Sprints, Artifacts, Todos, and Loops work together to manage complex workflows in Coqui.

Component Overview

ComponentPurposeScopeStorage
ProjectsOrganize work across sessionsPersistentprojects table
SprintsOrdered work units within a projectPersistentsprints table
ArtifactsVersioned structured outputs (plans, docs, code)Session or persistentartifacts + artifact_versions tables
TodosTask tracking and progress managementSession-scopedtodos table
LoopsAutomated multi-role iteration cyclesSession-linkedloops + loop_iterations + loop_stages tables

All tables reside in a shared SQLite database (WAL mode) managed by SessionStorage.

Data Relationships

Project ├── Sprint 1 (planned → in_progress → review → complete) │ ├── Artifact: plan (draft → review → final) │ │ └── Todos: auto-generated from plan │ │ ├── Todo 1 (pending → in_progress → completed) │ │ ├── Todo 2 │ │ └── Todo 3 │ └── Artifact: loop_output (from loop stage) ├── Sprint 2 │ └── ... └── Loop (harness: plan → coder → reviewer) ├── Iteration 1 │ ├── Stage: plan │ ├── Stage: coder │ └── Stage: reviewer → "NEEDS CHANGES" └── Iteration 2 ├── Stage: plan ├── Stage: coder └── Stage: reviewer → "APPROVED" (loop completes)

Foreign Key Map

FromColumnToCascade
sprintsproject_idprojects.idCASCADE delete
artifactssession_idsessions.id
artifactsproject_idprojects.id
artifactssprint_idsprints.id
todossession_idsessions.idCASCADE delete
todosartifact_idartifacts.idSET NULL on delete
todosparent_idtodos.idCASCADE delete
todossprint_idsprints.id
loopssession_idsessions.id
loop_iterationsloop_idloops.idCASCADE delete
loop_iterationssprint_idsprints.id
loop_stagesiteration_idloop_iterations.idCASCADE delete

Common Workflow Patterns

1. Plan-Implement-Review (Manual)

The most common pattern for structured development:

User → /role plan → "Build a caching layer" Plan agent: artifact_create(type: "plan") ↓ discovery, design, iteration Plan agent: artifact_stage("review") ↓ user approves Plan agent: artifact_stage("final") ↓ PlanTodoGenerator auto-creates todos User → /role coder Coder agent: todo_list() → reads plan todos Coder agent: implements each step, marks todo_complete() User → /role reviewer (or spawn_agent) Reviewer: reads artifacts, checks todos, provides feedback

2. Automated Harness Loop

Fully automated plan-implement-review cycles:

Agent: loop_start(definition: "harness", goal: "Build caching layer") Iteration 1: plan agent → creates implementation plan coder agent → implements the plan reviewer agent → evaluates, responds "NEEDS CHANGES" ↓ (termination not met, continue) Iteration 2: plan agent → reviews feedback, adjusts plan coder agent → makes revisions reviewer agent → responds "APPROVED" ↓ (termination met, loop completes)

3. Project-Scoped Sprint Workflow

For large features spanning multiple sessions:

Plan agent: project_create(title: "Auth System", slug: "auth") Plan agent: sprint_create(project_id, title: "MVP Login") Plan agent: artifact_create(type: "plan", project_id, sprint_id) ↓ iterates on plan Plan agent: artifact_stage("final") → auto-generates todos Coder agent: reads todos, implements, marks complete Coder agent: sprint_transition(id, "review") Reviewer agent: checks acceptance criteria If pass → sprint_transition(id, "complete") If fail → sprint_transition(id, "rejected", notes: "...") ↓ (back to coder on rejection)

Session Propagation

All components share data through session ID propagation. When one agent spawns another, the parent’s session ID flows to the child so all agents in a workflow see the same artifacts, todos, and sprint context.

Spawn MethodSession Propagation
spawn_agentParent’s sessionId → child’s ArtifactToolkit, TodoToolkit, SprintToolkit
loop_startOrchestrator’s sessionIdloops.session_idLoopStageResult.sessionId → stage agent toolkits
start_background_taskParent’s session → new child task session (separate session, but can read parent artifacts)
/role switchSame session throughout

Active Project Context

When a project is active (set via /projects ‹slug› or project_switch), its metadata and sprint roster are injected into the system prompt. This gives all agents ambient awareness of the current project without explicit tool calls.

See PROJECTS.md for details.

Cleanup Lifecycle

ComponentCleanup TriggerBehavior
Session-scoped artifactsSession deletionDeleted with session (non-persistent only)
Persistent artifactsManual deletionSurvive session deletion when project_id is set
TodosSession deletionCASCADE delete; also cleaned on boot for orphaned/stale entries
SprintsProject deletionCASCADE delete
LoopsManual or loop completionLoop records persist; stages cascade with iterations

Further Reading

  • PROJECTS.md — Projects and sprints: creation, lifecycle, and review workflow
  • ARTIFACTS.md — Versioned artifacts: staging, persistence, and plan handoff
  • TODOS.md — Task tracking: auto-generation, bulk operations, and progress
  • LOOPS.md — Automated workflows: definitions, termination, and session context
  • AGENTS.md — Full architecture reference for all systems
Last updated