Note (v0.1.12+): This document predates the removal of the AI-agent dispatch + 3-gate review pipeline. Sections referencing
agent_runs,review_gates,current_agent_run_id,runOneCycle, the dispatcher, the scheduler, the supervisor event loop, or theagentCLI group no longer reflect the codebase. The rest of the doc — projects, tasks, worktrees, dev-pool, capsules — is still accurate.
SQLite stores dynamic runtime state that should not depend on chat memory or Markdown parsing alone.
Core project registry.
Suggested columns:
id TEXT PRIMARY KEYslug TEXT UNIQUE NOT NULLname TEXT NOT NULLdescription TEXTlocal_repo_root TEXT NOT NULLdefault_branch TEXTbranch_naming_pattern TEXTworktree_root TEXTdev_command TEXTinstall_command TEXTmax_active_dev_servers INTEGER DEFAULT 1created_at TEXT NOT NULLupdated_at TEXT NOT NULL
id TEXT PRIMARY KEYproject_id TEXT NOT NULLkey TEXTtitle TEXT NOT NULLgoal TEXTrefer_link TEXTpriority INTEGER DEFAULT 3branch_name TEXTworkspace_name TEXTworkspace_branch TEXTworkspace_subrepo_branches_json TEXTpreferred_port INTEGERworktree_path TEXTport INTEGERdev_server_state TEXTcontext_vault_root_path TEXTcontext_vault_sources_json TEXTcontext_vault_files_json TEXTcontext_vault_selected_file TEXTcurrent_agent_run_id TEXTlatest_blocker TEXTcreated_at TEXT NOT NULLupdated_at TEXT NOT NULL
Indexes:
idx_tasks_project_id
id TEXT PRIMARY KEYtask_id TEXT NOT NULLkind TEXT NOT NULLrole TEXTstatus TEXT NOT NULLinput_ref TEXToutput_ref TEXTerror_message TEXTstarted_at TEXTfinished_at TEXTcreated_at TEXT NOT NULL
Indexes:
idx_agent_runs_task_ididx_agent_runs_status
id TEXT PRIMARY KEYtask_id TEXT NOT NULLgate_type TEXT NOT NULLstatus TEXT NOT NULLresult TEXTnotes_ref TEXTopened_at TEXTclosed_at TEXT
Unique constraint:
(task_id, gate_type)
id TEXT PRIMARY KEYproject_id TEXT NOT NULLtask_id TEXTport INTEGER NOT NULLpid INTEGERstatus TEXT NOT NULLhealth_url TEXTstarted_at TEXTstopped_at TEXT
Indexes:
idx_dev_servers_project_ididx_dev_servers_status- unique
port
id TEXT PRIMARY KEYtask_id TEXTproject_id TEXTlevel TEXT NOT NULLchannel TEXT NOT NULLtitle TEXT NOT NULLbody TEXTstatus TEXT NOT NULLcreated_at TEXT NOT NULLdelivered_at TEXT
Used for local concurrency safety.
key TEXT PRIMARY KEYowner TEXT NOT NULLexpires_at TEXTcreated_at TEXT NOT NULL
Append-only event log.
id TEXT PRIMARY KEYentity_type TEXT NOT NULLentity_id TEXT NOT NULLevent_type TEXT NOT NULLpayload_json TEXTcreated_at TEXT NOT NULL
Indexes:
idx_events_entityidx_events_typeidx_events_created_at
Child table of tasks that gives one task N nested-repo slots, each with
its own branch / worktree / port / dev_command / dev_server_state.
id TEXT PRIMARY KEYtask_id TEXT NOT NULL REFERENCES tasks(id) ON DELETE CASCADErepo_path TEXT NOT NULL(relative toprojects.local_repo_root, e.g.repos/backend)branch_name TEXTworktree_path TEXTpreferred_port INTEGERdev_command TEXT(override; falls back toprojects.dev_command)dev_server_state TEXTcreated_at TEXT NOT NULLupdated_at TEXT NOT NULLUNIQUE(task_id, repo_path)
Indexes:
idx_task_subrepos_task_id
Related schema change in migration 016:
dev_servers.task_subrepo_id TEXT REFERENCES task_subrepos(id)(nullable; NULL for outer-repo / single-repo dev servers)idx_dev_servers_task_subrepo_id
- keep schema boring and explicit
- prefer append-only events for observability
- avoid premature polymorphic magic
- use SQLite in WAL mode
- migrate with plain SQL files, not heavy ORM-first abstraction