Skip to content

docs(plans): plan workflow packs and propose ADR-0057 (WP0) - #277

Closed
lg2m wants to merge 2 commits into
mainfrom
docs/eng-1019-workflow-packs
Closed

lg2m wants to merge 2 commits into
mainfrom
docs/eng-1019-workflow-packs

Conversation

@lg2m

@lg2m lg2m commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

WP0: plan workflow packs and propose ADR-0057

Spec: docs/plans/workflow-packs.md · Linear: ENG-1019 (parent ENG-1018, milestone Workflow Packs)

Docs only. No code or behavior changes.

What this proposes

Cursor's pstack is one plugin: a router skill, 23 playbooks, 24 principle skills hidden from the model, and a dependency on cursor-team-kit that only its README states. This plan builds the QQ equivalent as several packs that share one skill library:

  • Shared library in .qq/skills/, visible under every profile: principles (one file per principle), plain-prose, test-first, check-the-number, decision-log, plus the existing qq-verify and design-skill-or-pack.
  • deep pack: a router persona (8 KiB authoring budget, enforced by a test), playbooks, and the how / why / arena / swarm / interrogate workflows. The workflows use spawn_agent with roster routes.
  • reviewer, perf, protocol: the existing packs, moved onto the shared library.

Sharing comes from the directory layout, so no pack depends on another.

ADR-0057 (Proposed)

Two runtime gaps stop this today:

  1. G1. load_skill reads only SKILL.md. Proposal: load_skill { name, file? }, confined to the skill's directory under the same body contract, with the file's hash recorded in prompt identity. This follows fx's skill { location, resource } tool. docs(rust): add reference-backed Rust quality skill #247's rust-quality/references/*.md is a current case that would use it.
  2. G2. Child runs get no skill index and no load_skill, although they inherit the persona that names the skills. Proposal: split allow_guidance into select_guidance and pull_skills; children get pull only. Claude Code, Codex, fx and OpenCode all give children the catalog.

Survey

Plan § Survey compares Codex, OpenCode, pi and fx (from .source/) with Claude Code, Cursor and Grok Build (from their docs). It covers skill format, the hide-from-model flag, supporting files, children's skill access, named agents, persona/mode, bundles, catalog budgets and hooks. It also lists failure modes the plan avoids: silent shadowing, keys accepted but ignored, unbounded injection, README-only dependencies, and plugins that run code.

Slices

WP0 (this PR) to WP8, each with its own Linear sub-issue (ENG-1019 to ENG-1027). WP1 and WP2 are runtime changes. WP2 touches sessions/ and needs a second reviewer. WP8 (spawn_agent { profile }) is only proposed and is open decision 1.

Shared files

  • progress/root.md: reserves ADR-0057, so the next free number is 0058.
  • One row each added to docs/adr/README.md, docs/plans/README.md and docs/plans/progress/README.md.

How verified

Decisions needed

  1. WP8: may a child run on another profile chosen by name, or only inherit the parent's?
  2. Should the setup and meta skills (deep-setup, reflect, correct) live in .qq/skills/? This PR proposes yes.

lg2m added 2 commits October 10, 2026 14:15
Plan role packs (a `deep` router plus the existing reviewer/perf/protocol
packs) over a shared .qq/skills library, modeled on Cursor's pstack and a
survey of Codex, Claude Code, OpenCode, pi, fx, Cursor and Grok Build.
ADR-0057 proposes skill supporting files through load_skill and skill pull
for delegate runs.

Slice: WP0 (ENG-1019, parent ENG-1018).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T21:24:56.103484Z 267b6db PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 267b6db34a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

| Slice | Goal | Inputs | Owned paths | Acceptance |
| --- | --- | --- | --- | --- |
| WP0 | Plan, ADR-0057, ledger, Linear issues | none | `docs/plans/workflow-packs.md`, ledger, `docs/adr/0057-*`, root reservation | Docs review |
| WP1 | `load_skill` supporting files (G1) | WP0 | `qq-core` `workspace/{skills,guidance,prepare}.rs`, `tools/specs.rs`, `runtime/prompt.rs`; `docs/design/tools.md` | Loads a file from a pack root and from a workspace root. Refuses `..`, absolute paths, symlink escapes, non-UTF-8, over 64 KiB, and a command with `file`. An unknown file is a tool error. Prompt identity records the file hash. Cancellation is honoured |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Define post-call provenance before using prompt identity

When load_skill reads a supporting file, it does so only after a model response, but RunPromptIdentity is constructed and persisted before the first provider request and its wire type only records pre-run selected_guidance. WP1 therefore cannot satisfy this acceptance within the listed paths: mutating prompt identity later would redefine the authoritative record, while adding dynamic guidance requires a versioned qq-protocol and persistence/fixture design. Choose a durable transcript receipt or a separate versioned provenance record and scope those changes before WP1.

AGENTS.md reference: AGENTS.md:L137-L142

Useful? React with 👍 / 👎.

| --- | --- | --- | --- | --- |
| WP0 | Plan, ADR-0057, ledger, Linear issues | none | `docs/plans/workflow-packs.md`, ledger, `docs/adr/0057-*`, root reservation | Docs review |
| WP1 | `load_skill` supporting files (G1) | WP0 | `qq-core` `workspace/{skills,guidance,prepare}.rs`, `tools/specs.rs`, `runtime/prompt.rs`; `docs/design/tools.md` | Loads a file from a pack root and from a workspace root. Refuses `..`, absolute paths, symlink escapes, non-UTF-8, over 64 KiB, and a command with `file`. An unknown file is a tool error. Prompt identity records the file hash. Cancellation is honoured |
| WP2 | Delegate skill pull (G2) | WP0 | `qq-core` `RunCapabilities`, `sessions/execution.rs`, `plan.rs` prefix keys; `docs/design/tools.md` | A read child calls `load_skill`. A child task starting with `/name` is not selected. Summarizer and run keys stay equal (golden test). `context_assembly` bench before and after. Second reviewer |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add the run loop to WP2 ownership

WP2 cannot remain within its declared owned paths: crates/qq-core/src/runtime/run_loop.rs currently destructures allow_guidance, gates slash parsing, maps it to StaticFilter::load_skill, and constructs PromptPrefixKey::guidance. Splitting selection from pulling and enabling only pulling for child runs necessarily changes that file, while docs/plans/workflow.md treats edits outside owned paths as blocking. Add the run-loop path, and name the lib.rs path containing RunCapabilities, to the slice ownership.

Useful? React with 👍 / 👎.

| WP2 | Delegate skill pull (G2) | WP0 | `qq-core` `RunCapabilities`, `sessions/execution.rs`, `plan.rs` prefix keys; `docs/design/tools.md` | A read child calls `load_skill`. A child task starting with `/name` is not selected. Summarizer and run keys stay equal (golden test). `context_assembly` bench before and after. Second reviewer |
| WP3 | Shared library in `.qq/skills/` | WP1 | `.qq/skills/{principles,plain-prose,test-first,check-the-number,decision-log}`, `design-skill-or-pack` | Capabilities list them. `load_skill principles prove-it-works.md` records a hash. Persona-budget test added |
| WP4 | `deep` pack: persona, playbooks, `how`, `why`, `arena`, `swarm`, `interrogate`, `custom-playbook`, `deep-help` | WP2, WP3 | `.qq/packs/deep/` | `qq config show` lists `[email protected]`. Each workflow runs once on a real repository question within child bounds. Prefix bytes and turn-2 cache reads recorded |
| WP5 | `deep-setup`, `reflect`, `correct` | WP3 | `.qq/skills/` or a pack (Open decision 2) | Two runs of `deep-setup` produce byte-identical output that keeps `write_children` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Verify every delegation field setup must preserve

With a pre-existing non-default max_depth or default_role, an implementation can reset those values and still satisfy this acceptance because it checks only write_children, despite the behavior section requiring all three fields to survive whole-section replacement. Require both setup runs to preserve max_depth and default_role as well, so the test covers the promised public behavior rather than merely byte-identical incorrect output.

AGENTS.md reference: AGENTS.md:L148-L149

Useful? React with 👍 / 👎.

directory.
- The file follows the same contract as `SKILL.md`: a regular UTF-8 file of
at most 64 KiB, read from the same opened root.
- Paths containing `..`, absolute paths and symlink escapes are refused.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Confine canonical targets to the selected skill directory

A request can contain no .. yet still escape its selected skill through a symlink such as .qq/skills/a/ref -> ../b/private.md. The existing Workspace::contained_path canonicalizes relative to the whole workspace or pack root, so that sibling target remains valid even though the decision says file is relative to the skill directory and follows fx's directory-confined behavior. Specify that the canonical target must remain beneath <skill>/ and add a sibling/intra-pack symlink case rather than testing only escapes from the workspace.

Useful? React with 👍 / 👎.

Comment on lines +49 to +50
- A child's cached prompt prefix grows by the skill index, at most
64 × 512 bytes. WP2 measures this with the `context_assembly` bench.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bound the rendered child skill prefix, not descriptions alone

The 512-byte constant bounds only each description, not the rendered index entry: every entry also includes an up-to-64-byte name, kind, punctuation and newline, and truncation appends a multibyte ellipsis after the limit. At 64 maximal entries the index is roughly 38 KiB rather than the claimed 32 KiB, before the header and newly exposed load_skill schema. Correct the worst-case bound so the WP2 measurement and cache-cost assessment cover the resource actually added to every child request.

AGENTS.md reference: AGENTS.md:L83-L84

Useful? React with 👍 / 👎.

Comment on lines +165 to +166
- Roster roles: `fast` for breadth, `balanced` for code, `strong` for the
hardest work and for judgment.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Make deep delegation conditional on the available roster

On a clean checkout or any configuration without all three roles, these persona instructions cannot be followed: pack manifests cannot declare a delegation roster, the checked-in .qq/config.ron declares only write_children, and spawn_agent includes role only when a roster exists, with its enum limited to roles actually configured. WP4 also does not depend on the later setup slice, so deep can emit schema-invalid role calls. Make the persona use only roles present in the rendered roster, or add a setup/configuration dependency and acceptance cases for empty and partial rosters.

Useful? React with 👍 / 👎.

| WP4 | `deep` pack: persona, playbooks, `how`, `why`, `arena`, `swarm`, `interrogate`, `custom-playbook`, `deep-help` | WP2, WP3 | `.qq/packs/deep/` | `qq config show` lists `[email protected]`. Each workflow runs once on a real repository question within child bounds. Prefix bytes and turn-2 cache reads recorded |
| WP5 | `deep-setup`, `reflect`, `correct` | WP3 | `.qq/skills/` or a pack (Open decision 2) | Two runs of `deep-setup` produce byte-identical output that keeps `write_children` |
| WP6 | Retrofit `reviewer`, `perf`, `protocol` onto the shared library; `perf` playbooks | WP3 | `.qq/packs/{reviewer,perf,protocol}/` | Persona rules that duplicate the library are removed; budgets pass |
| WP7 | Guide page | WP4 | `docs/guide/` (GE1/GE3) | Shows `/profile deep` and the pack and library layout |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fold WP7 into the existing guide slices

GE1 already owns the planned agents.md coverage for profiles and packs, while GE3 owns skills.md; neither page exists yet, and both slices require sidebar and docs-truth changes. WP7 instead depends only on WP4, owns all of docs/guide/, and names neither a page nor those required companion paths, so it would either duplicate that documentation or conflict with the existing guide slices. Fold this work into GE1/GE3, or add explicit dependencies and precise page, sidebar, and test ownership.

Useful? React with 👍 / 👎.

| WP1 | `load_skill` supporting files (G1) | WP0 | `qq-core` `workspace/{skills,guidance,prepare}.rs`, `tools/specs.rs`, `runtime/prompt.rs`; `docs/design/tools.md` | Loads a file from a pack root and from a workspace root. Refuses `..`, absolute paths, symlink escapes, non-UTF-8, over 64 KiB, and a command with `file`. An unknown file is a tool error. Prompt identity records the file hash. Cancellation is honoured |
| WP2 | Delegate skill pull (G2) | WP0 | `qq-core` `RunCapabilities`, `sessions/execution.rs`, `plan.rs` prefix keys; `docs/design/tools.md` | A read child calls `load_skill`. A child task starting with `/name` is not selected. Summarizer and run keys stay equal (golden test). `context_assembly` bench before and after. Second reviewer |
| WP3 | Shared library in `.qq/skills/` | WP1 | `.qq/skills/{principles,plain-prose,test-first,check-the-number,decision-log}`, `design-skill-or-pack` | Capabilities list them. `load_skill principles prove-it-works.md` records a hash. Persona-budget test added |
| WP4 | `deep` pack: persona, playbooks, `how`, `why`, `arena`, `swarm`, `interrogate`, `custom-playbook`, `deep-help` | WP2, WP3 | `.qq/packs/deep/` | `qq config show` lists `[email protected]`. Each workflow runs once on a real repository question within child bounds. Prefix bytes and turn-2 cache reads recorded |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Gate deep on the runtime that supports its skill schema

The deep pack depends on WP1's new load_skill.file argument and WP2's child-pull behavior, but this acceptance checks only that the profile is listed and never pins requires.protocol to a post-WP1/WP2 runtime. An older QQ can therefore accept and display the pack, then reject its supporting-file calls or omit the skills its children need. Reserve the compatibility version, require it in pack.ron, and test that the immediately previous runtime refuses the pack.

Useful? React with 👍 / 👎.

Comment on lines +220 to +222
| WP4 | `deep` pack: persona, playbooks, `how`, `why`, `arena`, `swarm`, `interrogate`, `custom-playbook`, `deep-help` | WP2, WP3 | `.qq/packs/deep/` | `qq config show` lists `[email protected]`. Each workflow runs once on a real repository question within child bounds. Prefix bytes and turn-2 cache reads recorded |
| WP5 | `deep-setup`, `reflect`, `correct` | WP3 | `.qq/skills/` or a pack (Open decision 2) | Two runs of `deep-setup` produce byte-identical output that keeps `write_children` |
| WP6 | Retrofit `reviewer`, `perf`, `protocol` onto the shared library; `perf` playbooks | WP3 | `.qq/packs/{reviewer,perf,protocol}/` | Persona rules that duplicate the library are removed; budgets pass |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Specify observable behavior for every named workflow

The plan names the WP4 workflows, WP5's reflect and correct, and WP6's hillclimb and trace-forensics without defining their triggers, delegation pattern, inputs, outputs, or failure behavior. The current acceptance can therefore pass with empty or no-op skills: “runs once” observes no result, WP5 tests only deep-setup, and WP6 checks only deduplication and size. Define an observable contract and focused acceptance for each shipped workflow.

AGENTS.md reference: AGENTS.md:L148-L149

Useful? React with 👍 / 👎.

| WP5 | `deep-setup`, `reflect`, `correct` | WP3 | `.qq/skills/` or a pack (Open decision 2) | Two runs of `deep-setup` produce byte-identical output that keeps `write_children` |
| WP6 | Retrofit `reviewer`, `perf`, `protocol` onto the shared library; `perf` playbooks | WP3 | `.qq/packs/{reviewer,perf,protocol}/` | Persona rules that duplicate the library are removed; budgets pass |
| WP7 | Guide page | WP4 | `docs/guide/` (GE1/GE3) | Shows `/profile deep` and the pack and library layout |
| WP8 | Proposed: `spawn_agent { profile }` so `deep` hands review to `reviewer` (ADR-0058, if accepted) | WP2 | `qq-core` `tools/specs.rs`, `sessions/subagents.rs` | Open decision 1 |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require independent review for WP8's sessions change

If open decision 1 accepts WP8, the slice explicitly modifies sessions/subagents.rs, but unlike WP2 its acceptance and ledger note omit the independent second review required by docs/plans/workflow.md for every sessions/ change. Add that review gate to WP8's conditional acceptance before the slice becomes dispatchable.

Useful? React with 👍 / 👎.

lg2m added a commit that referenced this pull request Oct 13, 2026
PR #277 (workflow packs WP0) proposed ADR-0057 on 2026-10-09, before the
T19 reservation. Record its row and move T19 to 0058; next free is 0059.
lg2m added a commit that referenced this pull request Oct 13, 2026
… matches

- if_hash mismatch on edit_file and write_file no longer names the
  current hash (it would authorize the refused edit on the next call)
- uniqueness counts overlapping occurrences (aa in aaa is two)
- a later if_hash no longer erases note=unread/changed_since_read

Also renumbers the ADR to 0058 (#277 holds 0057). ENG-1030.
@lg2m lg2m closed this Oct 15, 2026
@lg2m
lg2m deleted the docs/eng-1019-workflow-packs branch October 15, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant