feat: /swarm + factory-root resolution + autonomy-loop hardening - #19
Open
hamza-ali-shahjahan wants to merge 1 commit into
Open
feat: /swarm + factory-root resolution + autonomy-loop hardening#19hamza-ali-shahjahan wants to merge 1 commit into
hamza-ali-shahjahan wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
/hamzaishassumedcwd == 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.scripts/autonomy-loop.tswas undiscoverable (never routed to by any command); the rest (mock-first scaffold, on-disk brief, the build/verifyWorkflow) 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);/swarmadded 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,STOPkill switch.scripts/autonomy-loop.ts— preflight (claudeCLI +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-turnsand exited without writingloop-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 gitignoredcode-paths.local.jsononly.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.tsparses across all branches (bun build) and dry-runs.resolve-root.shresolves 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)
--max-turns)./swarmproves out, repackage as a portablefactory/plugins/plugin (likeweb-launch).