@imdeadpool/guardex 7.0.39 → 7.0.43
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.
- package/README.md +85 -16
- package/package.json +2 -1
- package/skills/gitguardex/SKILL.md +13 -0
- package/skills/guardex-merge-skills-to-dev/SKILL.md +59 -0
- package/src/agents/cleanup-sessions.js +126 -0
- package/src/agents/detect.js +160 -0
- package/src/agents/finish.js +172 -0
- package/src/agents/inspect.js +189 -0
- package/src/agents/launch.js +240 -0
- package/src/agents/registry.js +133 -0
- package/src/agents/selection-panel.js +571 -0
- package/src/agents/sessions.js +151 -0
- package/src/agents/start.js +591 -0
- package/src/agents/status.js +143 -0
- package/src/agents/terminal.js +152 -0
- package/src/budget/index.js +343 -0
- package/src/ci-init/index.js +265 -0
- package/src/cli/args.js +305 -1
- package/src/cli/main.js +262 -132
- package/src/cockpit/action-runner.js +3 -0
- package/src/cockpit/actions.js +80 -0
- package/src/cockpit/control.js +1121 -0
- package/src/cockpit/index.js +426 -0
- package/src/cockpit/keybindings.js +224 -0
- package/src/cockpit/kitty-layout.js +549 -0
- package/src/cockpit/kitty-tree.js +144 -0
- package/src/cockpit/layout.js +224 -0
- package/src/cockpit/logs-reader.js +182 -0
- package/src/cockpit/menu.js +204 -0
- package/src/cockpit/pane-actions.js +597 -0
- package/src/cockpit/pane-menu.js +387 -0
- package/src/cockpit/projects-finder.js +178 -0
- package/src/cockpit/render.js +215 -0
- package/src/cockpit/settings-render.js +128 -0
- package/src/cockpit/settings.js +124 -0
- package/src/cockpit/shortcuts.js +24 -0
- package/src/cockpit/sidebar.js +311 -0
- package/src/cockpit/state.js +72 -0
- package/src/cockpit/theme.js +128 -0
- package/src/cockpit/welcome.js +266 -0
- package/src/context.js +78 -35
- package/src/doctor/index.js +4 -3
- package/src/finish/index.js +39 -2
- package/src/git/index.js +65 -0
- package/src/kitty/command.js +101 -0
- package/src/kitty/runtime.js +250 -0
- package/src/output/index.js +1 -1
- package/src/pr-review.js +241 -0
- package/src/scaffold/index.js +19 -0
- package/src/submodule/index.js +288 -0
- package/src/terminal/index.js +120 -0
- package/src/terminal/kitty.js +622 -0
- package/src/terminal/tmux.js +126 -0
- package/src/tmux/command.js +27 -0
- package/src/tmux/session.js +89 -0
- package/templates/AGENTS.multiagent-safety.md +421 -37
- package/templates/codex/skills/gitguardex/SKILL.md +2 -0
- package/templates/githooks/pre-commit +22 -1
- package/templates/github/workflows/README.md +87 -0
- package/templates/github/workflows/ci-full.yml +55 -0
- package/templates/github/workflows/ci.yml +56 -0
- package/templates/github/workflows/cr.yml +20 -1
- package/templates/scripts/agent-branch-finish.sh +545 -27
- package/templates/scripts/agent-branch-start.sh +193 -21
- package/templates/scripts/agent-preflight.sh +89 -0
- package/templates/scripts/agent-worktree-prune.sh +96 -5
- package/templates/scripts/codex-agent.sh +41 -6
- package/templates/scripts/openspec/init-plan-workspace.sh +43 -0
- package/templates/scripts/review-bot-watch.sh +31 -2
- package/templates/scripts/agent-session-state.js +0 -171
- package/templates/scripts/install-vscode-active-agents-extension.js +0 -135
- package/templates/vscode/guardex-active-agents/README.md +0 -34
- package/templates/vscode/guardex-active-agents/extension.js +0 -3782
- package/templates/vscode/guardex-active-agents/fileicons/gitguardex-fileicons.json +0 -54
- package/templates/vscode/guardex-active-agents/fileicons/icons/agent.svg +0 -5
- package/templates/vscode/guardex-active-agents/fileicons/icons/branch.svg +0 -7
- package/templates/vscode/guardex-active-agents/fileicons/icons/config.svg +0 -4
- package/templates/vscode/guardex-active-agents/fileicons/icons/hook.svg +0 -4
- package/templates/vscode/guardex-active-agents/fileicons/icons/openspec.svg +0 -5
- package/templates/vscode/guardex-active-agents/fileicons/icons/plan.svg +0 -4
- package/templates/vscode/guardex-active-agents/fileicons/icons/spec.svg +0 -5
- package/templates/vscode/guardex-active-agents/icon.png +0 -0
- package/templates/vscode/guardex-active-agents/media/active-agents-hivemind.svg +0 -14
- package/templates/vscode/guardex-active-agents/package.json +0 -169
- package/templates/vscode/guardex-active-agents/session-schema.js +0 -1348
|
@@ -1,63 +1,447 @@
|
|
|
1
1
|
<!-- multiagent-safety:START -->
|
|
2
|
-
## Multi-Agent Execution Contract
|
|
2
|
+
## Multi-Agent Execution Contract: Guardex + Colony
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
### Repo toggle
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
`GUARDEX_ON=0` disables Guardex for that repo.
|
|
8
|
-
`GUARDEX_ON=1` explicitly enables Guardex for that repo again.
|
|
6
|
+
Guardex is enabled by default.
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
Promote to OMX orchestration only when the task is medium/large: multi-file behavior changes, API/schema work, refactors, migrations, architecture, cross-cutting scope, or long prompts. Heavy OMX modes (`ralph`, `autopilot`, `team`, `ultrawork`, `swarm`, `ralplan`) are for that larger scope. If the task grows while working, upgrade then.
|
|
8
|
+
If the repo-root `.env` sets any of these values, treat this entire Guardex contract as disabled for the repo:
|
|
12
9
|
|
|
13
|
-
|
|
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
|
+
```
|
|
24
|
+
|
|
25
|
+
### Core rules
|
|
26
|
+
|
|
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
|
+
- Prefer fff MCP tools for file search whenever available; do not route file search through RTK when fff can answer it.
|
|
31
|
+
- Use OpenSpec for durable behavior contracts and change-driven work.
|
|
32
|
+
- Keep outputs compact: less word, same proof.
|
|
33
|
+
- Commit, push, and open/update a PR for completed work unless the user explicitly says to keep it local.
|
|
34
|
+
- Do not embed stale memory dumps, generated status snapshots, PR transcripts, session history, or long logs in this file.
|
|
35
|
+
|
|
36
|
+
### Task-size routing
|
|
37
|
+
|
|
38
|
+
Small tasks stay direct and caveman-only.
|
|
39
|
+
|
|
40
|
+
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.
|
|
41
|
+
|
|
42
|
+
Treat these prefixes as explicit lightweight escape hatches:
|
|
43
|
+
|
|
44
|
+
- `quick:`
|
|
45
|
+
- `simple:`
|
|
46
|
+
- `tiny:`
|
|
47
|
+
- `minor:`
|
|
48
|
+
- `small:`
|
|
49
|
+
- `just:`
|
|
50
|
+
- `only:`
|
|
51
|
+
|
|
52
|
+
Promote to full Guardex / OMX orchestration only when scope grows into:
|
|
53
|
+
|
|
54
|
+
- multi-file behavior change
|
|
55
|
+
- API/schema work
|
|
56
|
+
- refactor
|
|
57
|
+
- migration
|
|
58
|
+
- architecture
|
|
59
|
+
- cross-cutting scope
|
|
60
|
+
- long prompt
|
|
61
|
+
- multi-agent execution
|
|
62
|
+
|
|
63
|
+
### Colony coordination loop
|
|
64
|
+
|
|
65
|
+
Use Colony as the primary coordination surface.
|
|
66
|
+
|
|
67
|
+
On every startup, resume, follow-up, or "continue" request, run this order:
|
|
68
|
+
|
|
69
|
+
1. `mcp__colony__hivemind_context`
|
|
70
|
+
2. `mcp__colony__attention_inbox`
|
|
71
|
+
3. `mcp__colony__task_ready_for_agent`
|
|
72
|
+
4. `mcp__colony__search` only when prior decisions, earlier lanes, file history, or error context matter.
|
|
73
|
+
|
|
74
|
+
Rules:
|
|
75
|
+
|
|
76
|
+
- Use `task_ready_for_agent` to choose work.
|
|
77
|
+
- Use `task_list` only for browsing/debugging. Do not use `task_list` as the normal work picker.
|
|
78
|
+
- 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.
|
|
79
|
+
- Before editing files on an active task, call `task_claim_file` for each touched file.
|
|
80
|
+
- Use `task_post` for task-thread notes, decisions, blockers, and working-state updates.
|
|
81
|
+
- Use `task_message` / `task_messages` for directed agent-to-agent communication.
|
|
82
|
+
- Use `get_observations` only after compact Colony tools return IDs worth hydrating.
|
|
83
|
+
|
|
84
|
+
Fallback:
|
|
85
|
+
|
|
86
|
+
- 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.
|
|
87
|
+
- 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.
|
|
88
|
+
- Do not skip Colony just because OMX state exists. OMX is fallback, not the first coordination source.
|
|
89
|
+
- 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.
|
|
90
|
+
- Keep `.omx/notepad.md` lean: live handoffs only.
|
|
91
|
+
|
|
92
|
+
### Working-state notes
|
|
93
|
+
|
|
94
|
+
Colony is preferred over generic notepad state.
|
|
95
|
+
|
|
96
|
+
A working-state note should be task-scoped, searchable, and useful to another agent resuming the lane.
|
|
97
|
+
|
|
98
|
+
When saving progress, use a task-scoped Colony note when possible:
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
task_post kind=note
|
|
102
|
+
content="branch=<branch>; task=<task>; blocker=<blocker>; next=<next>; evidence=<path|command|PR|spec>"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Use exactly these fields for handoff-style notes:
|
|
106
|
+
|
|
107
|
+
- `branch`
|
|
108
|
+
- `task`
|
|
109
|
+
- `blocker`
|
|
110
|
+
- `next`
|
|
111
|
+
- `evidence`
|
|
112
|
+
|
|
113
|
+
Do not store long proof dumps, stale narrative, or full logs in notepads. Put bulky proof in OpenSpec artifacts, PRs, or command output.
|
|
114
|
+
|
|
115
|
+
### Token / context budget
|
|
14
116
|
|
|
15
117
|
Default: less word, same proof.
|
|
16
118
|
|
|
17
|
-
- For prompts about `token inefficiency`, `reviewer mode`, `minimal token overhead`, or session waste patterns, switch into low-overhead mode
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
119
|
+
- For prompts about `token inefficiency`, `reviewer mode`, `minimal token overhead`, or session waste patterns, switch into low-overhead mode.
|
|
120
|
+
- Plan in at most 4 bullets.
|
|
121
|
+
- Execute by phase.
|
|
122
|
+
- Batch related reads and commands.
|
|
123
|
+
- Avoid duplicate reads and interactive loops.
|
|
124
|
+
- Keep outputs compact.
|
|
125
|
+
- Verify once per phase.
|
|
126
|
+
- Low output alone is not a defect. A bounded run that finishes in roughly <=10 steps is usually fine.
|
|
127
|
+
- Low output spread across 20+ steps with rising per-turn input is fragmentation and should be treated as context growth first.
|
|
128
|
+
- Startup / resume summaries stay tiny: `branch`, `task`, `blocker`, `next`, and `evidence`.
|
|
129
|
+
- Front-load scaffold/path discovery into one grouped inspection pass. Avoid serial `ls` / `find` / `rg` / `cat` retries that rediscover the same path state.
|
|
130
|
+
- Treat repeated `write_stdin`, repeated `sed` / `cat` peeks, and tiny diagnostic follow-up checks as strong negative signals.
|
|
131
|
+
- If a session turns fragmented, collapse back to inspect once, patch once, verify once, and summarize once.
|
|
23
132
|
- Tool / hook summaries stay tiny: command, status, last meaningful lines only. Drop routine hook boilerplate.
|
|
24
133
|
- 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.
|
|
25
134
|
- 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.
|
|
26
|
-
- Treat local edit/commit, remote publish/PR, CI diagnosis, and cleanup as bounded phases.
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
135
|
+
- Treat local edit/commit, remote publish/PR, CI diagnosis, and cleanup as bounded phases.
|
|
136
|
+
- Do not spend fresh narration or approval turns on obvious safe follow-ons inside an already authorized phase unless the risk changes.
|
|
137
|
+
|
|
138
|
+
### RTK command compression
|
|
30
139
|
|
|
31
|
-
|
|
140
|
+
When `rtk` is available, prefer it for noisy shell discovery and verification. For file search, fff MCP takes precedence whenever available.
|
|
32
141
|
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
142
|
+
- Files: `rtk ls .`, `rtk read <file>`, `rtk read <file> -l aggressive`, `rtk smart <file>`, `rtk find "<glob>" .`, `rtk grep "<pattern>" .`, `rtk diff <a> <b>`.
|
|
143
|
+
- Git and GitHub: `rtk git status`, `rtk git diff`, `rtk git log -n 10`, `rtk gh pr list`, `rtk gh pr view <id>`.
|
|
144
|
+
- Tests and builds: `rtk test <cmd>`, `rtk err <cmd>`, `rtk jest`, `rtk vitest`, `rtk playwright test`, `rtk pytest`, `rtk cargo test`, `rtk tsc`, `rtk lint`.
|
|
145
|
+
- Runtime and data probes: `rtk docker ps`, `rtk docker logs <container>`, `rtk kubectl pods`, `rtk json <file>`, `rtk log <file>`, `rtk curl <url>`.
|
|
146
|
+
- Savings checks: `rtk gain`, `rtk discover`, and `rtk session`.
|
|
147
|
+
- Use `rtk proxy <command>` only when raw passthrough is required.
|
|
148
|
+
- Do not wrap machine-readable commands with RTK when code parses stdout (`--porcelain`, `--json`, NUL-delimited output, or exact stdout contracts).
|
|
149
|
+
- If `rtk` is missing, use raw commands and summarize only meaningful lines.
|
|
150
|
+
|
|
151
|
+
### FFF file search
|
|
152
|
+
|
|
153
|
+
Use the fff MCP tools for all file search operations instead of default tools, including RTK shell wrappers.
|
|
154
|
+
|
|
155
|
+
If fff MCP tools are unavailable in the current client, fall back to `rtk grep`, `rtk find`, `rtk ls`, or `rg` and keep output compact.
|
|
156
|
+
|
|
157
|
+
### Caveman style
|
|
158
|
+
|
|
159
|
+
Commentary and progress updates use smart-caveman `ultra` by default:
|
|
160
|
+
|
|
161
|
+
- Answer order stays fixed: answer first, cause next, fix or next step last.
|
|
162
|
+
- drop filler
|
|
163
|
+
- use fragments when clear
|
|
164
|
+
- answer first
|
|
165
|
+
- cause next
|
|
166
|
+
- fix or next step last
|
|
167
|
+
|
|
168
|
+
Keep exact literals unchanged:
|
|
169
|
+
|
|
170
|
+
- code
|
|
171
|
+
- commands
|
|
172
|
+
- file paths
|
|
173
|
+
- flags
|
|
174
|
+
- env vars
|
|
175
|
+
- URLs
|
|
176
|
+
- numbers
|
|
177
|
+
- timestamps
|
|
178
|
+
- error text
|
|
179
|
+
|
|
180
|
+
Switch back to `lite` or normal wording for:
|
|
181
|
+
|
|
182
|
+
- security warnings
|
|
183
|
+
- irreversible actions
|
|
184
|
+
- privacy/compliance notes
|
|
185
|
+
- ordered instructions where fragments may confuse
|
|
186
|
+
- confused users
|
|
187
|
+
- commits
|
|
188
|
+
- PR text
|
|
189
|
+
- specs
|
|
190
|
+
- logs
|
|
191
|
+
- blocker evidence
|
|
192
|
+
|
|
193
|
+
Never caveman-compress commands, file paths, specs, logs, or blocker evidence.
|
|
194
|
+
|
|
195
|
+
### Isolation
|
|
196
|
+
|
|
197
|
+
Every task runs on a dedicated `agent/*` branch and worktree.
|
|
198
|
+
|
|
199
|
+
Start with:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
gx branch start "<task>" "<agent-name>"
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Treat the base branch (`main` / `dev`) as read-only while an agent branch is active.
|
|
38
206
|
|
|
39
|
-
**Isolation.** Every task runs on a dedicated `agent/*` branch + worktree. Start with `gx branch start "<task>" "<agent-name>"`. Treat the base branch (`main`/`dev`) as read-only while an agent branch is active. The `.githooks/post-checkout` hook auto-reverts primary-branch switches during agent sessions and auto-stashes a dirty tree before reverting - bypass only with `GUARDEX_ALLOW_PRIMARY_BRANCH_SWITCH=1`.
|
|
40
207
|
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.
|
|
41
|
-
Never implement directly on the local/base branch checkout; keep it unchanged and perform all edits in the agent sub-branch/worktree.
|
|
42
208
|
|
|
43
|
-
|
|
209
|
+
Never implement directly on the local/base branch checkout. Keep it unchanged and perform all edits in the agent sub-branch/worktree.
|
|
210
|
+
|
|
211
|
+
### Primary-tree lock
|
|
212
|
+
|
|
213
|
+
On the primary checkout, do not run:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
git checkout <ref>
|
|
217
|
+
git switch <ref>
|
|
218
|
+
git switch -c ...
|
|
219
|
+
git checkout -b ...
|
|
220
|
+
git worktree add <path> <existing-agent-branch>
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Allowed on primary:
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
git fetch
|
|
227
|
+
git pull --ff-only
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
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.
|
|
231
|
+
|
|
232
|
+
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.
|
|
233
|
+
|
|
234
|
+
### Dirty-tree rule
|
|
235
|
+
|
|
236
|
+
Finish or stash edits inside the worktree they belong to before any branch switch on primary.
|
|
237
|
+
|
|
238
|
+
The post-checkout guard may auto-stash a dirty primary tree as:
|
|
239
|
+
|
|
240
|
+
```text
|
|
241
|
+
guardex-auto-revert <ts> <prev>-><new>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
That is a safety net, not a workflow. Do not rely on it routinely.
|
|
245
|
+
|
|
246
|
+
Recover stashed changes with:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
git stash list | grep 'guardex-auto-revert'
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Ownership
|
|
253
|
+
|
|
254
|
+
Before editing, claim files.
|
|
255
|
+
|
|
256
|
+
Preferred Colony path when on an active task:
|
|
257
|
+
|
|
258
|
+
```text
|
|
259
|
+
mcp__colony__task_claim_file
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Guardex lock path:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
gx locks claim --branch "<agent-branch>" <file...>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Before deleting, confirm the path is in your claim.
|
|
269
|
+
|
|
270
|
+
Do not edit outside your scope unless reassigned.
|
|
271
|
+
|
|
272
|
+
If another agent owns or recently touched nearby code:
|
|
273
|
+
|
|
274
|
+
1. read latest Colony context
|
|
275
|
+
2. post a handoff or question
|
|
276
|
+
3. avoid reverting unrelated changes
|
|
277
|
+
4. report conflicts instead of overwriting
|
|
278
|
+
|
|
279
|
+
### Handoff gate
|
|
280
|
+
|
|
281
|
+
Before editing, post a one-line handoff note through Colony `task_post` when a task is active.
|
|
282
|
+
|
|
283
|
+
Use `.omx/notepad.md` only when Colony is unavailable or the lane explicitly depends on legacy OMX state.
|
|
284
|
+
|
|
285
|
+
Handoff shape:
|
|
286
|
+
|
|
287
|
+
```text
|
|
288
|
+
branch=<branch>; task=<task>; blocker=<blocker>; next=<next>; evidence=<path|command|PR|spec>
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Re-read latest Colony context before replacing another agent's code.
|
|
292
|
+
|
|
293
|
+
### Completion
|
|
294
|
+
|
|
295
|
+
Finish with:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
gx branch finish --branch "<agent-branch>" --via-pr --wait-for-merge --cleanup
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
or:
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
gx finish --all
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Task is complete only when:
|
|
308
|
+
|
|
309
|
+
1. changes are committed
|
|
310
|
+
2. branch is pushed
|
|
311
|
+
3. PR URL is recorded
|
|
312
|
+
4. PR state is `MERGED`
|
|
313
|
+
5. sandbox worktree is pruned
|
|
314
|
+
6. final handoff records proof
|
|
315
|
+
|
|
316
|
+
If anything blocks, append a `BLOCKED:` note and stop. Do not half-finish.
|
|
317
|
+
|
|
318
|
+
OMX completion policy: when a task is done, the agent must run `gx branch finish --branch "<agent-branch>" --via-pr --wait-for-merge --cleanup` (or `gx finish --all`) instead of standalone `git push` / `gh pr` commands. The finish flow owns commit, push, PR creation/update, merge wait, and sandbox cleanup.
|
|
319
|
+
|
|
320
|
+
External approval boundary:
|
|
321
|
+
|
|
322
|
+
- Guardex cannot bypass Codex host approval prompts or external-remote policy decisions.
|
|
323
|
+
- 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.
|
|
324
|
+
- Do not replace the finish flow with repeated standalone `git push` / `gh pr` attempts. That increases approval churn and can strand PR, merge, or cleanup state.
|
|
325
|
+
|
|
326
|
+
### Parallel safety
|
|
327
|
+
|
|
328
|
+
Assume other agents edit nearby.
|
|
329
|
+
|
|
330
|
+
- Never revert unrelated changes.
|
|
331
|
+
- Never simplify or delete critical shared paths without explicit request and regression coverage.
|
|
332
|
+
- Report conflicts in the handoff.
|
|
333
|
+
- Prefer compatibility-preserving changes over endpoint-specific rewrites when other agents may be changing adjacent systems.
|
|
334
|
+
|
|
335
|
+
### Reporting
|
|
336
|
+
|
|
337
|
+
Every completion handoff includes:
|
|
338
|
+
|
|
339
|
+
```text
|
|
340
|
+
branch
|
|
341
|
+
task
|
|
342
|
+
files changed
|
|
343
|
+
behavior touched
|
|
344
|
+
verification commands/results
|
|
345
|
+
PR URL
|
|
346
|
+
merge state
|
|
347
|
+
sandbox cleanup state
|
|
348
|
+
risks/follow-ups
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
If blocked, use:
|
|
352
|
+
|
|
353
|
+
```text
|
|
354
|
+
BLOCKED:
|
|
355
|
+
branch=<branch>
|
|
356
|
+
task=<task>
|
|
357
|
+
blocker=<blocker>
|
|
358
|
+
next=<next>
|
|
359
|
+
evidence=<path|command|PR|spec>
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Open questions
|
|
363
|
+
|
|
364
|
+
If Codex/Claude hits an unresolved question, branching decision, or blocker that should survive chat, record it in:
|
|
365
|
+
|
|
366
|
+
```text
|
|
367
|
+
openspec/plan/<plan-slug>/open-questions.md
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
as an unchecked item:
|
|
371
|
+
|
|
372
|
+
```md
|
|
373
|
+
- [ ] Question or blocker...
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
Resolve it in-place when answered instead of burying it in chat-only notes.
|
|
377
|
+
|
|
378
|
+
### OpenSpec
|
|
379
|
+
|
|
380
|
+
OpenSpec is the source of truth for change-driven repo work.
|
|
381
|
+
|
|
382
|
+
For change-driven tasks, keep:
|
|
383
|
+
|
|
384
|
+
```text
|
|
385
|
+
openspec/changes/<slug>/tasks.md
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
current during work, not batched at the end.
|
|
389
|
+
|
|
390
|
+
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.
|
|
391
|
+
|
|
392
|
+
Validate specs before archive:
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
openspec validate --specs
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
Never archive unverified work.
|
|
399
|
+
|
|
400
|
+
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.
|
|
401
|
+
|
|
402
|
+
For `T2` / `T3` lanes, keep proposal, spec, design, and tasks live while implementing.
|
|
403
|
+
|
|
404
|
+
### Version bumps
|
|
405
|
+
|
|
406
|
+
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.
|
|
407
|
+
|
|
408
|
+
Do not edit `CHANGELOG.md` directly unless the repo explicitly requires manual changelog edits.
|
|
409
|
+
|
|
410
|
+
### Verification gates
|
|
411
|
+
|
|
412
|
+
Before claiming completion, run the narrowest meaningful verification for the touched area.
|
|
413
|
+
|
|
414
|
+
Examples:
|
|
44
415
|
|
|
45
|
-
|
|
416
|
+
```bash
|
|
417
|
+
pnpm test
|
|
418
|
+
pnpm typecheck
|
|
419
|
+
pnpm lint
|
|
420
|
+
```
|
|
46
421
|
|
|
47
|
-
|
|
422
|
+
If a command cannot run, record:
|
|
48
423
|
|
|
49
|
-
|
|
424
|
+
```text
|
|
425
|
+
command
|
|
426
|
+
reason it could not run
|
|
427
|
+
risk
|
|
428
|
+
next
|
|
429
|
+
```
|
|
50
430
|
|
|
51
|
-
|
|
52
|
-
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.
|
|
431
|
+
Do not claim green verification without command output evidence.
|
|
53
432
|
|
|
54
|
-
|
|
433
|
+
### What not to put in this file
|
|
55
434
|
|
|
56
|
-
|
|
435
|
+
Do not embed:
|
|
57
436
|
|
|
58
|
-
|
|
437
|
+
- stale memory dumps
|
|
438
|
+
- PR transcripts
|
|
439
|
+
- long logs
|
|
440
|
+
- generated status snapshots
|
|
441
|
+
- session history
|
|
442
|
+
- full OpenSpec examples
|
|
443
|
+
- repeated copies of long workflow docs
|
|
59
444
|
|
|
60
|
-
|
|
445
|
+
Keep this section as the hard multi-agent contract. Put long examples and recovery docs in repo-specific workflow docs.
|
|
61
446
|
|
|
62
|
-
**Version bumps.** If a change bumps a published version, the same PR updates release notes/changelog.
|
|
63
447
|
<!-- 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.
|
|
@@ -207,11 +207,32 @@ fi
|
|
|
207
207
|
|
|
208
208
|
if [[ "$branch" == agent/* ]]; then
|
|
209
209
|
if [[ "${GUARDEX_AUTOCLAIM_STAGED_LOCKS:-1}" == "1" ]]; then
|
|
210
|
+
# Auto-claim non-deletion staged paths. Deletions need an explicit
|
|
211
|
+
# `--allow-delete` flag below so `locks validate --staged` doesn't
|
|
212
|
+
# reject the commit on the same trip the user staged the delete.
|
|
210
213
|
while IFS= read -r staged_file; do
|
|
211
214
|
[[ -z "$staged_file" ]] && continue
|
|
212
215
|
[[ "$staged_file" == ".omx/state/agent-file-locks.json" ]] && continue
|
|
213
216
|
run_guardex_cli locks claim --branch "$branch" "$staged_file" >/dev/null 2>&1 || true
|
|
214
|
-
done < <(git diff --cached --name-only --diff-filter=
|
|
217
|
+
done < <(git diff --cached --name-only --diff-filter=ACMRTUXB)
|
|
218
|
+
|
|
219
|
+
# Auto-approve deletions for the same branch (gated separately so
|
|
220
|
+
# operators can disable this single behavior without disabling the
|
|
221
|
+
# broader auto-claim). Defaults to enabled — matches the auto-claim
|
|
222
|
+
# default and removes the "first commit fails, then `gx locks
|
|
223
|
+
# allow-delete`, then commit again" loop.
|
|
224
|
+
if [[ "${GUARDEX_AUTOCLAIM_STAGED_DELETES:-1}" == "1" ]]; then
|
|
225
|
+
_staged_deletes=()
|
|
226
|
+
while IFS= read -r staged_delete; do
|
|
227
|
+
[[ -z "$staged_delete" ]] && continue
|
|
228
|
+
[[ "$staged_delete" == ".omx/state/agent-file-locks.json" ]] && continue
|
|
229
|
+
_staged_deletes+=("$staged_delete")
|
|
230
|
+
done < <(git diff --cached --name-only --diff-filter=D)
|
|
231
|
+
if (( ${#_staged_deletes[@]} > 0 )); then
|
|
232
|
+
run_guardex_cli locks claim --branch "$branch" --allow-delete \
|
|
233
|
+
"${_staged_deletes[@]}" >/dev/null 2>&1 || true
|
|
234
|
+
fi
|
|
235
|
+
fi
|
|
215
236
|
fi
|
|
216
237
|
|
|
217
238
|
if ! run_guardex_cli locks validate --branch "$branch" --staged; then
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# `templates/github/workflows/` — budget-friendly CI defaults
|
|
2
|
+
|
|
3
|
+
Workflow files in this directory are copied into a gitguardex-managed
|
|
4
|
+
project's `.github/workflows/` directory when bootstrapping. They are
|
|
5
|
+
the **default** budget posture for projects that use `gx branch start`
|
|
6
|
+
to drive agent iterations.
|
|
7
|
+
|
|
8
|
+
Agent flows land a high volume of PRs per month. Without these trims,
|
|
9
|
+
every PR + every post-merge push fans out across CI, CodeQL, Scorecard,
|
|
10
|
+
and Code Review — which dominates the GitHub Actions bill for any
|
|
11
|
+
multi-agent repo. The trims below cut that cost without giving up
|
|
12
|
+
correctness coverage.
|
|
13
|
+
|
|
14
|
+
## What's trimmed and why
|
|
15
|
+
|
|
16
|
+
1. **`concurrency: cancel-in-progress: true`** scoped per workflow + ref
|
|
17
|
+
so rapid pushes to the same agent branch cancel the prior run
|
|
18
|
+
instead of letting both finish on Actions minutes.
|
|
19
|
+
|
|
20
|
+
2. **`if: github.event.pull_request.draft == false`** on every job that
|
|
21
|
+
shouldn't run on a draft PR, paired with
|
|
22
|
+
`pull_request.types: [..., ready_for_review]` in the trigger list so
|
|
23
|
+
CI fires the moment the PR is promoted out of draft.
|
|
24
|
+
|
|
25
|
+
3. **`if: !startsWith(head.ref, 'agent/')`** on the Code Review job
|
|
26
|
+
(`cr.yml`) — skip AI review on automated agent-lane PRs. AI review
|
|
27
|
+
on hundreds of agent PRs per month burns both Actions minutes and
|
|
28
|
+
OpenAI tokens without adding signal; human-authored PRs (any non-
|
|
29
|
+
`agent/*` head branch) still get reviewed.
|
|
30
|
+
|
|
31
|
+
4. **No `push: main` trigger** in `ci.yml` — branch protection on
|
|
32
|
+
`main` forces all changes through a PR, so PR-time CI is sufficient
|
|
33
|
+
and post-merge CI on `main` was pure duplication. Use
|
|
34
|
+
`workflow_dispatch` for ad-hoc full runs.
|
|
35
|
+
|
|
36
|
+
5. **`paths-ignore`** for docs / openspec / template-only changes — skip
|
|
37
|
+
CI on changes that don't affect runtime behavior.
|
|
38
|
+
|
|
39
|
+
## Customizing
|
|
40
|
+
|
|
41
|
+
- Replace `placeholder` steps in `ci.yml` with your build/test/lint
|
|
42
|
+
commands.
|
|
43
|
+
- Keep the `concurrency:`, `if:`, and `paths-ignore:` patterns. They
|
|
44
|
+
are the load-bearing part of the budget posture; removing them undoes
|
|
45
|
+
the win.
|
|
46
|
+
|
|
47
|
+
## When to skip the draft-skip pattern
|
|
48
|
+
|
|
49
|
+
If your CI is fast (≤ 2 min) and you want continuous validation as
|
|
50
|
+
agents iterate, drop the `if: pull_request.draft == false` job guard.
|
|
51
|
+
The concurrency cancel alone still prevents minute pile-up.
|
|
52
|
+
|
|
53
|
+
## When to re-enable AI code review on agent PRs
|
|
54
|
+
|
|
55
|
+
If your team relies on AI review as a true gating signal (not just
|
|
56
|
+
advisory), remove the `!startsWith(head.ref, 'agent/')` guard in
|
|
57
|
+
`cr.yml`. Expect the OpenAI bill to scale linearly with merge volume.
|
|
58
|
+
|
|
59
|
+
## Per-PR label opt-in
|
|
60
|
+
|
|
61
|
+
Both `cr.yml` and `ci-full.yml` honor PR labels so the occasional
|
|
62
|
+
agent PR that actually needs the heavier check can opt in without
|
|
63
|
+
flipping a global toggle:
|
|
64
|
+
|
|
65
|
+
| Label | Effect |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| `needs-review` | Run AI code review on this PR even though it's `agent/*`. Useful for security-sensitive changes or public-API redesigns. |
|
|
68
|
+
| `needs-ci-full` | Run the full cross-runtime matrix from `ci-full.yml` on this PR instead of waiting for the weekly schedule. Useful before a release branch lands. |
|
|
69
|
+
|
|
70
|
+
To enable: open the PR, then `gh pr edit <num> --add-label needs-review`
|
|
71
|
+
(or click the labels picker in the GitHub UI). The label-trigger fires
|
|
72
|
+
the workflow immediately; you don't need to re-push.
|
|
73
|
+
|
|
74
|
+
Add label definitions to your repo with `gh label create needs-review
|
|
75
|
+
--description "Run AI code review on this PR"` and similar for
|
|
76
|
+
`needs-ci-full`, or define them in `.github/labels.yml` if you use a
|
|
77
|
+
label-sync workflow.
|
|
78
|
+
|
|
79
|
+
## What about CodeQL / Scorecard?
|
|
80
|
+
|
|
81
|
+
The gitguardex repo itself runs CodeQL and Scorecard on the **weekly
|
|
82
|
+
schedule + `workflow_dispatch`** only — not on per-PR / per-push
|
|
83
|
+
triggers. Those workflows are long-running (5–10 min for CodeQL) and
|
|
84
|
+
were the largest single line item on the monthly Actions bill before
|
|
85
|
+
this change. If your project needs per-PR CodeQL gating for compliance
|
|
86
|
+
reasons, re-add the `pull_request` trigger and accept the cost; for
|
|
87
|
+
most repos, weekly + on-demand is the right default.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Optional companion to `ci.yml`. Drop in alongside it when your
|
|
2
|
+
# project supports multiple runtimes / OS combinations and you want
|
|
3
|
+
# coverage across all of them without paying per-PR.
|
|
4
|
+
#
|
|
5
|
+
# Strategy: PR-time `ci.yml` runs the primary runtime only (cheap).
|
|
6
|
+
# This workflow runs the full matrix on the weekly schedule, and
|
|
7
|
+
# on-demand via `workflow_dispatch` before a release. Per-PR opt-in
|
|
8
|
+
# is available by applying the `needs-ci-full` label to a PR.
|
|
9
|
+
#
|
|
10
|
+
# Customize the matrix rows below to match your supported runtimes.
|
|
11
|
+
|
|
12
|
+
name: CI (full matrix)
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
schedule:
|
|
16
|
+
- cron: '15 4 * * 1'
|
|
17
|
+
workflow_dispatch:
|
|
18
|
+
pull_request:
|
|
19
|
+
types: [labeled, synchronize]
|
|
20
|
+
|
|
21
|
+
permissions:
|
|
22
|
+
contents: read
|
|
23
|
+
|
|
24
|
+
concurrency:
|
|
25
|
+
group: ci-full-${{ github.workflow }}-${{ github.ref }}
|
|
26
|
+
cancel-in-progress: true
|
|
27
|
+
|
|
28
|
+
jobs:
|
|
29
|
+
test:
|
|
30
|
+
name: test (node ${{ matrix.node }})
|
|
31
|
+
# PR runs only fire when the `needs-ci-full` label is present.
|
|
32
|
+
# Schedule and workflow_dispatch always run.
|
|
33
|
+
if: >-
|
|
34
|
+
github.event_name != 'pull_request' ||
|
|
35
|
+
contains(github.event.pull_request.labels.*.name, 'needs-ci-full') ||
|
|
36
|
+
(github.event.action == 'labeled' && github.event.label.name == 'needs-ci-full')
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
strategy:
|
|
39
|
+
fail-fast: false
|
|
40
|
+
matrix:
|
|
41
|
+
node: [18, 22]
|
|
42
|
+
|
|
43
|
+
steps:
|
|
44
|
+
- name: Checkout
|
|
45
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
46
|
+
|
|
47
|
+
- name: Setup Node
|
|
48
|
+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
49
|
+
with:
|
|
50
|
+
node-version: ${{ matrix.node }}
|
|
51
|
+
|
|
52
|
+
# Replace below with your build/test/lint steps. Keep them parallel
|
|
53
|
+
# to `ci.yml` so the weekly matrix matches what runs per-PR.
|
|
54
|
+
- name: Project verification placeholder
|
|
55
|
+
run: echo "Replace this step with your build/test/lint commands."
|