namespace ClaudeDo.Data.Models; public sealed class AppSettingsEntity { public const int SingletonId = 1; public int Id { get; set; } = SingletonId; // Persistent counter backing TaskNumberAllocator: the next task number to hand out. Lives on // the singleton row so allocation is a single atomic UPDATE...RETURNING in the task's own // insert transaction, never a MAX(number)+1 recompute. public int NextTaskNumber { get; set; } = 1; public string DefaultClaudeInstructions { get; set; } = string.Empty; public string DefaultModel { get; set; } = "sonnet"; public int DefaultMaxTurns { get; set; } = 40; public string DefaultPermissionMode { get; set; } = "auto"; // Hard ceiling every resolved max-turns value (task/list/global) is clamped to before a run // starts. Guards against runaway sessions regardless of what a task/list override requests. public int MaxTurnsCeiling { get; set; } = 80; public int MaxParallelExecutions { get; set; } = 1; public string WorktreeStrategy { get; set; } = "sibling"; public string? CentralWorktreeRoot { get; set; } public bool WorktreeAutoCleanupEnabled { get; set; } public int WorktreeAutoCleanupDays { get; set; } = 7; // JSON array of parent folders remembered by the repo-import modal. public string? RepoImportFolders { get; set; } // JSON array of SshWorkspace rows offered as remote quick sessions in Mission Control. public string? SshWorkspaces { get; set; } // JSON array of path prefixes whose sessions are excluded from the weekly report. public string? ReportExcludedPaths { get; set; } // DayOfWeek the standup happens on; default Wednesday. Drives the report's default range. public int StandupWeekday { get; set; } = (int)DayOfWeek.Wednesday; // Max number of open tasks the daily prep ("Prime Claude") may place in MyDay. public int DailyPrepMaxTasks { get; set; } = 5; // JSON array of session skill names applied by default to new tasks. public string? SessionSkills { get; set; } // JSON array of ModelPreset rows (model → effort + max turns). Supplies the global effort and // turn defaults per model; list-/task-level max-turns overrides still win. Null = ship defaults. public string? ModelPresets { get; set; } // Percentage of the 5h/7d Claude usage window at which the autonomous queue pauses. 0 = gate off. public int UsageGateFiveHourPct { get; set; } = 80; public int UsageGateSevenDayPct { get; set; } = 90; // Percentage at which the queue starts throttling parallelism ahead of the hard gate above. // Tracked per bucket, because the 5h and 7d windows fill at very different rates — soft caps // parallelism at 2 slots, hard at 1. 0 = that stage off for that bucket. public int UsageThrottleFiveHourSoftPct { get; set; } = 50; public int UsageThrottleFiveHourHardPct { get; set; } = 65; public int UsageThrottleSevenDaySoftPct { get; set; } = 50; public int UsageThrottleSevenDayHardPct { get; set; } = 65; // Off by default. When on: a task that failed on the Anthropic usage limit gets exactly one // automatic ContinueTask once the 5h window resets, and the gate-blocked queue wakes exactly // at that reset time instead of only on the 30s backstop. public bool AutoContinueOnUsageLimit { get; set; } // Master switch for PowerUse: list-handler runs go unattended (never ask the user) and harvest // new work when a round would otherwise starve. Toggled in Settings → Execution. Off by default, // and on its own it changes nothing — a run is only in PowerUse when the LIST also opted in via // ListConfigEntity.PowerUseAllowed, so leaving this on cannot make an unrelated list's handler // run unattended. Composition lives in InteractiveLaunchSpecService. public bool PowerUseEnabled { get; set; } // Optional local-time window (both `HH:mm`) narrowing when PowerUse applies, checked per phase // at prompt-build time. Both null (the default) = round the clock, byte-identical to the // pre-window behaviour; only one set counts as unset too. End before start wraps over midnight. // Semantics live in PowerUseWindow. public string? PowerUseWindowStart { get; set; } public string? PowerUseWindowEnd { get; set; } // Percentage of the 5h usage window at which a PowerUse handler session is told to hand off // rather than start more work. Stored and displayed here; the consumer is the handoff prompt. public int PowerUseHandoffPct { get; set; } = 95; // Server-side cap on a list-handler run's wait<->merge handoff chain (HandoffRoundTracker). // 4 = two full wait/merge cycles, the long-standing default. Raise it for a run meant to keep // going for hours. It exists to bound runaway handoff loops, so it must stay >= 1. public int ListHandlerMaxHandoffs { get; set; } = 4; // List that receives imported ticket items Claude could not place (import_ticket without a // list). Null = such items are skipped. No FK: a deleted list simply reads as unset at import. public string? TicketFallbackListId { get; set; } }