hotmilk 0.1.13 → 0.1.15

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 (57) hide show
  1. package/AGENTS.md +12 -10
  2. package/README.md +237 -53
  3. package/agents/README.md +3 -3
  4. package/agents/assistant.md +1 -1
  5. package/agents/coach.md +26 -4
  6. package/agents/designer.md +1 -1
  7. package/agents/planner.md +2 -2
  8. package/hotmilk.json +11 -0
  9. package/package.json +43 -24
  10. package/prompts/prompt-eval.md +241 -0
  11. package/prompts/tidy.md +3 -1
  12. package/prompts/translate.md +3 -1
  13. package/skills/make-docs/SKILL.md +43 -0
  14. package/skills/pioneer/SKILL.md +135 -131
  15. package/skills/pioneer/references/autoresearch-routing.md +114 -0
  16. package/skills/pioneer/references/chat-plan.md +50 -0
  17. package/skills/pioneer/references/goal-gate.md +54 -0
  18. package/skills/pioneer/references/graph-recon-gate.md +50 -0
  19. package/skills/pioneer/references/observational-memory-routing.md +90 -0
  20. package/skills/pioneer/references/openspec-routing.md +50 -0
  21. package/skills/pioneer/references/plannotator-routing.md +83 -0
  22. package/skills/pioneer/references/prompt-eval-gate.md +38 -0
  23. package/skills/pioneer/references/shazam-routing.md +58 -0
  24. package/skills/recommend-research/SKILL.md +94 -6
  25. package/skills/recommend-research/references/example-narrow.md +53 -0
  26. package/skills/recommend-research/references/scope-gate.md +46 -0
  27. package/skills/recommend-research/references/shortlist-gate.md +69 -0
  28. package/skills/recommend-research/references/verify-gate.md +73 -0
  29. package/skills/update-docs/SKILL.md +86 -0
  30. package/skills/update-docs/references/doc-inventory.md +69 -0
  31. package/skills/update-docs/references/drift-verification.md +59 -0
  32. package/src/bootstrap/btw.ts +49 -0
  33. package/src/bootstrap/context-stack.ts +71 -14
  34. package/src/bootstrap/dashboard-settings.ts +16 -2
  35. package/src/bootstrap/dashboard.ts +85 -10
  36. package/src/bootstrap/defaults.ts +26 -0
  37. package/src/bootstrap/extensions.ts +10 -1
  38. package/src/bootstrap/global-extension-sources.ts +43 -4
  39. package/src/bootstrap/graph.ts +12 -0
  40. package/src/bootstrap/project-trust.ts +55 -0
  41. package/src/bootstrap/resolve-bundled.ts +28 -4
  42. package/src/bootstrap/session.ts +61 -1
  43. package/src/bootstrap/subagents-doctor.ts +12 -0
  44. package/src/config/bundled-extensions.ts +42 -0
  45. package/src/config/bundled-package-registry.ts +3 -0
  46. package/src/config/hotmilk.ts +76 -1
  47. package/src/config/mcp.ts +45 -12
  48. package/src/config/resolve.ts +21 -0
  49. package/src/config/runtime.ts +6 -0
  50. package/src/controller/input.ts +15 -0
  51. package/src/controller/mode.ts +32 -0
  52. package/src/index.ts +5 -0
  53. package/src/ui/footer.ts +63 -1
  54. package/src/ui/github-user.ts +52 -4
  55. package/src/ui/session-logo.ts +31 -3
  56. package/themes/monokai.json +1 -1
  57. package/skills/empirical-prompt-tuning/SKILL.md +0 -232
@@ -1,176 +1,180 @@
1
1
  ---
2
2
  name: pioneer
3
- description: End-to-end pion workflow — graphify recon, optional goal, grill-with-docs interview, structured Plan, then execute. Use for architecture planning, /grill, /goal, graphify-out questions, or before multi-step implementation.
3
+ description: End-to-end pioneer hotmilk workflow — graphify recon (phase 0), optional goal, grill-with-docs interview, chat Plan, Plannotator, planning-with-files, OpenSpec/SDD, autoresearch optimize loops, observational-memory for long sessions, shazam execute-time structure guards, then execute. Use for pioneer, architecture planning, bundled extension manifest work, hotmilk.json defaults, bundled-extensions.ts, /grill, /goal, /plannotator, /autoresearch, shazam_impact, graphify-out questions, openspec work, chat plan, compaction continuity, or before multi-step implementation.
4
4
  ---
5
5
 
6
6
  # Pioneer (graph → goal → grill → plan → execute)
7
7
 
8
- Single orchestration skill for **pion** read-only planning and execution. It combines:
8
+ Single orchestration skill for **hotmilk** planning and execution.
9
+
10
+ ## Scenario router (read first)
11
+
12
+ | User signal | Route |
13
+ | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
14
+ | Turn-1 plan request, non-trivial scope | Phase 0 → Phase 3; skip grill unless one blocking term |
15
+ | One-file typo / known single-file fix | Chat Plan; skip Phase 0–2 |
16
+ | Medium scope + human plan approval | Phase 0 → Plannotator (`extensions.plannotator: true`) |
17
+ | Heavy research, long session, `/clear` recovery | planning-with-files (`extensions.planning-with-files: true`) |
18
+ | SDD request, cross-cutting, or medium+ bundled manifest work | Phase 0 → OpenSpec (`gentle-ai` required) — see **Bundled extension scope** |
19
+ | Measure/optimize loop, benchmark regression, tune metric | `/skill:autoresearch-create` (`extensions.autoresearch: true`); **not** a plan path — mutually exclusive with SDD/plan for same task |
20
+ | Long session, frequent compactions, preserve decision rationale | `extensions.observational-memory: true` — background memory; **not** plan authority — see [`observational-memory-routing.md`](references/observational-memory-routing.md) |
21
+ | Shared-module edit, blast radius, post-edit LSP verify | `extensions.shazam: true` — execute-time structure; **not** Phase 0 recon — see [`shazam-routing.md`](references/shazam-routing.md) |
22
+ | Skill or prompt edit just completed | `/prompt-eval <path>` before ship |
9
23
 
10
- | Layer | Source | Role |
11
- | ----------- | ----------------------------------------- | ------------------------------------------------------------------- |
12
- | **Graph** | `/skill:graphify` (bundled `graphify-pi`) | Codebase map before broad search |
13
- | **Goal** | pion `/goal`, `get_goal`, `update_goal` | Multi-turn objective (optional) |
14
- | **Grill** | `/skill:grill-with-docs` | One question, CONTEXT/ADR, recommended answers |
15
- | **Plan** | pion `Plan:` + `[DONE:n]` | Structured steps with verification |
16
- | **Execute** | `/pion-execute` | Writes + doc proposals; `/skill:tdd-guard` + `/skill:tdd` for tests |
24
+ | Layer | Delegate to | Role |
25
+ | ------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------- |
26
+ | **Graph** | `/skill:graphify` | Codebase map before broad search |
27
+ | **Structure** | pi-shazam (bundled, default off) | Impact / verify during execute — not graph replacement |
28
+ | **Goal** | pi-goal (bundled) | Multi-turn objective (optional) |
29
+ | **Grill** | `/skill:grill-with-docs` | One question, CONTEXT/ADR, recommended answers |
30
+ | **Plan** | chat `Plan:` **or** Plannotator **or** planning-with-files **or** OpenSpec SDD | Light chat; approval gate; file memory; substantial spec work |
31
+ | **Execute** | **`/skill:gentle-ai`** + subagents | Implement, verify; SDD phases when active |
17
32
 
18
- Load this skill when the user plans work in pion, asks how modules relate, or runs `/grill` / `/pion-grill` / `/goal` in the same session.
33
+ **References:** Do **not** read `references/` unless a phase below applies. Each reference states its load trigger at the top.
19
34
 
20
- ## Phase map
35
+ ## Runtime
21
36
 
22
- ```text
23
- 0. Graph recon (if graphify-out exists) — read-only
24
- 1. Goal (optional) — /goal when work spans many turns
25
- 2. Grill (when scope/terms unclear) — /pion-grill or /grill <task>
26
- 3. Plan — Context / Assumptions / Tradeoffs / Risks + Plan:
27
- 4. Execute — /pion-execute, [DONE:n], apply Proposed docs
28
- ```
37
+ hotmilk bundles **gentle-ai**, **graphify**, **pi-goal**, **pi-subagents**. Toggle via `/mode` + `/reload`. Verify commands: **`AGENTS.md`** (`bun test`, `bun run check`).
29
38
 
30
- Skip phases that do not apply. Do not grill when the graph + CONTEXT already answer the question.
39
+ | Toggle | Pioneer note |
40
+ | --------------------------------- | -------------------------------------------------------------------------------------------- |
41
+ | `extensions.graphify` | Phase 0; `graphify-out/` when built — off → graph-recon-gate fallback |
42
+ | `extensions.shazam` | Phase 4 impact/verify (`shazam_*`); default off; complements graphify — not recon substitute |
43
+ | `extensions.goal` | Phase 1; `/goal`, `get_goal`, `update_goal` |
44
+ | `extensions.gentle-ai` | OpenSpec path; off → Chat Plan + direct execute only |
45
+ | `extensions.plannotator` | Phase 3 approval gate; `/plannotator`, `--plan`; off → Chat Plan or OpenSpec |
46
+ | `extensions.planning-with-files` | On-disk `task_plan` / `findings` / `progress`; off → skip file-memory path |
47
+ | `extensions.autoresearch` | Optimize loop (`/autoresearch`, `.auto/`); off → one-shot Chat Plan + benchmark in `verify:` |
48
+ | `extensions.context-mode` | Prefer `ctx_*` for large outputs; pairs with observational-memory for long sessions |
49
+ | `extensions.observational-memory` | Compaction continuity (observations/reflections); default off; not plan authority |
50
+ | `extensions.rtk-optimizer` | Bash/read output compaction with context-mode |
51
+ | `extensions.subagents` | Phase 4 delegation; off → inline execute |
31
52
 
32
- ---
53
+ **Skill dependencies** (`/skill:graphify`, `/skill:grill-with-docs`, `/skill:tdd`, `/skill:gentle-ai`) may live in bundled packages or global Pi config.
33
54
 
34
- ## Phase 0 — Graph recon (graphify)
55
+ ### Skill resolution ladder
35
56
 
36
- **Before** wide `grep` / reading many files, check graph artifacts in the project cwd:
57
+ When a `/skill:*` path is missing, resolve in order stop at first hit. Announce which step forced a behavior change.
37
58
 
38
- 1. `graphify-out/wiki/index.md` prefer for navigation when sufficient
39
- 2. `graphify-out/GRAPH_REPORT.md` god nodes, surprising connections, suggested questions
40
- 3. `graphify-out/graph.json` fallback for paths and communities
59
+ | Step | Check | Action |
60
+ | ---- | ------------------- | ------------------------------------------------------------------------- |
61
+ | 1 | Hotmilk first-party | Search `./skills/*/SKILL.md` for the same skill name |
62
+ | 2 | Bundled package | Search `node_modules/*/skills/` and `.pi/skills/` for the same skill name |
63
+ | 3 | Global Pi config | `~/.pi/agent/skills/`, `~/.claude/skills/`, `~/.agents/skills/` |
64
+ | 4 | Project fallback | `AGENTS.md` commands only; say which `/skill:*` was unavailable |
41
65
 
42
- **When to use graph commands** (see `/skill:graphify` for full CLI):
66
+ Path-specific fallbacks when step 4 hits:
43
67
 
44
- | Question type | Command |
45
- | ------------------------ | ------------------------------------------------------- |
46
- | How does X relate to Y? | `graphify query "…" --graph graphify-out/graph.json` |
47
- | Shortest dependency path | `graphify path "A" "B" --graph graphify-out/graph.json` |
48
- | What is node X? | `graphify explain "X" --graph graphify-out/graph.json` |
68
+ - **`/skill:gentle-ai`** + `extensions.gentle-ai: false` → Chat Plan + direct execute only (OpenSpec forbidden)
69
+ - **`/skill:graphify`** [`graph-recon-gate.md`](references/graph-recon-gate.md) **Fallback when graph is missing**
70
+ - **`/skill:grill-with-docs`** skip Phase 2; fix terms in Phase 3 **Assumptions**; one blocking chat question max
49
71
 
50
- Rules:
72
+ ### Toggle-off ladder
51
73
 
52
- - Answer from graph output; do not invent edges or source paths.
53
- - If the graph gives an exact path, use it; otherwise one narrow lookup, then read that file.
54
- - If `graphify-out/needs_update` exists or code changed this session, say the graph may be stale; suggest `graphify update .` before trusting modified areas.
55
- - No `graphify-out/`? Skip this phase or offer a build (`graphify .`) only if the user wants a map.
74
+ When a capability is disabled via `/mode`, fall back — do not invoke missing tools or paths.
56
75
 
57
- Use graph **suggested questions** to seed grill topics (cross-community bridges).
76
+ | Toggle off | Phase impact | Fallback |
77
+ | ---------------------------------------- | ------------------- | -------------------------------------------------------------------------------------------------- |
78
+ | `extensions.graphify: false` | Phase 0 | [`graph-recon-gate.md`](references/graph-recon-gate.md) **Fallback when graph is missing** ladder |
79
+ | `extensions.goal: false` | Phase 1 | Skip `/goal`; objective in Assumptions or proposal — see [`goal-gate.md`](references/goal-gate.md) |
80
+ | `extensions.gentle-ai: false` | OpenSpec path | **Forbidden** — Chat Plan + direct execute only; say SDD requires gentle-ai |
81
+ | `extensions.plannotator: false` | Plannotator path | Chat Plan or OpenSpec per routing; say approval gate skipped |
82
+ | `extensions.planning-with-files: false` | File-memory path | Skip PWF; use Chat Plan, Plannotator, or OpenSpec |
83
+ | `extensions.autoresearch: false` | Optimize loop | Chat Plan + explicit benchmark `verify:`; say autoresearch unavailable |
84
+ | `extensions.observational-memory: false` | Long-session memory | Say OM unavailable; use PWF for `/clear` recovery or context-mode for corpus |
85
+ | `extensions.shazam: false` | Structure guards | Say shazam unavailable; graphify + read/grep + tests in `verify:` |
86
+ | `extensions.subagents: false` | Phase 4 | Inline execute; no `subagent` tool — say delegation skipped |
87
+ | grill-with-docs unavailable | Phase 2 | Skip grill; terms in **Assumptions**; one blocking chat question max |
58
88
 
59
- ---
89
+ ### Composite toggle-off matrix
60
90
 
61
- ## Phase 1Goal (optional)
91
+ When **multiple** toggles are off, apply rows in order first matching row wins. Announce which composite row forced the path.
62
92
 
63
- Use when the task is not a single plan but a **session-long objective** (feature, migration, investigation).
93
+ | Toggles off | Plan path | Phase impact | Fallback |
94
+ | -------------------------------------- | ---------------- | --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
95
+ | `graphify` + `gentle-ai` | Chat Plan only | Phase 0 → graph-recon fallback ladder; OpenSpec forbidden | [`graph-recon-gate.md`](references/graph-recon-gate.md) **Fallback when graph is missing**; direct execute |
96
+ | `gentle-ai` + `subagents` | Chat Plan only | Phase 4 inline only; OpenSpec forbidden | No SDD; no `subagent` tool — say both skipped |
97
+ | `graphify` + `subagents` | Either plan path | Phase 0 fallback; Phase 4 inline | Graph ladder + inline execute; say delegation skipped |
98
+ | `goal` + `graphify` | Either plan path | Skip Phase 1; Phase 0 fallback | Objective in Assumptions; graph-recon fallback ladder |
99
+ | `graphify` + `gentle-ai` + `subagents` | Chat Plan only | Phase 0 fallback; Phase 4 inline | Graph ladder + inline execute; OpenSpec forbidden |
64
100
 
65
- | Action | Command / tool |
66
- | ----------------------- | ---------------------------------------------------------------------------------------- |
67
- | Set objective | `/goal <text>` or `update_goal` |
68
- | Check progress | `get_goal` |
69
- | Pause during plan/grill | automatic — pion suppresses `agent_end` auto-continue while plan/grill/execute is active |
70
- | Resume after plan work | `/goal resume` |
101
+ Say which toggle or missing skill forced the fallback when it changes the chosen path.
71
102
 
72
- Align the goal text with what the grill and `Plan:` will deliver. After `/pion-execute`, mark goal progress in `update_goal` when milestones complete.
103
+ ## Plan routing (one authority per task)
73
104
 
74
- ---
105
+ Choose **one** plan target per task:
75
106
 
76
- ## Phase 2 Grill (grill-with-docs)
107
+ | Path | When | Artifact | Reference |
108
+ | ----------------------- | ---------------------------------------------------------------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------- |
109
+ | **Chat Plan** | Small, bounded, known context, single area, quick fix | `Plan:` in chat | [`references/chat-plan.md`](references/chat-plan.md) |
110
+ | **Plannotator** | Medium scope, human browser approval, bounded checklist execution | `plans/*.md` + approval | [`references/plannotator-routing.md`](references/plannotator-routing.md) |
111
+ | **planning-with-files** | Heavy research, parallel tracks, session recovery after `/clear` | `task_plan.md`, `findings.md`, `progress.md` | `/skill:planning-with-files` (bundled when toggled on) |
112
+ | **OpenSpec SDD** | Large, ambiguous, architectural, cross-cutting, high review risk, or user asks SDD | `openspec/changes/<change>/` | [`references/openspec-routing.md`](references/openspec-routing.md) + **`/skill:gentle-ai`** |
77
113
 
78
- Enter when terminology, scope, or trade-offs are unclear even after graph recon.
114
+ Say which path you chose and why. Do not mix plan authorities unless the user explicitly layers them (e.g. SDD tasks → Plannotator gate).
79
115
 
80
- **Start:** `/pion-grill`, `/grill <task>`, or `/pion` + load `/skill:grill-with-docs`.
116
+ **Memory layers (not plan paths):** compaction rationale and session continuity → **`observational-memory`** when toggle on — see [`references/observational-memory-routing.md`](references/observational-memory-routing.md). Corpus / large output → **context-mode**. Execute-time structure (impact, LSP verify) → **`shazam`** when toggle on — see [`references/shazam-routing.md`](references/shazam-routing.md). Do not treat OM or shazam as spec or plan authority.
81
117
 
82
- **Strict rules** (details in grill-with-docs skill):
118
+ **Optimize loop (not a plan path):** when success = measurable metric with keep/discard iterations → **`/skill:autoresearch-create`** — see [`references/autoresearch-routing.md`](references/autoresearch-routing.md). Do not start Chat Plan, Plannotator, or OpenSpec for the same task unless the user pivots to feature delivery.
83
119
 
84
- - **One question per turn** + **recommended answer**; wait for the user.
85
- - Recon: `CONTEXT-MAP.md` when present, then the relevant `CONTEXT.md`; ADRs under `docs/adr/` and `extensions/pion/docs/adr/` (formats in `skills/grill-with-docs/references/`).
86
- - Cross-check user claims against code; sharpen vague terms against the glossary.
87
- - Read-only: emit `## Proposed CONTEXT.md` / `## Proposed ADR` in chat — no `edit`/`write`.
88
- - Do **not** output `Plan:` until grilling is done or the user asks (e.g. "プラン出して").
120
+ **Tie-breaker (gray zone):** scope is medium or ~2 files but not clearly trivial → **OpenSpec** when **any** of: cross-cutting, review budget >400 changed lines, 2+ areas/modules, architectural/product ambiguity, or **medium+ bundled manifest work** (new bundled row + dep + README + tests, or default toggle changes across `bundled-extensions.ts` and `hotmilk.json` — not a one-line typo). **Plannotator** when human approval is the primary goal and spec artifacts are not required. **planning-with-files** when research volume or `/clear` recovery dominates. Otherwise **Chat Plan**. If `extensions.gentle-ai: false`, OpenSpec is forbidden — Chat Plan or Plannotator only.
89
121
 
90
- **Graph + grill:** Use GRAPH_REPORT god nodes / surprising connections as grill fuel ("this edge implies X is that still true?").
122
+ **MANDATORY - READ ENTIRE FILE** the reference for your chosen path before emitting `Plan:`, starting `/plannotator`, or starting SDD work.
91
123
 
92
- ---
124
+ ### Bundled extension scope
93
125
 
94
- ## Phase 3 Plan
126
+ When the task adds, removes, or reconfigures a bundled extension, resolve in Assumptions (chat) or proposal (SDD):
95
127
 
96
- Emit only when grill is sufficient or the user requests a plan.
128
+ | Topic | Pin |
129
+ | ------------------------ | -------------------------------------------------------------------------------------------------- |
130
+ | Extension id | kebab-case row in `src/config/bundled-extensions.ts` — **not** `package.json` → `pi.extensions` |
131
+ | Edit scope | Manifest row + `hotmilk.json` default + `package.json` dep + README; lazy load via `extensions.ts` |
132
+ | Auth / integration scope | OAuth, MCP, external API: state secrets, env, approval — default **no** new auth unless required |
133
+ | Missing package | Dependency install/version as explicit step; no speculative toggle defaults |
97
134
 
98
- ### Required shape
99
-
100
- ```markdown
101
- ## Context
102
-
103
- ## Assumptions
104
-
105
- ## Tradeoffs
135
+ ## Phase map
106
136
 
107
- ## Risks
137
+ Skip phases that do not apply. Do not grill when graph + CONTEXT already answer the question.
108
138
 
109
- Plan:
139
+ **Plan on turn 1:** First message asks for a plan and scope is not trivial → Phase 3 after Phase 0; skip grill unless one blocking term remains.
110
140
 
111
- 1. … — verify: …
112
- 2.
141
+ ```text
142
+ 0. Graph recon → **MANDATORY - READ ENTIRE FILE** graph-recon-gate.md
143
+ 1. Goal (optional) → **MANDATORY - READ ENTIRE FILE** goal-gate.md (when Phase 1 applies)
144
+ 2. Grill (if unclear) → /skill:grill-with-docs; one question/turn
145
+ skip when graph+CONTEXT suffice or grill-with-docs unavailable
146
+ 3. Plan → **MANDATORY - READ ENTIRE FILE** chat-plan.md OR plannotator-routing.md OR planning-with-files skill OR openspec-routing.md (+ gentle-ai for SDD)
147
+ 4. Execute → gentle-ai Work Routing Ladder (chat-plan Execute or SDD /sdd-continue)
148
+ When shazam on → shared-module edits: shazam_impact → edit → shazam_verify (+ tests)
149
+ Alt: Optimize loop → **MANDATORY - READ ENTIRE FILE** autoresearch-routing.md + `/skill:autoresearch-create` (replaces Phase 3–4 for metric loops)
150
+ 5. Prompt hardening → **MANDATORY - READ ENTIRE FILE** prompt-eval-gate.md (edits-only: before ship; mixed: after Phase 4)
113
151
  ```
114
152
 
115
- ### Step ordering
116
-
117
- 1. Apply any `## Proposed CONTEXT.md` / `## Proposed ADR` from grill (or reference them as first steps).
118
- 2. Recon / design steps informed by graph paths and communities.
119
- 3. Implementation steps with concrete `verify:` checks (test, command, file exists, behavior).
120
-
121
- ### Persist plan file (chezmoi / multi-context repos)
122
-
123
- When the chezmoi repo (or any project with `CONTEXT-MAP.md`) is the cwd:
124
-
125
- - At **plan finalization**, write **`docs/plans/<slug>.md`** with the same `## Context` … `Plan:` content (kebab-case slug).
126
- - Chat `Plan:` remains the pion step tracker (`[DONE:n]` after `/pion-execute`).
127
- - Only `docs/plans/*.md` may be written while plan mode is ON; CONTEXT / ADR / code wait for `/pion-execute`.
128
-
129
- While pion is ON: **no** `edit`; **no** `write` except `docs/plans/<slug>.md` at finalize. Refine with `/pion-refine`.
130
-
131
- ---
132
-
133
- ## Phase 4 — Execute
134
-
135
- **Start:** `/pion-execute` (restores write tools; may enable `get_goal` / `update_goal` in tool set).
136
-
137
- - Work steps in order; tag completed steps with `[DONE:n]` in the response.
138
- - Sync CONTEXT/ADR and **doc patches** from grill (bootstrap or drift fixes) before code when proposed.
139
- - For test work: load **`/skill:tdd`** then **`/skill:tdd-guard`** (plan testlist if missing, then one cycle at a time).
140
- - After large code changes, mention `graphify update .` if the project uses graphify.
141
- - Interrupt: `/pion-interrupt` (steer). Stop: `/pion-stop` (abort, exit execute mode).
142
- - Unfinished steps: `/pion-todos`.
143
-
144
153
  ---
145
154
 
146
- ## Commands (quick reference)
147
-
148
- | Command | Phase |
149
- | -------------------------------------- | ------------------------------------------------ |
150
- | `/pion` | Toggle plan mode (read-only) |
151
- | `/pion-grill`, `/grill <task>` | Grill only |
152
- | `/pion-refine` | Adjust plan (read-only) |
153
- | `/pion-execute` | Execute |
154
- | `/pion-stop`, `/pion-interrupt` | Control during execute |
155
- | `/pion-todos` | Remaining plan steps |
156
- | `/goal`, `/goal pause`, `/goal resume` | Goal |
157
- | `/graphify …` | Delegates to graphify skill (build/query/update) |
158
-
159
155
  ## Anti-patterns
160
156
 
161
- | Do not | Do instead |
162
- | ----------------------------------------------------------- | ---------------------------------------------------------- |
163
- | `Plan:` before glossary/scope stable | Keep grilling |
164
- | Multiple grill questions in one message | One question + recommended answer |
165
- | Broad grep ignoring `graphify-out/` | Graph recon first |
166
- | Invent graph edges or paths | `graphify query` / say "graph lacks …" |
167
- | Implementation detail in proposed CONTEXT | Glossary and decisions only |
168
- | `edit` or `write` outside `docs/plans/` while plan/grill ON | `/pion-execute` (plan file at finalize is OK in plan mode) |
169
- | Ignore active `/goal` | Read `get_goal`; update when done |
170
-
171
- ## Related skills
172
-
173
- - **`/skill:grill-with-docs`** grill + doc bootstrap/sync (replaces make-docs / update-docs)
174
- - **`/skill:tdd`** canonical TDD philosophy (load first)
175
- - **`/skill:tdd-guard`** test planning + cycle guardrails (replaces tdd-cycle / testcase)
176
- - **`/skill:graphify`** build, update, query, MCP, watch, merge graphs
157
+ | Do not | Why | Do instead |
158
+ | ------------------------------------------------------ | ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
159
+ | Read `references/` without a matching path | Wastes tokens; loads wrong workflow | Load only when Phase 0, Phase 1, Chat Plan, Plannotator, OpenSpec, autoresearch, observational-memory, shazam, or Phase 5 prompt-eval applies |
160
+ | Ship skill/prompt edits without prompt-eval | Author blind spot; stale triggers survive | Phase 5 prompt-eval-gate → `/prompt-eval <path>` |
161
+ | Downgrade active SDD to Chat Plan mid-flow | Artifact drift; verify/sync never run | Stop; tell user gentle-ai required; resume SDD after toggle on — see openspec-routing **Mid-flow recovery** |
162
+ | OpenSpec when `gentle-ai` is off | SDD commands unavailable; path breaks mid-flow | Chat Plan only; say toggle must enable gentle-ai for SDD |
163
+ | Ignore toggle-off ladder | Calls missing tools; false confidence in SDD/subagents | Use toggle-off table; announce fallback |
164
+ | `Plan:` before scope stable (user did not ask) | Premature plan hides glossary gaps | Keep grilling; user asks Plan with open items in Assumptions |
165
+ | OpenSpec for a one-file typo | SDD overhead wastes review budget | Chat Plan + direct implement |
166
+ | Chat Plan for cross-cutting architecture | Chat plan lacks artifact gates | OpenSpec SDD + `/sdd-continue` |
167
+ | Plannotator + OpenSpec as dual plan authorities | Two sources of truth | SDD for spec; Plannotator gates tasks or execution only |
168
+ | Plannotator + planning-with-files same plan file | Schema and hook conflict | Separate paths: `plans/` vs `.planning/` |
169
+ | Chat Plan mid-task then Plannotator for same scope | Context split | Pick one path at Phase 3 |
170
+ | Autoresearch + SDD or Plannotator same task | Conflicting authorities (loop vs gates) | Pick autoresearch **or** plan path; `/autoresearch off` before switching |
171
+ | OpenSpec or Plannotator mid-active autoresearch loop | Metric loop never converges to shippable contract | Stop loop; finalize or clear `.auto/`; then start plan path |
172
+ | Multiple grill questions in one message | User cannot answer precisely; violates grill-with-docs | One question + recommended answer |
173
+ | Grill without grill-with-docs loaded | Skill rules violated; multi-question drift | Skip Phase 2 or load skill; terms in Assumptions |
174
+ | Broad grep ignoring `graphify-out/` | Misses graph-cached structure | Graph recon first (graph-recon-gate) |
175
+ | `shazam_overview` instead of graphify for architecture | No persistent graph; wrong layer | Phase 0 graphify; shazam only in Phase 4 execute |
176
+ | Treat OM reflections as SDD spec | Hidden plan authority | OpenSpec artifacts remain source of truth |
177
+ | Invent graph edges or paths | False architecture confidence | `graphify query` / say "graph lacks …" |
178
+ | Implementation detail in proposed CONTEXT | CONTEXT is glossary/decisions, not design doc | Glossary and decisions only |
179
+ | Skip SDD verify/sync | Artifacts drift from shipped code | OpenSpec path → **`/skill:gentle-ai`** through archive |
180
+ | Ignore active `/goal` | Session objective diverges from work | Read `get_goal`; update when done |
@@ -0,0 +1,114 @@
1
+ # Autoresearch (optimize loop)
2
+
3
+ **Load when:** the task is a **measure → edit → benchmark → keep/discard** loop, not a one-shot feature or spec-driven build.
4
+
5
+ **Do NOT load when:** Chat Plan, Plannotator, planning-with-files, or OpenSpec SDD is the chosen plan authority — use the matching reference instead.
6
+
7
+ **Canonical matrix:** [README § Workflow routing](../../../README.md#workflow-routing).
8
+
9
+ ## When to use
10
+
11
+ | Signal | Route here |
12
+ | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
13
+ | User asks to optimize, benchmark, tune, or run experiments in a loop | `/skill:autoresearch-create` |
14
+ | Success = measurable metric (test time, bundle size, loss, Lighthouse, build time) | Autoresearch |
15
+ | User invokes `/autoresearch`, mentions `.auto/`, or wants keep/discard iterations | Autoresearch |
16
+ | Feature delivery, spec, architecture, cross-cutting change | OpenSpec / gentle-ai — **not** autoresearch |
17
+ | Human plan approval before any writes | Plannotator — **not** autoresearch as plan authority |
18
+ | Strict RED→GREEN test-first for a known fix | `/skill:tdd` or `/tdd` — **not** autoresearch unless optimizing the test suite itself |
19
+
20
+ **Tie-breaker vs plan paths:** optimization target with a metric → autoresearch; delivery with acceptance criteria and review gates → plan path (Chat / Plannotator / PWF / SDD).
21
+
22
+ ## 向く / 向かない (suited vs not suited)
23
+
24
+ Inspired by [Armin Ronacher — _The Coming Loop_](https://lucumr.pocoo.org/2026/6/23/the-coming-loop/) (2026-06-23): agent loops excel when the harness can **measure** progress; they degrade long-lived code when judgment is outsourced to the loop alone.
25
+
26
+ | 向く (use autoresearch) | Why | 向かない (use another path) | Why |
27
+ | ---------------------------------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------ |
28
+ | Metric optimization (build time, bundle size, benchmark score, test runtime) | Machine-verifiable keep/discard signal | Feature delivery with acceptance criteria | Needs spec, review gates, human product judgment → **SDD / Plannotator** |
29
+ | Mechanical transforms (port, migration, bulk rename) with binary pass/fail | Clear invariant; loop replaces tedious repetition | Cross-cutting architecture or manifest work | Many files + contract risk → **OpenSpec SDD** |
30
+ | Experiment exploration (hyperparams, perf knobs, algorithm variants) | Short-lived tries; best branch wins | Long-lived production module, hands-off for days | Defensive layers stack; comprehension drops → **SDD + phased apply** |
31
+ | Security scan / dependency triage loops | Verifiable findings; bounded artifact | “Make it work” without a measure command | No metric → **Chat Plan** with explicit `verify:` or **TDD** |
32
+ | Research / PoC where discard is cheap | `.auto/` and branches are disposable | Production bugfix with one known root cause | Single shot + tests → **TDD** or inline fix |
33
+ | Optimizing the test suite or CI itself | Metric = test time, flake rate, coverage gate | Same task also needs proposal/spec/design | Dual authority → pick **SDD** _or_ autoresearch, not both |
34
+
35
+ **Harness takeaway:** autoresearch is the **outer optimize loop** (queue → measure → keep/revert). Pair with graphify recon before starting; return human judgment via **finalize** + PR review — do not treat the loop as “done” without a human or phase gate on merge.
36
+
37
+ ## Prerequisites
38
+
39
+ | Requirement | Check |
40
+ | ----------- | --------------------------------------------------------------------------------------------------------------------- |
41
+ | Toggle | `extensions.autoresearch: true` — if off, say loop unavailable; do not fake the workflow |
42
+ | Extension | `pi-autoresearch` loaded via `/reload` after `/mode` |
43
+ | Skills | `autoresearch-create` (start), `autoresearch-finalize` (clean branches), `autoresearch-hooks` (optional side effects) |
44
+ | Workspace | Writes under `.auto/` (`prompt.md`, `log.jsonl`, session state) — add `.auto/` to `.gitignore` if missing |
45
+
46
+ ## Workflow
47
+
48
+ ```text
49
+ 1. Confirm metric, direction (lower/higher), and measure command
50
+ 2. /skill:autoresearch-create → init_experiment + session files
51
+ 3. Loop: propose change → run_experiment → log_experiment (keep or revert)
52
+ 4. /autoresearch export for live dashboard (optional)
53
+ 5. When done: /skill:autoresearch-finalize for reviewable branches
54
+ ```
55
+
56
+ ## Coexistence matrix
57
+
58
+ | Layer | Autoresearch | Notes |
59
+ | --------------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
60
+ | **gentle-ai SDD** | **Mutually exclusive** for the same task | SDD = phased spec/apply/verify; autoresearch = unbounded optimize loop. Pick one authority. |
61
+ | **gentle-ai inline/worker** | OK after loop | Use subagents for isolated tries; do not run SDD phases mid-loop |
62
+ | **Plannotator** | **Do not combine** as dual authority | Approve a plan, then autoresearch only if metric loop is a separate follow-up task |
63
+ | **planning-with-files** | Rare overlap | PWF for research notes; autoresearch for benchmark loop — separate dirs (`.planning/` vs `.auto/`) |
64
+ | **red-green / TDD** | Different jobs | TDD = correctness-first test cycle; autoresearch = metric optimization. Use TDD inside a loop only when the metric is test-driven |
65
+ | **pi-goal** | OK | Goal = north star; autoresearch = tactical iterations toward metric |
66
+ | **graphify** | OK before loop | Phase 0 recon still applies when codebase map reduces bad experiments |
67
+
68
+ ## Execute (vs Phase 4)
69
+
70
+ Autoresearch **replaces** pioneer Phase 3–4 when the task is optimize-only:
71
+
72
+ ```text
73
+ Phase 0 graph (optional) → autoresearch-create → loop until metric plateaus or user stops
74
+ ```
75
+
76
+ Do **not** emit `Plan:` or start SDD for the same scope unless the user pivots to feature delivery.
77
+
78
+ ## gentle-ai guardrails
79
+
80
+ When `extensions.gentle-ai: true` and autoresearch is active:
81
+
82
+ - Do not start `/sdd-continue` or OpenSpec apply for the same change name.
83
+ - Prefer **inline or worker** execution inside the loop; avoid review-budget gates every iteration.
84
+ - Turn autoresearch **off** (`/autoresearch off`) before switching to SDD or Plannotator on the same task.
85
+
86
+ ## Shortcuts and UI
87
+
88
+ Default shortcut: `Ctrl+Shift+F` (fullscreen dashboard). Override in `~/.pi/agent/extensions/pi-autoresearch.json`:
89
+
90
+ ```json
91
+ {
92
+ "shortcuts": {
93
+ "fullscreenDashboard": "ctrl+shift+y"
94
+ }
95
+ }
96
+ ```
97
+
98
+ Use `null` to disable a shortcut. Off by default in hotmilk — widget + shortcuts add session weight.
99
+
100
+ ## Fallback when autoresearch is off
101
+
102
+ - Say **"Autoresearch skipped: extension off"**
103
+ - One-shot optimize → Chat Plan with explicit `verify:` benchmark commands
104
+ - Feature + metric → OpenSpec or Plannotator first; enable autoresearch only for a follow-up optimization slice
105
+
106
+ ## Anti-patterns
107
+
108
+ | Do not | Do instead |
109
+ | --------------------------------------------- | ---------------------------------------------------- |
110
+ | SDD proposal + autoresearch loop same task | Pick SDD **or** autoresearch |
111
+ | Plannotator plan + `/autoresearch` same scope | Finish approval path; start autoresearch as new task |
112
+ | Autoresearch without a defined metric | `init_experiment` with measure command first |
113
+ | Leave autoresearch on during manual SDD apply | `/autoresearch off` before phase work |
114
+ | Ignore `.auto/log.jsonl` growth | `/autoresearch clear` or finalize when pivoting |
@@ -0,0 +1,50 @@
1
+ # Chat Plan (Phase 3a)
2
+
3
+ **Load when:** Plan routing chose **Chat Plan** (light path).
4
+
5
+ **Do NOT load when:** OpenSpec SDD path is chosen — use [`openspec-routing.md`](openspec-routing.md) instead.
6
+
7
+ ## Template
8
+
9
+ ```markdown
10
+ ## Context
11
+
12
+ ## Assumptions
13
+
14
+ ## Tradeoffs
15
+
16
+ ## Risks
17
+
18
+ Plan:
19
+
20
+ 1. … — verify: …
21
+ 2. …
22
+ ```
23
+
24
+ ## Persist
25
+
26
+ Chat only — do not create `docs/plans/` unless the repo already uses that convention.
27
+
28
+ ## Step ordering
29
+
30
+ 1. Apply grill doc proposals (CONTEXT/ADR patches) when proposed.
31
+ 2. Recon/design from graph output when available.
32
+ 3. Implementation steps with concrete `verify:` checks per **`AGENTS.md`** commands.
33
+
34
+ ## Execute (Phase 4 chat path)
35
+
36
+ Work plan steps in order. Each step ends with its `verify:` check before the next step starts.
37
+
38
+ **Delegation:** load **`/skill:gentle-ai`** and follow its Work Routing Ladder. When `extensions.subagents: false`, execute inline and say delegation was skipped.
39
+
40
+ **When gentle-ai is unavailable** (toggle off or skill resolution step 3): pioneer inline execute — no SDD, no subagents.
41
+
42
+ ```text
43
+ 1. Implement step N inline (single writer thread).
44
+ 2. Run verify from AGENTS.md (e.g. bun test) — record pass/fail.
45
+ 3. Say: "gentle-ai unavailable — inline execute; SDD and delegation skipped."
46
+ ```
47
+
48
+ **Verify:** use repo commands from **`AGENTS.md`** (`bun test`, `bun run check`, lint/format when defined). Record pass/fail per step.
49
+
50
+ **Control:** `/stop` halts the current turn cleanly; `/interrupt` cancels mid-stream. Say which control was used if execution pauses before plan completion.
@@ -0,0 +1,54 @@
1
+ # Goal gate
2
+
3
+ **Load when:** Phase 1 runs — before grill or plan when session objective may span turns.
4
+
5
+ ## Enter (mandatory)
6
+
7
+ Run Phase 1 when **any** of:
8
+
9
+ - Work spans multiple turns or sessions (migration, refactor, feature arc)
10
+ - Objective is ambiguous and drift would waste grill/plan cycles
11
+ - User sets `/goal` or asks for persistent pursuit
12
+ - Grill/plan would benefit from a single north-star sentence
13
+
14
+ ## Skip
15
+
16
+ Skip Phase 1 when **all** of:
17
+
18
+ - One-shot, bounded task (typo, single-file fix, known location)
19
+ - User asked for a plan on turn 1 with trivial scope
20
+ - Active goal already exists — read `get_goal` and align instead of creating a new one
21
+
22
+ Say **"Goal skipped: …"** with reason when skipping.
23
+
24
+ ## Active goal check
25
+
26
+ Before Phase 2 or 3:
27
+
28
+ 1. If `extensions.goal: true` and goal tools are available → call `get_goal`
29
+ 2. Active goal → align grill topics and plan steps to it; do not replace unless user asks
30
+ 3. Work complete → `update_goal({ status: "complete" })` only with verify evidence per pi-goal
31
+
32
+ ## Commands
33
+
34
+ Full CLI: bundled **pi-goal** docs.
35
+
36
+ | Action | Command |
37
+ | -------------- | ------------------------------------------------------- |
38
+ | Set / replace | `/goal <objective>` or `/goal --tokens 50k <objective>` |
39
+ | Read state | `/goal status` or `get_goal` tool |
40
+ | Pause / resume | `/goal pause`, `/goal resume` |
41
+ | Clear | `/goal clear` |
42
+
43
+ ## Fallback when goal is off
44
+
45
+ `extensions.goal: false` or goal tools unavailable?
46
+
47
+ - Say **"Goal skipped: goal extension off"**
48
+ - Capture objective in chat **Assumptions** (Chat Plan) or proposal **executive_summary** (OpenSpec)
49
+ - Do not invoke `/goal`, `get_goal`, or `update_goal`
50
+
51
+ ## Goal + grill + plan
52
+
53
+ - Goal sets the north star; grill resolves terms/trade-offs; plan lists steps that advance the goal
54
+ - Do not grill unrelated scope when an active goal exists — flag conflict to the user first
@@ -0,0 +1,50 @@
1
+ # Graph recon gate
2
+
3
+ **Load when:** Phase 0 runs — before wide `grep` or reading many files.
4
+
5
+ ## Artifact order
6
+
7
+ 1. `graphify-out/wiki/index.md` — prefer for navigation when sufficient
8
+ 2. `graphify-out/GRAPH_REPORT.md` — god nodes, surprising connections, suggested questions
9
+ 3. `graphify-out/graph.json` — fallback for paths and communities
10
+
11
+ ## Graph commands
12
+
13
+ Full CLI: `/skill:graphify`.
14
+
15
+ | Question type | Command |
16
+ | ------------------------ | ------------------------------------------------------- |
17
+ | How does X relate to Y? | `graphify query "…" --graph graphify-out/graph.json` |
18
+ | Shortest dependency path | `graphify path "A" "B" --graph graphify-out/graph.json` |
19
+ | What is node X? | `graphify explain "X" --graph graphify-out/graph.json` |
20
+
21
+ ## Rules
22
+
23
+ - Answer from graph output; do not invent edges or source paths.
24
+ - If the graph gives an exact path, use it; otherwise one narrow lookup, then read that file.
25
+ - If `graphify-out/needs_update` exists or code changed this session, say the graph may be stale; suggest `graphify update .` before trusting modified areas.
26
+
27
+ ## When graph update fails
28
+
29
+ `graphify update .` failed, graphify unavailable, or toggle `extensions.graphify: false` after stale detection?
30
+
31
+ 1. Say **"Graph stale — update failed: …"** with command + short error summary
32
+ 2. Fall through to **Fallback when graph is missing** ladder — do not retry update in a loop
33
+ 3. Prefer narrow reads of files changed this session over stale graph edges
34
+ 4. Offer `graphify .` or enable graphify only if the user wants a fresh map
35
+
36
+ Leave the stale warning visible in chat before Phase 2+ work.
37
+
38
+ ## Fallback when graph is missing
39
+
40
+ No `graphify-out/` or artifacts unreadable? Say **"Graph recon skipped: …"** with reason, then use this ladder **before** repo-wide grep:
41
+
42
+ 1. `AGENTS.md` / `README.md` for the topic
43
+ 2. One narrow path lookup (glob or single grep) to find the canonical file
44
+ 3. Read that file only — no broad grep until steps 1–2 fail
45
+
46
+ Offer `graphify .` only if the user wants a map built first.
47
+
48
+ ## Graph + grill
49
+
50
+ Use GRAPH_REPORT god nodes / surprising connections as grill fuel ("this edge implies X — is that still true?").