[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M758J40K241MTXDDAQMPEYMC":3,"skill-same:01M758J40K241MTXDDAQMPEYMC":71},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":51,"repositoryHtmlUrl":52,"repositoryHomepageUrl":53,"ownerHtmlUrl":54,"ownerBlogUrl":6,"ownerDescription":55,"updatedAt":56,"install":57,"resources":70},"01M758J40K241MTXDDAQMPEYMC","task-persistence",null,"Cross-session tasks via task-db.py or task_* MCP tools. v2: story\u002Fslices, paused, switch, bus-as-tasks, Telegram events.","lukemcqueen\u002Fsteadfaste-fleet","lukemcqueen","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F405240?v=4","01M757MHPAGRXTJAT46SKZP98R","Luke McQueen","01M757MHPZ573KP8DT9GB8SBQ7",4,"MIT","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Ftask-persistence\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: task-persistence\nversion: 2.1.0\ncategory: devops\ndescription: \"Cross-session tasks via task-db.py or task_* MCP tools. v2: story\u002Fslices, paused, switch, bus-as-tasks, Telegram events.\"\nauthor: Steadfaste Fleet\nplatforms: [linux, macos]\naliases: [todo-persistence]\nmetadata:\n  hermes:\n    tags: [task, persistence, session, postgres, tasks, protocol, todo]\n    related_skills: [session-manager, agent-fundamentals, task-start, session-start-discipline, fleet-bus]\n---\n\n# Task Persistence — Cross-Session Task Tracking (tasks schema)\n\n## Why This Exists\n\nThe Hermes `todo()` tool is **per-session** — items set in one session vanish\nwhen the next starts. This skill documents the durable task system on the\n`tasks` schema of each host's mycortex-postgres (party-reviewed design 2026-08-06:\ndocs\u002Fdesign\u002Ftask-workflow.md). Task Lifecycle v2 (2026-08-06,\ndocs\u002Fdesign\u002Ftask-lifecycle-v2.md) adds story\u002Fslices, paused, switch,\nbus-commands-as-tasks, and Telegram visibility.\n\n**History:** the old system (bus.todos + todo-db.py) was retired 2026-08-06 —\n`bus.todos` never existed on workers (bus schema is orchestrator-only), and\ntodo-db.py silently no-op'd (stdin-mode psql rc=0). The tasks schema is\napplied on EVERY host by fleet-update.sh via the version-gated runner.\n\n## Architecture\n\n```\nAgent Session\n     │\n     ├── todo()  ──►  ephemeral (Hermes tool, per-session)\n     │\n     └── task-db.py  ──►  tasks.tasks (per-host mycortex-postgres)\n                │             │\n                ├─ CLI        ├─ RLS per-profile isolation (fail-closed)\n                └─ task-mcp.py├─ CRUD as mycortex_reader_\u003Cprofile> (never superuser)\n                  (MCP tools) └─ Survives crashes, restarts, disconnects\n                                └─ task_events → telegram_notify → Luke's DM\n```\n\n### Database\n\n- **Schema:** `ops\u002Fservices\u002Ftasks\u002Fschema\u002Fv00X__*.sql` (version-gated by\n  `tasks.schema_version`; applied by `ops\u002Fservices\u002Ftasks\u002Fmigrate.py`).\n  Current: **v007** — v005 added hierarchy\u002Fpaused\u002Fcorrelation\u002Fevents,\n  v006 added reader SELECT on schema_version, v007 fixed task_upsert\n  partial-update preservation.\n- **Table:** `tasks.tasks` (active), `tasks.task_archive` (historical),\n  `tasks.task_events` (append-only audit + notify source of truth)\n- **Functions:** `tasks.task_upsert()`, `tasks.task_list()`,\n  `tasks.task_archive_old()`, `tasks.task_prune()`, `tasks.task_log_event()`,\n  `tasks.transition_allowed()`\n- **RLS:** personal rows visible to own profile only; fleet rows visible to\n  all, writable only by fleet writers (orchestrator profiles); fleet ×\n  client-project and path\u002Femail\u002FIP content banned (PII scrub gate)\n\n### Identity — NEVER hostname (Luke 2026-08-10)\n\nAgent identity (`PROFILE`, `CRUD_ROLE`) resolves from, in order:\n`HERMES_PROFILE` env → `AGENT_NAME` env → `AGENT_NAME` in\n`~\u002F.steadfaste-fleet\u002Fagent.env` → `~\u002Fsteadfaste-fleet\u002F.env` → `~\u002Fsteadfaste-fleet\u002F.env`.\n**There is NO hostname\u002Fwhoami fallback** — if no agent variable is found,\ntask-db.py exits 1 with a clear error. A misconfigured host fails loudly\ninstead of silently writing rows as the machine name. Same rule in\n`commands.py` (handler dispatch) — it raises RuntimeError.\n\n### CLI + MCP\n\n- **Deployed to:** `~\u002F.steadfaste-fleet\u002Fscripts\u002Ftask-db.py` (register in fleet-update.sh)\n- **MCP server:** `mcp-servers\u002Ftask-mcp.py`, registered as `todos`\n  (tools: task_add, task_list, task_pending, task_update, task_switch,\n  task_save_end, task_prune). All agents — not orchestrator-only.\n- **Queries are repo-scoped** (2026-10-14, reported by Titus): `list`, `pending`,\n  `--board`, `--claimable` and `--handed-out` show the CALLER's repo plus\n  untagged rows — another named repo's tasks are never returned. The repo comes\n  from `--repo`, else the repo the enforcer injected for your session, else\n  `FLEET_SESSION_REPO`, else the git repo at the working directory; if none of\n  those exist the query returns NOTHING (never every repo's tasks). The\n  fleet-wide view is the EXPLICIT `--repo ALL` \u002F `{\"repo\": \"ALL\"}`.\n\n## Commands\n\n```bash\n# List my tasks (union of personal + locally-present fleet rows)\ntask-db.py list [--status pending|in_progress|paused|completed|cancelled]\ntask-db.py list --project steadfaste-fleet --repo steadfaste-fleet\n\n# Add a task (tag it: project\u002Frepo\u002Fscope\u002Fsource). v2: story\u002Fslice hierarchy.\ntask-db.py add \"Fix dashboard health check\" --priority 2 \\\n    --project steadfaste-fleet --repo steadfaste-fleet --scope personal --source manual\ntask-db.py add \"Story: fleet observability\" --kind story\ntask-db.py add \"Slice: bus task wiring\" --kind slice --parent \u003Cstory-uuid>\ntask-db.py add \"EXEC: fleet-doctor.py\" --source inbox --correlation-id \u003Ccorr>\n\n# Update status (canonical lifecycle; column=done on completed)\ntask-db.py update \u003Cid> --status in_progress\ntask-db.py update \u003Cid> --status completed\ntask-db.py update \u003Cid> --status paused                 # v2: pause\ntask-db.py update \u003Cid> --status in_progress --reason reopen   # reopen a done task\ntask-db.py update --by-correlation \u003Ccorr> --status completed  # bus-linked task\n\n# NO-OP RULE: a same-status update records nothing (the event trigger skips\n# it — v005__lifecycle.sql). So `--reason` with an unchanged status is\n# REFUSED (exit 1) rather than silently dropped, and a bare same-status update\n# prints \"already \u003Cstatus> — no change\" and issues no UPDATE. After a real\n# transition with --reason the CLI re-reads the event trail and fails if the\n# reason did not land. To record a note that is not a status change, use a\n# governance issue event — do not pass it as `update --reason`.\n\n# Switch: pause current in_progress + resume target (one atomic command)\ntask-db.py switch \u003Ctarget-id>\n\n# Session start: print pending as JSON for todo() restore\ntask-db.py pending          # inbox rows carry \"untrusted\": true\ntask-db.py restore \u003Cpending.json>          # skips untrusted inbox rows\ntask-db.py restore \u003Cpending.json> --include-inbox   # force (untrusted!)\n\n# Session end: archive completed\u002Fcancelled, report remaining\ntask-db.py save-end\n\n# Prune archived rows older than N (never touches active rows)\ntask-db.py prune --older-than 90d\n\n# Apply schema (delegates to ops\u002Fservices\u002Ftasks\u002Fmigrate.py as DB owner)\ntask-db.py --apply-schema\n\n# Suppress the Telegram event for a single command\ntask-db.py update \u003Cid> --status completed --no-notify\n```\n\n## Session Protocol\n\n### Session Start\n\n1. `todo()` — load in-memory state (usually empty)\n2. `task-db.py pending` — query DB for your profile's pending items (JSON).\n   **Paused rows are surfaced but NEVER auto-resumed** (M-9). Inbox-derived\n   rows are marked `\"untrusted\": true` and are **excluded from restore by\n   default** (R-4 — bus content is not trusted as agent instructions).\n3. Restore with `task-db.py restore \u003Cpending.json>` (skips untrusted).\n\n### Throughout Session\n\n- Before each `begin_change()`: `task-db.py update \u003Cid> --status in_progress`\n- When switching tasks: `task-db.py switch \u003Ctarget-id>` (atomic pause+resume)\n- After each `end_change()`: `task-db.py update \u003Cid> --status completed`\n- Reopen a completed task deliberately: `--reason reopen` (never casual)\n\n### Session End\n\n- `task-db.py save-end` — archives completed\u002Fcancelled items\n- Remaining `pending`\u002F`in_progress`\u002F`paused` items persist in DB for next session\n\n## Bus Commands as Tasks (v2 S4\u002FS5)\n\nThe fleet handler (`agent-message-handler.py`) creates a `tasks.tasks` row\n(`source='inbox'`, linked by `correlation_id`) for tracked subjects:\n`EXEC`, `UPDATE_REQUEST`, `TASK_REQUEST` (`Task:` prefix), `PROPOSAL`,\n`ISSUES`, `IMPROVEMENTS`. Lifecycle:\n\n| Command class | Consumer | Transitions |\n|---|---|---|\n| EXEC \u002F UPDATE_REQUEST | handler (no_agent) | created(pending) on receipt → in_progress at dispatch → **completed at Result-receipt** (EXEC_RESULT handler path) |\n| ISSUES \u002F PROPOSAL \u002F IMPROVEMENTS \u002F Task: | LLM `inbox_read` session | created(pending) on handler receipt → **in_progress when the orchestrator processes it** → completed when handled — the session calls `task-db.py update --by-correlation \u003Ccorr> --status completed` |\n\n- **Stale sweep:** the handler pauses inbox tasks stuck `in_progress` > 1h\n  (`TASKS_STALE_HOURS`) with reason='stale' on every tick.\n- **Telegram:** entry + completed events notify Luke's DM via\n  `lib\u002Ftelegram_notify.py` (`[agent] story → slice: status (id)`). Mute via\n  `TASKS_NOTIFY_MUTE=in_progress,paused`; quiet hours via\n  `TASKS_NOTIFY_QUIET=22:00-07:00`.\n- **Never silently drop:** a handled ISSUES\u002FPROPOSAL must be transitioned to\n  completed (or paused if deferred). See `fleet-bus` skill.\n\n## Honest Fleet Semantics (party B-3)\n\n`--scope fleet` stores the row **locally on this host only** — it is NOT\nvisible fleet-wide until transport ships (roadmap: git-backed, private repo).\nThe CLI prints this warning. Never claim fleet-wide visibility in reports.\n\n## Security Invariants (party B-1\u002FB-2)\n\n- Identifier-ish values (agent\u002Fproject\u002Frepo\u002Ftarget\u002Fassignee\u002Fscope\u002Fstatus\u002F\n  source\u002Fcolumn\u002Fkind) are allowlist-validated BEFORE use; all DML funnels\n  through the parameterized `tasks.task_upsert()` — never string-built WHERE\n  clauses.\n- Free text is quote-doubled into string literals only.\n- psql runs with `ON_ERROR_STOP=1`; query flows via STDIN, never embedded in\n  a shell command string (the old sg-embedding path was shell-RCE).\n- CRUD connects as `mycortex_reader_\u003Cprofile>` — NEVER superuser.\n- **v007 partial-update fix:** status-only updates preserve source\u002Fscope\u002F\n  priority\u002Fproject\u002Fcreated_by (a bus task stays `source='inbox'` through its\n  lifecycle). Do not revert to `COALESCE(EXCLUDED.x, ...)` in task_upsert.\n\n## Anti-Patterns\n\n- ❌ **Relying only on `todo()` tool** — per-session. Items vanish.\n- ❌ **Using a local file for persistence** — the DB is already there.\n- ❌ **Letting completed items accumulate** — run `task-db.py save-end`.\n- ❌ **Forgetting to update status** — stale pending items clutter restore.\n- ❌ **Hardcoding UUIDs** — retrieve via `task-db.py pending`\u002F`list`.\n- ❌ **Using bus.* or todo-* nomenclature** — the tasks system is `tasks.*`,\n  `task-db.py`, `task_*` tools everywhere (AC-1).\n- ❌ **Hostname identity fallback** — identity comes from AGENT_NAME env \u002F\n  .env, never platform.node() (Luke 2026-08-10).\n\n## Doctor Checks (v2 S7)\n\nThe doctor's `check_task_lifecycle_v2` FAILs\u002FWARNs on: schema_version \u003C 5\n(FAIL), task_events RLS forgeable grants (FAIL), telegram notify failures\n(WARN), stale inbox tasks (WARN), .env perms != 600 (WARN). Run the doctor\nafter any schema\u002Fdeploy change.\n\n## Known Issues\n\n### ✅ FIXED 2026-08-06 — silent failure class (rc=0 stdin bug)\n\nThe old todo-db.py printed ✅ while rows vanished (stdin-mode psql returns\nrc=0 on SQL error; bus.todos never existed on the migrated DB). The rewrite\nuses `-c`\u002FON_ERROR_STOP + stderr scan; errors exit 1 with evidence. The\ndoctor now runs a **write-probe** (seed → list → archive) to catch the\n\"valid JSON but dead table\" class — see `check_task_db`.\n\n### ✅ FIXED 2026-08-10 — v007 partial-update clobber (found live in S3 e2e)\n\nv005's `task_upsert` ON CONFLICT used `COALESCE(EXCLUDED.x, existing)` but\nEXCLUDED.x is never NULL (INSERT defaults) → every status-only update\nclobbered source (inbox→manual), scope (fleet→personal), priority (→0),\nproject (→steadfaste-fleet), created_by. v007 fixes the DO UPDATE clause to\ncoalesce against the function parameter. Regression-locked in\ntest-tasks-schema.sh.\n\n## Reference\n\n- Design: `~\u002Fsteadfaste-fleet\u002Fdocs\u002Fdesign\u002Ftask-workflow.md`\n- Lifecycle v2: `~\u002Fsteadfaste-fleet\u002Fdocs\u002Fdesign\u002Ftask-lifecycle-v2.md`\n- CLI: `~\u002Fsteadfaste-fleet\u002Fops\u002Fscripts\u002Fmanage\u002Ftask-db.py`\n- MCP: `~\u002Fsteadfaste-fleet\u002Fmcp-servers\u002Ftask-mcp.py`\n- Migration runner: `~\u002Fsteadfaste-fleet\u002Fops\u002Fservices\u002Ftasks\u002Fmigrate.py`\n- Notify: `~\u002Fsteadfaste-fleet\u002Fops\u002Fscripts\u002Flib\u002Ftelegram_notify.py`\n- psql pitfalls: skill `psql-automation`\n- Session restore: skill `session-start-discipline`\n","# Task Persistence — Cross-Session Task Tracking (tasks schema)\n\n## Why This Exists\n\nThe Hermes `todo()` tool is **per-session** — items set in one session vanish\nwhen the next starts. This skill documents the durable task system on the\n`tasks` schema of each host's mycortex-postgres (party-reviewed design 2026-08-06:\ndocs\u002Fdesign\u002Ftask-workflow.md). Task Lifecycle v2 (2026-08-06,\ndocs\u002Fdesign\u002Ftask-lifecycle-v2.md) adds story\u002Fslices, paused, switch,\nbus-commands-as-tasks, and Telegram visibility.\n\n**History:** the old system (bus.todos + todo-db.py) was retired 2026-08-06 —\n`bus.todos` never existed on workers (bus schema is orchestrator-only), and\ntodo-db.py silently no-op'd (stdin-mode psql rc=0). The tasks schema is\napplied on EVERY host by fleet-update.sh via the version-gated runner.\n\n## Architecture\n\n```\nAgent Session\n     │\n     ├── todo()  ──►  ephemeral (Hermes tool, per-session)\n     │\n     └── task-db.py  ──►  tasks.tasks (per-host mycortex-postgres)\n                │             │\n                ├─ CLI        ├─ RLS per-profile isolation (fail-closed)\n                └─ task-mcp.py├─ CRUD as mycortex_reader_\u003Cprofile> (never superuser)\n                  (MCP tools) └─ Survives crashes, restarts, disconnects\n                                └─ task_events → telegram_notify → Luke's DM\n```\n\n### Database\n\n- **Schema:** `ops\u002Fservices\u002Ftasks\u002Fschema\u002Fv00X__*.sql` (version-gated by\n  `tasks.schema_version`; applied by `ops\u002Fservices\u002Ftasks\u002Fmigrate.py`).\n  Current: **v007** — v005 added hierarchy\u002Fpaused\u002Fcorrelation\u002Fevents,\n  v006 added reader SELECT on schema_version, v007 fixed task_upsert\n  partial-update preservation.\n- **Table:** `tasks.tasks` (active), `tasks.task_archive` (historical),\n  `tasks.task_events` (append-only audit + notify source of truth)\n- **Functions:** `tasks.task_upsert()`, `tasks.task_list()`,\n  `tasks.task_archive_old()`, `tasks.task_prune()`, `tasks.task_log_event()`,\n  `tasks.transition_allowed()`\n- **RLS:** personal rows visible to own profile only; fleet rows visible to\n  all, writable only by fleet writers (orchestrator profiles); fleet ×\n  client-project and path\u002Femail\u002FIP content banned (PII scrub gate)\n\n### Identity — NEVER hostname (Luke 2026-08-10)\n\nAgent identity (`PROFILE`, `CRUD_ROLE`) resolves from, in order:\n`HERMES_PROFILE` env → `AGENT_NAME` env → `AGENT_NAME` in\n`~\u002F.steadfaste-fleet\u002Fagent.env` → `~\u002Fsteadfaste-fleet\u002F.env` → `~\u002Fsteadfaste-fleet\u002F.env`.\n**There is NO hostname\u002Fwhoami fallback** — if no agent variable is found,\ntask-db.py exits 1 with a clear error. A misconfigured host fails loudly\ninstead of silently writing rows as the machine name. Same rule in\n`commands.py` (handler dispatch) — it raises RuntimeError.\n\n### CLI + MCP\n\n- **Deployed to:** `~\u002F.steadfaste-fleet\u002Fscripts\u002Ftask-db.py` (register in fleet-update.sh)\n- **MCP server:** `mcp-servers\u002Ftask-mcp.py`, registered as `todos`\n  (tools: task_add, task_list, task_pending, task_update, task_switch,\n  task_save_end, task_prune). All agents — not orchestrator-only.\n- **Queries are repo-scoped** (2026-10-14, reported by Titus): `list`, `pending`,\n  `--board`, `--claimable` and `--handed-out` show the CALLER's repo plus\n  untagged rows — another named repo's tasks are never returned. The repo comes\n  from `--repo`, else the repo the enforcer injected for your session, else\n  `FLEET_SESSION_REPO`, else the git repo at the working directory; if none of\n  those exist the query returns NOTHING (never every repo's tasks). The\n  fleet-wide view is the EXPLICIT `--repo ALL` \u002F `{\"repo\": \"ALL\"}`.\n\n## Commands\n\n```bash\n# List my tasks (union of personal + locally-present fleet rows)\ntask-db.py list [--status pending|in_progress|paused|completed|cancelled]\ntask-db.py list --project steadfaste-fleet --repo steadfaste-fleet\n\n# Add a task (tag it: project\u002Frepo\u002Fscope\u002Fsource). v2: story\u002Fslice hierarchy.\ntask-db.py add \"Fix dashboard health check\" --priority 2 \\\n    --project steadfaste-fleet --repo steadfaste-fleet --scope personal --source manual\ntask-db.py add \"Story: fleet observability\" --kind story\ntask-db.py add \"Slice: bus task wiring\" --kind slice --parent \u003Cstory-uuid>\ntask-db.py add \"EXEC: fleet-doctor.py\" --source inbox --correlation-id \u003Ccorr>\n\n# Update status (canonical lifecycle; column=done on completed)\ntask-db.py update \u003Cid> --status in_progress\ntask-db.py update \u003Cid> --status completed\ntask-db.py update \u003Cid> --status paused                 # v2: pause\ntask-db.py update \u003Cid> --status in_progress --reason reopen   # reopen a done task\ntask-db.py update --by-correlation \u003Ccorr> --status completed  # bus-linked task\n\n# NO-OP RULE: a same-status update records nothing (the event trigger skips\n# it — v005__lifecycle.sql). So `--reason` with an unchanged status is\n# REFUSED (exit 1) rather than silently dropped, and a bare same-status update\n# prints \"already \u003Cstatus> — no change\" and issues no UPDATE. After a real\n# transition with --reason the CLI re-reads the event trail and fails if the\n# reason did not land. To record a note that is not a status change, use a\n# governance issue event — do not pass it as `update --reason`.\n\n# Switch: pause current in_progress + resume target (one atomic command)\ntask-db.py switch \u003Ctarget-id>\n\n# Session start: print pending as JSON for todo() restore\ntask-db.py pending          # inbox rows carry \"untrusted\": true\ntask-db.py restore \u003Cpending.json>          # skips untrusted inbox rows\ntask-db.py restore \u003Cpending.json> --include-inbox   # force (untrusted!)\n\n# Session end: archive completed\u002Fcancelled, report remaining\ntask-db.py save-end\n\n# Prune archived rows older than N (never touches active rows)\ntask-db.py prune --older-than 90d\n\n# Apply schema (delegates to ops\u002Fservices\u002Ftasks\u002Fmigrate.py as DB owner)\ntask-db.py --apply-schema\n\n# Suppress the Telegram event for a single command\ntask-db.py update \u003Cid> --status completed --no-notify\n```\n\n## Session Protocol\n\n### Session Start\n\n1. `todo()` — load in-memory state (usually empty)\n2. `task-db.py pending` — query DB for your profile's pending items (JSON).\n   **Paused rows are surfaced but NEVER auto-resumed** (M-9). Inbox-derived\n   rows are marked `\"untrusted\": true` and are **excluded from restore by\n   default** (R-4 — bus content is not trusted as agent instructions).\n3. Restore with `task-db.py restore \u003Cpending.json>` (skips untrusted).\n\n### Throughout Session\n\n- Before each `begin_change()`: `task-db.py update \u003Cid> --status in_progress`\n- When switching tasks: `task-db.py switch \u003Ctarget-id>` (atomic pause+resume)\n- After each `end_change()`: `task-db.py update \u003Cid> --status completed`\n- Reopen a completed task deliberately: `--reason reopen` (never casual)\n\n### Session End\n\n- `task-db.py save-end` — archives completed\u002Fcancelled items\n- Remaining `pending`\u002F`in_progress`\u002F`paused` items persist in DB for next session\n\n## Bus Commands as Tasks (v2 S4\u002FS5)\n\nThe fleet handler (`agent-message-handler.py`) creates a `tasks.tasks` row\n(`source='inbox'`, linked by `correlation_id`) for tracked subjects:\n`EXEC`, `UPDATE_REQUEST`, `TASK_REQUEST` (`Task:` prefix), `PROPOSAL`,\n`ISSUES`, `IMPROVEMENTS`. Lifecycle:\n\n| Command class | Consumer | Transitions |\n|---|---|---|\n| EXEC \u002F UPDATE_REQUEST | handler (no_agent) | created(pending) on receipt → in_progress at dispatch → **completed at Result-receipt** (EXEC_RESULT handler path) |\n| ISSUES \u002F PROPOSAL \u002F IMPROVEMENTS \u002F Task: | LLM `inbox_read` session | created(pending) on handler receipt → **in_progress when the orchestrator processes it** → completed when handled — the session calls `task-db.py update --by-correlation \u003Ccorr> --status completed` |\n\n- **Stale sweep:** the handler pauses inbox tasks stuck `in_progress` > 1h\n  (`TASKS_STALE_HOURS`) with reason='stale' on every tick.\n- **Telegram:** entry + completed events notify Luke's DM via\n  `lib\u002Ftelegram_notify.py` (`[agent] story → slice: status (id)`). Mute via\n  `TASKS_NOTIFY_MUTE=in_progress,paused`; quiet hours via\n  `TASKS_NOTIFY_QUIET=22:00-07:00`.\n- **Never silently drop:** a handled ISSUES\u002FPROPOSAL must be transitioned to\n  completed (or paused if deferred). See `fleet-bus` skill.\n\n## Honest Fleet Semantics (party B-3)\n\n`--scope fleet` stores the row **locally on this host only** — it is NOT\nvisible fleet-wide until transport ships (roadmap: git-backed, private repo).\nThe CLI prints this warning. Never claim fleet-wide visibility in reports.\n\n## Security Invariants (party B-1\u002FB-2)\n\n- Identifier-ish values (agent\u002Fproject\u002Frepo\u002Ftarget\u002Fassignee\u002Fscope\u002Fstatus\u002F\n  source\u002Fcolumn\u002Fkind) are allowlist-validated BEFORE use; all DML funnels\n  through the parameterized `tasks.task_upsert()` — never string-built WHERE\n  clauses.\n- Free text is quote-doubled into string literals only.\n- psql runs with `ON_ERROR_STOP=1`; query flows via STDIN, never embedded in\n  a shell command string (the old sg-embedding path was shell-RCE).\n- CRUD connects as `mycortex_reader_\u003Cprofile>` — NEVER superuser.\n- **v007 partial-update fix:** status-only updates preserve source\u002Fscope\u002F\n  priority\u002Fproject\u002Fcreated_by (a bus task stays `source='inbox'` through its\n  lifecycle). Do not revert to `COALESCE(EXCLUDED.x, ...)` in task_upsert.\n\n## Anti-Patterns\n\n- ❌ **Relying only on `todo()` tool** — per-session. Items vanish.\n- ❌ **Using a local file for persistence** — the DB is already there.\n- ❌ **Letting completed items accumulate** — run `task-db.py save-end`.\n- ❌ **Forgetting to update status** — stale pending items clutter restore.\n- ❌ **Hardcoding UUIDs** — retrieve via `task-db.py pending`\u002F`list`.\n- ❌ **Using bus.* or todo-* nomenclature** — the tasks system is `tasks.*`,\n  `task-db.py`, `task_*` tools everywhere (AC-1).\n- ❌ **Hostname identity fallback** — identity comes from AGENT_NAME env \u002F\n  .env, never platform.node() (Luke 2026-08-10).\n\n## Doctor Checks (v2 S7)\n\nThe doctor's `check_task_lifecycle_v2` FAILs\u002FWARNs on: schema_version \u003C 5\n(FAIL), task_events RLS forgeable grants (FAIL), telegram notify failures\n(WARN), stale inbox tasks (WARN), .env perms != 600 (WARN). Run the doctor\nafter any schema\u002Fdeploy change.\n\n## Known Issues\n\n### ✅ FIXED 2026-08-06 — silent failure class (rc=0 stdin bug)\n\nThe old todo-db.py printed ✅ while rows vanished (stdin-mode psql returns\nrc=0 on SQL error; bus.todos never existed on the migrated DB). The rewrite\nuses `-c`\u002FON_ERROR_STOP + stderr scan; errors exit 1 with evidence. The\ndoctor now runs a **write-probe** (seed → list → archive) to catch the\n\"valid JSON but dead table\" class — see `check_task_db`.\n\n### ✅ FIXED 2026-08-10 — v007 partial-update clobber (found live in S3 e2e)\n\nv005's `task_upsert` ON CONFLICT used `COALESCE(EXCLUDED.x, existing)` but\nEXCLUDED.x is never NULL (INSERT defaults) → every status-only update\nclobbered source (inbox→manual), scope (fleet→personal), priority (→0),\nproject (→steadfaste-fleet), created_by. v007 fixes the DO UPDATE clause to\ncoalesce against the function parameter. Regression-locked in\ntest-tasks-schema.sh.\n\n## Reference\n\n- Design: `~\u002Fsteadfaste-fleet\u002Fdocs\u002Fdesign\u002Ftask-workflow.md`\n- Lifecycle v2: `~\u002Fsteadfaste-fleet\u002Fdocs\u002Fdesign\u002Ftask-lifecycle-v2.md`\n- CLI: `~\u002Fsteadfaste-fleet\u002Fops\u002Fscripts\u002Fmanage\u002Ftask-db.py`\n- MCP: `~\u002Fsteadfaste-fleet\u002Fmcp-servers\u002Ftask-mcp.py`\n- Migration runner: `~\u002Fsteadfaste-fleet\u002Fops\u002Fservices\u002Ftasks\u002Fmigrate.py`\n- Notify: `~\u002Fsteadfaste-fleet\u002Fops\u002Fscripts\u002Flib\u002Ftelegram_notify.py`\n- psql pitfalls: skill `psql-automation`\n- Session restore: skill `session-start-discipline`\n",{"name":5,"author":24,"aliases":25,"version":27,"category":28,"metadata":29,"platforms":45,"description":7},"Steadfaste Fleet",[26],"todo-persistence","2.1.0","devops",{"hermes":30},{"tags":31,"related_skills":39},[32,33,34,35,36,37,38],"task","persistence","session","postgres","tasks","protocol","todo",[40,41,42,43,44],"session-manager","agent-fundamentals","task-start","session-start-discipline","fleet-bus",[46,47],"linux","macos","main","9dc0e92c5fa81d4db5292b205716e8ea0c00d10e","skills\u002Fdevops\u002Ftask-persistence",1,"https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet","steadfaste.com","https:\u002F\u002Fgithub.com\u002Flukemcqueen","AI Architect | Building Hermes Cortex: governed multi-agent AI for autonomous software engineering | Enterprise Tech Consultant","2026-11-14 22:33:34",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add lukemcqueen\u002Fsteadfaste-fleet --skill task-persistence",{"tool":63,"command":64},"bunx","bunx skills add lukemcqueen\u002Fsteadfaste-fleet --skill task-persistence",{"tool":66,"command":67},"pnpm","pnpm dlx skills add lukemcqueen\u002Fsteadfaste-fleet --skill task-persistence","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Ftask-persistence\u002FSKILL.md",true,[],[72,80,87,94,101,108],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":79},"01M7DXY4G8NSVB59K8B6S2AQNP","macbook-linux-maintenance","Legacy MacBook Linux fixes: GPU wedge, reboot hang, thermal.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fmacbook-linux-maintenance\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":79},"01M7DXXYJCXFJ3TGB84ZQ8KFE6","governance-regression-triage","Triage a host's governance issues: what changed.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fgovernance-regression-triage\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":79},"01M7DXXSAP1G8FDRJAMXQGBBMK","enforcement-immutability","Use when enforcement files lose their immutable flag.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fenforcement-immutability\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":79},"01M78SSDQVRYX64Y16X32TC0NS","steadfaste-fleet-repo-deploy","Use when committing to the steadfaste-fleet repo.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fsteadfaste-fleet-repo-deploy\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":79},"01M78SS928F3R2RJAYVW4E30CE","steadfaste-fleet-maintenance","Maintain an installed Steadfaste Fleet instance — update both the upstream Hermes Agent and the fleet repo layer, merge diverged histories, sync skills safely, and troubleshoot common issues. Covers the dual-update workflow (hermes update + fleet-update.sh), encrypted brain data backup, mycortex import, and recovery techniques.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fsteadfaste-fleet-maintenance\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":79},"01M78SP1CHW0T0BWE5ZT6JBPX8","fleet-preflight","DEPRECATED alias — merged into survey-before-action (2026-08-20). Load survey-before-action instead; its \"Repo-Specific Pre-Flight\" section covers git search, Hermes boundary, and deployment verification.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Ffleet-preflight\u002FSKILL.md",[],[]]