@marcomigozzi/trailhead 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +159 -98
  2. package/bin/trailhead.js +14 -3
  3. package/package.json +2 -4
  4. package/plugins/trailhead/.claude-plugin/plugin.json +2 -4
  5. package/plugins/trailhead/commands/adopt.md +2 -2
  6. package/plugins/trailhead/commands/bug.md +1 -1
  7. package/plugins/trailhead/commands/config.md +1 -1
  8. package/plugins/trailhead/commands/grill.md +1 -1
  9. package/plugins/trailhead/commands/idea.md +1 -1
  10. package/plugins/trailhead/commands/inbox.md +1 -1
  11. package/plugins/trailhead/commands/map.md +1 -1
  12. package/plugins/trailhead/commands/new.md +1 -1
  13. package/plugins/trailhead/commands/note.md +1 -1
  14. package/plugins/trailhead/commands/pause.md +1 -1
  15. package/plugins/trailhead/commands/resume.md +1 -1
  16. package/plugins/trailhead/commands/seed.md +2 -2
  17. package/plugins/trailhead/commands/split.md +1 -1
  18. package/plugins/trailhead/commands/ticket.md +1 -1
  19. package/plugins/trailhead/commands/todo.md +2 -2
  20. package/plugins/trailhead/commands/update.md +5 -0
  21. package/plugins/trailhead/commands/work.md +1 -1
  22. package/plugins/trailhead/hooks/hooks.json +14 -0
  23. package/plugins/trailhead/hooks/trailhead-check-update.js +125 -0
  24. package/plugins/trailhead/hooks/trailhead-commit-guard.js +3 -3
  25. package/plugins/trailhead/hooks/trailhead-issue-injection-scanner.js +5 -5
  26. package/plugins/trailhead/hooks/trailhead-secret-guard.js +131 -0
  27. package/plugins/trailhead/hooks/trailhead-secret-guard.test.js +71 -0
  28. package/plugins/trailhead/skills/trailhead/SKILL.md +176 -208
  29. package/plugins/trailhead/skills/trailhead/references/capture.md +20 -0
  30. package/plugins/trailhead/skills/trailhead/references/configuration.md +44 -16
  31. package/plugins/trailhead/skills/trailhead/references/inbox.md +29 -0
  32. package/plugins/trailhead/skills/trailhead/references/teamwork.md +87 -0
  33. package/plugins/trailhead/skills/trailhead/references/techniques/acceptance-testing.md +6 -2
  34. package/plugins/trailhead/skills/trailhead/references/techniques/code-review.md +10 -6
  35. package/plugins/trailhead/skills/trailhead/references/techniques/codebase-map.md +9 -7
  36. package/plugins/trailhead/skills/trailhead/references/techniques/debug.md +11 -9
  37. package/plugins/trailhead/skills/trailhead/references/techniques/domain-vocabulary.md +6 -5
  38. package/plugins/trailhead/skills/trailhead/references/techniques/grilling.md +8 -8
  39. package/plugins/trailhead/skills/trailhead/references/techniques/plan-review.md +14 -5
  40. package/plugins/trailhead/skills/trailhead/references/techniques/prototype.md +10 -8
  41. package/plugins/trailhead/skills/trailhead/references/techniques/research.md +7 -7
  42. package/plugins/trailhead/skills/trailhead/references/techniques/tdd.md +6 -6
  43. package/plugins/trailhead/skills/trailhead/references/updating.md +42 -0
  44. package/plugins/trailhead/templates/statusline-trailhead.sh +344 -0
  45. package/plugins/trailhead/templates/trailhead-label-guard.yml +2 -2
package/README.md CHANGED
@@ -1,55 +1,103 @@
1
1
  # trailhead
2
2
 
3
- **Start and drive large projects as a map of tickets on GitHub Issues — resolving one at a time until the way to the destination is clear.**
3
+ **Start and drive large projects as a map of tickets on GitHub Issues, resolving one at a time until the way to the destination is clear.**
4
4
 
5
- `trailhead` is an orchestrator skill for [Claude Code](https://docs.claude.com/en/docs/claude-code). It gives a big, foggy idea a place to begin — a *trailhead* — and a disciplined way to walk it to a working result, with the whole plan living on your issue tracker instead of in scattered local files.
5
+ `trailhead` is an orchestrator skill for [Claude Code](https://docs.claude.com/en/docs/claude-code). It gives a big, foggy idea a place to begin (a *trailhead*) and a disciplined way to walk it to a working result, with the whole plan living on your issue tracker instead of in scattered local files.
6
6
 
7
7
  ---
8
8
 
9
- ## Why trailhead exists
9
+ ## 💡 Why trailhead exists
10
10
 
11
11
  Two approaches to agent-driven project work each nail one half of the problem:
12
12
 
13
- - **[Wayfinder](https://github.com/mattpocock/skills)** (by Matt Pocock) is brilliant at *starting*. It turns a loose idea into a **shared map of decision tickets on your issue tracker**, named through a proper grilling conversation, with a visible frontier and a "fog of war" for what isn't sharp enough to plan yet. You resolve one decision per session and the map grows outward. What it deliberately doesn't do is *build* — it plans, then hands off.
13
+ - **[Wayfinder](https://github.com/mattpocock/skills)** (by Matt Pocock) is brilliant at *starting*. It turns a loose idea into a **shared map of decision tickets on your issue tracker**, named through a proper grilling conversation, with a visible frontier and a "fog of war" for what isn't sharp enough to plan yet. You resolve one decision per session and the map grows outward. What it deliberately doesn't do is *build*: it plans, then hands off.
14
14
 
15
15
  - **GSD** (the [open-gsd](https://github.com/open-gsd/gsd-core) workflow system) is brilliant at *doing*. Its `discuss → plan → execute → verify` cycle, atomic commits, and zero-friction capture make the actual construction reliable and reviewable. But its state lives in a local `.planning/` tree, separate from where the team can see it.
16
16
 
17
- Working across both, one pattern kept recurring: **use Wayfinder's map and onboarding to decide the shape of the work, then use GSD's engine to build each piece — without ever leaving the issue tracker.** `trailhead` is that pattern made into a single skill.
17
+ Working across both, one pattern kept recurring: **use Wayfinder's map and onboarding to decide the shape of the work, then use GSD's engine to build each piece, without ever leaving the issue tracker.** `trailhead` is that pattern made into a single skill.
18
18
 
19
- > **trailhead is self-contained.** Wayfinder and GSD are *inspiration*, not dependencies. Every technique those systems package as a separate skill — grilling, TDD, systematic debugging, codebase mapping, code review — is **built in here as an inline protocol**. trailhead's core invokes no other skill; its subagents (research, codebase-map, review) use Claude Code's built-in `Agent` tool. The only thing to install is trailhead itself. (One opt-in exception: `claude.ai/design` mockup mode uses Claude Code's built-in Claude Design when enabled, and silently falls back to local-disk mockups when it isn't.)
19
+ > **trailhead is self-contained.** Wayfinder and GSD are *inspiration*, not dependencies. Every technique those systems package as a separate skill (grilling, TDD, systematic debugging, codebase mapping, code review) is **built in here as an inline protocol**. trailhead's core invokes no other skill; its subagents (research, codebase-map, review) use Claude Code's built-in `Agent` tool. The only thing to install is trailhead itself. There is one opt-in exception: when enabled, `claude.ai/design` mockup mode pushes to a design-system project via DesignSync (the `claude_design` MCP plus the `/design-sync` skill). If that isn't available, it silently falls back to local-disk mockups.
20
20
 
21
21
  The design choices that fall out of it:
22
22
 
23
- - **Everything lives on GitHub Issues.** The map is the parent issue; each ticket is a child issue; discussion, plan, and verification are *comments*. There is no `.planning/` directory — the repo holds code only, and the plan is always visible to anyone with the repo.
24
- - **Execution happens inside the map.** Unlike pure Wayfinder ("plan, don't do"), build tickets graduate from the fog and are executed as children of the map. The destination is the **working artifact** (a deployed app), not a spec document — though a project can override that and stop at the spec.
23
+ - **Everything lives on GitHub Issues.** The map is the parent issue; each ticket is a child issue; discussion, plan, and verification are *comments*. There is no `.planning/` directory: the repo holds code only, and the plan is always visible to anyone with the repo.
24
+ - **Execution happens inside the map.** Unlike pure Wayfinder ("plan, don't do"), build tickets graduate from the fog and are executed as children of the map. The destination is the **working artifact** (a deployed app), not a spec document, though a project can override that and stop at the spec.
25
25
  - **Lean by default.** The heavy machinery (codebase mapping, systematic debugging) runs once where it earns its keep; the per-ticket cycle stays light.
26
26
 
27
+ - **Built for teams, because the plan is shared.** The tracker is the single source of truth, so the map is a **shared workspace**, not one person's local file. Many people (and their agents) work it at once, and the mechanics keep them from colliding:
28
+ - **Claiming.** You take a ticket by assigning it to yourself; the assignee *is* the lock. A collision stops you and asks, rather than clobbering someone else's work. Whoever claims a ticket owns it end to end and closes it, no separate approver.
29
+ - **A shared frontier, one ticket per session.** The **frontier** (open, unassigned, unblocked tickets) is the common queue of what's takeable now; each person picks a different one. Resolving a ticket ends the session, so work stays in reviewable, single-ticket chunks.
30
+ - **Isolation for concurrent sessions on one machine.** Two agents editing one checkout corrupt each other, so the `isolation:` convention gives each in-flight ticket its own **`git worktree`** (or a full **`clone`** for path-bound apps a worktree can't build); disjoint `Scope:` lines let non-overlapping work run in parallel and serialise only where it truly overlaps.
31
+ - **Pause, resume, split.** Any ticket can be **paused** with a checkpoint comment and **resumed** later by anyone (once released), or **split** into children when it outgrows a session, with blockers re-pointed so the frontier stays honest.
32
+ - **Several maps at once.** A repo can carry **more than one live map** (parallel milestones or features), each with its own scoped frontier, so two people can drive two efforts on the same repo without stepping on each other, and you can park one map to work another.
33
+ - **Outsiders and trust.** Issues opened by other people flow through an **inbox** that reframes the worthwhile ones into tickets *in place* (keeping the reporter's authorship), while a **trust and provenance** guard quarantines `trailhead:*`-labelled issues from untrusted sources until a maintainer adopts them, backed by a repo-side label-guard workflow.
34
+
35
+ The full protocol lives in the **Working as a team** section below.
36
+
27
37
  ---
28
38
 
29
- ## How it works
39
+ ## 📦 Install
40
+
41
+ > **Claude Code only, for now.** trailhead installs as a Claude Code skill + `/trailhead:*` commands + hooks. It's built to grow to other AI CLIs later (the installer already uses a per-agent adapter), but today Claude Code is the only supported host.
42
+
43
+ **Prerequisites:** an authenticated [`gh` CLI](https://cli.github.com) (the tracker is GitHub Issues) and a GitHub repo to work in. The npm path also needs Node 18+.
44
+
45
+ ### As a Claude Code plugin (native, managed by `/plugin`)
46
+ ```
47
+ /plugin marketplace add ToRvaLDz/trailhead
48
+ /plugin install trailhead@trailhead
49
+ ```
50
+ Update with `/plugin update trailhead`; remove with `/plugin uninstall trailhead`.
51
+
52
+ ### Or via npm (installs into your agent's config dir)
53
+ ```
54
+ npx @marcomigozzi/trailhead # install into ~/.claude (or $CLAUDE_CONFIG_DIR)
55
+ npx @marcomigozzi/trailhead --symlink # dev install (symlink to the checkout, edits go live)
56
+ npx @marcomigozzi/trailhead --uninstall # remove everything it added
57
+ npx @marcomigozzi/trailhead --dir=<path> # target a specific config dir
58
+ ```
59
+ It copies the skill (+ its `references/`), the `/trailhead:*` commands, the hooks (into `hooks/`, registered in `settings.json`) including a SessionStart **update check**, and the label-guard + statusline templates, idempotently. Re-run `npx @marcomigozzi/trailhead` to update, or run **`/trailhead:update`** from inside the agent: it detects how trailhead was installed and installs the newer version where that is safe (a `git pull` for a dev-symlink, an `npx` re-run for npm, or `/plugin update` for the plugin). When a newer version exists, the statusline shows a `⬆ trailhead <version>` flag.
60
+
61
+ ### After installing
62
+ Restart or reload your agent so the commands register, then run **`/trailhead`** to start (smart entry), or `/trailhead:new "<idea>"` to chart a map. Note: once installed, the **commit guard hook runs on every `git commit`** (enforcing Conventional Commits and blocking `Co-Authored-By`); disable the plugin's hooks in settings if you don't want that. Either way trailhead is self-contained: no other skill or plugin is required, no preflight, no version drift.
63
+
64
+ ---
65
+
66
+ ## 🗺️ How it works
30
67
 
31
68
  A **map** is one GitHub issue labelled `trailhead:map`. It's an index, not a store: a Destination, standing Notes, the `Decisions so far`, the `Not yet specified` fog, and what's `Out of scope`.
32
69
 
33
- Each **ticket** is a child issue with a type label and a one-question body. The **frontier** is the set of open, unassigned tickets whose blockers are all closed — what's takeable right now. You claim a ticket by assigning it to yourself, resolve it with the engine for its type, then record the answer as a comment, close it, and gist it back onto the map.
70
+ **What earns a map?** A map is the unit for an effort that is **too big to hold in one session** and carries **open decisions**, not just execution. In practice that's a **milestone** (a release, a version, "v2 of the dashboard"), or a **single feature big enough that you must decide before you can build it**: where the data lives, which library, what the screen actually does. Charting a map names its destination and fans that effort out into many tickets, wired by their dependencies. As the decisions resolve, the fog clears and the build tickets graduate, until the destination is reached.
71
+
72
+ What does **not** need its own map is a single, defined piece of work with no open questions, small enough to finish in one session. That is just **one ticket**, a direct `build` (or a `todo`): a *work* you take with `/trailhead:work` and resolve in a sitting, no charting required. **Rule of thumb: decisions to make, or too big for one sitting → a map; "just do X" → a single work.** A feature that starts as a lone work but turns out to need decisions gets promoted to its own map (or split); a map whose questions all evaporate collapses back to a handful of works. And a repo can hold **several maps at once** (parallel milestones or features), each with its own frontier, so you can park one and work another.
73
+
74
+ Each **ticket** is a child issue with a type label and a one-question body. The **frontier** is the set of open, unassigned tickets whose blockers are all closed: what's takeable right now. You claim a ticket by assigning it to yourself, resolve it with the engine for its type, then record the answer as a comment, close it, and gist it back onto the map.
34
75
 
35
76
  As tickets resolve, the fog clears: questions that were too vague to phrase become sharp enough to ticket, one at a time, until nothing is left to decide or build and the destination is reached.
36
77
 
78
+ A map is scoped to **one** effort, so knowledge that belongs to the *repo* (not to any single map) lives in two **repo-scoped anchor issues**, created once and shared by every map (each map's Notes just links them, so nothing is stranded when a map finishes):
79
+
80
+ - **`trailhead:codebase`**: the distilled codebase map (architecture, stack, conventions, risks, test/build), written once at adopt and refreshed only on major drift.
81
+ - **`trailhead:conventions`**: the project's **way of working**, readable by everyone: a small machine-read header the engine obeys (`git: main|pr`, `release: command|auto`, `isolation: none|worktree|clone`) over human prose. `/trailhead:adopt` and `:new` ask for it up front. `isolation: worktree` gives each executing ticket its own `git worktree` + branch (concurrent sessions on one clone never share a working tree); `isolation: clone` gives it a dedicated clone instead, for path-bound apps a worktree can't build.
82
+
83
+ Together with the map, these three fill GitHub's **3 pinned-issue slots**, so a repo's trailhead anchors stay one click away. Project *config* (models, TDD, design…) is separate again, a plain `.trailhead/config.json` file at the repo root, never in an issue.
84
+
37
85
  ---
38
86
 
39
- ## Workflow
87
+ ## 🔄 Workflow
40
88
 
41
89
  **The lifecycle.** Every project walks the same loop:
42
90
 
43
- 1. **Start** — `/trailhead:new "<idea>"` (greenfield) or `/trailhead:adopt` (existing code: map the codebase once, then go lean). This *charts the map*: name the destination, then map the frontier breadth-first into the first tickets and the fog.
44
- 2. **Work the frontier, one ticket per session** — `/trailhead:work` takes the next takeable ticket (or one you name) and runs the engine for its type: `research` gathers a fact · `decision` diverges options then grills to choose · `prototype` makes a rough artifact to react to · `build` runs discuss → plan → execute → verify · `bug` runs repro → diagnose → fix → verify · `task` is manual plumbing that unblocks a decision.
45
- 3. **Close & unblock** — resolve the ticket (comment + close), gist it into `Decisions so far`, and drop `trailhead:blocked` from any dependent whose last blocker just closed — graduating it onto the frontier.
46
- 4. **Repeat** until the frontier is empty and the fog has cleared — the destination (a working artifact) is reached.
91
+ 1. **Start**: `/trailhead:new "<idea>"` (greenfield) or `/trailhead:adopt` (existing code: map the codebase once, then go lean). This *charts the map*: name the destination, then map the frontier breadth-first into the first tickets and the fog.
92
+ 2. **Work the frontier, one ticket per session**: `/trailhead:work` takes the next takeable ticket (or one you name) and runs the engine for its type: `research` gathers a fact · `decision` diverges options then grills to choose · `prototype` makes a rough artifact to react to · `build` runs discuss → plan → execute → verify · `bug` runs repro → diagnose → fix → verify · `task` is manual plumbing that unblocks a decision.
93
+ 3. **Close & unblock**: resolve the ticket (comment + close), gist it into `Decisions so far`, and drop `trailhead:blocked` from any dependent whose last blocker just closed, graduating it onto the frontier.
94
+ 4. **Repeat** until the frontier is empty and the fog has cleared: the destination (a working artifact) is reached.
47
95
 
48
96
  Along the way: **capture** ideas mid-work without derailing, **split** a ticket that grew too big, **pause/resume** across sessions, and let several people work unblocked tickets in parallel.
49
97
 
50
- ### A worked example — "add social login"
98
+ ### A worked example: "add social login"
51
99
 
52
- Destination: *users sign in with Google and GitHub, alongside email/password.* Charting fans it into six tickets — one of each type — wired by their dependencies:
100
+ Destination: *users sign in with Google and GitHub, alongside email/password.* Charting fans it into six tickets (one of each type) wired by their dependencies:
53
101
 
54
102
  ```
55
103
  ① research "OAuth providers + library: Supabase Auth native or Auth.js?" ← frontier (AFK)
@@ -60,7 +108,7 @@ Destination: *users sign in with Google and GitHub, alongside email/password.* C
60
108
  ⑥ bug (appears after ⑤ ships)
61
109
  ```
62
110
 
63
- Initial frontier = ①③④ — three people can start in parallel. Then:
111
+ Initial frontier = ①③④, three people can start in parallel. Then:
64
112
 
65
113
  - **① research** → a subagent reads the docs, returns a decision-ready finding, closes → unblocks ②.
66
114
  - **② decision** → diverge the options, grill to choose native vs custom, record the why.
@@ -78,102 +126,116 @@ Initial frontier = ①③④ — three people can start in parallel. Then:
78
126
 
79
127
  The preparatory types (`research`/`decision`/`prototype`/`task`) unblock the constructive ones (`build`/`bug`); parallelism is real but across sessions on the frontier, not inside one.
80
128
 
81
- ### …then a suggestion arrives — inbox → fog → graduation
129
+ ### …then a suggestion arrives: inbox → fog → graduation
82
130
 
83
- The app is live, and a user *not on the team* files a plain issue: *"can we add Apple sign-in too?"* — no `trailhead:*` label, so it isn't a ticket yet. Here's how an outside voice becomes a first-class ticket on the map, without losing the reporter's authorship:
131
+ The app is live, and a user *not on the team* files a plain issue: *"can we add Apple sign-in too?"* No `trailhead:*` label, so it isn't a ticket yet. Here's how an outside voice becomes a first-class ticket on the map, without losing the reporter's authorship:
84
132
 
85
- 1. **Inbox** — `/trailhead:inbox` lists it under *New — to triage*. It's in scope but not sharp: web only or native? does it need the paid Apple Developer account? You can't phrase one answerable Question yet — so you don't force a ticket.
86
- 2. **Fog** — label it `trailhead:fog` and **keep the issue open as a clarification space**. A comment posts the sharpening questions (async grilling); the reporter and anyone interested refine it in the thread. It's off the frontier but tracked — `gh issue list --label trailhead:fog` is the durable list, and the reporter follows their own issue.
87
- 3. **Graduation** — the discussion converges. Next time you run `/trailhead:inbox`, its *Parked fog* section surfaces the thread as recently-active — that's how you notice the fog cleared. Now the Question is phrasable, so you **adopt it in place**: swap `trailhead:fog` for `trailhead:ticket` + a type label, add the `Parent:` line and the `## Question`. Same issue number, same reporter credited — it lands on the frontier, ready for `/trailhead:work`.
133
+ 1. **Inbox**: `/trailhead:inbox` lists it under *New: to triage*. It's in scope but not sharp: web only or native? does it need the paid Apple Developer account? You can't phrase one answerable Question yet, so you don't force a ticket.
134
+ 2. **Fog**: label it `trailhead:fog` and **keep the issue open as a clarification space**. A comment posts the sharpening questions (async grilling); the reporter and anyone interested refine it in the thread. It's off the frontier but tracked: `gh issue list --label trailhead:fog` is the durable list, and the reporter follows their own issue.
135
+ 3. **Graduation**: the discussion converges. Next time you run `/trailhead:inbox`, its *Parked fog* section surfaces the thread as recently-active: that's how you notice the fog cleared. Now the Question is phrasable, so you **adopt it in place**: swap `trailhead:fog` for `trailhead:ticket` + a type label, add the `Parent:` line and the `## Question`. Same issue number, same reporter credited, it lands on the frontier, ready for `/trailhead:work`.
88
136
 
89
137
  ```
90
138
  suggestion issue ──inbox──► 🌫️ fog (kept open, discussed) ──sharpens──► 🎫 ticket on the frontier
91
139
  (same #, reporter still credited)
92
140
  ```
93
141
 
94
- No separate backlog, no lost credit: the map absorbs external suggestions the same way it grows its own — through fog that graduates when it's sharp.
142
+ No separate backlog, no lost credit: the map absorbs external suggestions the same way it grows its own, through fog that graduates when it's sharp.
95
143
 
96
144
  ---
97
145
 
98
- ## Commands
146
+ ## ⌨️ Commands
99
147
 
100
148
  `trailhead` is user-invoked (it won't fire on its own). The **first word** is the verb; the rest is text or a ticket number. With no verb, `/trailhead` does **smart entry**: it inspects the repo and proposes the right next move.
101
149
 
102
- Every verb is also a namespaced command — `/trailhead:new`, `/trailhead:work`, `/trailhead:bug`, … — so typing `/trailhead` lists them all in the command picker. `/trailhead <verb>` and `/trailhead:<verb>` are equivalent.
150
+ Every verb is also a namespaced command (`/trailhead:new`, `/trailhead:work`, `/trailhead:bug`, …) so typing `/trailhead` lists them all in the command picker. `/trailhead <verb>` and `/trailhead:<verb>` are equivalent.
103
151
 
104
152
  ### Flow
105
153
 
106
154
  | Command | What it does |
107
155
  |---|---|
108
- | `/trailhead` | smart entry — detect state and propose |
156
+ | `/trailhead` | smart entry: detect state and propose |
109
157
  | `/trailhead:new [idea]` | chart a new map from a loose idea |
110
158
  | `/trailhead:adopt` | adopt an existing project (map the codebase once, then go lean) |
111
159
  | `/trailhead:work [ticket]` | work the next frontier ticket, or the one you name |
112
160
  | `/trailhead:inbox [issue]` | triage issues opened by others and integrate the good ones into the map |
113
161
  | `/trailhead:resume [ticket]` | resume a paused ticket from its `PAUSED` checkpoint |
114
162
  | `/trailhead:pause [note]` | checkpoint the ticket in play so anyone can resume it |
115
- | `/trailhead:ticket <type> <title>` | open a ticket on the fly (diverges briefly first — a micro-charting act) |
163
+ | `/trailhead:ticket <type> <title>` | open a ticket on the fly (diverges briefly first: a micro-charting act) |
116
164
  | `/trailhead:split [ticket]` | split an oversized ticket into children, supersede the original |
117
165
  | `/trailhead:grill [topic]` | run a standalone grilling session on a decision/topic |
118
166
  | `/trailhead:map` | show the low-res map (destination, decisions, frontier, fog) |
119
167
 
120
- ### Capture — zero friction, one confirmation line, resolves nothing
168
+ ### Capture: zero friction, one confirmation line, resolves nothing
121
169
 
122
170
  | Command | Lands as | Meaning |
123
171
  |---|---|---|
124
- | `/trailhead:todo <text>` | a frontier ticket | *I'm doing it* — defined work, now |
172
+ | `/trailhead:todo <text>` | a frontier ticket | *I'm doing it*: defined work, now |
125
173
  | `/trailhead:seed <text>` | a blocked ticket (trigger noted) | *I'll do it when X happens* |
126
- | `/trailhead:idea <text>` | the fog (`Not yet specified`) | *maybe I'll do it* — graduates to a ticket if it sharpens |
127
- | `/trailhead:note <text>` | verbatim text | *remember this* — not necessarily work |
174
+ | `/trailhead:idea <text>` | the fog (`Not yet specified`) | *maybe I'll do it*: graduates to a ticket if it sharpens |
175
+ | `/trailhead:note <text>` | verbatim text | *remember this*: not necessarily work |
128
176
  | `/trailhead:bug [--of <ticket>] <text>` | a `bug` ticket | a defect; `--of` records it as a `Regression of:` a closed ticket |
129
177
 
130
- The four fog/ticket captures form a spectrum of commitment and timing: **note < idea < seed < todo**. Discriminator — not even work → `note`; maybe, once it's clear → `idea`; yes, when X happens → `seed`; yes, now → `todo`.
178
+ The four fog/ticket captures form a spectrum of commitment and timing: **note < idea < seed < todo**.
179
+
180
+ The three that trip people up are **idea, seed, todo**, so here they are spelled out:
181
+
182
+ - **`idea`** = *maybe, and not yet clear.* It lands in the **fog** (`Not yet specified`), **not** as a ticket, because you can't even phrase the question sharply yet, so there is nothing to work. It **graduates** into a ticket later, when the frontier reaches it or it simply gets clearer.
183
+ - **`seed`** = *yes, but not yet.* It **is** a ticket, but **parked** (`trailhead:blocked`) on a **trigger** you name ("when the public API ships", "when we pass 1k users"). The question is already sharp; what's missing is a **condition**, not clarity. When the trigger fires, it graduates onto the frontier.
184
+ - **`todo`** = *yes, now.* Defined work you will just do: it's born a **`build` ticket on the frontier**, takeable immediately.
185
+
186
+ The two cuts that matter: **idea vs seed** is waiting on *clarity* vs waiting on a *condition* (both land "later", for different reasons); **seed vs todo** is committed *later* vs committed *now*. Below all three sits **`note`** (raw text to remember, maybe never work), and off to the side is **`bug`** (a defect, not a commitment tier). The test for idea vs ticket is always: **can you phrase the question precisely now?** Yes → a ticket (`todo` if takeable, `seed` if gated); no → the fog (`idea`).
131
187
 
132
188
  ---
133
189
 
134
- ## Ticket types and their engines
190
+ ## 🎫 Ticket types and their engines
135
191
 
136
192
  Each ticket carries a type label; each type has its own way of being resolved.
137
193
 
138
- Each type has its own inline engine — no external skill is invoked.
194
+ Each type has its own inline engine: no external skill is invoked.
139
195
 
140
196
  | Type | Produces | Mode | Engine |
141
197
  |---|---|---|---|
142
- | `decision` | a choice | HITL | diverge the options if unclear, then grill to converge on one |
143
- | `research` | a fact | AFK | a subagent on a throwaway branch (the only type run in parallel) |
144
- | `prototype` | an approved direction | HITL | a rough throwaway artifact to react to; UI screens go through this (disk, or a configured claude.ai/design project) before UI code |
145
- | `build` | working code | HITL/AFK | `discuss → plan → execute → verify` — atomic commits, TDD at seams, code review + acceptance testing (browser-drive or guided UAT) |
146
- | `bug` | corrected code | HITL/AFK | `repro → diagnose → fix → verify`; a defect in closed work is a *new* ticket (`Regression of:`), not a reopen |
147
- | `task` | an external state change | HITL/AFK | manual work that unblocks a decision (provision access, move data, sign up) |
198
+ | 🧭 `decision` | a choice | HITL | diverge the options if unclear, then grill to converge on one |
199
+ | 🔬 `research` | a fact | AFK | a subagent on a throwaway branch (the only type run in parallel) |
200
+ | 🎨 `prototype` | an approved direction | HITL | a rough throwaway artifact to react to; UI screens go through this (disk, or a configured claude.ai/design project) before UI code |
201
+ | 🔨 `build` | working code | HITL/AFK | `discuss → plan → execute → verify`: atomic commits, TDD at seams, **a mockup first for user-facing UI** (Prototype technique, gated by `design.approval`), code review + acceptance testing (browser-drive or conversational step-by-step UAT) |
202
+ | 🐛 `bug` | corrected code | HITL/AFK | `repro → diagnose → fix → verify`; a defect in closed work is a *new* ticket (`Regression of:`), not a reopen |
203
+ | 🔧 `task` | an external state change | HITL/AFK | manual work that unblocks a decision (provision access, move data, sign up) |
148
204
 
149
- Two rules of thumb: build tickets **never auto-grill** — on blocking ambiguity the skill stops and asks; and brainstorming (divergence) lives in charting, in `ticket`'s micro-charting, and in a `decision`'s option phase — never in the grilling itself, which only converges.
205
+ Two rules of thumb: build tickets **never auto-grill**: on blocking ambiguity the skill stops and asks; and brainstorming (divergence) lives in charting, in `ticket`'s micro-charting, and in a `decision`'s option phase, never in the grilling itself, which only converges.
150
206
 
151
207
  ---
152
208
 
153
- ## Labels
209
+ ## 🏷️ Labels
154
210
 
155
211
  Everything the map needs is expressed as GitHub labels, so state is queryable in the tracker UI:
156
212
 
157
213
  - **Structural:** `trailhead:map`, `trailhead:ticket`
158
- - **Type (one per ticket):** `trailhead:decision` · `research` · `prototype` · `build` · `bug` · `task`
214
+ - **Repo-scoped anchors (one each per repo):** `trailhead:codebase` (the distilled codebase map), `trailhead:conventions` (the way of working)
215
+ - **Type (one per ticket):** 🧭 `trailhead:decision` · 🔬 `research` · 🎨 `prototype` · 🔨 `build` · 🐛 `bug` · 🔧 `task`
159
216
  - **State:** `trailhead:blocked` (has an open blocker) · `seed` (parked on a trigger) · `out-of-scope` (closed, beyond the destination) · `superseded` (closed, split into children)
160
217
 
161
- The **frontier** is then a single query — open, unassigned, not `trailhead:blocked` — no body-parsing needed.
218
+ The **frontier** is then a single query (open, unassigned, not `trailhead:blocked`), no body-parsing needed.
162
219
 
163
- ## Working as a team
220
+ ## 👥 Working as a team
164
221
 
165
222
  Many people (and their agent sessions) share one map and work it concurrently:
166
223
 
167
- - **Claim = assign to yourself.** The claimer owns the ticket end to end and closes it — there is no approver and no one to wait on. On a claim collision the session stops and asks you, rather than resolving it silently.
224
+ - **Claim = assign to yourself.** The claimer owns the ticket end to end and closes it: there is no approver and no one to wait on. On a claim collision the session stops and asks you, rather than resolving it silently.
168
225
  - **Split** an oversized ticket into children and supersede the original (`/trailhead:split`).
169
226
  - **Pause/resume** via a `PAUSED` checkpoint comment, so any session can pick a ticket back up.
170
- - **State lives on the tickets** (claim, labels, comments — all conflict-free); the map body is a re-readable index, not the source of truth. The durable record of a resolution is the ticket's own comment.
171
- - **Labels are protected from outsiders.** `trailhead:*` labels drive the map, so trailhead trusts a labelled issue only when a write-access collaborator applied the label and (for a ticket) it has a valid `Parent:` — anything else is quarantined as `trailhead:unverified`, off the frontier. GitHub already blocks non-write users from labelling; for defence against triage users and automations, trailhead can **install the label guard GitHub Action for you** (from `templates/trailhead-label-guard.yml`) into your repo's `.github/workflows/` — it strips unauthorized `trailhead:*` labels at the source. (Installing a workflow needs a token with the `workflow` scope; trailhead runs `gh auth refresh -s workflow` if the push is rejected.)
172
- - **Issues opened by others are triaged, not trusted blindly.** `/trailhead:inbox` lists inbound issues (bug reports, requests, questions that aren't yet trailhead tickets) and integrates the worthwhile ones **in place** — reframing them as tickets, keeping the reporter's authorship, and applying the labels on adoption. The rest routes to fog, out-of-scope, duplicate, or needs-info.
227
+ - **Isolate concurrent sessions with worktrees.** Claiming keeps two sessions off the *same* ticket, but two sessions on *different* tickets in the *same* clone still share one working tree. Set `isolation: worktree` in the conventions header and each executing ticket runs in its own `git worktree` on a `trailhead/t<n>` branch, integrated back to the trunk at Resolve. It implies a branch per ticket even under `git: main` (git won't check the trunk out twice), and it is the right posture for a **monorepo** (a worktree shares the object store, far cheaper than a second clone). One caveat: a worktree isolates *source* but is a fresh path with no installed deps, so a **path-bound package** (React Native/Expo, native toolchains, anything tied to a local `node_modules`) won't build from it. For those there's **`isolation: clone`**: a dedicated per-ticket clone that installs its own deps and builds/UATs like the real app (heavier than a worktree, and the right tool for an Expo/RN submodule). Or keep `isolation: none` and serialize. Otherwise run concurrent sessions in separate clones.
228
+ - **A session-ticket marker for your statusline.** When it starts working a ticket, trailhead drops a one-line, gitignored `.trailhead/session-ticket` (`#<n> <title>`) at the working root and clears it at handoff. It's purely a cheap, offline hint so a statusline (or any tool) can show *which ticket this session is on* without hitting the tracker; trailhead itself still treats the Issues as the source of truth.
229
+ - **It nudges you when isolation was never chosen.** If a repo was charted or adopted before you set an `isolation:` mode (so it silently defaults to `none`), the first time you go to work a ticket with a real collision risk (another ticket in progress, or path-bound tooling in its `Scope:`) trailhead surfaces a one-line suggestion of the fitting mode (`worktree` or `clone`) instead of quietly editing the shared checkout. Whatever you decide, including keeping `none`, it writes the `isolation:` key into the conventions so the choice is recorded and it never asks again. A header that already set `isolation:` is left alone.
230
+ - **Scope tickets by path on a monorepo.** A ticket can carry a `Scope:` line naming the package/dir(s) it touches: disjoint scopes parallelize safely, and it scopes build/test and the worktree's commits to the affected package. `/trailhead:adopt` detects a monorepo and proposes both `isolation: worktree` and the `Scope:` convention. Under `isolation: none`, `Scope:` also **serializes** a shared area: at claim time a session holds off if another in-progress ticket's scope overlaps, so two tickets scoped to the same submodule/package can't run at once (how you keep two sessions off one path-bound app).
231
+ - **Git submodules are handled as separate repos.** Work that lands inside a submodule is committed *inside the submodule* plus a gitlink bump in the parent, and (under `worktree`) isolated at the submodule, not the superproject. A ticket spanning two submodules stays atomic via a single parent commit that bumps both gitlinks together; its `Scope:` names both. `/trailhead:adopt` detects `.gitmodules` and writes the rule into the conventions.
232
+ - **State lives on the tickets** (claim, labels, comments; all conflict-free); the map body is a re-readable index, not the source of truth. The durable record of a resolution is the ticket's own comment.
233
+ - **Labels are protected from outsiders.** `trailhead:*` labels drive the map, so trailhead trusts a labelled issue only when a write-access collaborator applied the label and (for a ticket) it carries a valid `Parent:`. Anything else is quarantined as `trailhead:unverified`, off the frontier. GitHub already blocks non-write users from labelling; against triage users and automations, trailhead can **install the label guard GitHub Action for you** (from `templates/trailhead-label-guard.yml`) into your repo's `.github/workflows/`, where it strips unauthorized `trailhead:*` labels at the source. Installing a workflow needs a token with the `workflow` scope, so trailhead runs `gh auth refresh -s workflow` if the push is rejected.
234
+ - **Issues opened by others are triaged, not trusted blindly.** `/trailhead:inbox` lists inbound issues (bug reports, requests, questions that aren't yet trailhead tickets) and integrates the worthwhile ones **in place**: reframing them as tickets, keeping the reporter's authorship, and applying the labels on adoption. The rest routes to fog, out-of-scope, duplicate, or needs-info.
173
235
 
174
- ## Keeping tickets honest
236
+ ## ✅ Keeping tickets honest
175
237
 
176
- A ticket is one answerable Question, sized to one session — so you never grow it in flight. When new scope surfaces while you're working (testing especially sparks ideas), you decide per idea: small and part of the same Question → just do it; balloons the ticket past one session → **split** it; separate work or a follow-up → **capture** it (`idea`/`todo`/`ticket`/`bug`) and keep going. Extras never become silent lines inside the ticket you're on.
238
+ A ticket is one answerable Question, sized to one session, so you never grow it in flight. When new scope surfaces while you're working (testing especially sparks ideas), you decide per idea: small and part of the same Question → just do it; balloons the ticket past one session → **split** it; separate work or a follow-up → **capture** it (`idea`/`todo`/`ticket`/`bug`) and keep going. Extras never become silent lines inside the ticket you're on.
177
239
 
178
240
  Tickets that spin off from other work carry a lineage pointer in their body, so the map stays traceable:
179
241
 
@@ -185,85 +247,84 @@ Tickets that spin off from other work carry a lineage pointer in their body, so
185
247
 
186
248
  ---
187
249
 
188
- ## Configuration
250
+ ## ⚙️ Configuration
189
251
 
190
- Two optional layers — **project overrides global**, key by key (built-in defaults otherwise):
252
+ Three layers: **nearest wins**, key by key (a key unset at one layer inherits the next):
191
253
 
192
- - **Global** — `~/.claude/trailhead/config.json`: your standing defaults across every project.
193
- - **Project** — a `## Config` block in the map issue: overrides for this map, right on the tracker.
254
+ - **Project**: a `.trailhead/config.json` file at the repo root: overrides for this project, committed so a team shares one config. Config lives in a plain file, **never in the map issue**; it's yours to change at any time.
255
+ - **Global**: `~/.claude/trailhead/config.json`: your standing defaults across every project.
256
+ - **Defaults**: the built-in values.
194
257
 
195
- `/trailhead:config` runs a **guided, menu-driven setup** — pick the scope, then walk each setting (🧠 models · 🎨 design · 🧪 TDD · 🌐 acceptance testing) as an icon-labelled menu; no hand-editing JSON. `config get` prints the effective merged config; `config set <key> <value>` writes one key.
258
+ `/trailhead:config` runs a **guided, menu-driven setup**: pick the scope, then walk each setting (🌐 ticket language · 🧠 models · 🎨 design + approval · 🧪 TDD · 🖥️ acceptance testing · 🧑‍⚖️ plan review · 📊 statusline) as an icon-labelled menu; no hand-editing JSON. Every step is asked (none skipped), and **plan and execute models are always two separate, version-pinned choices**. `config get` prints the effective merged config; `config set <key> <value>` writes one key.
259
+
260
+ The **📊 statusline** step offers to install trailhead's Claude Code status bar: one line with **model · project · branch · plan usage (`5h %` · reset · `7d %`) · a context-window bar**, plus a **second line with the active ticket** (`▸ #N Title`) whenever you're working one, and a `⬆ trailhead <version>` flag when a newer trailhead is available (run `/trailhead:update`). It's a global Claude Code setting; if you already run a statusline (e.g. `ccstatusline`) the setup asks before replacing it, and the script also exposes `--ticket-only` / `--context-only` / `--usage-only` segments to slot into an existing tool.
261
+
262
+ **First-use offer (once per project).** You don't have to seek this out: the first time you set a project up (at the end of `/trailhead:new`/`:adopt`, or on a bare `/trailhead` when a map exists but no config does) trailhead offers to run the guided setup, or to continue on defaults. It asks **only once**: configuring writes `.trailhead/config.json`, and "continue on defaults" writes an empty `{}`. Once that file exists it's never offered again, and it never interrupts mid-ticket.
196
263
 
197
264
  | Key | Values (default **bold**) | Effect |
198
265
  |---|---|---|
199
- | `models.{plan,execute,research,review,debug}` | a model id (**inherit session**) | which model runs each activity |
200
- | `design` | **`disk`** \| a claude.ai/design project URL | where UI mockups go |
266
+ | `ticket.language` | an ISO 639-1 code (**`en`**) | the language trailhead **writes** its GitHub prose & commit descriptions in, decoupled from the language it converses in |
267
+ | `models.{plan,execute,research,review,debug}` | a full **versioned** model id (**inherit session**) | which model runs each activity; `plan` and `execute` are always set separately |
268
+ | `design` | **`disk`** \| `claude.ai/design` | where UI mockups go: local throwaway HTML, or a design-system project on claude.ai/design via DesignSync |
269
+ | `design.approval` | **`explicit`** \| `auto` | wait for mockup approval before UI code, or proceed without blocking |
201
270
  | `tdd` | **`seams`** \| `on` \| `off` | how the `build` engine tests |
202
- | `acceptance.browser` | **`auto`** \| `on` \| `off` | drive the browser in Verify, or hand a UAT checklist |
271
+ | `acceptance.browser` | **`auto`** \| `on` \| `off` | drive the browser in Verify, or walk you through a conversational UAT (step by step in chat, not a checklist to self-serve) |
203
272
  | `testing.webapp` / `testing.url` | bool / URL | is it browser-drivable, and where |
204
273
  | `plan_review` | **`off`** \| `on` \| CLI list | send `build` PLANs to external AI CLIs (Gemini, Codex, …) for a second opinion and converge on their concerns |
274
+ | `plan_review.rounds` | integer (**`2`**) | max converge-and-re-review rounds |
205
275
 
206
- **Models** apply to every subagent trailhead spawns (research, codebase-map, review); when `models.plan` differs from `models.execute`, the build's Plan step runs as a planner subagent on the plan model, then execution continues on the execute model. Example `~/.claude/trailhead/config.json`:
276
+ **Models.** Each key runs its activity as a **subagent** on the model you name, so the whole per-activity split applies within a single work session, whatever model that session runs on:
207
277
 
208
- ```json
209
- { "models": { "plan": "opus", "execute": "sonnet" }, "tdd": "seams", "acceptance": { "browser": "auto" } }
210
- ```
278
+ - `plan` and `execute` are the build/bug engine's steps. Execute is a subagent too, and it commits to `main`.
279
+ - `research`, `review`, `debug`, and the codebase-map fan-out each run on their own key.
211
280
 
212
- ---
281
+ Choose `plan` and `execute` separately, each by **full versioned id** (never a bare `opus` or `sonnet`). A key that is unset, or equal to the session model, simply runs inline.
213
282
 
214
- ## Requirements
283
+ The **main session stays the orchestrator**. It holds the interactive moments (a build's Discuss, and Verify's acceptance/UAT) and it does charting, grilling, and ticket-writing on its own model. No key governs ticket quality, so run charting sessions on your strong model.
215
284
 
216
- Just an **authenticated `gh` CLI** — the tracker is GitHub Issues. Nothing else.
285
+ Example config file (the same shape works for the project `.trailhead/config.json` and the global `~/.claude/trailhead/config.json`):
217
286
 
218
- `trailhead` is **self-contained**: every technique it uses (grilling, TDD, systematic debugging, codebase mapping, code review) is built in as an inline protocol, and its subagents (research, codebase-map, review) use Claude Code's built-in `Agent` tool. No companion plugins, no preflight, no version drift.
287
+ ```json
288
+ { "ticket": { "language": "en" }, "models": { "plan": "claude-opus-4-8", "execute": "claude-sonnet-5" }, "tdd": "seams", "acceptance": { "browser": "auto" } }
289
+ ```
219
290
 
220
- ## Hooks
291
+ **Design mockups.** `design: disk` (the default) drops a throwaway static HTML mockup next to the code and links it from the ticket. `design: claude.ai/design` instead pushes the mockup to a **design-system project** on claude.ai/design via **DesignSync** (the `/design-sync` skill plus the `claude_design` MCP), where you refine it visually.
221
292
 
222
- Beyond the skill's instructions, trailhead ships two of its own hooks (in `hooks/`, self-contained via `${CLAUDE_PLUGIN_ROOT}`) that *enforce* the parts of the discipline the model shouldn't be trusted to remember:
293
+ On the first UI screen, trailhead asks which design system to use. You can:
223
294
 
224
- - **Commit guard** (`PreToolUse` on `git commit`) — hard-blocks a commit whose subject isn't [Conventional Commits](https://www.conventionalcommits.org), and hard-blocks any `Co-Authored-By` trailer. This mirrors GSD's commit validation.
225
- - **Issue injection scanner** (`PostToolUse` on `gh` reads) — trailhead reads issue/PR/comment text written by anyone with repo access, i.e. untrusted input. When that text contains prompt-injection phrases, the hook injects an advisory reminding the agent to treat it as data, never as commands. Advisory only — it never blocks.
295
+ - **pick from your 10 most-recent**,
296
+ - **paste a `claude.ai/design/p/<id>` URL**, or
297
+ - **create a new one** (it asks you for the name).
226
298
 
227
- Both are crash-safe (any error → allow) and active whenever the plugin is installed. The commit guard therefore applies in **every** repo, not only trailhead projects — intentional, since conventional commits and no `Co-Authored-By` are trailhead's standing rules. To opt out, disable the plugin's hooks in your Claude Code settings.
299
+ It caches the chosen id in `design.project`. Each screen is pushed there, and its URL is linked from the ticket. Once you approve, trailhead **re-fetches** the current design (in case you edited it live) before writing any UI code.
228
300
 
229
- ---
301
+ DesignSync drives only design-system projects, not regular ones; for a regular project you place the mockup by hand. `design.approval` decides whether the build waits for your explicit go-ahead (`explicit`), or proceeds right after surfacing the mockup (`auto`).
230
302
 
231
- ## Install
303
+ ---
232
304
 
233
- **Prerequisites:** an authenticated [`gh` CLI](https://cli.github.com) (the tracker is GitHub Issues) and a GitHub repo to work in. The npm path also needs Node 18+.
305
+ ## 🪝 Hooks
234
306
 
235
- ### As a Claude Code plugin (native, managed by `/plugin`)
236
- ```
237
- /plugin marketplace add ToRvaLDz/trailhead
238
- /plugin install trailhead@trailhead
239
- ```
240
- Update with `/plugin update trailhead`; remove with `/plugin uninstall trailhead`.
307
+ Beyond the skill's instructions, trailhead ships three of its own hooks (in `hooks/`, self-contained via `${CLAUDE_PLUGIN_ROOT}`) that *enforce* the parts of the discipline the model shouldn't be trusted to remember:
241
308
 
242
- ### Or via npm (installs into your agent's config dir)
243
- ```
244
- npx @marcomigozzi/trailhead # install into ~/.claude (or $CLAUDE_CONFIG_DIR)
245
- npx @marcomigozzi/trailhead --symlink # dev install (symlink to the checkout, edits go live)
246
- npx @marcomigozzi/trailhead --uninstall # remove everything it added
247
- npx @marcomigozzi/trailhead --dir=<path> # target a specific config dir
248
- ```
249
- It copies the skill (+ its `references/`), the `/trailhead:*` commands, the two hooks (into `hooks/`, registered in `settings.json`), and the label-guard template — idempotently. Re-run `npx @marcomigozzi/trailhead` to update. The installer uses a per-agent adapter (Claude Code today) so it can grow to target other AI CLIs later.
309
+ - **Commit guard** (`PreToolUse` on `git commit`): hard-blocks a commit whose subject isn't [Conventional Commits](https://www.conventionalcommits.org), and hard-blocks any `Co-Authored-By` trailer. This mirrors GSD's commit validation.
310
+ - **Secret guard** (`PreToolUse` on `gh` issue/PR writes): trailhead posts a lot to the tracker (ticket bodies, engine comments, codebase/conventions issues, resolutions). This scans what a `gh issue`/`gh pr`/`gh api` write is about to post (the inline `--body`, a heredoc, or a `--body-file`) and **hard-blocks** it if it matches a credential pattern (private keys, GitHub/AWS/OpenAI/Slack/Google/Stripe tokens, JWTs, or a hardcoded `password`/`secret`/`token=…`). The block is a **clean-and-retry cue, not a dead end**: trailhead redacts the flagged value in place (`<REDACTED>` or an env-var reference) and re-posts automatically, so the cleaned content still lands: the secret just never reaches the tracker. It stays a fail-safe *block* rather than a silent auto-rewrite on purpose: a block never leaks, whereas a redaction that quietly failed to apply would. It never scans reads, only outbound writes.
311
+ - **Issue injection scanner** (`PostToolUse` on `gh` reads): trailhead reads issue/PR/comment text written by anyone with repo access, i.e. untrusted input. When that text contains prompt-injection phrases, the hook injects an advisory reminding the agent to treat it as data, never as commands. Advisory only: it never blocks.
250
312
 
251
- ### After installing
252
- Restart or reload your agent so the commands register, then run **`/trailhead`** to start (smart entry) — or `/trailhead:new "<idea>"` to chart a map. Note: once installed, the **commit guard hook runs on every `git commit`** (enforcing Conventional Commits and blocking `Co-Authored-By`); disable the plugin's hooks in settings if you don't want that. Either way trailhead is self-contained — no other skill or plugin is required.
313
+ All three are crash-safe (any error → allow) and active whenever the plugin is installed. The commit and secret guards therefore apply in **every** repo, not only trailhead projects: intentional, since conventional commits, no `Co-Authored-By`, and no leaked secrets are trailhead's standing rules. To opt out, disable the plugin's hooks in your Claude Code settings.
253
314
 
254
315
  ---
255
316
 
256
- ## Acknowledgements
317
+ ## 🙏 Acknowledgements
257
318
 
258
- `trailhead` stands on the shoulders of two bodies of work. It is an original, self-contained methodology **inspired by** them — it does not copy or redistribute their code, and it invokes none of their skills; it reimplements the ideas as its own inline protocols:
319
+ `trailhead` stands on the shoulders of two bodies of work. It is an original, self-contained methodology **inspired by** them. It does not copy or redistribute their code, and it invokes none of their skills; it reimplements the ideas as its own inline protocols:
259
320
 
260
- - **[Matt Pocock](https://www.aihero.dev)** — for **Wayfinder**, whose map / frontier / fog-of-war model is the backbone of trailhead's planning half, and whose `grilling`, `domain-modeling`, `prototype`, `research`, and `tdd` skills shaped trailhead's inline techniques. See [`mattpocock/skills`](https://github.com/mattpocock/skills).
261
- - **The [open-gsd](https://github.com/open-gsd/gsd-core) team** — for **GSD**, whose `discuss → plan → execute → verify` cycle, capture model, codebase mapping, and systematic debugging are the engine of trailhead's building half.
321
+ - **[Matt Pocock](https://www.aihero.dev)**: for **Wayfinder**, whose map / frontier / fog-of-war model is the backbone of trailhead's planning half, and whose `grilling`, `domain-modeling`, `prototype`, `research`, and `tdd` skills shaped trailhead's inline techniques. See [`mattpocock/skills`](https://github.com/mattpocock/skills).
322
+ - **The [open-gsd](https://github.com/open-gsd/gsd-core) team**: for **GSD**, whose `discuss → plan → execute → verify` cycle, capture model, codebase mapping, and systematic debugging are the engine of trailhead's building half.
262
323
 
263
- Thank you. If you like the ideas here, go star and use the originals — they go far deeper than trailhead's compact protocols.
324
+ Thank you. If you like the ideas here, go star and use the originals: they go far deeper than trailhead's compact protocols.
264
325
 
265
326
  ---
266
327
 
267
- ## License
328
+ ## 📄 License
268
329
 
269
330
  MIT © Marco Migozzi ([@ToRvaLDz](https://github.com/ToRvaLDz))
package/bin/trailhead.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- // trailhead installer — places the skill, commands, hooks, and templates into
3
+ // trailhead installer: places the skill, commands, hooks, and templates into
4
4
  // an agent's config dir, and registers the hooks in settings.json.
5
5
  // No dependencies. Idempotent. Usage:
6
6
  // npx @marcomigozzi/trailhead install for Claude Code (~/.claude or $CLAUDE_CONFIG_DIR)
@@ -9,7 +9,7 @@
9
9
  // npx @marcomigozzi/trailhead --dir=/path/to/configdir
10
10
  //
11
11
  // Multi-CLI: only the Claude adapter exists today. Add adapters below (config dir,
12
- // commands/hooks layout) to target Codex, Gemini, etc. — see ADAPTERS.
12
+ // commands/hooks layout) to target Codex, Gemini, etc. See ADAPTERS.
13
13
 
14
14
  const fs = require('fs');
15
15
  const os = require('os');
@@ -42,7 +42,7 @@ const P = {
42
42
  templates: path.join(configDir, 'trailhead', 'templates'),
43
43
  settings: path.join(configDir, 'settings.json'),
44
44
  };
45
- const HOOK_FILES = ['trailhead-commit-guard.js', 'trailhead-issue-injection-scanner.js'];
45
+ const HOOK_FILES = ['trailhead-commit-guard.js', 'trailhead-issue-injection-scanner.js', 'trailhead-secret-guard.js', 'trailhead-check-update.js'];
46
46
  const hookCmd = (name) => `node "${path.join(P.hooksDir, name)}"`;
47
47
 
48
48
  const rmrf = (p) => fs.rmSync(p, { recursive: true, force: true });
@@ -77,7 +77,9 @@ if (uninstall) {
77
77
  HOOK_FILES.forEach((f) => rmrf(path.join(P.hooksDir, f)));
78
78
  const s = readJSON(P.settings);
79
79
  stripHook(s, 'PreToolUse', 'trailhead-commit-guard.js');
80
+ stripHook(s, 'PreToolUse', 'trailhead-secret-guard.js');
80
81
  stripHook(s, 'PostToolUse', 'trailhead-issue-injection-scanner.js');
82
+ stripHook(s, 'SessionStart', 'trailhead-check-update.js');
81
83
  writeJSON(P.settings, s);
82
84
  console.log(`trailhead uninstalled from ${configDir}`);
83
85
  process.exit(0);
@@ -92,10 +94,19 @@ for (const f of HOOK_FILES) {
92
94
  fs.copyFileSync(path.join(SRC, 'hooks', f), path.join(P.hooksDir, f));
93
95
  fs.chmodSync(path.join(P.hooksDir, f), 0o755);
94
96
  }
97
+ // version marker: serve al check-update hook per la versione installata (canale npm)
98
+ const pkgVersion = (readJSON(path.join(SRC, '.claude-plugin', 'plugin.json')).version || '').trim();
99
+ if (pkgVersion) {
100
+ ensure(path.join(configDir, 'trailhead'));
101
+ fs.writeFileSync(path.join(configDir, 'trailhead', 'VERSION'), pkgVersion + '\n');
102
+ }
103
+
95
104
  const s = readJSON(P.settings);
96
105
  const added = [
97
106
  addHook(s, 'PreToolUse', 'Bash', hookCmd('trailhead-commit-guard.js')),
107
+ addHook(s, 'PreToolUse', 'Bash', hookCmd('trailhead-secret-guard.js')),
98
108
  addHook(s, 'PostToolUse', 'Bash', hookCmd('trailhead-issue-injection-scanner.js')),
109
+ addHook(s, 'SessionStart', '', hookCmd('trailhead-check-update.js')),
99
110
  ].some(Boolean);
100
111
  writeJSON(P.settings, s);
101
112
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@marcomigozzi/trailhead",
3
- "version": "0.1.0",
4
- "description": "Start and drive large projects as a map of tickets on GitHub Issues. Wayfinder's map-based onboarding + a discuss→plan→execute→verify engine, all on the Issues. Installs the trailhead skill, commands, and hooks into your agent's config dir.",
3
+ "version": "0.2.0",
4
+ "description": "Start and drive large projects as a map of tickets on GitHub Issues. Map-based onboarding + a discuss→plan→execute→verify engine, all on the Issues. Installs the trailhead skill, commands, and hooks into your agent's config dir.",
5
5
  "bin": {
6
6
  "trailhead": "bin/trailhead.js"
7
7
  },
@@ -20,8 +20,6 @@
20
20
  "keywords": [
21
21
  "trailhead",
22
22
  "claude-code",
23
- "wayfinder",
24
- "gsd",
25
23
  "github-issues",
26
24
  "planning",
27
25
  "agent-skill"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trailhead",
3
- "version": "0.1.0",
4
- "description": "Start and drive large projects as a map of tickets on GitHub Issues, resolving one at a time. Map-based onboarding + a discuss→plan→execute→verify engine with atomic commits, all on the Issues. Self-contained: inspired by Wayfinder and GSD, but depends on nothing beyond an authenticated gh CLI.",
3
+ "version": "0.2.0",
4
+ "description": "Start and drive large projects as a map of tickets on GitHub Issues, resolving one at a time. Map-based onboarding + a discuss→plan→execute→verify engine with atomic commits, all on the Issues. Self-contained: depends on nothing beyond an authenticated gh CLI.",
5
5
  "author": {
6
6
  "name": "Marco Migozzi",
7
7
  "url": "https://github.com/ToRvaLDz"
@@ -10,8 +10,6 @@
10
10
  "repository": "https://github.com/ToRvaLDz/trailhead",
11
11
  "license": "MIT",
12
12
  "keywords": [
13
- "wayfinder",
14
- "gsd",
15
13
  "github-issues",
16
14
  "planning",
17
15
  "orchestrator",
@@ -1,6 +1,6 @@
1
1
  ---
2
- description: Adopt an existing project — map the codebase once, then go lean
2
+ description: Adopt an existing project: map the codebase once, then go lean
3
3
  argument-hint: ""
4
4
  ---
5
5
 
6
- Invoke the `trailhead` skill for the **adopt** action: call the Skill tool with skill name `trailhead` and arguments `adopt $ARGUMENTS`, then carry out the skill's instructions for that verb. Do not re-implement the behaviour here — the skill is the single source of truth.
6
+ Invoke the `trailhead` skill for the **adopt** action: call the Skill tool with skill name `trailhead` and arguments `adopt $ARGUMENTS`, then carry out the skill's instructions for that verb. Do not re-implement the behaviour here. The skill is the single source of truth.
@@ -3,4 +3,4 @@ description: Capture a bug ticket (use --of <ticket> for a regression)
3
3
  argument-hint: "[--of <ticket>] <text>"
4
4
  ---
5
5
 
6
- Invoke the `trailhead` skill for the **bug** action: call the Skill tool with skill name `trailhead` and arguments `bug $ARGUMENTS`, then carry out the skill's instructions for that verb. Do not re-implement the behaviour here — the skill is the single source of truth.
6
+ Invoke the `trailhead` skill for the **bug** action: call the Skill tool with skill name `trailhead` and arguments `bug $ARGUMENTS`, then **read the skill's `references/capture.md` and follow it**: that file holds the full protocol for the capture verbs. Do not re-implement the behaviour here. The skill is the single source of truth.
@@ -3,4 +3,4 @@ description: Guided menu setup, or get/set trailhead config
3
3
  argument-hint: "[get|set …]"
4
4
  ---
5
5
 
6
- Invoke the `trailhead` skill for the **config** action: call the Skill tool with skill name `trailhead` and arguments `config $ARGUMENTS`, then carry out the skill's instructions for that verb. Do not re-implement the behaviour here — the skill is the single source of truth.
6
+ Invoke the `trailhead` skill for the **config** action: call the Skill tool with skill name `trailhead` and arguments `config $ARGUMENTS`, then **read the skill's `references/configuration.md` and follow it**: that file holds the keys, their semantics, and the guided setup. Do not re-implement the behaviour here. The skill is the single source of truth.
@@ -3,4 +3,4 @@ description: Run a standalone grilling session on a decision or topic
3
3
  argument-hint: "[topic|ticket]"
4
4
  ---
5
5
 
6
- Invoke the `trailhead` skill for the **grill** action: call the Skill tool with skill name `trailhead` and arguments `grill $ARGUMENTS`, then carry out the skill's instructions for that verb. Do not re-implement the behaviour here — the skill is the single source of truth.
6
+ Invoke the `trailhead` skill for the **grill** action: call the Skill tool with skill name `trailhead` and arguments `grill $ARGUMENTS`, then **read the skill's `references/techniques/grilling.md` (and `references/techniques/domain-vocabulary.md`) and follow them**: they hold the full protocol for this action. Do not re-implement the behaviour here. The skill is the single source of truth.