{"openapi":"3.1.0","info":{"title":"Projects Manager API","version":"1.0.0","description":"Personal software projects with strategies, to-dos, an interactive AI planner and AI agents that work on to-dos. Path param {project} accepts a project id or slug. Authenticate with the API token (full access) or a session cookie from POST /auth/login (per-project roles)."},"servers":[{"url":"/api"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"cookieAuth":{"type":"apiKey","in":"cookie","name":"pm_session"}},"schemas":{"Me":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/User"},"superAdmin":{"type":"boolean","description":"Signed in with API_TOKEN (or no users exist yet)"},"needsSetup":{"type":"boolean","description":"No users exist yet: POST /auth/setup creates the first admin"}},"required":["user","superAdmin","needsSetup"]},"User":{"type":["object","null"],"properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":"string"},"isAdmin":{"type":"boolean"},"disabled":{"type":"boolean"},"aiEnabled":{"type":"boolean","description":"May use AI features (admins always may)"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","email","name","isAdmin","disabled","aiEnabled","createdAt","updatedAt"],"description":"Signed-in user; null when using the API token or before setup"},"Error":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]},"Setup":{"type":"object","properties":{"email":{"type":"string","maxLength":320,"format":"email","example":"ada@example.com"},"name":{"type":"string","minLength":1,"maxLength":200,"example":"Ada Lovelace"},"password":{"type":"string","minLength":8,"maxLength":200}},"required":["email","name","password"]},"Login":{"type":"object","properties":{"email":{"type":"string","maxLength":320,"format":"email","example":"ada@example.com"},"password":{"type":"string","minLength":1,"maxLength":200}},"required":["email","password"]},"MeUpdate":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200,"example":"Ada Lovelace"},"password":{"type":"string","minLength":8,"maxLength":200},"currentPassword":{"type":"string","maxLength":200,"description":"Required when changing the password"}}},"UserDirectoryEntry":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":"string"}},"required":["id","email","name"]},"UserCreate":{"type":"object","properties":{"email":{"type":"string","maxLength":320,"format":"email","example":"ada@example.com"},"name":{"type":"string","minLength":1,"maxLength":200,"example":"Ada Lovelace"},"password":{"type":"string","minLength":8,"maxLength":200},"isAdmin":{"type":"boolean","default":false},"aiEnabled":{"type":"boolean","default":false}},"required":["email","name","password"]},"UserUpdate":{"type":"object","properties":{"email":{"type":"string","maxLength":320,"format":"email","example":"ada@example.com"},"name":{"type":"string","minLength":1,"maxLength":200,"example":"Ada Lovelace"},"password":{"type":"string","minLength":8,"maxLength":200,"description":"Sets a new password and signs the user out everywhere"},"isAdmin":{"type":"boolean"},"disabled":{"type":"boolean"},"aiEnabled":{"type":"boolean"}}},"Member":{"type":"object","properties":{"userId":{"type":"string"},"email":{"type":"string"},"name":{"type":"string"},"role":{"type":"string","enum":["viewer","editor","owner"],"description":"viewer reads; editor changes content; owner also manages members and deletes","example":"editor"},"createdAt":{"type":"string","format":"date-time"}},"required":["userId","email","name","role","createdAt"]},"ProjectListItem":{"allOf":[{"$ref":"#/components/schemas/Project"},{"type":"object","properties":{"counts":{"$ref":"#/components/schemas/ProjectCounts"}}}]},"ProjectCounts":{"type":"object","properties":{"strategies":{"type":"number"},"todosOpen":{"type":"number"},"todosDone":{"type":"number"},"masterPlans":{"type":"number","description":"Non-archived master plans; 0 = the project has no master plan yet"},"todosOverdue":{"type":"number","description":"Open to-dos past their due date"}},"required":["strategies","todosOpen","todosDone","masterPlans","todosOverdue"],"description":"Present when include=counts"},"Project":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["idea","planning","active","paused","completed","archived"],"description":"Project lifecycle status","example":"active"},"type":{"type":"string","enum":["software","game","website","tool","other"],"description":"Kind of project; selects the growth playbooks used by the AI planner","example":"game"},"localDir":{"type":["string","null"]},"externalDir":{"type":["string","null"]},"pinned":{"type":"boolean","description":"Listed first"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","slug","title","description","status","type","localDir","externalDir","pinned","createdAt","updatedAt"]},"ProjectDetail":{"allOf":[{"$ref":"#/components/schemas/Project"},{"type":"object","properties":{"localDirExists":{"type":["boolean","null"],"description":"Whether localDir exists on this machine (null if unset)"},"counts":{"$ref":"#/components/schemas/ProjectCounts"}},"required":["localDirExists","counts"]}]},"ProjectCreate":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200,"example":"Projects Manager"},"slug":{"type":"string","maxLength":120,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$","description":"URL-friendly id; derived from title when omitted","example":"projects-manager"},"description":{"type":["string","null"],"maxLength":20000},"status":{"type":"string","enum":["idea","planning","active","paused","completed","archived"],"default":"idea","description":"Project lifecycle status","example":"active"},"type":{"type":"string","enum":["software","game","website","tool","other"],"default":"other","description":"Kind of project; selects the growth playbooks used by the AI planner","example":"game"},"localDir":{"type":["string","null"],"maxLength":1024,"description":"Local directory path","example":"H:\\g\\web\\ai\\projects-manager"},"externalDir":{"type":["string","null"],"maxLength":1024,"description":"External location (repo URL, network share, cloud folder)","example":"https://github.com/me/projects-manager"},"pinned":{"type":"boolean","description":"Pinned projects are listed first. Changing only this does not bump updatedAt."}},"required":["title"]},"ProjectUpdate":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200,"example":"Projects Manager"},"slug":{"type":"string","maxLength":120,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$","description":"URL-friendly id; derived from title when omitted","example":"projects-manager"},"description":{"type":["string","null"],"maxLength":20000},"status":{"type":"string","enum":["idea","planning","active","paused","completed","archived"],"description":"Project lifecycle status","example":"active"},"type":{"type":"string","enum":["software","game","website","tool","other"],"description":"Kind of project; selects the growth playbooks used by the AI planner","example":"game"},"localDir":{"type":["string","null"],"maxLength":1024,"description":"Local directory path","example":"H:\\g\\web\\ai\\projects-manager"},"externalDir":{"type":["string","null"],"maxLength":1024,"description":"External location (repo URL, network share, cloud folder)","example":"https://github.com/me/projects-manager"},"pinned":{"type":"boolean","description":"Pinned projects are listed first. Changing only this does not bump updatedAt."}}},"SearchHit":{"type":"object","properties":{"type":{"type":"string","enum":["project","strategy","todo"]},"id":{"type":"string"},"projectId":{"type":"string"},"projectSlug":{"type":"string"},"projectTitle":{"type":"string"},"title":{"type":"string"},"snippet":{"type":"string","description":"Text around the first match (empty when only the title matched)"},"archived":{"type":"boolean","description":"Strategy is archived / to-do is done"}},"required":["type","id","projectId","projectSlug","projectTitle","title","snippet","archived"]},"Activity":{"type":"object","properties":{"id":{"type":"string"},"projectId":{"type":"string"},"type":{"type":"string","enum":["todo_done","todo_reopened","todo_status","todo_result","todo_assigned","strategy_created","strategy_updated","decision_applied","agent_completed","plan_applied"]},"summary":{"type":"string"},"refId":{"type":["string","null"],"description":"Id of the to-do, strategy, decision session, agent run or planner session"},"actorId":{"type":["string","null"],"description":"User who made the change (null: API token, MCP or before accounts)"},"actorName":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","projectId","type","summary","refId","actorId","actorName","createdAt"]},"ProjectExport":{"type":"object","properties":{"version":{"type":"number","enum":[1]},"exportedAt":{"type":"string","format":"date-time"},"project":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","maxLength":120},"description":{"type":["string","null"],"maxLength":20000},"status":{"type":"string","enum":["idea","planning","active","paused","completed","archived"],"description":"Project lifecycle status","example":"active"},"type":{"type":"string","enum":["software","game","website","tool","other"],"description":"Kind of project; selects the growth playbooks used by the AI planner","example":"game"},"localDir":{"type":["string","null"],"maxLength":1024},"externalDir":{"type":["string","null"],"maxLength":1024},"pinned":{"type":"boolean","description":"Missing in older exports: not pinned"}},"required":["title","slug","description","status","type","localDir","externalDir"]},"strategies":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"content":{"type":"string","maxLength":1000000},"kind":{"type":"string","enum":["master","review","project","growth","launch","monetization","technical"],"description":"master = the master plan of the project (vision, goals, roadmap); other kinds mirror the AI planner focus","example":"project"},"status":{"type":"string","enum":["draft","active","archived"],"example":"draft"},"enabled":{"type":"boolean"}},"required":["title","content","kind","status","enabled"]}},"todos":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":["string","null"],"maxLength":20000},"priority":{"type":"string","enum":["low","medium","high"],"example":"medium"},"done":{"type":"boolean"},"status":{"type":"string","enum":["idea","backlog","in_progress","in_review","done"],"example":"in_progress","description":"Missing in older exports: derived from done"},"result":{"type":["string","null"],"maxLength":20000},"dueOn":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-12-31","description":"Due date (YYYY-MM-DD)"},"fact":{"type":"boolean","description":"Missing in older exports: a to-do with a result is then a fact"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[\\p{L}\\p{N}][\\p{L}\\p{N}_-]*$","example":"frontend"},"maxItems":12,"example":["frontend","bug"],"description":"Missing in older exports: no tags"},"repeat":{"type":["string","null"],"pattern":"^(daily|weekdays|weekly|monthly|yearly|[1-9]\\d{0,2}[dwm])$","example":"weekly","description":"Missing in older exports: does not repeat"}},"required":["title","notes","priority","done","result","dueOn"]},"default":[]},"todoLists":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"items":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":["string","null"],"maxLength":20000},"priority":{"type":"string","enum":["low","medium","high"],"example":"medium"},"done":{"type":"boolean"},"status":{"type":"string","enum":["idea","backlog","in_progress","in_review","done"],"example":"in_progress","description":"Missing in older exports: derived from done"},"result":{"type":["string","null"],"maxLength":20000},"dueOn":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-12-31","description":"Due date (YYYY-MM-DD)"},"fact":{"type":"boolean","description":"Missing in older exports: a to-do with a result is then a fact"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[\\p{L}\\p{N}][\\p{L}\\p{N}_-]*$","example":"frontend"},"maxItems":12,"example":["frontend","bug"],"description":"Missing in older exports: no tags"},"repeat":{"type":["string","null"],"pattern":"^(daily|weekdays|weekly|monthly|yearly|[1-9]\\d{0,2}[dwm])$","example":"weekly","description":"Missing in older exports: does not repeat"}},"required":["title","notes","priority","done","result","dueOn"]}}},"required":["title","items"]},"description":"Older exports only: named lists; their to-dos are imported in order (titles are dropped)"}},"required":["version","exportedAt","project","strategies"]},"ProjectsExport":{"type":"object","properties":{"version":{"type":"number","enum":[1]},"exportedAt":{"type":"string","format":"date-time"},"projects":{"type":"array","items":{"type":"object","properties":{"project":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","maxLength":120},"description":{"type":["string","null"],"maxLength":20000},"status":{"type":"string","enum":["idea","planning","active","paused","completed","archived"],"description":"Project lifecycle status","example":"active"},"type":{"type":"string","enum":["software","game","website","tool","other"],"description":"Kind of project; selects the growth playbooks used by the AI planner","example":"game"},"localDir":{"type":["string","null"],"maxLength":1024},"externalDir":{"type":["string","null"],"maxLength":1024},"pinned":{"type":"boolean","description":"Missing in older exports: not pinned"}},"required":["title","slug","description","status","type","localDir","externalDir"]},"strategies":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"content":{"type":"string","maxLength":1000000},"kind":{"type":"string","enum":["master","review","project","growth","launch","monetization","technical"],"description":"master = the master plan of the project (vision, goals, roadmap); other kinds mirror the AI planner focus","example":"project"},"status":{"type":"string","enum":["draft","active","archived"],"example":"draft"},"enabled":{"type":"boolean"}},"required":["title","content","kind","status","enabled"]}},"todos":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":["string","null"],"maxLength":20000},"priority":{"type":"string","enum":["low","medium","high"],"example":"medium"},"done":{"type":"boolean"},"status":{"type":"string","enum":["idea","backlog","in_progress","in_review","done"],"example":"in_progress","description":"Missing in older exports: derived from done"},"result":{"type":["string","null"],"maxLength":20000},"dueOn":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-12-31","description":"Due date (YYYY-MM-DD)"},"fact":{"type":"boolean","description":"Missing in older exports: a to-do with a result is then a fact"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[\\p{L}\\p{N}][\\p{L}\\p{N}_-]*$","example":"frontend"},"maxItems":12,"example":["frontend","bug"],"description":"Missing in older exports: no tags"},"repeat":{"type":["string","null"],"pattern":"^(daily|weekdays|weekly|monthly|yearly|[1-9]\\d{0,2}[dwm])$","example":"weekly","description":"Missing in older exports: does not repeat"}},"required":["title","notes","priority","done","result","dueOn"]},"default":[]},"todoLists":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"items":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":["string","null"],"maxLength":20000},"priority":{"type":"string","enum":["low","medium","high"],"example":"medium"},"done":{"type":"boolean"},"status":{"type":"string","enum":["idea","backlog","in_progress","in_review","done"],"example":"in_progress","description":"Missing in older exports: derived from done"},"result":{"type":["string","null"],"maxLength":20000},"dueOn":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-12-31","description":"Due date (YYYY-MM-DD)"},"fact":{"type":"boolean","description":"Missing in older exports: a to-do with a result is then a fact"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[\\p{L}\\p{N}][\\p{L}\\p{N}_-]*$","example":"frontend"},"maxItems":12,"example":["frontend","bug"],"description":"Missing in older exports: no tags"},"repeat":{"type":["string","null"],"pattern":"^(daily|weekdays|weekly|monthly|yearly|[1-9]\\d{0,2}[dwm])$","example":"weekly","description":"Missing in older exports: does not repeat"}},"required":["title","notes","priority","done","result","dueOn"]}}},"required":["title","items"]},"description":"Older exports only: named lists; their to-dos are imported in order (titles are dropped)"}},"required":["project","strategies"]}}},"required":["version","exportedAt","projects"]},"Strategy":{"type":"object","properties":{"id":{"type":"string"},"projectId":{"type":"string"},"title":{"type":"string"},"content":{"type":"string","description":"Markdown"},"kind":{"type":"string","enum":["master","review","project","growth","launch","monetization","technical"],"description":"master = the master plan of the project (vision, goals, roadmap); other kinds mirror the AI planner focus","example":"project"},"status":{"type":"string","enum":["draft","active","archived"],"example":"draft"},"enabled":{"type":"boolean","description":"Disabled strategies are left out of the AI planner and agent context"},"position":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","projectId","title","content","kind","status","enabled","position","createdAt","updatedAt"]},"StrategyCreate":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"content":{"type":"string","maxLength":1000000,"default":""},"kind":{"type":"string","enum":["master","review","project","growth","launch","monetization","technical"],"default":"project","description":"master = the master plan of the project (vision, goals, roadmap); other kinds mirror the AI planner focus","example":"project"},"status":{"type":"string","enum":["draft","active","archived"],"default":"draft","example":"draft"},"enabled":{"type":"boolean","default":true}},"required":["title"]},"StrategyUpdate":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"content":{"type":"string","maxLength":1000000},"kind":{"type":"string","enum":["master","review","project","growth","launch","monetization","technical"],"description":"master = the master plan of the project (vision, goals, roadmap); other kinds mirror the AI planner focus","example":"project"},"status":{"type":"string","enum":["draft","active","archived"],"example":"draft"},"enabled":{"type":"boolean"},"position":{"type":"integer","minimum":0}}},"Todo":{"type":"object","properties":{"id":{"type":"string"},"projectId":{"type":"string"},"title":{"type":"string"},"notes":{"type":["string","null"]},"done":{"type":"boolean"},"status":{"type":"string","enum":["idea","backlog","in_progress","in_review","done"],"example":"in_progress","description":"Kanban stage; \"done\" means the to-do is done (done = status === \"done\")"},"priority":{"type":"string","enum":["low","medium","high"],"example":"medium"},"position":{"type":"integer"},"skippedAt":{"type":["string","null"],"format":"date-time","description":"Set while the to-do is snoozed (skipped in work-off mode)"},"result":{"type":["string","null"],"description":"The answer/outcome recorded for this to-do (markdown)"},"resultAt":{"type":["string","null"],"format":"date-time","description":"When the result was last saved"},"dueOn":{"type":["string","null"],"example":"2026-12-31","description":"Due date (YYYY-MM-DD)"},"fact":{"type":"boolean","description":"Saved as a project fact (its result, or notes, is given to the AI as known)"},"tags":{"type":"array","items":{"type":"string"},"example":["frontend"],"description":"Tags ([] when none)"},"repeat":{"type":["string","null"],"example":"weekly","description":"Repeat rule; done creates the next to-do (null = does not repeat)"},"assigneeId":{"type":["string","null"],"description":"User id of the project member the to-do is assigned to (null = unassigned)"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","projectId","title","notes","done","status","priority","position","skippedAt","result","resultAt","dueOn","fact","tags","repeat","assigneeId","createdAt","updatedAt"]},"TodoCreate":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":["string","null"],"maxLength":20000},"priority":{"type":"string","enum":["low","medium","high"],"default":"medium","example":"medium"},"done":{"type":"boolean","default":false},"status":{"type":"string","enum":["idea","backlog","in_progress","in_review","done"],"example":"in_progress","description":"Kanban stage; defaults to \"done\" when done is true, else \"backlog\". Wins over done."},"dueOn":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-12-31","description":"Due date (YYYY-MM-DD)"},"fact":{"type":"boolean","default":false},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[\\p{L}\\p{N}][\\p{L}\\p{N}_-]*$","example":"frontend"},"maxItems":12,"default":[],"example":["frontend","bug"],"description":"Up to 12 tags (lowercased, de-duplicated)"},"repeat":{"type":["string","null"],"pattern":"^(daily|weekdays|weekly|monthly|yearly|[1-9]\\d{0,2}[dwm])$","example":"weekly","description":"Repeat rule: daily, weekdays, weekly, monthly, yearly, or every n days/weeks/months (\"3d\", \"2w\", \"6m\"). Marking the to-do done creates the next one."},"assigneeId":{"type":["string","null"],"description":"Assign to this project member (user id)"}},"required":["title"]},"TodoReorder":{"type":"object","properties":{"todoIds":{"type":"array","items":{"type":"string"},"description":"All to-do ids of the project, in the new order"}},"required":["todoIds"]},"TodoQueue":{"type":"object","properties":{"next":{"allOf":[{"$ref":"#/components/schemas/Todo"},{"type":["object","null"],"description":"The open, non-snoozed to-do to work on next"}]},"remaining":{"type":"integer","description":"Open, non-snoozed to-dos (including next)"},"skipped":{"type":"array","items":{"$ref":"#/components/schemas/Todo"},"description":"Snoozed open to-dos, oldest snooze first"}},"required":["next","remaining","skipped"]},"ProjectFact":{"type":"object","properties":{"todoId":{"type":"string"},"title":{"type":"string","description":"Title of the to-do the fact was recorded on"},"result":{"type":"string","description":"The recorded result, or the notes when there is none"},"resultAt":{"type":["string","null"],"format":"date-time"},"done":{"type":"boolean"}},"required":["todoId","title","result","resultAt","done"]},"TodoBackup":{"type":["object","null"],"properties":{"id":{"type":"string"},"projectId":{"type":"string"},"reason":{"type":"string","example":"Before AI plan (replace)"},"items":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"notes":{"type":["string","null"]},"priority":{"type":"string","enum":["low","medium","high"],"example":"medium"},"done":{"type":"boolean"},"status":{"type":"string","enum":["idea","backlog","in_progress","in_review","done"],"example":"in_progress","description":"Kanban stage; \"done\" means the to-do is done (done = status === \"done\")"},"result":{"type":["string","null"]},"dueOn":{"type":["string","null"]},"fact":{"type":"boolean"},"tags":{"type":"array","items":{"type":"string"}},"repeat":{"type":["string","null"]}},"required":["title","notes","priority","done","result","dueOn"]}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","projectId","reason","items","createdAt"]},"Agenda":{"type":"object","properties":{"today":{"type":"string","example":"2026-11-03","description":"Server date the agenda was computed for"},"items":{"type":"array","items":{"$ref":"#/components/schemas/AgendaItem"},"description":"Open to-dos of non-archived projects, earliest due date first, then priority"}},"required":["today","items"]},"AgendaItem":{"allOf":[{"$ref":"#/components/schemas/Todo"},{"type":"object","properties":{"projectSlug":{"type":"string"},"projectTitle":{"type":"string"}},"required":["projectSlug","projectTitle"]}]},"TodoBulkResult":{"type":"object","properties":{"updated":{"type":"array","items":{"$ref":"#/components/schemas/Todo"}},"deleted":{"type":"integer"}},"required":["updated","deleted"]},"TodoBulk":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":500},"patch":{"$ref":"#/components/schemas/TodoUpdate"},"delete":{"type":"boolean","description":"Delete the to-dos instead of updating them"}},"required":["ids"]},"TodoUpdate":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":["string","null"],"maxLength":20000},"priority":{"type":"string","enum":["low","medium","high"],"example":"medium"},"done":{"type":"boolean","description":"true sets status \"done\"; false reopens a done to-do into \"backlog\" (other statuses stay)"},"status":{"type":"string","enum":["idea","backlog","in_progress","in_review","done"],"example":"in_progress","description":"Kanban stage; \"done\" marks it done. Wins over done if both are given."},"skipped":{"type":"boolean","description":"Snooze (true) or un-snooze (false). Snoozed to-dos are left out of the work-off queue; marking done clears it."},"result":{"type":["string","null"],"maxLength":20000,"description":"Record the answer/outcome of the to-do; blank or null clears it"},"dueOn":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-12-31","description":"Due date (YYYY-MM-DD); null clears it"},"fact":{"type":"boolean","description":"Save as a project fact (true) or not (false). Recording a first result saves it as a fact unless false is given."},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[\\p{L}\\p{N}][\\p{L}\\p{N}_-]*$","example":"frontend"},"maxItems":12,"example":["frontend","bug"],"description":"Replaces all tags ([] clears them)"},"repeat":{"type":["string","null"],"pattern":"^(daily|weekdays|weekly|monthly|yearly|[1-9]\\d{0,2}[dwm])$","example":"weekly","description":"Repeat rule; null stops repeating"},"assigneeId":{"type":["string","null"],"description":"Assign to this project member (user id); null unassigns"}},"description":"Applied to every to-do (same fields as PATCH /todos/{id})"},"AiProviders":{"type":"object","properties":{"default":{"type":"string","enum":["ollama","openai","anthropic","openai-compatible"],"example":"anthropic"},"providers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["ollama","openai","anthropic","openai-compatible"],"example":"anthropic"},"available":{"type":"boolean"},"reason":{"type":"string"},"defaultModel":{"type":"string"},"models":{"type":"array","items":{"type":"string"}},"refreshedAt":{"type":"string","description":"When the model list was last fetched from the provider"},"refreshError":{"type":"string","description":"Why the last refresh of this provider failed"}},"required":["id","available","defaultModel","models"]}}},"required":["default","providers"]},"AiSettingsUpdate":{"type":"object","properties":{"defaultProvider":{"type":["string","null"],"enum":["ollama","openai","anthropic","openai-compatible",null],"example":"anthropic","description":"Provider used when a session names none; null resets to the server config"},"models":{"type":"object","properties":{"ollama":{"type":["string","null"],"maxLength":200},"openai":{"type":["string","null"],"maxLength":200},"anthropic":{"type":["string","null"],"maxLength":200},"openai-compatible":{"type":["string","null"],"maxLength":200}},"description":"Default model per provider; null resets to the server config"}}},"AiSessionDetail":{"allOf":[{"$ref":"#/components/schemas/AiSession"},{"type":"object","properties":{"messages":{"type":"array","items":{"$ref":"#/components/schemas/AiMessage"}}},"required":["messages"]}]},"AiMessage":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string","enum":["user","assistant"]},"content":{"type":"string"},"turn":{"$ref":"#/components/schemas/AiTurn"},"createdAt":{"type":"string"}},"required":["id","role","content","createdAt"]},"AiTurn":{"type":"object","properties":{"message":{"type":"string"},"questions":{"type":"array","items":{"$ref":"#/components/schemas/AiQuestion"}},"proposal":{"$ref":"#/components/schemas/AiProposal"}},"required":["message"]},"AiQuestion":{"type":"object","properties":{"id":{"type":"string"},"question":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"multiSelect":{"type":"boolean"}},"required":["id","question","options","multiSelect"]},"AiProposal":{"type":"object","properties":{"strategy":{"type":"object","properties":{"title":{"type":"string"},"content":{"type":"string"}},"required":["title","content"]},"todos":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"notes":{"type":"string"},"priority":{"type":"string","enum":["low","medium","high"],"example":"medium"}},"required":["title","priority"]}}}},"AiSession":{"type":"object","properties":{"id":{"type":"string"},"projectId":{"type":"string"},"goal":{"type":"string"},"target":{"type":"string","enum":["strategy","todos","both"]},"focus":{"type":"string","enum":["master","review","project","growth","launch","monetization","technical"],"description":"master: master plan via an extensive interview (vision, goals, roadmap); review: progress review & next steps; project: milestone/feature plan; growth: growth & business (playbooks by project type and stage); launch: release plan; monetization: business model & pricing; technical: architecture & tech debt"},"provider":{"type":"string","enum":["ollama","openai","anthropic","openai-compatible"],"example":"anthropic"},"model":{"type":"string"},"includeDirContext":{"type":"boolean"},"status":{"type":"string","enum":["open","applied","discarded"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","projectId","goal","target","focus","provider","model","includeDirContext","status","createdAt","updatedAt"]},"AiSessionCreate":{"type":"object","properties":{"goal":{"type":"string","maxLength":5000,"description":"What to plan; defaults to a goal derived from the focus","example":"plan the MVP launch"},"target":{"type":"string","enum":["strategy","todos","both"],"default":"both"},"focus":{"type":"string","enum":["master","review","project","growth","launch","monetization","technical"],"default":"project","description":"master: master plan via an extensive interview (vision, goals, roadmap); review: progress review & next steps; project: milestone/feature plan; growth: growth & business (playbooks by project type and stage); launch: release plan; monetization: business model & pricing; technical: architecture & tech debt"},"provider":{"type":"string","enum":["ollama","openai","anthropic","openai-compatible"],"example":"anthropic"},"model":{"type":"string","maxLength":200},"includeDirContext":{"type":"boolean","default":false,"description":"Send README, file tree and manifests of localDir to the LLM"}}},"AiReply":{"type":"object","properties":{"content":{"type":"string","maxLength":20000},"answers":{"type":"array","items":{"type":"object","properties":{"questionId":{"type":"string"},"selected":{"type":"array","items":{"type":"string"}},"other":{"type":"string","maxLength":5000}},"required":["questionId","selected"]}}}},"AiApplyResult":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/AiSession"},"strategies":{"type":"array","items":{"$ref":"#/components/schemas/Strategy"}},"todos":{"type":"array","items":{"$ref":"#/components/schemas/Todo"}}},"required":["session","strategies","todos"]},"AiApply":{"type":"object","properties":{"mode":{"type":"string","enum":["append","replace"]}},"required":["mode"]},"AgentRunDetail":{"allOf":[{"$ref":"#/components/schemas/AgentRun"},{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/AgentEvent"}}},"required":["events"]}]},"AgentEvent":{"type":"object","properties":{"seq":{"type":"integer"},"type":{"type":"string","enum":["system","user","assistant","tool_use","tool_result","permission","permission_result","result","error"]},"payload":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string","format":"date-time"}},"required":["seq","type","payload","createdAt"]},"AgentRun":{"type":"object","properties":{"id":{"type":"string"},"todoId":{"type":"string"},"projectId":{"type":"string"},"status":{"type":"string","enum":["running","waiting","idle","done","failed","stopped"]},"live":{"type":"boolean","description":"The agent process is running in this server (false after stop or a restart)"},"interrupted":{"type":"boolean","description":"The run was active when the server stopped; send a message to resume it"},"cwd":{"type":"string"},"baseCommit":{"type":["string","null"],"description":"git HEAD of cwd when the run started (null outside a git repository)"},"costUsd":{"type":["number","null"],"description":"Estimated cost so far (USD), from the latest result"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","todoId","projectId","status","live","interrupted","cwd","baseCommit","costUsd","createdAt","updatedAt"]},"AgentRunSummary":{"allOf":[{"$ref":"#/components/schemas/AgentRun"},{"type":"object","properties":{"todoTitle":{"type":"string"},"projectSlug":{"type":"string"},"projectTitle":{"type":"string"}},"required":["todoTitle","projectSlug","projectTitle"]}]},"AgentRunDiff":{"type":"object","properties":{"baseCommit":{"type":["string","null"]},"diff":{"type":"string","description":"Unified diff of tracked files against baseCommit"},"untracked":{"type":"array","items":{"type":"string"},"description":"Untracked files (paths relative to cwd)"},"truncated":{"type":"boolean"},"note":{"type":"string"}},"required":["baseCommit","diff","untracked","truncated","note"]},"AgentMessage":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":50000}},"required":["content"]},"AgentPermission":{"type":"object","properties":{"allow":{"type":"boolean"},"always":{"type":"boolean","description":"Allow this kind of tool call for the rest of the session"},"message":{"type":"string","maxLength":5000,"description":"Why it was denied / what to do instead"}},"required":["allow"]},"DecisionSessionDetail":{"allOf":[{"$ref":"#/components/schemas/DecisionSession"},{"type":"object","properties":{"messages":{"type":"array","items":{"$ref":"#/components/schemas/DecisionMessage"}}},"required":["messages"]}]},"DecisionMessage":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string","enum":["user","assistant"]},"content":{"type":"string"},"turn":{"$ref":"#/components/schemas/DecisionTurn"},"createdAt":{"type":"string"}},"required":["id","role","content","createdAt"]},"DecisionTurn":{"type":"object","properties":{"message":{"type":"string"},"questions":{"type":"array","items":{"$ref":"#/components/schemas/AiQuestion"}},"proposal":{"$ref":"#/components/schemas/DecisionProposal"}},"required":["message"]},"DecisionProposal":{"type":"object","properties":{"decision":{"type":"string","description":"The decision in 1-3 sentences"},"strategyId":{"type":["string","null"],"description":"Strategy to record it in; null = create a new one"},"newStrategy":{"type":"object","properties":{"title":{"type":"string"},"kind":{"type":"string","enum":["master","review","project","growth","launch","monetization","technical"],"description":"master = the master plan of the project (vision, goals, roadmap); other kinds mirror the AI planner focus","example":"project"}},"required":["title","kind"],"description":"Title and kind of the new strategy (when strategyId is null)"},"section":{"type":"object","properties":{"heading":{"type":"string","description":"Section heading (without #); an existing section with this heading is replaced"},"content":{"type":"string","description":"Markdown body of the section"}},"required":["heading","content"]}},"required":["decision","strategyId","section"]},"DecisionSession":{"type":"object","properties":{"id":{"type":"string"},"todoId":{"type":"string"},"projectId":{"type":"string"},"provider":{"type":"string","enum":["ollama","openai","anthropic","openai-compatible"],"example":"anthropic"},"model":{"type":"string"},"status":{"type":"string","enum":["open","applied","discarded"]},"strategyId":{"type":["string","null"],"description":"Strategy the decision was applied to"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","todoId","projectId","provider","model","status","strategyId","createdAt","updatedAt"]},"DecisionApplyResult":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/DecisionSession"},"strategy":{"$ref":"#/components/schemas/Strategy"},"todo":{"$ref":"#/components/schemas/Todo"}},"required":["session","strategy","todo"]},"DecisionApply":{"type":"object","properties":{"strategyId":{"type":["string","null"],"description":"Override the proposed target strategy (null = create a new one)"},"markDone":{"type":"boolean","default":true,"description":"Also mark the to-do done"}}},"BackupList":{"type":"object","properties":{"dir":{"type":"string","description":"Folder the backups are stored in (BACKUP_DIR)"},"intervalHours":{"type":"number","description":"Scheduled backup interval (BACKUP_INTERVAL_HOURS); 0 = off"},"keep":{"type":"integer","description":"Scheduled backups kept (BACKUP_KEEP); manual ones are never pruned"},"backups":{"type":"array","items":{"$ref":"#/components/schemas/BackupEntry"}}},"required":["dir","intervalHours","keep","backups"]},"BackupEntry":{"type":"object","properties":{"name":{"type":"string"},"size":{"type":"integer","description":"Bytes (gzip-compressed JSON)"},"createdAt":{"type":"string","format":"date-time"},"reason":{"type":"string","enum":["manual","scheduled","pre-restore"]}},"required":["name","size","createdAt","reason"]},"RestoreResult":{"type":"object","properties":{"restoredAt":{"type":"string","format":"date-time"},"counts":{"type":"object","additionalProperties":{"type":"integer"},"description":"Restored rows per table"},"safetyBackup":{"type":"string","description":"Backup of the data as it was before the restore"}},"required":["restoredAt","counts","safetyBackup"]}},"parameters":{}},"paths":{"/auth/me":{"get":{"tags":["Auth"],"summary":"Who is signed in (works without signing in)","responses":{"200":{"description":"Current actor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"}}}}}},"patch":{"tags":["Auth"],"summary":"Change your own name or password","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"requestBody":{"description":"Changes","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeUpdate"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/setup":{"post":{"tags":["Auth"],"summary":"Create the first admin account (only while no accounts exist; needs the API token if one is set). The admin becomes owner of all existing projects.","requestBody":{"description":"First admin","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Setup"}}}},"responses":{"201":{"description":"Created and signed in","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/login":{"post":{"tags":["Auth"],"summary":"Sign in (sets the session cookie)","requestBody":{"description":"Credentials","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Login"}}}},"responses":{"200":{"description":"Signed in","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/logout":{"post":{"tags":["Auth"],"summary":"Sign out (ends this session)","responses":{"200":{"description":"Signed out","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}}}}}}},"/users":{"get":{"tags":["Users"],"summary":"List user accounts (admin)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"responses":{"200":{"description":"Users","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/User"}}}}},"403":{"description":"Not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Users"],"summary":"Create a user account (admin)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"requestBody":{"description":"New user","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/users/directory":{"get":{"tags":["Users"],"summary":"Active users to add as project members (id, name, email)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"responses":{"200":{"description":"Users","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserDirectoryEntry"}}}}}}}},"/users/{id}":{"patch":{"tags":["Users"],"summary":"Update a user: name, email, admin, disabled, password reset (admin)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"description":"Fields to change","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserUpdate"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Users"],"summary":"Delete a user account (admin)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"403":{"description":"Not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/members":{"get":{"tags":["Members"],"summary":"Members of a project and their roles","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"responses":{"200":{"description":"Members","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Member"}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/members/{userId}":{"put":{"tags":["Members"],"summary":"Add a member or change their role (owner)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"userId","in":"path"}],"requestBody":{"description":"Role","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["viewer","editor","owner"],"description":"viewer reads; editor changes content; owner also manages members and deletes","example":"editor"}},"required":["role"]}}}},"responses":{"200":{"description":"Members","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Member"}}}}},"403":{"description":"Not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Members"],"summary":"Remove a member (owner; anyone may leave a project)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"userId","in":"path"}],"responses":{"200":{"description":"Members","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Member"}}}}},"403":{"description":"Not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/health":{"get":{"tags":["System"],"summary":"Service health and active database","responses":{"200":{"description":"Healthy","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"database":{"type":"string","enum":["postgres","mysql"]}},"required":["ok","database"]}}}}}}},"/stats":{"get":{"tags":["System"],"summary":"Project counts by status","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"responses":{"200":{"description":"Stats","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"number"},"byStatus":{"type":"object","properties":{"idea":{"type":"number"},"planning":{"type":"number"},"active":{"type":"number"},"paused":{"type":"number"},"completed":{"type":"number"},"archived":{"type":"number"}}}},"required":["total","byStatus"]}}}}}}},"/projects":{"get":{"tags":["Projects"],"summary":"List projects (pinned first, then newest updated)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["idea","planning","active","paused","completed","archived"],"description":"Project lifecycle status","example":"active"},"required":false,"description":"Project lifecycle status","name":"status","in":"query"},{"schema":{"type":"string","enum":["software","game","website","tool","other"],"description":"Kind of project; selects the growth playbooks used by the AI planner","example":"game"},"required":false,"description":"Kind of project; selects the growth playbooks used by the AI planner","name":"type","in":"query"},{"schema":{"type":"string","maxLength":200,"description":"Search in title, slug and description"},"required":false,"description":"Search in title, slug and description","name":"q","in":"query"},{"schema":{"type":"string","enum":["counts"],"description":"Add strategy/to-do counts to each project"},"required":false,"description":"Add strategy/to-do counts to each project","name":"include","in":"query"}],"responses":{"200":{"description":"Projects","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ProjectListItem"}}}}}}},"post":{"tags":["Projects"],"summary":"Create a project","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"requestBody":{"description":"New project","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}":{"get":{"tags":["Projects"],"summary":"Get project info","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"responses":{"200":{"description":"Project (myRole: your access)","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ProjectDetail"},{"type":"object","properties":{"myRole":{"type":"string","enum":["viewer","editor","owner"],"description":"viewer reads; editor changes content; owner also manages members and deletes","example":"editor"}},"required":["myRole"]}]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["Projects"],"summary":"Update a project (partial)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"requestBody":{"description":"Fields to change","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectUpdate"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Projects"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Delete a project (cascades to strategies, to-dos and AI sessions)","parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"responses":{"200":{"description":"Deleted project","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/status":{"get":{"tags":["Projects"],"summary":"Get project status","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"responses":{"200":{"description":"Status","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string","enum":["idea","planning","active","paused","completed","archived"],"description":"Project lifecycle status","example":"active"},"updatedAt":{"type":"string"}},"required":["id","slug","status","updatedAt"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/search":{"get":{"tags":["System"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Search projects, strategies and to-dos (title, description, content, notes, results, tags)","parameters":[{"schema":{"type":"string","minLength":2,"maxLength":200,"example":"pricing"},"required":true,"name":"q","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Maximum hits per type"},"required":false,"description":"Maximum hits per type","name":"limit","in":"query"}],"responses":{"200":{"description":"Hits, grouped by type","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SearchHit"}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/activity":{"get":{"tags":["Projects"],"summary":"Recent activity of a project (newest first)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":500,"default":50},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Activity","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Activity"}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/export":{"get":{"tags":["Projects"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Export a project with its strategies and to-dos (JSON; /export.md for Markdown)","parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"responses":{"200":{"description":"Export","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectExport"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/import":{"post":{"tags":["Projects"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Create a new project from an export (slug kept when free, otherwise derived from the title)","requestBody":{"description":"Export document","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectExport"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/duplicate":{"post":{"tags":["Projects"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Copy a project with its strategies and to-dos into a new project (new slug, not pinned)","parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/export/projects":{"get":{"tags":["Projects"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Export every project you can see, with strategies and to-dos, as one document","responses":{"200":{"description":"Export","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectsExport"}}}}}}},"/import/projects":{"post":{"tags":["Projects"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Create a new project for each project in a multi-project export","requestBody":{"description":"Multi-project export document","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectsExport"}}}},"responses":{"201":{"description":"Created projects","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Project"}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/strategies":{"get":{"tags":["Strategies"],"summary":"List strategies of a project","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"},{"schema":{"type":"string","enum":["draft","active","archived"],"example":"draft"},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"Strategies","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Strategy"}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Strategies"],"summary":"Create a strategy","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"requestBody":{"description":"New strategy","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StrategyCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Strategy"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/master-plan":{"get":{"tags":["Strategies"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"The master plan of the project (newest non-archived strategy of kind \"master\"; null if there is none)","parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"responses":{"200":{"description":"Master plan or null","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Strategy"},{"type":["object","null"]}]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/strategies/{id}":{"get":{"tags":["Strategies"],"summary":"Get a strategy","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Strategy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Strategy"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["Strategies"],"summary":"Update a strategy","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"description":"Fields to change","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StrategyUpdate"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Strategy"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Strategies"],"summary":"Delete a strategy","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Strategy"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/todos":{"get":{"tags":["To-dos"],"summary":"List the project's to-dos (in list order)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"},{"schema":{"type":"string","enum":["true","false"],"description":"Default true"},"required":false,"description":"Default true","name":"includeDone","in":"query"}],"responses":{"200":{"description":"To-dos","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Todo"}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["To-dos"],"summary":"Add a to-do (appended)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"requestBody":{"description":"New to-do","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TodoCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Todo"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/todos/reorder":{"post":{"tags":["To-dos"],"summary":"Set the order of all to-dos of a project","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"requestBody":{"description":"New order","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TodoReorder"}}}},"responses":{"200":{"description":"Reordered to-dos","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Todo"}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/todos/queue":{"get":{"tags":["To-dos"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Work-off queue: the next open to-do by priority (then list order), plus snoozed to-dos","parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"responses":{"200":{"description":"Queue","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TodoQueue"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/facts":{"get":{"tags":["To-dos"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Project facts: the results recorded on the to-dos of the project, in list order","parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"responses":{"200":{"description":"Facts","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ProjectFact"}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/todo-backup":{"get":{"tags":["To-dos"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"The newest to-do backup (taken before an AI plan replaced the to-dos), or null","parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"responses":{"200":{"description":"Backup or null","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TodoBackup"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/todo-backup/restore":{"post":{"tags":["To-dos"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Re-create the to-dos of the newest backup (appended to the current ones); the backup is then removed","parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"responses":{"200":{"description":"All to-dos after the restore","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Todo"}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/todos/agenda":{"get":{"tags":["To-dos"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Open to-dos due soon or overdue, across all projects (for the Today view)","parameters":[{"schema":{"type":["integer","null"],"minimum":0,"maximum":366,"default":7,"description":"Include to-dos due up to this many days from today (overdue ones are always included)"},"required":false,"description":"Include to-dos due up to this many days from today (overdue ones are always included)","name":"days","in":"query"}],"responses":{"200":{"description":"Agenda","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Agenda"}}}}}}},"/todos/bulk":{"post":{"tags":["To-dos"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Update (same fields as PATCH /todos/{id}) or delete many to-dos at once","requestBody":{"description":"Ids and the change","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TodoBulk"}}}},"responses":{"200":{"description":"Result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TodoBulkResult"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/todos/{id}":{"patch":{"tags":["To-dos"],"summary":"Update a to-do (or move it to another list)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"description":"Fields to change","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TodoUpdate"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Todo"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["To-dos"],"summary":"Delete a to-do","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Todo"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/ai/providers":{"get":{"tags":["AI planner"],"summary":"Configured LLM providers and models","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"responses":{"200":{"description":"Providers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiProviders"}}}}}}},"/ai/providers/refresh":{"post":{"tags":["AI planner"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Fetch current text models from each configured provider (cached for GET /ai/providers)","responses":{"200":{"description":"Providers with refreshed models","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiProviders"}}}}}}},"/ai/settings":{"put":{"tags":["AI planner"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Save the default provider and per-provider default models (null resets to server config)","requestBody":{"description":"Settings","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSettingsUpdate"}}}},"responses":{"200":{"description":"Providers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiProviders"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/ai/sessions":{"post":{"tags":["AI planner"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Start a planning session (returns the first assistant turn)","parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"requestBody":{"description":"Session options","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSessionCreate"}}}},"responses":{"201":{"description":"Session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSessionDetail"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"LLM provider error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["AI planner"],"summary":"List planning sessions (newest first)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Project id or slug","example":"projects-manager"},"required":true,"description":"Project id or slug","name":"project","in":"path"}],"responses":{"200":{"description":"Sessions","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AiSession"}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/ai/sessions/{id}":{"get":{"tags":["AI planner"],"summary":"Get a session with its messages","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSessionDetail"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["AI planner"],"summary":"Delete a session","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSession"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/ai/sessions/{id}/messages":{"post":{"tags":["AI planner"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Answer questions and/or give feedback (returns the next assistant turn)","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"description":"Answers and/or feedback","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiReply"}}}},"responses":{"200":{"description":"Session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSessionDetail"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"LLM provider error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/ai/sessions/{id}/apply":{"post":{"tags":["AI planner"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Apply the latest proposal to the project (append or replace)","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"description":"Apply mode","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiApply"}}}},"responses":{"200":{"description":"Created items","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiApplyResult"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/ai/sessions/{id}/discard":{"post":{"tags":["AI planner"],"summary":"Discard a session","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Discarded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSession"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/todos/{id}/agent-runs":{"post":{"tags":["AI agent"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Start a Claude Code agent on a to-do (runs in the project's local directory)","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"201":{"description":"Run","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunDetail"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["AI agent"],"summary":"Agent runs of a to-do (newest first)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Runs","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AgentRun"}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agent-runs/recent":{"get":{"tags":["AI agent"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Live agent runs and recently updated ones, across projects (newest first)","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":1440,"default":30,"description":"Also include runs updated within this many minutes (live runs are always included)"},"required":false,"description":"Also include runs updated within this many minutes (live runs are always included)","name":"minutes","in":"query"}],"responses":{"200":{"description":"Runs","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AgentRunSummary"}}}}}}}},"/agent-runs/{id}":{"get":{"tags":["AI agent"],"summary":"Get an agent run with its transcript","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Run","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunDetail"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agent-runs/{id}/diff":{"get":{"tags":["AI agent"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"What the run changed: git diff of its directory against the commit it started from","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Diff","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunDiff"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agent-runs/{id}/messages":{"post":{"tags":["AI agent"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Send a message to the agent (resumes a stopped run)","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"description":"Message","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentMessage"}}}},"responses":{"200":{"description":"Run","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunDetail"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agent-runs/{id}/permissions/{requestId}":{"post":{"tags":["AI agent"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Allow or deny a pending tool call","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"requestId","in":"path"}],"requestBody":{"description":"Answer","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentPermission"}}}},"responses":{"200":{"description":"Run","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunDetail"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agent-runs/{id}/stop":{"post":{"tags":["AI agent"],"summary":"Stop the agent (a message resumes it)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Run","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunDetail"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agent-runs/{id}/complete":{"post":{"tags":["AI agent"],"summary":"End the run and mark its to-do done","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Run","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunDetail"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/todos/{id}/decisions":{"post":{"tags":["AI decisions"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Start deciding a to-do with AI (returns the first assistant turn)","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"201":{"description":"Session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionSessionDetail"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"LLM provider error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["AI decisions"],"summary":"Decision sessions of a to-do (newest first)","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Sessions","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DecisionSession"}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/decisions/{id}":{"get":{"tags":["AI decisions"],"summary":"Get a decision session with its messages","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionSessionDetail"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/decisions/{id}/messages":{"post":{"tags":["AI decisions"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Answer questions and/or give feedback (returns the next assistant turn)","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"description":"Answers and/or feedback","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiReply"}}}},"responses":{"200":{"description":"Session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionSessionDetail"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"LLM provider error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/decisions/{id}/apply":{"post":{"tags":["AI decisions"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Write the proposed section into the strategy, note the decision on the to-do (and mark it done)","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"description":"Options","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionApply"}}}},"responses":{"200":{"description":"Applied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionApplyResult"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/decisions/{id}/discard":{"post":{"tags":["AI decisions"],"summary":"Discard a decision session","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Discarded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionSession"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/backups":{"get":{"tags":["Backups"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Stored whole-database backups (newest first) and the schedule","responses":{"200":{"description":"Backups","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackupList"}}}},"403":{"description":"Not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Backups"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Back up the whole database now","responses":{"201":{"description":"Created backup","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackupEntry"}}}},"403":{"description":"Not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/backups/{name}":{"delete":{"tags":["Backups"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Delete a stored backup","parameters":[{"schema":{"type":"string","minLength":1,"example":"backup-2026-11-19T08-30-00.000Z-manual.json.gz"},"required":true,"name":"name","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}}}},"403":{"description":"Not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/backups/{name}/restore":{"post":{"tags":["Backups"],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"summary":"Replace ALL data with a stored backup (the current data is backed up first)","parameters":[{"schema":{"type":"string","minLength":1,"example":"backup-2026-11-19T08-30-00.000Z-manual.json.gz"},"required":true,"name":"name","in":"path"}],"responses":{"200":{"description":"Restored","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreResult"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{}}