@lovrozagar/grunt 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/.agents/agents/grunt.md +2 -23
  2. package/.agents/agents/orchestrator.md +5 -45
  3. package/.agents/skills/ask/SKILL.md +11 -0
  4. package/.agents/skills/auto/SKILL.md +13 -0
  5. package/.agents/skills/browser/SKILL.md +4 -7
  6. package/.agents/skills/clasp/SKILL.md +11 -0
  7. package/.agents/skills/commit/SKILL.md +3 -1
  8. package/.agents/skills/commit-push/SKILL.md +2 -0
  9. package/.agents/skills/commit-push-deploy/SKILL.md +2 -0
  10. package/.agents/skills/commit-push-release/SKILL.md +2 -0
  11. package/.agents/skills/explain/SKILL.md +7 -13
  12. package/.agents/skills/google-workspace/SKILL.md +13 -0
  13. package/.agents/skills/handoff/SKILL.md +7 -11
  14. package/.agents/skills/implement-plan/SKILL.md +5 -108
  15. package/.agents/skills/listen/SKILL.md +15 -0
  16. package/.agents/skills/pickup/SKILL.md +6 -12
  17. package/.agents/skills/speak/SKILL.md +13 -0
  18. package/.agents/skills/tmp/SKILL.md +54 -0
  19. package/.agents/skills/write-plan/SKILL.md +5 -74
  20. package/.claude/agents/grunt.md +2 -25
  21. package/.claude/agents/orchestrator.md +12 -45
  22. package/.claude/skills/ask/SKILL.md +11 -0
  23. package/.claude/skills/auto/SKILL.md +13 -0
  24. package/.claude/skills/browser/SKILL.md +4 -7
  25. package/.claude/skills/clasp/SKILL.md +11 -0
  26. package/.claude/skills/commit/SKILL.md +3 -1
  27. package/.claude/skills/commit-push/SKILL.md +2 -0
  28. package/.claude/skills/commit-push-deploy/SKILL.md +2 -0
  29. package/.claude/skills/commit-push-release/SKILL.md +2 -0
  30. package/.claude/skills/explain/SKILL.md +7 -13
  31. package/.claude/skills/google-workspace/SKILL.md +13 -0
  32. package/.claude/skills/handoff/SKILL.md +7 -11
  33. package/.claude/skills/implement-plan/SKILL.md +5 -108
  34. package/.claude/skills/listen/SKILL.md +15 -0
  35. package/.claude/skills/pickup/SKILL.md +6 -12
  36. package/.claude/skills/speak/SKILL.md +13 -0
  37. package/.claude/skills/tmp/SKILL.md +54 -0
  38. package/.claude/skills/write-plan/SKILL.md +5 -74
  39. package/.codex/agents/grunt.toml +2 -25
  40. package/.codex/agents/orchestrator.toml +4 -45
  41. package/.grok/agents/grunt.md +2 -23
  42. package/.grok/agents/orchestrator.md +4 -43
  43. package/.grok/global-settings.toml +1 -3
  44. package/.grok/hooks/orchestrate-parent.js +278 -228
  45. package/.grok/skills/ask/SKILL.md +11 -0
  46. package/.grok/skills/auto/SKILL.md +13 -0
  47. package/.grok/skills/browser/SKILL.md +4 -7
  48. package/.grok/skills/clasp/SKILL.md +11 -0
  49. package/.grok/skills/commit/SKILL.md +3 -1
  50. package/.grok/skills/commit-push/SKILL.md +2 -0
  51. package/.grok/skills/commit-push-deploy/SKILL.md +2 -0
  52. package/.grok/skills/commit-push-release/SKILL.md +2 -0
  53. package/.grok/skills/explain/SKILL.md +7 -13
  54. package/.grok/skills/google-workspace/SKILL.md +13 -0
  55. package/.grok/skills/handoff/SKILL.md +7 -11
  56. package/.grok/skills/implement-plan/SKILL.md +5 -108
  57. package/.grok/skills/listen/SKILL.md +15 -0
  58. package/.grok/skills/pickup/SKILL.md +6 -12
  59. package/.grok/skills/speak/SKILL.md +13 -0
  60. package/.grok/skills/tmp/SKILL.md +54 -0
  61. package/.grok/skills/write-plan/SKILL.md +5 -74
  62. package/.rulesync/hooks.jsonc +1 -1
  63. package/.rulesync/mcp-policy.jsonc +0 -2
  64. package/.rulesync/reference/INDEX.md +30 -17
  65. package/.rulesync/reference/browser.md +13 -6
  66. package/.rulesync/reference/cascade.md +6 -84
  67. package/.rulesync/reference/clasp.md +21 -0
  68. package/.rulesync/reference/google-workspace.md +79 -0
  69. package/.rulesync/reference/hooks.md +7 -9
  70. package/.rulesync/reference/implementation-format.md +113 -0
  71. package/.rulesync/reference/law.md +5 -3
  72. package/.rulesync/reference/listen.md +80 -0
  73. package/.rulesync/reference/map.md +39 -31
  74. package/.rulesync/reference/output.md +3 -41
  75. package/.rulesync/reference/plan-format.md +14 -12
  76. package/.rulesync/reference/refs-map.md +12 -5
  77. package/.rulesync/reference/rtk.md +3 -2
  78. package/.rulesync/reference/scope.md +37 -0
  79. package/.rulesync/reference/setup.md +27 -0
  80. package/.rulesync/reference/skills-map.md +13 -9
  81. package/.rulesync/reference/speak.md +59 -0
  82. package/.rulesync/rules/CLAUDE.md +3 -44
  83. package/.rulesync/rules/overview.md +9 -42
  84. package/.rulesync/skills/ask/SKILL.md +11 -0
  85. package/.rulesync/skills/auto/SKILL.md +11 -0
  86. package/.rulesync/skills/browser/SKILL.md +4 -8
  87. package/.rulesync/skills/clasp/SKILL.md +9 -0
  88. package/.rulesync/skills/commit/SKILL.md +3 -1
  89. package/.rulesync/skills/commit-push/SKILL.md +2 -0
  90. package/.rulesync/skills/commit-push-deploy/SKILL.md +2 -0
  91. package/.rulesync/skills/commit-push-release/SKILL.md +2 -0
  92. package/.rulesync/skills/explain/SKILL.md +7 -14
  93. package/.rulesync/skills/google-workspace/SKILL.md +11 -0
  94. package/.rulesync/skills/handoff/SKILL.md +7 -11
  95. package/.rulesync/skills/implement-plan/SKILL.md +5 -116
  96. package/.rulesync/skills/listen/SKILL.md +13 -0
  97. package/.rulesync/skills/pickup/SKILL.md +6 -12
  98. package/.rulesync/skills/speak/SKILL.md +13 -0
  99. package/.rulesync/skills/tmp/SKILL.md +54 -0
  100. package/.rulesync/skills/write-plan/SKILL.md +5 -80
  101. package/.rulesync/subagents/grunt.md +2 -23
  102. package/.rulesync/subagents/orchestrator.md +14 -54
  103. package/AGENTS.md +9 -42
  104. package/CHANGELOG.md +89 -0
  105. package/CLAUDE.md +1 -44
  106. package/README.md +97 -88
  107. package/cli/grunt.mjs +29 -13
  108. package/cli/grunt.test.ts +62 -20
  109. package/cli/init.mjs +218 -31
  110. package/cli/init.test.ts +669 -46
  111. package/cli/prompt.mjs +8 -0
  112. package/cli/prompt.test.ts +14 -0
  113. package/package.json +13 -1
  114. package/scripts/browser.mjs +98 -5
  115. package/scripts/doctor.mjs +82 -1
  116. package/scripts/emit-gemini.mjs +1 -1
  117. package/scripts/emit-mcp-policy.mjs +1 -1
  118. package/scripts/gate-fat-tools.mjs +223 -173
  119. package/scripts/google-workspace.mjs +713 -0
  120. package/scripts/grunt-job.mjs +453 -69
  121. package/scripts/listen.mjs +829 -0
  122. package/scripts/parse-need.mjs +21 -2
  123. package/scripts/persist-implementation.mjs +278 -0
  124. package/scripts/persist-plan.mjs +17 -2
  125. package/scripts/persist-tmp.mjs +123 -0
  126. package/scripts/scrub-spawn-prompt.mjs +4 -51
  127. package/scripts/setup.mjs +746 -0
  128. package/scripts/speak.mjs +291 -0
  129. package/.agents/agents/implementer.md +0 -32
  130. package/.agents/agents/thinker.md +0 -28
  131. package/.agents/skills/cascade/SKILL.md +0 -26
  132. package/.agents/skills/parent/SKILL.md +0 -6
  133. package/.agents/skills/solo/SKILL.md +0 -23
  134. package/.claude/agents/implementer.md +0 -37
  135. package/.claude/agents/thinker.md +0 -35
  136. package/.claude/skills/cascade/SKILL.md +0 -26
  137. package/.claude/skills/parent/SKILL.md +0 -6
  138. package/.claude/skills/solo/SKILL.md +0 -23
  139. package/.codex/agents/implementer.toml +0 -26
  140. package/.codex/agents/thinker.toml +0 -25
  141. package/.grok/agents/implementer.md +0 -27
  142. package/.grok/agents/thinker.md +0 -26
  143. package/.grok/parent.md +0 -1
  144. package/.grok/roles/implementer.toml +0 -5
  145. package/.grok/roles/thinker.toml +0 -5
  146. package/.grok/skills/cascade/SKILL.md +0 -26
  147. package/.grok/skills/parent/SKILL.md +0 -6
  148. package/.grok/skills/solo/SKILL.md +0 -23
  149. package/.rulesync/skills/cascade/SKILL.md +0 -26
  150. package/.rulesync/skills/parent/SKILL.md +0 -6
  151. package/.rulesync/skills/solo/SKILL.md +0 -23
  152. package/.rulesync/subagents/implementer.md +0 -49
  153. package/.rulesync/subagents/thinker.md +0 -48
package/README.md CHANGED
@@ -27,23 +27,23 @@ OSS drop-in; merges existing configs; switches default provider flow to Grunt.
27
27
 
28
28
  ```
29
29
  npm i -D @lovrozagar/grunt
30
- npx @lovrozagar/grunt
30
+ npm exec grunt
31
31
  ```
32
32
 
33
- - Same as `npx @lovrozagar/grunt init` when no command
33
+ - Same as `npm exec grunt init` when no command
34
34
  - Do not `npm test` as a consumer
35
- - Package: `@lovrozagar/grunt` `0.4.2` MIT · https://github.com/lovrozagar/grunt
35
+ - Package: `@lovrozagar/grunt` `0.6.0` MIT · https://github.com/lovrozagar/grunt
36
36
 
37
37
  ## Prerequisites
38
38
 
39
39
  All OS. Print-only. Never auto-install.
40
40
 
41
41
  ```
42
- npx grunt doctor
42
+ npm exec grunt doctor
43
43
  node scripts/doctor.mjs
44
44
  ```
45
45
 
46
- Exit 1 if any required missing; 0 if all required ok. Optional `gh` reported only.
46
+ Exit 1 if any required missing; 0 if all required ok. Optional tools are reported; missing optional does not fail.
47
47
 
48
48
  | tool | required | install |
49
49
  | --- | --- | --- |
@@ -54,12 +54,18 @@ Exit 1 if any required missing; 0 if all required ok. Optional `gh` reported onl
54
54
  | lightpanda | yes | `curl -fsSL https://pkg.lightpanda.io/install.sh \| bash` · mac `brew tap lightpanda-io/browser` · win WSL only |
55
55
  | chromium-family | yes | linux `sudo apt install chromium` · mac `brew install --cask chromium` or `google-chrome` · win `winget install Google.Chrome` / `Microsoft.Edge` + PATH |
56
56
  | gh | no | report only |
57
+ | clasp | no | `npm i -g @google/clasp` · custom Apps Script only |
58
+ | google-workspace | no | `node scripts/google-workspace.mjs` · Sheets Docs Slides Calendar Gmail · doctor reports `oauth`/`tokens`/`adc`/`clasprc` (no secrets) · `grunt setup` / `node scripts/setup.mjs google-workspace` |
59
+ | speak | no | `node scripts/speak.mjs` · TTS output (ElevenLabs or OpenAI) · `grunt setup` / `node scripts/setup.mjs speak` · or `ELEVENLABS_API_KEY` / `OPENAI_API_KEY` / `~/.grunt/speak.json` |
60
+ | ffmpeg | no | mic capture for `/listen` · mac `brew install ffmpeg` · linux `sudo apt install ffmpeg` · win `winget install Gyan.FFmpeg` |
61
+ | whisper-cli | no | local STT for `/listen` · mac `brew install whisper-cpp` · first listen downloads `ggml-base.en.bin` · setup in `.rulesync/reference/listen.md` |
62
+ | listen | no | `node scripts/listen.mjs` · STT input · `grunt setup` / `node scripts/setup.mjs listen` · local whisper.cpp then OpenAI Whisper |
57
63
 
58
- Rulesync schema doctor is separate: `npm run rulesync:doctor`.
64
+ Rulesync schema doctor is separate: `npm run grunt:rulesync:doctor`.
59
65
 
60
66
  ## Usage
61
67
 
62
- - TTY no command → menu (init default; generate check sync-globals purge-mcps doctor help quit)
68
+ - TTY no command → menu (init default; generate check sync-globals purge-mcps doctor setup upgrade help quit)
63
69
  - Piped / CI / `--yes` / `-y` / `--non-interactive` no command → still `init`
64
70
  - Bin: `grunt` → `./bin/grunt.js` (`type: module`)
65
71
 
@@ -67,12 +73,14 @@ Rulesync schema doctor is separate: `npm run rulesync:doctor`.
67
73
 
68
74
  ### Commands
69
75
 
70
- - `init` → `init()` — merge SoT, `npm install`, `rulesync:generate`, `sync:globals:apply`, `rulesync:check`
71
- - `generate` → `npm run rulesync:generate`
72
- - `check` → `npm run rulesync:check`
73
- - `sync-globals` → `npm run sync:globals` (dry-run); `--apply` → `sync:globals:apply`
74
- - `purge-mcps` → `npm run purge:global-mcps` (dry-run); `--apply` → `purge:global-mcps:apply`
75
- - `doctor` → `npm run doctor` (`node scripts/doctor.mjs`). Rulesync schema: `npm run rulesync:doctor`
76
+ - `init` → `init()` — merge SoT, `npm install`, `grunt:rulesync:generate`, `grunt:sync:globals:apply`, `grunt:rulesync:check`
77
+ - `generate` → `npm run grunt:rulesync:generate`
78
+ - `check` → `npm run grunt:rulesync:check`
79
+ - `sync-globals` → `npm run grunt:sync:globals` (dry-run); `--apply` → `grunt:sync:globals:apply`
80
+ - `purge-mcps` → `npm run grunt:purge:global-mcps` (dry-run); `--apply` → `grunt:purge:global-mcps:apply`
81
+ - `doctor` → `npm run grunt:doctor` (`npm exec grunt doctor` / `node scripts/doctor.mjs` stay). Rulesync schema: `npm run grunt:rulesync:doctor`
82
+ - `setup` → `npm run grunt:setup` (`node scripts/setup.mjs`) — handheld speak / listen / google-workspace / browser. TTY walks each; flags for non-TTY keys/`--creds`
83
+ - `upgrade` → same merge as init for an already-inited repo: copy owned trees/scripts, prune retired grunt-owned names, print reserved skill names
76
84
  - `help`
77
85
  - `version`
78
86
 
@@ -85,36 +93,39 @@ Rulesync schema doctor is separate: `npm run rulesync:doctor`.
85
93
 
86
94
  ## Init
87
95
 
88
- - Merge SoT `npm install` `rulesync:generate` `sync:globals:apply` `rulesync:check`
96
+ - Merge SoT `npm install` `grunt:rulesync:generate` `grunt:sync:globals:apply` `grunt:rulesync:check`
89
97
  - `--skip-globals` skips apply
90
98
  - Re-init auto-skips globals when `<!-- grunt:begin -->` in `AGENTS.md`/`CLAUDE.md`
91
99
  - First init (no sentinel) applies globals unless flagged
92
100
  - Owned trees/scripts refresh; extra `.rulesync` files kept; patches to grunt-owned files lost
101
+ - `cp` cannot delete dest extras. Init/upgrade then prune: retired skills `parent` `solo` `cascade`, agents `implementer` `thinker` (plus `.grok/roles/{implementer,thinker}.toml` and `.gemini/agents/{name}/`), scripts `telemetry.mjs` `grunt-config.mjs`, paths `.grok/parent.md` `.grok/skills/shared` `.rulesync/grunt.config.jsonc` plus local overlay and example, and reserved skill dirs this package no longer ships. Consumer extras stay.
102
+ - Breaking: consumer npm scripts are `grunt:<SoT-key>` (`grunt:rulesync:generate`, `grunt:doctor`). Re-init migrates `package.json` (owned unprefixed keys + suffixes; `npm run` refs in other dest scripts). CI/husky/`npm run rulesync:*` / `npm run doctor` must switch. No aliases. SoT repo scripts stay unprefixed (`npm run rulesync:generate`).
93
103
 
94
104
  ## Version bump
95
105
 
106
+ Already-inited consumer (0.5.x → 0.6, and later):
107
+
96
108
  ```
97
- npm i -D @lovrozagar/grunt@latest && npx @lovrozagar/grunt init
109
+ npm i -D @lovrozagar/grunt@latest
110
+ npm exec grunt upgrade
98
111
  ```
99
112
 
100
- - Same re-init / globals rules as Init
113
+ `upgrade` is init plus a reserved-names print. Same merge, prune, and globals-skip rules as Init. New skills/scripts appear because they are in the package copy list. Dropped grunt-owned files disappear only if they are on the retired lists (or a reserved skill this package no longer ships). Do not expect a blind dest-dir mirror-delete; that would wipe consumer extras.
101
114
 
102
115
  ## Agents
103
116
 
104
- SoT: `.rulesync/subagents/{orchestrator grunt implementer thinker}.md`
117
+ SoT: `.rulesync/subagents/{orchestrator grunt}.md`
105
118
 
106
119
  Emit: `.claude/` `.grok/` `.agents/` `.gemini/`
107
120
 
108
- - **orchestrator** (parent) — always spawn+prompt; user-facing `[orchestrator]:` (or child role tag) one-line recap; advise leftover numbered pick each on own line after that recap (do not cram `1. Implementer with verbal plan 2. Implementer with file plan 3. Tweak` onto the recap line). `/parent` one-turn; `/handoff` writes `.tmp/grunt/handoffs/{serial}-{slug}-{stamp}.md`; `/pickup` spawn-first pickup (inverse of `/handoff`; not a mode). `/solo` session escape; `/cascade` restores it. Small/low router. First token spawn. No parent Read/Bash/Grep. Does not implement, plan, or fetch world facts
109
- - **grunt** — tools: facts/search/exec/git/web/test/low-reason mechanical write. Isolation `verdict:`. Never feature solution. Never spawn. World fact: `job: web`
110
- - **implementer** — write already-defined solution on allowlisted paths. TDD when spec/plan says tests. Validate + sim after write. Fat dumps via `need:`. Never spawn. Never plan. Id is **implementer** (not Implementor)
111
- - **thinker** — think/plan/advise/recommend/how/why/explain; unsure→thinker; cheap false+; edge cases. Read-only named-file Read of prompt SSOT; trees/search/exec/web/test → `need:`. Never spawn. No bash. Never implement
121
+ - **orchestrator** — session agent. Tools on. Does the work. en-US unless asked. Concise complete sentences with natural grammar. Skip filler and fluff. Optimal solutions only; rewrite if not. Flag blockers. Do not monkey-patch. Runs `node scripts/grunt-job.mjs` for fat dumps; spawn grunt only when the dump needs judgment.
122
+ - **grunt** — isolation worker. Facts only (≤8 lines, stash receipt when needed).
112
123
 
113
- Children never spawn. Spawn only grunt|implementer|thinker. Omit model on spawn; frontmatter on agent files picks haiku/sonnet/opus vs grok-4.5 / grok-4.6 / other hosts. Voice: `.rulesync/reference/output.md`. Protocol: `.rulesync/reference/cascade.md`. `AGENTS.md`/`CLAUDE.md` spawn-first. `GEMINI.md` → `@AGENTS.md`. Goals: synced configs across grok build claude code codex gemini cli antigravity; max situational speed; superterse token savings; max/min reasoning by role.
124
+ Fat dumps rewrite to `scripts/grunt-job.mjs` (squeez + stash). Scratch goes in `.tmp/grunt/`. Voice: `.rulesync/reference/output.md`. `GEMINI.md` → `@AGENTS.md`.
114
125
 
115
126
  ## Browser
116
127
 
117
- Lightpanda-first session CLI: `node scripts/browser.mjs nav|snap|click|fill|shot|pdf|stop|doctor|ensure`. Zero MCP. Zero env knobs. Chromium only for `shot`/`pdf`/`trace`, Windows, missing Lightpanda, one probe-fail replay, or paint hosts. Session: `.tmp/grunt/browser/`. Spec: [`.rulesync/reference/browser.md`](.rulesync/reference/browser.md).
128
+ Lightpanda-first session CLI: `node scripts/browser.mjs`. Zero MCP. Zero env knobs. The rail swaps to Chromium for `shot`/`pdf`/`trace`, Windows, missing Lightpanda, probe-fail, Chromium-first hosts (figma, Google docs/sheets/slides, Gmail, earth, Amazon), or a blocked/empty/client-rendered snap. Session: `.tmp/grunt/browser/`. Spec: [`.rulesync/reference/browser.md`](.rulesync/reference/browser.md). App e2e uses Playwright. URL-in-a-cite is a cite.
118
129
 
119
130
  `node scripts/browser.mjs doctor` (alias `ensure`) runs the unified doctor (`scripts/doctor.mjs`). Install engines: [Prerequisites](#prerequisites).
120
131
 
@@ -122,11 +133,15 @@ Lightpanda-first session CLI: `node scripts/browser.mjs nav|snap|click|fill|shot
122
133
 
123
134
  Present under `.claude` / `.rulesync` / `.agents` / `.grok` (`rulesync -f skills` mirrors SSOT):
124
135
 
125
- - `browser` `cascade` `commit` `commit-and-push` (1-release alias → `commit-push`) `commit-push` `commit-push-deploy` `commit-push-release` `explain` `handoff` `pickup` `parent` `solo` `write-plan` `implement-plan`
136
+ - `ask` `auto` `browser` `clasp` `commit` `commit-and-push` (1-release alias → `commit-push`) `commit-push` `commit-push-deploy` `commit-push-release` `explain` `google-workspace` `handoff` `implement-plan` `listen` `pickup` `speak` `tmp` `write-plan`
137
+
138
+ `/auto` (default) keeps going and asks on blockers. `/ask` finishes one step, recaps, then asks. `/auto` returns the session to auto.
126
139
 
127
- Reserved names: do not reuse those stems for consumer custom skills. Same name → one SSOT under `.rulesync/skills/<name>/`; re-init force-refresh overwrites grunt-owned names; extras kept; maps `origin` badge ≠ content picker. See `.rulesync/reference/law.md` (flows into INDEX).
140
+ Reserved names: do not reuse those stems for consumer custom skills. Same name → one SSOT under `.rulesync/skills/<name>/`; re-init force-refresh overwrites grunt-owned names; extras kept; maps `origin` badge ≠ content picker. Retired 0.5 names (`parent` `solo` `cascade` plus subagents `implementer` `thinker`) are pruned on init/upgrade. See `.rulesync/reference/law.md` (flows into INDEX).
128
141
 
129
- `/write-plan` and `/implement-plan` SSOT: `.rulesync/skills/{write-plan,implement-plan}/`; format SSOT `.rulesync/reference/plan-format.md`. `/write-plan` plan-only inspect-pause → `next: /implement-plan {n}`; empty `/implement-plan` resumes unique in-progress or starts unique ready, else lists (need serial); leftover pick **2. Implementer with file plan** = persist then implement one-shot skip pause; leftover pick **1. Implementer with verbal plan** / explicit implement = verbal spec no plan file; slash `/implement-plan {n}` disk/file ≠ verbal; not `ok`/`yes`/`go`
142
+ Size first: `.rulesync/reference/scope.md`. Straight shot → do it. Else that file.
143
+
144
+ `/write-plan` and `/implement-plan` SSOT: `.rulesync/skills/{write-plan,implement-plan}/`; format SSOT `.rulesync/reference/plan-format.md`. `/write-plan` plan-only inspect-pause → `next: /implement-plan {n}`; empty `/implement-plan` resumes unique in-progress or starts unique ready, else lists (need serial); slash `/implement-plan {n}` disk/file. The session agent executes the plan. `/implement-plan` also writes `.tmp/grunt/implementations/` (format `.rulesync/reference/implementation-format.md`): Files / Log / Done for commits. Straight shots skip the journal.
130
145
 
131
146
  ## Generate
132
147
 
@@ -150,15 +165,32 @@ Emit writes other-CLI trees from `.rulesync` for the **next** process of that CL
150
165
  - `sync-globals` / `purge-mcps`: dry-run default; `--apply` writes
151
166
  - Hosts: grok claude codex gemini antigravity
152
167
 
168
+ ### Secrets (machine)
169
+
170
+ Not git. Not `sync-globals`.
171
+
172
+ First-hand: `npm exec grunt setup` (TTY). Per target: `node scripts/setup.mjs speak|listen|google-workspace|browser`. Spec: `.rulesync/reference/setup.md`.
173
+
174
+ | | where |
175
+ | --- | --- |
176
+ | Speak / listen OpenAI | `OPENAI_API_KEY` or `~/.grunt/speak.json` `openai.apiKey` |
177
+ | Speak ElevenLabs | `ELEVENLABS_API_KEY` or `~/.grunt/speak.json` `elevenlabs.apiKey` |
178
+ | Listen extras | `WHISPER_MODEL` `LISTEN_DEVICE` `LISTEN_STT` `SPEAK_PROVIDER` — optional |
179
+ | Google Workspace | OAuth under `~/.grunt/` |
180
+
181
+ `~/.grunt/speak.json` chmod 600. Env wins over that file. Copy the file or export env on another machine. Doctor reports optional google-workspace / speak / ffmpeg / whisper-cli.
182
+
183
+ `sync-globals` is host CLI globals (MCP and friends), not API keys.
184
+
153
185
  ## Architecture
154
186
 
155
- Protocol picture: one CLI host process, parent-only orchestrator in that session, three sibling spawn types (`grunt` | `implementer` | `thinker`), local workspace tools with RTK on Bash stdout only, one vendor Model API outside the host bubble. Not a product walkthrough. `@lovrozagar/grunt` = protocol SoT + CLI (init/generate/check); not a model runtime. Do not paste `.rulesync/reference/cascade.md` here — boxes and edges only.
187
+ Protocol picture: one CLI host process, session orchestrator in that session with tools on, optional grunt isolation sibling, local workspace tools with RTK on Bash stdout only, one vendor Model API outside the host bubble. Not a product walkthrough. `@lovrozagar/grunt` = protocol SoT + CLI (init/generate/check); not a model runtime. Do not paste `.rulesync/reference/cascade.md` here — boxes and edges only.
156
188
 
157
189
  ### Containment
158
190
 
159
191
  Draw **one** CLI host bubble. That bubble is **this** session’s CLI: Grok Build, Claude Code, Codex, Gemini CLI, or Antigravity. The CLI **is** the host — not a peer router beside another CLI. Parent lives **inside** that host session. Children spawn **inside the same process**. Other CLIs = emit/config on disk only; no runtime hop; no shared spawn/peek line.
160
192
 
161
- User-visible conversation attaches only to the parent. Children never talk to the user. Children never spawn.
193
+ User-visible conversation attaches only to the session agent. Children never talk to the user. Children never spawn. The session agent does the work. Spawn grunt only when isolation is cheaper.
162
194
 
163
195
  ### Host support (GAP)
164
196
 
@@ -179,30 +211,23 @@ Same topology as the session recap; every legal edge labeled.
179
211
  ```
180
212
  USER
181
213
  │
182
- │ session in/out (parent only; tagged one-line recap; advise leftover 1./2./3. own lines)
214
+ │ session in/out (session agent only; tagged recap)
183
215
  │ TUI local; completion tokens from Model API (mixed)
184
216
  ▼
185
217
  ┌──────────────────────── CLI HOST (this process) ────────────────────────┐
186
218
  │ TUI · hooks · emit/generate · RTK PreToolUse · fs workspace │
187
219
  │ │
188
- │ Parent orchestrator (only spawner; spawn-first; no parent Read/Bash) │
189
- │ legal spawn types: grunt | implementer | thinker │
220
+ │ Session orchestrator (tools on; grunt-job first) │
221
+ │ legal spawn type: grunt │
190
222
  │ omit model on spawn; FM on agent files picks haiku/sonnet/opus │
191
223
  │ vs grok-4.5 / grok-4.6 / etc. │
192
224
  │ │
193
- │ spawn / peek / resume_from │
225
+ │ spawn / peek (optional) │
194
226
  │ │ │
195
227
  │ ▼ │
196
- │ siblings (never spawn; no child→child) │
197
- │ ┌───────────┬───────────────┬──────────────┐ │
198
- │ │ grunt │ implementer │ thinker │ │
199
- │ │ facts/ │ specified │ plan/deep │ │
200
- │ │ tools │ writes + TDD │ reason │ │
201
- │ │ Bash+fs │ Write/Bash/ │ Read / need: │ │
202
- │ │ web/test │ fs │ no Bash │ │
203
- │ └─────┬─────┴───────┬───────┴───────┬──────┘ │
204
- │ │ │ │ │
205
- │ └──────── tool call ──────────┘ │
228
+ │ grunt sibling (never spawn; facts ≤8 lines) │
229
+ │ │ │
230
+ │ └──────── tool call ──────────┐ │
206
231
  │ │ │
207
232
  │ ▼ │
208
233
  │ host tools (same process) │
@@ -237,50 +262,38 @@ Same topology as the session recap; every legal edge labeled.
237
262
  (no fake peeks)
238
263
  ```
239
264
 
240
- ### `need:` / `resume_from`
265
+ ### `need:` / grunt-job
241
266
 
242
- Implementer or thinker that still needs a fat dump **stops** on a `need:` JSON line. Parent fans those jobs as **parallel grunt** siblings, then one `resume_from` with **new** `verdict:` blobs only. Max **3** `resume_from` per child id. Thinker has no Bash; facts go through this loop. Grunt does not emit `need:` for its own tool use.
267
+ The session agent runs `node scripts/grunt-job.mjs --job search|exec|slice|fetch|test` for fat dumps. A grunt child that still needs a fat dump **stops** on a `need:` JSON line. SubagentStop intercepts `search|exec|slice|fetch` (cap 4) in-hook. Spawn a grunt **model** only when the dump needs judgment. Grunt does not emit `need:` for its own tool use.
243
268
 
244
269
  ```
245
- implementer | thinker
246
- │
247
- │ stop on JSON only (≤4 jobs/batch)
248
- ▼
249
- need: [{"job":"search|exec|web|test","query":"..."}]
250
- │
251
- │ parent parse-need (or SubagentStop intercept
252
- │ when every job is search|exec)
253
- ▼
254
- parallel grunt spawns (same host; not a new CLI)
270
+ session agent
255
271
  │
256
- │ isolation
272
+ │ grunt-job first
257
273
  ▼
258
- verdict: ok|fail|empty
274
+ node scripts/grunt-job.mjs --job search|exec|slice|fetch|test
259
275
  │
260
- │ one resume_from:<child id> + new verdicts only
261
- │ do not re-send original task; max 3
276
+ │ spawn grunt model only if the dump needs judgment
262
277
  ▼
263
- same child continues (transcript already on resume_from)
278
+ grunt isolation facts (≤8 lines, optional stash=)
264
279
  ```
265
280
 
266
281
  ### Node table
267
282
 
268
283
  | node | inside host? | local vs AI-server | notes |
269
284
  | --- | --- | --- | --- |
270
- | User | no | mixed | Speaks only to parent session. Never a child edge. |
271
- | Session in/out / TUI | yes | mixed | TUI is local; recap tokens come from the model. Legal `[role]:` one-line recap; advise leftover numbered pick each on own line after (not crammed onto the recap line). |
285
+ | User | no | mixed | Speaks only to the session agent. Never a child edge. |
286
+ | Session in/out / TUI | yes | mixed | TUI is local; recap tokens come from the model. Legal `[role]:` tagged recap. |
272
287
  | CLI host process | yes (is the box) | local process | Grok Build / Claude Code / Codex / Gemini / Antigravity. Not a peer of another CLI. |
273
- | Parent orchestrator | yes | AI-server **turn** | Spawn-first low router. No parent Read/Bash/Grep. Lives in this session, not a sidecar. |
274
- | `grunt` sibling | yes | AI-server **turn** | Facts/tools/mechanical write. Never spawn. Never feature solution. |
275
- | `implementer` sibling | yes | AI-server **turn** | Specified writes + TDD when tests are in the spec. Agent id is **implementer**. Never spawn. |
276
- | `thinker` sibling | yes | AI-server **turn** | Plan/deep reason. Read-only. Named-file Read of prompt SSOT; investigate → `need:`. No Bash. Never spawn. |
277
- | Host spawn / peek / `resume_from` | yes | **local** | `spawn_subagent` / `Agent` and host peek tools. Gemini spawn/peek = GAP; block on return, classify `done`; no fake peeks. |
278
- | Workspace fs tools | yes | **local** | Read/Grep/Glob/Write (and host aliases). Parent is denied these except documented persist paths / `/solo`. |
279
- | Bash / `run_terminal_command` | yes | **local** | RTK wraps stdout on PreToolUse. Thinker has no Bash. |
288
+ | Session orchestrator | yes | AI-server **turn** | Does the work. Tools on. grunt-job first. Lives in this session, not a sidecar. |
289
+ | `grunt` sibling | yes | AI-server **turn** | Facts/tools/mechanical write. Never spawn. Never feature solution. Optional. |
290
+ | Host spawn / peek | yes | **local** | `spawn_subagent` / `Agent` and host peek tools. Gemini spawn/peek = GAP; block on return, classify `done`; no fake peeks. Other hosts: spawn is an optimization; grunt-job still runs in-process. |
291
+ | Workspace fs tools | yes | **local** | Read/Grep/Glob/Write (and host aliases). Fat dumps still gate. |
292
+ | Bash / `run_terminal_command` | yes | **local** | RTK wraps stdout on PreToolUse. |
280
293
  | RTK | yes | **local** | Bash/shell stdout compression only. Not Read/Grep/Glob/prompts/images. |
281
- | `scrub-spawn-prompt` / `parse-need` / `grunt-job` | yes | **local** | Hooks and scripts. Isolation `verdict:` is grunt output, not a model hop. |
294
+ | `scrub-spawn-prompt` / `parse-need` / `grunt-job` | yes | **local** | Hooks and scripts. Isolation facts are grunt-job output, not a model hop. |
282
295
  | emit / generate / init | yes (this repo / install) | **local** | Writes other-CLI configs. Not a runtime line to those CLIs. |
283
- | WebSearch / web_fetch | tool from host | **remote-not-LLM** | Network search/fetch. Not a second Model API box. World facts: grunt `job: web`. |
296
+ | WebSearch / web_fetch | tool from host | **remote-not-LLM** | Network search/fetch. Not a second Model API box. Snippet/cite/"what is X"/world fact: grunt `job: web`. Live URL/DOM: grunt browser rail, not this box. |
284
297
  | MCP | policy deny | n/a | Denied by policy in-tree. Do not draw as a main path. |
285
298
  | Model API | **no** (one box outside) | AI-server | This host’s vendor SDK only. Parent and child **turns** complete here. Spawn omits model; frontmatter on `.rulesync/subagents/*.md` picks the model. |
286
299
  | Other CLIs | no (not this process) | emit/config only | Same protocol files emitted elsewhere. No hop, no shared peek. |
@@ -292,12 +305,11 @@ Use these labels. Do not revive “prompt input” or “agent to use”.
292
305
 
293
306
  | edge | meaning |
294
307
  | --- | --- |
295
- | **session in/out** | User ↔ parent only. Children have no user edge. |
296
- | **spawn** | Parent → `grunt` \| `implementer` \| `thinker`. First sentence: `You are {agent} subagent.` Omit model. |
297
- | **peek** | Parent reads host status on the child id. Real host fields. `timeout_ms=60000`. GAP hosts: no fake peeks; block on spawn return = `done`. |
298
- | **resume_from** | Parent continues the **same** child id with new `verdict:` blobs only. Max 3. Not a fresh spawn. |
299
- | **need:** | Child stop line: fat dump jobs for parent to fan as grunt. Cap 4 jobs per batch. |
300
- | **verdict:** | Grunt isolation result back onto `resume_from`. `ok\|fail\|empty`. Short facts, not dumps. |
308
+ | **session in/out** | User ↔ session agent only. Children have no user edge. |
309
+ | **spawn** | Session agent → `grunt`. First sentence: `You are grunt subagent.` Omit model. Optional. |
310
+ | **peek** | Session agent reads host status on the child id. Real host fields. `timeout_ms=60000`. GAP hosts: no fake peeks; block on spawn return = `done`. |
311
+ | **need:** | Child stop line: fat dump jobs interceptable as grunt-job. Cap 4 jobs per batch. |
312
+ | **facts** | Grunt isolation result back onto `resume_from`. Sentence plus dash facts, not dumps. |
301
313
  | **tool call** | Child (or, illegally if parent, denied) → host tools. |
302
314
  | **RTK** | PreToolUse Bash/shell → compressed stdout. No other tools. |
303
315
  | **completion** | Parent and children → **one** Model API (this host’s SDK). |
@@ -306,13 +318,12 @@ Use these labels. Do not revive “prompt input” or “agent to use”.
306
318
  ### What not to draw
307
319
 
308
320
  - A **CLI Provider** box as a peer of the host, or a router that hops between CLIs at runtime
309
- - **Thinker ↔ CLI** as a special extra channel — thinker is a sibling; tools/`need:` like the protocol
310
- - The spelling **Implementor** — id is **implementer**
321
+ - **implementer** or **thinker** siblings — gone in 0.6
311
322
  - **Per-agent Model API** boxes — one Model API outside the host, this SDK only
312
- - **Child → child spawn** — isolation is parent fan-out of grunt siblings (or in-hook grunt-job for interceptable `search|exec` batches)
323
+ - **Child → child spawn** — isolation is grunt-job or a grunt sibling
313
324
  - **MCP** as a happy-path tool rail
314
325
  - **RTK** on Read/Grep/Glob/prompts/images
315
- - **User** arrows into grunt/implementer/thinker
326
+ - **User** arrows into grunt
316
327
  - Gemini **fake peek** loops. GAP: no invented status API; block on return
317
328
 
318
329
  ### Emit footnote and Gemini GAP
@@ -327,17 +338,15 @@ Repo-relative (repository root):
327
338
 
328
339
  - `.rulesync/reference/INDEX.md` — aggregate catalog composed from slices (law.md, skills-map.md, refs-map.md). Maps/law = slices for deep dive. Always. Not if-maps-else
329
340
  - `.rulesync/reference/law.md` — domain law stub (protocol stays cascade/overview)
330
- - `.rulesync/reference/cascade.md` — parent-only spawn, peek/kill table, `need:` / `resume_from`, isolation `verdict:`
341
+ - `.rulesync/reference/cascade.md` — parent-only spawn, peek/kill table, `need:` / `resume_from`, isolation facts
331
342
  - `.rulesync/reference/rtk.md` — Bash/shell stdout compression
332
343
  - `.rulesync/reference/map.md` — cheap outline of protocol, scripts, generated trees
333
344
  - `.rulesync/subagents/orchestrator.md`
334
345
  - `.rulesync/subagents/grunt.md`
335
- - `.rulesync/subagents/implementer.md`
336
- - `.rulesync/subagents/thinker.md`
337
346
 
338
347
  ## Layout
339
348
 
340
- Published (`package.json` `files`): `bin/grunt.js` `cli` `scripts/check-globals.mjs` `scripts/emit-agent-shell-tools.mjs` `scripts/emit-gemini.mjs` `scripts/guarded-roots.mjs` `scripts/emit-mcp-policy.mjs` `scripts/gate-fat-tools.mjs` `scripts/hooks-union.mjs` `scripts/pipeline.mjs` `scripts/grunt-job.mjs` `scripts/parse-need.mjs` `scripts/persist-handoff.mjs` `scripts/persist-plan.mjs` `scripts/purge-global-mcps.mjs` `scripts/scrub-spawn-prompt.mjs` `scripts/scrub-text-lib.mjs` `scripts/sync-global-settings.mjs` `scripts/browser.mjs` `scripts/doctor.mjs` `scripts/scrub-text` `.rulesync` `.grok` `.codex` `.claude` `.agents` `AGENTS.md` `CLAUDE.md` `.mcp.json` `README.md` `LICENSE` `CHANGELOG.md`
349
+ Published (`package.json` `files`): `bin/grunt.js` `cli` `scripts/check-globals.mjs` `scripts/emit-agent-shell-tools.mjs` `scripts/emit-gemini.mjs` `scripts/guarded-roots.mjs` `scripts/emit-mcp-policy.mjs` `scripts/gate-fat-tools.mjs` `scripts/hooks-union.mjs` `scripts/pipeline.mjs` `scripts/grunt-job.mjs` `scripts/parse-need.mjs` `scripts/persist-handoff.mjs` `scripts/persist-implementation.mjs` `scripts/persist-tmp.mjs` `scripts/persist-plan.mjs` `scripts/purge-global-mcps.mjs` `scripts/scrub-spawn-prompt.mjs` `scripts/scrub-text-lib.mjs` `scripts/sync-global-settings.mjs` `scripts/browser.mjs` `scripts/speak.mjs` `scripts/listen.mjs` `scripts/google-workspace.mjs` `scripts/setup.mjs` `scripts/doctor.mjs` `scripts/scrub-text` `.rulesync` `.grok` `.codex` `.claude` `.agents` `AGENTS.md` `CLAUDE.md` `.mcp.json` `README.md` `LICENSE` `CHANGELOG.md`
341
350
 
342
351
  No `scripts/*.test.ts` `scripts/fixtures/` `docs/` `coverage/` `vitest.config.ts` in `files`. `cli` dir ships whole (includes `cli/*.test.ts`).
343
352
 
@@ -370,10 +379,10 @@ npm i && npm test
370
379
 
371
380
  Keep these four flows only:
372
381
 
373
- 1. “Create me a react weather app” → thinker plan/recap-stop + pick 1.Implementer with verbal plan 2.Implementer with file plan 3.Tweak → user picks 1 (verbal spec) or 2 (file plan one-shot) or `/implement-plan {n}` → implementer write → recap
374
- 2. “What is 2+2” → grunt → `[grunt]:` echo
375
- 3. Marvel theatrical next → grunt `job:web` → recap
376
- 4. `.logs` 3/6/2021 tag `framework bug` → grunt local search → recap
382
+ 1. “Create me a react weather app” → session agent writes (or `/write-plan` then `/implement-plan {n}`) → recap
383
+ 2. “What is 2+2” → session agent → recap
384
+ 3. Marvel theatrical next → session agent web search → recap
385
+ 4. `.logs` 3/6/2021 tag `framework bug` → `grunt-job --job search` → recap
377
386
 
378
387
  ## License
379
388
 
package/cli/grunt.mjs CHANGED
@@ -2,7 +2,7 @@ import { execFileSync } from "node:child_process"
2
2
  import { readFileSync } from "node:fs"
3
3
  import path from "node:path"
4
4
  import { fileURLToPath } from "node:url"
5
- import { destAlreadyInited, init, shouldAutoSkipGlobals } from "./init.mjs"
5
+ import { destAlreadyInited, init, RESERVED_SKILLS, shouldAutoSkipGlobals, toGruntScriptName } from "./init.mjs"
6
6
  import { confirm, isInteractive, select, spinner } from "./prompt.mjs"
7
7
 
8
8
  const PKG_ROOT = path.join(path.dirname(fileURLToPath(import.meta.url)), "..")
@@ -12,12 +12,14 @@ const USAGE = `Usage: grunt [command]
12
12
  Default (no command): TTY menu; else init — full setup
13
13
 
14
14
  Commands:
15
- init Full setup: merge SoT, npm install, rulesync:generate, sync:globals:apply, rulesync:check
16
- generate npm run rulesync:generate
17
- check npm run rulesync:check
18
- sync-globals npm run sync:globals (dry-run; --apply to write)
19
- purge-mcps npm run purge:global-mcps (dry-run; --apply to write)
20
- doctor npm run doctor
15
+ init Full setup: merge SoT, npm install, grunt:rulesync:generate, grunt:sync:globals:apply, grunt:rulesync:check
16
+ generate npm run grunt:rulesync:generate
17
+ check npm run grunt:rulesync:check
18
+ sync-globals npm run grunt:sync:globals (dry-run; --apply to write)
19
+ purge-mcps npm run grunt:purge:global-mcps (dry-run; --apply to write)
20
+ doctor npm run grunt:doctor
21
+ setup npm run grunt:setup — handheld keys/OAuth (speak, listen, google-workspace, browser)
22
+ upgrade Re-init: copy owned files, prune retired grunt-owned names, print reserved skills
21
23
  help Show this help
22
24
  version Print package version
23
25
 
@@ -36,6 +38,8 @@ const MENU_OPTIONS = [
36
38
  { value: "sync-globals", label: "sync-globals" },
37
39
  { value: "purge-mcps", label: "purge-mcps" },
38
40
  { value: "doctor", label: "doctor" },
41
+ { value: "setup", label: "setup" },
42
+ { value: "upgrade", label: "upgrade" },
39
43
  { value: "help", label: "help" },
40
44
  { value: "quit", label: "quit" },
41
45
  ]
@@ -90,7 +94,7 @@ export function parseArgv(argv) {
90
94
  }
91
95
  positionals.push(a)
92
96
  }
93
- return { cmd: positionals[0], skipGlobals, apply, host, hostError }
97
+ return { cmd: positionals[0], args: positionals.slice(1), skipGlobals, apply, host, hostError }
94
98
  }
95
99
 
96
100
  function hostExtra(host) {
@@ -146,24 +150,36 @@ async function dispatch(cmd, flags, interactive) {
146
150
  return
147
151
  }
148
152
  if (cmd === "generate") {
149
- npmRun("rulesync:generate")
153
+ npmRun(toGruntScriptName("rulesync:generate"))
150
154
  return
151
155
  }
152
156
  if (cmd === "check") {
153
- npmRun("rulesync:check")
157
+ npmRun(toGruntScriptName("rulesync:check"))
154
158
  return
155
159
  }
156
160
  if (cmd === "sync-globals") {
157
- const script = flags.apply ? "sync:globals:apply" : "sync:globals"
161
+ const script = flags.apply ? toGruntScriptName("sync:globals:apply") : toGruntScriptName("sync:globals")
158
162
  npmRun(script, hostExtra(flags.host))
159
163
  return
160
164
  }
161
165
  if (cmd === "purge-mcps") {
162
- npmRun(flags.apply ? "purge:global-mcps:apply" : "purge:global-mcps")
166
+ npmRun(flags.apply ? toGruntScriptName("purge:global-mcps:apply") : toGruntScriptName("purge:global-mcps"))
163
167
  return
164
168
  }
165
169
  if (cmd === "doctor") {
166
- npmRun("doctor")
170
+ npmRun(toGruntScriptName("doctor"))
171
+ return
172
+ }
173
+ if (cmd === "setup") {
174
+ npmRun(toGruntScriptName("setup"), flags.args)
175
+ return
176
+ }
177
+ if (cmd === "upgrade") {
178
+ await runInit(process.cwd(), {
179
+ skipGlobals: flags.skipGlobals,
180
+ interactive: false,
181
+ })
182
+ process.stdout.write(`reserved: ${RESERVED_SKILLS.join(" ")}\n`)
167
183
  return
168
184
  }
169
185
  process.stdout.write(USAGE)