metadata.context on a CoS task is overloaded — the same key carries two different kinds of content:
- A one-line human note (
server/routes/cosJobRoutes.js ~line 182; server/services/cosTaskStore.js ~line 920 escalation context, and the direct-write path at ~line 320: if (taskData.context) metadata.context = taskData.context;).
- A multi-thousand-character agent prompt (
server/services/cosTaskGenerator.js ~line 1609-1628: "Move the generator's multi-line prompt into metadata.context..." — confirmed still present: task.metadata.context = task.description;; consumed via server/routes/cosTaskRoutes.js ~line 197).
The prompt ends up there because generateTasksMarkdown flattens description to one line and parseTasksMarkdown only matches a - [ ] block's first line, so newlines in description would corrupt COS-TASKS.md on the markdown round-trip — metadata.context was the escape hatch that survives serialization.
Fix shape
Split into two fields:
metadata.prompt — the full agent-facing payload (what cosTaskGenerator.js currently stuffs into metadata.context).
metadata.context — reverts to just the one-line human note.
This touches:
- The markdown round-trip (
generateTasksMarkdown/parseTasksMarkdown in server/services/cosTaskGenerator.js).
LEGACY_DIRECT_FIELDS in server/services/cosTaskStore.js (~line 66, currently ['context', 'model', 'provider', 'effort', 'app']).
server/services/cosTaskMerge.js (~line 200 area) — the merge logic that reconciles metadata on update.
- The agent prompt builder that currently reads the prompt out of
metadata.context.
- Every on-disk task with an existing
metadata.context prompt payload — needs a migration (scripts/migrations/) to move it to metadata.prompt so old tasks keep resolving correctly, per the root CLAUDE.md migration-required rule for on-disk format changes.
Deferred as disproportionate to what was a presentational problem (the long-text clamping in client/src/components/ui/CollapsibleText.jsx) — the UI clamp handles both shapes correctly today regardless of which one a given task uses, so there is no user-visible bug, only a data-modeling debt.
Migrated from PLAN.md by /do:replan --issues.
metadata.contexton a CoS task is overloaded — the same key carries two different kinds of content:server/routes/cosJobRoutes.js~line 182;server/services/cosTaskStore.js~line 920 escalation context, and the direct-write path at ~line 320:if (taskData.context) metadata.context = taskData.context;).server/services/cosTaskGenerator.js~line 1609-1628: "Move the generator's multi-line prompt intometadata.context..." — confirmed still present:task.metadata.context = task.description;; consumed viaserver/routes/cosTaskRoutes.js~line 197).The prompt ends up there because
generateTasksMarkdownflattensdescriptionto one line andparseTasksMarkdownonly matches a- [ ]block's first line, so newlines indescriptionwould corruptCOS-TASKS.mdon the markdown round-trip —metadata.contextwas the escape hatch that survives serialization.Fix shape
Split into two fields:
metadata.prompt— the full agent-facing payload (whatcosTaskGenerator.jscurrently stuffs intometadata.context).metadata.context— reverts to just the one-line human note.This touches:
generateTasksMarkdown/parseTasksMarkdowninserver/services/cosTaskGenerator.js).LEGACY_DIRECT_FIELDSinserver/services/cosTaskStore.js(~line 66, currently['context', 'model', 'provider', 'effort', 'app']).server/services/cosTaskMerge.js(~line 200 area) — the merge logic that reconcilesmetadataon update.metadata.context.metadata.contextprompt payload — needs a migration (scripts/migrations/) to move it tometadata.promptso old tasks keep resolving correctly, per the rootCLAUDE.mdmigration-required rule for on-disk format changes.Deferred as disproportionate to what was a presentational problem (the long-text clamping in
client/src/components/ui/CollapsibleText.jsx) — the UI clamp handles both shapes correctly today regardless of which one a given task uses, so there is no user-visible bug, only a data-modeling debt.Migrated from PLAN.md by /do:replan --issues.