@srobroek/pi-user-journeys 0.0.0-stage → 0.6.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/CHANGELOG.md +68 -0
- package/LICENSE +202 -0
- package/README.md +101 -2
- package/agents/journey-scribe.md +30 -0
- package/agents/journey-validator.md +30 -0
- package/extensions/journeys.js +282 -0
- package/package.json +40 -4
- package/skills/journey-campaign/SKILL.md +152 -0
- package/skills/journey-consolidate/SKILL.md +62 -0
- package/skills/journey-init/SKILL.md +100 -0
- package/skills/journey-init/scripts/journeys.py +356 -0
- package/skills/journey-init/templates/FORMAT.md +243 -0
- package/skills/journey-init/templates/README.template.md +55 -0
- package/skills/journey-init/templates/journey.template.md +35 -0
- package/skills/journey-init/templates/run.template.md +18 -0
- package/skills/journey-verify/SKILL.md +87 -0
- package/skills/journey-verify/formulas/journey-step-agentic-verification.formula.toml +72 -0
- package/skills/journey-verify/formulas/journey-step-human-verification.formula.toml +82 -0
- package/skills/journey-verify-changed/SKILL.md +51 -0
- package/skills/journey-write/SKILL.md +144 -0
- package/skills/journeys-guide/SKILL.md +21 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// Generated by scripts/build.ts. Do not edit.
|
|
3
|
+
// plugins/journeys/pi-src/journeys.ts
|
|
4
|
+
import { existsSync as existsSync2 } from "fs";
|
|
5
|
+
import { isAbsolute as isAbsolute2, resolve as resolve2 } from "path";
|
|
6
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
7
|
+
import { Type } from "typebox";
|
|
8
|
+
|
|
9
|
+
// plugins/journeys/shared/journeys-tool.ts
|
|
10
|
+
import { execFile } from "child_process";
|
|
11
|
+
import { copyFileSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync } from "fs";
|
|
12
|
+
import { basename, isAbsolute, join, relative, resolve, sep } from "path";
|
|
13
|
+
import { fileURLToPath } from "url";
|
|
14
|
+
import { promisify } from "util";
|
|
15
|
+
var execFileAsync = promisify(execFile);
|
|
16
|
+
var TIMEOUT_MS = 600000;
|
|
17
|
+
var MAX_BUFFER = 10 * 1024 * 1024;
|
|
18
|
+
function pluginAsset(path) {
|
|
19
|
+
const candidates = [
|
|
20
|
+
fileURLToPath(new URL(`../skills/${path}`, import.meta.url)),
|
|
21
|
+
fileURLToPath(new URL(`../common/skills/${path}`, import.meta.url)),
|
|
22
|
+
fileURLToPath(new URL(`../../common/skills/${path}`, import.meta.url))
|
|
23
|
+
];
|
|
24
|
+
const asset = candidates.find(existsSync);
|
|
25
|
+
if (asset === undefined)
|
|
26
|
+
throw new Error(`journeys plugin asset not found: ${path}`);
|
|
27
|
+
return asset;
|
|
28
|
+
}
|
|
29
|
+
var JOURNEYS_SCRIPT = pluginAsset("journey-init/scripts/journeys.py");
|
|
30
|
+
var FORMULAS_DIR = pluginAsset("journey-verify/formulas/");
|
|
31
|
+
var REQUIRED_FORMULAS = ["journey-step-agentic-verification", "journey-step-human-verification"];
|
|
32
|
+
var exec = async (file, args, options) => {
|
|
33
|
+
const result = await execFileAsync(file, args, options);
|
|
34
|
+
return { stdout: result.stdout, stderr: result.stderr };
|
|
35
|
+
};
|
|
36
|
+
var COMMANDS = ["index", "lint", "prune"];
|
|
37
|
+
function readIndexParams(input) {
|
|
38
|
+
const value = input ?? {};
|
|
39
|
+
const command = value.command;
|
|
40
|
+
if (!COMMANDS.includes(command))
|
|
41
|
+
return "command must be index, lint or prune";
|
|
42
|
+
if (typeof value.journeysDir !== "string" || value.journeysDir === "")
|
|
43
|
+
return "journeysDir is required";
|
|
44
|
+
const params = { command, journeysDir: value.journeysDir };
|
|
45
|
+
if (value.keep !== undefined) {
|
|
46
|
+
if (typeof value.keep !== "number" || !Number.isSafeInteger(value.keep) || value.keep < 0)
|
|
47
|
+
return "keep must be a nonnegative safe integer";
|
|
48
|
+
params.keep = value.keep;
|
|
49
|
+
}
|
|
50
|
+
if (value.yes !== undefined)
|
|
51
|
+
params.yes = value.yes === true;
|
|
52
|
+
if (value.journey !== undefined) {
|
|
53
|
+
if (typeof value.journey !== "string" || value.journey === "")
|
|
54
|
+
return "journey must be a non-empty string";
|
|
55
|
+
params.journey = value.journey;
|
|
56
|
+
}
|
|
57
|
+
return params;
|
|
58
|
+
}
|
|
59
|
+
function journeysWrites(params) {
|
|
60
|
+
if (params.command === "lint")
|
|
61
|
+
return false;
|
|
62
|
+
if (params.command === "prune")
|
|
63
|
+
return params.yes === true;
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
function journeysArgs(params, script = JOURNEYS_SCRIPT) {
|
|
67
|
+
const args = [script, params.command, params.journeysDir];
|
|
68
|
+
if (params.command !== "prune")
|
|
69
|
+
return args;
|
|
70
|
+
if (params.keep !== undefined)
|
|
71
|
+
args.push("--keep", String(params.keep));
|
|
72
|
+
if (params.journey !== undefined)
|
|
73
|
+
args.push("--journey", params.journey);
|
|
74
|
+
if (params.yes)
|
|
75
|
+
args.push("--yes");
|
|
76
|
+
return args;
|
|
77
|
+
}
|
|
78
|
+
async function runJourneys(cwd, params, signal, runner = exec, timeoutMs = TIMEOUT_MS, script = JOURNEYS_SCRIPT) {
|
|
79
|
+
try {
|
|
80
|
+
const result = await runner("python3", journeysArgs(params, script), {
|
|
81
|
+
cwd,
|
|
82
|
+
shell: false,
|
|
83
|
+
timeout: timeoutMs,
|
|
84
|
+
maxBuffer: MAX_BUFFER,
|
|
85
|
+
signal
|
|
86
|
+
});
|
|
87
|
+
return { stdout: result.stdout, stderr: result.stderr, exitCode: 0 };
|
|
88
|
+
} catch (error) {
|
|
89
|
+
const failure = typeof error === "object" && error !== null ? error : {};
|
|
90
|
+
const stdout = typeof failure.stdout === "string" ? failure.stdout : "";
|
|
91
|
+
const stderr = typeof failure.stderr === "string" ? failure.stderr : typeof failure.message === "string" ? failure.message : "";
|
|
92
|
+
if (signal?.aborted)
|
|
93
|
+
return { stdout, stderr, unrun: "cancelled" };
|
|
94
|
+
if (failure.killed === true && failure.code === null)
|
|
95
|
+
return { stdout, stderr, unrun: `timed out after ${timeoutMs / 1000} s` };
|
|
96
|
+
return { stdout, stderr, exitCode: typeof failure.code === "number" ? failure.code : 1 };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function localPath(raw) {
|
|
100
|
+
if (!raw.includes("://") && !raw.startsWith("file:"))
|
|
101
|
+
return raw;
|
|
102
|
+
if (!raw.startsWith("file:"))
|
|
103
|
+
return null;
|
|
104
|
+
try {
|
|
105
|
+
return fileURLToPath(raw);
|
|
106
|
+
} catch {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function managedRoot(dir, base) {
|
|
111
|
+
const local = localPath(dir);
|
|
112
|
+
if (local === null)
|
|
113
|
+
return null;
|
|
114
|
+
if (local.split(sep === "\\" ? /[\\/]/ : "/").includes(".."))
|
|
115
|
+
return null;
|
|
116
|
+
try {
|
|
117
|
+
return realpathSync(resolve(base, local));
|
|
118
|
+
} catch {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function safePath(path, base) {
|
|
123
|
+
const absolute = resolve(isAbsolute(path) ? path : join(base, path));
|
|
124
|
+
const inside = relative(base, absolute);
|
|
125
|
+
if (inside === ".." || inside.startsWith(`..${sep}`) || isAbsolute(inside))
|
|
126
|
+
throw new Error(`outside the managed root: ${absolute}`);
|
|
127
|
+
let current = base;
|
|
128
|
+
if (lstatSync(current, { throwIfNoEntry: false })?.isSymbolicLink())
|
|
129
|
+
throw new Error(`unsafe symlink: ${current}`);
|
|
130
|
+
for (const part of inside.split(sep === "\\" ? /[\\/]/ : "/").filter(Boolean)) {
|
|
131
|
+
current = join(current, part);
|
|
132
|
+
if (lstatSync(current, { throwIfNoEntry: false })?.isSymbolicLink())
|
|
133
|
+
throw new Error(`unsafe symlink: ${current}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function formulaSources(dir) {
|
|
137
|
+
if (!existsSync(dir))
|
|
138
|
+
return [];
|
|
139
|
+
return readdirSync(dir).filter((name) => name.endsWith(".formula.toml")).sort().map((name) => join(dir, name));
|
|
140
|
+
}
|
|
141
|
+
function installFormulas(rawRepoRoot, force, base, rawSourcesDir = FORMULAS_DIR) {
|
|
142
|
+
const repoRoot = managedRoot(rawRepoRoot, base);
|
|
143
|
+
const sourcesDir = managedRoot(rawSourcesDir, base);
|
|
144
|
+
if (repoRoot === null)
|
|
145
|
+
return { ok: false, text: `ERROR not a Beads workspace: ${rawRepoRoot}` };
|
|
146
|
+
if (sourcesDir === null)
|
|
147
|
+
return { ok: false, text: `ERROR no formula sources: ${rawSourcesDir}` };
|
|
148
|
+
try {
|
|
149
|
+
safePath(repoRoot, repoRoot);
|
|
150
|
+
safePath(sourcesDir, sourcesDir);
|
|
151
|
+
safePath(join(repoRoot, ".beads", "formulas"), repoRoot);
|
|
152
|
+
} catch (error) {
|
|
153
|
+
return { ok: false, text: `ERROR ${error instanceof Error ? error.message : String(error)}` };
|
|
154
|
+
}
|
|
155
|
+
const beadsDir = join(repoRoot, ".beads");
|
|
156
|
+
if (!lstatSync(beadsDir, { throwIfNoEntry: false })?.isDirectory())
|
|
157
|
+
return { ok: false, text: `ERROR not a Beads workspace: ${repoRoot}` };
|
|
158
|
+
const destinationDir = join(beadsDir, "formulas");
|
|
159
|
+
const destinationStat = lstatSync(destinationDir, { throwIfNoEntry: false });
|
|
160
|
+
if (destinationStat && (destinationStat.isSymbolicLink() || !destinationStat.isDirectory()))
|
|
161
|
+
return { ok: false, text: `ERROR unsafe formula destination: ${destinationDir}` };
|
|
162
|
+
for (const name of REQUIRED_FORMULAS) {
|
|
163
|
+
const source = join(sourcesDir, `${name}.formula.toml`);
|
|
164
|
+
const st = lstatSync(source, { throwIfNoEntry: false });
|
|
165
|
+
if (!st?.isFile() || st.isSymbolicLink())
|
|
166
|
+
return { ok: false, text: `ERROR required formula missing or unsafe: ${source}` };
|
|
167
|
+
}
|
|
168
|
+
const sources = formulaSources(sourcesDir);
|
|
169
|
+
const unchanged = new Set;
|
|
170
|
+
const unsafe = [];
|
|
171
|
+
const conflicts = [];
|
|
172
|
+
for (const source of sources) {
|
|
173
|
+
const sourceStat = lstatSync(source);
|
|
174
|
+
if (!sourceStat.isFile() || sourceStat.isSymbolicLink())
|
|
175
|
+
return { ok: false, text: `ERROR unsafe formula source: ${source}` };
|
|
176
|
+
const destination = join(destinationDir, basename(source));
|
|
177
|
+
const st = lstatSync(destination, { throwIfNoEntry: false });
|
|
178
|
+
if (!st)
|
|
179
|
+
continue;
|
|
180
|
+
if (st.isSymbolicLink() || !st.isFile())
|
|
181
|
+
unsafe.push(destination);
|
|
182
|
+
else if (readFileSync(destination).equals(readFileSync(source)))
|
|
183
|
+
unchanged.add(source);
|
|
184
|
+
else
|
|
185
|
+
conflicts.push(destination);
|
|
186
|
+
}
|
|
187
|
+
if (unsafe.length)
|
|
188
|
+
return { ok: false, text: `ERROR unsafe formula destinations: ${unsafe.join(", ")}` };
|
|
189
|
+
if (conflicts.length && !force)
|
|
190
|
+
return { ok: false, text: `ERROR refusing to overwrite divergent formula files: ${conflicts.join(", ")}` };
|
|
191
|
+
mkdirSync(destinationDir, { recursive: true });
|
|
192
|
+
let copied = 0;
|
|
193
|
+
for (const source of sources) {
|
|
194
|
+
if (unchanged.has(source))
|
|
195
|
+
continue;
|
|
196
|
+
copyFileSync(source, join(destinationDir, basename(source)));
|
|
197
|
+
copied += 1;
|
|
198
|
+
}
|
|
199
|
+
return { ok: true, text: `formulas: ${copied} copied, ${unchanged.size} unchanged`, copied, unchanged: unchanged.size };
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// plugins/journeys/pi-src/journeys.ts
|
|
203
|
+
var within = (base, path) => isAbsolute2(path) ? path : resolve2(base, path);
|
|
204
|
+
function journeys_default(pi) {
|
|
205
|
+
const packageRoot = fileURLToPath2(new URL("..", import.meta.url));
|
|
206
|
+
const asset = (path) => {
|
|
207
|
+
const candidates = [
|
|
208
|
+
resolve2(packageRoot, "skills", path),
|
|
209
|
+
resolve2(packageRoot, "common/skills", path),
|
|
210
|
+
resolve2(packageRoot, "pi/skills", path),
|
|
211
|
+
resolve2(packageRoot, "../common/skills", path)
|
|
212
|
+
];
|
|
213
|
+
const found = candidates.find(existsSync2);
|
|
214
|
+
if (found === undefined)
|
|
215
|
+
throw new Error(`journeys plugin asset not found: ${path}`);
|
|
216
|
+
return found;
|
|
217
|
+
};
|
|
218
|
+
const journeysScript = asset("journey-init/scripts/journeys.py");
|
|
219
|
+
const formulasDir = asset("journey-verify/formulas");
|
|
220
|
+
pi.registerTool({
|
|
221
|
+
name: "journeys_index",
|
|
222
|
+
label: "Index Journeys",
|
|
223
|
+
description: "Index, structurally lint or prune a user-journeys directory with the bundled journeys.py helper. Lint is structural, not semantic readiness. index rewrites INDEX.md; prune is a dry run unless yes=true. Every prune invocation is confirmed because it may delete runs.",
|
|
224
|
+
parameters: Type.Object({
|
|
225
|
+
command: Type.Union([Type.Literal("index"), Type.Literal("lint"), Type.Literal("prune")]),
|
|
226
|
+
journeysDir: Type.String({ description: "Path to the journeys directory" }),
|
|
227
|
+
keep: Type.Optional(Type.Integer({ minimum: 0, description: "prune: keep the newest N runs (default 20)" })),
|
|
228
|
+
yes: Type.Optional(Type.Boolean({ description: "prune: actually delete (default dry run)" })),
|
|
229
|
+
journey: Type.Optional(Type.String({ description: "prune: the journey directory name; omit only for an authorized directory-wide prune" }))
|
|
230
|
+
}, { required: ["command", "journeysDir"], additionalProperties: false }),
|
|
231
|
+
async execute(_id, raw, signal, _update, ctx) {
|
|
232
|
+
const params = readIndexParams(raw);
|
|
233
|
+
if (typeof params === "string")
|
|
234
|
+
return { content: [{ type: "text", text: `journeys_index: ${params}` }], details: { ok: false } };
|
|
235
|
+
const resolved = { ...params, journeysDir: within(ctx.cwd, params.journeysDir) };
|
|
236
|
+
if ((resolved.command === "prune" || journeysWrites(resolved)) && !ctx.hasUI)
|
|
237
|
+
return { content: [{ type: "text", text: `journeys_index: ${resolved.command} refused because confirmation UI is unavailable` }], details: { ok: false } };
|
|
238
|
+
if (resolved.command === "prune" || journeysWrites(resolved)) {
|
|
239
|
+
const action = resolved.command === "index" ? `write INDEX.md in ${resolved.journeysDir}` : resolved.yes === true ? `delete selected runs in ${resolved.journeysDir}` : `show prune candidates in ${resolved.journeysDir}`;
|
|
240
|
+
if (!await ctx.ui.confirm("Confirm journeys write", action))
|
|
241
|
+
return { content: [{ type: "text", text: "journeys_index: write cancelled" }], details: { ok: false } };
|
|
242
|
+
}
|
|
243
|
+
try {
|
|
244
|
+
const result = await runJourneys(ctx.cwd, resolved, signal, undefined, undefined, journeysScript);
|
|
245
|
+
const output = result.stdout && result.stderr ? `${result.stdout}
|
|
246
|
+
${result.stderr}` : result.stdout || result.stderr;
|
|
247
|
+
if ("unrun" in result) {
|
|
248
|
+
const text = [`journeys.py ${params.command} did not finish: ${result.unrun}`, output].filter(Boolean).join(`
|
|
249
|
+
`);
|
|
250
|
+
return { content: [{ type: "text", text }], details: { ok: false, complete: false, command: params.command, unrun: result.unrun } };
|
|
251
|
+
}
|
|
252
|
+
return { content: [{ type: "text", text: output || `journeys.py ${params.command} exited ${result.exitCode}` }], details: { ok: result.exitCode === 0, complete: true, command: params.command, exitCode: result.exitCode } };
|
|
253
|
+
} catch (error) {
|
|
254
|
+
return { content: [{ type: "text", text: `journeys_index: ${error instanceof Error ? error.message : String(error)}` }], details: { ok: false } };
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
pi.registerTool({
|
|
259
|
+
name: "journey_install_formulas",
|
|
260
|
+
label: "Install Journey Formulas",
|
|
261
|
+
description: "Copy the journeys plugin's formula TOMLs into a Beads workspace's .beads/formulas/. Identical copies stay; divergent destinations are refused unless force=true; symlinked paths are always refused.",
|
|
262
|
+
parameters: Type.Object({
|
|
263
|
+
repoRoot: Type.String({ description: "Repository root containing .beads/" }),
|
|
264
|
+
force: Type.Optional(Type.Boolean({ description: "Overwrite divergent destination files" }))
|
|
265
|
+
}, { required: ["repoRoot"], additionalProperties: false }),
|
|
266
|
+
async execute(_id, raw, _signal, _update, ctx) {
|
|
267
|
+
const { repoRoot, force } = raw;
|
|
268
|
+
if (typeof repoRoot !== "string" || repoRoot === "")
|
|
269
|
+
return { content: [{ type: "text", text: "journey_install_formulas: repoRoot is required" }], details: { ok: false } };
|
|
270
|
+
if (!ctx.hasUI)
|
|
271
|
+
return { content: [{ type: "text", text: "journey_install_formulas: write refused because confirmation UI is unavailable" }], details: { ok: false } };
|
|
272
|
+
const target = within(ctx.cwd, repoRoot);
|
|
273
|
+
if (!await ctx.ui.confirm("Confirm formula install", `Copy journey formulas into ${target}/.beads/formulas/?`))
|
|
274
|
+
return { content: [{ type: "text", text: "journey_install_formulas: write cancelled" }], details: { ok: false } };
|
|
275
|
+
const result = installFormulas(repoRoot, force === true, ctx.cwd, formulasDir);
|
|
276
|
+
return { content: [{ type: "text", text: result.text }], details: { ok: result.ok, copied: result.copied, unchanged: result.unchanged } };
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
export {
|
|
281
|
+
journeys_default as default
|
|
282
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@srobroek/pi-user-journeys",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Author, validate and maintain user journeys: seven skills, the journeys.py helper, and the journey-scribe and journey-validator subagents.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pi-package"
|
|
7
|
+
],
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/srobroek/harness-plugins.git",
|
|
12
|
+
"directory": "plugins/journeys/pi"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"CHANGELOG.md",
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"README.md",
|
|
18
|
+
"agents",
|
|
19
|
+
"extensions",
|
|
20
|
+
"skills"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public",
|
|
24
|
+
"provenance": true
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"typebox": "*"
|
|
28
|
+
},
|
|
29
|
+
"pi": {
|
|
30
|
+
"extensions": [
|
|
31
|
+
"./extensions/journeys.js"
|
|
32
|
+
],
|
|
33
|
+
"skills": [
|
|
34
|
+
"./skills"
|
|
35
|
+
],
|
|
36
|
+
"subagents": {
|
|
37
|
+
"agents": [
|
|
38
|
+
"./agents"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: journey-campaign
|
|
3
|
+
description: "Use for fleet-scale journey or issue validation: fan out validators, fix defects and re-validate until green."
|
|
4
|
+
metadata:
|
|
5
|
+
opencode/autoinvoke: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# journey-campaign
|
|
9
|
+
|
|
10
|
+
Orchestrate validation at fleet scale. FORMAT.md and README.md in the
|
|
11
|
+
journeys directory are normative; the fix-loop policy comes from README
|
|
12
|
+
frontmatter (`fix_loop`, `fix_loop_max_iterations`) unless the invocation
|
|
13
|
+
overrides it.
|
|
14
|
+
|
|
15
|
+
## Mode
|
|
16
|
+
|
|
17
|
+
Two entry points, one engine. Take the mode from the invocation; when
|
|
18
|
+
unstated, infer it from the scope: a journey, a journey subset, or a diff
|
|
19
|
+
→ journey-driven; a tracker query or a list of issues → issue-driven.
|
|
20
|
+
|
|
21
|
+
- **journey-driven** (default) -- the unit of work is a journey. Validate to
|
|
22
|
+
discover defects. Findings are **outputs**. Done when the journeys are
|
|
23
|
+
green.
|
|
24
|
+
- **issue-driven** -- the unit of work is a tracker issue that already
|
|
25
|
+
describes a defect. Findings are **inputs**. Fix first, then verify only
|
|
26
|
+
the steps that cover the issue. Done when the issues are verified and
|
|
27
|
+
closed.
|
|
28
|
+
|
|
29
|
+
Everything after selection is shared: exclusive-profile serialization,
|
|
30
|
+
validator agents, dedupe, the fix loop, hard stops, the report.
|
|
31
|
+
|
|
32
|
+
## Plan
|
|
33
|
+
|
|
34
|
+
1. Select the unit of work: journeys (all `active` by default, or the
|
|
35
|
+
user's subset, or a `journey-verify-changed` scoping pass when the
|
|
36
|
+
campaign is diff-driven), or issues (a reporter query).
|
|
37
|
+
2. Group by interface profile. Profiles with `exclusive: true` form a
|
|
38
|
+
serial lane (one validator at a time -- typically a single desktop app
|
|
39
|
+
instance); the rest run in parallel.
|
|
40
|
+
3. Announce the plan: mode, journeys or issues, lanes, fix-loop mode,
|
|
41
|
+
iteration budget.
|
|
42
|
+
|
|
43
|
+
## Journey-driven campaign
|
|
44
|
+
|
|
45
|
+
Launch one `journey-validator` subagent per journey with: journey path,
|
|
46
|
+
journeys-dir path, mode (full or the scoped step set), and the resolved
|
|
47
|
+
profile. Each validator follows the journey-verify procedure end to end
|
|
48
|
+
(evidence, triage, intent-gated amendments, run file, findings via
|
|
49
|
+
reporter) and returns a structured result: per-step results, amendments,
|
|
50
|
+
finding ids.
|
|
51
|
+
|
|
52
|
+
Aggregate. **Dedupe across journeys**: one product defect surfacing in
|
|
53
|
+
several journeys is one finding -- file once, reference it from every
|
|
54
|
+
affected run file; do not spam the tracker. With the local tracker, id
|
|
55
|
+
assignment is single-writer: validators return finding payloads
|
|
56
|
+
and the coordinator appends them to TRACKER.md in one pass (explicitly
|
|
57
|
+
assigned github-issues reporters may file directly). The coordinator owns the single reindex and
|
|
58
|
+
the single journeys-dir commit per wave.
|
|
59
|
+
|
|
60
|
+
Then run the fix loop over the `suspected-regression` findings.
|
|
61
|
+
|
|
62
|
+
## Issue-driven campaign
|
|
63
|
+
|
|
64
|
+
1. **Select** the issues from the reporter. Subtract any issue already
|
|
65
|
+
owned by an in-flight branch or PR -- never double-assign a lane someone
|
|
66
|
+
else holds.
|
|
67
|
+
2. **Map issue → journey + steps**, in precedence order: an explicit
|
|
68
|
+
journey/step trace in the issue body; the `journey-<n>` label; else the
|
|
69
|
+
product surface via README's surface map. The resulting step set **is**
|
|
70
|
+
the verification scope. The mapping is the campaign's own artifact:
|
|
71
|
+
where a label is missing but the mapping is certain, add it.
|
|
72
|
+
- **Unmapped issues are not skipped.** They are fixed like any other,
|
|
73
|
+
and the fixed behavior still gets an in-app check at the profile's
|
|
74
|
+
fidelity, recorded as an ad-hoc verification on the issue. Each one
|
|
75
|
+
also raises a **coverage proposal**: the existing journey plus the new
|
|
76
|
+
step it belongs in, or a new journey when several orphans share one
|
|
77
|
+
user goal. Proposals go to the human in the report -- never author or
|
|
78
|
+
amend a journey to fit an issue you just fixed. That is self-review,
|
|
79
|
+
and it invents intent the user never stated.
|
|
80
|
+
- Issues with no user-observable behavior (refactors, tech debt) are
|
|
81
|
+
marked `no-journey-surface`: they verify on the repo's own gates
|
|
82
|
+
alone. Say so in the report; do not invent a journey for them.
|
|
83
|
+
3. **Lane** the issues and dispatch per `fix_loop`. One lane per issue,
|
|
84
|
+
except that issues touching the same files share a lane -- the lane is
|
|
85
|
+
the conflict unit, not the issue.
|
|
86
|
+
4. **Verify in waves, batched by journey.** Verification is the scarce
|
|
87
|
+
resource on an `exclusive: true` profile; never spend one app session
|
|
88
|
+
per issue. Once a wave's fixes have merged, group the merged issues by
|
|
89
|
+
journey and launch ONE validator per journey with
|
|
90
|
+
`changed-only(<union of the steps covering that wave's issues>)`.
|
|
91
|
+
Serialize those validators. A journey with no merged fixes is not
|
|
92
|
+
re-run.
|
|
93
|
+
5. **Resolve per issue** from the wave's run file:
|
|
94
|
+
- pass → comment the evidence (steps run, expected vs observed, run-file
|
|
95
|
+
reference, fix commit or PR) on the issue, then close it.
|
|
96
|
+
- fail → the issue stays open; route the finding back to its lane per
|
|
97
|
+
the fix loop. One retry per issue, then hard-stop it and report.
|
|
98
|
+
|
|
99
|
+
A step covering several issues can fail for one and pass for the rest --
|
|
100
|
+
attribute per issue, not per step.
|
|
101
|
+
6. **Bank the by-product.** A wave often ends up running every step of a
|
|
102
|
+
journey; when it does and all pass, that is a full run -- promote
|
|
103
|
+
`draft` → `active` per FORMAT if the journey's Known gaps are all
|
|
104
|
+
user-confirmed.
|
|
105
|
+
|
|
106
|
+
## Fix loop
|
|
107
|
+
|
|
108
|
+
Per `fix_loop` mode:
|
|
109
|
+
|
|
110
|
+
- **report-only** -- stop after the first validation pass; report.
|
|
111
|
+
- **dispatch-coder** (default) -- for each unique `suspected-regression`
|
|
112
|
+
(journey-driven) or selected issue (issue-driven): dispatch a fresh coder
|
|
113
|
+
agent (isolated worktree when parallel) with the defect (journey/step,
|
|
114
|
+
expected vs observed, evidence, repro steps) and the repo's own gates
|
|
115
|
+
(tests/lint) as its acceptance bar. The validator never fixes product
|
|
116
|
+
code; the coder never edits journeys. When fixes land, re-validate
|
|
117
|
+
**only** the failed journeys, scoped to failed/blocked steps plus what is
|
|
118
|
+
needed to reach them. Iterate.
|
|
119
|
+
- **fix-direct** -- the campaign context fixes small regressions itself,
|
|
120
|
+
then re-validates. Note in each finding that fixer and validator shared
|
|
121
|
+
context (weakest evidence integrity; solo use).
|
|
122
|
+
|
|
123
|
+
**Hard stops** -- end the loop and hand to the human when:
|
|
124
|
+
- iteration count reaches the budget (default 3),
|
|
125
|
+
- the same finding or issue fails again after a fix attempt (one retry
|
|
126
|
+
each),
|
|
127
|
+
- a finding is triaged `product-question` -- never auto-resolved; park it
|
|
128
|
+
and continue the rest,
|
|
129
|
+
- the environment breaks (env findings spike) -- fix the harness or stop;
|
|
130
|
+
do not burn iterations on a broken bench.
|
|
131
|
+
|
|
132
|
+
Re-triage after every iteration: a "fix" that changes behavior without
|
|
133
|
+
intent evidence is itself a regression.
|
|
134
|
+
|
|
135
|
+
## Report
|
|
136
|
+
|
|
137
|
+
Single campaign report at the end:
|
|
138
|
+
- per-journey final state (pass / fail / blocked, version validated,
|
|
139
|
+
amendments with evidence),
|
|
140
|
+
- findings: fixed (with fix commits/PRs), still open, parked
|
|
141
|
+
product-questions needing decisions,
|
|
142
|
+
- issue-driven also: issues closed with their evidence, issues still open
|
|
143
|
+
and why, coverage proposals awaiting a decision, and the
|
|
144
|
+
`no-journey-surface` set,
|
|
145
|
+
- iterations used; what was NOT covered and why,
|
|
146
|
+
- proposals: consolidation candidates (green journeys with Δ entries),
|
|
147
|
+
coverage gaps, surface-map additions.
|
|
148
|
+
|
|
149
|
+
Commit journeys-dir changes per journey-verify's convention. Product-fix
|
|
150
|
+
commits follow the repo's workflow: a coder that commits owns its commit;
|
|
151
|
+
when the coder agent type does not commit, the coordinator commits the fix
|
|
152
|
+
citing the finding id. Never leave an applied fix uncommitted.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: journey-consolidate
|
|
3
|
+
description: "Use when advancing a journey checkpoint with approval: flush delta-log entries, prune old runs, regenerate the index."
|
|
4
|
+
metadata:
|
|
5
|
+
opencode/autoinvoke: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# journey-consolidate
|
|
9
|
+
|
|
10
|
+
Consolidation is what keeps journey files small and trusted (FORMAT.md,
|
|
11
|
+
"Consolidation checkpoints"). An agent prepares and proposes; **only a
|
|
12
|
+
human blesses**. Never consolidate as a side effect of another skill.
|
|
13
|
+
|
|
14
|
+
Read the journeys directory's normative `FORMAT.md`, config `README.md`, and
|
|
15
|
+
`INDEX.md` first. The checkpoint and retained delta window must agree.
|
|
16
|
+
|
|
17
|
+
## Eligibility
|
|
18
|
+
|
|
19
|
+
Propose consolidation only for journeys where:
|
|
20
|
+
- the latest run is `pass` at the journey's current version (or the user
|
|
21
|
+
explicitly waives this), and
|
|
22
|
+
- there is something to flush or prune (Δ entries, excess runs) or
|
|
23
|
+
`status: draft` is ready to become `active`.
|
|
24
|
+
|
|
25
|
+
## Procedure (per journey)
|
|
26
|
+
|
|
27
|
+
1. Capture the journey's exact body, version, prior checkpoint, and delta entries
|
|
28
|
+
as the review snapshot. Present the body (or a summary for long journeys),
|
|
29
|
+
proposed new checkpoint (today), and exact Δ ids/content to flush through
|
|
30
|
+
that date, including same-day entries. Include latest run result + date,
|
|
31
|
+
proposed promotion, prune dry-run deletion list, and open findings referencing
|
|
32
|
+
this journey (grep the tracker for `journey-finding` / `journey: J<id>`).
|
|
33
|
+
Open findings are a reason to DEFER consolidation -- surface them.
|
|
34
|
+
2. Ask the human to bless this packet per journey (the `question` tool for batches, `AskUserQuestion` in Claude Code). No
|
|
35
|
+
blanket approvals for unseen packets. Immediately before applying, compare
|
|
36
|
+
the current journey, run evidence, findings, and prune selection to the packet.
|
|
37
|
+
Any change, including a new/corrected delta or date rollover, invalidates the
|
|
38
|
+
packet: retain all entries and the old checkpoint, refresh eligibility and
|
|
39
|
+
obtain renewed approval. Do not merge unseen edits into an approved snapshot.
|
|
40
|
+
3. On approval:
|
|
41
|
+
- flush only the exact approved Δ entries dated on or before the NEW
|
|
42
|
+
checkpoint; never select deletions by date alone or the previous checkpoint,
|
|
43
|
+
- set `last_reviewed:` to that approved date and promote draft → active only
|
|
44
|
+
if agreed, in the same guarded edit as the flush. Preserve every unapproved
|
|
45
|
+
entry. If any remaining entry is dated on/before the proposed checkpoint,
|
|
46
|
+
defer and re-review instead of advancing past it,
|
|
47
|
+
- reject a stale edit rather than overwriting concurrent work; a concurrent
|
|
48
|
+
change requires a fresh packet and approval, not an automatic retry,
|
|
49
|
+
- prune only the approved journey: `python3 <journeys-dir>/journeys.py
|
|
50
|
+
prune <journeys-dir> --journey <journey-directory-name>
|
|
51
|
+
--keep <runs_keep> --yes`. First run the same selection without `--yes`
|
|
52
|
+
and show its deletion list. Use `runs_keep` from README frontmatter.
|
|
53
|
+
In OpenCode, `journeys_index` command `prune` with that `journey` does the same.
|
|
54
|
+
Never omit the selector under a per-journey approval.
|
|
55
|
+
- reindex: `python3 <journeys-dir>/journeys.py index <journeys-dir>`,
|
|
56
|
+
then lint. The helper lives in the journeys directory itself.
|
|
57
|
+
4. Commit: `journey(J<id>): consolidate — last_reviewed <date>`.
|
|
58
|
+
|
|
59
|
+
## Report
|
|
60
|
+
|
|
61
|
+
Which journeys were consolidated (entries flushed, runs pruned), which were
|
|
62
|
+
deferred and why (open findings, red run, human declined).
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: journey-init
|
|
3
|
+
description: "Use when setting up a user-journeys directory in a repo that has none: investigate, interview and scaffold the format."
|
|
4
|
+
metadata:
|
|
5
|
+
opencode/autoinvoke: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# journey-init
|
|
9
|
+
|
|
10
|
+
Provision a journeys directory per the user-journeys format. Three phases, in
|
|
11
|
+
order: investigate, interview, scaffold. Never skip the interview -- detected
|
|
12
|
+
facts are proposals, the user decides.
|
|
13
|
+
|
|
14
|
+
Templates and the helper script live in this skill's directory:
|
|
15
|
+
`templates/FORMAT.md`, `templates/README.template.md`,
|
|
16
|
+
`templates/journey.template.md`, `templates/run.template.md`, and
|
|
17
|
+
`scripts/journeys.py`.
|
|
18
|
+
|
|
19
|
+
## Phase 1 -- Investigate the repo
|
|
20
|
+
|
|
21
|
+
Gather evidence before asking anything. Cheap checks first; delegate to a
|
|
22
|
+
search subagent only if the repo is large and unfamiliar.
|
|
23
|
+
|
|
24
|
+
1. **Existing journeys:** any directory already containing `FORMAT.md` +
|
|
25
|
+
`*/journey.md`? If found and healthy, stop -- offer `journey-write` or
|
|
26
|
+
re-configuration of README.md instead of re-init.
|
|
27
|
+
2. **Product shape** (drives interface-profile proposals):
|
|
28
|
+
- web: `package.json` with vite/next/astro/remix; a dev-server script.
|
|
29
|
+
- desktop: `tauri.conf.json`, electron deps, native app manifests.
|
|
30
|
+
- CLI/TUI: bin-only manifests, clap/argparse/cobra/bubbletea deps.
|
|
31
|
+
- API/service: OpenAPI files, route frameworks, Dockerfiles exposing ports.
|
|
32
|
+
A repo can be several of these -- propose one profile per shape.
|
|
33
|
+
3. **Available drivers:** Playwright/WDIO configs, MCP servers in
|
|
34
|
+
`.mcp.json`, `opencode.json` (`mcp.servers`) or `.claude/settings.json` (browser or app-driving servers),
|
|
35
|
+
e2e harnesses, `just`/`make`/npm scripts for dev/launch/reset. Note
|
|
36
|
+
concrete launch and reset commands -- these seed profile `notes`.
|
|
37
|
+
4. **Tracker reality:** is this a GitHub repo with `gh` authenticated
|
|
38
|
+
(`gh auth status`)? GitLab? No forge? This seeds the reporter proposal.
|
|
39
|
+
5. **Intent-evidence sources:** CHANGELOG, specs/ADRs/PRD dirs, release
|
|
40
|
+
notes, PR conventions -- where merged intent is recorded in this repo.
|
|
41
|
+
6. **Docs layout:** where documentation lives (`docs/`, `doc/`, wiki-less?)
|
|
42
|
+
to propose the journeys location. Default `docs/journeys/`.
|
|
43
|
+
7. **Journey-like docs worth migrating:** manual test scripts, E2E journey
|
|
44
|
+
catalogs, validation trackers, user-flow docs. List candidates; do not
|
|
45
|
+
migrate anything in this skill.
|
|
46
|
+
|
|
47
|
+
## Phase 2 -- Interview the user
|
|
48
|
+
|
|
49
|
+
Ask with the `question` tool (`AskUserQuestion` in Claude Code), presenting detected facts as defaults. Cover, in
|
|
50
|
+
one or two rounds:
|
|
51
|
+
|
|
52
|
+
1. **Location** of the journeys directory (default from investigation).
|
|
53
|
+
2. **Reporter:** github-issues / local / none -- recommend what phase-1
|
|
54
|
+
found usable; mention extra labels if the repo uses a label taxonomy.
|
|
55
|
+
3. **Interface profiles:** confirm each proposed profile (kind, launch/reset
|
|
56
|
+
commands, driver preference, doc pointers), ask for what investigation
|
|
57
|
+
could not see (staging URLs, credentials handling, environments that must
|
|
58
|
+
never be touched), and whether a profile is `exclusive` (single-instance
|
|
59
|
+
apps: one validator at a time).
|
|
60
|
+
4. **Fix loop default:** report-only / dispatch-coder / fix-direct, and max
|
|
61
|
+
iterations (default dispatch-coder, 3).
|
|
62
|
+
5. **Retention:** how many validation runs to keep per journey
|
|
63
|
+
(`runs_keep`, default 20) -- and say plainly that pruning happens only at
|
|
64
|
+
consolidation checkpoints, never automatically.
|
|
65
|
+
6. **Migration:** if phase 1 found journey-like docs, migrate now (via
|
|
66
|
+
journey-write, one pilot first), later, or never.
|
|
67
|
+
|
|
68
|
+
Ask only what investigation could not establish or the user must decide; do
|
|
69
|
+
not re-ask what the repo already answers. If no interactive question
|
|
70
|
+
channel exists (headless run, subagent context), treat owner-provided
|
|
71
|
+
preferences from the invocation as the interview answers; anything they do
|
|
72
|
+
not cover is an open question in your report -- never guess it.
|
|
73
|
+
|
|
74
|
+
## Phase 3 -- Scaffold
|
|
75
|
+
|
|
76
|
+
1. Create the journeys directory. Copy `templates/FORMAT.md` verbatim AND
|
|
77
|
+
`scripts/journeys.py` from this skill's directory into it -- the
|
|
78
|
+
helper travels with the repo so every future skill and validator invokes
|
|
79
|
+
`<journeys-dir>/journeys.py`, never a path inside an installed skill. In
|
|
80
|
+
OpenCode, the journeys plugin's `journeys_index` tool runs the same helper.
|
|
81
|
+
In Claude Code, copy it from `${CLAUDE_SKILL_DIR}/scripts/journeys.py`.
|
|
82
|
+
2. Write `README.md` from `templates/README.template.md` with frontmatter
|
|
83
|
+
and all sections filled from phases 1 to 2 -- real launch commands, real doc
|
|
84
|
+
pointers, real intent-evidence locations. Delete placeholder text.
|
|
85
|
+
3. Generate the index: `journeys_index` with command `index` in OpenCode, or
|
|
86
|
+
`python3 <journeys-dir>/journeys.py index <journeys-dir>`.
|
|
87
|
+
4. If reporter is `local`, create `TRACKER.md` with a `# Journey findings`
|
|
88
|
+
heading and nothing else.
|
|
89
|
+
5. Report what was created and, if migration was chosen, hand off to
|
|
90
|
+
`journey-write` with the migration candidates listed.
|
|
91
|
+
|
|
92
|
+
## Rules
|
|
93
|
+
|
|
94
|
+
- Detected facts are proposals; the user's answers win.
|
|
95
|
+
- Never write into the journeys directory of another repo layout convention
|
|
96
|
+
(monorepos: ask which app the journeys belong to; one journeys dir per
|
|
97
|
+
product, not per package).
|
|
98
|
+
- The scaffold must be immediately lintable:
|
|
99
|
+
`journeys_index` command `lint` in OpenCode, or `python3 <journeys-dir>/journeys.py lint <journeys-dir>` exits 0 on a fresh
|
|
100
|
+
scaffold (no journeys yet).
|