@juicesharp/rpiv-pi 2.0.0 → 2.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 +121 -271
- package/agents/scope-tracer.md +1 -1
- package/docs/agents.md +70 -0
- package/docs/architecture.md +136 -0
- package/docs/lanes.md +82 -0
- package/docs/models-config.md +200 -0
- package/docs/skills.md +86 -0
- package/docs/workflows.md +109 -0
- package/extensions/rpiv-core/bash-timeout.ts +16 -0
- package/extensions/rpiv-core/built-in-workflows.ts +2363 -278
- package/extensions/rpiv-core/guidance.ts +35 -19
- package/extensions/rpiv-core/lane-list.ts +5 -29
- package/extensions/rpiv-core/lane-progress.ts +5 -76
- package/extensions/rpiv-core/models-config.ts +35 -0
- package/extensions/rpiv-core/run-lane-registry.ts +0 -65
- package/extensions/rpiv-core/sdk-workflow-host.ts +4 -0
- package/extensions/rpiv-core/workflow-execution-host.ts +24 -7
- package/package.json +7 -3
- package/skills/amend/SKILL.md +7 -3
- package/skills/annotate-guidance/SKILL.md +2 -3
- package/skills/annotate-inline/SKILL.md +1 -3
- package/skills/architecture-review/SKILL.md +5 -4
- package/skills/blueprint/SKILL.md +14 -6
- package/skills/changelog/SKILL.md +1 -0
- package/skills/commit/SKILL.md +1 -0
- package/skills/design/SKILL.md +8 -5
- package/skills/design-review/SKILL.md +2 -1
- package/skills/design-slice/SKILL.md +2 -1
- package/skills/discover/SKILL.md +3 -4
- package/skills/elaborate/SKILL.md +17 -5
- package/skills/elaborate/_helpers/validate-workflow-invariant.mjs +88 -0
- package/skills/explore/SKILL.md +1 -0
- package/skills/frontend-design/SKILL.md +1 -0
- package/skills/grade/SKILL.md +20 -3
- package/skills/implement/SKILL.md +10 -2
- package/skills/plan/SKILL.md +10 -6
- package/skills/research/SKILL.md +14 -12
- package/skills/resume-handoff/SKILL.md +2 -1
- package/skills/revise/SKILL.md +1 -0
- package/skills/slice/SKILL.md +3 -2
- package/skills/synthesize/SKILL.md +16 -7
- package/skills/validate/SKILL.md +2 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Architecture and internals
|
|
2
|
+
|
|
3
|
+
What `@juicesharp/rpiv-pi` registers into a Pi session, how it finds its siblings, and
|
|
4
|
+
how it injects context. Read this if you are debugging behavior you did not ask for, or
|
|
5
|
+
extending the package.
|
|
6
|
+
|
|
7
|
+
## The package tree
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
rpiv-pi/
|
|
11
|
+
├── extensions/rpiv-core/ the one extension: hooks, commands, lanes, guidance, model config
|
|
12
|
+
├── skills/ 27 contract-carrying skills, one directory each
|
|
13
|
+
├── agents/ 15 subagent profiles, copied to ~/.pi/agent/agents/ at runtime
|
|
14
|
+
└── scripts/ deterministic helpers skills shell out to (Node built-ins only)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The `pi` manifest in `package.json` is two lines:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
"pi": { "extensions": ["./extensions"], "skills": ["./skills"] }
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Extensions load as TypeScript through jiti — there is no build step. Agents are not in
|
|
24
|
+
the manifest; they are copied to disk instead (see [agents.md](./agents.md)).
|
|
25
|
+
|
|
26
|
+
## It registers zero tools
|
|
27
|
+
|
|
28
|
+
rpiv-pi calls `registerTool` nowhere. Every tool its skills use — `Agent`,
|
|
29
|
+
`ask_user_question`, `todo`, `advisor`, `web_search`, `web_fetch` — comes from a sibling
|
|
30
|
+
package. rpiv-pi contributes skills, agents, workflows, commands, and session behavior;
|
|
31
|
+
the siblings contribute capability.
|
|
32
|
+
|
|
33
|
+
## Session surfaces
|
|
34
|
+
|
|
35
|
+
| Surface | Registered by | Notes |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| `/rpiv-setup` | always | Interactive only |
|
|
38
|
+
| `/rpiv-update-agents` | always | |
|
|
39
|
+
| `/rpiv-models` | always | Interactive only |
|
|
40
|
+
| `/lanes` | always | No-ops with a notice when nothing is running |
|
|
41
|
+
| `ctrl+q` | conditionally | Skipped entirely when `RPIV_LANES_HOTKEY` disables it |
|
|
42
|
+
| `/skill:<name>` × 27 | Pi, from the manifest | |
|
|
43
|
+
| `--rpiv-debug` flag | always | Reveals the hidden injected messages below |
|
|
44
|
+
|
|
45
|
+
Session events subscribed: `session_start`, `session_compact`, `session_shutdown`,
|
|
46
|
+
`tool_call`, `before_agent_start`, plus `input` and `agent_end` for the `/skill:` model
|
|
47
|
+
bracket.
|
|
48
|
+
|
|
49
|
+
Startup maintenance — per-directory cleanup, agent sync, and the sibling banner — runs
|
|
50
|
+
once per process load, not on every `session_start`.
|
|
51
|
+
|
|
52
|
+
## Guidance injection
|
|
53
|
+
|
|
54
|
+
On every `read`, `edit`, or `write` tool call, rpiv-pi walks from the project root down
|
|
55
|
+
to the touched file's directory. At each depth it picks **at most one** file, the first
|
|
56
|
+
that exists of:
|
|
57
|
+
|
|
58
|
+
1. `AGENTS.md`
|
|
59
|
+
2. `CLAUDE.md`
|
|
60
|
+
3. `.rpiv/guidance/<subpath>/architecture.md`
|
|
61
|
+
|
|
62
|
+
Depth 0 skips `AGENTS.md` and `CLAUDE.md` because Pi's own resource loader already
|
|
63
|
+
handles the working directory, but it still checks
|
|
64
|
+
`<cwd>/.rpiv/guidance/architecture.md`. Root guidance is additionally injected at
|
|
65
|
+
`session_start`.
|
|
66
|
+
|
|
67
|
+
Delivery is a hidden message with `customType: "rpiv-guidance"`. An in-process set
|
|
68
|
+
deduplicates it, cleared on `session_start`, `session_compact`, and `session_shutdown`.
|
|
69
|
+
Run `pi --rpiv-debug` to see the messages as they are sent.
|
|
70
|
+
|
|
71
|
+
## Git context injection
|
|
72
|
+
|
|
73
|
+
Branch, short commit, and user are injected at `session_start`, re-injected after
|
|
74
|
+
`session_compact`, and on `before_agent_start` only when they changed — a git-mutating
|
|
75
|
+
bash command invalidates the cache. `customType: "rpiv-git-context"`, also revealed by
|
|
76
|
+
`--rpiv-debug`.
|
|
77
|
+
|
|
78
|
+
Git is optional. If the `git` calls fail, the injection is skipped and nothing else
|
|
79
|
+
changes. When `git config user.name` is empty, `$USER` is used, then `unknown`.
|
|
80
|
+
|
|
81
|
+
## Pipeline pointer
|
|
82
|
+
|
|
83
|
+
18 of the 27 skills set `disable-model-invocation: true`, which hides them from the
|
|
84
|
+
model's skill list so it cannot wander into a design pass mid-conversation. To keep them
|
|
85
|
+
discoverable, a roughly 120-token stage index is injected at `session_start` — hidden
|
|
86
|
+
by default, visible under `--rpiv-debug`.
|
|
87
|
+
|
|
88
|
+
## Sibling coupling
|
|
89
|
+
|
|
90
|
+
Sibling **presence** is detected from the filesystem: a case-insensitive regex over the
|
|
91
|
+
`packages[]` array in the active Pi settings file (`<agent dir>/settings.json`, honoring
|
|
92
|
+
`PI_CODING_AGENT_DIR`). No sibling is statically imported from the entry graph; a test
|
|
93
|
+
enforces that.
|
|
94
|
+
|
|
95
|
+
`/rpiv-setup` installs eight packages:
|
|
96
|
+
|
|
97
|
+
| Package | Provides |
|
|
98
|
+
| --- | --- |
|
|
99
|
+
| `@tintinweb/pi-subagents` | `Agent`, `get_subagent_result`, `steer_subagent` tools |
|
|
100
|
+
| `@juicesharp/rpiv-ask-user-question` | `ask_user_question` tool |
|
|
101
|
+
| `@juicesharp/rpiv-todo` | `todo` tool, `/todos`, overlay widget |
|
|
102
|
+
| `@juicesharp/rpiv-advisor` | `advisor` tool and `/advisor` |
|
|
103
|
+
| `@juicesharp/rpiv-i18n` | `/languages`, `--locale`, the i18n SDK |
|
|
104
|
+
| `@juicesharp/rpiv-web-tools` | `web_search`, `web_fetch`, `/web-tools` |
|
|
105
|
+
| `@juicesharp/rpiv-args` | `$N` / `$ARGUMENTS` substitution in skill bodies |
|
|
106
|
+
| `@juicesharp/rpiv-workflow` | `/wf` and the workflow runner |
|
|
107
|
+
|
|
108
|
+
It installs them serially with a 120-second timeout each, previews every change in a
|
|
109
|
+
confirmation dialog, and applies nothing until you confirm. It also prunes the
|
|
110
|
+
superseded `pi-subagents` entry from `settings.json` when it finds one.
|
|
111
|
+
|
|
112
|
+
Only two siblings are ever imported at runtime, both behind guarded dynamic imports that
|
|
113
|
+
no-op silently when the module is absent: `@juicesharp/rpiv-workflow` (built-in
|
|
114
|
+
workflows, execution host, skill contracts, lane progress) and `@juicesharp/rpiv-warp`
|
|
115
|
+
(the Blocked badge on parked questions, entirely opt-in).
|
|
116
|
+
|
|
117
|
+
Registration order is load-bearing. The session hooks, `/rpiv-update-agents`, and
|
|
118
|
+
`/rpiv-setup` register unconditionally and first, so a clean install with no siblings
|
|
119
|
+
still shows the missing-siblings banner and can fix itself. The three
|
|
120
|
+
workflow-dependent registrars are chained strictly in sequence to avoid a
|
|
121
|
+
half-initialized barrel under jiti.
|
|
122
|
+
|
|
123
|
+
## Uninstall
|
|
124
|
+
|
|
125
|
+
```sh
|
|
126
|
+
pi uninstall npm:@juicesharp/rpiv-pi
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Optionally `pi uninstall npm:@tintinweb/pi-subagents` if no other plugin needs it, then
|
|
130
|
+
restart Pi. Your `.rpiv/artifacts/` tree, `~/.config/rpiv-pi/models.json`, and
|
|
131
|
+
`~/.pi/agent/agents/` are left in place — delete them by hand if you want them gone.
|
|
132
|
+
|
|
133
|
+
## Releasing
|
|
134
|
+
|
|
135
|
+
Every `@juicesharp/rpiv-*` package ships in lockstep from the monorepo root via
|
|
136
|
+
`node scripts/release.mjs`. Never run `npm version` inside this package.
|
package/docs/lanes.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Lanes
|
|
2
|
+
|
|
3
|
+
Every `/wf` stage runs in a detached child session. The lane dock and lane browser are
|
|
4
|
+
how you watch those runs, answer their questions, and stop them.
|
|
5
|
+
|
|
6
|
+
## The dock
|
|
7
|
+
|
|
8
|
+
Once a run is in flight, a lane dock renders directly below your editor. It stays there
|
|
9
|
+
for the life of the run — you keep typing in the main session while stages execute. Each
|
|
10
|
+
lane shows one run; a fanout stage adds a sub-row per parallel unit.
|
|
11
|
+
|
|
12
|
+
From an **empty** prompt (no text typed, no autocomplete open, at least one lane):
|
|
13
|
+
|
|
14
|
+
| Key | Effect |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| `↓` | Step into the lane browser |
|
|
17
|
+
| `esc` | Clear the dock — only once every lane has finished; a single running lane makes it a no-op |
|
|
18
|
+
|
|
19
|
+
## Opening the browser
|
|
20
|
+
|
|
21
|
+
| Trigger | Notes |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| `/lanes` | Always available |
|
|
24
|
+
| `ctrl+q` | Global hotkey; requires a UI, at least one lane, and that you are not already focused into a run |
|
|
25
|
+
| `↓` on an empty prompt | See above |
|
|
26
|
+
|
|
27
|
+
With no runs in flight, `/lanes` notifies `No in-flight runs.`; `ctrl+q` silently does
|
|
28
|
+
nothing.
|
|
29
|
+
|
|
30
|
+
## Inside the browser
|
|
31
|
+
|
|
32
|
+
The browser replays the selected lane's transcript, tool calls included.
|
|
33
|
+
|
|
34
|
+
| Key | Effect |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `↑` / `↓` | Move along the lane spine. `↑` on the top row backs out |
|
|
37
|
+
| `⏎` | Arm the parked question on a flagged lane, inline |
|
|
38
|
+
| `PgUp` / `PgDn` | Scroll the transcript. Scrolling away from the tail switches the footer from `following` to `paused` |
|
|
39
|
+
| `t` | Expand or collapse tool output |
|
|
40
|
+
| `x` | Stop the selected run |
|
|
41
|
+
| `esc` / `←` | Back out to the prompt |
|
|
42
|
+
|
|
43
|
+
The footer states the live contract:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
↑/↓ lanes · ⏎ answer · following · PgUp/PgDn scroll · t expand · x stop · ↑/←/esc back
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Parked questions
|
|
50
|
+
|
|
51
|
+
When a detached stage needs an answer, it does not steal your session. The question
|
|
52
|
+
parks on that lane, the row is flagged, and the browser's footer grows `⏎ answer`.
|
|
53
|
+
Press `⏎` on the flagged lane to arm the question in place and answer it there; the
|
|
54
|
+
browser stays open across answers, so you can work through several lanes in a row.
|
|
55
|
+
|
|
56
|
+
While a question has focus, `esc` hands the keys back to the lane spine and leaves the
|
|
57
|
+
question deferred — it stays parked until you come back to it. The footer in that state
|
|
58
|
+
reads `esc → lanes · answer in the question above`.
|
|
59
|
+
|
|
60
|
+
Install [`@juicesharp/rpiv-warp`](https://www.npmjs.com/package/@juicesharp/rpiv-warp)
|
|
61
|
+
if you want parked questions to also raise a "Blocked" badge in Warp. It is entirely
|
|
62
|
+
opt-in; without it nothing changes.
|
|
63
|
+
|
|
64
|
+
## Configuration
|
|
65
|
+
|
|
66
|
+
| Variable | Default | Effect |
|
|
67
|
+
| --- | --- | --- |
|
|
68
|
+
| `RPIV_LANES_HOTKEY` | `ctrl+q` | Rebind the browser hotkey to any Pi key id. Set it to `off`, `none`, `false`, `disabled`, or empty to register no hotkey at all — `/lanes` still works. An unrecognized key id registers but never fires |
|
|
69
|
+
| `RPIV_BASH_TIMEOUT_MS` | `180000` (3 min) | Per-command watchdog on bash calls inside detached child sessions. Clamped to 5 000–1 800 000 ms; a non-numeric or non-positive value falls back to the default. Read once at load, so export it before starting Pi |
|
|
70
|
+
|
|
71
|
+
When a bash call exceeds the watchdog the child session aborts that command and the
|
|
72
|
+
reason is routed into the run's soft-halt gate rather than wedging the lane:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
bash command exceeded the 180s per-command timeout and was aborted: `<command>`
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Why lanes are launcher-only
|
|
79
|
+
|
|
80
|
+
The dock, the dock editor, the execution host, and the progress bridge are installed
|
|
81
|
+
only in a root interactive session. A detached child that re-loads the extension skips
|
|
82
|
+
all of them, so a running stage can never clobber the launcher's dock.
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Model configuration
|
|
2
|
+
|
|
3
|
+
How to give Pi a model provider, and how `@juicesharp/rpiv-pi` routes individual
|
|
4
|
+
agents, skills, and workflow stages to different models and reasoning levels.
|
|
5
|
+
|
|
6
|
+
## Part 1 — giving Pi a provider
|
|
7
|
+
|
|
8
|
+
This is Pi Agent's own configuration, not rpiv-pi's. If `/login` already works or
|
|
9
|
+
`~/.pi/agent/models.json` is set up, skip to Part 2. Pick one:
|
|
10
|
+
|
|
11
|
+
**Subscription login** — start Pi and run `/login` to authenticate with Anthropic
|
|
12
|
+
Claude Pro/Max, ChatGPT Plus/Pro, or GitHub Copilot. `/login` also accepts plain API
|
|
13
|
+
keys for other providers, including Google Gemini.
|
|
14
|
+
|
|
15
|
+
**BYOK (API key)** — edit `~/.pi/agent/models.json` and add a provider entry with
|
|
16
|
+
`baseUrl`, `api`, `apiKey`, and `models[]`. Example, using the z.ai GLM coding plan:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"providers": {
|
|
21
|
+
"zai": {
|
|
22
|
+
"baseUrl": "https://api.z.ai/api/coding/paas/v4",
|
|
23
|
+
"api": "openai-completions",
|
|
24
|
+
"apiKey": "XXXXXXXXX",
|
|
25
|
+
"compat": {
|
|
26
|
+
"supportsDeveloperRole": false,
|
|
27
|
+
"thinkingFormat": "zai"
|
|
28
|
+
},
|
|
29
|
+
"models": [
|
|
30
|
+
{
|
|
31
|
+
"id": "glm-5.1",
|
|
32
|
+
"name": "glm-5.1 [coding plan]",
|
|
33
|
+
"reasoning": true,
|
|
34
|
+
"input": ["text"],
|
|
35
|
+
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
|
|
36
|
+
"contextWindow": 204800,
|
|
37
|
+
"maxTokens": 131072
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
With no provider configured, `/rpiv-models` cannot offer you anything and reports
|
|
46
|
+
`No models available (no API keys configured?).`
|
|
47
|
+
|
|
48
|
+
## Part 2 — rpiv-pi's `models.json`
|
|
49
|
+
|
|
50
|
+
### Where it lives
|
|
51
|
+
|
|
52
|
+
`<config dir>/rpiv-pi/models.json`, where the config dir is `$XDG_CONFIG_HOME` when
|
|
53
|
+
that is set to an absolute path (or a `~` / `~/…` path, which is tilde-expanded
|
|
54
|
+
first), and `~/.config` otherwise.
|
|
55
|
+
|
|
56
|
+
| Environment | Path |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| default | `~/.config/rpiv-pi/models.json` |
|
|
59
|
+
| `XDG_CONFIG_HOME=/x` | `/x/rpiv-pi/models.json` |
|
|
60
|
+
|
|
61
|
+
An `XDG_CONFIG_HOME` that is unset, empty, whitespace-only, relative, or in `~user`
|
|
62
|
+
form is ignored and `~/.config` is used.
|
|
63
|
+
|
|
64
|
+
**Reads fall back, writes do not.** If the XDG path does not exist, rpiv-pi still reads
|
|
65
|
+
`~/.config/rpiv-pi/models.json`. If the XDG path *does* exist, it wins even when its
|
|
66
|
+
JSON is malformed — corruption is warned about, never masked by the legacy file.
|
|
67
|
+
`/rpiv-models` always writes the XDG path.
|
|
68
|
+
|
|
69
|
+
The file is written with mode `0600`. The `chmod` is best-effort and never gates
|
|
70
|
+
success, so filesystems that ignore permission bits (tmpfs, some network mounts,
|
|
71
|
+
Windows) still save correctly.
|
|
72
|
+
|
|
73
|
+
Missing or malformed JSON degrades to no overrides at all. The parsed config is cached
|
|
74
|
+
for the session and re-read after a successful `/rpiv-models` save or a
|
|
75
|
+
`/rpiv-update-agents` run.
|
|
76
|
+
|
|
77
|
+
### Schema
|
|
78
|
+
|
|
79
|
+
| Key | Type | Applies to |
|
|
80
|
+
| --- | --- | --- |
|
|
81
|
+
| `defaults` | entry | Everything below that does not override it |
|
|
82
|
+
| `agents` | `{ [agentName]: entry }` | Bundled subagents, keyed by filename without `.md` |
|
|
83
|
+
| `stages` | `{ [stageName]: entry }` | A workflow stage, in every workflow that has it |
|
|
84
|
+
| `skills` | `{ [skillName]: entry }` | A skill, both as a `/wf` stage and as a typed `/skill:<name>` |
|
|
85
|
+
| `presets` | `{ [workflowName]: { stages: { [stage]: entry } } }` | One stage of one workflow |
|
|
86
|
+
|
|
87
|
+
An **entry** is either a bare string `"provider/modelId"` or an object
|
|
88
|
+
`{ "model": "provider/modelId", "thinking": "<level>" }`. No other keys are accepted at
|
|
89
|
+
any level — a `presets.<name>.defaults` block, for example, is rejected by the schema.
|
|
90
|
+
|
|
91
|
+
### Cascade
|
|
92
|
+
|
|
93
|
+
Most specific wins:
|
|
94
|
+
|
|
95
|
+
1. `presets[workflow].stages[stage]`
|
|
96
|
+
2. `stages[stage]`
|
|
97
|
+
3. `skills[skill]`
|
|
98
|
+
4. `defaults`
|
|
99
|
+
|
|
100
|
+
Each layer is composed field-by-field against `defaults` when the file loads, so an
|
|
101
|
+
entry that sets only `thinking` still inherits the default model. Two *configured*
|
|
102
|
+
layers do not merge with each other — the most specific one replaces the others whole.
|
|
103
|
+
|
|
104
|
+
**The standalone `/skill:` exception.** A user-typed `/skill:<name>` picks up an
|
|
105
|
+
override only from an explicit `skills[<name>]` entry. `defaults` does not arm it, so
|
|
106
|
+
your current session model stays sovereign for anything you invoke by hand.
|
|
107
|
+
|
|
108
|
+
### Reasoning levels
|
|
109
|
+
|
|
110
|
+
Six values are accepted in `thinking`: `off`, `minimal`, `low`, `medium`, `high`,
|
|
111
|
+
`xhigh`. Omitting the field and setting it to `off` are different: omitting inherits the
|
|
112
|
+
session baseline, `off` explicitly disables reasoning. Anything else is warned about:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
[rpiv-pi] models.json: unknown thinking level "<v>" — valid values: off, minimal, low, medium, high, xhigh
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Model key form
|
|
119
|
+
|
|
120
|
+
Canonical is `provider/modelId` with a slash. The legacy `provider:modelId` colon form
|
|
121
|
+
still parses on read for back-compatibility; new saves emit the slash form.
|
|
122
|
+
|
|
123
|
+
### Typo detection
|
|
124
|
+
|
|
125
|
+
A session-start check reports record keys that pass schema validation but would silently
|
|
126
|
+
never apply — `skills.committ`, `agents.codebase-analzyer`, `presets.shipp`,
|
|
127
|
+
`presets.ship.stages.plann`. It warns once per process with the dotted path. The
|
|
128
|
+
`agents` and `skills` axes are always checked; `stages` and `presets` are checked only
|
|
129
|
+
when the workflow runner can supply the universe of names, so you never get a false
|
|
130
|
+
warning from a workflow it could not see.
|
|
131
|
+
|
|
132
|
+
## Worked examples
|
|
133
|
+
|
|
134
|
+
**Cheap models for cheap turns**
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"defaults": "anthropic/claude-opus-4-7",
|
|
139
|
+
"skills": {
|
|
140
|
+
"commit": "zai/glm-4-7",
|
|
141
|
+
"changelog": "zai/glm-4-7",
|
|
142
|
+
"research": { "model": "openai/gpt-5.5", "thinking": "high" }
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Your default is Opus. `/skill:commit` and `/skill:changelog` use the cheaper GLM;
|
|
148
|
+
`/skill:research` uses GPT-5.5 at high effort. Workflow-dispatched runs of the same
|
|
149
|
+
skills inherit the same overrides through the cascade's skill rung.
|
|
150
|
+
|
|
151
|
+
**Per-workflow stage overrides**
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"defaults": "anthropic/claude-opus-4-7",
|
|
156
|
+
"presets": {
|
|
157
|
+
"ship": {
|
|
158
|
+
"stages": {
|
|
159
|
+
"plan": "openai/gpt-5.5",
|
|
160
|
+
"design": { "model": "openai/gpt-5.5", "thinking": "high" }
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"polish": {
|
|
164
|
+
"stages": {
|
|
165
|
+
"plan": "zai/glm-4-7"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
`/wf ship`'s plan and design stages use GPT-5.5, `/wf polish`'s plan stage uses GLM, and
|
|
173
|
+
everything else falls through to Opus.
|
|
174
|
+
|
|
175
|
+
**A subagent on a cheaper model**
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"agents": {
|
|
180
|
+
"codebase-locator": "zai/glm-4-7",
|
|
181
|
+
"web-search-researcher": { "model": "zai/glm-4-7", "thinking": "off" }
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Agent overrides are injected into the agent's frontmatter on disk, so they take effect
|
|
187
|
+
the next time the file is synced. Run `/rpiv-update-agents` to apply them mid-session.
|
|
188
|
+
|
|
189
|
+
## The `/rpiv-models` picker
|
|
190
|
+
|
|
191
|
+
`/rpiv-models` walks scope → key → model → effort → save. `esc` steps back one level;
|
|
192
|
+
`esc` at the scope step exits. It requires interactive mode.
|
|
193
|
+
|
|
194
|
+
- Every scope, including `defaults`, offers **Reset to default** to drop an override.
|
|
195
|
+
- A **reset all overrides** scope clears the file, behind a confirmation dialog.
|
|
196
|
+
- Non-reasoning models skip the effort step and commit immediately.
|
|
197
|
+
- The effort step lists `inherit (no override)` and `off (disable reasoning)` as
|
|
198
|
+
separate choices — picking `inherit` persists no `thinking` field at all.
|
|
199
|
+
- On save it notifies `Saved <scope>/<key> → <model> (<effort>)`; removing an override
|
|
200
|
+
notifies `Removed <label>.`
|
package/docs/skills.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Skills reference
|
|
2
|
+
|
|
3
|
+
Every skill `@juicesharp/rpiv-pi` ships, what it consumes, what it writes, and
|
|
4
|
+
whether the model may reach for it on its own.
|
|
5
|
+
|
|
6
|
+
## How to read these tables
|
|
7
|
+
|
|
8
|
+
- **Invoke** — `/skill:<name>` from inside a Pi session, or as a stage of a `/wf`
|
|
9
|
+
workflow (see [workflows.md](./workflows.md)).
|
|
10
|
+
- **Auto** — ✓ means the model may select the skill by itself from your prompt.
|
|
11
|
+
18 of the 27 skills set `disable-model-invocation: true` and are marked —;
|
|
12
|
+
those run *only* on an explicit `/skill:<name>` or a workflow dispatch. A short
|
|
13
|
+
stage index is injected at session start so the model still knows they exist and
|
|
14
|
+
can suggest one.
|
|
15
|
+
- **Writes** — the artifact bucket under `.rpiv/artifacts/`. "side-effect" means the
|
|
16
|
+
skill changes the repo (code, commits, docs) rather than emitting an artifact.
|
|
17
|
+
- Every skill declares a `contract:` block (`produces` / `consumes`) in its
|
|
18
|
+
frontmatter. `/wf` uses those contracts to route each stage's output into the next
|
|
19
|
+
stage's input without you naming paths.
|
|
20
|
+
|
|
21
|
+
## Intent and research
|
|
22
|
+
|
|
23
|
+
| Skill | Auto | Consumes | Writes | What it does |
|
|
24
|
+
| --- | :---: | --- | --- | --- |
|
|
25
|
+
| `discover` | — | free text, or an existing artifact path | `discover/` | Interviews you one question at a time and synthesizes a Feature Requirements Document. The first question is intent-only, before any codebase probe; later ones ground in what the probe found. Its Decisions block flows through `research` into `design`. |
|
|
26
|
+
| `research` | — | free text, or a `discover` artifact | `research/` | Dispatches `scope-tracer` to formulate trace-quality questions, answers them with parallel analysis agents, and synthesizes a research document. |
|
|
27
|
+
| `explore` | — | a `research` artifact | `solutions/` | Compares solution approaches with pros, cons, trade-offs, and a recommendation. Use when several implementations are valid. |
|
|
28
|
+
| `slice` | — | a `research` artifact | `slices/` | Cuts the work into independent vertical slices, each separately designable, with a machine-readable `slices:` frontmatter array. Also runs in re-slice mode to structurally re-cut a map that failed a readiness gate. |
|
|
29
|
+
|
|
30
|
+
## Design
|
|
31
|
+
|
|
32
|
+
| Skill | Auto | Consumes | Writes | What it does |
|
|
33
|
+
| --- | :---: | --- | --- | --- |
|
|
34
|
+
| `design` | — | `research` or `solutions` | `designs/` | Decomposes a feature into vertical slices, generates code slice by slice with per-slice `slice-verifier` dispatch, and emits architecture decisions, slice breakdown, and file map. |
|
|
35
|
+
| `design-slice` | — | `slices` (+ upstream `design`) | `designs/` | Designs exactly ONE slice in isolation — decisions, file map, key interfaces, integration points, success criteria. A fanout unit, not standalone. |
|
|
36
|
+
| `design-review` | — | every per-slice `design` + the `slices` map | in-place edits | One consolidated developer checkpoint over a whole design fanout: accept or adjust the proposed shape, adjustments applied surgically and cascaded to dependent slices. |
|
|
37
|
+
| `synthesize` | — | N `designs` (or N `subplans`) | `plans/`, `subplans/` | Merges independent per-slice designs into one coherent phased plan, reconciling overlaps and ordering phases by slice dependency. Runs hierarchically for large slice maps via `--as-subplan`. |
|
|
38
|
+
|
|
39
|
+
## Planning
|
|
40
|
+
|
|
41
|
+
| Skill | Auto | Consumes | Writes | What it does |
|
|
42
|
+
| --- | :---: | --- | --- | --- |
|
|
43
|
+
| `plan` | — | a `design` artifact | `plans/` | Converts a design into parallelized atomic phases with explicit success criteria. Prefer it when a straightforward phased breakdown is enough. |
|
|
44
|
+
| `blueprint` | — | `research` or `solutions` (optional) | `plans/` | Fuses design + plan in one pass: vertical-slice decomposition with developer micro-checkpoints between phases, emitting an implement-ready plan. Lighter subagent fan-out than `design` — it trusts the research artifact's integration and precedent sections. |
|
|
45
|
+
| `elaborate` | — | a `plan` artifact | `elaborations/` | Writes implement-ready code into ONE phase of a synthesized plan. A fanout unit; the results are stitched back into the plan. |
|
|
46
|
+
| `revise` | — | a `plan` (+ optional `reviews`) | `plans/` | Surgically updates an existing plan after review feedback, a mid-implement blocker, or a scope change — preserving structure instead of rewriting. |
|
|
47
|
+
| `amend` | — | one artifact + its `grade` verdicts | same artifact | Fixes only the failing dimensions a grade panel flagged and re-emits the artifact in place. Single-pass, no subagents; a gate's revise stage. |
|
|
48
|
+
|
|
49
|
+
## Execution and verification
|
|
50
|
+
|
|
51
|
+
| Skill | Auto | Consumes | Writes | What it does |
|
|
52
|
+
| --- | :---: | --- | --- | --- |
|
|
53
|
+
| `implement` | — | a `plan` artifact | code changes | Executes a plan phase by phase, verifying each phase against its success criteria before moving on. |
|
|
54
|
+
| `validate` | — | a `plan` + the working tree | `validation/` | Runs each phase's success criteria against the working tree and reports a `pass` / `fail` verdict. |
|
|
55
|
+
| `code-review` | ✓ | the working tree, a branch, or a PR | `reviews/` | Parallel specialist agents audit the diff, compare against peer code, and verify claims. Emits `blockers_count` plus severity-tagged findings. Scope argument accepts `staged`, `working`, a hash, `A..B`, or a branch; empty scope defaults to feature-branch vs default-branch. |
|
|
56
|
+
| `architecture-review` | — | a file, directory, or module path | `architecture-reviews/` | Top-down, layer-by-layer audit with a uniform 10-dimension checklist per layer, triaged through a developer checkpoint. Emits a phased polish plan `blueprint` can consume per phase. Language-agnostic. |
|
|
57
|
+
| `grade` | — | one artifact + one dimension name | `verdicts/` | Judges ONE artifact along ONE named quality dimension and writes a verdict JSON. It only judges — no fixes. A panel member, not standalone. |
|
|
58
|
+
| `commit` | ✓ | a dirty working tree | git commits | Groups staged and unstaged changes into one or more logical commits with descriptive messages. |
|
|
59
|
+
|
|
60
|
+
## Repository utilities
|
|
61
|
+
|
|
62
|
+
| Skill | Auto | Consumes | Writes | What it does |
|
|
63
|
+
| --- | :---: | --- | --- | --- |
|
|
64
|
+
| `pr-triage` | ✓ | a PR number, URL, or the current branch | `triage/` | Read-only triage of a GitHub PR: disposition (Review / Request changes / Hold / Decline), a security tier (0–2), and convention drift. Never checks out or mutates the working tree. |
|
|
65
|
+
| `create-handoff` | ✓ | the current session | `handoffs/` | Compacts the current task, decisions, in-flight changes, and open questions into one file a fresh session can pick up. |
|
|
66
|
+
| `resume-handoff` | ✓ | a `handoff` document | continues work | Reads the handoff, verifies repo, branch, and state, and continues from where the previous session stopped. |
|
|
67
|
+
| `annotate-guidance` | ✓ | the source tree | `.rpiv/guidance/**/architecture.md` | Generates architecture guidance in a shadow tree alongside the source. rpiv-pi injects these automatically — see [architecture.md](./architecture.md). |
|
|
68
|
+
| `annotate-inline` | ✓ | the source tree | `CLAUDE.md` files | Same analysis, written inline next to the code instead of into a shadow tree. |
|
|
69
|
+
| `migrate-to-guidance` | ✓ | existing `CLAUDE.md` files | `.rpiv/guidance/` | Finds every `CLAUDE.md`, transforms internal references, and creates equivalent `architecture.md` files. `--delete-originals` removes the sources. |
|
|
70
|
+
| `changelog` | ✓ | git history + the working tree | `CHANGELOG.md` edits | Regenerates the `[Unreleased]` section of every affected changelog in Keep a Changelog style from Conventional Commit prefixes. Monorepo-aware and idempotent. |
|
|
71
|
+
| `frontend-design` | — | the project's style system | injected guidance | Injects tailored visual design guidance for web frontend work. Auto-adapts: empty scan → 2-question micro-interview; established design system → scan-only injection. |
|
|
72
|
+
|
|
73
|
+
## Artifact buckets
|
|
74
|
+
|
|
75
|
+
Everything lands under `.rpiv/artifacts/` in the project you are working in:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
.rpiv/artifacts/
|
|
79
|
+
├── goal/ discover/ research/
|
|
80
|
+
├── solutions/ slices/ designs/
|
|
81
|
+
├── elaborations/ plans/ subplans/
|
|
82
|
+
├── verdicts/ reviews/ validation/
|
|
83
|
+
└── architecture-reviews/ triage/ handoffs/
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The directory is created lazily by the first skill that writes into it.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Workflows and recipes
|
|
2
|
+
|
|
3
|
+
The five `/wf` pipelines `@juicesharp/rpiv-pi` contributes, and the hand-driven
|
|
4
|
+
skill chains to reach for when you don't want a whole pipeline.
|
|
5
|
+
|
|
6
|
+
`/wf` itself ships with [`@juicesharp/rpiv-workflow`](https://www.npmjs.com/package/@juicesharp/rpiv-workflow),
|
|
7
|
+
which `/rpiv-setup` installs. rpiv-pi registers its built-ins into that runner at
|
|
8
|
+
session start; if the runner is not installed, the built-ins simply do not appear.
|
|
9
|
+
|
|
10
|
+
## Using `/wf`
|
|
11
|
+
|
|
12
|
+
| Form | Effect |
|
|
13
|
+
| --- | --- |
|
|
14
|
+
| `/wf` | Preview every registered workflow |
|
|
15
|
+
| `/wf <name>` | Show one workflow's stage graph |
|
|
16
|
+
| `/wf <name> "<task>"` | Run it — every stage executes in a detached child session |
|
|
17
|
+
| `/wf @<run-id>` | Resume a run |
|
|
18
|
+
|
|
19
|
+
A run appears as a lane in the dock under your editor. You keep typing in the main
|
|
20
|
+
session while it works — see [lanes.md](./lanes.md).
|
|
21
|
+
|
|
22
|
+
## The five built-in workflows
|
|
23
|
+
|
|
24
|
+
### `ship`
|
|
25
|
+
|
|
26
|
+
`blueprint → implement → validate → commit`
|
|
27
|
+
|
|
28
|
+
Fast path with no research and no review. Best when the change is small and the
|
|
29
|
+
approach is already obvious.
|
|
30
|
+
|
|
31
|
+
### `arch`
|
|
32
|
+
|
|
33
|
+
`research → design → plan → implement → validate → code-review → (design loop | commit)`
|
|
34
|
+
|
|
35
|
+
Design-led pipeline for complex changes touching many files or layers. Best when the
|
|
36
|
+
approach itself has to be worked out before planning.
|
|
37
|
+
|
|
38
|
+
### `vet`
|
|
39
|
+
|
|
40
|
+
`code-review → (blueprint → implement → validate → loop) | commit`
|
|
41
|
+
|
|
42
|
+
Examine changes that already exist — yours or a teammate's — and loop a fix cycle if
|
|
43
|
+
the review does not approve them.
|
|
44
|
+
|
|
45
|
+
### `polish`
|
|
46
|
+
|
|
47
|
+
`architecture-review → blueprint (per review phase, accumulating) → implement → validate → code-review → (blueprint loop | commit)`
|
|
48
|
+
|
|
49
|
+
Architecture-review-driven. Best when a large review can't be planned in one pass and
|
|
50
|
+
each phase's plan must build on the ones before it.
|
|
51
|
+
|
|
52
|
+
### `build`
|
|
53
|
+
|
|
54
|
+
`goal → research → slice → slice gate (+ fix loop) → design-slice (parallel fanout) → design-review → synthesize → plan gate → elaborate (parallel fanout) → re-grade → implement → validate → commit`
|
|
55
|
+
|
|
56
|
+
Ship, sliced. It captures your brief verbatim as a goal artifact — the north star the
|
|
57
|
+
quality gates and `validate` anchor against — then decomposes the work into vertical
|
|
58
|
+
slices, designs each in parallel, takes one consolidated developer checkpoint on the
|
|
59
|
+
proposed interfaces, synthesizes hierarchically, and grades the plan before and after
|
|
60
|
+
code is elaborated into it. Three automated gates plus one human checkpoint.
|
|
61
|
+
|
|
62
|
+
## Review loops
|
|
63
|
+
|
|
64
|
+
`arch`, `vet`, and `polish` gate on the numeric `blockers_count` a `code-review`
|
|
65
|
+
artifact reports: greater than zero routes back into a fix stage, zero routes to
|
|
66
|
+
`commit`. The runner's default backward-jump budget is 2, so a review loop runs at
|
|
67
|
+
most three times before the workflow stops looping.
|
|
68
|
+
|
|
69
|
+
## Hand-driven recipes
|
|
70
|
+
|
|
71
|
+
Skills compose without a workflow. Pick the entry point that matches your intent.
|
|
72
|
+
|
|
73
|
+
- **Capture intent before research** — `/skill:discover "<feature>"`. A
|
|
74
|
+
one-question-at-a-time interview that settles goals, non-goals, requirements,
|
|
75
|
+
acceptance criteria, and a decisions log into a Feature Requirements Document. Its
|
|
76
|
+
decisions are inherited by `design` through `research`.
|
|
77
|
+
- **Form context before a task** — `/skill:research "<topic>"`, or
|
|
78
|
+
`/skill:research .rpiv/artifacts/discover/<latest>.md` if you ran discover first.
|
|
79
|
+
Produces a high-signal subspace of the codebase, ready to feed the next prompt.
|
|
80
|
+
- **Compare approaches before designing** — `/skill:explore "<problem>"` →
|
|
81
|
+
`/skill:design <solutions artifact>`. Use when several implementations are valid;
|
|
82
|
+
the solutions artifact is a first-class input to `design`.
|
|
83
|
+
- **One-shot plan from research** — `/skill:research` → `/skill:blueprint` →
|
|
84
|
+
`/skill:implement`. Fuses design and plan into a single pass with the same
|
|
85
|
+
slice-by-slice rigor and a lighter subagent fan-out. Pick `design` → `plan` instead
|
|
86
|
+
when the design is itself a deliverable someone else reviews.
|
|
87
|
+
- **Full feature build** — `/skill:discover` → `research` → `design` → `plan` →
|
|
88
|
+
`implement` → `validate` → `code-review` ↔ `commit`. Jump in at any stage if you
|
|
89
|
+
already have the input artifact.
|
|
90
|
+
- **Investigate a bug** — `/skill:discover "why does X fail"` →
|
|
91
|
+
`/skill:research .rpiv/artifacts/discover/<latest>.md`. Fix straight from the
|
|
92
|
+
research output when the change is too small to warrant a plan.
|
|
93
|
+
- **Adjust mid-implementation** — `/skill:revise <plan artifact>` → resume
|
|
94
|
+
`/skill:implement`. Use when new constraints land after the plan is drafted.
|
|
95
|
+
- **Review before shipping** — `/skill:code-review` ↔ `/skill:commit`. Order is your
|
|
96
|
+
call: review `staged` or `working` before committing to catch issues at the
|
|
97
|
+
smallest blast radius, or commit first and review the branch (empty scope defaults
|
|
98
|
+
to feature-branch vs default-branch, first-parent).
|
|
99
|
+
- **Audit a specific scope** — `/skill:code-review <commit|staged|working|hash|A..B|branch>`.
|
|
100
|
+
- **Review-driven plan revision** — `/skill:code-review` → `/skill:revise <plan>` →
|
|
101
|
+
resume `/skill:implement`. For findings the existing plan can't absorb as spot fixes.
|
|
102
|
+
- **Audit a whole module** — `/skill:architecture-review <path>` →
|
|
103
|
+
`/skill:blueprint <architecture-review artifact>`, one phase at a time. Or run
|
|
104
|
+
`/wf polish` and let the workflow drive the same loop.
|
|
105
|
+
- **Hand off across sessions** — `/skill:create-handoff` → in a new session,
|
|
106
|
+
`/skill:resume-handoff <doc>`.
|
|
107
|
+
- **Onboard a fresh repo** — `/skill:annotate-guidance` once, then use the pipeline
|
|
108
|
+
normally. Use `annotate-inline` if the project follows the `CLAUDE.md` convention,
|
|
109
|
+
or `migrate-to-guidance` to move from one to the other.
|
|
@@ -59,6 +59,14 @@ export interface BashWatchdog {
|
|
|
59
59
|
/** The recorded timeout reason once the watchdog has fired, else `undefined`. Wired to
|
|
60
60
|
* `WorkflowSessionContext.toolTimeout` so the runner can divert the abort to soft-halt. */
|
|
61
61
|
timedOut(): { reason: string } | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Clear the recorded verdict (`fired` → undefined) AND every pending per-`toolCallId`
|
|
64
|
+
* timer WITHOUT unsubscribing — the `subscribe` listener stays live so a resumed turn's
|
|
65
|
+
* new bash `tool_execution_start` re-arms a fresh timer. The strike-recovery path calls
|
|
66
|
+
* this after consuming a strike (before re-prompting the child); `dispose()` (unsubscribe
|
|
67
|
+
* + clear) still runs in the per-stage `finally`. Mirrors `dispose()` minus the unsubscribe.
|
|
68
|
+
*/
|
|
69
|
+
reset(): void;
|
|
62
70
|
/** Unsubscribe + clear any pending timers. The host calls this in its per-stage `finally`. */
|
|
63
71
|
dispose(): void;
|
|
64
72
|
}
|
|
@@ -101,6 +109,14 @@ export function armBashWatchdog(session: WatchableSession, timeoutMs: number = B
|
|
|
101
109
|
|
|
102
110
|
return {
|
|
103
111
|
timedOut: () => fired,
|
|
112
|
+
// Recovery: clear the verdict + pending timers but KEEP the subscribe listener armed,
|
|
113
|
+
// so the resumed turn's next bash call re-arms a fresh per-toolCallId timer. dispose()
|
|
114
|
+
// (below) is the only path that unsubscribes.
|
|
115
|
+
reset: () => {
|
|
116
|
+
fired = undefined;
|
|
117
|
+
for (const timer of timers.values()) clearTimeout(timer);
|
|
118
|
+
timers.clear();
|
|
119
|
+
},
|
|
104
120
|
dispose: () => {
|
|
105
121
|
unsubscribe();
|
|
106
122
|
for (const timer of timers.values()) clearTimeout(timer);
|