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
151 changes: 130 additions & 21 deletions .agents/skills/request-intake/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,149 @@
---
name: request-intake
description: Store raw transcripts byte-for-byte, verify SHA-256 integrity, segment ideas, and scaffold initial research collections. Use when capturing a new request, prompt, or noisy voice transcription.
description: Capture a request, from one sentence to a multipage rambling or speech-to-text transcript, as a research package (stage S0). Stores the exact bytes with the workflow tool's init, maps every sentence segment to a concept or the global bucket G, keeps hints, contradictions and changes of mind, records garbled words in a reading register, explores the repo for context and overlap with parallel read-only subagents, pre-creates one stub per concept and lands main.md, design.md and changes.md as a docs-only PR. Use when the user hands over new ideas, a brain dump, a voice note or a long request to turn into research and design docs, or says capture, intake or start a research package. Stops after intake unless told to continue. For a package that already exists, load research-workflow instead.
---

# Request Intake (Stage 0)
# Request intake (S0)

Scaffold a sealed, evidence-preserving research collection from raw user input. Specifications live in [/planning/workflow/stages.md](/planning/workflow/stages.md) and [/planning/workflow/records.md](/planning/workflow/records.md).
This skill turns one request into a research package. The request can be anything from a sentence to a multipage voice transcript full of typos. The package holds:

## Procedure
- the exact transcript;
- a manifest;
- the main reference;
- the meta design;
- a change log;
- one stub per concept.

1. **Save Raw Input**:
Save the exact input bytes without normalization or whitespace changes to a temporary file `/tmp/raw-input.txt`.
One agent runs intake. Intake keeps everything; refining, merging and rejecting come at S2 and later. The layout and formats are in [records.md](/planning/workflow/records.md), the stages in [stages.md](/planning/workflow/stages.md), and the vocabulary (types, relations, priority, horizon) in [DEPENDENCIES.md](/planning/DEPENDENCIES.md).

2. **Compute Checksum**:
Compute `sha256sum /tmp/raw-input.txt` to verify byte preservation.
## Set up

3. **Draft Concept Outline**:
Inspect the input and map every nonblank section to concepts (`C001`, `C002`, ...), recording source line ranges. Include a "Garbled Input Reading Register" if phonetic or speech-to-text artifacts are present.
```sh
source /home/user/.local/share/plaza-tools/git-env.sh # the profile's git_env
SLUG=<kebab-slug>; TS=$(date -u +%Y-%m-%dT%H:%M:%SZ); PKG="doc/${TS//:/-}_research_$SLUG"
git fetch -q origin
git worktree add -b "research/$SLUG/s0-intake" "/home/user/work/wt/research-$SLUG-s0-intake" origin/main
cd "/home/user/work/wt/research-$SLUG-s0-intake" && git push -u origin "research/$SLUG/s0-intake"
rw() { python3 -I scripts/research_workflow.py "$@"; }
WORK="$(git rev-parse --git-common-dir)/agent-work/${PKG##*/}-S0"; mkdir -p "$WORK" # scratch, never committed
```

4. **Scaffold Package**:
If a command fails with `invalid choice` or an unknown flag, read [tool-fallbacks.md](../research-workflow/references/tool-fallbacks.md).

## Steps

1. **Get the exact bytes without retyping.** Use the source as it was delivered, chosen with [references/exact-bytes.md](references/exact-bytes.md): a file path, an attachment, an issue body, a pipe or the harness's own record of the message. Set `SRC` to that file and `SHA=$(sha256sum "$SRC" | cut -d' ' -f1)`. If the user or the source supplied a hash, it is the expected hash. Scan the input for secrets (keys, tokens, passwords). This repository is public.
Done when `SRC` holds the delivered bytes, the source is described in one line, any expected hash is noted, and the secret scan is clean. A hit makes you Blocked on user.

2. **Preview the segments.** Run `rw init --input "$SRC" --slug "$SLUG" --preview-segments > "$WORK/segments.txt"`. Segments are sentences: the tool splits after `.`, `?` and `!`, and at every newline.
Done when `segments.txt` lists `T001` to `Tn` and `git status --short` shows the preview wrote nothing to the repository.

3. **Read everything and record what it says.** Read every segment, following [references/reading-messy-input.md](references/reading-messy-input.md). For long input it splits the work across parallel read-only range readers. Write `$WORK/reading.md` with these lists, each entry citing segment ids:
- candidate concepts;
- directives about how to work (these go to `G`);
- hints;
- contradictions;
- changes of mind;
- repeats;
- garbled tokens;
- ideas the user missed or only implied.
Done when every segment id appears in `reading.md` at least once.

4. **Explore the context in parallel (read-only).** In one turn, launch the explore subagents in [references/explore-briefs.md](references/explore-briefs.md):
- code and config;
- docs and architecture;
- issues and PRs;
- one more for each large area the topics touch.

Each returns `file:line` evidence per topic, plus an overlap list of existing docs, issues or PRs that already cover a topic, contradict it, or would be edited by it. Before using a report, re-run two of its claims.
Done when every candidate concept has evidence or a "nothing found (searched: ...)" line, and the overlap list is merged into `reading.md`.

5. **Write the outline.** Write `$WORK/outline.json` using the schema and example in [references/outline.md](references/outline.md):
- Make one concept per document to create (`kind: new`) or existing file to edit (`kind: edit`, with `targets`).
- Give every segment to a concept or to `G`. Overlap between concepts is allowed.
- A hinted idea gets `type: hint`.
- Keep both sides of a contradiction or change of mind, with `contradicts` or `supersedes`.
- Put garbled tokens in the reading register.
- Add missed or half-formed ideas to `suggestions[]`, each starting `Inference:`.
- Take priority, horizon, goal and `enables` from the user's words, else `unspecified`.
Done when every idea in a multi-idea segment is claimed by a concept, by `G` or by a suggestion (the idea-level check in `references/outline.md`).

6. **Create the package.**

```sh
python3 scripts/research_workflow.py init --input /tmp/raw-input.txt --slug <kebab-slug> --outline <outline.json> --expect-sha256 <hash>
rw init --input "$SRC" --slug "$SLUG" --timestamp "$TS" --outline "$WORK/outline.json" \
--expect-sha256 "$SHA" --source "<one line: where the bytes came from>" --visibility public
rw verify-transcript --package "$PKG" --against "$SRC"
```

5. **Verify Package**:
- Add `--encoding <name>` only for input that isn't UTF-8.
- `init` refuses bytes that are already captured. Hand that package to `research-workflow` instead. Use `--allow-duplicate` only if the user asks for a second capture.
- Uncovered segments make `init` fail and write nothing. Fix the outline and rerun.

Done when `init` exits 0 and `verify-transcript` reports a match.

7. **Complete the main reference and the meta design.** Go through [references/package-checklist.md](references/package-checklist.md). In `main.md`, make sure it has:
- the file list (every stub and every target);
- the introduction;
- `G`;
- the reading register;
- each concept's preliminary thoughts as hierarchical items;
- empty Issues and PRs placeholders.

Add any missing item with `rw item add --package "$PKG" --parent C001 --text "..."`. In `design.md`, make sure it has:
- the first-pass review order with reasons;
- the waves from `rw ready --package "$PKG"`;
- the line "run one agent per concept" where nothing blocks;
- the run table from `rw render --package "$PKG"`.

Done when every checklist line holds and `rw ids --package "$PKG"` lists items for every concept that has thoughts.

8. **Validate.** Commit first (`git add -- "$PKG" && git commit -m "docs: capture $SLUG request"`), then run:

```sh
python3 scripts/research_workflow.py check --package doc/<package-dir>
rw check --package "$PKG" && rw check --repo-root .
prettier --check "$PKG"/*.md "$PKG"/concepts/*.md && biome format "$PKG"/package.json
rw render --package "$PKG" && git diff --exit-code -- "$PKG" # views are current and stable
```

## Turn Report
Then give `main.md` to a fresh zero-context reader subagent with the prompt in `references/package-checklist.md`. Fix every gap it finds in the package, or list it under Questions.
Done when every command exits 0 and each of the reader's questions is answered in the package or listed.

9. **Land as a docs-only PR.**
1. `git fetch -q origin && git merge --no-edit origin/main`, then push.
2. `gh pr create --base main --title "docs: capture <slug> request" --body-file "$WORK/pr.md"`, with the body from the checklist.
3. `git diff --name-only origin/main...HEAD` must list only `$PKG/**`.
4. If you are a dispatched worker, stop here; the router merges.
5. If you are running standalone, wait for green checks, then `gh pr merge <n> --merge --match-head-commit "$(git rev-parse HEAD)"`, then `git merge-base --is-ancestor <sha> origin/main`.

Done when the PR is open (worker), or merged with the ancestor check passing (standalone).

10. **Stop at intake.** Continue only if the user asked for more, in which case load `research-workflow` with the package path.
Done when the turn report names the package, the PR and the next stage (S1, one `research-prepare` agent per ready concept).

## Parallelism and ownership

Intake has one writer: you own the whole package until its PR merges. The range readers and explore subagents are read-only and return reports; they write nothing. Once the PR merges, each concept file belongs to the worker of its current stage. From then on, `main.md` and `design.md` change only through PRs, and `changes.md` only by appending a single line. The rules are in [collaboration.md](/planning/workflow/collaboration.md); this skill does not restate them.

## Should load / should not load

- Load for: a new request, brain dump, voice note or transcript to capture; "start a research package"; "store this exactly and break it into docs"; making the main reference, the meta design and the concept stubs for new input.
- Don't load for: an existing package (`research-workflow`); preparing one concept (`research-prepare`); deep research (`concept-research`); transcribing audio; polishing dictated prose; questioning the user about a plan (`grilling`); turning a spec into tickets (`feature-plan`).

## References

- [references/exact-bytes.md](references/exact-bytes.md): read in step 1.
- [references/reading-messy-input.md](references/reading-messy-input.md): read in step 3, and again whenever the input is long, garbled or self-contradicting.
- [references/explore-briefs.md](references/explore-briefs.md): read in step 4. `research-prepare` uses it too.
- [references/outline.md](references/outline.md): read in step 5.
- [references/package-checklist.md](references/package-checklist.md): read in steps 7 to 9.

End every turn with:
## Turn report

- Done: <intake summary and package path>
- Verified: <sha256 and check command output>
- Remaining: <handoff to research-prepare>
- Questions (non-blocking): <question -> default>
- Blocked on user: <blocker or none>
```
Done: <package path, n segments, n concepts, G size, PR URL>
Verified: <rw check ... -> ok; verify-transcript -> match sha256 <first 12>; prettier --check -> ok>
Remaining: <S1 for C001..Cn, or nothing if the user stopped at intake>
Questions (non-blocking): <readings of garbled input, contradictions kept unresolved -> default used>, or none
Blocked on user: <secret found, expected hash mismatch>, or none
```
32 changes: 32 additions & 0 deletions .agents/skills/request-intake/references/exact-bytes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Getting the exact bytes

Read this in step 1. The transcript has to be the bytes as the user delivered them, with no harness prefix, no added trailing newline and no tidying. A model that types text back out is retyping it, even inside a tool call, and retyping drifts. So copy bytes with programs and type nothing yourself.

## Pick the source, best first

1. **A file the user named or attached.** Set `SRC=<path>`. Done.
2. **An issue, PR or comment body.** Note that `gh ... --jq .body` adds a newline, so write the field with Python instead:
```sh
gh api repos/<owner>/<repo>/issues/<n> | python3 -I -c 'import json,sys; sys.stdout.write(json.load(sys.stdin)["body"])' > "$WORK/input.txt"
SRC="$WORK/input.txt"
```
3. **Output of another program** (clipboard, export, speech-to-text tool): pipe it straight into a file, e.g. `wl-paste --no-newline > "$WORK/input.txt"`.
4. **A message that exists only in this conversation.** Look for the harness's own record of it, such as a session export or a transcript log under the harness's data directory, and extract the message field with a script, as in 2.
5. **Nothing else works.** Write the text once with the file-writing tool. Then:
- pass `--source "retyped by agent from chat; bytes not verified"`;
- add a Question: "send the original file or its sha256 -> proceeding with the retyped copy".

Don't present a retyped copy as exact.

## Hashes and provenance

- `--expect-sha256` takes the hash the user, the issue or an earlier copy gave. A mismatch means you have different bytes, so stop: Blocked on user, showing both hashes.
- A copy kept elsewhere (another repository, a note with a prefix like `in code pull then do this : `) is a different byte string. Record where it lives in `--source`, and don't make it the transcript unless the user says so.
- After `init`, `rw verify-transcript --package "$PKG" --against "$SRC"` proves the stored file equals the source.

## Privacy

The repository is public. Before committing:

- **Secrets:** scan for API keys, tokens, passwords and private keys (the repository's secret scanner, or `grep -nEi 'api[_-]?key|secret|token|passw' "$SRC"`, then read each hit). Any real secret means Blocked on user. Never commit it, not even redacted, unless the user tells you how.
- **Other people's private material** (names with contact details, private repository content): ask before committing. Your default is to keep the transcript out of this repository and record only its hash and where it lives (`--visibility private`).
41 changes: 41 additions & 0 deletions .agents/skills/request-intake/references/explore-briefs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Explore briefs (read-only context subagents)

Read this in step 4 of `request-intake` and in step 4 of `research-prepare`. Launch all briefs in one turn, so the explorers run in parallel. Explorers write no files. Their final message is the report.

## Common brief

```
Name: explore-<area>-<4 hex> Role: read-only explorer
Objective: for each topic below, find what already exists in this repository and its issue tracker.
Repository: <checkout path> at origin/main (<sha>). Issue repository: <owner/repo from the profile>.
Topics: <one line per candidate concept: slug, title, the segment ids, 1-sentence summary>
Area: <code and config | docs and architecture | issues and PRs | <named area>>
Writes: nothing. No files anywhere; use pipes and shell variables.
Allowed commands: git grep -n, git log --oneline -- <path>, git show, ls, rg,
gh issue list --state all --search, gh pr list --state all --search, gh issue view, gh pr view.
Done when: every topic has evidence or "nothing found" with the searches you ran.
Return, per topic:
Topic: <slug>
Evidence: - <path>:<line> — what it shows (exact quote of at most 25 words if quoting)
Overlap: - <path | #issue | #PR> — covers | contradicts | would be edited by | duplicates — one line
Targets: - <existing file this topic would edit>, if any
Searched: <the searches>, <n of N results read>
```

## Areas

- **Code and config:** source trees, scripts, CI workflows, flake and module layout touched by the topics.
- **Docs and architecture:**
- `doc/` (dated records), `planning/` (workflow, roadmaps, plans, designs);
- `AGENTS.md`, `CLAUDE.md`, READMEs;
- `.agents/skills/` and `.opencode/skills/` (a topic may already be a skill).
- **Issues and PRs:** open and closed issues and PRs whose title or body covers a topic. Include earlier research packages (`doc/*_research_*`) with overlapping concepts.
- **Named area:** one more explorer for each large subproject the topics touch (for example `pkgs/id`, `infra/`). That explorer reads the subproject's own `AGENTS.md` first.

## Using the reports

Before you rely on a report, re-run two of its claims. Then merge the overlaps into `reading.md`:

- An existing file a concept would change makes that concept `kind: edit`, with the file as a target.
- An existing issue or PR that covers a concept goes in that concept's thoughts ("Overlap: #123 already tracks ..."). The concept is kept, never dropped. Whether to merge them is decided at S2.
- A contradiction between the request and an existing doc becomes a thought on the concept, citing both the segment and the `path:line`.
Loading
Loading