Skip to content

feat: /swarm + factory-root resolution + autonomy-loop hardening - #19

Open
hamza-ali-shahjahan wants to merge 1 commit into
mainfrom
feat/swarm-and-root-resolution
Open

feat: /swarm + factory-root resolution + autonomy-loop hardening#19
hamza-ali-shahjahan wants to merge 1 commit into
mainfrom
feat/swarm-and-root-resolution

Conversation

@hamza-ali-shahjahan

Copy link
Copy Markdown
Owner

Why

Both fixes here surfaced the first time a real autonomous build ran through the factory (the synthux replica build). They're exactly the gaps a new user hits first.

  1. /hamzaish assumed cwd == factory root. Invoked from the workspace root (how a new user invokes it), its factory-relative paths resolved to nothing and the front door's first visible act was a "that folder isn't here" probe.
  2. The swarm pattern existed only in parts. scripts/autonomy-loop.ts was undiscoverable (never routed to by any command); the rest (mock-first scaffold, on-disk brief, the build/verify Workflow) had to be hand-assembled (~12 files). New users couldn't reach the current state of the art (eval → loop → swarm).

What changed

  • scripts/resolve-root.sh (new) — deterministic factory-root resolver: $HAMZAISH_ROOT → walk up from cwd → ~/Claude/Hamzaish → common spots. Single source of truth.
  • factory/commands/hamzaish.md — new "Step 0 — Anchor to the factory" preamble (runs the resolver silently; triage becomes Step 1); /swarm added to the Express-Lane routing.
  • factory/commands/swarm.md (new) + templates/build-swarm.workflow.js (new) — /swarm: pins a measurable rubric → mock-first scaffold (zero-secrets verifiable) → on-disk operating brief → parallel build → verify swarm per phase → launch with preflight, budget cap, branch-only, STOP kill switch.
  • scripts/autonomy-loop.tspreflight (claude CLI + git + repo; fail fast — a flaky/missing shell is the Products skeleton + drop symlinks + /hamzaish momentum router #1 cause of an unattended run that produces nothing) and stop after 2 consecutive sessions that make no progress and write no handoff (distinguishes "stuck" from "progressed but didn't write state" via commit sha). Direct fix for what the live run did: session 1 hit --max-turns and exited without writing loop-state.json, so the loop relaunched blind.
  • brain/anti-patterns/sensitive-product-stays-local.md (new) — a replica/sensitive product keeps its metadata (not just code) out of the always-public factory; wired in via gitignored code-paths.local.json only.
  • Learning (brain/learnings/2026-07-01-*), changelog (v1.35), README counts (65→66 / 24→25).

Testing

Local, all green: check-changelog, check-counts, check-product-layout, check-assets, check-starter (fresh scaffold installs cleanly). autonomy-loop.ts parses across all branches (bun build) and dry-runs. resolve-root.sh resolves correctly from an unrelated cwd.

Scope / safety

No product code in this repo. Nothing deployed, no secrets, no visibility change. Mock-first throughout.

Follow-ups (noted, not in this PR)

  • Per-session wall-clock watchdog (a hung network call can still wedge a session under --max-turns).
  • Scheduled-cloud execution option so a flaky local shell isn't the single point of failure for a multi-day run.
  • If /swarm proves out, repackage as a portable factory/plugins/ plugin (like web-launch).

Make the eval-loop + agentic-swarm pattern first-class and reachable by new users, and stop /hamzaish from ever assuming cwd is the factory root. Both gaps surfaced on the first real autonomous run through the factory (synthux replica build).

- New scripts/resolve-root.sh: deterministic factory-root resolver (env -> walk-up -> ~/Claude/Hamzaish -> common spots). /hamzaish gets a 'Step 0 - Anchor to the factory' preamble so it works from anywhere.

- New /swarm (factory/commands/swarm.md) + templates/build-swarm.workflow.js: packages autonomy-loop + /goal + mock-first scaffold + parallel build/verify swarm into one command; added to the Express-Lane routing.

- Harden scripts/autonomy-loop.ts: preflight (claude CLI + git + repo) and stop after 2 sessions that make no progress and write no handoff (a session hit --max-turns without writing loop-state.json on the live run).

- New brain/anti-patterns/sensitive-product-stays-local.md: a replica/sensitive product keeps metadata (not just code) out of the always-public factory; wired via gitignored code-paths.local.json only.

- Learning + changelog (v1.35); README counts 65->66 / 24->25.

No product code in this repo. Nothing deployed. Mock-first; secrets-free.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants