feat(harness): workflow guidance in the prompt (SP7, #1873) #1952

Merged
jason.woltje merged 2 commits from sp7 into refactor 2026-11-12 22:05:58 +00:00
Owner

Starter packs slice SP7 (#1873): workflow guidance in agents' prompts. Design: docs/plans/2026-11-12_starter-packs-design.md section 8, under Jason's full send of 11-12 about 21:05Z, which covers the new prompt text.

  • resolveInstance puts workflows on the resolved record: the organization's, plus the project's when a project is given, with the project winning by name. The key is present only when the list is non-empty, so existing digests stay the same.
  • prompt adds one section, ## Organization workflows, after the contract and persona and before ## This session.
    • The chief of staff, and any role holding task.create or task.assign after limits, sees every step.
    • A role a step names sees only its own steps.
    • Any other role gets no section, and its prompt is byte-identical to before.
  • The section says workflows are read-only guidance that grants nothing, and that the role contract and the rails win.
  • Workflow data is one JSON line per workflow inside a <workflows-data> block. <, >, & and every control, format and line or paragraph separator character are escaped, so no value can start a line, open a heading or close the block.
  • The launcher still names no project, so only org workflows reach launched prompts today.

Tests: workflow-prompt.test.mjs and resolve-workflows.test.mjs. Red before: a chief bundle for an org with a change workflow has no workflows section. The lane gate was 2537/1; the one failure is the known CHAT-01 base red in conversation reader.test.mjs. The Lead check ran separately under env -i.

Reviews (fresh Opus delegates):

  • Build: approve.
  • Security: approve. It tried 111 injection values in titles, descriptions and step titles, and none escaped the data block.
  • Three P3s were fixed in the second commit.

Deferred: SP3's loader has no cap on the number of workflows; 300 at maximum size makes a 2.1 MB prompt.

Starter packs slice SP7 (#1873): workflow guidance in agents' prompts. Design: `docs/plans/2026-11-12_starter-packs-design.md` section 8, under Jason's full send of 11-12 about 21:05Z, which covers the new prompt text. - `resolveInstance` puts `workflows` on the resolved record: the organization's, plus the project's when a project is given, with the project winning by name. The key is present only when the list is non-empty, so existing digests stay the same. - `prompt` adds one section, `## Organization workflows`, after the contract and persona and before `## This session`. - The chief of staff, and any role holding `task.create` or `task.assign` after limits, sees every step. - A role a step names sees only its own steps. - Any other role gets no section, and its prompt is byte-identical to before. - The section says workflows are read-only guidance that grants nothing, and that the role contract and the rails win. - Workflow data is one JSON line per workflow inside a `<workflows-data>` block. `<`, `>`, `&` and every control, format and line or paragraph separator character are escaped, so no value can start a line, open a heading or close the block. - The launcher still names no project, so only org workflows reach launched prompts today. Tests: `workflow-prompt.test.mjs` and `resolve-workflows.test.mjs`. Red before: a chief bundle for an org with a `change` workflow has no workflows section. The lane gate was 2537/1; the one failure is the known CHAT-01 base red in conversation reader.test.mjs. The Lead check ran separately under `env -i`. Reviews (fresh Opus delegates): - Build: approve. - Security: approve. It tried 111 injection values in titles, descriptions and step titles, and none escaped the data block. - Three P3s were fixed in the second commit. Deferred: SP3's loader has no cap on the number of workflows; 300 at maximum size makes a 2.1 MB prompt.
jason.woltje added 2 commits 2026-11-12 22:05:55 +00:00
resolveInstance carries the organization's workflows, plus the given
project's, the project's winning by name; the key is added only when
there is one, so an organization without workflows digests as before.

The prompt renders them under one fixed heading, "## Organization
workflows", after the contract and persona and before "## This
session". The chief of staff and roles holding task.create or
task.assign see every step; a role a step names sees only its own
steps; any other role sees nothing. Each workflow is one JSON line
between <workflows-data> markers with <, >, &, line separators, C1
controls and bidi overrides escaped, so no title, description or step
role can start a heading or close the block. The section says
workflows grant nothing and the contract and rails win. The contract
text is unchanged.
The workflows data lines now escape every \p{Cc}, \p{Cf}, \p{Zl} and
\p{Zp} character by UTF-16 unit, so zero-width, soft hyphen, BOM and
tag characters never reach the prompt invisible. The section says the
rails come later in the prompt, not at its end, since skills can follow
them. A role holding task.assign or task.create only cross-role sees
every step; now tested.
jason.woltje merged commit 1ced0e3924 into refactor 2026-11-12 22:05:58 +00:00
Sign in to join this conversation.