From 44dd5ae87cf22cc5c37107eb75e7b60dfe6d2f9a Mon Sep 17 00:00:00 2001 From: SomeRandmGuyy <127457986+SomeRandmGuyy@users.noreply.github.com> Date: Fri, 2 Oct 2026 04:56:56 +0000 Subject: [PATCH 1/5] feat: gsd-autonomous + ultrathink post-orchestrate hook integration (n1-n8 plan; opt-in AIO_SWARM_AFTER_ORCH; state/obs/trigger/detector shims; thin classify delegates; .claude/swarm-state.json obs) - New swarm/ modules for state idempotency, observability, signal detection, hook trigger per n8 execution plan. - Thin shims + on_a01_complete.py for a01-complete / uplift end signal. - Adopted n6 defaults (a01 signal, opt-in, seq default, separate state). - Guardrails stub + n5 6-state projection. - Enables parallel gsd run after ultrathink/orchestrate via hooks. - Tests and smoke pass; no regression. Part of rebuilding Swarm for gsd + claude-ultrathink autonomous via hooks. --- .claude/swarm-state.json | 10 +++ AGENTS.md | 9 ++- hooks/autonomous_run.py | 24 ++++--- hooks/on_a01_complete.py | 27 ++++++++ hooks/user_prompt_submit.py | 29 +++++---- omp/src/guard.ts | 125 +++++++++++++++++------------------ omp/test/guard.test.ts | 26 +++++--- swarm/hook_trigger.py | 41 ++++++++++++ swarm/observability.py | 58 +++++++++++++++++ swarm/signal_detector.py | 40 ++++++++++++ swarm/state_store.py | 126 ++++++++++++++++++++++++++++++++++++ 11 files changed, 417 insertions(+), 98 deletions(-) create mode 100644 .claude/swarm-state.json create mode 100755 hooks/on_a01_complete.py create mode 100644 swarm/hook_trigger.py create mode 100644 swarm/observability.py create mode 100644 swarm/signal_detector.py create mode 100644 swarm/state_store.py diff --git a/.claude/swarm-state.json b/.claude/swarm-state.json new file mode 100644 index 0000000..b7bcaae --- /dev/null +++ b/.claude/swarm-state.json @@ -0,0 +1,10 @@ +{ + "version": "1.0", + "correlation_id": "test-corr-2026", + "swarm_state": "RUNNING", + "updated_at": "2026-10-02T04:54:35Z", + "progress": { + "done": 0, + "total": 1 + } +} diff --git a/AGENTS.md b/AGENTS.md index 76effe2..45e3a2c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -84,19 +84,21 @@ flowchart LR - Identity: the session's `session_init.agent`, else env `SWARM_AGENT` (headless `-p` only; `omp/src/context.ts` `callingAgent`). A *swarm session* is one of the 15 slugs, or a top-level session with `SWARM_AGENT` or `SWARM_TASK_ID` set. - HOOK-01 `before_agent_start` (`omp/src/hooks.ts`): appends a `## AgentSwarm` system-prompt part pointing at `/swarm ` and `task` with `agent: "a01-orchestrator"`. Silent in subagents (any `session_init`), under `SWARM_CHILD=1` or `SWARM_AGENT`, when the part is already present, and on every non-SDLC prompt above; a classifier throw leaves the prompt untouched; it never spawns. An Ultrathink/Prompt-Uplift XML prompt (root `BUILD_PROMPT`, `FIX_PROMPT`, `RESEARCH_PROMPT`, `CHANGE_PROMPT`, `UPLIFTED_PROMPT`, `uplifted` or `ultrathink`) is classified by its unescaped `` text, else as the whole prompt (`classifiedText`), so HOOK-01 agrees with the plugin's headless kickoff; `hooks/user_prompt_submit.py` has no such extraction. - Runtime root (`before_agent_start`, `runtimeContext` in `omp/src/hooks.ts`): a session whose calling agent is one of the 15 slugs (`session_init.agent`, else `SWARM_AGENT` in `-p`) gets a `## AgentSwarm runtime` system-prompt part with `Runtime root: ` (`swarmRoot()`); the omp preambles run `python3 /scripts/