@imdeadpool/guardex 7.0.41 → 7.1.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 (118) hide show
  1. package/README.md +94 -13
  2. package/package.json +3 -1
  3. package/skills/gitguardex/SKILL.md +13 -0
  4. package/skills/guardex-merge-skills-to-dev/SKILL.md +59 -0
  5. package/skills/gx-act/SKILL.md +82 -0
  6. package/src/agents/cleanup-sessions.js +126 -0
  7. package/src/agents/finish.js +172 -0
  8. package/src/agents/inspect.js +202 -0
  9. package/src/agents/launch.js +249 -0
  10. package/src/agents/registry.js +133 -0
  11. package/src/agents/selection-panel.js +571 -0
  12. package/src/agents/sessions.js +151 -0
  13. package/src/agents/start.js +591 -0
  14. package/src/agents/status.js +146 -0
  15. package/src/agents/terminal.js +152 -0
  16. package/src/budget/index.js +344 -0
  17. package/src/ci-init/index.js +265 -0
  18. package/src/cli/args.js +357 -3
  19. package/src/cli/commands/agents.js +364 -0
  20. package/src/cli/commands/bootstrap.js +92 -0
  21. package/src/cli/commands/branch.js +127 -0
  22. package/src/cli/commands/claude.js +674 -0
  23. package/src/cli/commands/doctor.js +268 -0
  24. package/src/cli/commands/finish.js +26 -0
  25. package/src/cli/commands/mcp.js +122 -0
  26. package/src/cli/commands/misc.js +304 -0
  27. package/src/cli/commands/pr.js +439 -0
  28. package/src/cli/commands/prompt.js +92 -0
  29. package/src/cli/commands/release.js +305 -0
  30. package/src/cli/commands/report.js +244 -0
  31. package/src/cli/commands/review.js +32 -0
  32. package/src/cli/commands/setup.js +242 -0
  33. package/src/cli/commands/status.js +338 -0
  34. package/src/cli/commands/watch.js +234 -0
  35. package/src/cli/main.js +85 -3613
  36. package/src/cli/shared/repo-env.js +161 -0
  37. package/src/cli/shared/sandbox.js +417 -0
  38. package/src/cli/shared/scaffolding.js +535 -0
  39. package/src/cli/shared/toolchain-shims.js +420 -0
  40. package/src/cockpit/action-runner.js +3 -0
  41. package/src/cockpit/actions.js +80 -0
  42. package/src/cockpit/control.js +1121 -0
  43. package/src/cockpit/index.js +426 -0
  44. package/src/cockpit/kitty-layout.js +549 -0
  45. package/src/cockpit/kitty-tree.js +144 -0
  46. package/src/cockpit/logs-reader.js +182 -0
  47. package/src/cockpit/menu.js +204 -0
  48. package/src/cockpit/pane-actions.js +597 -0
  49. package/src/cockpit/pane-menu.js +387 -0
  50. package/src/cockpit/projects-finder.js +178 -0
  51. package/src/cockpit/render.js +215 -0
  52. package/src/cockpit/settings-render.js +128 -0
  53. package/src/cockpit/settings.js +124 -0
  54. package/src/cockpit/shortcuts.js +24 -0
  55. package/src/cockpit/sidebar.js +311 -0
  56. package/src/cockpit/state.js +72 -0
  57. package/src/cockpit/theme.js +128 -0
  58. package/src/cockpit/welcome.js +266 -0
  59. package/src/context.js +304 -43
  60. package/src/core/runtime.js +6 -1
  61. package/src/doctor/index.js +45 -15
  62. package/src/finish/index.js +186 -7
  63. package/src/finish/preflight.js +177 -0
  64. package/src/finish/review-gate.js +182 -0
  65. package/src/git/index.js +511 -4
  66. package/src/hooks/index.js +0 -64
  67. package/src/kitty/command.js +101 -0
  68. package/src/kitty/runtime.js +250 -0
  69. package/src/mcp/collect.js +370 -0
  70. package/src/mcp/server.js +157 -0
  71. package/src/output/index.js +68 -2
  72. package/src/pr-review.js +264 -0
  73. package/src/pr.js +381 -0
  74. package/src/sandbox/index.js +13 -2
  75. package/src/scaffold/agent-worktree-prep.js +213 -0
  76. package/src/scaffold/index.js +127 -10
  77. package/src/speckit/index.js +226 -0
  78. package/src/submodule/index.js +288 -0
  79. package/src/terminal/index.js +45 -0
  80. package/src/terminal/kitty.js +622 -0
  81. package/src/terminal/tmux.js +125 -0
  82. package/src/tmux/command.js +27 -0
  83. package/src/tmux/session.js +89 -0
  84. package/src/toolchain/index.js +20 -0
  85. package/templates/AGENTS.monorepo-apps.md +26 -0
  86. package/templates/AGENTS.multiagent-safety.md +63 -323
  87. package/templates/AGENTS.multiagent-safety.min.md +11 -0
  88. package/templates/codex/skills/gitguardex/SKILL.md +2 -0
  89. package/templates/codex/skills/gx-act/SKILL.md +82 -0
  90. package/templates/githooks/pre-commit +44 -20
  91. package/templates/github/workflows/README.md +87 -0
  92. package/templates/github/workflows/ci-full.yml +55 -0
  93. package/templates/github/workflows/ci.yml +56 -0
  94. package/templates/github/workflows/cr.yml +20 -1
  95. package/templates/scripts/agent-branch-finish.sh +519 -23
  96. package/templates/scripts/agent-branch-merge.sh +4 -1
  97. package/templates/scripts/agent-branch-start.sh +176 -24
  98. package/templates/scripts/agent-preflight.sh +115 -0
  99. package/templates/scripts/agent-worktree-prune.sh +96 -5
  100. package/templates/scripts/codex-agent.sh +41 -97
  101. package/templates/scripts/openspec/init-plan-workspace.sh +43 -0
  102. package/templates/scripts/review-bot-watch.sh +31 -2
  103. package/templates/scripts/agent-session-state.js +0 -171
  104. package/templates/scripts/install-vscode-active-agents-extension.js +0 -135
  105. package/templates/vscode/guardex-active-agents/README.md +0 -34
  106. package/templates/vscode/guardex-active-agents/extension.js +0 -3782
  107. package/templates/vscode/guardex-active-agents/fileicons/gitguardex-fileicons.json +0 -54
  108. package/templates/vscode/guardex-active-agents/fileicons/icons/agent.svg +0 -5
  109. package/templates/vscode/guardex-active-agents/fileicons/icons/branch.svg +0 -7
  110. package/templates/vscode/guardex-active-agents/fileicons/icons/config.svg +0 -4
  111. package/templates/vscode/guardex-active-agents/fileicons/icons/hook.svg +0 -4
  112. package/templates/vscode/guardex-active-agents/fileicons/icons/openspec.svg +0 -5
  113. package/templates/vscode/guardex-active-agents/fileicons/icons/plan.svg +0 -4
  114. package/templates/vscode/guardex-active-agents/fileicons/icons/spec.svg +0 -5
  115. package/templates/vscode/guardex-active-agents/icon.png +0 -0
  116. package/templates/vscode/guardex-active-agents/media/active-agents-hivemind.svg +0 -14
  117. package/templates/vscode/guardex-active-agents/package.json +0 -169
  118. package/templates/vscode/guardex-active-agents/session-schema.js +0 -1348
@@ -1,36 +1,16 @@
1
1
  <!-- multiagent-safety:START -->
2
- ## Multi-Agent Execution Contract: Guardex + Colony
2
+ ## Multi-Agent Execution Contract
3
3
 
4
- ### Repo toggle
4
+ ### Toggle
5
5
 
6
- Guardex is enabled by default.
7
-
8
- If the repo-root `.env` sets any of these values, treat this entire Guardex contract as disabled for the repo:
9
-
10
- ```text
11
- GUARDEX_ON=0
12
- GUARDEX_ON=false
13
- GUARDEX_ON=no
14
- GUARDEX_ON=off
15
- ```
16
-
17
- When disabled, do not require Guardex worktrees, lock claims, completion flow, or OpenSpec workflow until `GUARDEX_ON` is re-enabled.
18
-
19
- To explicitly enable:
20
-
21
- ```text
22
- GUARDEX_ON=1
23
- ```
6
+ Guardex is enabled by default. Disable via repo-root `.env` with `GUARDEX_ON=0|false|no|off`. Re-enable with `GUARDEX_ON=1`.
24
7
 
25
8
  ### Core rules
26
9
 
27
- - Work from an `agent/*` branch and worktree, never directly on the protected base branch.
28
- - Claim files before edits.
29
- - Use Colony for coordination before falling back to OMX state/notepad.
30
- - Use OpenSpec for durable behavior contracts and change-driven work.
31
- - Keep outputs compact: less word, same proof.
32
- - Commit, push, and open/update a PR for completed work unless the user explicitly says to keep it local.
33
- - Do not embed stale memory dumps, generated status snapshots, PR transcripts, session history, or long logs in this file.
10
+ - Work from an `agent/*` branch + worktree. **Never** edit the protected base directly.
11
+ - Claim files before editing. Confirm a path is in your claim before deleting it.
12
+ - Commit, push, and open/update a PR for completed work unless the user says keep-local.
13
+ - Keep outputs and notes compact. Less word, same proof.
34
14
 
35
15
  ### Task-size routing
36
16
 
@@ -38,237 +18,65 @@ Small tasks stay direct and caveman-only.
38
18
 
39
19
  For typos, single-file tweaks, one-liners, version bumps, comment-only changes, or similarly bounded asks, solve directly and do not escalate into heavy orchestration just because a keyword appears.
40
20
 
41
- Treat these prefixes as explicit lightweight escape hatches:
42
-
43
- - `quick:`
44
- - `simple:`
45
- - `tiny:`
46
- - `minor:`
47
- - `small:`
48
- - `just:`
49
- - `only:`
50
-
51
- Promote to full Guardex / OMX orchestration only when scope grows into:
52
-
53
- - multi-file behavior change
54
- - API/schema work
55
- - refactor
56
- - migration
57
- - architecture
58
- - cross-cutting scope
59
- - long prompt
60
- - multi-agent execution
61
-
62
- ### Colony coordination loop
63
-
64
- Use Colony as the primary coordination surface.
65
-
66
- On every startup, resume, follow-up, or "continue" request, run this order:
67
-
68
- 1. `mcp__colony__hivemind_context`
69
- 2. `mcp__colony__attention_inbox`
70
- 3. `mcp__colony__task_ready_for_agent`
71
- 4. `mcp__colony__search` only when prior decisions, earlier lanes, file history, or error context matter.
72
-
73
- Rules:
74
-
75
- - Use `task_ready_for_agent` to choose work.
76
- - Use `task_list` only for browsing/debugging. Do not use `task_list` as the normal work picker.
77
- - If an agent reaches for `task_list` repeatedly while choosing work, stop and call `task_ready_for_agent` instead. `task_list` is an inventory tool, not a scheduler.
78
- - Before editing files on an active task, call `task_claim_file` for each touched file.
79
- - Use `task_post` for task-thread notes, decisions, blockers, and working-state updates.
80
- - Use `task_message` / `task_messages` for directed agent-to-agent communication.
81
- - Use `get_observations` only after compact Colony tools return IDs worth hydrating.
82
-
83
- Fallback:
84
-
85
- - Colony is considered unavailable only when the MCP namespace is missing, the tool call fails, or the installed Colony server does not expose the required tool.
86
- - If `attention_inbox` or `task_ready_for_agent` is missing, fall back to `hivemind_context`, then `task_list`, then hydrate only the relevant task IDs.
87
- - Do not skip Colony just because OMX state exists. OMX is fallback, not the first coordination source.
88
- - Read `.omx/state` and `.omx/notepad.md` only when Colony is unavailable, missing the needed state, or the task explicitly depends on legacy OMX state.
89
- - Keep `.omx/notepad.md` lean: live handoffs only.
90
-
91
- ### Working-state notes
92
-
93
- Colony is preferred over generic notepad state.
94
-
95
- A working-state note should be task-scoped, searchable, and useful to another agent resuming the lane.
96
-
97
- When saving progress, use a task-scoped Colony note when possible:
98
-
99
- ```text
100
- task_post kind=note
101
- content="branch=<branch>; task=<task>; blocker=<blocker>; next=<next>; evidence=<path|command|PR|spec>"
102
- ```
103
-
104
- Use exactly these fields for handoff-style notes:
21
+ Lightweight escape prefixes: `quick:`, `simple:`, `tiny:`, `minor:`, `small:`, `just:`, `only:`.
105
22
 
106
- - `branch`
107
- - `task`
108
- - `blocker`
109
- - `next`
110
- - `evidence`
23
+ Promote to full Guardex / OMX orchestration only when scope grows into multi-file behavior change, API/schema work, refactor, migration, architecture, cross-cutting scope, long prompt, or multi-agent execution.
111
24
 
112
- Do not store long proof dumps, stale narrative, or full logs in notepads. Put bulky proof in OpenSpec artifacts, PRs, or command output.
25
+ ### Isolation (the load-bearing rule)
113
26
 
114
- ### Token / context budget
115
-
116
- Default: less word, same proof.
117
-
118
- - For prompts about `token inefficiency`, `reviewer mode`, `minimal token overhead`, or session waste patterns, switch into low-overhead mode.
119
- - Plan in at most 4 bullets.
120
- - Execute by phase.
121
- - Batch related reads and commands.
122
- - Avoid duplicate reads and interactive loops.
123
- - Keep outputs compact.
124
- - Verify once per phase.
125
- - Low output alone is not a defect. A bounded run that finishes in roughly <=10 steps is usually fine.
126
- - Low output spread across 20+ steps with rising per-turn input is fragmentation and should be treated as context growth first.
127
- - Startup / resume summaries stay tiny: `branch`, `task`, `blocker`, `next`, and `evidence`.
128
- - Front-load scaffold/path discovery into one grouped inspection pass. Avoid serial `ls` / `find` / `rg` / `cat` retries that rediscover the same path state.
129
- - Treat repeated `write_stdin`, repeated `sed` / `cat` peeks, and tiny diagnostic follow-up checks as strong negative signals.
130
- - If a session turns fragmented, collapse back to inspect once, patch once, verify once, and summarize once.
131
- - Tool / hook summaries stay tiny: command, status, last meaningful lines only. Drop routine hook boilerplate.
132
- - Keep raw terminal interaction out of long-lived context. For `write_stdin` or interactive babysitting, retain only process, action sent, current result, and next action.
133
- - Keep execution log separate from reasoning context: full commands/stdout belong in logs, while prompt context keeps only the latest 1-2 checkpoints plus the newest tool-result summary.
134
- - Treat local edit/commit, remote publish/PR, CI diagnosis, and cleanup as bounded phases.
135
- - Do not spend fresh narration or approval turns on obvious safe follow-ons inside an already authorized phase unless the risk changes.
136
-
137
- ### Caveman style
138
-
139
- Commentary and progress updates use smart-caveman `ultra` by default:
140
-
141
- - Answer order stays fixed: answer first, cause next, fix or next step last.
142
- - drop filler
143
- - use fragments when clear
144
- - answer first
145
- - cause next
146
- - fix or next step last
147
-
148
- Keep exact literals unchanged:
149
-
150
- - code
151
- - commands
152
- - file paths
153
- - flags
154
- - env vars
155
- - URLs
156
- - numbers
157
- - timestamps
158
- - error text
159
-
160
- Switch back to `lite` or normal wording for:
161
-
162
- - security warnings
163
- - irreversible actions
164
- - privacy/compliance notes
165
- - ordered instructions where fragments may confuse
166
- - confused users
167
- - commits
168
- - PR text
169
- - specs
170
- - logs
171
- - blocker evidence
172
-
173
- Never caveman-compress commands, file paths, specs, logs, or blocker evidence.
174
-
175
- ### Isolation
176
-
177
- Every task runs on a dedicated `agent/*` branch and worktree.
178
-
179
- Start with:
27
+ Every task = one `agent/*` branch + worktree. Start with:
180
28
 
181
29
  ```bash
182
30
  gx branch start "<task>" "<agent-name>"
183
31
  ```
184
32
 
185
- Treat the base branch (`main` / `dev`) as read-only while an agent branch is active.
186
-
187
- For every new task, including follow-up work in the same chat/session, if an assigned agent sub-branch/worktree is already open, continue in that sub-branch instead of creating a fresh lane unless the user explicitly redirects scope.
33
+ Then `cd` into the printed worktree path. Every subsequent git command runs from inside that worktree.
188
34
 
189
- Never implement directly on the local/base branch checkout. Keep it unchanged and perform all edits in the agent sub-branch/worktree.
35
+ If a worktree is already open for this chat/session, **continue in it** instead of spawning a fresh lane unless the user redirects scope.
190
36
 
191
37
  ### Primary-tree lock
192
38
 
193
39
  On the primary checkout, do not run:
194
40
 
195
41
  ```bash
196
- git checkout <ref>
197
- git switch <ref>
198
- git switch -c ...
199
- git checkout -b ...
200
- git worktree add <path> <existing-agent-branch>
42
+ git checkout <ref> git switch <ref>
43
+ git switch -c ... git checkout -b ...
44
+ git worktree add <p> <agent-branch>
201
45
  ```
202
46
 
203
- Allowed on primary:
47
+ Allowed on primary: `git fetch`, `git pull --ff-only`. Anything else needs `gx branch start` first.
204
48
 
205
- ```bash
206
- git fetch
207
- git pull --ff-only
208
- ```
209
-
210
- To work on any `agent/*` branch, run `gx branch start ...` first, then `cd` into the printed worktree path and run every subsequent git command from inside that worktree.
211
-
212
- If you are about to type `git checkout agent/...` or `git switch agent/...` from the primary checkout, stop. That is the mistake that flips primary onto an agent branch.
49
+ If you are about to type `git checkout agent/...` from the primary checkout, **stop** — that is the mistake that flips primary onto an agent branch.
213
50
 
214
51
  ### Dirty-tree rule
215
52
 
216
- Finish or stash edits inside the worktree they belong to before any branch switch on primary.
217
-
218
- The post-checkout guard may auto-stash a dirty primary tree as:
219
-
220
- ```text
221
- guardex-auto-revert <ts> <prev>-><new>
222
- ```
53
+ Finish or stash edits inside the worktree they belong to before any branch switch on primary. The post-checkout guard may auto-stash a dirty primary tree as `guardex-auto-revert <ts> <prev>-><new>` — that is a safety net, not a workflow.
223
54
 
224
- That is a safety net, not a workflow. Do not rely on it routinely.
225
-
226
- Recover stashed changes with:
227
-
228
- ```bash
229
- git stash list | grep 'guardex-auto-revert'
230
- ```
55
+ Recover: `git stash list | grep 'guardex-auto-revert'`.
231
56
 
232
57
  ### Ownership
233
58
 
234
- Before editing, claim files.
235
-
236
- Preferred Colony path when on an active task:
237
-
238
- ```text
239
- mcp__colony__task_claim_file
240
- ```
241
-
242
- Guardex lock path:
59
+ Before editing, claim files:
243
60
 
244
61
  ```bash
245
62
  gx locks claim --branch "<agent-branch>" <file...>
246
63
  ```
247
64
 
248
- Before deleting, confirm the path is in your claim.
249
-
250
- Do not edit outside your scope unless reassigned.
251
-
252
- If another agent owns or recently touched nearby code:
253
-
254
- 1. read latest Colony context
255
- 2. post a handoff or question
65
+ If another agent owns nearby code:
66
+ 1. read the latest context for that lane
67
+ 2. post a handoff / question
256
68
  3. avoid reverting unrelated changes
257
69
  4. report conflicts instead of overwriting
258
70
 
259
- ### Handoff gate
260
-
261
- Before editing, post a one-line handoff note through Colony `task_post` when a task is active.
71
+ ### Handoff format
262
72
 
263
- Use `.omx/notepad.md` only when Colony is unavailable or the lane explicitly depends on legacy OMX state.
264
-
265
- Handoff shape:
73
+ When posting handoff or working-state notes (`.omx/notepad.md`, PR description, or whichever coordination surface the repo uses), use these fields:
266
74
 
267
75
  ```text
268
76
  branch=<branch>; task=<task>; blocker=<blocker>; next=<next>; evidence=<path|command|PR|spec>
269
77
  ```
270
78
 
271
- Re-read latest Colony context before replacing another agent's code.
79
+ No long proof dumps, no stale narrative, no full logs. Bulky proof goes in OpenSpec artifacts, PRs, or command output.
272
80
 
273
81
  ### Completion
274
82
 
@@ -276,53 +84,38 @@ Finish with:
276
84
 
277
85
  ```bash
278
86
  gx branch finish --branch "<agent-branch>" --via-pr --wait-for-merge --cleanup
279
- ```
280
-
281
- or:
282
-
283
- ```bash
87
+ # or:
284
88
  gx finish --all
285
89
  ```
286
90
 
287
- Task is complete only when:
91
+ Task scaffolds and manual task edits must include a final completion/cleanup section that ends with PR merge + sandbox cleanup and records PR URL + final `MERGED` evidence.
92
+
93
+ Task is complete only when **all six** are true:
288
94
 
289
- 1. changes are committed
290
- 2. branch is pushed
291
- 3. PR URL is recorded
292
- 4. PR state is `MERGED`
293
- 5. sandbox worktree is pruned
95
+ 1. changes committed
96
+ 2. branch pushed
97
+ 3. PR URL recorded
98
+ 4. PR state = `MERGED`
99
+ 5. sandbox worktree pruned
294
100
  6. final handoff records proof
295
101
 
296
- If anything blocks, append a `BLOCKED:` note and stop. Do not half-finish.
102
+ If blocked, append a `BLOCKED:` note and stop. Do not half-finish.
297
103
 
298
- OMX completion policy: when a task is done, the agent must commit the task changes, push the agent branch, and create/update a PR before considering the branch complete.
104
+ Use the finish flow instead of standalone `git push` / `gh pr` commands. The finish flow owns commit, push, PR creation/update, merge wait, and sandbox cleanup; standalone fallbacks strand PR / merge / cleanup state.
299
105
 
300
- ### Parallel safety
106
+ ### External approval boundary
301
107
 
302
- Assume other agents edit nearby.
108
+ Guardex cannot bypass Codex host approval prompts or external-remote policy decisions. When the host blocks a publish or finish command, request approval for the narrow `gx branch finish ...` command, or for the exact session wrapper that invokes it, and continue after approval. Do not replace the finish flow with repeated standalone `git push` / `gh pr` attempts — that increases approval churn and can strand state.
303
109
 
304
- - Never revert unrelated changes.
305
- - Never simplify or delete critical shared paths without explicit request and regression coverage.
306
- - Report conflicts in the handoff.
307
- - Prefer compatibility-preserving changes over endpoint-specific rewrites when other agents may be changing adjacent systems.
110
+ ### Parallel safety
308
111
 
309
- ### Reporting
112
+ Assume other agents edit nearby. Never revert unrelated changes. Never simplify or delete critical shared paths without explicit request + regression coverage. Prefer compatibility-preserving changes when adjacent systems may be in motion.
310
113
 
311
- Every completion handoff includes:
114
+ ### Reporting
312
115
 
313
- ```text
314
- branch
315
- task
316
- files changed
317
- behavior touched
318
- verification commands/results
319
- PR URL
320
- merge state
321
- sandbox cleanup state
322
- risks/follow-ups
323
- ```
116
+ Every completion handoff includes: branch, task, files changed, behavior touched, verification commands + results, PR URL, merge state, sandbox cleanup state, risks/follow-ups.
324
117
 
325
- If blocked, use:
118
+ Blocked? Use:
326
119
 
327
120
  ```text
328
121
  BLOCKED:
@@ -333,89 +126,36 @@ next=<next>
333
126
  evidence=<path|command|PR|spec>
334
127
  ```
335
128
 
336
- ### Open questions
337
-
338
- If Codex/Claude hits an unresolved question, branching decision, or blocker that should survive chat, record it in:
339
-
340
- ```text
341
- openspec/plan/<plan-slug>/open-questions.md
342
- ```
343
-
344
- as an unchecked item:
345
-
346
- ```md
347
- - [ ] Question or blocker...
348
- ```
349
-
350
- Resolve it in-place when answered instead of burying it in chat-only notes.
351
-
352
- ### OpenSpec
353
-
354
- OpenSpec is the source of truth for change-driven repo work.
129
+ ### Verification gates
355
130
 
356
- For change-driven tasks, keep:
131
+ Before claiming completion, run the narrowest meaningful verification (`pnpm test`, `pnpm typecheck`, `pnpm lint`, etc. — whatever fits the touched area). Do not claim green without command output evidence. If a command can't run, record command / reason / risk / next.
357
132
 
358
- ```text
359
- openspec/changes/<slug>/tasks.md
360
- ```
133
+ ### Open questions
361
134
 
362
- current during work, not batched at the end.
135
+ Persist unresolved questions or blockers into `openspec/plan/<plan-slug>/open-questions.md` as unchecked items. Resolve in-place rather than burying in chat.
363
136
 
364
- Task scaffolds and manual task edits must include a final completion/cleanup section that ends with PR merge + sandbox cleanup and records PR URL + final `MERGED` evidence.
137
+ ### Optional companion tooling (use if installed)
365
138
 
366
- Validate specs before archive:
139
+ - **fff MCP** (file search): prefer for all file search; fall back to `rtk grep`/`rtk find` or `rg`.
140
+ - **rtk** (shell compression): wrap noisy discovery (`rtk ls`/`grep`/`find`/`read`), git/gh (`rtk git status`/`gh pr list`), and verification (`rtk tsc`/`lint`/`test`). Do **not** wrap machine-readable commands (`--porcelain`, `--json`, exact stdout contracts).
141
+ - **OpenSpec**: keep `openspec/changes/<slug>/tasks.md` current during work, not batched. Validate with `openspec validate --specs` before archive.
367
142
 
368
- ```bash
369
- openspec validate --specs
370
- ```
371
-
372
- Never archive unverified work.
143
+ ### Token / context budget
373
144
 
374
- For `T0` / small `T1` lanes, use the compact Colony spec path when available. One Colony handoff plus `colony-spec.md` is enough. Do not create proposal/spec/tasks unless the task grows.
145
+ Default: less word, same proof.
375
146
 
376
- For `T2` / `T3` lanes, keep proposal, spec, design, and tasks live while implementing.
147
+ - Plan in ≤4 bullets, execute by phase, batch reads/commands.
148
+ - Verify once per phase. A bounded ≤10-step run is fine.
149
+ - 20+ steps with rising per-turn input = fragmentation → collapse to inspect once, patch once, verify once, summarize once.
150
+ - Startup/resume summaries stay tiny: `branch`, `task`, `blocker`, `next`, `evidence`.
151
+ - Keep raw terminal interaction out of long-lived context: retain only process, action sent, current result, next action.
152
+ - Full commands/stdout belong in logs; prompt context keeps only the latest 1–2 checkpoints plus the newest tool-result summary.
377
153
 
378
154
  ### Version bumps
379
155
 
380
- If a change bumps a published version, the same PR records release notes in the appropriate OpenSpec artifact or release-note mechanism for the repo.
381
-
382
- Do not edit `CHANGELOG.md` directly unless the repo explicitly requires manual changelog edits.
383
-
384
- ### Verification gates
385
-
386
- Before claiming completion, run the narrowest meaningful verification for the touched area.
387
-
388
- Examples:
389
-
390
- ```bash
391
- pnpm test
392
- pnpm typecheck
393
- pnpm lint
394
- ```
395
-
396
- If a command cannot run, record:
397
-
398
- ```text
399
- command
400
- reason it could not run
401
- risk
402
- next
403
- ```
404
-
405
- Do not claim green verification without command output evidence.
156
+ If a change bumps a published version, the same PR records release notes in the appropriate OpenSpec artifact or release-note mechanism for the repo. Do not edit `CHANGELOG.md` directly unless the repo explicitly requires manual changelog edits.
406
157
 
407
158
  ### What not to put in this file
408
159
 
409
- Do not embed:
410
-
411
- - stale memory dumps
412
- - PR transcripts
413
- - long logs
414
- - generated status snapshots
415
- - session history
416
- - full OpenSpec examples
417
- - repeated copies of long workflow docs
418
-
419
- Keep this section as the hard multi-agent contract. Put long examples and recovery docs in repo-specific workflow docs.
420
-
160
+ No stale memory dumps, PR transcripts, long logs, generated status snapshots, session history, full OpenSpec examples, or duplicate workflow docs. This block is the hard contract — long examples and recovery docs live in repo-specific workflow files.
421
161
  <!-- multiagent-safety:END -->
@@ -0,0 +1,11 @@
1
+ <!-- multiagent-safety:START -->
2
+ ## Multi-Agent Safety (minimal)
3
+
4
+ Guardex is enabled by default. Disable via repo-root `.env` with `GUARDEX_ON=0`.
5
+
6
+ - Work from an `agent/*` branch + worktree — never edit the protected base (`main`/`dev`) directly. Start with `gx branch start "<task>" "<agent-name>"`, then `cd` into the printed worktree.
7
+ - Claim files before editing: `gx locks claim --branch "<agent-branch>" <file...>`.
8
+ - Finish completed work via PR + cleanup: `gx branch finish --branch "<agent-branch>" --via-pr --wait-for-merge --cleanup` (or `gx finish --all`).
9
+
10
+ Want the full multi-agent contract (Colony coordination, OpenSpec, token discipline, recovery)? Run `gx setup --contract`.
11
+ <!-- multiagent-safety:END -->
@@ -9,3 +9,5 @@ Use when repo safety may be broken.
9
9
 
10
10
  Bootstrap: `gx setup`
11
11
  Ops: `gx branch start "<task>" "<agent>"`, `gx locks claim --branch "<agent-branch>" <file...>`, `gx branch finish --branch "<agent-branch>" --base <base> --via-pr --wait-for-merge --cleanup`, `gx finish --all`, `gx cleanup`
12
+
13
+ When inspecting or verifying, prefer `rtk` compact wrappers if available (`rtk git status`, `rtk grep`, `rtk test <cmd>`). Do not wrap commands whose stdout is parsed by scripts.
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: gx-act
3
+ description: "Run GitHub Actions workflows locally with nektos/act before pushing, so CI failures are caught on the laptop and the PR can be squash-merged on the first remote run."
4
+ ---
5
+
6
+ # gx-act — local GitHub Actions
7
+
8
+ Use whenever a change touches code that would trigger CI on GitHub. Run the workflows locally with `act` first; only push the branch when the local run is green, then squash-merge the PR on GitHub.
9
+
10
+ ## When to invoke
11
+
12
+ - Before `gx pr open` / `gx pr sync` / `gx branch finish --via-pr`.
13
+ - Before re-pushing after a CI failure.
14
+ - When iterating on `.github/workflows/*.yml` itself.
15
+
16
+ ## Install `act`
17
+
18
+ `act` requires Docker (or Podman). Check the binary:
19
+
20
+ ```sh
21
+ command -v act || echo "act not installed"
22
+ ```
23
+
24
+ Install one way:
25
+
26
+ ```sh
27
+ # Linux/macOS via the upstream installer
28
+ curl -fsSL https://raw.githubusercontent.com/nektos/act/master/install.sh | bash -s -- -b "$HOME/.local/bin"
29
+
30
+ # macOS via Homebrew
31
+ brew install act
32
+
33
+ # Arch
34
+ sudo pacman -S act
35
+
36
+ # Or use the GitHub CLI extension
37
+ gh extension install https://github.com/nektos/gh-act
38
+ ```
39
+
40
+ Upstream: https://github.com/nektos/act
41
+
42
+ ## Quick commands
43
+
44
+ ```sh
45
+ # List jobs the local runner would execute for the push event
46
+ act -l
47
+
48
+ # Run the default push workflows (what GitHub runs on a normal push)
49
+ act push
50
+
51
+ # Run a specific event
52
+ act pull_request
53
+ act workflow_dispatch -W .github/workflows/release.yml
54
+
55
+ # Run a single job
56
+ act -j test
57
+
58
+ # Pin a runner image (medium is the act default; large matches real GH closer)
59
+ act -P ubuntu-latest=catthehacker/ubuntu:act-latest
60
+
61
+ # Pass secrets / env without committing them
62
+ act -s GITHUB_TOKEN="$GITHUB_TOKEN" --env-file .env.act
63
+
64
+ # Reuse containers between runs (faster iteration)
65
+ act --reuse
66
+ ```
67
+
68
+ ## Workflow (local CI → squash-merge on GitHub)
69
+
70
+ 1. Implement the change in the agent worktree.
71
+ 2. `act -l` to confirm which jobs will fire for the event you care about.
72
+ 3. `act push` (or the specific event/job) until it is green locally.
73
+ 4. `gx branch finish --branch "<agent-branch>" --base main --via-pr --wait-for-merge --cleanup`.
74
+ - Or `gx pr open` then `gx pr sync --auto-merge --merge-strategy squash` for explicit PR control.
75
+ 5. On GitHub: squash-merge once the remote run mirrors the local one.
76
+
77
+ ## Notes
78
+
79
+ - `act` does not reproduce GitHub-hosted services exactly (no real secrets, different runner image, no concurrency groups). Treat a green `act` run as a strong signal, not a proof — the remote run is still authoritative.
80
+ - Keep `act` config in `.actrc` at the repo root so every agent uses the same runner image.
81
+ - If a workflow uses `GITHUB_TOKEN` for API calls, pass a PAT via `-s GITHUB_TOKEN=...`; do not commit it.
82
+ - Add `.actrc`, `.cache/act`, and any `act`-specific event payloads to `.gitignore` if they appear.