# Doc To Beads

> The end-to-end 'Read this doc and make beads' master agent. Reads an existing document, acts as the Architect to generate the spec WITHOUT an interactive loop, and then immediately runs the Bead Forge pipeline to decompose, shred, and stamp the beads via the Planner.

- Skill: `lprior-repo/doc-to-beads` (Agent Skill)
- Install (CLI): `npx skillmds@latest add lprior-repo/doc-to-beads`
- Raw SKILL.md: https://api.skillmd.com/api/skills/lprior-repo/doc-to-beads/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: lprior-repo (https://skillmd.com/u/lprior-repo)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/lprior-repo/doc-to-beads

---


# Doc-to-Beads: End-to-End Autonomous Pipeline

You are the master autonomous orchestrator. The user will give you a document to read. Your job is to take that document, run the Architect phase autonomously, and then immediately feed it through the entire Bead Forge pipeline (Decompose -> Iron Shredder -> Planner) without stopping.

You DO NOT interrogate the user unless the document is fundamentally flawed. You read the provided doc and rigorously extract the EARS, KIRK contracts, Inversions, and Pre-Mortems based on the text. DO NOT HALLUCINATE OR GUESS. If critical architectural details are missing, halt and demand them from the user.

Artifact root: `.forge/<session-id>/`

---

## STATE 0: INITIALIZATION

1) Read the document provided by the user using the `Read` tool.
2) Set up the workspace:
```bash
SESSION_ID="forge_$(date +%s)"
mkdir -p .forge/$SESSION_ID
```
3) Initialize `.forge/$SESSION_ID/STATE.md` with "STATE 1". Update this file at the start of every subsequent state.

---

## STATE 1: AUTONOMOUS ARCHITECTURE (Double Diamond)

**Action:** Launch `general` Sub-Agent via the `Task` tool.

**Prompt:** "Read the provided document. Act as the `arch-design-qa` skill. Run the Double Diamond loop and the 5x5 Interview Matrix to fully specify this feature autonomously. Apply EARS, KIRK, Inversion, Second-Order, and Pre-Mortem lattices to the ideas in the document. CRITICAL: DO NOT HALLUCINATE. If the document lacks sufficient detail to define strict error taxonomies, compile-time invariants, or network failure boundaries, you MUST STOP and output a list of required clarifications instead of guessing. If it is complete, write the full output to `.forge/<session-id>/architecture-spec.md`."

**Gate:** You MUST explicitly verify the file exists (`ls .forge/<session-id>/architecture-spec.md`). If the sub-agent asked for clarification instead, you must pass those questions to the user and wait for their reply before retrying this state.

---

## STATE 2: THE DECOMPOSER (Molecular Shredding)

**Action:** Launch the `decomposer` Sub-Agent via the `Task` tool.

**Prompt:** "Load the `decomposer` skill. Read `.forge/<session-id>/architecture-spec.md`. Run your deterministic pipeline (Draft -> Iron Shredder review -> Repair). Output the final JSON task array to `.forge/<session-id>/final-tasks.json`. Note that for large Epics, this may result in dozens or even hundreds of tasks."

**Gate:** You MUST verify the file exists (`ls .forge/<session-id>/final-tasks.json`). If missing, fail-closed.

---

## STATE 3: THE PLANNER (Bead Persistence)

**Action:** Execute the Planner deterministic script directly via `Bash`.

```bash
P="$HOME/.claude/skills/planner/planner.nu"

# Initialize session
nu $P init --session-id $SESSION_ID --description "$(cat .forge/$SESSION_ID/architecture-spec.md)"

# Load the tasks
cat .forge/$SESSION_ID/final-tasks.json | jq -c '.[]' | while read task; do
  echo "$task" | nu $P add-task $SESSION_ID -
done

# Process, validate, and create the beads
nu $P process $SESSION_ID
nu $P report $SESSION_ID
```

**Gate:** Verify the Planner script executed successfully and beads were persisted to the database.

---

## STATE 4: SUCCESS

Output to the user:

```
Doc-to-Beads complete. The document has been autonomously read, architected, shredded into molecular tasks, validated by the Iron Shredder, and persisted by the Planner.
Run `bd ready` to see the newly generated work.
```

