create-pathfinder 4.2.0 → 4.3.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.
Files changed (39) hide show
  1. package/CLAUDE.md +2 -0
  2. package/package.json +1 -1
  3. package/skills/learn-codebase/SKILL.md +188 -17
  4. package/skills/learn-feature/SKILL.md +136 -15
  5. package/skills/map-system/SKILL.md +293 -0
  6. package/skills/render-artifact/SKILL.md +187 -0
  7. package/skills/render-artifact/engine/bin/render.mjs +225 -0
  8. package/skills/render-artifact/engine/deliver.mjs +197 -0
  9. package/skills/render-artifact/engine/doctor.mjs +96 -0
  10. package/skills/render-artifact/engine/examples/diagram.json +223 -0
  11. package/skills/render-artifact/engine/examples/lesson.json +242 -0
  12. package/skills/render-artifact/engine/references/determinism.md +71 -0
  13. package/skills/render-artifact/engine/references/specification.md +149 -0
  14. package/skills/render-artifact/engine/references/validation.md +268 -0
  15. package/skills/render-artifact/engine/render/behavior.mjs +128 -0
  16. package/skills/render-artifact/engine/render/diagram.mjs +342 -0
  17. package/skills/render-artifact/engine/render/escape.mjs +34 -0
  18. package/skills/render-artifact/engine/render/graph/behavior.mjs +394 -0
  19. package/skills/render-artifact/engine/render/graph/draw.mjs +204 -0
  20. package/skills/render-artifact/engine/render/graph/interaction.mjs +174 -0
  21. package/skills/render-artifact/engine/render/graph/layout.mjs +698 -0
  22. package/skills/render-artifact/engine/render/graph/style.mjs +200 -0
  23. package/skills/render-artifact/engine/render/graph/width.mjs +204 -0
  24. package/skills/render-artifact/engine/render/index.mjs +50 -0
  25. package/skills/render-artifact/engine/render/lesson.mjs +294 -0
  26. package/skills/render-artifact/engine/render/shell.mjs +275 -0
  27. package/skills/render-artifact/engine/render/theme.mjs +592 -0
  28. package/skills/render-artifact/engine/schemas/common.schema.json +101 -0
  29. package/skills/render-artifact/engine/schemas/diagram.schema.json +176 -0
  30. package/skills/render-artifact/engine/schemas/lesson.schema.json +210 -0
  31. package/skills/render-artifact/engine/validate/composition.mjs +395 -0
  32. package/skills/render-artifact/engine/validate/diagnostics.mjs +83 -0
  33. package/skills/render-artifact/engine/validate/diagram-parts.mjs +68 -0
  34. package/skills/render-artifact/engine/validate/evidence.mjs +302 -0
  35. package/skills/render-artifact/engine/validate/index.mjs +132 -0
  36. package/skills/render-artifact/engine/validate/jsonschema.mjs +312 -0
  37. package/skills/render-artifact/engine/validate/structural.mjs +241 -0
  38. package/skills/render-artifact/engine/verification.mjs +76 -0
  39. package/skills/render-artifact/engine/version.mjs +24 -0
@@ -0,0 +1,293 @@
1
+ ---
2
+ name: map-system
3
+ description: Turn a plain request about a system or codebase into a semantic diagram artifact, with evidence pinned to a commit when the diagram is derived.
4
+ argument-hint: what to map, in your own words
5
+ ---
6
+
7
+ # Map System
8
+
9
+ Someone asks what a system looks like. You answer with a diagram they can
10
+ interrogate.
11
+
12
+ > Describe the system, not the canvas.
13
+
14
+ That line is the whole boundary. You decide what exists, what each thing is,
15
+ what relates to what, which things belong together, which walks matter, and
16
+ what backs every claim. You decide nothing about how any of it is drawn.
17
+
18
+ ## When this applies
19
+
20
+ A request about the shape of a system: "Map this repository's runtime
21
+ architecture." "Visualize this checkout flow." "Map the ticket lifecycle."
22
+ "Design an API with auth, cache, queue, workers and storage."
23
+
24
+ This is the only skill that writes a `diagram` specification.
25
+ `render-artifact` is infrastructure you call, not a thing a human invokes for a
26
+ diagram. If the request is really "teach me this feature", that is
27
+ `learn-feature`; "explain the whole codebase" is `learn-codebase`.
28
+
29
+ ## Read
30
+
31
+ 1. `skills/render-artifact/engine/references/specification.md` — the fields,
32
+ and `provenance` in particular.
33
+ 2. `skills/render-artifact/engine/references/validation.md` — the four layers,
34
+ the provenance table, and what the evidence layer does and does not
35
+ establish.
36
+ 3. `skills/render-artifact/engine/examples/diagram.json` — a complete derived
37
+ specification, as a shape to follow.
38
+ 4. Then the part of the system you were asked about, and nothing else. A map of
39
+ one subsystem does not need the whole repository read.
40
+
41
+ ## Output
42
+
43
+ ```text
44
+ diagrams/[system-slug]/diagram.json the semantic specification — yours
45
+ diagrams/[system-slug]/diagram.html the rendered artifact — the renderer's
46
+ ```
47
+
48
+ The JSON is the reviewable source. A human can read it, disagree with a claim,
49
+ and see exactly what was asserted and what backs it. It is also what makes the
50
+ artifact reproducible: the same specification through the same renderer version
51
+ produces the same bytes.
52
+
53
+ Do not author the HTML. Do not author SVG, CSS, or presentation JavaScript.
54
+ There is one visual-artifact path in Pathfinder and it runs through
55
+ `render-artifact`.
56
+
57
+ ## Process
58
+
59
+ 1. **Decide the provenance.** Before anything else, because it decides what
60
+ the rest of the work has to prove. See "Provenance" below.
61
+ 2. **Decide the scope.** See "Scope and size". Say what you excluded later.
62
+ 3. **Pin the commit,** when the diagram is `derived`. Use the commit the map
63
+ is *about* — normally the one you read. Never the working tree: evidence
64
+ resolves against the commit and nothing else.
65
+ 4. **Gather the evidence, then write the nodes.** In that order. A component
66
+ you cannot ground is not a component of a derived map.
67
+ 5. **Write the specification** to `diagram.json`.
68
+ 6. **Validate.**
69
+
70
+ ```sh
71
+ node skills/render-artifact/engine/bin/render.mjs validate \
72
+ diagrams/[system-slug]/diagram.json
73
+ ```
74
+
75
+ 7. **Deliver.**
76
+
77
+ ```sh
78
+ node skills/render-artifact/engine/bin/render.mjs deliver \
79
+ diagrams/[system-slug]/diagram.json \
80
+ diagrams/[system-slug]/diagram.html --json
81
+ ```
82
+
83
+ 8. **Report.** See "What to say afterwards".
84
+
85
+ ## The artifact is the proposal
86
+
87
+ Do not ask the human to approve a list of nodes and edges before you render.
88
+ Routine textual model approval is not required here and must not be
89
+ introduced — a wrong guess is far more obvious in a picture than in a list, and
90
+ a list costs the human a review they would have to do twice.
91
+
92
+ Render, then report what you chose. Corrections revise the specification and
93
+ deliver again.
94
+
95
+ ## Provenance
96
+
97
+ `provenance` is required and there is no default. Pick the one that is true.
98
+
99
+ **`derived`** — the system exists, and this map is what the repository asserts
100
+ about itself at the declared commit.
101
+
102
+ - `source` is required, with the repository and the pinned commit.
103
+ - Every node carries at least one citation.
104
+ - Every edge carries at least one citation.
105
+ - A group, path or view carrying a `summary` or `note` carries a citation. A
106
+ label-only one does not: its truth follows from its already-cited members.
107
+ - `artifact.summary` is not permitted. Put the claim on the thing it is about
108
+ and cite it there, or use `artifact.subtitle`, which names the diagram
109
+ rather than asserting anything.
110
+
111
+ **`proposed`, with a source** — a design that does not exist yet, argued
112
+ against a repository that does. Citations are optional; every one you supply is
113
+ still checked at the commit. `artifact.summary` is permitted, and is the right
114
+ place to say plainly that the diagram is a proposal.
115
+
116
+ **`proposed`, with no source** — a system with no repository behind it at all.
117
+ Omit `source` entirely. Citations are then forbidden, the evidence layer is
118
+ reported as not run, and the artifact carries no verification sentence.
119
+
120
+ Do not invent provenance to make a map look more authoritative. A source you
121
+ attached so the page would carry a commit row is the one lie this contract
122
+ cannot detect for you.
123
+
124
+ ## Evidence
125
+
126
+ Gather it before you treat anything as established fact. The shape is the one
127
+ the renderer uses everywhere:
128
+
129
+ ```json
130
+ { "path": "skills/ticket/SKILL.md", "lines": [43, 49] }
131
+ ```
132
+
133
+ Evidence is **where a reader goes to check a claim**, which is not always the
134
+ code implementing it. An actor is cited by the entry point that accepts it. An
135
+ external system by its client, its configuration, or its infrastructure
136
+ declaration. A subsystem by its manifest or its entry module.
137
+
138
+ A node says a component exists. An edge says two things relate. Each is a claim
139
+ somebody may want to check, which is why a derived map cites both.
140
+
141
+ **Repository documentation is first-class evidence.** A README, an ADR, a
142
+ runbook — all valid, all checked the same way. But keep the distinction, and
143
+ report it: a relationship you found in code, configuration or
144
+ infrastructure-as-code is grounded differently from one you found only in prose
145
+ somebody wrote about the system. Prose goes stale silently. Say which claims
146
+ rest on it.
147
+
148
+ What the engine establishes is that the cited file exists at that commit, that
149
+ the cited lines exist, and that the material is there to read. **Not that the
150
+ claim is true.** Provenance is not truth, and nothing you write may suggest
151
+ otherwise.
152
+
153
+ Two things not to do, both of which produce a map that passes validation and
154
+ misleads a reader:
155
+
156
+ - Do not infer a component nobody wrote down and then cite something nearby to
157
+ satisfy the schema. A citation that proves a file exists is not a citation
158
+ that supports the relationship you drew.
159
+ - Do not keep a component you cannot ground. Omit it, narrow the scope, or make
160
+ the whole map `proposed` — which is the honest answer when the interesting
161
+ part of the system is the part not in the repository.
162
+
163
+ ## Scope and size
164
+
165
+ The caps are 40 nodes, 80 edges, 8 groups, 6 paths and 6 views, and they are a
166
+ ceiling rather than a target. **A good primary diagram is roughly 8 to 20
167
+ nodes.** Below that it usually is not worth a picture; far above it, a reader
168
+ stops being able to hold the whole thing.
169
+
170
+ Split a large system rather than cramming it. Two coherent maps of two
171
+ subsystems beat one exhaustive map of both, and a request that would need 60
172
+ nodes is a request to narrow, split, or re-scope — say so rather than deleting
173
+ arbitrary components to fit.
174
+
175
+ ## Material ambiguity
176
+
177
+ Ask a question first **only** when the ambiguity would produce materially
178
+ disjoint systems — a different set of components, not a different level of
179
+ detail. "Map the pipeline" in a repository with an unrelated data pipeline and
180
+ release pipeline is material: the two maps share nothing.
181
+
182
+ Everything else you decide. Depth, emphasis, which peripheral thing to leave
183
+ out, how to group, which walks are worth an authored path — none of that is
184
+ material. Choose, render, and say what you chose. A skill that asks before
185
+ every judgement call makes the human do the work they asked you to do.
186
+
187
+ ## The vocabulary is closed
188
+
189
+ Roles: `actor`, `interface`, `service`, `store`, `queue`, `job`, `external`,
190
+ `step`, `decision`, `terminal`.
191
+
192
+ Relations: `calls`, `reads`, `writes`, `publishes`, `consumes`, `depends_on`,
193
+ `transitions_to`, `triggers`.
194
+
195
+ That is all of both, and an unknown value is refused rather than drawn with a
196
+ default. Architecture roles and process roles share one vocabulary on purpose:
197
+ a codebase map uses `service` and `store`, a lifecycle map uses `step` and
198
+ `decision`, and nothing in the renderer branches on which.
199
+
200
+ If the system genuinely cannot be expressed in these — not "does not fit
201
+ neatly", but cannot be said — stop and report the mismatch. Do not extend the
202
+ schema, and do not force a value that misdescribes what the thing is.
203
+
204
+ ## Groups and paths
205
+
206
+ A group is **semantic containment**: these things belong together in the
207
+ system. A node belongs to at most one group, and nesting is one level — a
208
+ parent must itself be a root. Do not reach for a group to improve the picture;
209
+ containment you invented to tidy the layout is a claim about the system that
210
+ is not true.
211
+
212
+ A path is an ordered walk worth calling a reader's attention to — a request
213
+ flow, a clean run, a failure route. It names the **edge ids** it consists of,
214
+ in order, and each edge must begin where the last one ended:
215
+
216
+ ```json
217
+ {
218
+ "id": "clean-run",
219
+ "label": "A clean run",
220
+ "note": "Four transitions, each performed by a different action.",
221
+ "edges": ["e-load", "e-start", "e-submit", "e-accept"]
222
+ }
223
+ ```
224
+
225
+ Edges rather than nodes, because two edges may join the same pair and a node
226
+ sequence could not say which relationship the path claims. Do not author a path
227
+ to make something look important: emphasis is derived from paths, so a path you
228
+ invented for emphasis is a claim you did not mean to make.
229
+
230
+ ## What you cannot ask for
231
+
232
+ The specification carries no presentation, and the schema refuses the attempt
233
+ rather than ignoring it. There is no field for a coordinate, a position, a
234
+ size, a width, a height, a rank, a lane, a column, a route, a bend, a side, an
235
+ orientation, a colour, an icon, a shape, a preset, an opacity, a transition, an
236
+ animation, a zoom level, a viewport, a theme, or a class.
237
+
238
+ There is no `emphasis` field either. An edge is drawn heavier exactly when an
239
+ authored path walks it — say why a walk matters, and the renderer decides how
240
+ loud it gets.
241
+
242
+ There is no field for focus, traversal, adjacency, or a reachable set. Upstream
243
+ and downstream are derived from the directed edges you wrote. How focus and
244
+ traversal *look*, and how the evidence panel behaves, are the renderer's
245
+ entirely.
246
+
247
+ Text is text. No field is Markdown and no field is HTML: every string is
248
+ escaped on the way out, so `<b>bold</b>` renders as those nine characters.
249
+
250
+ There is also no field for whether the specification was validated or whether
251
+ its evidence checked out, and no field that selects the artifact's verification
252
+ wording. Those are claims about work the engine performs, and the engine is the
253
+ only thing entitled to make them.
254
+
255
+ ## What to say afterwards
256
+
257
+ Report enough that the human can judge the map before accepting it:
258
+
259
+ - **the scope you interpreted**, in your words, and the request you read it from
260
+ - **the provenance mode**, and the pinned commit when there is one
261
+ - **what you deliberately excluded**, and why
262
+ - **the character of the evidence** — code, configuration,
263
+ infrastructure-as-code, documentation — as relevant
264
+ - **the weakest claims**, and any node or edge resting on documentation rather
265
+ than implementation
266
+ - **the artifact's location**
267
+ - **the validation and delivery result**, from the receipt
268
+
269
+ The receipt names the renderer version and the SHA-256 and byte count of both
270
+ the specification and the artifact. It supports one real claim: this
271
+ specification, compiled by this renderer, produced these bytes, and its
272
+ evidence resolved at the commit it names.
273
+
274
+ It says nothing about whether the diagram reads well or is a good map. Nobody
275
+ has looked at it. Report the validation result and say separately that
276
+ perceptual review has not happened. If a human then opens it, that is their
277
+ finding, in their words — and it is not evidence for the validation result any
278
+ more than the validation result is evidence for it.
279
+
280
+ ## When the renderer cannot run
281
+
282
+ Check with:
283
+
284
+ ```sh
285
+ node skills/render-artifact/engine/bin/render.mjs doctor
286
+ ```
287
+
288
+ If the engine is unavailable, or delivery fails, you may still describe the
289
+ system in conversation or in Markdown where that helps. That answer is not a
290
+ Pathfinder visual artifact. Do not call it one, do not hand-author HTML or SVG
291
+ to stand in for one, and do not reach for a second way to produce a picture. A
292
+ non-zero exit is never reported as success, and a failed delivery leaves any
293
+ previously delivered artifact exactly as it was.
@@ -0,0 +1,187 @@
1
+ ---
2
+ name: render-artifact
3
+ description: Compile a typed semantic specification into a self-contained, deterministic HTML artifact carrying the Pathfinder visual identity. Use when a skill must deliver a visual artifact instead of hand-authoring HTML.
4
+ argument-hint: validate|deliver|doctor <spec path>
5
+ ---
6
+
7
+ # Render Artifact
8
+
9
+ A producer skill writes a small typed specification. This engine compiles it
10
+ into one self-contained HTML file.
11
+
12
+ > The producer owns what is true. The renderer owns what it looks like.
13
+
14
+ That line is the whole design. A producer decides what exists — modules,
15
+ concepts and flows in a lesson; components, relationships, boundaries and
16
+ authored paths in a diagram — what each asserts, and the evidence behind it. It
17
+ never decides colour, layout, geometry, class names, or a single word of
18
+ interface language, and the schema rejects the attempt rather than ignoring it.
19
+
20
+ ## When this applies
21
+
22
+ Use it when a Pathfinder skill must deliver a visual artifact.
23
+
24
+ This engine is infrastructure a producer calls, not the human entry point. A
25
+ lesson comes from `learn-feature` or `learn-codebase`; a diagram comes from
26
+ `map-system`, which is the only skill that writes a `diagram` specification.
27
+
28
+ Do not hand-author HTML for such an artifact. Not as a fallback, not as a
29
+ placeholder, and not "just this once" — a hand-authored page carries the
30
+ identity without carrying any of the checks that make the identity mean
31
+ something.
32
+
33
+ ## The refusal
34
+
35
+ `lesson` and `diagram` are the only artifact kinds that exist. A `diagram`
36
+ supports one topology, `graph`, and an unsupported topology is refused with its
37
+ own diagnostic on exactly the same grounds: there is no generic layout to fall
38
+ back on.
39
+
40
+ If the artifact you need is neither kind, stop and say so. Do not invent a kind,
41
+ do not extend the schema to fit, and do not write the HTML yourself instead. A
42
+ missing kind is a refusal and a conversation with the human about whether that
43
+ kind should exist — never permission to improvise.
44
+
45
+ If the engine cannot run at all, you may still give the human your normal
46
+ conversational or Markdown answer where that already makes sense. You may not
47
+ call it the Pathfinder artifact, because it is not one.
48
+
49
+ ## Requirements
50
+
51
+ Node, at the version Pathfinder already supports. Nothing else: the engine has
52
+ zero runtime dependencies and imports only `node:` builtins.
53
+
54
+ Check with:
55
+
56
+ ```sh
57
+ node skills/render-artifact/engine/bin/render.mjs doctor
58
+ ```
59
+
60
+ `doctor` answers "can this machine render", not "is my specification good". It
61
+ deliberately does not validate the shipped examples — see "The examples" below.
62
+
63
+ ## Producing an artifact
64
+
65
+ 1. **Write the specification.** Start from the example for the kind —
66
+ `engine/examples/lesson.json` or `engine/examples/diagram.json` — and read
67
+ `engine/references/specification.md` for the fields. Every claim about the
68
+ source carries evidence: every concept in a lesson cites, and a `derived`
69
+ diagram cites every component and every relationship.
70
+ 2. **Pick the commit.** `source.commit` is what evidence resolves against. Use
71
+ the commit the artifact describes, not "now" — the working tree is never
72
+ consulted, so a citation either resolves at that commit or fails. A diagram
73
+ describing a system that does not exist yet declares no source at all;
74
+ `engine/references/validation.md` has the three provenance states and what
75
+ each is allowed to claim.
76
+ 3. **Validate.**
77
+
78
+ ```sh
79
+ node skills/render-artifact/engine/bin/render.mjs validate <spec.json>
80
+ ```
81
+
82
+ 4. **Deliver.**
83
+
84
+ ```sh
85
+ node skills/render-artifact/engine/bin/render.mjs deliver <spec.json> <out.html>
86
+ ```
87
+
88
+ Add `--repo <dir>` when the specification does not live in the repository it
89
+ cites. Add `--json` for a machine-readable receipt.
90
+
91
+ 5. **Report honestly.** See "What delivery proves" below.
92
+
93
+ ## The four layers
94
+
95
+ Each supports a different claim, and they are reported apart because collapsing
96
+ them would throw away the only thing that makes the result honest.
97
+
98
+ | Layer | The claim it supports |
99
+ | --- | --- |
100
+ | Structural | the specification satisfies its schema |
101
+ | Composition | identifiers, references, graphs and answers are coherent |
102
+ | Evidence | every citation resolves at the declared commit, where there is one |
103
+ | Delivery | the artifact was rendered, digested, and committed atomically |
104
+
105
+ A failure in any layer delivers nothing and leaves a previously delivered
106
+ artifact exactly as it was. A non-zero exit is never reported as success.
107
+
108
+ `engine/references/validation.md` has the diagnostics and what each one means.
109
+
110
+ ## What delivery proves
111
+
112
+ The receipt names the renderer version and the SHA-256 and byte count of both
113
+ the specification and the artifact. That is a real claim: this specification,
114
+ compiled by this renderer, produced these bytes. `deliver` reads the
115
+ specification as bytes, parses and validates that one copy, and renders it, so
116
+ the digest in the receipt is the digest of what was actually rendered.
117
+
118
+ A delivered artifact whose evidence was actually checked also carries a sentence
119
+ saying so. Only delivery can put it there — rendering on its own emits no such
120
+ claim, and nothing in a specification can ask for one. An artifact with no
121
+ citation to resolve carries no such sentence either: a layer that had nothing to
122
+ check is not a layer that checked something, and the wording follows what was
123
+ verified rather than what was asked for.
124
+
125
+ None of it is a claim that the artifact looks right. Nobody has looked at it.
126
+
127
+ So when you report a delivery, say what was checked and say separately that
128
+ perceptual review has not happened. If a human has opened it in a browser, that
129
+ is their finding to record, in their words, and it is not evidence for the
130
+ validation result any more than the validation result is evidence for it.
131
+
132
+ ## Determinism
133
+
134
+ The invariant: **the same specification bytes and the same renderer version
135
+ produce byte-identical HTML in every supported environment.**
136
+
137
+ A renderer release may intentionally change output. That is a version change,
138
+ which is why the receipt reports the renderer version alongside the digests. If
139
+ you change anything that can alter rendered HTML, bump `engine/version.mjs` in
140
+ the same commit.
141
+
142
+ `engine/references/determinism.md` has the rules this puts on the code.
143
+
144
+ ## The examples
145
+
146
+ One per kind: `engine/examples/lesson.json` and `engine/examples/diagram.json`.
147
+ Both cite the Pathfinder source repository at a fixed commit, so both are
148
+ reference fixtures for that repository rather than specimens that validate
149
+ anywhere.
150
+
151
+ In an installed project that commit does not exist, and validating either there
152
+ fails with `source_commit_unavailable`. That is correct behaviour, not a broken
153
+ installation: evidence is never fetched, never cloned, and never looked up over
154
+ a network, so a commit that is not present locally is a commit whose evidence
155
+ was not verified — and the engine says so rather than claiming otherwise.
156
+
157
+ Read them as examples of the shape. Do not run them as a health check; run
158
+ `doctor` for that.
159
+
160
+ ## Layout
161
+
162
+ Paths below are relative to this skill's own directory.
163
+
164
+ ```
165
+ SKILL.md this file
166
+ engine/version.mjs the renderer version — the deterministic input
167
+ engine/bin/render.mjs validate | deliver | doctor
168
+ engine/schemas/ common.schema.json, and one schema per kind
169
+ engine/validate/ structural, composition, evidence layers
170
+ engine/render/ shared shell and theme, plus one renderer per kind
171
+ engine/render/graph/ everything specific to drawing a graph
172
+ engine/deliver.mjs the delivery layer
173
+ engine/doctor.mjs capability check
174
+ engine/examples/ the reference fixtures, one per kind
175
+ engine/references/ the detail this file deliberately does not carry
176
+ ```
177
+
178
+ The engine lives under `skills/` because that is what the kit copies, so an
179
+ installed project, the generated adapters, and the plugin surface all carry it
180
+ with no change to `copy-list.json`.
181
+
182
+ ## Attribution
183
+
184
+ The architecture — typed specification, deterministic compile, layered
185
+ validation, verification claims kept apart — is adapted at the level of ideas
186
+ from Archify (`tt-a1i/archify`, MIT). No Archify source is copied. If any is
187
+ later adapted, retain its notice and declare it in this frontmatter.