From b0fc1a26ca26febeefd43474ae2957d289dac48d Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Wed, 21 Oct 2026 05:01:37 -0500 Subject: [PATCH 1/5] docs(repo): deepen concept-research skill steps and document outline --- .agents/skills/concept-research/SKILL.md | 81 +++++++---- .../references/document-outline.md | 135 ++++++++++++++++++ 2 files changed, 191 insertions(+), 25 deletions(-) create mode 100644 .agents/skills/concept-research/references/document-outline.md diff --git a/.agents/skills/concept-research/SKILL.md b/.agents/skills/concept-research/SKILL.md index 694ad4947c..02ade2b96f 100644 --- a/.agents/skills/concept-research/SKILL.md +++ b/.agents/skills/concept-research/SKILL.md @@ -1,42 +1,73 @@ --- name: concept-research -description: Conduct deep factual research for a single concept, steelmanning alternatives, documenting use cases, and analyzing risks. Use during Stage 2 concept investigation. +description: "Write the definitive research document for one concept of a workflow research package (doc/_research_/concepts/C001-.md) at stage S2: restate the request, then cover every facet, feasibility, state of the art, prior art and example projects, labelled anecdotes, steelmanned alternatives, risks, open questions and preliminary recommendations, with typed sources cited only from tool results, a research log and a change log. Runs read-only research subagents per facet while the concept owner stays the only writer, sends cross-concept notes, and records refinements as items directly below what they refine. Use when a concept's S1 preparation or research issue is done and its full research should start, resume or go deeper. For mapping the repo and writing research questions first use research-prepare; for the final note sweep use notes-reconcile; for a research question outside a package use research." --- -# Concept Research (Stage 2) +# Concept research (S2) -Execute deep factual research and architectural analysis for a single concept. Full contracts live in [/planning/workflow/stages.md](/planning/workflow/stages.md) and [/planning/DEPENDENCIES.md](/planning/DEPENDENCIES.md). +You own one concept file, `concepts/C001-.md`, and turn it into the definitive document for that concept: everything a later design, plan or implementation agent needs, every claim traceable to a source, and nothing from earlier stages lost. There is no length limit; later runs add more detail. The stage contract is in [stages.md](/planning/workflow/stages.md), file formats in [records.md](/planning/workflow/records.md), and the concept template in [templates](/planning/workflow/templates/) (`concept.md`). -## Procedure +Commands below are `python3 -I scripts/research_workflow.py `, run from the repository root; `` is the package folder `doc/_research_`. Run ` --help` for argument names. -1. **Verify Ownership**: - Confirm lease and own branch/worktree. Read the concept document and prepare angles. +## Load or not -2. **Conduct Factual Research**: - Investigate official specs, source repositories, practitioner experiences, and local codebase patterns. Cite only URLs returned by tools. Label inference and unconfirmed statements explicitly. +Load for: -3. **Steelman Alternatives**: - Document at least two realistic architectural alternatives, providing strong cases for and against each. +- running or resuming a package concept's research issue (`Research: (·C001)`); +- deepening an existing concept document: more facets, sources, alternatives or risks; +- answering "research everything about C003 so a designer needs nothing else". -4. **Risk & Failure Mode Analysis**: - Construct a risk matrix covering likelihood, severity, preventive mitigation, and contingent fallback. +Do not load for: -5. **Cross-Concept Communication**: - If research uncovers dependencies or impacts on another concept, write an immutable note: +- mapping the repository and writing research questions before research: `research-prepare`; +- the final sweep of notes and receipts after research: `notes-reconcile`; +- writing the GitHub handoff or fan-out issues: `issue-handoff`; +- choosing between options or writing decision records: `design-orchestrate`; +- a research question that belongs to no package concept: `research`. - ```sh - python3 scripts/research_workflow.py note --package --from CXXX --to CYYY --input /tmp/note.md - ``` +## Ownership and parallelism -6. **Update Concept Record**: - Update `concepts/CXXX-.md` with detailed findings, cite all sources, update the concept state block, and commit. +Many concept owners run at once, one per concept, so nothing here waits on another concept. You are the only writer of your concept file, your outgoing notes and your receipts. Facet subagents are read-only: they return evidence and never write in the repository. In `main.md` you touch only your concept's section, and only through your own pull request. Anything for another concept goes in a note; anything else wide goes through a PR. Boot, branch, lease, heartbeat and final-report rules are in [collaboration.md](/planning/workflow/collaboration.md); follow them, do not restate them. -## Turn Report +## Steps + +1. **Claim and boot.** Follow the worker boot in collaboration.md: git env, fresh worktree from `origin/main`, your own branch (the brief's name, else `wf//C001-s2`), push it empty. Take the concept lease with `lease acquire` and renew it before it expires. Append a `start` line to your live log. + Done when `lease list` shows your lease, `git ls-remote origin ` shows the branch, and the log has `start`. +2. **Read the inputs.** Read the concept file (S0 excerpts and thoughts, the S1 repo map and research questions), its research issue, the concept's section of `main.md`, the "Reading of garbled input" register, and every transcript segment the state block lists (`ids` resolves allocated ids; never invent one). Run `check --package --remote-notes` and read every note already addressed to you. + Done when you can list each segment and each S1 question for this concept, and each note addressed to it. +3. **Restate the request and fix the facets.** Write "Request restated" (segment ids, assumptions, inference labelled). List the facets: every S1 question, every distinct sub-topic in the segments, and every idea that was hinted, implied or missed but belongs in the record. Give each facet a tool-allocated item id with `item add` under the concept in `main.md` (for example `C001.4`), and use that id as the facet's heading in the concept file. + Done when every segment and every S1 question maps to at least one facet, and every facet has an id. +4. **Research the facets in parallel.** Write one brief in a scratch directory outside the repository and launch one read-only subagent per facet, or per cluster of small facets, with disjoint scopes. Research the repository yourself where the facet needs measured facts (`path:line` at a recorded SHA). Read `references/facet-subagents.md` first. + Done when every facet has evidence back, or an explicit "one source only" or "no source found" with the queries tried. +5. **Verify before writing.** Re-fetch every page you will cite, match each quote exactly and check the heading above it, re-measure every number and every subagent claim you will repeat, and re-run repository commands at your SHA. Read `references/citations.md`. + Done when every `[n]` traces to a page fetched in this run and every number states its sample and scope. +6. **Write the document.** Add the sections in `references/document-outline.md`, in order, below what S0 and S1 wrote: facets, feasibility, state of the art, prior art and example projects, use cases and labelled anecdotes, steelmanned alternatives, risks, open questions, preliminary recommendations, cross-concept notes, unsourced ideas (each argued for and against), sources, research log, change log. Commit and push after each large section so a restart loses little. + Done when every section exists or says in one line why it does not apply, and every fact carries `[n]`, `[unsourced]` or "Inference:". +7. **Refine, never overwrite.** Earlier text stays. When research clarifies, supersedes or retracts an earlier item, add the refinement as a child directly below it with `item add`, then prepend the new status to the earlier item with `item set-status` (`clarified`, `superseded` or `retracted`, with one sentence such as "More nuanced than S0 thought; see C001.2.1"). In the concept file, write the refinement directly below the text it refines, carrying the same item id. + Done when `check --package ` passes and `git diff origin/main -- ` deletes no earlier line except where a status prefix was added. +8. **Exchange notes as you go.** When a finding affects another concept, send `note --package --from C001 --to C00N --input ` (one topic per note; say what you found, the evidence, and what you suggest). Answer notes addressed to you while you work with `resolve-note` (see the notes-reconcile skill's `references/receipts.md` for dispositions) instead of leaving them all for S3. Re-run `check --package --remote-notes` before you finish. + Done when "Cross-concept notes" lists every note you sent and every note received so far, each with its receipt or "pending S3". +9. **Update state and logs.** In the state block set `stage` to `S2`, update `relations` from the feasibility section, and append a `history` entry. Add a change-log line at the bottom of the concept file and one line to the package `changes.md`. Run `render` and commit only the hunks inside your concept's own sections; the router refreshes shared views such as the run table. + Done when `check --package ` and `check --changed-since origin/main` pass. +10. **Publish and report.** Format your files (`prettier --write`), merge `origin/main` into your branch, push, open a ready PR into `main` whose body says what, why, evidence and what is not verified, record the PR in the state block, `lease release`, and append `end` to your log. + Done when `git ls-remote origin ` equals the PR head and the SHA in your report. + +## References + +- `references/document-outline.md`: the section list and what each section must hold. Read at steps 3 and 6. +- `references/citations.md`: source, citation, quote and count rules, and the unsourced-ideas format. Read before step 4 and again at step 5. +- `references/facet-subagents.md`: the facet brief, the return format and how to merge results. Read at step 4. + +## Turn report End every turn with: -- Done: -- Verified: -- Remaining: -- Questions (non-blocking): default> -- Blocked on user: +```text +Done: +Verified: result>, ... +Remaining: merges"> +Questions (non-blocking): default being used>, or "none" +Blocked on user: , or "none" +``` + +The final turn also gives the branch, the PR URL, the last pushed SHA and the counts of facets, sources and `[unsourced]` claims. diff --git a/.agents/skills/concept-research/references/document-outline.md b/.agents/skills/concept-research/references/document-outline.md new file mode 100644 index 0000000000..fe121767c9 --- /dev/null +++ b/.agents/skills/concept-research/references/document-outline.md @@ -0,0 +1,135 @@ +# Concept document outline (S2) + +The concept file is the definitive document for one concept. Keep everything S0 and S1 wrote at the top, unchanged: the title, the `workflow-state` block, the links to `main.md` and the transcript, the transcript excerpts, the normalized purpose, the initial thoughts, the inferred suggestions, the S1 repository map and the S1 research questions. S2 adds the sections below, in this order, after that material. + +Headings are fixed so that later stages, `check` and readers find them. A section that does not apply stays, with one line saying why. There is no length limit. Later stages and later S2 runs add to these sections; they never delete from them. + +## Writing rules for every section + +- Every factual sentence carries `[n]`, `[unsourced]` or starts with "Inference:" (`citations.md`). +- Prefer `-` bullets, `**bold**`, backticks and links. Avoid tables: a one-cell edit reflows the whole table and makes merges hard. +- Refinements go directly below what they refine and carry the item id and status trail used in `main.md`: + + ```markdown + - **C001.2** `clarified` · S2 · 2026-10-21T10:00:00Z — More nuanced than S0 thought; see C001.2.1. ← `created` · S0 · 2026-10-19T06:09:02Z + - **C001.2.1** `created` · S2 · 2026-10-21T10:00:00Z — The nuance, with its evidence [4]. + ``` + +- Repository facts give `path:line` and the SHA they were read at. State that SHA once at the top of the S2 material ("Repository facts verified at ``, ``"). + +## Sections + +### `## Request restated` + +- What the user asked for in this concept, in clean words, with the segment ids it comes from (`T012-T014`). +- Ideas that were only hinted at, implied or garbled, each labelled "Inference:", with the reading taken from the garbled-input register in `main.md`. +- Assumptions made, each with the default used. +- What is out of scope for this concept and which concept holds it instead. + +### `## Summary of findings` + +Five to ten bullets with the findings a designer must not miss, each cited. Point to the facet or section that holds the detail. + +### `## Facets` + +One `### C001.N ` sub-section per facet, using the tool-allocated item id. Each holds: + +- **Question:** the facet's research questions, with their S1 ids where they exist. +- **In this repository now:** what exists, with `path:line`, the command run and its output. Say "nothing found" with the searches run when nothing exists. +- **Findings:** what the sources say, cited. +- **How others do it:** at least two projects, tools or harnesses when two exist, or a line saying why only one applies. +- **Pitfalls:** failure modes, with evidence. +- **Open questions:** what this facet still does not know (also listed in "Open questions"). +- **Verdict:** one or two sentences and a confidence (`high`, `medium`, `low`) with what drives it. + +### `## Feasibility` + +- Technical feasibility: what exists, what is missing, and the constraints of this repository (for example stdlib-only Python for workflow tooling, the Nix flake, formatters in `treefmt.toml`). +- Effort: a size (`S`, `M`, `L`, `XL`) and what drives it. +- Dependencies on other concepts, each as a relation kind (`requires`, `recommended-after`, `shares-files-with`, `conflicts-with`, `enables`, `optional-if`) with its reason. The same relations go into the state block. +- Verdict: `feasible`, `feasible with conditions` (list them) or `not feasible` (say what would change that). + +### `## State of the art` + +Current best practice and the most advanced techniques in use, each dated, because these move fast. Name the version or date each source describes. + +### `## Prior art and example projects` + +One bullet per project or system: name and link `[n]`, what it does like this concept, what it does differently, and the lesson for us. Include projects in this repository and in its other packages. + +### `## Use cases and anecdotes` + +- Use cases the concept must serve: stated ones with segment ids, inferred ones labelled. +- Anecdotes, presented as anecdotes ("one user reports [12]"), with the source type `anecdote` or `forum` in Sources. Never generalise from one report; state how many reports you found and where you looked. + +### `## Alternatives` + +At least two realistic alternatives, one of which is the smallest thing that could work (or doing nothing). For each: + +- what it is; +- **For:** the strongest honest case for it (steelman), cited; +- **Against:** the strongest case against it, cited; +- **Wins when:** the conditions under which it is the best choice; +- **Switching cost later:** what it costs to move off it. + +Do not pick here. The pick is a preliminary recommendation, and the decision record comes at S6. + +### `## Risks` + +One bullet per risk: what can go wrong, likelihood, impact, the early signal, the mitigation, the fallback if it happens anyway, and the evidence. + +### `## Open questions` + +One bullet per question, ranked by how much the answer changes what we do: + +- the question and why it matters (what changes with each answer); +- the default assumed until it is answered; +- who or what can answer it: the human, more research, a prototype; +- what it blocks. + +Never list a question the transcript already answers; cite the segment instead. + +### `## Preliminary recommendations` + +One bullet per recommendation, each marked `agent-preliminary`: + +- the recommendation and the alternative it prefers; +- the rationale, cited; +- the confidence and the evidence that would change it; +- the reversal cost and the items it affects. + +These are not decisions. Only the decision protocol in [decisions.md](/planning/workflow/decisions.md) records decisions, and nothing downstream may promote an `agent-preliminary` item to confirmed. + +### `## Cross-concept notes` + +- **Sent:** link to each note file, the receiver, and a one-line subject. +- **Received:** link to each note, the sender, and its receipt with the disposition, or "pending S3". +- **Related concepts:** each related concept with the relation kind and a one-line reason. + +### `## Unsourced ideas` + +Every idea no source supports: ideas from the transcript that no source confirms, and recommendations that rest on `[unsourced]` claims. Number them. Each is marked `[unsourced]` and carries these labels: + +- what it is; +- `For: Inference:` the strongest reason it may be right; +- `Against: Inference:` the strongest reason it may be wrong, cost too much or not apply; +- `Apply/test:` how to apply it, or how to test it cheaply; +- `Nearest:` the nearest source, or "none". + +An idea is never dropped because it has no source. + +### `## Sources` + +Numbered by first use: `1. . <Author or publisher>, <date or "undated">. <URL>. <type>`. Repository sources give the path and SHA with type `repo`. Rules are in `citations.md`. + +### `## Research log` + +- Date, session and agent name for each run. +- Subagents launched, each with its scope and the evidence file it returned. +- Queries run, per facet; pages fetched; sources rejected and why. +- Retrieval fallbacks used (the repository's web-retrieval fallback protocol in `AGENTS.md`), and what failed. +- What was searched for and not found. + +### `## Change log` + +Add-only, oldest first, one line per major change: `- <UTC> · S2 · <agent> — <what changed and why>`. Minor fixes need no line. Each major change also gets one line in the package `changes.md`. From 6f5aaee797b04335dfec464583aca0c4dc3d6bd5 Mon Sep 17 00:00:00 2001 From: Drewry Pope <drewrypope@gmail.com> Date: Wed, 21 Oct 2026 10:01:14 -0500 Subject: [PATCH 2/5] docs(repo): add concept-research citation and facet-subagent references --- .../concept-research/references/citations.md | 60 ++++++++++++++++ .../references/facet-subagents.md | 71 +++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 .agents/skills/concept-research/references/citations.md create mode 100644 .agents/skills/concept-research/references/facet-subagents.md diff --git a/.agents/skills/concept-research/references/citations.md b/.agents/skills/concept-research/references/citations.md new file mode 100644 index 0000000000..8cc8f2c81f --- /dev/null +++ b/.agents/skills/concept-research/references/citations.md @@ -0,0 +1,60 @@ +# Sources, citations and evidence (S2) + +These rules adapt the cairn research spec (`~/git/cairn/SPEC.md`, rules 3 to 5 and 9, and its quality checklist) to concept documents. Cairn's spec is the long form; where the two disagree for a concept document, this file wins. + +## Every fact has a label + +- A fact from a source found in this run carries `[n]`, matching the numbered Sources list. +- A fact from memory, or a claim from the transcript or a note that no source in this run confirms, is allowed when marked `[unsourced]`. It never counts toward a facet's two sources. +- Your own reasoning starts with "Inference:". +- Nothing is dropped for lack of a source. It goes under "Unsourced ideas" with a case for and a case against. + +## Cite only what a tool returned + +- Every URL in the document appeared in a search result or a page fetch in this run, copied exactly. Never build, guess or normalize a URL, including GitHub or Hacker News URLs that look predictable. +- When a page redirected, cite the final URL. +- Record the publication or update date when the page shows one; otherwise write "undated". +- When a site blocks plain requests, follow the web-retrieval fallback protocol in `AGENTS.md` (the `web-retrieval-fallback` skill) and record what you tried in the research log. + +## Sources are typed and weighted + +Each Sources entry ends with its type: `docs`, `spec`, `paper`, `repo`, `issue`, `blog`, `forum`, `talk` or `anecdote`. + +When sources conflict, weight them in this order and record the conflict in the facet and the research log: + +1. docs and specs; +2. papers and blogs by the people who built the thing; +3. practitioner posts and repositories; +4. comments and anecdotes. + +The text presents an anecdote as one ("one user reports [12]"), and every count of reports states where you looked. + +## Quotes, numbers and repository facts + +- A quote is copied exactly, at most 25 words, and is about the same thing as the claim it supports. Read the heading above it before using it. A paraphrase is not a quote. +- Every count states its sample and scope: "11 of the last 100 issues", never "the issues". A claim about a whole set needs the whole set queried, or it says "sampled k of N". +- A repository fact gives `path:line`, the SHA it was read at, and the command and output where one was run. A negative claim names the search ("`rg -n 'remote-notes' scripts/` returns nothing at `<sha>`"). +- Re-measure anything a subagent or a note reports before you repeat it. Restating a report is not verifying it; keep its hedges. + +## Two sources per facet + +Each facet ends with at least two independent sources, or an explicit "one source only" or "no source found" with the queries tried. `[unsourced]` claims do not count. + +## Numbering and later runs + +- Number sources by first use. One number per exact URL; merge duplicates. +- Later runs append new sources after the last number. Never renumber: renumbering rewrites every citation line and hides what changed. +- A source that turns out wrong stays listed with "(withdrawn <UTC>: <reason>)", and the claims that used it are refined below, not deleted. + +## Public repository + +This repository is public. Nothing private goes in: no secrets, no credentials, no company-internal material, no personal data. When a source is private, describe it generically and keep the exact anchor outside the repository. + +## Checklist before publishing + +- Every factual sentence has `[n]`, `[unsourced]` or "Inference:". +- Every URL came from a tool result in this run. +- Every source ends with its type, and anecdotes read as anecdotes. +- Every quote matched its re-fetched page; every count has its sample and scope. +- Every facet has two sources or says why not. +- Every unsourced idea has a case for and a case against. diff --git a/.agents/skills/concept-research/references/facet-subagents.md b/.agents/skills/concept-research/references/facet-subagents.md new file mode 100644 index 0000000000..b25746bd60 --- /dev/null +++ b/.agents/skills/concept-research/references/facet-subagents.md @@ -0,0 +1,71 @@ +# Facet research subagents (S2) + +The concept owner fans out read-only subagents, one per facet or per cluster of small facets, and stays the only writer of the concept document. This file is the brief and the merge procedure. It adapts cairn's `research-capture/references/brief-template.md` and `agents/researcher.md`. + +## Shape of the fan-out + +- **Scopes are disjoint.** No facet belongs to two subagents. Each brief lists the facets to skip because a sibling owns them. +- **Read-only.** Subagents need no worktree, branch or lease. They never write in any repository checkout. They return evidence in their final message, or write exactly one evidence file in the scratch directory when the brief names one. +- **Leaves.** Subagents do not launch subagents of their own. +- **Parallel.** Launch them all at once. If the harness runs fewer at a time than there are facets, run them in rounds, largest facets first. +- **Sized.** Each subagent's scope fits one fresh session. A facet too large for one session is split before launch. + +## Scratch directory + +Create one scratch directory per run outside the repository (for example `mktemp -d`). It holds the brief, the evidence files and any fetched-page cache. Nothing in it is committed. The research log in the concept document names each subagent, its scope and what it returned. + +## Brief + +Write the brief once and point every subagent at it. Give each its scope line in the launch message. + +```markdown +# <package>·C001 <concept title>: facet evidence + +The concept owner writes the concept document; you collect evidence only. +Concept document: <full GitHub URL or repository path>. Transcript segments: <ids>. +Main reference section: <link>. Research questions from S1: <ids and text>. + +## Your scope + +- Facets you own: <C001.N title, its questions>. +- Facets you skip (a sibling owns them): <list>. +- Preferred sources: official docs and specs first, then builders' write-ups and papers, then practitioners' repositories, issues and forum threads, then anecdotes. +- Angles: how at least two projects or harnesses handle it; best practice; advanced techniques; failure reports and critiques; example projects; user anecdotes. + +## Boundaries + +- Read-only. Allowed: reading files, `git log/show/grep`, read-only `gh api` GETs, web search and fetch. +- Never write in the repository, push, open issues or PRs, or read secret values. Do not launch subagents. +- Write nothing, or exactly <scratch>/<prefix>.md if named here. No helper or temporary files. + +## Return + +1. One line per source: `S | key | title | publisher | date or undated | exact returned URL | type` + (type: docs, spec, paper, repo, issue, blog, forum, talk, anecdote). Keys start with `<prefix>-`. +2. At least one line per source: `C | key | "exact quote of at most 25 words" | claim it supports`. +3. Repository facts: `R | path:line | sha | command | what it shows`. +4. Per facet: findings, pitfalls, open questions, and a verdict with confidence. +5. Conflicts between sources. +6. What you searched for and did not find, with the queries. +7. Each unsourced idea in scope: what it is, `For: Inference:`, `Against: Inference:`, `Apply/test:`, `Nearest:`. + +Every count gives n of N and its scope. Copy URLs exactly as a tool returned them; never build one. +``` + +## Known failures to guard against + +From cairn's research logs; each happened. + +1. Subagents told in prose not to write files wrote helper files anyway. Grant only read tools where the harness allows, and list the scratch directory and `git status` afterwards. +2. A sample was reported as the whole population. Require "n of N" on every count. +3. A quote was applied to the wrong claim. Require the heading check, and re-check it yourself. +4. An error was relayed from a subagent's notes. Re-measure before repeating. + +## Merging the results + +1. Collect every `S`, `C` and `R` line. Merge keys that share an exact URL. +2. Re-fetch each cited page and match each quote exactly (step 5 of the skill). Drop or re-source any quote that does not match. +3. Re-run the repository commands at your SHA. +4. Assign `[n]` numbers by first use in the document. +5. Write the facet sections yourself. Copy no subagent prose verbatim without checking it. +6. Record each subagent, its scope and its result in the research log, including what it could not find. From 67c183fbc44cb09315e86571bbcc1d54bfefeada Mon Sep 17 00:00:00 2001 From: Drewry Pope <drewrypope@gmail.com> Date: Wed, 21 Oct 2026 10:03:26 -0500 Subject: [PATCH 3/5] docs(repo): deepen notes-reconcile skill with receipts and remote-note scans --- .agents/skills/notes-reconcile/SKILL.md | 79 ++++++++++++------- .../notes-reconcile/references/receipts.md | 59 ++++++++++++++ 2 files changed, 110 insertions(+), 28 deletions(-) create mode 100644 .agents/skills/notes-reconcile/references/receipts.md diff --git a/.agents/skills/notes-reconcile/SKILL.md b/.agents/skills/notes-reconcile/SKILL.md index fda49ac047..691b3d3e38 100644 --- a/.agents/skills/notes-reconcile/SKILL.md +++ b/.agents/skills/notes-reconcile/SKILL.md @@ -1,44 +1,67 @@ --- name: notes-reconcile -description: Process cross-agent directed notes, record atomic resolution receipts, and update concept documents. Use during Stage 3 reconciliation before handoff. +description: "Close out the directed notes for one concept of a workflow research package at stage S3: gather every note addressed to it on the current branch and on remote refs (check --remote-notes), write one receipt per note (incorporated, acknowledged, declined, deferred or superseded, each with a target and a reason), bring accepted changes into the concept document, record which refs and SHAs were scanned, and finish without waiting for late notes, handing the concept to issue-handoff. Use after concept-research finishes a concept, when notes to a concept are pending, or to make sure every comment from other agents reached its document. For sending or answering a note while research is still running use concept-research; for the GitHub handoff issue use issue-handoff." --- -# Notes Reconcile (Stage 3) +# Notes reconcile (S3) -Incorporate, acknowledge, or decline all directed notes received by a concept, recording immutable receipts. Full rules live in [/planning/workflow/stages.md](/planning/workflow/stages.md) and [/planning/workflow/records.md](/planning/workflow/records.md). +You close out one concept's notes. Every note any agent sent to this concept ends with exactly one receipt, the concept document reflects what was accepted, and the scan you made is on record so a later note is provably late, not lost. Note and receipt formats are in [records.md](/planning/workflow/records.md); the stage contract is in [stages.md](/planning/workflow/stages.md). -## Procedure +Commands below are `python3 -I scripts/research_workflow.py <command>`, run from the repository root; `<pkg>` is the package folder `doc/<UTC>_research_<slug>`. Run `<command> --help` for argument names. -1. **Discover Unresolved Notes**: - Scan local and remote incoming notes: +## Load or not - ```sh - python3 scripts/research_workflow.py check --package <dir> - ``` +Load for: -2. **Evaluate & Incorporate**: - For each note addressed to your concept in `notes/`: - - Evaluate the notification or change request against your concept findings. - - If accepted, update the concept document with the change. - - If declined or deferred, document the technical rationale. +- reconciling the notes sent to a concept after its research PR merged; +- "are all the notes to C002 resolved?" or "make sure every comment from other agents reached C002"; +- a router report that a concept has pending notes, including notes found only on remote branches. -3. **Record Resolution Receipt**: +Do not load for: - ```sh - python3 scripts/research_workflow.py resolve-note --package <dir> --note <path> --disposition <incorporated|acknowledged|declined|superseded> --target <target-anchor> --reason "<rationale>" - ``` +- writing a note, or answering one while research is still running: `concept-research`; +- the research itself: `concept-research`; +- the parent handoff issue that follows: `issue-handoff`; +- review comments on a pull request: answer them in the PR; +- a decision between two concepts' conflicting proposals: `design-orchestrate`. -4. **Verify Full Reconciliation**: - ```sh - python3 scripts/research_workflow.py check --package <dir> --require-resolved - ``` +## Ownership and parallelism -## Turn Report +One agent per concept runs this stage, and the concepts reconcile in parallel. You are the concept's current owner: the only writer of its concept file and of the receipts for notes addressed to it. Notes are immutable and belong to their senders; you never edit, move or delete one. A change another concept must make goes back to it as a new note. `main.md` changes only inside this concept's section and only through your PR. Boot, lease, heartbeat and final-report rules are in [collaboration.md](/planning/workflow/collaboration.md). + +## Steps + +1. **Check the entry condition and boot.** The concept's S2 research PR is merged into `main` (`status --live --package <pkg>` shows it). If it is still open, stop: report "blocked: S2 PR <url> not merged" and leave the concept to the router. Otherwise boot per collaboration.md on your own branch (the brief's name, else `wf/<package-slug>/C001-s3`), push it empty, take the concept lease with `lease acquire`, and append `start` to your live log. + Done when the S2 PR is merged, your branch is pushed and `lease list` shows your lease. +2. **Gather every note.** `git fetch origin`, then run `check --package <pkg>` for unresolved notes on your branch and `check --package <pkg> --remote-notes` for notes addressed to this concept that sit only on `origin/*` refs. Record the scan in the concept file's `## Reconciliation` section: the UTC time and every scanned ref with its SHA (`git for-each-ref refs/remotes/origin --format='%(refname:short) %(objectname)'`). + Done when you have one list of every note addressed to the concept, each marked local or remote with its ref, and the scan is recorded. +3. **Bring remote notes in.** A note that exists only on another branch cannot be resolved here. Import it byte for byte with `git checkout <ref> -- <pkg>/notes/<note-file>`; the identical file merges cleanly when the sender's branch lands. Run `check --package <pkg>` to confirm its body hash, and record "imported from `<ref>` at `<sha>`" in the Reconciliation section. + Done when every note from step 2 is on your branch and `check` accepts each one. +4. **Decide each note.** Read the note, re-check its claims (a note is a report, not a source), and choose one disposition: `incorporated`, `acknowledged`, `declined`, `deferred` or `superseded`. Read `references/receipts.md` for when each applies and what its target and reason must say. Incorporate accepted changes the way concept-research does: the refinement goes directly below what it refines (`item add`, then `item set-status` on the earlier item), cited, and nothing earlier is deleted. A note asking for a change you do not own gets `acknowledged` or `deferred`, plus a reply note or a PR, as `receipts.md` says. + Done when every note has a chosen disposition and every `incorporated` change is in the document. +5. **Write the receipts.** One per note: `resolve-note --package <pkg> --note <pkg>/notes/<note-file> --disposition <disposition> --target <link inside the package> --reason "<reason>"`. Creation is exclusive, so a note that already has a receipt (for example from S2) keeps it: skip it and list it. Receipts are never edited; if your view changes later, record it as a new item in the document and, if the sender must act, send a new note. + Done when `check --package <pkg> --require-resolved` exits 0. +6. **Sync the document.** In `## Cross-concept notes`, list every received note with its sender, disposition and a link to its receipt. Set the state block's `stage` to `S3` and append a `history` entry; add a change-log line in the concept file and one line to `changes.md`. + Done when every note in `notes/` addressed to the concept appears in the document with a receipt link. +7. **Final scan, then finish.** Fetch and run `check --package <pkg> --remote-notes` once more just before pushing. Handle any new note with steps 3 to 6. Then stop: do not wait or poll for notes that may come later. A note that arrives after your recorded scan is post-reconciliation, and the router sends it to a new notes-reconcile run. + Done when the final scan is recorded and lists nothing pending. +8. **Publish and hand off.** Format your files (`prettier --write`), run `check --package <pkg>` and `check --changed-since origin/main`, merge `origin/main` into your branch, push, open a ready PR into `main`, record it in the state block, `lease release`, and append `end`. + Done when `git ls-remote origin <branch>` equals the PR head and the reported SHA, and the turn report names `issue-handoff` mode `parent` as next. + +## References + +- `references/receipts.md`: the five dispositions, target and reason rules, the deferred revisit trigger, the scan record, imported notes and late notes. Read before step 4. + +## Turn report End every turn with: -- Done: <notes processed and dispositions recorded> -- Verified: <check --require-resolved output> -- Remaining: <handoff to issue-handoff> -- Questions (non-blocking): <question -> default> -- Blocked on user: <blocker or none> +```text +Done: <notes found, receipts written by disposition, notes imported from remote refs> +Verified: <check --require-resolved -> exit 0>, <check --remote-notes -> none pending>, ... +Remaining: <"issue-handoff mode parent for C001 after PR <url> merges", or what is left> +Questions (non-blocking): <question -> default being used>, or "none" +Blocked on user: <only what nothing else can proceed without>, or "none" +``` + +The final turn also gives the branch, the PR URL, the last pushed SHA and the scan time with its ref count. diff --git a/.agents/skills/notes-reconcile/references/receipts.md b/.agents/skills/notes-reconcile/references/receipts.md new file mode 100644 index 0000000000..b59ec138e5 --- /dev/null +++ b/.agents/skills/notes-reconcile/references/receipts.md @@ -0,0 +1,59 @@ +# Receipts, scans and late notes (S3) + +A receipt says what happened to one note. There is exactly one per note, written by the receiver (or by the reconciler on its behalf, who then records its own name), created exclusively, and never edited. `resolve-note` writes it; the receipt template is in `planning/workflow/templates/`. + +## The five dispositions + +Pick the one that says what happened. When two seem to fit, pick the one that asks least of the next reader. + +- **`incorporated`**: you changed the concept document because of the note. Target: the item or heading that now holds the change. Reason: what changed, in one sentence, and the evidence you checked. + Example reason: "Added C002.6.1 under C002.6: the lease lifetime is 20 minutes, verified in collaboration.md at 4063f248." +- **`acknowledged`**: the note is informational, or it is already reflected, so the document needs no change. Target: where the document already covers it, or the `Cross-concept notes` section. Reason: why no change is needed. + Example: "Already covered by C002.3; the note confirms it with a second source." +- **`declined`**: you considered the suggestion and will not adopt it. Target: the section holding the reasoning. Reason: why, with evidence. Send a reply note when the sender's own work depends on the answer. + Example: "Declined: per-note files avoid the append conflicts that a shared log causes (review-parallel-ops scenario 9); see C002.4." +- **`deferred`**: valid, but not for now. Target: the open question or item where it waits. Reason: why it waits, and a revisit trigger written as "Revisit when: <event>", such as a decision, a merge or a stage. + Example: "Needs the S6 storage decision. Revisit when: the decision record for storage is confirmed." +- **`superseded`**: a later note, a later finding, or a change in the sender's own concept made this note moot. Target: the superseding note or item. Reason: what replaced it. + +A note asking for a change in a file you do not own (another concept, `design.md`, `AGENTS.md`) cannot be `incorporated` by you. Use `acknowledged` when you only record it, or `deferred` with a trigger, and then either send a note to that file's owner or open a PR for a wide file, and link it from the reason. + +## Target rules + +- The target is a link inside the package: `concepts/C001-<slug>.md#<heading>`, `main.md#<heading>`, a note or a decision record. +- It must resolve. `check` validates links and heading anchors; run it after writing. +- Point at the item or heading that changed, not the top of the file. + +## Reason rules + +- One or two sentences. Say what you did and why, with the evidence: a source number, a `path:line` at a SHA, or a command and its result. +- Never restate the note; link it. +- A note's claim is a report. Re-measure it before you incorporate it, and say in the reason that you did. + +## Scan record + +The concept file's `## Reconciliation` section holds one entry per scan, add-only: + +```markdown +- Scan 2026-10-21T12:00:00Z by notes-reconcile-C002: 14 refs on origin. + - `origin/main` 4063f248 + - `origin/wf/pkg/C001-s2` 1a2b3c4d + - Pending found: 1 (imported from `origin/wf/pkg/C001-s2` at 1a2b3c4d: `notes/C001__to__C002__<id>.md`) +``` + +List every ref scanned, not only the ones with notes, so a later reader can prove what was and was not visible. The final scan of a run says "Pending found: 0". + +## Imported notes + +A note on an unmerged branch is imported byte for byte with `git checkout <ref> -- <path>`. The file stays the sender's: you neither edit nor reformat it (do not run a formatter over `notes/`). When the sender's branch merges, git sees the same file added on both sides and merges it cleanly. If `check` reports a body-hash mismatch, the note was edited after it was written: do not import it; record the problem in the Reconciliation section and send the sender a note. + +## Late notes + +You do not wait for notes. A note committed after your final scan is late: its ref was either not on origin at the recorded time or pointed at a different SHA. The router finds it with `check --remote-notes` and starts a new notes-reconcile run on a new branch, because the earlier branch is dead once merged. That run adds a new scan entry and new receipts; it changes nothing the first run wrote. + +## What never happens + +- Editing, moving, reformatting or deleting a note. +- Editing or replacing a receipt. +- Writing a receipt for a note addressed to another concept. +- Declaring the concept reconciled while `check --require-resolved` fails or the last scan found pending notes. From dc8bc03baee2a7e2c9da63f8ebc5a017b3204e07 Mon Sep 17 00:00:00 2001 From: Drewry Pope <drewrypope@gmail.com> Date: Wed, 21 Oct 2026 15:02:01 -0500 Subject: [PATCH 4/5] docs(repo): deepen issue-handoff skill and add parent mode reference --- .agents/skills/issue-handoff/SKILL.md | 87 +++++++++++++------ .../skills/issue-handoff/references/parent.md | 57 ++++++++++++ 2 files changed, 118 insertions(+), 26 deletions(-) create mode 100644 .agents/skills/issue-handoff/references/parent.md diff --git a/.agents/skills/issue-handoff/SKILL.md b/.agents/skills/issue-handoff/SKILL.md index 347180f0f0..12c8015d94 100644 --- a/.agents/skills/issue-handoff/SKILL.md +++ b/.agents/skills/issue-handoff/SKILL.md @@ -1,44 +1,79 @@ --- name: issue-handoff -description: Generate self-contained parent, facet child, or orchestration GitHub issues for concepts and stages. Use during Stages 4 and 5 to hand off research into design. +description: "Publish the GitHub issues that carry one concept of a workflow research package from research into design. Mode parent (S4) reviews the whole reconciled concept document and writes one self-contained issue to investigate and implement some or all of it, with a basic design plan in high-level stages. Mode fanout (S5) lets a zero-context agent turn that parent issue into one child issue per facet, each a full handoff, after estimating size and cost, and fills the design's initial research stages with every related issue in priority order with blocked-by and parallel-safe-with. Mode orchestration writes the issue that runs subagents against the child issues. Use when a concept has passed notes-reconcile, or when given a parent handoff issue URL to fan out. For a handoff file of the current conversation use handoff; for running the child issues use design-orchestrate." --- -# Issue Handoff (Stages 4 & 5) +# Issue handoff (S4 and S5) -Publish self-contained GitHub issues with zero-context handoff contracts. Specifications live in [/planning/workflow/stages.md](/planning/workflow/stages.md) and [/planning/workflow/templates/issue-parent.md](/planning/workflow/templates/issue-parent.md). +You turn a reconciled concept into GitHub issues that a fresh agent with no context can pick up. One skill, three modes, run in this order: -## Modes +- **`parent` (S4)**: one issue per concept, written after reading the whole concept document. It hands the concept on for investigation and implementation, in whole or in part, and sets out the basic design plan in high-level stages. +- **`fanout` (S5)**: a zero-context agent given only the parent issue URL creates one child issue per facet, each a complete handoff, then records them all in the design's initial research stages and in the main reference. +- **`orchestration` (end of S5)**: the same agent writes one issue whose job is to run subagents against the child issues. `design-orchestrate` executes it. -- **`parent` (Stage 4)**: Creates a single parent issue per concept defining overall research goals, scope, and deliverables using `templates/issue-parent.md`. -- **`fanout` (Stage 5)**: Breaks down a parent issue into granular child issues (one per research facet) using `templates/issue-child.md` and populates the initial research stages in `design.md`. -- **`orchestration` (Stage 5)**: Generates the top-level orchestration issue using `templates/issue-orchestration.md` to coordinate parallel subagents across the child issues. +The stage contract is in [stages.md](/planning/workflow/stages.md), issue rules in [records.md](/planning/workflow/records.md), body templates in [templates](/planning/workflow/templates/). Commands below are `python3 -I scripts/research_workflow.py <command>` from the repository root; `<pkg>` is `doc/<UTC>_research_<slug>`. -## Procedure +## Load or not -1. **Verify Source Concept**: - Read the concept document and ensure all notes are resolved (`check --require-resolved`). +Load for: -2. **Draft Issue Body**: - Format the issue body using the appropriate template. Ensure context pointers, acceptance criteria, and the trailing machine comment `<!-- workflow:issue ... -->` are present. +- "create the handoff issue for C003" after its notes are reconciled; +- "here is issue #501, fan it out into child issues" (mode `fanout`); +- writing the orchestration issue for a set of child issues; +- filling the initial research stages of `design.md` for a concept. -3. **Check for Duplicate Issues**: - Search open repository issues for matching metadata markers before publishing to prevent duplicate creation on retry. +Do not load for: -4. **Publish Issue**: +- a markdown handoff of the current conversation: `handoff`; +- the S1 research trigger issue: `research-prepare`; +- running the child issues, merging their PRs or deciding between options: `design-orchestrate`; +- plan or implementation issues: `feature-plan`; +- triaging incoming bugs or feature requests. - ```sh - gh issue create --repo <repo> --title "<title>" --body-file /tmp/issue-body.md - ``` +## Ownership and parallelism -5. **Update Concept & Design Records**: - Record the created issue number and URL in the concept state block and update `design.md`. +One agent per concept runs `parent`, and one per parent issue runs `fanout` then `orchestration`, so concepts move through S4 and S5 in parallel. You are the only writer of the issues you create and, while you hold the concept lease, of the concept's state block. `main.md` and `design.md` change only inside this concept's own sections and only through your PR. You never edit another concept's issues or sections. Boot, lease, heartbeat and final-report rules are in [collaboration.md](/planning/workflow/collaboration.md). -## Turn Report +**No recursion.** `parent` does not fan out. `fanout` creates child issues and one orchestration issue, and runs none of them. Child issues are leaves: their workers never fan out further or run this skill, and they report new work to the orchestrator instead. Subagents you launch (validators, searchers) are read-only leaves. + +## Steps + +1. **Boot and claim.** Boot per collaboration.md on your own branch (the brief's name, else `wf/<package-slug>/C001-s4` or `-s5`), push it empty, take the concept lease with `lease acquire`, and append `start` to your live log. + Done when the branch is pushed and `lease list` shows your lease. +2. **Verify the entry state.** Record the trunk SHA and UTC time. For `parent`: the S3 PR is merged, and on `origin/main` both `check --package <pkg> --require-resolved` and `check --package <pkg> --remote-notes` show nothing pending. For `fanout`: the parent issue is open and its preconditions still hold. Read `status --live --package <pkg>` for the concept's issues and PRs. If a condition fails, stop as blocked with the reason. + Done when every condition is checked against the recorded SHA, with the command output kept for the "Current state" section. +3. **Read everything, three times.** Read the whole concept document, its `main.md` section, `design.md`, the transcript segments and every linked issue and PR: at the start, before drafting, and before publishing. Log each re-read. + Done when your live log has three `reread` lines. +4. **Draft the bodies for your mode.** `parent`: read `references/parent.md`. `fanout`: read `references/fanout.md`, and estimate size and cost before drafting any child. `orchestration`: read `references/orchestration.md`. Every body is self-contained and follows `references/publishing.md` for links, length and the marker. + Done when each draft has every section its reference lists, and every claim has evidence. +5. **Check for duplicates.** For each draft, look for an issue that already carries its marker: first in the concept state block and your live log, then by search with an exact match on the body (`references/publishing.md`). Reuse what exists; never create a second issue with the same marker. + Done when each draft is marked `new` or `exists: <url>`. +6. **Validate with zero context.** Give each draft body, and nothing else, to a fresh read-only subagent using the zero-context reader prompt in `references/publishing.md`. Fix every gap it reports and re-run until it has no blocking question. + Done when each body's last validation lists no blocking question, no broken link and no unlocatable claim. +7. **Publish.** Create the issues with `gh issue create --repo <repo> --title <title> --body-file <file>`, adding only labels that already exist and, for child issues, `--parent <parent-number>`. Record each URL in your live log at once, then verify it with `gh issue view <url> --json url,state,title,body`. + Done when every issue is open, its rendered body ends with its marker, and its URL is recorded. +8. **Record and mark.** Add each issue to the concept state block's `issues` (`{number, url, stage, state}`) and append a `history` entry. Add an item with `item add` in the concept's `main.md` section that marks this stage and says what was found ("S5 · <UTC> — 7 child issues, 2 related issues, orchestration #510"), and use `item set-status` on any earlier item this stage clarified or superseded. `fanout` also writes the concept's "Initial research stages" sub-section in `design.md`. Never remove an earlier finding. Run `render` and commit only your concept's hunks; add one line to `changes.md`. + Done when `check --package <pkg>` and `check --changed-since origin/main` pass. +9. **Publish the record and report.** Format your files (`prettier --write`), merge `origin/main`, push, open a ready PR into `main`, `lease release`, append `end`, and comment the PR URL on the parent issue. + Done when `git ls-remote origin <branch>` equals the PR head and the reported SHA. + +## References + +- `references/parent.md`: mode `parent`, its preconditions, the body sections and the basic design plan. Read at step 4 in that mode. +- `references/fanout.md`: mode `fanout`, the size and cost estimate, related-issue search, dependency analysis, child bodies, and the `design.md` and `main.md` updates. Read at step 4 in that mode. +- `references/orchestration.md`: mode `orchestration` and its body. Read at step 4 in that mode. +- `references/publishing.md`: titles, markers, duplicate search, labels, links, length, zero-context validation and publishing. Read before steps 4 to 7 in every mode. + +## Turn report End every turn with: -- Done: <issue created with URL and stage> -- Verified: <gh issue view output> -- Remaining: <handoff to design-orchestrate> -- Questions (non-blocking): <question -> default> -- Blocked on user: <blocker or none> +```text +Done: <issues created or reused, with URLs; sections written> +Verified: <gh issue view -> open, marker present>, <check -> ok>, <zero-context validation -> no blocking gaps>, ... +Remaining: <"fanout of <parent url>", "design-orchestrate on <orchestration url>", or what is left> +Questions (non-blocking): <question -> default being used>, or "none" +Blocked on user: <only: no repository, gh cannot create issues, or two readings that give different issues>, or "none" +``` + +The final turn also gives the branch, the PR URL, the last pushed SHA, and the size and cost estimate in `fanout` mode. diff --git a/.agents/skills/issue-handoff/references/parent.md b/.agents/skills/issue-handoff/references/parent.md new file mode 100644 index 0000000000..654bad2392 --- /dev/null +++ b/.agents/skills/issue-handoff/references/parent.md @@ -0,0 +1,57 @@ +# Mode parent (S4) + +One issue per concept. You read the whole concept document and write the handoff that a zero-context agent will later fan out into child issues. The issue covers investigating the concept and implementing some or all of it. + +## Preconditions + +- The concept's S3 notes-reconcile PR is merged into `main`. +- On `origin/main`, `check --package <pkg> --require-resolved` exits 0 and `check --package <pkg> --remote-notes` lists nothing pending for the concept. +- No open issue already carries this concept's parent marker (`publishing.md`). + +If one fails, stop as blocked and name it. + +## Review the whole document + +Before drafting, build these lists from the concept document. Each entry links the section it came from. + +- **Scope.** What is in scope to implement (all of the concept by default), what is only to investigate, what is `deferred` (with reason and revisit trigger) and what is `contingent` (with its trigger). Follow the concept's priority tier. +- **Facets.** Every facet item (`C001.N`) with a one-line scope. Add the gaps you find: an open question or risk that needs research of its own becomes a proposed facet, marked as proposed by S4. +- **Known edges.** Relations to other concepts, shared files and undecided shared interfaces between facets. +- **Open questions and preliminary recommendations**, each with its default. +- **Existing issues and PRs** for this concept: the S1 research issue, the S2 and S3 PRs, and any issue that links the concept. + +## Title and marker + +- Title: `Handoff: <concept title> (<package>·C001)`. +- Marker, the last line of the body: `<!-- workflow:issue {"concept":"C001","kind":"parent","package":"<package>","stage":"S4"} -->`. + +## Body sections, in order + +1. **Opening line.** "Picking this up with no context? Everything you need is here or linked. Read 'Your role' first, then 'Current state'." +2. **Goal.** The end state in the present tense: "Every facet of C001 has a research child issue; the concept's initial research stages in `design.md` list them, with every related issue, in priority order; an orchestration issue runs them." Then the longer-term goal: the concept designed, planned and implemented (in full, or the parts in scope). +3. **Links.** Full GitHub URLs: the concept document, its `main.md` section, the transcript with segment ids, `design.md`, `changes.md`, the S1 research issue, the S2 and S3 PRs. +4. **Current state (verified `<UTC>` against `<trunk SHA>`).** What the research established, in bullets that link the document's sections; note status (receipt count, last scan time); what is not known yet. Every bullet has evidence. +5. **Your role.** "You create issues; you do not research, design or implement. Load the `issue-handoff` skill and run mode `fanout`, then mode `orchestration`, on this issue." Link the skill file on `main`. +6. **Facets to fan out.** One bullet per facet: id, title, one-line scope, the document sections it draws on, a suggested wave, known blockers, and shared files or interfaces. Proposed facets are marked as such. +7. **Basic design plan.** The high-level stages below, adapted to the concept. +8. **Decisions and human actions to raise at the start.** `D1`, `D2`, ... and `H1`, `H2`, ..., each with the question or need, the recommended option, the default used if there is no answer, and what it blocks. Leave out anything the transcript already answers. +9. **Traps.** The concept's top risks, plus the workflow traps in `fanout.md` ("Traps"). +10. **Repository mechanics.** Links to `collaboration.md`, `.agents/research-workflow.json` and `AGENTS.md`; the git environment line; the tool commands the next agent uses. +11. **Done when.** Checkboxes: child issues exist, one per facet, each validated with zero context; the `design.md` initial research stages sub-section is merged; the concept's `main.md` section marks S5 and what it found; the orchestration issue exists; this issue has a comment linking all of them. +12. **Related.** Sibling concepts' parent issues and related work, each with what it shares. +13. **Not verified.** What you could not check and why, plus the searches behind any negative claim. +14. **Marker.** + +## Basic design plan (section 7) + +The stages mostly cover research and design. Planning and implementation get one line each, because their own skills set them up later. + +- **Stage R, initial research.** One child issue per facet, in waves: wave 0 pins shared names, interfaces and foundation files; wave 1 runs every independent facet in parallel; wave 2 is anything that needs wave 1's results. Entry: the child issues exist. Exit: every child's findings are merged. Skill: `design-orchestrate`, driven by the orchestration issue. +- **Stage D, design.** Design records, decision records with steelmanned options, the challenge pass and the minimal human-review list. Entry: stage R exits. Exit: the design is merged and the plan issue exists. Skill: `design-orchestrate`; rules in `decisions.md`. +- **Stage P, feature plan.** Skill `feature-plan`. +- **Stage I, implementation.** Skill `implementation-orchestrate`. + +## After publishing + +- Add the issue to the concept state block's `issues` with stage `S4`, and mark S4 in the concept's `main.md` section with an item. +- If the user keeps a personal handoff list (cairn's handoff goal uses `~/git/handoffs/TODO.md`), append one line `- [<short goal>](<issue URL>)`. Never edit existing lines; skip the append if the URL is already there. From 340ce3bfba6067e991948bfc50e9cb2a7dcf544f Mon Sep 17 00:00:00 2001 From: Drewry Pope <drewrypope@gmail.com> Date: Wed, 21 Oct 2026 15:03:15 -0500 Subject: [PATCH 5/5] docs(repo): add issue-handoff fanout, orchestration and publishing references --- .../skills/issue-handoff/references/fanout.md | 122 ++++++++++++++++++ .../issue-handoff/references/orchestration.md | 37 ++++++ .../issue-handoff/references/publishing.md | 84 ++++++++++++ 3 files changed, 243 insertions(+) create mode 100644 .agents/skills/issue-handoff/references/fanout.md create mode 100644 .agents/skills/issue-handoff/references/orchestration.md create mode 100644 .agents/skills/issue-handoff/references/publishing.md diff --git a/.agents/skills/issue-handoff/references/fanout.md b/.agents/skills/issue-handoff/references/fanout.md new file mode 100644 index 0000000000..20458b46a0 --- /dev/null +++ b/.agents/skills/issue-handoff/references/fanout.md @@ -0,0 +1,122 @@ +# Mode fanout (S5) + +You start with only the parent issue URL and no other context. You turn the parent into one child issue per facet, each a complete handoff, record them in the design's initial research stages and in the main reference, and then write the orchestration issue (`orchestration.md`). You run none of the child issues. + +## F1. Verify the parent + +- Read the parent issue, its comments and everything it links, at a trunk SHA you record. +- Parse its marker. Confirm the S4 preconditions in `parent.md` still hold on `origin/main`. +- Compare the parent's "Current state" with the concept document now. Record every discrepancy; the document on `main` wins. + +Done when the parent's claims are checked and the discrepancies are listed. + +## F2. Gather every related issue and PR + +The initial research stages list every GitHub issue that was made for, or is related in any way to, this concept. Find them with: + +- the package's markers: `gh issue list --repo <repo> --state all --search '"<package>" in:body' --json number,url,title,state,body --limit 200`, then keep the bodies that contain this concept's id; +- the concept id and title keywords in titles and bodies; +- every issue and PR linked from the concept document, its `main.md` section and the parent; +- PRs that touched the concept file: `gh pr list --repo <repo> --state all --search '<concept file name>' --json number,url,title,state`. + +Record each search and its result count, so the negative claim "no other related issue" names where you looked. + +Done when you have the list, each entry with number, state and one line on how it relates. + +## F3. Settle the facet list + +- Start from the parent's facets, including its proposed ones. +- Add any facet the concept document implies but the parent missed, with the reason. +- Size each against one fresh session. If a worker would run out of context before finishing, split the facet. If setting it up would cost more than doing it, merge it with a neighbour. Splits get new item ids from `item add`; never invent ids. + +Done when every facet has an id, a one-line scope and a size. + +## F4. Estimate size and cost before creating anything + +Write the estimate down before drafting a single child: + +- the number of child issues, and the waves and critical path from F5; +- the peak number of parallel workers, capped by `max_parallel_writers` in `.agents/research-workflow.json`; +- worker sessions: one fresh session per child, or the number you expect; +- tokens: sessions times a per-session figure you state (for example 150k tokens, about the size of one session's useful context), plus the orchestrator's overhead, labelled an estimate; +- human attention: the decisions and human actions the children will raise. + +Post the estimate as a comment on the parent issue. If it exceeds a budget the parent or your brief sets, merge facets until it fits and say what you merged. Never create more child issues than the estimate states. + +Done when the estimate comment is on the parent. + +## F5. Maximize parallelism + +For each pair of facets, decide the edge, and prefer the arrangement with the fewest hard edges: + +- `requires` only when one facet's output is a real input to the other. +- `recommended-after` when starting early is possible but costs rework; say what rework. +- `shares-files-with` when both would write the same file: assign the file to one facet, or serialize the two. +- An undecided shared interface (names, paths, formats, a shared module) gets its own wave-0 child that pins it before the facets that use it start. Parallel workers otherwise invent incompatible answers. +- `parallel-safe-with` lists every sibling with no edge and no shared file or interface. + +Then group the facets into waves: wave 0 for pinned interfaces and foundation files, wave 1 for every independent facet, wave 2 for facets that need wave 1's results. Priority order within a wave follows the concept's priority tiers, then the reversal cost of being wrong. + +Done when every child has its wave, priority, blocked-by and parallel-safe-with lists. + +## F6. Draft each child + +- Title: `Research: <facet title> (<package>·C001.N)`. +- Marker: `<!-- workflow:issue {"concept":"C001","facet":"C001.N","kind":"child","package":"<package>","stage":"S5"} -->`. +- Body sections, in order: + 1. Opening line, as in `parent.md`. + 2. **Goal**: the facet's end state in the present tense. + 3. **Questions**: the facet's questions, copied exactly from the concept document, with a link to its heading. + 4. **Links**: full GitHub URLs to the facet heading, the concept document, its `main.md` section, the transcript segments, the parent, the orchestration issue (filled in later) and related issues. + 5. **Current state (verified `<UTC>` against `<SHA>`)**: what S2 already found for this facet and what is still unknown, with evidence. + 6. **Owned outputs**: the findings file at the path the orchestration issue assigns (`design-orchestrate` places it in the concept's design record folder), notes to other concepts, and nothing else. It never writes the concept document, `main.md` or `design.md`. + 7. **Acceptance evidence**: what proves it is done: the questions answered with typed, cited sources; the open questions ranked with defaults; the PR merged. + 8. **Prerequisites**: `Blocked by:` issue links with reasons; `Recommended after:` with the rework cost. + 9. **Parallel-safe with**: sibling issue links. + 10. **What to do first**: three concrete actions. + 11. **Done contract**: the outcome, how it is verified, the boundaries (files it may write and must not touch), and the stop-as-blocked rule: if a blocker is not merged or a decision is missing, comment "Blocked: <what>; default: <x>" on the issue, then continue on the default where `decisions.md` allows it, otherwise stop. + 12. **Leaf rule**: "Do not create issues or fan out further. Report new work in your final message and as a comment on the orchestration issue." + 13. **Report**: branch, PR URL, last pushed SHA, what is verified, what is not. + 14. **Marker.** + +Done when each body passes zero-context validation (`publishing.md`). + +## F7. Create, then cross-link + +- Create the children in wave order, blockers first, each with `--parent <parent number>`, recording each URL in your live log as soon as it exists. +- Then edit each child once with `gh issue edit <url> --body-file <file>` to replace facet ids with issue links in `Blocked by` and `Parallel-safe with`. +- The body text is the contract. Where the repository has native blocked-by links, add them too, but the orchestrator computes the frontier from what has merged, not from GitHub's blocked-by state. + +Done when every child is open, cross-linked and recorded. + +## F8. Write the initial research stages in `design.md` + +One sub-section per concept, so fan-outs for different concepts merge cleanly. Bullets only, no tables: + +```markdown +### C001 <concept title>: initial research stages + +S5 · 2026-10-21T12:00:00Z · parent [#501](url) · orchestration [#510](url) · estimate: 6 children, 3 waves, about 1M tokens + +- **Wave 0** + - [#502](url) `C001.4` Pin shared names for note files — fixes the names the other facets use. Priority 1. Blocked by: none. Parallel-safe with: none. +- **Wave 1** + - [#503](url) `C001.5` Remote-ref scanning — how to find notes on unmerged branches. Priority 2. Blocked by: #502. Parallel-safe with: #504, #505. +- **Related issues** + - [#381](url) S1 research issue, closed; context only. +- **What this stage found**: <new details, discrepancies, facets added or merged>. +``` + +A rerun never removes an earlier sub-section. It adds a new dated block below it, and earlier entries that it replaces get a status trail. + +## F9. Update the main reference + +In the concept's `main.md` section: add an item that marks S5 and denotes what was found; set `clarified` or `superseded` on earlier items the fan-out changed; add every child and the orchestration issue to the concept state block's `issues` so the generated "Issues and PRs" views list them. Remove nothing. + +## Traps + +- Relative links in an issue body resolve against the issue URL and break. Use full GitHub URLs (`publishing.md`). +- GitHub search splits the marker into words, and a new issue takes a while to appear in search. Check your own record first, then search, then match the marker exactly. +- Tracker blocked-by state lags behind merges. The frontier comes from what has merged. +- Parallel children that share an undecided name or file collide. Pin it in wave 0. +- A fan-out without an estimate can burn far more tokens than the work is worth. Estimate first. diff --git a/.agents/skills/issue-handoff/references/orchestration.md b/.agents/skills/issue-handoff/references/orchestration.md new file mode 100644 index 0000000000..ab6eb5b6e4 --- /dev/null +++ b/.agents/skills/issue-handoff/references/orchestration.md @@ -0,0 +1,37 @@ +# Mode orchestration (end of S5) + +After the children exist, the fan-out agent writes one more issue: the handoff whose purpose is to orchestrate subagents against every child issue. `design-orchestrate` runs it. You write it; you do not run it. + +## Title and marker + +- Title: `Design: <concept title> (<package>·C001)`. +- Marker: `<!-- workflow:issue {"concept":"C001","kind":"orchestration","package":"<package>","stage":"S5"} -->`. + +## Body sections, in order + +1. **Opening line**, as in `parent.md`. +2. **Goal.** The end state in the present tense: every child issue has been researched by a worker, its PR is merged, and its findings are folded into the concept's design records; decisions are recorded with steelmanned options and their source; the challenge pass is done; the minimal human-review list exists; and the plan issue for `feature-plan` is open. +3. **Current state (verified `<UTC>` against `<SHA>`).** The parent, the children by wave with their state, the estimate from the parent comment, and anything already in flight. +4. **Your role: orchestrator, not implementer.** Quote the user's instruction verbatim: + + > "it's orchestrating/planning/managing and it should use subagents to implement/review/validate and only handle itself when it can't use a subagent somehow. it should make parallel subagents for any portions that can be broken apart." + + Then link the orchestrator rule in `stages.md` and the merge gate and restart rules in `collaboration.md`, without restating them. + +5. **Read first, in order.** The parent issue, the concept document, the concept's sub-section of the initial research stages in `design.md`, `collaboration.md`, `decisions.md`, and the reviewer, critic and investigator prompts in `planning/workflow/templates/prompts/`. One line each on why. +6. **Child issues by wave.** A snapshot of the `design.md` sub-section: links, ids, one-line descriptions, priorities, blocked-by and parallel-safe-with. Say that `design.md` on `main` is the live version. +7. **Where to start.** Dispatch wave 0 first. Compute the frontier with `ready --package <pkg>` and from what has merged, not from GitHub's blocked-by state. Take a lease per child with `lease acquire`. Keep at most `max_parallel_writers` workers at once. Give each worker the child issue URL and its owned output path; pass URLs and paths, not pasted summaries. +8. **Decisions and human actions to raise at the start.** The D and H items from the parent that are still open, with defaults. Conflicting worker findings go to the decision protocol in `decisions.md`; work continues on the preliminary choice. +9. **Traps.** From `fanout.md`, plus: a worker that reports done without a pushed SHA has not finished; a child that finds new work reports it here and does not fan out; late notes are picked up by notes-reconcile, not waited for. +10. **Keeping track.** Comment on this issue when a worker PR opens, merges or blocks. Update `main.md` and `design.md` only through PRs, inside this concept's sections, marking each stage and what it found, and never removing earlier findings. +11. **Done when.** Checkboxes matching the goal, plus: every child is closed with a link to its merged PR, and the plan issue URL is commented here. +12. **Related.** The parent, sibling concepts' orchestration issues, and anything sharing files. +13. **Not verified.** +14. **Marker.** + +## After publishing + +- Comment on the parent with links to every child and to this issue. +- Comment on each child with this issue's link, so its worker knows where to report. +- Add the issue to the concept state block's `issues` with stage `S5`, and fill the orchestration link into the `design.md` sub-section. +- If the user keeps a personal handoff list (cairn's handoff goal uses `~/git/handoffs/TODO.md`), append one line for this issue, as in `parent.md`. diff --git a/.agents/skills/issue-handoff/references/publishing.md b/.agents/skills/issue-handoff/references/publishing.md new file mode 100644 index 0000000000..b39a2344e9 --- /dev/null +++ b/.agents/skills/issue-handoff/references/publishing.md @@ -0,0 +1,84 @@ +# Publishing issues: markers, links, validation + +Every mode publishes through these rules. They adapt cairn's handoff goal (`~/git/cairn/prompts/goals/handoff/SPEC.md`, sections 7 to 9) to this workflow. + +## Titles and markers + +| Mode | Title | Marker `kind` | `stage` | +| ------------- | -------------------------------------------- | --------------- | ------- | +| parent | `Handoff: <concept title> (<package>·C001)` | `parent` | `S4` | +| fanout child | `Research: <facet title> (<package>·C001.N)` | `child` | `S5` | +| orchestration | `Design: <concept title> (<package>·C001)` | `orchestration` | `S5` | + +The marker is the last line of the body: `<!-- workflow:issue {...} -->`, holding JSON with sorted keys `concept`, `facet` (children only), `kind`, `package` and `stage`. It is unique per issue. If the templates in `planning/workflow/templates/` define more keys, add them; never drop these. + +## Duplicate check, in this order + +1. Your own record: the concept state block's `issues` and your live log. A URL recorded there is the issue; reuse it. +2. Search, then match exactly. GitHub search splits the marker into words and matches loosely, so a search only narrows the candidates: + + ```sh + gh issue list --repo <repo> --state all --search '"<package>" "C001" in:body' \ + --json number,url,title,state,body --limit 200 + ``` + + Keep only the issues whose body contains the exact marker string. + +3. A title search for the exact title, as a last check. + +A new issue can take a while to appear in search, which is why step 1 comes first and why you record each URL as soon as `gh issue create` returns it. + +When a match is found: + +- open, and nobody has started on it (no linked PR, no worker comments): update its body with `gh issue edit <url> --body-file <file>` if yours is better, otherwise reuse it as is; +- open, and work has started: leave the body alone and add a comment with the differences; +- closed: do not reopen it. Record it and stop as blocked if the closure contradicts the package state. + +## Labels and people + +Run `gh label list --repo <repo> --json name` and add only labels that already exist and fit, for example `documentation` for research and design issues. Never create labels. Never assign people unless the repository's convention says to. + +## Links + +- Use full GitHub URLs, never relative links: a relative link resolves against the issue URL and breaks. +- Files on `main`: `https://github.com/<repo>/blob/main/<path>`, plus `#<heading-anchor>` when the anchor exists. +- Line references: a permalink at the recorded SHA, `https://github.com/<repo>/blob/<sha>/<path>#L10-L20`, with a note that lines drift. +- Check every file link before publishing: `gh api "repos/<repo>/contents/<path>?ref=<ref>" --silent` exits 0. Content that exists only on an unmerged branch is not linkable yet; wait for its merge or name the PR instead. +- Mention a local path only with what it contains and that it is on one machine. + +## Length and safety + +- The body must stay under GitHub's 65,536-character limit; check with `wc -c`. If it is longer, move the bulk into a repository file (through your PR) or a first comment, and keep the goal, current state, role, start and done sections in the body. +- No secret values anywhere. This repository is public: nothing private either. + +## Zero-context validation + +Give the draft body, and nothing else, to a fresh read-only subagent with this prompt (from cairn's `agents/zero-context-reader.md`): + +```text +You know nothing except the document below. Use no other context. You may follow its own links to check that they resolve and say what they claim. Do not write files or launch subagents. +Return: +1. Restatement: the goal, your role, and the first three actions you would take. +2. Questions: every question you would need answered before starting, most blocking first. +3. Unlocatable claims: claims you could not find support for in the document or its links. +4. Broken or local-only references. +5. Risks: places where two readings would lead to different work. +<draft body> +``` + +Fix every gap and re-run until there is no blocking question, no broken link and no unlocatable claim. In fan-out mode, run one validator per child body, in parallel. + +## Publish and verify + +```sh +gh issue create --repo <repo> --title "<title>" --body-file <file> [--label <existing>] [--parent <number>] +gh issue view <url> --json url,state,title,body +``` + +Confirm the issue is open, the body is complete (no truncation, every section present) and its last line is the exact marker. Record the URL in your live log at once (`<name> <UTC> issue: <url> <kind> <id>`), then in the concept state block. + +If an older open issue covers the same work, comment on each with a link to the other and leave closing to the user. Never close other issues. + +## Resuming after a failure + +Re-run the duplicate check for every planned issue, reuse what exists, and create only the missing ones. Never create a second issue with the same marker.