@ftrdotdev/pi-qrspi 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,10 +14,17 @@ QRSPI stands for **Q**uestions → **R**esearch → **D**esign → **S**tructure
14
14
 
15
15
  Each phase produces an artifact: a file under `.qrspi/` in your project. The next phase reads the artifact from the previous phase.
16
16
 
17
- The agent pauses at every checkpoint and asks for your approval. It does not advance until you approve. If you request changes, the agent revises the phase output and shows it to you again. You never approve blind: after each phase writes its artifact, the orchestrator reads the file back and shows you the full content — stamped frontmatter included — before asking for approval.
17
+ The agent pauses at every checkpoint and asks for your approval. It does not advance until you approve. If you request changes, the agent revises the phase output and shows it to you again. You never approve blind: after each phase writes its artifact, the orchestrator presents the full content to you — stamped frontmatter included — before asking for approval, rendered by a user-facing preview tool so it never enters the agent's context.
18
18
 
19
19
  This package is the Pi version of the [opencode-qrspi](https://github.com/felixnorden/skills/tree/main/packages/opencode-qrspi) plugin for OpenCode. Both tools use the same `.qrspi/` artifact format, so you can switch between them without losing your research or plans.
20
20
 
21
+ ## Credits
22
+
23
+ The framework is inspired by **Harness Engineering** — the practice of customizing a coding agent's configuration (skills, agents, commands, hooks) to improve reliability and output quality. This concept was coined by [Viv Trivedy](https://x.com/Vtrivedy10) and popularized by [Dex Horthy](https://x.com/dexhorthy) and the team at [HumanLayer](https://humanlayer.dev).
24
+
25
+ - **Blog post**: [Skill Issue: Harness Engineering for Coding Agents](https://humanlayer.dev/blog/skill-issue-harness-engineering-for-coding-agents)
26
+ - **Talk**: Dex Horthy on context engineering and agent harnesses ([YouTube](https://www.youtube.com/watch?v=YwZR6tc7qYg))
27
+
21
28
  ## Installation
22
29
 
23
30
  Install from npm, git, or a local path:
@@ -61,7 +68,7 @@ Run the complete workflow with one command:
61
68
 
62
69
  ### Orchestrated flow
63
70
 
64
- `/qrspi` is an orchestrator. It does not draft artifacts itself; each phase runs in a **separate fresh-context subagent**, so exploration and drafting stay out of your main session's context. The orchestrator owns the session: the Q phase, launching one phase agent at a time, relaying your answers to the Design phase, reading each artifact back and presenting it in full at every checkpoint, and producing the session summary.
71
+ `/qrspi` is an orchestrator. It does not draft artifacts itself; each phase runs in a **separate fresh-context subagent**, so exploration and drafting stay out of your main session's context. The orchestrator owns the session: the Q phase, launching one phase agent at a time, relaying your answers to the Design phase, presenting each artifact in full at every checkpoint without loading it into its own context, and producing the session summary.
65
72
 
66
73
  Each phase agent is told exactly what to do: which template to follow, which prior artifacts to read, where to write (`.qrspi/<kind>/<slug>.md`), and what to return (the inline summary plus any open questions). Phase agents never ask you questions directly — they return questions and design options to the orchestrator, which relays them to you.
67
74
 
@@ -105,7 +112,7 @@ Six prompt templates in `prompts/`, one per phase:
105
112
  | `prompts/qrspi-plan.md` | `/qrspi-plan` |
106
113
  | `prompts/qrspi-iterate.md` | `/qrspi-iterate` |
107
114
 
108
- The `/qrspi` orchestrator runs each phase in a fresh subagent session, so earlier phases do not clutter your main session's context. After each phase, the orchestrator reads the artifact back from disk and presents the full content before the checkpoint — what you approve is exactly what was written, including the extension-stamped frontmatter. The phase prompts double as standalone commands; when run standalone they keep their interactive steps (clarify, options, completion gate), and when invoked by the orchestrator they run in orchestrated mode (no direct user interaction; questions relayed through the orchestrator).
115
+ The `/qrspi` orchestrator runs each phase in a fresh subagent session, so earlier phases do not clutter your main session's context. After each phase, the orchestrator presents the full content to you before the checkpoint — what you approve is exactly what was written, including the extension-stamped frontmatter — rendered by a user-facing preview tool so it never enters the orchestrator's context. The phase prompts double as standalone commands; when run standalone they keep their interactive steps (clarify, options, completion gate), and when invoked by the orchestrator they run in orchestrated mode (no direct user interaction; questions relayed through the orchestrator).
109
116
 
110
117
  ### Extension
111
118
 
@@ -138,7 +145,7 @@ Commit these files. Research and plans are project knowledge, not temporary stat
138
145
 
139
146
  ## Development
140
147
 
141
- The package bundles shared skills from the repo root (`skills/planning-workflow`, `skills/tdd`) through a symlink during development. `npm pack` and `bun pm pack` skip symlinks, so the `prepack` script copies the real skill directories into the tarball. The `postpack` script restores the symlink.
148
+ The `planning-workflow` and `tdd` skills are authored in the separate [`felixnorden/skills`](https://github.com/felixnorden/skills) repo. `scripts/fetch-skills.ts` shallow-clones that repo at a pinned tag (`v0.1.0`) and copies the two skill directories into `./skills`. It runs from `prepare` (on `bun install`, so skills are present for tests) and from `prepack` (before `bun pm pack`, so they land in the tarball). `./skills` is generated, git-ignored, and never committed.
142
149
 
143
150
  The git metadata cache resolves lazily on the first artifact write and caches per working directory for 60 seconds. The orchestrator session and its subagents share the cache, so later writes never re-run git. A bash command that changes git state (`commit`, `checkout`, `rebase`, `pull`, …) resets the cache.
144
151
 
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@ftrdotdev/pi-qrspi",
3
- "version": "0.1.0",
4
- "homepage": "https://github.com/felixnorden/skills/blob/main/packages/pi-qrspi/README.md",
3
+ "version": "0.2.0",
4
+ "homepage": "https://github.com/felixnorden/pi-mono/blob/main/packages/qrspi/README.md",
5
5
  "bugs": {
6
- "url": "https://github.com/felixnorden/skills/issues"
6
+ "url": "https://github.com/felixnorden/pi-mono/issues"
7
7
  },
8
8
  "license": "MIT",
9
+ "author": "Felix Nordén <felixnorden@gmail.com>",
9
10
  "repository": {
10
11
  "type": "git",
11
- "url": "git+https://github.com/felixnorden/skills.git",
12
- "path": "packages/pi-qrspi"
12
+ "url": "git+https://github.com/felixnorden/pi-mono.git",
13
+ "path": "packages/qrspi"
13
14
  },
14
15
  "files": [
15
16
  "prompts",
@@ -19,24 +20,23 @@
19
20
  ],
20
21
  "type": "module",
21
22
  "scripts": {
22
- "prepack": "rm -rf ./skills && mkdir -p ./skills && cp -R ../../skills/planning-workflow ./skills/ && cp -R ../../skills/tdd ./skills/ && rm -rf ./skills/planning-workflow/skills",
23
- "postpack": "rm -rf ./skills && ln -s ../../skills ./skills",
23
+ "fetch:skills": "bun run scripts/fetch-skills.ts",
24
+ "prepare": "[ -d skills/planning-workflow ] || bun run fetch:skills",
25
+ "prepack": "bun run fetch:skills",
24
26
  "pack": "bun pm pack --destination ./dist",
25
27
  "test": "bun test",
26
28
  "typecheck": "tsc --noEmit",
27
- "lint": "oxlint -c oxlint.config.ts",
28
- "lint:fix": "oxlint -c oxlint.config.ts --fix",
29
- "fmt": "oxfmt -c oxfmt.config.ts",
30
- "fmt:check": "oxfmt -c oxfmt.config.ts --check"
29
+ "lint": "oxlint",
30
+ "lint:fix": "oxlint --fix",
31
+ "fmt": "oxfmt",
32
+ "fmt:check": "oxfmt --check"
31
33
  },
32
34
  "devDependencies": {
35
+ "@earendil-works/pi-coding-agent": "^0.84.2",
33
36
  "@types/bun": "latest",
34
37
  "oxfmt": "^0.63.0",
35
- "oxlint": "^1.78.0"
36
- },
37
- "peerDependencies": {
38
- "@earendil-works/pi-coding-agent": "0.84.1",
39
- "typescript": ">=6.0.2"
38
+ "oxlint": "1.77.0",
39
+ "typescript": "7.0.2"
40
40
  },
41
41
  "pi": {
42
42
  "prompts": [
@@ -58,10 +58,10 @@ Write to `<worktree-root>/.qrspi/designs/{slug}.md` (the package extension stamp
58
58
 
59
59
  ### 7 — Completion Gate
60
60
 
61
- Ask the user to confirm the design concept is sufficient before proceeding.
61
+ Preview the written artifact to the user with a user-facing preview tool (fall back to `read` only if none exists), then ask the user to confirm the design concept is sufficient before proceeding.
62
62
 
63
63
  - If confirmed: finalize and save the document.
64
- - If not confirmed: revise according to the requested changes, then re-present for confirmation.
64
+ - If not confirmed: revise according to the requested changes, then preview the revision and ask again for confirmation.
65
65
 
66
66
  ---
67
67
 
@@ -17,7 +17,7 @@ If no feedback string is present, ask the user: "What needs to change in the pla
17
17
 
18
18
  ## Orchestrated Mode
19
19
 
20
- When invoked as a QRSPI phase subagent from `/qrspi`: the feedback arrives in the orchestrator's task, not from the user. Skip Step 1 (Clarify) and the interactive gate — state any assumption explicitly in the revision note and return the revision summary. Interactive steps apply only when run standalone.
20
+ When invoked as a QRSPI phase subagent from `/qrspi`: the feedback arrives in the orchestrator's task, not from the user. Skip Step 1 (Clarify) and Step 5 (Completion Gate) — state any assumption explicitly in the revision note and return the revision summary. Interactive steps apply only when run standalone.
21
21
 
22
22
  ---
23
23
 
@@ -60,6 +60,13 @@ Revised: {YYYY-MM-DD} — {one-line summary of what changed}
60
60
 
61
61
  Write the revised plan to the same path, overwriting the original.
62
62
 
63
+ ### 5 — Completion Gate
64
+
65
+ Preview the revised plan to the user with a user-facing preview tool (fall back to `read` only if none exists), state which slices changed, and ask the user to confirm the revision before finishing.
66
+
67
+ - If confirmed: done.
68
+ - If not confirmed: revise according to the feedback, then preview the revision and ask again for confirmation.
69
+
63
70
  ---
64
71
 
65
72
  Return the revision summary and plan path.
@@ -75,10 +75,10 @@ Write to `<worktree-root>/.qrspi/plans/{slug}.md` (the package extension stamps
75
75
 
76
76
  ### 7 — Completion Gate
77
77
 
78
- Ask the user to confirm the plan is sufficient before proceeding.
78
+ Preview the written plan to the user with a user-facing preview tool (fall back to `read` only if none exists), then ask the user to confirm the plan is sufficient before proceeding.
79
79
 
80
80
  - If confirmed: finalize and save the plan.
81
- - If not confirmed: revise according to the requested changes, then re-present for confirmation.
81
+ - If not confirmed: revise according to the requested changes, then preview the revision and ask again for confirmation.
82
82
 
83
83
  ---
84
84
 
@@ -52,10 +52,10 @@ Write to `<worktree-root>/.qrspi/outlines/{slug}.md` (the package extension stam
52
52
 
53
53
  ### 5 — Completion Gate
54
54
 
55
- Ask the user to confirm the outline is sufficient before proceeding.
55
+ Preview the written outline to the user with a user-facing preview tool (fall back to `read` only if none exists), then ask the user to confirm the outline is sufficient before proceeding.
56
56
 
57
57
  - If confirmed: finalize and save the outline.
58
- - If not confirmed: revise according to the requested changes, then re-present for confirmation.
58
+ - If not confirmed: revise according to the requested changes, then preview the revision and ask again for confirmation.
59
59
 
60
60
  ---
61
61
 
package/prompts/qrspi.md CHANGED
@@ -26,12 +26,12 @@ Per phase launch:
26
26
  - One phase per run, sequential: launch the child in the foreground (blocking) and wait for it to finish, then checkpoint. Do not parallelize phases and do not background phase work — every checkpoint is human-gated.
27
27
  - Pass `context: 'fresh'` so the child carries no session history, and `cwd: <worktree-root>` so it reads and writes the same tree.
28
28
  - Pass `skill: 'planning-workflow'` (add `tdd` for P and I) so the child can load the templates.
29
- - The task text must be self-contained: the phase, the template to follow, the input artifact paths from prior phases, the slug, the ticket (if any), the output path `.qrspi/<kind>/<slug>.md`, and the return contract (inline summary, open questions, anything the orchestrator must relay to the user).
29
+ - The task text must be self-contained: the phase, the template to follow, the input artifact paths from prior phases, the slug, the ticket (if any), the output path `.qrspi/<kind>/<slug>.md`, and the return contract (the final stamped artifact path, inline summary, open questions, anything the orchestrator must relay to the user).
30
30
  - Children write the artifacts themselves. The extension stamps the `YYYYMMDD-` prefix and frontmatter on their writes too — it is shared by the orchestrator session and its subagents.
31
31
 
32
32
  ## Artifact Preview Rule
33
33
 
34
- After each phase subagent completes, READ the artifact back from disk and present it in full to the user before the checkpoint — stamped frontmatter included. Never ask for checkpoint approval without the artifact content visible in the session.
34
+ After each phase subagent completes, present the artifact to the user before the checkpoint — stamped frontmatter included. Use a user-facing preview tool — one that renders the file for the user without adding its contents to your context — when your environment provides one. Only use `read` (which loads contents into your context) if no such tool exists. Never ask for checkpoint approval without the artifact content visible to the user.
35
35
 
36
36
  ## Phases
37
37
 
@@ -39,15 +39,15 @@ Execute in order. **Ask the user for approval at each checkpoint — do not adva
39
39
 
40
40
  **Q — Questions** (you, inline): Gather goal, hard constraints, and out-of-scope items. Do not save a file. Derive the slug if not provided. Checkpoint.
41
41
 
42
- **R — Research** (subagent): Launch the research phase agent. Task: load `planning-workflow` → `templates/research.md`, research the topic, write `.qrspi/research/{slug}.md`, return the inline summary and any open questions. Then read the artifact back, present it in full, checkpoint.
42
+ **R — Research** (subagent): Launch the research phase agent. Task: load `planning-workflow` → `templates/research.md`, research the topic, write `.qrspi/research/{slug}.md`, return the inline summary and any open questions. Then preview the artifact to the user, checkpoint.
43
43
 
44
- **D — Design** (subagent with interactive relay): Launch the design phase agent. The child returns its clarifying questions and 2–3 design options in its output instead of asking you. Relay them to the user with the `question` tool. On direction, send the user's choice back to the design agent (resume it if your environment supports resuming, otherwise relaunch with the choice embedded in the task); it writes `.qrspi/designs/{slug}.md` and returns the summary. Then read the artifact back, present it in full, checkpoint.
44
+ **D — Design** (subagent with interactive relay): Launch the design phase agent. The child returns its clarifying questions and 2–3 design options in its output instead of asking you. Relay them to the user with the `question` tool. On direction, send the user's choice back to the design agent (resume it if your environment supports resuming, otherwise relaunch with the choice embedded in the task); it writes `.qrspi/designs/{slug}.md` and returns the summary. Then preview the artifact to the user, checkpoint.
45
45
 
46
- **S — Structure** (subagent): Launch the structure phase agent. Task: load `templates/outline.md`, produce the outline from the approved design, write `.qrspi/outlines/{slug}.md`, return the outline summary and any unresolved structural decisions. Then read the artifact back, present it in full, checkpoint.
46
+ **S — Structure** (subagent): Launch the structure phase agent. Task: load `templates/outline.md`, produce the outline from the approved design, write `.qrspi/outlines/{slug}.md`, return the outline summary and any unresolved structural decisions. Then preview the artifact to the user, checkpoint.
47
47
 
48
- **P — Plan** (subagent): Launch the plan phase agent with `skill: 'planning-workflow,tdd'`. Task: load `templates/plan.md` and the `tdd` skill, produce the plan from the approved outline, write `.qrspi/plans/{slug}.md`, return the plan summary. Then read the artifact back, present it in full, checkpoint.
48
+ **P — Plan** (subagent): Launch the plan phase agent with `skill: 'planning-workflow,tdd'`. Task: load `templates/plan.md` and the `tdd` skill, produce the plan from the approved outline, write `.qrspi/plans/{slug}.md`, return the plan summary. Then preview the artifact to the user, checkpoint.
49
49
 
50
- **I — Iterate** (subagent, only on revision request): Launch the iterate phase agent with the user's feedback as the task. Task: load `templates/iterate.md`, revise surgically, overwrite the plan in place, return the revision summary. Then read the plan back, present the changed sections, checkpoint. If the child reports that the feedback requires a design change, return to the D phase instead of patching the plan.
50
+ **I — Iterate** (subagent, only on revision request): Launch the iterate phase agent with the user's feedback as the task. Task: load `templates/iterate.md`, revise surgically, overwrite the plan in place, return the revision summary. Then preview the revised plan to the user, noting which slices changed in one line of prose, checkpoint. If the child reports that the feedback requires a design change, return to the D phase instead of patching the plan.
51
51
 
52
52
  ---
53
53
 
@@ -33,7 +33,7 @@ For TDD integration within each slice, load relevant skills before authoring the
33
33
 
34
34
  A QRSPI session runs with one orchestrator and per-phase agents. One phase at a time; every phase ends at a human checkpoint. The orchestrator never drafts artifacts — phase agents do that in fresh contexts, so exploration and drafting stay out of the orchestrator's context.
35
35
 
36
- **Orchestrator owns**: the Q phase, launching each phase agent, relaying user answers (Design phase), reading artifacts back from disk and presenting them in full at each checkpoint, approving or denying advancement, coordinating Iterate, and producing the session summary.
36
+ **Orchestrator owns**: the Q phase, launching each phase agent, relaying user answers (Design phase), previewing each artifact to the user at its checkpoint, approving or denying advancement, coordinating Iterate, and producing the session summary.
37
37
 
38
38
  **Phase agent owns**: loading the current phase's template, reading the prior artifacts, drafting and writing the artifact to `.qrspi/<kind>/<slug>.md`, and returning the inline summary.
39
39
 
@@ -44,7 +44,7 @@ A QRSPI session runs with one orchestrator and per-phase agents. One phase at a
44
44
  - Convert unresolved ambiguities into explicit assumptions in the artifact (Open Questions / Decisions Required sections) rather than blocking.
45
45
  - The package extension stamps the `YYYYMMDD-` prefix and the frontmatter on your write; write to `.qrspi/<kind>/<slug>.md` and let it normalize.
46
46
 
47
- **Artifact visibility**: the orchestrator reads each artifact back after the phase agent writes it and presents the full content — stamped frontmatter included — before asking for checkpoint approval. Approving blind is not part of this workflow.
47
+ **Artifact visibility**: the orchestrator previews each artifact to the user after the phase agent writes it — full content, stamped frontmatter included — using a user-facing preview tool so the artifact never enters the orchestrator's context. Fall back to `read` only if no user-facing preview tool exists. Approving blind is not part of this workflow.
48
48
 
49
49
  ---
50
50