Add WaitingForChildren to the status tables, document the single parent lifecycle (planning + improvement) and approve-merges-the-whole-unit across the root, Worker, and Data CLAUDE.md files. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5.0 KiB
5.0 KiB
ClaudeDo.Data
Shared data layer: models, repositories, SQLite infrastructure, and git operations.
Models
- TaskEntity — Id, ListId, Title, Description, Status (
Idle|Queued|Running|WaitingForChildren|WaitingForReview|Done|Failed|Cancelled), PlanningPhase (None|Active|Finalized— parent-only), BlockedByTaskId (nullable FK to predecessor in a chain), ScheduledFor, Result, ReviewFeedback (nullable; reviewer's rejection comment, consumed and cleared by the runner on the next re-run), LogPath, timestamps, CommitType, Model / SystemPrompt / AgentPath / MaxTurns (nullable overrides), IsStarred, IsMyDay, Notes, ParentTaskId, PlanningSessionId, PlanningSessionToken, PlanningFinalizedAt, CreatedBy. Legacy valuesManual/Planning/Planned/Draft/Waitingwere retired; existing rows backfill automatically via theRetireLegacyTaskStatusmigration. - ListEntity — Id, Name, WorkingDir, DefaultCommitType, CreatedAt
- ListConfigEntity — ListId (PK, 1:1 with list), Model, SystemPrompt, AgentPath, MaxTurns (all nullable)
- WorktreeEntity — TaskId (PK, 1:1 with task), Path, BranchName, BaseCommit, HeadCommit, DiffStat, State (Active|Merged|Discarded|Kept)
- TaskRunEntity — per-run record (session_id, tokens, turns, result, structured output, exit code, log path)
- PrimeScheduleEntity — Id, Days (
[Flags] PrimeDaysweekday bitmask, stored asdays_of_weekint), TimeOfDay, Enabled, LastRunAt, PromptOverride, CreatedAt. Recurs on the selected weekdays; no date range. - DailyNoteEntity — Id, Date (DateOnly), Text, SortOrder, CreatedAt → table
daily_notes - WeekReportEntity — Id, StartDate/EndDate (DateOnly), Markdown, GeneratedAt → table
week_reports, unique index on (start_date, end_date) - AppSettingsEntity also carries
ReportExcludedPaths(string?, JSON array of excluded path prefixes, columnreport_excluded_paths),StandupWeekday(int DayOfWeek, default Wednesday, columnstandup_weekday), andDailyPrepMaxTasks(int, default 5, columndaily_prep_max_tasks— hard cap on how many open tasks the daily-prep / "Prime Claude" feature may place in MyDay) - SubtaskEntity, AppSettingsEntity, AgentInfo — existing helpers / settings / record for scanned agent files
Repositories
All repositories use EF Core LINQ queries via ClaudeDoDbContext. The atomic Queued -> Running claim lives in the Worker's QueuePicker (uses FromSqlRaw), not here.
- TaskRepository — CRUD, planning helpers (
CreateChildAsync,SetPlanningStartedAsync,DiscardPlanningAsync,UpdateChildAsync),UpdateAgentSettingsAsync(model / system-prompt / agent-path overrides). Status-mutation primitivesMarkRunningAsync/MarkDoneAsync/MarkFailedAsync/FlipAllRunningToFailedAsyncareinternaland called only byTaskStateServicein the worker.CreateChildAsyncproduces children withStatus=Idle, PlanningPhase=None; once their parent'sPlanningPhasebecomesFinalized, the chain coordinator queues them. - ListRepository — CRUD,
GetConfigAsync/SetConfigAsync(upsert) /DeleteConfigAsyncforlist_config - WorktreeRepository — CRUD,
UpdateHeadAsync,SetStateAsync - TaskRunRepository, SubtaskRepository, AppSettingsRepository
- DailyNoteRepository —
ListByDayAsync,ListBetweenAsync,AddAsync,UpdateAsync,DeleteAsync - WeekReportRepository —
GetByRangeAsync,UpsertAsync
Infrastructure
- ClaudeDoDbContext — EF Core DbContext; configured with WAL mode and foreign keys via
UseSqliteoptions - IDbContextFactory — registered in DI; used by singleton consumers (e.g. Worker hosted service)
- Paths — expands
~and%USERPROFILE%, resolves relative paths. App root:~/.todo-app - AppSettings — loads
~/.todo-app/ui.config.json(DbPath, SignalRUrl)
Git
- GitService — async wrapper around git CLI (ProcessStartInfo, no shell). Operations: worktree add/remove, add all, commit (stdin for message), merge ff-only, rev-parse, diff-stat, has-changes, is-git-repo,
PreviewMergeAsync(non-destructive mergeability check viagit merge-tree --write-tree),CountChangedFilesAsync
Schema
Tables: lists, tasks, worktrees, list_config, task_runs, subtasks, app_settings, prime_schedules, daily_notes, week_reports. Managed by EF Core migrations in the Migrations/ folder. The tasks table holds status, planning_phase (default none), and blocked_by_task_id (FK to tasks.id, ON DELETE SET NULL). Migration WeeklyReport added daily_notes, week_reports, and the two new app_settings columns. Migration DailyPrepMaxTasks added the daily_prep_max_tasks column to app_settings (no new tables).
Conventions
- Enum <-> string mapping via EF Core
ValueConverter(configured inIEntityTypeConfiguration<T>) - Entity configurations live in the
Configuration/folder - Primary keys are
init-only strings (GUIDs assigned at creation) - All methods are async with CancellationToken where applicable