Orchestrata Ultimate › Plans › swarm-remediation-plan-2026-07-06

Swarm Remediation Plan — 2026-07-06

Source: plans/swarm-remediation-plan-2026-07-06.md at 8a2cb42ad · last changed 2026-08-10 · first committed 2026-07-05 · 333 lines.

Prose pending.

Plan text

Swarm Remediation Plan — 2026-07-06

0. Standing agent rules

NO git stash in agent tasks (added 2026-07-06 after two stash collisions between concurrent agents on this shared, non-worktree checkout — one required git-object-database recovery). For before/after baseline comparisons use git show HEAD:<path> > /tmp/baseline.py (read-only, collision-free). NO backgrounded gate runs: run test suites in the FOREGROUND with a generous timeout — a stopped agent's background task orphans the wait (four agents stalled this way).

Executable wave plan derived from plans/analysis-2026-07-06-findings.md. Owner: Opus orchestrator. Executors: roster agents (.claude/agents/): auditor / builder / wirer / refactorer / test-writer / lint-fixer / reviewer. Tracking: this file's checkboxes (flip [ ]→[x] with commit hash) + session CLI work items (added S200) + one scoped commit per task. Status legend: each task line carries id | agent | prio | deps.

0. Standing rules for EVERY agent brief (paste verbatim into prompts)

  1. Context safety (also in each agent's .md): size files before reading (wc -c); NEVER read whole: docs/rtm.json (7.5M), docs/rtm.md (1.9M), docs/CODEBASE_MAP.md (1.2M), plans/ast-.json, coverage/ci dumps, reviews/. Aggregate via python3 -c/jq; cap output | head -40; ranged Reads ≤250 lines.
  2. Doctrine: no mocks, no skips, no xdist (scripts/run_tests.py, -j4 max), no pip (uv only), absolute imports, function-scope fixtures, no AI attribution in commits, specs authoritative over code AND tests.
  3. Gates before declaring done (per touched scope): uv run ruff check <files> · uv run black --check <files> · uv run pyright <files> (no NEW errors) · uv run python scripts/test-review.py <test files> · targeted pytest for the touched modules · uv run python scripts/serialize_codebase_ast.py standards clean on touched files.
  4. Scope discipline: touch ONLY the files your brief names. Pre-existing debt you bump into → report, don't fix (wirer rule generalized), UNLESS your brief says otherwise. One scoped commit per task, message <type>(<area>): <what>.
  5. Report format back to orchestrator: {task-id, files touched, tests added/passing counts, gate outputs (1 line each), anything skipped, commit hash}.

Concurrency & conflict rules


Wave 0 — Unblock master (orchestrator, no swarm) — DO FIRST

Wave 1 — Fix the truth instruments (parallel-safe) 🎯 highest leverage

Wave 2 — Hygiene (single agent, mechanical)

Wave 3 — Consolidation (decision-gated; auditor evidence → decide → refactor)

Evidence packs first (parallel, read-only): — ALL FOUR LANDED 2026-07-06, persisted under plans/evidence/ (d1-pipeline-runners, d2-traceability, d3-duplicate-twins, d4-di-container), each verified by the orchestrator (one D2 claim refuted: PEP 758 syntax misread as Python 2). Decisions D1-D4 are now UNBLOCKED and waiting on Mohamed.

Execution (after decisions recorded in §D):

Wave 4 — Feature levers (builders/wirers; independent of Wave 3)

Wave 5 — Spec-gap closure (after W1 makes the RTM trustworthy)

Wave 6 — Debt paydown (continuous background, low priority)

Wave 7 — DOGFOOD on incus (user directive 2026-07-06; AFTER all waves)

Wave 8 — Context semantic layer (user directive 2026-07-06; design-first)

GOAL: maximize context-injection effectiveness and end context thrashing. Build an ontology/semantic layer over the existing assets (AST serialization, Neo4j KG + code intelligence, domaingen OWL tooling, spec/requirement parsers, memory engine) so each task's context is SELECTED as graph nodes (typed, ranked, k-hop bounded), PACKED under an explicit token budget, and emitted as an EDITABLE context pack the orchestrator can trim — for volk injection AND for Claude-side agent briefs (replacing static map tiers with task-aware packs).

D. Decision Register (Mohamed / Opus-with-Mohamed; blocks marked tasks)

ID Decision Input Blocks
D1 Which PipelineRunner is the product (kernel static-boot vs orchestrator dynamic); workflow_engine's fate W3.E1 pack W3.1, W3.5
D2 Canonical traceability module (recommend core/base/traces.py — 444 fan-in) W3.E2 pack W3.2
D3 Per-twin collapse directions W3.E3 pack W3.3
D4 DI container vs setter wiring as THE composition mechanism W3.E4 pack W3.4
D5 port_all.sh keep/delete; Read ux/ delete-after-diff; untrack 359 reviews/ files W2.3 memo (W2.2 excludes them)
D6 Codebase-map tier for subagents (two-tier hook vs accept cost) findings §6 W0.3
D7 Lazy-import layer fixes: codify as accepted pattern (checker INFO) or extract protocols findings §4.5 W3.5 wording
D8 Volk tool-loop rollout order + per-volk tool allowlists backlog #88 analysis W4.3
D9 VolkContextInjector wire-or-delete overlap memo W4.4
D10 SPEC-028: implement 'default' sentinel vs normalize errors; spec vs spike-profiles authority backlog #29/#31 W5.3

ALL TEN RULED 2026-07-06 per Mohamed's directive (evidence recommendations, spec-favouring, consolidate-don't-delete complete implementations) — full text in plans/decisions-2026-07-06.md. One-liners: D1 orchestrator engine survives+absorbs, workflow_engine deleted; D2 base.traces canon, engines consolidated, utils stays copy-target; D3 mechanical 1-5 execute, PolicyEvaluator+RoutingEngine WIRED (staged), kernel router consolidate-or-delete by @traces, LRU promoted; D4 option (b) + honest SPEC-024 rewrite; D5 untrack reviews/, delete port_all.sh + Read-ux-after-diff; D6 two-tier RATIFIED; D7 lazy imports codified + INFO count; D8 Ar/Cd/Qa staged; D9 VolkContextInjector consolidated into live path; D10 sentinel implemented, profiles authoritative.

Progress protocol

  1. Orchestrator flips checkboxes here WITH commit hashes; session CLI log-work per completed task; complete-work for the matching backlog items (this plan subsumes backlog #4, 9, 10, 13, 14, 17(part), 21(prereq), 24, 27, 28, 29, 31, 32, 33, 34, 35, 36, 43, 44 — mark them via plan-task IDs).
  2. Wave completion = all tasks checked + full scripts/run_tests.py green + architecture_checker ≤1 + check-traces/pyright ratchets not regressed + wave summary logged to session CLI.
  3. Any agent that STOPs on ambiguity → orchestrator resolves or escalates to a D-item; never let a builder guess a design decision.
  4. Re-run bash .claude/hooks/inject-codebase-map.sh after structural waves so the map stays truthful.