@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,356 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Deterministic helpers for a user-journeys directory (stdlib only).
|
|
3
|
+
|
|
4
|
+
Subcommands:
|
|
5
|
+
index <journeys-dir> Regenerate INDEX.md from journey files.
|
|
6
|
+
lint <journeys-dir> Validate structure, not semantic readiness.
|
|
7
|
+
prune <journeys-dir> --keep N Prune runs/ to the newest N per journey
|
|
8
|
+
(dry-run unless --yes).
|
|
9
|
+
|
|
10
|
+
Format spec: FORMAT.md in the journeys directory.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import argparse
|
|
16
|
+
import os
|
|
17
|
+
import re
|
|
18
|
+
import sys
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
|
|
21
|
+
STEP_HEADING = re.compile(r"^### (S\d+[a-z]?) — .+ \{#(S\d+[a-z]?)\}\s*$")
|
|
22
|
+
DELTA_ENTRY = re.compile(r"^- \*\*Δ(\d+)\*\* (\d{4}-\d{2}-\d{2}) · (.+?) · behavior-change\s*$")
|
|
23
|
+
JOURNEY_ID = re.compile(r"^J\d+$")
|
|
24
|
+
STEP_REF = re.compile(r"\+?(S\d+[a-z]?)")
|
|
25
|
+
RESULTS = {"pass", "fail", "blocked", "skipped"}
|
|
26
|
+
STATUSES = {"draft", "active", "deprecated"}
|
|
27
|
+
REQUIRED_KEYS = ("id", "title", "version", "status", "last_reviewed")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def frontmatter_is_unterminated(text: str) -> bool:
|
|
31
|
+
lines = text.splitlines()
|
|
32
|
+
if not lines or lines[0].strip() != "---":
|
|
33
|
+
return False
|
|
34
|
+
return all(line.strip() != "---" for line in lines[1:])
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def parse_frontmatter(text: str) -> dict | None:
|
|
38
|
+
"""Parse the minimal YAML subset the format uses (scalars, inline
|
|
39
|
+
lists/dicts, no nesting). Returns None when absent or unterminated."""
|
|
40
|
+
lines = text.splitlines()
|
|
41
|
+
if not lines or lines[0].strip() != "---":
|
|
42
|
+
return None
|
|
43
|
+
fm: dict = {}
|
|
44
|
+
for line in lines[1:]:
|
|
45
|
+
if line.strip() == "---":
|
|
46
|
+
return fm
|
|
47
|
+
if not line.strip() or line.lstrip().startswith("#") or ":" not in line:
|
|
48
|
+
continue
|
|
49
|
+
key, _, raw = line.partition(":")
|
|
50
|
+
key, raw = key.strip(), raw.split(" #")[0].strip()
|
|
51
|
+
if raw.startswith("[") and raw.endswith("]"):
|
|
52
|
+
inner = raw[1:-1].strip()
|
|
53
|
+
fm[key] = [v.strip() for v in inner.split(",") if v.strip()] if inner else []
|
|
54
|
+
elif raw.startswith("{") and raw.endswith("}"):
|
|
55
|
+
entries = {}
|
|
56
|
+
inner = raw[1:-1].strip()
|
|
57
|
+
for part in filter(None, (p.strip() for p in inner.split(","))):
|
|
58
|
+
k, _, v = part.partition(":")
|
|
59
|
+
entries[k.strip()] = v.strip()
|
|
60
|
+
fm[key] = entries
|
|
61
|
+
else:
|
|
62
|
+
fm[key] = raw
|
|
63
|
+
return None
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def managed_root(directory: Path) -> Path | None:
|
|
68
|
+
"""The physical directory a command operates in, or None when it cannot be one.
|
|
69
|
+
|
|
70
|
+
Mirrors managedRoot in journeys-tool.ts. A `..` component is refused outright
|
|
71
|
+
rather than normalised: `..` is the only way a root can traverse a symlink, so
|
|
72
|
+
`/top/link/../managed` would be checked as one tree and written as another.
|
|
73
|
+
Comparing the lexical form against the physical one is NOT usable here, since
|
|
74
|
+
a plain `/tmp/x` legitimately differs from `/private/tmp/x` on macOS.
|
|
75
|
+
"""
|
|
76
|
+
if ".." in Path(directory).parts:
|
|
77
|
+
return None
|
|
78
|
+
try:
|
|
79
|
+
return Path(directory).resolve(strict=True)
|
|
80
|
+
except OSError:
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
def safe_path(path: Path, base: Path) -> None:
|
|
84
|
+
"""Refuse a symlink at or below `base`, and refuse a path that escapes it.
|
|
85
|
+
|
|
86
|
+
Mirrors safePath in journeys-tool.ts. Only the managed tree is
|
|
87
|
+
attacker-shaped; components above `base` are the user's own filesystem
|
|
88
|
+
layout. Walking those refused every temp directory on macOS, where `/tmp`
|
|
89
|
+
and `/var` are themselves symlinks, and would refuse any real checkout
|
|
90
|
+
reached through a symlinked home or work directory.
|
|
91
|
+
|
|
92
|
+
`base` MUST already be physically resolved by the caller, via managed_root.
|
|
93
|
+
That is what keeps the checked path and the operated path the same one: a
|
|
94
|
+
lexical normpath collapses `link/..` to the symlink's parent, so the walk
|
|
95
|
+
inspects one tree while the filesystem writes to another. The candidate is
|
|
96
|
+
then only normalised lexically, because it is built from that resolved root
|
|
97
|
+
and its own components must stay unresolved for is_symlink() to see them.
|
|
98
|
+
"""
|
|
99
|
+
root = base
|
|
100
|
+
absolute = Path(os.path.normpath(path.absolute()))
|
|
101
|
+
try:
|
|
102
|
+
inside = absolute.relative_to(root)
|
|
103
|
+
except ValueError:
|
|
104
|
+
raise ValueError(f"outside the managed root: {absolute}") from None
|
|
105
|
+
if root.is_symlink():
|
|
106
|
+
raise ValueError(f"unsafe symlink: {root}")
|
|
107
|
+
current = root
|
|
108
|
+
for part in inside.parts:
|
|
109
|
+
current = current / part
|
|
110
|
+
if current.is_symlink():
|
|
111
|
+
raise ValueError(f"unsafe symlink: {current}")
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def safe_journey_paths(root: Path) -> None:
|
|
115
|
+
safe_path(root, root)
|
|
116
|
+
safe_path(root / "INDEX.md", root)
|
|
117
|
+
safe_path(root / "TRACKER.md", root)
|
|
118
|
+
for directory in root.iterdir():
|
|
119
|
+
safe_path(directory, root)
|
|
120
|
+
if not directory.is_dir():
|
|
121
|
+
continue
|
|
122
|
+
safe_path(directory / "journey.md", root)
|
|
123
|
+
runs = directory / "runs"
|
|
124
|
+
safe_path(runs, root)
|
|
125
|
+
if not runs.exists():
|
|
126
|
+
continue
|
|
127
|
+
if not runs.is_dir():
|
|
128
|
+
raise ValueError(f"not a runs directory: {runs}")
|
|
129
|
+
for run in runs.glob("*.md"):
|
|
130
|
+
safe_path(run, root)
|
|
131
|
+
if not run.is_file():
|
|
132
|
+
raise ValueError(f"not a run file: {run}")
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def journey_dirs(root: Path) -> list[Path]:
|
|
136
|
+
return sorted(d for d in root.iterdir() if d.is_dir() and (d / "journey.md").exists())
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def latest_run(jdir: Path) -> dict | None:
|
|
140
|
+
runs = sorted((jdir / "runs").glob("*.md")) if (jdir / "runs").is_dir() else []
|
|
141
|
+
if not runs:
|
|
142
|
+
return None
|
|
143
|
+
last = runs[-1]
|
|
144
|
+
text = last.read_text(encoding="utf-8")
|
|
145
|
+
fm = parse_frontmatter(text)
|
|
146
|
+
if fm is None:
|
|
147
|
+
if frontmatter_is_unterminated(text):
|
|
148
|
+
return {"_file": last.name, "_malformed": True}
|
|
149
|
+
return None
|
|
150
|
+
fm["_file"] = last.name
|
|
151
|
+
return fm
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def open_findings(root: Path) -> dict:
|
|
156
|
+
"""Count open findings per journey from TRACKER.md (local reporter)."""
|
|
157
|
+
tracker = root / "TRACKER.md"
|
|
158
|
+
counts: dict = {}
|
|
159
|
+
if not tracker.exists():
|
|
160
|
+
return counts
|
|
161
|
+
for chunk in tracker.read_text(encoding="utf-8").split("<!-- journey-finding")[1:]:
|
|
162
|
+
jid = re.search(r"journey:\s*(\S+)", chunk[:400])
|
|
163
|
+
status = re.search(r"status:\s*(\w+)", chunk[:800])
|
|
164
|
+
if jid and (not status or status.group(1) == "open"):
|
|
165
|
+
counts[jid.group(1)] = counts.get(jid.group(1), 0) + 1
|
|
166
|
+
return counts
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def cmd_index(root: Path) -> int:
|
|
170
|
+
safe_journey_paths(root)
|
|
171
|
+
rows = []
|
|
172
|
+
findings = open_findings(root)
|
|
173
|
+
unreadable: list[str] = []
|
|
174
|
+
for jdir in journey_dirs(root):
|
|
175
|
+
journey_text = (jdir / "journey.md").read_text(encoding="utf-8")
|
|
176
|
+
parsed = parse_frontmatter(journey_text)
|
|
177
|
+
fm = parsed or {}
|
|
178
|
+
if parsed is None and frontmatter_is_unterminated(journey_text):
|
|
179
|
+
unreadable.append(f"{jdir.name}/journey.md")
|
|
180
|
+
fm = {"title": "**unreadable frontmatter**"}
|
|
181
|
+
run = latest_run(jdir)
|
|
182
|
+
if run and run.get("_malformed"):
|
|
183
|
+
unreadable.append(f"{jdir.name}/runs/{run['_file']}")
|
|
184
|
+
last = "**unreadable**"
|
|
185
|
+
elif run:
|
|
186
|
+
mode = str(run.get("mode", "full")).split("(")[0]
|
|
187
|
+
last = f"{run.get('date', '?')} {run.get('result', '?')} ({mode})"
|
|
188
|
+
else:
|
|
189
|
+
last = "never"
|
|
190
|
+
n_open = findings.get(fm.get("id", ""), 0)
|
|
191
|
+
rows.append(
|
|
192
|
+
"| [{id}]({d}/journey.md) | {t} | {st} | v{v} | {su} | {ifc} | {lr} | {last} | {op} |".format(
|
|
193
|
+
id=fm.get("id", "?"), d=jdir.name, t=fm.get("title", "?"),
|
|
194
|
+
st=fm.get("status", "?"), v=fm.get("version", "?"),
|
|
195
|
+
su=", ".join(fm.get("surfaces", [])) or "—",
|
|
196
|
+
ifc=", ".join(fm.get("interfaces", [])) or "—",
|
|
197
|
+
lr=fm.get("last_reviewed", "?"), last=last,
|
|
198
|
+
op=str(n_open) if n_open else "—",
|
|
199
|
+
)
|
|
200
|
+
)
|
|
201
|
+
body = "\n".join(
|
|
202
|
+
[
|
|
203
|
+
"# Journey index",
|
|
204
|
+
"",
|
|
205
|
+
"Generated by `journeys.py index` — do not hand-edit.",
|
|
206
|
+
"",
|
|
207
|
+
"| id | title | status | version | surfaces | interfaces | last_reviewed | last run | open findings |",
|
|
208
|
+
"|---|---|---|---|---|---|---|---|---|",
|
|
209
|
+
*rows,
|
|
210
|
+
"",
|
|
211
|
+
]
|
|
212
|
+
)
|
|
213
|
+
(root / "INDEX.md").write_text(body, encoding="utf-8")
|
|
214
|
+
notes = "\n".join(f"ERROR {rel}: unreadable frontmatter" for rel in unreadable)
|
|
215
|
+
print(f"INDEX.md: {len(rows)} journeys")
|
|
216
|
+
if notes:
|
|
217
|
+
print(notes)
|
|
218
|
+
return 0
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def lint_journey(jdir: Path, errors: list[str], seen_ids: dict) -> None:
|
|
223
|
+
path = jdir / "journey.md"
|
|
224
|
+
text = path.read_text(encoding="utf-8")
|
|
225
|
+
rel = f"{jdir.name}/journey.md"
|
|
226
|
+
fm = parse_frontmatter(text)
|
|
227
|
+
if not fm:
|
|
228
|
+
errors.append(f"{rel}: missing or unterminated frontmatter")
|
|
229
|
+
return
|
|
230
|
+
for key in REQUIRED_KEYS:
|
|
231
|
+
if key not in fm:
|
|
232
|
+
errors.append(f"{rel}: frontmatter missing `{key}`")
|
|
233
|
+
jid = fm.get("id", "")
|
|
234
|
+
if jid and not JOURNEY_ID.match(jid):
|
|
235
|
+
errors.append(f"{rel}: id `{jid}` does not match J<n>")
|
|
236
|
+
if jid and jid in seen_ids:
|
|
237
|
+
errors.append(f"{rel}: duplicate id `{jid}` (also {seen_ids[jid]})")
|
|
238
|
+
if jid:
|
|
239
|
+
seen_ids[jid] = rel
|
|
240
|
+
if jid and not jdir.name.startswith(f"{jid}-"):
|
|
241
|
+
errors.append(f"{rel}: directory `{jdir.name}` does not start with `{jid}-`")
|
|
242
|
+
if fm.get("status") and fm["status"] not in STATUSES:
|
|
243
|
+
errors.append(f"{rel}: status `{fm['status']}` not in {sorted(STATUSES)}")
|
|
244
|
+
if fm.get("version") and not str(fm["version"]).isdigit():
|
|
245
|
+
errors.append(f"{rel}: version `{fm['version']}` is not an integer")
|
|
246
|
+
|
|
247
|
+
step_ids: list[str] = []
|
|
248
|
+
for n, line in enumerate(text.splitlines(), 1):
|
|
249
|
+
if line.startswith("### ") and "{#" in line:
|
|
250
|
+
m = STEP_HEADING.match(line)
|
|
251
|
+
if not m:
|
|
252
|
+
errors.append(f"{rel}:{n}: malformed step heading (want `### S<id> — title {{#S<id>}}`)")
|
|
253
|
+
continue
|
|
254
|
+
if m.group(1) != m.group(2):
|
|
255
|
+
errors.append(f"{rel}:{n}: heading id {m.group(1)} != anchor {m.group(2)}")
|
|
256
|
+
if m.group(1) in step_ids:
|
|
257
|
+
errors.append(f"{rel}:{n}: duplicate step id {m.group(1)}")
|
|
258
|
+
step_ids.append(m.group(1))
|
|
259
|
+
elif line.startswith("### S"):
|
|
260
|
+
errors.append(f"{rel}:{n}: step heading missing `{{#S<id>}}` anchor")
|
|
261
|
+
|
|
262
|
+
version = int(fm["version"]) if str(fm.get("version", "")).isdigit() else None
|
|
263
|
+
for n, line in enumerate(text.splitlines(), 1):
|
|
264
|
+
m = DELTA_ENTRY.match(line)
|
|
265
|
+
if not m:
|
|
266
|
+
continue
|
|
267
|
+
if version is not None and int(m.group(1)) > version:
|
|
268
|
+
errors.append(f"{rel}:{n}: delta Δ{m.group(1)} exceeds journey version {version}")
|
|
269
|
+
for ref in STEP_REF.findall(m.group(3)):
|
|
270
|
+
if ref not in step_ids:
|
|
271
|
+
errors.append(f"{rel}:{n}: delta Δ{m.group(1)} references unknown step {ref}")
|
|
272
|
+
|
|
273
|
+
for run in sorted((jdir / "runs").glob("*.md")) if (jdir / "runs").is_dir() else []:
|
|
274
|
+
rfm = parse_frontmatter(run.read_text(encoding="utf-8"))
|
|
275
|
+
rrel = f"{jdir.name}/runs/{run.name}"
|
|
276
|
+
if not rfm:
|
|
277
|
+
errors.append(f"{rrel}: missing frontmatter")
|
|
278
|
+
continue
|
|
279
|
+
if rfm.get("journey") != jid:
|
|
280
|
+
errors.append(f"{rrel}: journey `{rfm.get('journey')}` != `{jid}`")
|
|
281
|
+
if rfm.get("result") not in {"pass", "fail", "blocked"}:
|
|
282
|
+
errors.append(f"{rrel}: result `{rfm.get('result')}` not pass|fail|blocked")
|
|
283
|
+
for sid, res in (rfm.get("steps") or {}).items():
|
|
284
|
+
if res not in RESULTS:
|
|
285
|
+
errors.append(f"{rrel}: step {sid} result `{res}` not in {sorted(RESULTS)}")
|
|
286
|
+
if sid not in step_ids:
|
|
287
|
+
errors.append(f"{rrel}: unknown step id {sid}")
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def cmd_lint(root: Path) -> int:
|
|
291
|
+
safe_journey_paths(root)
|
|
292
|
+
errors: list[str] = []
|
|
293
|
+
seen: dict = {}
|
|
294
|
+
dirs = journey_dirs(root)
|
|
295
|
+
if not dirs:
|
|
296
|
+
print(f"no journeys found under {root}", file=sys.stderr)
|
|
297
|
+
for jdir in dirs:
|
|
298
|
+
lint_journey(jdir, errors, seen)
|
|
299
|
+
for err in errors:
|
|
300
|
+
print(f"ERROR {err}")
|
|
301
|
+
print(f"structural lint: {len(dirs)} journeys, {len(errors)} errors; semantic readiness not assessed")
|
|
302
|
+
return 1 if errors else 0
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def cmd_prune(root: Path, keep: int, yes: bool, journey: str | None = None) -> int:
|
|
306
|
+
if type(keep) is not int or keep < 0 or keep > 9007199254740991:
|
|
307
|
+
print("keep must be a finite nonnegative safe integer", file=sys.stderr)
|
|
308
|
+
return 2
|
|
309
|
+
safe_journey_paths(root)
|
|
310
|
+
doomed: list[Path] = []
|
|
311
|
+
dirs = journey_dirs(root)
|
|
312
|
+
selected = dirs if journey is None else [jdir for jdir in dirs if jdir.name == journey]
|
|
313
|
+
if journey is not None and len(selected) != 1:
|
|
314
|
+
print(f"unknown journey directory: {journey}", file=sys.stderr)
|
|
315
|
+
return 2
|
|
316
|
+
for jdir in selected:
|
|
317
|
+
runs = sorted((jdir / "runs").glob("*.md")) if (jdir / "runs").is_dir() else []
|
|
318
|
+
doomed.extend(runs[:-keep] if keep else runs)
|
|
319
|
+
for path in doomed:
|
|
320
|
+
print(f"{'delete' if yes else 'would delete'} {path.relative_to(root)}")
|
|
321
|
+
if yes:
|
|
322
|
+
path.unlink()
|
|
323
|
+
print(f"prune: {len(doomed)} run files {'deleted' if yes else 'to delete (use --yes)'}")
|
|
324
|
+
return 0
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def main(argv: list[str] | None = None) -> int:
|
|
328
|
+
ap = argparse.ArgumentParser(description=__doc__)
|
|
329
|
+
sub = ap.add_subparsers(dest="cmd", required=True)
|
|
330
|
+
for name in ("index", "lint", "prune"):
|
|
331
|
+
p = sub.add_parser(name)
|
|
332
|
+
p.add_argument("journeys_dir", type=Path)
|
|
333
|
+
if name == "prune":
|
|
334
|
+
p.add_argument("--keep", type=int, default=20)
|
|
335
|
+
p.add_argument("--yes", action="store_true")
|
|
336
|
+
p.add_argument("--journey", help="selected journey directory name; omit only for an explicitly authorized directory-wide prune")
|
|
337
|
+
args = ap.parse_args(argv)
|
|
338
|
+
# Resolve first, then check and operate on that one directory. Using the raw
|
|
339
|
+
# argument would let `link/..` be checked as one tree and written as another.
|
|
340
|
+
root = managed_root(args.journeys_dir)
|
|
341
|
+
if root is None or not root.is_dir():
|
|
342
|
+
print(f"not a directory: {args.journeys_dir}", file=sys.stderr)
|
|
343
|
+
return 2
|
|
344
|
+
try:
|
|
345
|
+
if args.cmd == "index":
|
|
346
|
+
return cmd_index(root)
|
|
347
|
+
if args.cmd == "lint":
|
|
348
|
+
return cmd_lint(root)
|
|
349
|
+
return cmd_prune(root, args.keep, args.yes, args.journey)
|
|
350
|
+
except (OSError, ValueError) as exc:
|
|
351
|
+
print(f"ERROR {exc}", file=sys.stderr)
|
|
352
|
+
return 2
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
if __name__ == "__main__":
|
|
356
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# User Journey Format
|
|
2
|
+
|
|
3
|
+
Normative spec for every artifact under this journeys directory. Installed by
|
|
4
|
+
`journey-init`; the copy in the repo is authoritative for that repo. Agents and
|
|
5
|
+
humans read the same files -- nothing here requires a runtime beyond a text
|
|
6
|
+
editor, `git`, and `python3` for the index/lint helper.
|
|
7
|
+
|
|
8
|
+
The helper's lint command checks structure only. A clean lint result does not
|
|
9
|
+
establish semantic readiness or replace validation against the running product.
|
|
10
|
+
|
|
11
|
+
## Directory layout
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
<journeys-dir>/ # location set at init (default docs/journeys/)
|
|
15
|
+
FORMAT.md # this spec
|
|
16
|
+
README.md # per-project config: reporter, interface
|
|
17
|
+
# profiles, surface map, fix-loop policy
|
|
18
|
+
journeys.py # index/lint/prune helper — travels with the
|
|
19
|
+
# repo; installed by journey-init
|
|
20
|
+
INDEX.md # generated routing table — do not hand-edit
|
|
21
|
+
TRACKER.md # only when reporter is `local`
|
|
22
|
+
J07-<slug>/
|
|
23
|
+
journey.md # THE journey — current expected behavior
|
|
24
|
+
runs/
|
|
25
|
+
2026-07-14T09-31Z.md # one file per validation run
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## The journey file
|
|
29
|
+
|
|
30
|
+
`journey.md` is always **current truth**: what the product is expected to do
|
|
31
|
+
today, end to end, from the user's point of view. It is never a historical
|
|
32
|
+
record -- git is the historical record.
|
|
33
|
+
|
|
34
|
+
````markdown
|
|
35
|
+
---
|
|
36
|
+
id: J07 # stable, unique in this repo, never reused
|
|
37
|
+
title: Short user-goal phrase
|
|
38
|
+
version: 3 # bumped on behavior deltas only, never corrections
|
|
39
|
+
status: active # draft | active | deprecated
|
|
40
|
+
last_reviewed: 2026-07-10 # consolidation checkpoint; delta-log window start
|
|
41
|
+
actors: [primary-user] # who performs this journey
|
|
42
|
+
surfaces: [checkout, cart] # product surfaces touched — the changed-only key
|
|
43
|
+
interfaces: [web-ui] # config.yml interface_profiles able to run this
|
|
44
|
+
trace: [] # optional links in the repo's own vocabulary:
|
|
45
|
+
# spec IDs, FR IDs, PRD sections, tickets
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Goal
|
|
49
|
+
One paragraph: what the user is trying to accomplish and what "done" means.
|
|
50
|
+
|
|
51
|
+
## Preconditions
|
|
52
|
+
- P1: ... (each precondition gets a stable P-id)
|
|
53
|
+
|
|
54
|
+
## Steps
|
|
55
|
+
### S1 — Imperative step title {#S1}
|
|
56
|
+
- **Do:** what the user does, interface-agnostic.
|
|
57
|
+
- **Expect:** observable outcome(s). Every Expect is an assertion.
|
|
58
|
+
- **Expect (negative):** what must NOT happen, when trust depends on it.
|
|
59
|
+
- **Trace:** optional per-step links (spec FR, ticket).
|
|
60
|
+
|
|
61
|
+
## Success criteria
|
|
62
|
+
- SC1: journey-level outcomes, referencing step ids.
|
|
63
|
+
|
|
64
|
+
## Known gaps
|
|
65
|
+
- G1: steps or environments that cannot currently be validated, and why.
|
|
66
|
+
|
|
67
|
+
## Delta log
|
|
68
|
+
- **Δ3** 2026-07-14 · S3, +S3a · behavior-change
|
|
69
|
+
One-to-three lines: what changed, user-visibly.
|
|
70
|
+
Evidence: PR #691, spec-052/FR-004 · by: journey-scribe (intent-gated)
|
|
71
|
+
````
|
|
72
|
+
|
|
73
|
+
### Definition of ready
|
|
74
|
+
|
|
75
|
+
A journey may leave `status: draft` only when all of these hold. Authoring
|
|
76
|
+
skills audit against this list. Whatever cannot be satisfied becomes a
|
|
77
|
+
**Known gaps** entry only after the user explicitly confirms the ambiguity
|
|
78
|
+
is acceptable (record "accepted by user, <date>" on the entry); agents
|
|
79
|
+
never accept a gap on the user's behalf, and missing information is never
|
|
80
|
+
invented. Unconfirmed gaps keep the journey in `draft`.
|
|
81
|
+
|
|
82
|
+
- [ ] **Goal** names the actor's outcome and an observable definition of
|
|
83
|
+
"done" -- not a feature description.
|
|
84
|
+
- [ ] Every **Expect** is observable and falsifiable. "Works correctly",
|
|
85
|
+
"handles gracefully", and other unfalsifiable phrasing are defects.
|
|
86
|
+
- [ ] Every **success criterion** has a concrete target: a count, a
|
|
87
|
+
threshold, a state that either holds or doesn't. Where the user has
|
|
88
|
+
real KPIs (time-to-complete, error budget, conversion), the SC cites
|
|
89
|
+
them; where they don't, the SC still picks a checkable proxy.
|
|
90
|
+
- [ ] **Expect (negative)** guards every point where trust depends on
|
|
91
|
+
something not happening (silent writes, data loss, destructive
|
|
92
|
+
actions without confirmation, leaking state).
|
|
93
|
+
- [ ] **Preconditions** are sufficient to reach S1 from a clean
|
|
94
|
+
environment, and each is establishable (or its gap is documented).
|
|
95
|
+
- [ ] `actors`, `surfaces`, and `interfaces` are filled; `trace` links the
|
|
96
|
+
change records that informed authoring, or is explicitly empty.
|
|
97
|
+
- [ ] Error and edge branches are explicitly scoped: covered in steps,
|
|
98
|
+
or listed under Known gaps as out of scope -- never simply absent.
|
|
99
|
+
|
|
100
|
+
Promotion is event-driven: once the checklist holds, the first validation
|
|
101
|
+
run in which every step passes records `draft` → `active` (the verify
|
|
102
|
+
skill owns this transition); a consolidation checkpoint may also promote
|
|
103
|
+
with the human's blessing. Nothing else changes `status`.
|
|
104
|
+
|
|
105
|
+
### Step identity rules
|
|
106
|
+
|
|
107
|
+
- Step ids are `S<n>` with optional letter suffixes (`S3a`) for insertions.
|
|
108
|
+
- Ids are **stable**: never renumber, never reuse a retired id. Removing a
|
|
109
|
+
step removes its heading; the id stays retired.
|
|
110
|
+
- Every step heading carries an explicit anchor `{#S<id>}` so links survive
|
|
111
|
+
title edits.
|
|
112
|
+
- Preconditions (`P<n>`), success criteria (`SC<n>`), and gaps (`G<n>`)
|
|
113
|
+
follow the same stability rule.
|
|
114
|
+
- Everything that refers to a step -- deltas, run results, findings -- cites
|
|
115
|
+
`J<id>/S<id>`.
|
|
116
|
+
|
|
117
|
+
### The three change species
|
|
118
|
+
|
|
119
|
+
| Species | What it is | Body | Delta log | Version | History |
|
|
120
|
+
|---|---|---|---|---|---|
|
|
121
|
+
| **Correction** | The doc misdescribed existing behavior | edit in place | nothing | unchanged | git commit `journey(J07): correct S2 ...` |
|
|
122
|
+
| **Behavior delta** | The product intentionally changed | edit in place | one compact Δ entry | +1 | git + Δ entry until flushed |
|
|
123
|
+
| **Run result** | What happened when validated | never touches journey.md | never | -- | `runs/` file + reporter |
|
|
124
|
+
|
|
125
|
+
A **correction** needs no ceremony because no one ever needs to be told "we
|
|
126
|
+
once described this wrong" -- fix the text, commit. A **behavior delta** needs
|
|
127
|
+
its Δ entry because the next validator and the next human reviewer must see
|
|
128
|
+
what changed since the document was last trusted, with the evidence that the
|
|
129
|
+
change was intended.
|
|
130
|
+
|
|
131
|
+
### Delta log entries
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
- **Δ<version>** <date> · <step ids touched, +new ids> · behavior-change
|
|
135
|
+
<1–3 lines describing the user-visible change>
|
|
136
|
+
Evidence: <PR / spec / changelog / commit refs> · by: <human name | agent (intent-gated)>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The delta log is a **window, not an archive**. It holds only entries newer
|
|
140
|
+
than `last_reviewed`. At a consolidation checkpoint (see below) older entries
|
|
141
|
+
are deleted from the file. Steady-state file size is current behavior plus a
|
|
142
|
+
handful of recent deltas; the log cannot grow monotonically.
|
|
143
|
+
|
|
144
|
+
### Amendment authority (intent gating)
|
|
145
|
+
|
|
146
|
+
An agent may amend a journey **only** when it can cite intent evidence -- a
|
|
147
|
+
merged PR, spec, changelog entry, commit message, or an explicit user
|
|
148
|
+
instruction stating the behavior changed on purpose. The evidence must
|
|
149
|
+
itself STATE the behavior change: a commit that claims non-behavioral scope
|
|
150
|
+
("refactor", "cleanup") while its diff changes behavior is not intent
|
|
151
|
+
evidence -- it is grounds for suspicion. The evidence goes in the
|
|
152
|
+
Δ entry. With no intent evidence, the journey stays unchanged, the run marks
|
|
153
|
+
the step failing, and a finding is filed as `suspected-regression`. Agents
|
|
154
|
+
never resolve `product-question` findings; those always go to a human.
|
|
155
|
+
|
|
156
|
+
## Run files
|
|
157
|
+
|
|
158
|
+
One file per validation run: `runs/<UTC timestamp>.md`, machine-parsable
|
|
159
|
+
frontmatter, human-readable evidence body.
|
|
160
|
+
|
|
161
|
+
````markdown
|
|
162
|
+
---
|
|
163
|
+
journey: J07
|
|
164
|
+
journey_version: 3
|
|
165
|
+
commit: <git sha validated against>
|
|
166
|
+
date: 2026-07-14T09:31Z
|
|
167
|
+
mode: full # full | changed-only(S3,S3a) | smoke
|
|
168
|
+
interface: web-ui (playwright)
|
|
169
|
+
result: fail # pass | fail | blocked
|
|
170
|
+
steps: {S1: pass, S2: pass, S3: fail, S3a: skipped}
|
|
171
|
+
findings: [JV-0042] # reporter-assigned ids
|
|
172
|
+
---
|
|
173
|
+
## S3 — FAIL
|
|
174
|
+
Expected ... observed ... Evidence: <screenshots, command output, logs>.
|
|
175
|
+
Triage: suspected-regression — no intent evidence in merges since v3.
|
|
176
|
+
→ Filed as JV-0042 (github: #712).
|
|
177
|
+
````
|
|
178
|
+
|
|
179
|
+
Step result values: `pass | fail | blocked | skipped`. `blocked` means the
|
|
180
|
+
step could not be attempted (environment, missing fixture, prior failure);
|
|
181
|
+
`skipped` means deliberately out of scope for this run's mode. A step
|
|
182
|
+
unreachable because an earlier step in the same run failed is `blocked` --
|
|
183
|
+
the defect is recorded once, on the step that owns it; journey-level impact
|
|
184
|
+
shows in the run `result` and the success criteria, never by double-marking.
|
|
185
|
+
|
|
186
|
+
## Triage taxonomy
|
|
187
|
+
|
|
188
|
+
Every mismatch between journey and observed behavior gets exactly one triage:
|
|
189
|
+
|
|
190
|
+
- `correction` -- the doc was wrong about long-standing reality. Fix body.
|
|
191
|
+
- `intended-change` -- intent evidence found. Amend body + Δ entry, version+1.
|
|
192
|
+
- `suspected-regression` -- no intent evidence. File finding; journey unchanged.
|
|
193
|
+
- `product-question` -- reality and doc disagree and neither is clearly right;
|
|
194
|
+
needs a human product decision. File finding flagged `product-decision`.
|
|
195
|
+
- `environment` -- the harness/fixture/driver failed, not the product. Record
|
|
196
|
+
in the run file only; do not file to the tracker.
|
|
197
|
+
|
|
198
|
+
## Findings
|
|
199
|
+
|
|
200
|
+
Findings go to the reporter configured in the journeys `README.md`
|
|
201
|
+
frontmatter. Regardless of
|
|
202
|
+
tracker, every finding body embeds this block so journey↔finding linkage
|
|
203
|
+
survives any label scheme or tracker migration:
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
<!-- journey-finding
|
|
207
|
+
journey: J07
|
|
208
|
+
step: S3
|
|
209
|
+
journey_version: 3
|
|
210
|
+
commit: <sha>
|
|
211
|
+
run: 2026-07-14T09-31Z
|
|
212
|
+
triage: suspected-regression
|
|
213
|
+
severity: P2
|
|
214
|
+
-->
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Followed by human sections: **Summary**, **Repro** (the journey steps to
|
|
218
|
+
replay), **Expected vs Observed**, **Evidence**, **Triage rationale**.
|
|
219
|
+
Severity: P1 (journey-blocking) / P2 (step fails, journey completable) /
|
|
220
|
+
P3 (cosmetic or partial expectation miss).
|
|
221
|
+
|
|
222
|
+
Local reporter (`reporter.kind: local`): findings are appended to
|
|
223
|
+
`TRACKER.md` as `## JV-<seq> — <title>` sections carrying the same block plus
|
|
224
|
+
a `status: open | fixed | wontfix` line.
|
|
225
|
+
|
|
226
|
+
## Consolidation checkpoints
|
|
227
|
+
|
|
228
|
+
Consolidation is how the format stays small and trusted. It is always
|
|
229
|
+
human-approved (an agent may propose, only a human blesses):
|
|
230
|
+
|
|
231
|
+
1. Human reviews the journey body as current truth.
|
|
232
|
+
2. `last_reviewed` moves to today; Δ entries older than it are deleted.
|
|
233
|
+
3. `runs/` is pruned to the newest `runs_keep` files (README frontmatter).
|
|
234
|
+
4. `INDEX.md` is regenerated.
|
|
235
|
+
|
|
236
|
+
Git retains everything deleted in steps 2 to 3.
|
|
237
|
+
|
|
238
|
+
## INDEX.md
|
|
239
|
+
|
|
240
|
+
Generated by the `journeys.py` helper (never hand-edited): one row per
|
|
241
|
+
journey -- id, title, status, version, surfaces, interfaces, last_reviewed,
|
|
242
|
+
last run date/result. It is the routing table for "which journeys does this
|
|
243
|
+
change touch" and the first file an agent reads.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
config: user-journeys/1
|
|
3
|
+
reporter: local # github-issues | local | none
|
|
4
|
+
reporter_labels: [] # extra labels when reporter is github-issues
|
|
5
|
+
fix_loop: dispatch-coder # report-only | dispatch-coder | fix-direct
|
|
6
|
+
fix_loop_max_iterations: 3
|
|
7
|
+
runs_keep: 20
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# User journeys
|
|
11
|
+
|
|
12
|
+
End-to-end user journeys for this product: what a user does, what they must
|
|
13
|
+
observe, validated against the running product. `FORMAT.md` is the spec for
|
|
14
|
+
every file in this directory; `INDEX.md` is the generated routing table
|
|
15
|
+
(from this directory, regenerate with `python3 journeys.py index .`; never
|
|
16
|
+
hand-edit). This file is the
|
|
17
|
+
per-project configuration -- frontmatter holds the settings, the sections
|
|
18
|
+
below hold the guidance agents need to run journeys here.
|
|
19
|
+
|
|
20
|
+
## Interface profiles
|
|
21
|
+
|
|
22
|
+
One subsection per interface named in journey frontmatter `interfaces:`.
|
|
23
|
+
`kind` and `exclusive` are structured; everything else is free-form guidance
|
|
24
|
+
for the validating agent -- launch/reset commands, doc pointers, fixtures,
|
|
25
|
+
known quirks. Concrete bindings (selectors, commands per step) are never
|
|
26
|
+
stored; the agent resolves driving strategy from this plus the project docs.
|
|
27
|
+
|
|
28
|
+
### example-ui
|
|
29
|
+
- kind: web <!-- web | desktop-mcp | cli | tui | api -->
|
|
30
|
+
- exclusive: false <!-- true = one validator at a time on this profile -->
|
|
31
|
+
|
|
32
|
+
Replace me: how to launch and reset the product, which driver to prefer
|
|
33
|
+
(e.g. Playwright against `pnpm dev` on :5173), where fixtures live, what
|
|
34
|
+
must never be done against this environment. State how state/fixture
|
|
35
|
+
leakage into the checkout is PREVENTED (gitignore entry, temp working dir,
|
|
36
|
+
pre-run assertion) -- a convention alone is not a guarantee.
|
|
37
|
+
|
|
38
|
+
## Surface map
|
|
39
|
+
|
|
40
|
+
Maps changed file paths to journey `surfaces:` names for changed-only
|
|
41
|
+
validation. Optional -- agent judgment bridges anything unmapped.
|
|
42
|
+
|
|
43
|
+
| path glob | surfaces |
|
|
44
|
+
|---|---|
|
|
45
|
+
<!-- | `src/features/checkout/**` | checkout | -->
|
|
46
|
+
|
|
47
|
+
## Intent-evidence sources
|
|
48
|
+
|
|
49
|
+
Where an agent should look for proof that a behavior change was intentional
|
|
50
|
+
(amendment gating, see FORMAT.md): merged PRs, changelog, specs, ADRs --
|
|
51
|
+
list this repo's actual conventions and locations here.
|
|
52
|
+
|
|
53
|
+
## Notes
|
|
54
|
+
|
|
55
|
+
Anything else journey authors and validators should know in this repo.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: J01
|
|
3
|
+
title: <short user-goal phrase>
|
|
4
|
+
version: 1
|
|
5
|
+
status: draft
|
|
6
|
+
last_reviewed: <YYYY-MM-DD>
|
|
7
|
+
actors: [<primary-user>]
|
|
8
|
+
surfaces: []
|
|
9
|
+
interfaces: []
|
|
10
|
+
trace: []
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Goal
|
|
14
|
+
<What the user is trying to accomplish and what "done" means.>
|
|
15
|
+
|
|
16
|
+
## Preconditions
|
|
17
|
+
- P1: <state the product/environment must be in before S1>
|
|
18
|
+
|
|
19
|
+
## Steps
|
|
20
|
+
### S1 — <Imperative step title> {#S1}
|
|
21
|
+
- **Do:** <what the user does, interface-agnostic>
|
|
22
|
+
- **Expect:** <observable outcome -- every Expect is an assertion>
|
|
23
|
+
|
|
24
|
+
## Success criteria
|
|
25
|
+
- SC1: <journey-level outcome, referencing step ids>
|
|
26
|
+
|
|
27
|
+
## Known gaps
|
|
28
|
+
<!-- - G1: <step or environment that cannot be validated, and why> -->
|
|
29
|
+
|
|
30
|
+
## Delta log
|
|
31
|
+
<!-- Window since last_reviewed. Format:
|
|
32
|
+
- **Δ<version>** <date> · <step ids> · behavior-change
|
|
33
|
+
<what changed, user-visibly>
|
|
34
|
+
Evidence: <PR/spec/commit refs> · by: <author>
|
|
35
|
+
-->
|