From 3b4d71d3fd4f30d709f85fdbca79d8baddc0f226 Mon Sep 17 00:00:00 2001 From: NagyVikt Date: Tue, 21 Apr 2026 15:53:11 +0200 Subject: [PATCH] Auto-finish: gx doctor repairs --- .gitignore | 17 ++++------------- AGENTS.md | 9 ++++++--- scripts/agent-file-locks.py | 1 - 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 6c2f557..9cfa814 100644 --- a/.gitignore +++ b/.gitignore @@ -78,23 +78,14 @@ openspec/plan/* # multiagent-safety:START .omx/ .omc/ +scripts/* scripts/agent-branch-start.sh -scripts/agent-branch-finish.sh -scripts/codex-agent.sh -scripts/review-bot-watch.sh -scripts/agent-worktree-prune.sh scripts/agent-file-locks.py -scripts/install-agent-git-hooks.sh -scripts/openspec/init-plan-workspace.sh -scripts/openspec/init-change-workspace.sh -.githooks/pre-commit -.githooks/pre-push -.githooks/post-merge -.githooks/post-checkout +.githooks oh-my-codex/ -.codex/skills/guardex/SKILL.md +.codex/skills/gitguardex/SKILL.md .codex/skills/guardex-merge-skills-to-dev/SKILL.md -.claude/commands/guardex.md +.claude/commands/gitguardex.md .omx/state/agent-file-locks.json # multiagent-safety:END diff --git a/AGENTS.md b/AGENTS.md index 2910a4f..d386fed 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -253,7 +253,7 @@ scripts/openspec/init-plan-workspace.sh ``` -## Multi-Agent Safety Contract +## Multi-Agent Execution Contract (GX) **Repo toggle.** Guardex is enabled by default. If the repo root `.env` sets `GUARDEX_ON=0`, `false`, `no`, or `off`, treat this entire Guardex contract as disabled for the repo and do not require Guardex worktrees, lock claims, completion flow, or OpenSpec workflow until `GUARDEX_ON` is re-enabled. @@ -261,13 +261,16 @@ scripts/openspec/init-plan-workspace.sh `GUARDEX_ON=0` disables Guardex for that repo. `GUARDEX_ON=1` explicitly enables Guardex for that repo again. -**Isolation.** Every task runs on a dedicated `agent/*` branch + worktree. Start with `scripts/agent-branch-start.sh "" ""`. Treat the base branch (`main`/`dev`) as read-only while an agent branch is active. Never `git checkout ` on a primary working tree (including nested repos); use `git worktree add` instead. The `.githooks/post-checkout` hook auto-reverts primary-branch switches during agent sessions — bypass only with `GUARDEX_ALLOW_PRIMARY_BRANCH_SWITCH=1`. +**Isolation.** Every task runs on a dedicated `agent/*` branch + worktree. Start with `scripts/agent-branch-start.sh "" ""`. Treat the base branch (`main`/`dev`) as read-only while an agent branch is active. Never `git checkout ` on a primary working tree (including nested repos); use `git worktree add` instead. The `.githooks/post-checkout` hook auto-reverts primary-branch switches during agent sessions - bypass only with `GUARDEX_ALLOW_PRIMARY_BRANCH_SWITCH=1`. +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. +Never implement directly on the local/base branch checkout; keep it unchanged and perform all edits in the agent sub-branch/worktree. **Ownership.** Before editing, claim files: `scripts/agent-file-locks.py claim --branch "" `. Before deleting, confirm the path is in your claim. Don't edit outside your scope unless reassigned. **Handoff gate.** Post a one-line handoff note (plan/change, owned scope, intended action) before editing. Re-read the latest handoffs before replacing others' code. -**Completion.** Finish with `scripts/agent-branch-finish.sh --branch "" --via-pr --wait-for-merge --cleanup` (or `gx finish --all`). Task is only complete when: commit pushed, PR URL recorded, state = `MERGED`, sandbox worktree pruned. If anything blocks, append a `BLOCKED:` note and stop — don't half-finish. +**Completion.** Finish with `scripts/agent-branch-finish.sh --branch "" --via-pr --wait-for-merge --cleanup` (or `gx finish --all`). Task is only complete when: commit pushed, PR URL recorded, state = `MERGED`, sandbox worktree pruned. If anything blocks, append a `BLOCKED:` note and stop - don't half-finish. +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. **Parallel safety.** Assume other agents edit nearby. Never revert unrelated changes. Report conflicts in the handoff. diff --git a/scripts/agent-file-locks.py b/scripts/agent-file-locks.py index 53c2d2f..06cdd7a 100755 --- a/scripts/agent-file-locks.py +++ b/scripts/agent-file-locks.py @@ -27,7 +27,6 @@ 'AGENTS.md', '.githooks/pre-commit', '.githooks/pre-push', - '.githooks/post-merge', 'scripts/agent-branch-start.sh', 'scripts/agent-branch-finish.sh', 'scripts/agent-file-locks.py',