Skip to content

docs(plans): Agent Factory — the developer flow, automated (against the live SDK) - #1914

Merged
kovtcharov merged 17 commits into
mainfrom
claudia/agent-factory
Jul 2, 2026
Merged

kovtcharov merged 17 commits into
mainfrom
claudia/agent-factory

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Why this matters

Agents rot when frozen against an SDK snapshot — the GAIA SDK changes constantly. The Agent Factory is the developer lifecycle itself, automated, against the live SDK: clone → scope → issues → spec → synthetic data → implement → eval-gate → PR → build/ship → maintain on SDK deltas. It splits into a dev half (net-new agentic-coding automation) and a ship half (the existing, rigorous release_agent_email.yml + packaging/* pipeline, which the factory orchestrates rather than reinvents), tied by the maintenance loop — the differentiator nobody in the field (Hermes/OpenClaw learn skills) ships.

The plan is deliberately hardened: it has been through two adversarial architecture reviews, an independent cold read, and two domain-specialist reviews (eval methodology vs scorecard_gate.py/benchmark.py; release mechanics vs the live workflow/Hub Worker), with every correction folded into the normative sections (§11.5–§11.7 record what changed). Every "exists" claim is code-verified — including the honest ones: the whole-package zip is disabled (Cloudflare 413), the coder lives on origin/coder, and the manifest schema depends on #1913.

Load-bearing design points: a concrete recipe as the single authored input (§1.5) · per-stage human approve/deny gates incl. a blast-radius dry-run before any SDK release (§2.5) · the factory's own least-privilege authority (§2.6) · a statistically sound eval gate (fixed bar + non-inferiority band, matching the shipped scorecard_gate.py; §5) · synthetic-data discipline with a human-curated held-out oracle, curator ≠ spec author, split by thread-id (§5.5) · recovery levers that match the real infra (roll-forward, dist-tag, version pin; §6.5) · difficulty-ordered milestones M0→M4 with merge-prerequisites named (§10).

Test plan

  • Review docs/plans/agent-factory.md end-to-end (reading map at top; §11.5–§11.7 record the review corrections).
  • Confirm the §12 open decisions (orchestrator substrate; trusted-lane auto-approve scope; stage-18 trigger policy; recipe-vs-manifest).
  • 🔒 Sign off on the two escalated items: the PII scrub/consent gate for seed-from-real (§5.5) and the SDK-release blast-radius gate (§2.5).
  • Docs-only; no code paths affected.

…SDLC)

The factory is the developer flow automated against the LIVE (evolving) GAIA SDK:
clone -> scope -> issues/milestones -> spec -> iterate -> synthetic datasets ->
implement (live SDK) -> eval+optimize -> PRs into the codebase -> build+ship ->
maintain on SDK deltas. Engine = agentic coding (Claude Code + skills + memory
and/or Anthropic Agent SDK) driving the GAIA coder (origin/coder), in an isolated
live-SDK worktree. Grounds every stage in existing components (coder branch, eval
framework + --fix + synthetic corpus, gh, code_index, packaging line); net-new work
is the orchestrator + the SDK-delta maintenance loop. Sibling to the Agent UI v2
runtime PR (#1913); connects via the manifest/Hub/signing seam.
@github-actions github-actions Bot added the documentation Documentation changes label Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Verdict: Approve ✅

This adds a single plan doc, docs/plans/agent-factory.md, describing an automated SDLC ("Agent Factory") that builds and maintains GAIA agents against the live SDK. It's a design/vision doc — no code paths touched — and it's unusually well-grounded: every component it cites as exists (the coder branch's CodeAgent, the src/gaia/eval/ framework, the packaging/* line, claude.yml/build_agents.yml/publish_agents.yml/release_agent_email.yml, code_index, git worktrees) actually resolves in the tree, and it's honest about the net-new work (orchestrator + SDK-delta loop).

The one thing to be aware of: the doc leans on §0.x section references (manifest, Hub, signing, contract-version, autonomy) that live in the sibling runtime doc, and those §0 sections aren't in main yet — they land with #1913. The doc header discloses this dependency clearly, so it's not blocking, just a forward-reference that will dangle until #1913 merges.

No security concerns, no prompt-injection content in the diff.

🔍 Technical details

🟢 Minor — §0.x cross-references don't resolve yet (docs/plans/agent-factory.md:6-10, plus §0.28/§0.5/§0.24/§0.15/§0.34 throughout)
The current agent-ui-agent-capabilities-plan.md in main has no §0 section (it starts at "Milestone Scope Summary" → "## 1."), so none of the referenced anchors (§0.28 manifest, §0.5 Hub, §0.24 signing, §0.15 contract-version, §0.34 autonomy) resolve today. The header note and commit 698b7a7 already disclose that these come from #1913, so this is expected — flagging only because if #1913 lands with a different §-numbering, these refs rot silently with nothing to catch it. Worth a grep-check when #1913 merges. No change needed now.

Convention checks (all pass):

  • .md placement in docs/plans/ matches the existing convention — sibling .md plan files (agent-hub-22-agents-spec.md, agent-ui-agent-capabilities-plan.md, axis-gaia-integration.md) are also absent from docs/docs.json navigation, so no docs.json entry is required for this .md (unlike .mdx plans). Correct.
  • Relative link [agent-ui-agent-capabilities-plan.md](...) resolves — target exists.
  • Docs-only; no agent/CLI/SDK/test surface touched, so no test or eval requirement applies.

Strengths:

  • Claims are verifiable, not hand-wavy — the "exists vs net-new" inventory (§6) and the stage table (§3) cite real files/branches/workflows, all of which check out. That's exactly what keeps a vision doc from drifting into fiction.
  • The §8 "distinctiveness" and §9 "open decisions" sections are honest about what's speculative (the orchestrator + stage-10 SDK-delta loop are the hard, unbuilt part) rather than overselling — good for a doc whose job is to earn sign-off.

kovtcharov added 15 commits July 1, 2026 12:19
…halves SDLC)

Studied the real email pipeline (release_agent_email.yml + packaging/*) and folded the
gaps in. Key reframe: the factory is a two-halves SDLC — a DEV half (front, mostly
net-new: scope/issues/spec/synth-data/code/eval/PR via agentic coding) and a SHIP half
(back, ALREADY EXISTS and is rigorous). The factory ORCHESTRATES the existing ship half;
it must not reinvent or lose its rigor. Added the ship stages I missed:
docs generate+sync (5 surfaces + openapi, must stay in sync); scorecard as a shipped/
refreshed artifact; data-driven eval gate (prev-release baseline + acceptance bar +
URGENT floor #1437); multi-platform matrix + required-platform assertion; cross-OS-version
compat verify; real-hash lock regeneration; whole-package multi-component assembly;
npm-OIDC provenance; post-publish edge verification (#1655); catalog redeploy; release
governance (cut-from-main, version SSOT). Product is multi-component (binaries + npm
client + docs + lock), not one binary. Updated the component inventory (ship half exists;
dev-half orchestrator + SDK-delta loop are net-new) and the phased build (wrap the existing
ship half first).
…into the factory

Restructured the build into difficulty-ordered milestones (§10, easiest→hardest) and
folded the adversarial review's corrections (§11.5).

Milestones automate deterministic/existing work first, judgment-heavy/unsolved-research
work last:
  M0 Generalize the ship half (recipe-driven, per-agent; prove on a 2nd non-email agent)
  M1 Provenance + edge-verified releases (no LLM in the loop)
  M2 Independent eval oracle + confidence-bound gate (human-curated held-out set)
  M3 Assisted dev automation (agentic coding, human-gated)
  M4 SDK-delta maintenance loop (last; hard rules: serial-eval cap, no SDK auto-PR)

Review corrections: "reproducible against an SDK commit" is a category error (LLM codegen
isn't reproducible) → traceability + source-hash, not regeneration; "orchestrate don't
reinvent" overclaims reuse (release_agent_email.yml is 718 lines, email-hardcoded, npm OIDC
bound to the filename) → M0 proves generalization empirically; the eval gate has no
independent oracle (factory writes the agent AND its eval data AND sets the bar) → M2 adds a
human-curated held-out oracle + LCB-over-k-runs gating as a hard prereq for M3-M4; M4's
maintenance loop has a convergence hazard + a serial-eval throughput ceiling (N agents on one
Lemonade slot); AI auto-PRing the shared SDK is a hard boundary, not a rec (fails + files an
issue) — escalated. Downgraded the coder/#1913 deps to "exists on a branch."
…e human approve/deny

Corrects the SDK boundary: the factory MAY ship new SDK versions via PR + tagging (driving
the existing release process) — the containment is a human approve/deny gate at the risky
stages, not a prohibition. Adds §2.5 as a first-class concept: per-stage approve/deny
checkpoints (spec / PR-open / merge / SDK-release / ship) mirroring the agent confirmation
model (runtime §0.4 + §0.34 autonomy levels), configurable per trust level and
halting-by-default on the high-blast-radius stages. The all-agent re-eval an SDK change
triggers is reframed as the intended regression net (bounded by the serial-eval cap), not a
hazard. Updated §11.5, the M4 milestone gate, and the §12 open decisions accordingly.
…; fix train/held-out consistency

- New §5.5: synthetic data generation — seed-from-real (vendor_corpus_seed), ground truth
  known by construction (not AI-labelled post-hoc), and the strict dev/optimize vs.
  human-curated held-out split (the review's anti-circularity fix). Grounded in the email
  agent's existing practice (generate_mbox.py, committed ground_truth.json,
  pdf_document_generator templates, phishing_fixture adversarial bucket).
- Reconciled earlier text with the split: the continuous regression net (§1), stage 5, and
  the eval gate (§5) now run on the held-out oracle, not the tuning corpus.
- §2.5: non-convergence fails loudly — bounded auto-iteration budget, then halt + escalate
  to the human gate; never lowers the bar / disables a scenario / ships best-so-far.
…radius holes in-place

Second review found the first-round fixes were partly prose over unclosed holes. Fixed the
findings in the CANONICAL sections (not just a critique capstone — the review flagged that
anti-pattern):

- Held-out oracle self-certification: "different provenance" was defined against the LLM
  implementer (trivially true). Now requires curator ≠ SPEC AUTHOR (the real circular
  source), plus a human-judged real-data label slice (by-construction labels alone encode
  the author's definition as truth). §5.5.
- Oracle was consumed (stages 7/13) but produced nowhere and could rot as the agent grows.
  Added stage 5b (curate/extend the held-out oracle) with a coverage-delta gate. §3, §5.5.
- SDK-release human gate fired blind to blast radius (approving a tag before the N-agent
  fan-out is known = relocated rubber stamp). Now feeds the gate a pre-cut all-agent dry-run
  (approve the radius, not the tag) and disambiguates SDK-release (M4) from agent-publish
  (stage 16). §2.5, M4.
- Propagated LCB/k-runs gating into the canonical gate spec (§5, stage 13), not only §11.5.
- §10 now names unmerged-branch prerequisites (#1913 manifest schema; origin/coder) instead
  of "exists"; M0 flags per-agent OIDC provisioning as supply-chain work + packaging-parity
  risk. Non-convergence capacity cost (mis-sized-cadence signal) added to §2.5.
- 🔒 seed-from-real is a recurring PII intake → scrub/consent gate on every refresh (§5.5).
- §11.6 records what the fixes did/didn't close (closed / hardened / fixed / residual).
…ecovery, versioning

Third review pass (validated claims against the codebase; all cited components confirmed
real) surfaced three genuine design gaps the adversarial passes missed:

- §2.6 The factory's own authority: the factory is the most privileged actor (repo write,
  PR/merge, npm+Hub publish, SDK tag) yet its OWN powers were never scoped. Now least-
  privilege per stage — publish/merge/tag credentials held by the human gates, not the
  orchestrator; isolated execution with secrets injected only at the gated stage; auditable.
  The factory is subject to the same capability discipline it ships.
- §6.5 Recovery: verified there is NO rollback path today (all fail-forward). A passed-but-
  broken release is recovered by pin-previous (binaries.lock), yank + npm-deprecate + revert
  SDK tag + roll the Hub catalog back; the failing case is curated into the held-out oracle
  (stage 5b) so it can't re-ship — recovery feeds M2.
- Versioning is a factory decision, not a human-set constant: stamp_version.py only
  propagates; the factory chooses the semver bump from contract impact (breaking → major,
  runtime §0.15) so the version guard stays honest.
…cy layer, not levels)

Verified all six §0.x cross-references to the runtime doc (#1913) are accurate (§0.4
confirmation, §0.5 install/Hub, §0.15 contract-version, §0.24 signing, §0.28 manifest
schema, §0.34 autonomy). Corrected one: the runtime doc explicitly says §0.34 is 'a policy
+ temporal engine, not one enum field,' so calling it 'autonomy levels' contradicted the
sibling doc — now 'autonomy policy layer.'
…recipe to §1.5

Two navigability/completeness gaps closed: (1) the 'recipe' — the single authored input
driving the whole pipeline — was referenced 8x but never shown; added §1.5 with a concrete
recipe example (model/tools/skills/mcp/connectors/egress/eval-with-held-out-oracle+
safety-floors+LCB-gate/trust_tier/per-stage-gates/targets) and its relationship to the
manifest, held-out oracle, and versioning. (2) Added a reading-map jump-list for the
486-line doc.
…ume it) + milestone-range/nits

Independent cold read found one load-bearing contradiction inside the anti-circularity
section: §5.5 said 'Stages 7/13 consume the held-out oracle,' but rule 3 forbids the oracle
in stage 7's optimize loop (that's the memorization flaw the section exists to prevent).
Corrected to 'Stage 13 (and the regression gates) consume … stage 7 must not.'
Also: M0's stage range overclaimed (10/13/15/17 are M1/M2 work) → scoped M0 to the
deterministic packaging spine (9,11,12,14,16); dropped a rotting self-referenced line count;
'18 stages' → 'lifecycle stages'; marked the recipe's gates as an illustrative subset; and
defined how the coverage-delta gate measures capability/coverage.
…elease mechanics)

Ran eval-engineer + release-manager over the densest sections vs the real code; both found
factual errors the generalist passes missed. Corrected in-place (+ §11.7 record):

EVAL (vs scorecard_gate.py / benchmark.py / statistics.py):
- The gate LCB(candidate) >= prev_release_point + moving baseline is a ratchet that locks out
  releases in ~2-3 cycles → replaced with the SHIPPED construction: fixed acceptance bar +
  fixed safety floor, previous release as a non-inferiority band `>= prev - k*stdev`.
- k = stdev-band multiplier (default 1.0), n_runs = repetitions (3) — the draft conflated
  them (collided with --regression-k; 5x'd serial-eval cost).
- Safety floor is a point tripwire not a CI guarantee (0.95 needs ~59 sized instances; #1437
  uses 0.90 on the needs-attention axis); split by source/thread-id (near-dup leakage);
  enforce oracle separation as a harness mechanism; coverage-delta at scenario-class level;
  size the human-judged slice.

RELEASE (vs release_agent_email.yml / agent-hub Worker / fetch.ts / stamp_version.py):
- Recovery rewritten to the real infra: Hub Worker has no rollback route (roll forward), npm
  redirect is dist-tag (not deprecate), pin-previous is a version re-install (immutable lock),
  tag-revert un-ships nothing.
- Two-axis versioning: contract API_VERSION (§0.15 guard) AND package semver, kept separate.
- Whole-package zip is DISABLED (Cloudflare 413) — shipped product is npm tarball + R2
  binaries (§6/§7/stages 14/17). §2.6 publish-secret gate is built; merge/tag gating needs
  branch/tag-protection + an orchestrator token without contents:write. Stage 9/12 precision.
…e' skill, correct claude.yml role

Code-validated the dev-half stage components (the ship/eval halves were validated earlier).
Two false claims found and fixed: (1) stage 8 cited a 'finalize' skill that does not exist in
.claude/skills/ — removed. (2) stage 2 (open issues/milestones) misattributed claude.yml,
which is a PR-review/auto-fix bot, not an issue opener — corrected to gh CLI. Verified real:
code_index_tools.py, and the superpowers skills (brainstorming/writing-plans/TDD/debugging).
Also recorded an accurate strengthening point: claude.yml's auto-fix (issue → bug → branch →
PR + test steps) is a shipped, scoped instance of the dev-half loop — evidence M3 isn't vapor.
…ate; reading map += §11.7

The §11.7 eval correction (fixed bar + non-inferiority band; k = stdev multiplier, n_runs =
repetitions) had not been propagated to the normative M2/M4 milestone rows, which still said
'LCB(score, k runs) >= bar' / 'LCB-gated' — the exact k-as-run-count conflation §11.7 fixed.
Also added §11.7 to the reading map.
… coder-status caveat

The §2.5 non-convergence paragraph escalates stages 4/7 'to the human gate,' but the
checkpoint table had no such checkpoint (2nd-review item never propagated). Added the
Escalation row. §12.1 said the coder 'exists' without the on-a-branch caveat, contradicting
§10's merge-prerequisites — aligned.
…e (three lanes, gaia-agent.yaml, existing runbooks)

Deep codebase pass found the plan under-credits real infrastructure:

- The recipe (§1.5) now EXTENDS gaia-agent.yaml — the per-agent manifest 18 hub agents
  already carry (id/version/models/entry/deps/platforms/interfaces) — instead of inventing
  a second per-agent YAML that would drift against it.
- The ship half is THREE lanes (§6), one already generalized: the wheel→PyPI lane
  (publish_agents.yml: discover-from-setup.py matrix, one manual approve gate, per-agent
  PyPI OIDC) is per-agent TODAY — a shipped validation of §2.5/§2.6's human-gate +
  per-agent-publisher model; the frozen-binary sidecar lane (release_agent_email.yml) is
  email-only and is M0's actual work; build_agents.yml is the C++ lane.
- M0 rescoped to the sidecar lane; the agent-hub-release skill named as its existing runbook.
- M2 quantified: 1 of 18 agents has a scorecard today — 17 adapters + oracles to adopt;
  adding-eval-scorecard is the per-agent runbook.
- §9 inventory += gaia agent init (scaffold CLI), gaia agent publish, publish_agents.yml,
  gaia-agent.yaml, and the two skills; M3 scaffold grounded on gaia agent init.
…lidate the three critique appendices into one review record

Second independent cold read (verdict: minor-gaps, close to converged). Fixes:

- LCB terminology leak: §5 contradicted itself ("do not gate LCB..." then "LCB is the M2
  upgrade" 8 lines later) and stage-13/M2 used three different names for the same gate —
  now "non-inferiority band" everywhere normative.
- Docs-in-sync timing resolved: M0 ships stage 9 as-is (SCORECARD gen + publish committed
  docs); the sync-check automation that makes it a hard gate is an M1 deliverable (§4).
- M0 day-1 prerequisites stated (§10): the npm-OIDC publisher topology fork (now §12.6,
  rec: N thin per-agent callers for supply-chain isolation), recipe schema v1 as an M0
  deliverable, and pick-the-second-agent + packaging-parity audit.
- M2 row now owns stage 5b + the coverage-delta gate explicitly.
- Structural: consolidated §11.5/§11.6/§11.7 (~113 lines of evolving prose appendices —
  the drift vector that produced the LCB leak twice) into ONE §11.5 review-record table
  (finding → resolution → normative home, one row per finding, ~26 rows), preserving the
  🔒 escalations, the residual rubber-stamp risk, and the honest reframe. Doc shrank
  620 → 598 lines while gaining the M0-prereq + §12.6 content.
- Cosmetic: malformed ASCII box corners; stale §11.6/§11.7 cross-refs.
@kovtcharov
kovtcharov enabled auto-merge July 1, 2026 22:43
@kovtcharov
kovtcharov added this pull request to the merge queue Jul 2, 2026
Merged via the queue into main with commit bfdf8c3 Jul 2, 2026
28 checks passed
@kovtcharov
kovtcharov deleted the claudia/agent-factory branch July 2, 2026 12:37
kovtcharov-amd pushed a commit that referenced this pull request Jul 7, 2026
…in-language overview (#1954)

## Why this matters

The merged factory spec (#1914) still claims the `−k·stdev` eval band is
future M2 work when it already ships in `scorecard_gate.py` (#1894),
calls #1913 unmerged (it merged July 1 — M1's dependency story changed),
and carries a recipe example whose own fields wouldn't validate
(`min_ctx: 8192` vs the real 65536, a `calendar` scope that doesn't
exist in the connector catalog). Anyone scoping M1–M3 from the spec
as-is would plan against wrong facts. This PR corrects every claim a
code-verification pass refuted, and adds a two-page plain-language
overview so stakeholders can understand what the factory is and why we
need it without reading 600 lines of stage tables.

Two threads:
- **Corrections** — eval-gate status (band ships; M2 = per-agent
adoption + oracle), #1913 merged, coder dependency re-scoped
(`gaia-agent-code` ships on main; the unmerged piece is
`src/gaia/coder/`, ~420 commits behind), recipe field fixes, and honesty
patches (gitignored `ground_truth.json`, dispatch-only scorecard
refresh, no CLI hub-install, tarball excludes examples/tests, darwin-x64
best-effort, CI wires neither skills nor memory).
- **Overview doc** — `docs/plans/agent-factory-overview.md`, the
'what/why' companion for first-time readers.

## Test plan

- [x] `grep` sweep for the stale forms (`unmerged #1913`, `8192`,
`committed/curated`, `on a cadence`, `re-run 1–17`, `already in CI`) —
zero hits remain
- [x] Every corrected claim cites its evidence: `scorecard_gate.py` band
logic (#1894), `lemonade_client.py` `min_ctx_size=65536`,
`connectors/catalog/google.py` scope names,
`tests/fixtures/email/.gitignore` (ground truth derived),
`email_scorecard_refresh.yml` triggers, npm `files` whitelist
- [x] Overview links resolve (`agent-factory.md`,
`agent-ui-agent-capabilities-plan.md`, `hub-publishing.mdx`,
`eval-scorecard.mdx`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants