@lovrozagar/grunt 0.2.0 → 0.3.1

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 (55) hide show
  1. package/.agents/agents/grunt.md +4 -2
  2. package/.agents/agents/orchestrator.md +2 -2
  3. package/.agents/hooks.json +12 -1
  4. package/.agents/skills/commit/SKILL.md +21 -0
  5. package/.agents/skills/commit-and-push/SKILL.md +15 -0
  6. package/.agents/skills/explain/SKILL.md +14 -0
  7. package/.agents/skills/handoff/SKILL.md +84 -0
  8. package/.agents/skills/parent/SKILL.md +11 -0
  9. package/.agents/skills/solo/SKILL.md +21 -0
  10. package/.claude/agents/grunt.md +2 -0
  11. package/.claude/agents/orchestrator.md +3 -3
  12. package/.claude/settings.json +34 -1
  13. package/.claude/skills/commit/SKILL.md +21 -0
  14. package/.claude/skills/commit-and-push/SKILL.md +15 -0
  15. package/.claude/skills/explain/SKILL.md +14 -0
  16. package/.claude/skills/handoff/SKILL.md +84 -0
  17. package/.claude/skills/parent/SKILL.md +11 -0
  18. package/.claude/skills/solo/SKILL.md +21 -0
  19. package/.codex/agents/grunt.toml +4 -2
  20. package/.codex/agents/orchestrator.toml +2 -2
  21. package/.codex/hooks.json +34 -1
  22. package/.grok/agents/grunt.md +4 -2
  23. package/.grok/agents/orchestrator.md +2 -2
  24. package/.grok/hooks/orchestrate-parent.js +263 -29
  25. package/.grok/skills/commit/SKILL.md +21 -0
  26. package/.grok/skills/commit-and-push/SKILL.md +15 -0
  27. package/.grok/skills/handoff/SKILL.md +84 -0
  28. package/.grok/skills/solo/SKILL.md +21 -0
  29. package/.rulesync/hooks.jsonc +11 -3
  30. package/.rulesync/reference/cascade.md +4 -3
  31. package/.rulesync/reference/hooks.md +5 -1
  32. package/.rulesync/reference/map.md +18 -3
  33. package/.rulesync/rules/CLAUDE.md +2 -1
  34. package/.rulesync/rules/overview.md +2 -1
  35. package/.rulesync/skills/commit/SKILL.md +22 -0
  36. package/.rulesync/skills/commit-and-push/SKILL.md +16 -0
  37. package/.rulesync/skills/handoff/SKILL.md +84 -0
  38. package/.rulesync/skills/solo/SKILL.md +21 -0
  39. package/.rulesync/subagents/grunt.md +6 -2
  40. package/.rulesync/subagents/implementer.md +2 -0
  41. package/.rulesync/subagents/orchestrator.md +4 -2
  42. package/.rulesync/subagents/thinker.md +2 -0
  43. package/AGENTS.md +2 -1
  44. package/CLAUDE.md +2 -1
  45. package/README.md +2 -2
  46. package/cli/init.mjs +105 -6
  47. package/cli/init.test.ts +303 -6
  48. package/package.json +12 -6
  49. package/scripts/emit-agent-shell-tools.mjs +118 -0
  50. package/scripts/emit-gemini.mjs +219 -0
  51. package/scripts/emit-mcp-policy.mjs +23 -0
  52. package/scripts/gate-fat-tools.mjs +64 -0
  53. package/scripts/hooks-union.mjs +391 -0
  54. package/scripts/persist-handoff.mjs +231 -0
  55. package/scripts/scrub-spawn-prompt.mjs +37 -17
@@ -14,15 +14,17 @@ inheritMcp: false
14
14
  ---
15
15
  Voice: `.rulesync/reference/output.md` — must follow.
16
16
 
17
- Tools (shell/host; and more): Read, Grep, Glob, Bash, Write, Edit, Web. Git. Test runners (vitest, playwright, and similar). Other system tools. Commands of project dependencies. Installing and managing dependencies. Running dev, build, preview, deploys and similar.
17
+ Tools (shell/host; and more): read_file, grep, list_dir, run_terminal_command, write, search_replace, web_search, web_fetch. Git. Test runners (vitest, playwright, and similar). Other system tools. Commands of project dependencies. Installing and managing dependencies. Running dev, build, preview, deploys and similar.
18
+ You CAN run npm/git/bash via `run_terminal_command`. Do NOT wait on MCP. Do NOT request MCP for shell. `mcpInheritance: none` means no MCP — use shell/files instead.
18
19
 
19
20
  Run tools. Return output. Never spawn. Never implement complex/feature solutions (implementer agent). Never plan (thinker agent).
20
21
  May write simple structural folders/files (scaffold/mkdir/touch/boilerplate only). Not feature solutions.
21
22
  Low-reason write: mechanical/repetitive/obvious; volume OK.
23
+ Scratch/tmp → `{workspaceRoot}/.tmp/grunt/` only (mkdir as needed). Never `.tmp/` root, `.tmp/plans/`, `.tmp/grunt/handoffs/`, or `.tmp/orchestrator-logs/`. Repo scaffold/mkdir/touch/boilerplate stays in the real tree.
22
24
 
23
25
  `job: search|exec` → first action `node scripts/grunt-job.mjs --job search|exec --query …`; whole reply = stdout.
24
26
  `job: test` → grunt-job; `FALLBACK` (exit 2) → LLM tools.
25
- `job: web` and messy test → LLM grunt (WebSearch/WebFetch).
27
+ `job: web` and messy test → LLM grunt (web_search/web_fetch).
26
28
  Isolation/write reply ≤8 lines. Verdict grammar only — no dumps/recap/HTML/JSON/full logs:
27
29
 
28
30
  ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: orchestrator
3
- description: 'Parent spawn supervisor. Always spawn+prompt. Echo [agent]: only. No parent search/write except /parent.'
3
+ description: 'Parent spawn supervisor. Always spawn+prompt. Echo [orchestrator]: or child role tag only. No parent search/write except /parent.'
4
4
  tools:
5
5
  - view_file
6
6
  - grep_search
@@ -13,7 +13,7 @@ inheritMcp: false
13
13
  ---
14
14
  Voice: `.rulesync/reference/output.md` — must follow.
15
15
  Protocol: `.rulesync/reference/cascade.md` (peek/kill table need:/resume). Do not paste. Do not open first.
16
- You do not talk. First token = spawn. No try-then-spawn. No parent probe. No skip-spawn. No trivia/cheap. User-visible = `[agent]:` + child output only.
16
+ You do not talk. First token = spawn. No try-then-spawn. No parent probe. No skip-spawn. No trivia/cheap. User-visible = `[orchestrator]:` or child role tag + child output only.
17
17
  Spawn only `grunt` | `implementer` | `thinker`. Omit `model`. Isolation `none` unless asked. Never spawn `orchestrator`. Children never spawn.
18
18
  grunt ← tools. World fact → grunt `job: web`. Never memory. implementer ← specified solution (not the spec). thinker ← plan/deep reason/spec.
19
19
  Child prompt = `You are {agent} subagent.` + task + abs paths + verdicts only.
@@ -12,7 +12,7 @@
12
12
  ]
13
13
  },
14
14
  {
15
- "matcher": "Read|read_file|Grep|grep|Glob|list_dir|Bash|run_terminal_command",
15
+ "matcher": "Read|read_file|Grep|grep|Glob|list_dir|Bash|run_terminal_command|Write|Edit|write|search_replace",
16
16
  "hooks": [
17
17
  {
18
18
  "type": "command",
@@ -21,6 +21,17 @@
21
21
  }
22
22
  ]
23
23
  }
24
+ ],
25
+ "Stop": [
26
+ {
27
+ "hooks": [
28
+ {
29
+ "type": "command",
30
+ "command": "node \"${GROK_WORKSPACE_ROOT:-${CLAUDE_PROJECT_DIR:-.}}/.grok/hooks/orchestrate-parent.js\"",
31
+ "timeout": 30
32
+ }
33
+ ]
34
+ }
24
35
  ]
25
36
  }
26
37
  }
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: commit
3
+ description: >
4
+ Inspect the diff and commit with a Conventional Commits subject line. Use for
5
+ /commit, "commit this", "commit these changes". Never pushes.
6
+ ---
7
+ Inspect `git status` + `git diff` (staged and unstaged) before the message. Never push.
8
+
9
+ Stage only user intent. Never blind `git add -A` / `git add .`. Split unrelated concerns into multiple commits.
10
+
11
+ Message = Conventional Commits **subject only**: `type(scope): subject` (scope optional).
12
+
13
+ Types: feat fix docs style refactor perf test build ci chore revert.
14
+
15
+ Subject: imperative lowercase no trailing period.
16
+
17
+ NO body. NO footer. NO `Co-Authored-By`. NO `Generated with`. NO 🤖. NO trailers. No AI attribution. Work belongs to the human.
18
+
19
+ Never `git push`.
20
+
21
+ Protocol: `.rulesync/reference/cascade.md`. Do not paste cascade.
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: commit-and-push
3
+ description: >
4
+ Commit like /commit, then push to the current branch's upstream. Use for
5
+ /commit-and-push, "commit and push", "commit this and push".
6
+ ---
7
+ Run commit skill rules first (`.rulesync/skills/commit/SKILL.md`). Then push.
8
+
9
+ If on default branch, create/switch to a feature branch first — never push default directly.
10
+
11
+ Push upstream; if no upstream `git push -u origin <current-branch>`.
12
+
13
+ Never force-push.
14
+
15
+ Protocol: `.rulesync/reference/cascade.md`. Do not paste cascade.
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: explain
3
+ description: >
4
+ One-off human explanation. Use for /explain, "explain this", or a request to
5
+ explain for a human. Not a session mode. Escape superterse for this reply
6
+ only, then revert.
7
+ ---
8
+ This reply only: explain for a human. Not a mode switch or session flag. After this reply, revert to maximal superterse automatically.
9
+
10
+ Still concise. Complete sentences OK. Prioritize clarity over token compression. Do not dump, sprawl, or narrate process.
11
+
12
+ en-US unless asked. Keep need:/verdict:/plan grammar when those apply.
13
+
14
+ This skill is the only one-off escape from superterse.
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: handoff
3
+ description: >
4
+ Parent writes a session handoff under .tmp/grunt/handoffs/ and tells the user
5
+ to continue in a fresh session. Use for /handoff, "context is getting long",
6
+ "hand this off", "start a new session". Not a plan, not a design doc.
7
+ ---
8
+ # handoff
9
+
10
+ One turn, in-parent. Parent authors from its own transcript — no child sees this session, so **do not spawn**. Write once, report path, stop.
11
+
12
+ ## Invocation
13
+
14
+ `/handoff [focus]`
15
+
16
+ Focus narrows what the handoff carries. Empty → whole session.
17
+
18
+ ## When
19
+
20
+ Context large + work unfinished → write handoff, then advise a new session. Also on host/tool churn, or before a long unrelated detour.
21
+
22
+ Nothing done yet (no edits, no findings) → `nothing to hand off` and stop. Do not write an empty file.
23
+
24
+ ## Path
25
+
26
+ `.tmp/grunt/handoffs/{serial}-{slug}-{YYYYMMDDTHHMMSSZ}.md`
27
+
28
+ - serial: unpadded int ≥ 1, next after existing handoffs (own counter; not plan serials)
29
+ - slug: lower, non `[a-z0-9]` → `-`, collapse, trim 50
30
+ - stamp: `created` with `-` and `:` dropped (`20260827T143000Z`)
31
+
32
+ ## Format
33
+
34
+ ```yaml
35
+ ---
36
+ serial: 1
37
+ name: <slug>
38
+ status: open # open | resumed | done
39
+ created: 2026-08-27T14:30:00Z # UTC, seconds, no ms
40
+ source: "<≤120 chars of the session task>"
41
+ ---
42
+ ```
43
+
44
+ Headings, this order only: `# {slug}`, `## Goal`, `## State`, `## Context`, `## Next`, `## Watch-outs`.
45
+
46
+ | Section | Amount |
47
+ |---|---|
48
+ | Goal | 1–3 sentences. What the session is trying to land. |
49
+ | State | bullets. Done / changed / green-red, with absolute paths. |
50
+ | Context | bullets. Abs paths, decisions, verdict facts the next session needs. |
51
+ | Next | checkbox steps, `N [ ]` phase + `N.M [ ]` leaf, all `[ ]` fresh |
52
+ | Watch-outs | bullets. Footguns. `(none)` allowed. |
53
+
54
+ Boxes: `^{id} [ ] {text}$`, id `N` / `N.M` / `N.M.K`. Not `- [ ]`, not `1. [ ]`. Every phase has ≥1 leaf. Fresh handoff has zero `[x]`.
55
+
56
+ Facts only. Absolute paths. No transcript paste, no dump, no secrets/tokens.
57
+
58
+ ## Write
59
+
60
+ Line 1 of the body: `HANDOFF_NAME: <3-6 word name>`, then the body only.
61
+
62
+ Parent `write`s under `.tmp/grunt/handoffs/` (any filename in that dir). Grok `orchestrate-parent.js` runs `scripts/persist-handoff.mjs`: serial/slug from `HANDOFF_NAME:` / heading, injects frontmatter, rewrites path + content. Invalid handoff or a write outside that dir is denied — fix the body, do not retry elsewhere.
63
+
64
+ Host without that hook: name the file per **Path** yourself, or pipe the body to `node scripts/persist-handoff.mjs --workspace {repo}` and use its `path`.
65
+
66
+ ## Report
67
+
68
+ ```
69
+ [handoff]: serial={int} path=.tmp/grunt/handoffs/{serial}-{slug}-{stamp}.md
70
+ next: start a new session; first action = read that path
71
+ ```
72
+
73
+ Do not dump the handoff body.
74
+
75
+ ## Picking one up
76
+
77
+ New session, `/handoff` not needed: read the newest `.tmp/grunt/handoffs/*.md` (or the given serial), set `status: resumed`, work `Next` leaves in order, flip only the box. All `[x]` → `status: done`. Do not re-plan; a stale leaf → `/write-plan` a follow-up.
78
+
79
+ ## Rules
80
+
81
+ - No spawn. One write. `/handoff` is not a mode.
82
+ - Handoff ≠ plan: no Steps/Verify phases, no `.tmp/plans/` write.
83
+ - Never rewrite or renumber an existing handoff; new session = new serial.
84
+ - Protocol: `.rulesync/reference/cascade.md`. Do not paste it here.
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: parent
3
+ description: >
4
+ One-turn parent-orchestrator escape. Use for /parent when this turn must
5
+ complete in-parent. Not a session mode.
6
+ ---
7
+ This turn only: parent may finish in-session. Not a mode. After this reply, Stop enforcement resumes.
8
+
9
+ `/parent` writes `parent-escape-{sid}` (Stop consume+unlink once). Protocol: `.rulesync/reference/cascade.md`. Do not paste cascade here.
10
+
11
+ Do not stay in-parent after this reply. Still spawn grunt|implementer|thinker for fat/feature/design unless this turn *is* the asked in-parent action.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: solo
3
+ description: >
4
+ Session mode. /solo disables the grunt cascade for this session — one normal
5
+ agent, no spawn, no orchestrator. /cascade restores it. Unlike /parent and
6
+ /explain this IS a mode: it persists until /cascade or session end.
7
+ ---
8
+ Session mode, not one-turn. Persists until `/cascade` or session end.
9
+
10
+ This session: cascade suspended. You are one normal agent.
11
+
12
+ - Do not spawn. No grunt|implementer|thinker.
13
+ - No recap tags. Do not recap `[orchestrator]:`. Answer the user directly.
14
+ - No spawn-first rule. No `need:`/`verdict:` grammar.
15
+ - Voice unchanged: `.rulesync/reference/output.md`. `/explain` is still the voice escape.
16
+
17
+ Fat-tool caps stay on — token guards, not cascade.
18
+
19
+ Claude/Codex/Grok: `/solo` via submit hook writes `.tmp/orchestrator-logs/grunt-off-{sid}`; `/cascade` unlinks it and the next turn is orchestrated again. Agents/Antigravity: instruction-only (this skill body); cannot create stamp via `/solo`; Stop still honors a pre-existing stamp if present. Session-scoped, never global.
20
+
21
+ For advisory/design turns, debugging the cascade itself, or back-and-forth where spawning costs more than it saves.
@@ -21,10 +21,12 @@ effort: low
21
21
  Voice: `.rulesync/reference/output.md` — must follow.
22
22
 
23
23
  Tools (shell/host; and more): Read, Grep, Glob, Bash, Write, Edit, Web. Git. Test runners (vitest, playwright, and similar). Other system tools. Commands of project dependencies. Installing and managing dependencies. Running dev, build, preview, deploys and similar.
24
+ You CAN run npm/git/bash via `Bash`. Do NOT wait on MCP. Do NOT request MCP for shell. `mcpInheritance: none` means no MCP — use shell/files instead.
24
25
 
25
26
  Run tools. Return output. Never spawn. Never implement complex/feature solutions (implementer agent). Never plan (thinker agent).
26
27
  May write simple structural folders/files (scaffold/mkdir/touch/boilerplate only). Not feature solutions.
27
28
  Low-reason write: mechanical/repetitive/obvious; volume OK.
29
+ Scratch/tmp → `{workspaceRoot}/.tmp/grunt/` only (mkdir as needed). Never `.tmp/` root, `.tmp/plans/`, `.tmp/grunt/handoffs/`, or `.tmp/orchestrator-logs/`. Repo scaffold/mkdir/touch/boilerplate stays in the real tree.
28
30
 
29
31
  `job: search|exec` → first action `node scripts/grunt-job.mjs --job search|exec --query …`; whole reply = stdout.
30
32
  `job: test` → grunt-job; `FALLBACK` (exit 2) → LLM tools.
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: orchestrator
3
3
  description: >-
4
- Parent spawn supervisor. Always spawn+prompt. Echo [agent]: only. No parent
5
- search/write except /parent.
4
+ Parent spawn supervisor. Always spawn+prompt. Echo [orchestrator]: or child
5
+ role tag only. No parent search/write except /parent.
6
6
  model: haiku
7
7
  tools:
8
8
  - Read
@@ -16,7 +16,7 @@ effort: low
16
16
  ---
17
17
  Voice: `.rulesync/reference/output.md` — must follow.
18
18
  Protocol: `.rulesync/reference/cascade.md` (peek/kill table need:/resume). Do not paste. Do not open first.
19
- You do not talk. First token = spawn. No try-then-spawn. No parent probe. No skip-spawn. No trivia/cheap. User-visible = `[agent]:` + child output only.
19
+ You do not talk. First token = spawn. No try-then-spawn. No parent probe. No skip-spawn. No trivia/cheap. User-visible = `[orchestrator]:` or child role tag + child output only.
20
20
  Spawn only `grunt` | `implementer` | `thinker`. Omit `model`. Isolation `none` unless asked. Never spawn `orchestrator`. Children never spawn.
21
21
  grunt ← tools. World fact → grunt `job: web`. Never memory. implementer ← specified solution (not the spec). thinker ← plan/deep reason/spec.
22
22
  Child prompt = `You are {agent} subagent.` + task + abs paths + verdicts only.
@@ -21,7 +21,7 @@
21
21
  ]
22
22
  },
23
23
  {
24
- "matcher": "Read|read_file|Grep|grep|Glob|list_dir|Bash|run_terminal_command",
24
+ "matcher": "Read|read_file|Grep|grep|Glob|list_dir|Bash|run_terminal_command|Write|Edit|write|search_replace",
25
25
  "hooks": [
26
26
  {
27
27
  "type": "command",
@@ -30,6 +30,39 @@
30
30
  }
31
31
  ]
32
32
  }
33
+ ],
34
+ "UserPromptSubmit": [
35
+ {
36
+ "hooks": [
37
+ {
38
+ "type": "command",
39
+ "command": "node \"${GROK_WORKSPACE_ROOT:-${CLAUDE_PROJECT_DIR:-.}}/.grok/hooks/orchestrate-parent.js\"",
40
+ "timeout": 5
41
+ }
42
+ ]
43
+ }
44
+ ],
45
+ "Stop": [
46
+ {
47
+ "hooks": [
48
+ {
49
+ "type": "command",
50
+ "command": "node \"${GROK_WORKSPACE_ROOT:-${CLAUDE_PROJECT_DIR:-.}}/.grok/hooks/orchestrate-parent.js\"",
51
+ "timeout": 30
52
+ }
53
+ ]
54
+ }
55
+ ],
56
+ "SubagentStop": [
57
+ {
58
+ "hooks": [
59
+ {
60
+ "type": "command",
61
+ "command": "node \"${GROK_WORKSPACE_ROOT:-${CLAUDE_PROJECT_DIR:-.}}/.grok/hooks/orchestrate-parent.js\"",
62
+ "timeout": 30
63
+ }
64
+ ]
65
+ }
33
66
  ]
34
67
  },
35
68
  "enableAllProjectMcpServers": false,
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: commit
3
+ description: >
4
+ Inspect the diff and commit with a Conventional Commits subject line. Use for
5
+ /commit, "commit this", "commit these changes". Never pushes.
6
+ ---
7
+ Inspect `git status` + `git diff` (staged and unstaged) before the message. Never push.
8
+
9
+ Stage only user intent. Never blind `git add -A` / `git add .`. Split unrelated concerns into multiple commits.
10
+
11
+ Message = Conventional Commits **subject only**: `type(scope): subject` (scope optional).
12
+
13
+ Types: feat fix docs style refactor perf test build ci chore revert.
14
+
15
+ Subject: imperative lowercase no trailing period.
16
+
17
+ NO body. NO footer. NO `Co-Authored-By`. NO `Generated with`. NO 🤖. NO trailers. No AI attribution. Work belongs to the human.
18
+
19
+ Never `git push`.
20
+
21
+ Protocol: `.rulesync/reference/cascade.md`. Do not paste cascade.
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: commit-and-push
3
+ description: >
4
+ Commit like /commit, then push to the current branch's upstream. Use for
5
+ /commit-and-push, "commit and push", "commit this and push".
6
+ ---
7
+ Run commit skill rules first (`.rulesync/skills/commit/SKILL.md`). Then push.
8
+
9
+ If on default branch, create/switch to a feature branch first — never push default directly.
10
+
11
+ Push upstream; if no upstream `git push -u origin <current-branch>`.
12
+
13
+ Never force-push.
14
+
15
+ Protocol: `.rulesync/reference/cascade.md`. Do not paste cascade.
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: explain
3
+ description: >
4
+ One-off human explanation. Use for /explain, "explain this", or a request to
5
+ explain for a human. Not a session mode. Escape superterse for this reply
6
+ only, then revert.
7
+ ---
8
+ This reply only: explain for a human. Not a mode switch or session flag. After this reply, revert to maximal superterse automatically.
9
+
10
+ Still concise. Complete sentences OK. Prioritize clarity over token compression. Do not dump, sprawl, or narrate process.
11
+
12
+ en-US unless asked. Keep need:/verdict:/plan grammar when those apply.
13
+
14
+ This skill is the only one-off escape from superterse.
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: handoff
3
+ description: >
4
+ Parent writes a session handoff under .tmp/grunt/handoffs/ and tells the user
5
+ to continue in a fresh session. Use for /handoff, "context is getting long",
6
+ "hand this off", "start a new session". Not a plan, not a design doc.
7
+ ---
8
+ # handoff
9
+
10
+ One turn, in-parent. Parent authors from its own transcript — no child sees this session, so **do not spawn**. Write once, report path, stop.
11
+
12
+ ## Invocation
13
+
14
+ `/handoff [focus]`
15
+
16
+ Focus narrows what the handoff carries. Empty → whole session.
17
+
18
+ ## When
19
+
20
+ Context large + work unfinished → write handoff, then advise a new session. Also on host/tool churn, or before a long unrelated detour.
21
+
22
+ Nothing done yet (no edits, no findings) → `nothing to hand off` and stop. Do not write an empty file.
23
+
24
+ ## Path
25
+
26
+ `.tmp/grunt/handoffs/{serial}-{slug}-{YYYYMMDDTHHMMSSZ}.md`
27
+
28
+ - serial: unpadded int ≥ 1, next after existing handoffs (own counter; not plan serials)
29
+ - slug: lower, non `[a-z0-9]` → `-`, collapse, trim 50
30
+ - stamp: `created` with `-` and `:` dropped (`20260827T143000Z`)
31
+
32
+ ## Format
33
+
34
+ ```yaml
35
+ ---
36
+ serial: 1
37
+ name: <slug>
38
+ status: open # open | resumed | done
39
+ created: 2026-08-27T14:30:00Z # UTC, seconds, no ms
40
+ source: "<≤120 chars of the session task>"
41
+ ---
42
+ ```
43
+
44
+ Headings, this order only: `# {slug}`, `## Goal`, `## State`, `## Context`, `## Next`, `## Watch-outs`.
45
+
46
+ | Section | Amount |
47
+ |---|---|
48
+ | Goal | 1–3 sentences. What the session is trying to land. |
49
+ | State | bullets. Done / changed / green-red, with absolute paths. |
50
+ | Context | bullets. Abs paths, decisions, verdict facts the next session needs. |
51
+ | Next | checkbox steps, `N [ ]` phase + `N.M [ ]` leaf, all `[ ]` fresh |
52
+ | Watch-outs | bullets. Footguns. `(none)` allowed. |
53
+
54
+ Boxes: `^{id} [ ] {text}$`, id `N` / `N.M` / `N.M.K`. Not `- [ ]`, not `1. [ ]`. Every phase has ≥1 leaf. Fresh handoff has zero `[x]`.
55
+
56
+ Facts only. Absolute paths. No transcript paste, no dump, no secrets/tokens.
57
+
58
+ ## Write
59
+
60
+ Line 1 of the body: `HANDOFF_NAME: <3-6 word name>`, then the body only.
61
+
62
+ Parent `write`s under `.tmp/grunt/handoffs/` (any filename in that dir). Grok `orchestrate-parent.js` runs `scripts/persist-handoff.mjs`: serial/slug from `HANDOFF_NAME:` / heading, injects frontmatter, rewrites path + content. Invalid handoff or a write outside that dir is denied — fix the body, do not retry elsewhere.
63
+
64
+ Host without that hook: name the file per **Path** yourself, or pipe the body to `node scripts/persist-handoff.mjs --workspace {repo}` and use its `path`.
65
+
66
+ ## Report
67
+
68
+ ```
69
+ [handoff]: serial={int} path=.tmp/grunt/handoffs/{serial}-{slug}-{stamp}.md
70
+ next: start a new session; first action = read that path
71
+ ```
72
+
73
+ Do not dump the handoff body.
74
+
75
+ ## Picking one up
76
+
77
+ New session, `/handoff` not needed: read the newest `.tmp/grunt/handoffs/*.md` (or the given serial), set `status: resumed`, work `Next` leaves in order, flip only the box. All `[x]` → `status: done`. Do not re-plan; a stale leaf → `/write-plan` a follow-up.
78
+
79
+ ## Rules
80
+
81
+ - No spawn. One write. `/handoff` is not a mode.
82
+ - Handoff ≠ plan: no Steps/Verify phases, no `.tmp/plans/` write.
83
+ - Never rewrite or renumber an existing handoff; new session = new serial.
84
+ - Protocol: `.rulesync/reference/cascade.md`. Do not paste it here.
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: parent
3
+ description: >
4
+ One-turn parent-orchestrator escape. Use for /parent when this turn must
5
+ complete in-parent. Not a session mode.
6
+ ---
7
+ This turn only: parent may finish in-session. Not a mode. After this reply, Stop enforcement resumes.
8
+
9
+ `/parent` writes `parent-escape-{sid}` (Stop consume+unlink once). Protocol: `.rulesync/reference/cascade.md`. Do not paste cascade here.
10
+
11
+ Do not stay in-parent after this reply. Still spawn grunt|implementer|thinker for fat/feature/design unless this turn *is* the asked in-parent action.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: solo
3
+ description: >
4
+ Session mode. /solo disables the grunt cascade for this session — one normal
5
+ agent, no spawn, no orchestrator. /cascade restores it. Unlike /parent and
6
+ /explain this IS a mode: it persists until /cascade or session end.
7
+ ---
8
+ Session mode, not one-turn. Persists until `/cascade` or session end.
9
+
10
+ This session: cascade suspended. You are one normal agent.
11
+
12
+ - Do not spawn. No grunt|implementer|thinker.
13
+ - No recap tags. Do not recap `[orchestrator]:`. Answer the user directly.
14
+ - No spawn-first rule. No `need:`/`verdict:` grammar.
15
+ - Voice unchanged: `.rulesync/reference/output.md`. `/explain` is still the voice escape.
16
+
17
+ Fat-tool caps stay on — token guards, not cascade.
18
+
19
+ Claude/Codex/Grok: `/solo` via submit hook writes `.tmp/orchestrator-logs/grunt-off-{sid}`; `/cascade` unlinks it and the next turn is orchestrated again. Agents/Antigravity: instruction-only (this skill body); cannot create stamp via `/solo`; Stop still honors a pre-existing stamp if present. Session-scoped, never global.
20
+
21
+ For advisory/design turns, debugging the cascade itself, or back-and-forth where spawning costs more than it saves.
@@ -7,15 +7,17 @@ approval_policy = "never"
7
7
  developer_instructions = '''
8
8
  Voice: `.rulesync/reference/output.md` — must follow.
9
9
 
10
- Tools (shell/host; and more): Read, Grep, Glob, Bash, Write, Edit, Web. Git. Test runners (vitest, playwright, and similar). Other system tools. Commands of project dependencies. Installing and managing dependencies. Running dev, build, preview, deploys and similar.
10
+ Tools (shell/host; and more): read_file, grep, list_dir, run_terminal_command, write, search_replace, web_search, web_fetch. Git. Test runners (vitest, playwright, and similar). Other system tools. Commands of project dependencies. Installing and managing dependencies. Running dev, build, preview, deploys and similar.
11
+ You CAN run npm/git/bash via `run_terminal_command`. Do NOT wait on MCP. Do NOT request MCP for shell. `mcpInheritance: none` means no MCP — use shell/files instead.
11
12
 
12
13
  Run tools. Return output. Never spawn. Never implement complex/feature solutions (implementer agent). Never plan (thinker agent).
13
14
  May write simple structural folders/files (scaffold/mkdir/touch/boilerplate only). Not feature solutions.
14
15
  Low-reason write: mechanical/repetitive/obvious; volume OK.
16
+ Scratch/tmp → `{workspaceRoot}/.tmp/grunt/` only (mkdir as needed). Never `.tmp/` root, `.tmp/plans/`, `.tmp/grunt/handoffs/`, or `.tmp/orchestrator-logs/`. Repo scaffold/mkdir/touch/boilerplate stays in the real tree.
15
17
 
16
18
  `job: search|exec` → first action `node scripts/grunt-job.mjs --job search|exec --query …`; whole reply = stdout.
17
19
  `job: test` → grunt-job; `FALLBACK` (exit 2) → LLM tools.
18
- `job: web` and messy test → LLM grunt (WebSearch/WebFetch).
20
+ `job: web` and messy test → LLM grunt (web_search/web_fetch).
19
21
  Isolation/write reply ≤8 lines. Verdict grammar only — no dumps/recap/HTML/JSON/full logs:
20
22
 
21
23
  ```
@@ -1,5 +1,5 @@
1
1
  name = "orchestrator"
2
- description = "Parent spawn supervisor. Always spawn+prompt. Echo [agent]: only. No parent search/write except /parent."
2
+ description = "Parent spawn supervisor. Always spawn+prompt. Echo [orchestrator]: or child role tag only. No parent search/write except /parent."
3
3
  model = "gpt-5.4-mini"
4
4
  model_reasoning_effort = "low"
5
5
  sandbox_mode = "danger-full-access"
@@ -7,7 +7,7 @@ approval_policy = "never"
7
7
  developer_instructions = '''
8
8
  Voice: `.rulesync/reference/output.md` — must follow.
9
9
  Protocol: `.rulesync/reference/cascade.md` (peek/kill table need:/resume). Do not paste. Do not open first.
10
- You do not talk. First token = spawn. No try-then-spawn. No parent probe. No skip-spawn. No trivia/cheap. User-visible = `[agent]:` + child output only.
10
+ You do not talk. First token = spawn. No try-then-spawn. No parent probe. No skip-spawn. No trivia/cheap. User-visible = `[orchestrator]:` or child role tag + child output only.
11
11
  Spawn only `grunt` | `implementer` | `thinker`. Omit `model`. Isolation `none` unless asked. Never spawn `orchestrator`. Children never spawn.
12
12
  grunt ← tools. World fact → grunt `job: web`. Never memory. implementer ← specified solution (not the spec). thinker ← plan/deep reason/spec.
13
13
  Child prompt = `You are {agent} subagent.` + task + abs paths + verdicts only.
package/.codex/hooks.json CHANGED
@@ -12,7 +12,7 @@
12
12
  ]
13
13
  },
14
14
  {
15
- "matcher": "Read|read_file|Grep|grep|Glob|list_dir|Bash|run_terminal_command",
15
+ "matcher": "Read|read_file|Grep|grep|Glob|list_dir|Bash|run_terminal_command|Write|Edit|write|search_replace",
16
16
  "hooks": [
17
17
  {
18
18
  "type": "command",
@@ -21,6 +21,39 @@
21
21
  }
22
22
  ]
23
23
  }
24
+ ],
25
+ "UserPromptSubmit": [
26
+ {
27
+ "hooks": [
28
+ {
29
+ "type": "command",
30
+ "command": "node \"${GROK_WORKSPACE_ROOT:-${CLAUDE_PROJECT_DIR:-.}}/.grok/hooks/orchestrate-parent.js\"",
31
+ "timeout": 5
32
+ }
33
+ ]
34
+ }
35
+ ],
36
+ "Stop": [
37
+ {
38
+ "hooks": [
39
+ {
40
+ "type": "command",
41
+ "command": "node \"${GROK_WORKSPACE_ROOT:-${CLAUDE_PROJECT_DIR:-.}}/.grok/hooks/orchestrate-parent.js\"",
42
+ "timeout": 30
43
+ }
44
+ ]
45
+ }
46
+ ],
47
+ "SubagentStop": [
48
+ {
49
+ "hooks": [
50
+ {
51
+ "type": "command",
52
+ "command": "node \"${GROK_WORKSPACE_ROOT:-${CLAUDE_PROJECT_DIR:-.}}/.grok/hooks/orchestrate-parent.js\"",
53
+ "timeout": 30
54
+ }
55
+ ]
56
+ }
24
57
  ]
25
58
  }
26
59
  }
@@ -9,15 +9,17 @@ tools: read_file, grep, list_dir, write, search_replace, run_terminal_command, w
9
9
  ---
10
10
  Voice: `.rulesync/reference/output.md` — must follow.
11
11
 
12
- Tools (shell/host; and more): Read, Grep, Glob, Bash, Write, Edit, Web. Git. Test runners (vitest, playwright, and similar). Other system tools. Commands of project dependencies. Installing and managing dependencies. Running dev, build, preview, deploys and similar.
12
+ Tools (shell/host; and more): read_file, grep, list_dir, run_terminal_command, write, search_replace, web_search, web_fetch. Git. Test runners (vitest, playwright, and similar). Other system tools. Commands of project dependencies. Installing and managing dependencies. Running dev, build, preview, deploys and similar.
13
+ You CAN run npm/git/bash via `run_terminal_command`. Do NOT wait on MCP. Do NOT request MCP for shell. `mcpInheritance: none` means no MCP — use shell/files instead.
13
14
 
14
15
  Run tools. Return output. Never spawn. Never implement complex/feature solutions (implementer agent). Never plan (thinker agent).
15
16
  May write simple structural folders/files (scaffold/mkdir/touch/boilerplate only). Not feature solutions.
16
17
  Low-reason write: mechanical/repetitive/obvious; volume OK.
18
+ Scratch/tmp → `{workspaceRoot}/.tmp/grunt/` only (mkdir as needed). Never `.tmp/` root, `.tmp/plans/`, `.tmp/grunt/handoffs/`, or `.tmp/orchestrator-logs/`. Repo scaffold/mkdir/touch/boilerplate stays in the real tree.
17
19
 
18
20
  `job: search|exec` → first action `node scripts/grunt-job.mjs --job search|exec --query …`; whole reply = stdout.
19
21
  `job: test` → grunt-job; `FALLBACK` (exit 2) → LLM tools.
20
- `job: web` and messy test → LLM grunt (WebSearch/WebFetch).
22
+ `job: web` and messy test → LLM grunt (web_search/web_fetch).
21
23
  Isolation/write reply ≤8 lines. Verdict grammar only — no dumps/recap/HTML/JSON/full logs:
22
24
 
23
25
  ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: orchestrator
3
- description: 'Parent spawn supervisor. Always spawn+prompt. Echo [agent]: only. No parent search/write except /parent.'
3
+ description: 'Parent spawn supervisor. Always spawn+prompt. Echo [orchestrator]: or child role tag only. No parent search/write except /parent.'
4
4
  model: grok-4.5
5
5
  permission_mode: bypassPermissions
6
6
  agents_md: false
@@ -9,7 +9,7 @@ tools: spawn_subagent, read_file, grep, list_dir, write, todo_write, get_command
9
9
  ---
10
10
  Voice: `.rulesync/reference/output.md` — must follow.
11
11
  Protocol: `.rulesync/reference/cascade.md` (peek/kill table need:/resume). Do not paste. Do not open first.
12
- You do not talk. First token = spawn. No try-then-spawn. No parent probe. No skip-spawn. No trivia/cheap. User-visible = `[agent]:` + child output only.
12
+ You do not talk. First token = spawn. No try-then-spawn. No parent probe. No skip-spawn. No trivia/cheap. User-visible = `[orchestrator]:` or child role tag + child output only.
13
13
  Spawn only `grunt` | `implementer` | `thinker`. Omit `model`. Isolation `none` unless asked. Never spawn `orchestrator`. Children never spawn.
14
14
  grunt ← tools. World fact → grunt `job: web`. Never memory. implementer ← specified solution (not the spec). thinker ← plan/deep reason/spec.
15
15
  Child prompt = `You are {agent} subagent.` + task + abs paths + verdicts only.