Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 56 additions & 25 deletions .agents/skills/concept-research/SKILL.md
Original file line number Diff line number Diff line change
@@ -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/<UTC>_research_<slug>/concepts/C001-<slug>.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-<slug>.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 <command>`, run from the repository root; `<pkg>` is the package folder `doc/<UTC>_research_<slug>`. Run `<command> --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: <concept> (<package>·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 <dir> --from CXXX --to CYYY --input /tmp/note.md
```
## Ownership and parallelism

6. **Update Concept Record**:
Update `concepts/CXXX-<slug>.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/<package-slug>/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 <branch>` shows the branch, and the log has `start`.
Comment on lines +34 to +35

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 Replace the nonexistent lease subcommand

For every S2 run, this first step directs the worker to invoke python3 -I scripts/research_workflow.py lease acquire, because the skill defines all command fragments as subcommands of that script. The parser only exposes init, check, status, ready, note, and resolve-note, while collaboration.md describes leases as filesystem locks, so the documented boot procedure fails before research begins.

Useful? React with 👍 / 👎.

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 <pkg> --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 <pkg>` passes and `git diff origin/main -- <pkg>` deletes no earlier line except where a status prefix was added.
Comment on lines +46 to +47

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 Permit replacing the intake placeholder at S2 completion

For every initialized concept, the original document contains Pending: research, synthesis, design, planning and implementation have not run.; once the concept status becomes researched, check_package explicitly rejects that placeholder. This no-deletion completion condition therefore conflicts with the validator and makes a correctly completed S2 document fail unless the worker violates the skill by removing or replacing the stale line.

Useful? React with 👍 / 👎.

8. **Exchange notes as you go.** When a finding affects another concept, send `note --package <pkg> --from C001 --to C00N --input <file>` (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 <pkg> --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 <pkg>` and `check --changed-since origin/main` pass.
Comment on lines +50 to +51

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 Write lifecycle updates to the actual package state schema

For a multi-concept package produced by init, the concept file has no workflow state block; the sole block is in main.md, where lifecycle history is named events, relations are top-level dependencies, and each concept entry has its own status. Following this instruction either finds nothing to edit or adds ignored stage/relations/history data, so status and ready continue reporting the concept as unresearched and downstream stages cannot reliably advance.

Useful? React with 👍 / 👎.

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 <branch>` equals the PR head and the SHA in your report.
Comment on lines +52 to +53

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 Open the worker PR after the first commit

This delays opening the PR until all research and publishing work is complete, whereas the repository boot protocol requires opening it after the first commit so other workers and the router can see work in flight. Across long S2 runs this leaves only an untracked remote branch, undermining coordination and the open-PR checks used to avoid duplicate workers.

AGENTS.md reference: AGENTS.md:L54-L54

Useful? React with 👍 / 👎.


## 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: <research findings summary>
- Verified: <citations and check command output>
- Remaining: <handoff to notes-reconcile>
- Questions (non-blocking): <question -> default>
- Blocked on user: <blocker or none>
```text
Done: <what this turn finished>
Verified: <command -> result>, ...
Remaining: <work still to do; when complete, "notes-reconcile for C001 after PR <url> merges">
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 counts of facets, sources and `[unsourced]` claims.
60 changes: 60 additions & 0 deletions .agents/skills/concept-research/references/citations.md
Original file line number Diff line number Diff line change
@@ -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.
Loading
Loading