Skip to content

feat(architect): generate → run → judge → refine loop that ships Proven templates#269

Closed
gizmax wants to merge 3 commits into
feat/template-hubfrom
feat/architect
Closed

feat(architect): generate → run → judge → refine loop that ships Proven templates#269
gizmax wants to merge 3 commits into
feat/template-hubfrom
feat/architect

Conversation

@gizmax

@gizmax gizmax commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Upgrades the one-shot /generate endpoint into The Architect: an autonomous loop that doesn't stop until the generated workflow actually works — and ships it with a recorded cassette proof.

  • engine/architect.py: generate (existing generator.py, reusing its refine_from/refine_instruction) → derive test inputs (schema defaults → LLM → placeholders) → execute for real with cassette recording, budget- and time-capped, admin_trusted=False → hard checks + LLM judge vs the original description → refine with judge feedback, up to architect_max_iterations (3)
  • On success: workflow + recorded cassette packed via bundle.py and verified with the same verify_bundle that gates installs — proven=true only if the proof actually verifies; installed like template install
  • API: POST /api/architect (async job) + GET /api/architect/{job_id} (per-iteration log); CLI: sandcastle architect "<description>" [--budget 1.0]
  • Safety: generator constrained to cassette-replay-safe standard steps; generated code steps can never execute (admin_trusted=False); budget tracks live-run spend with per-run caps

Tests: 18 new + 485-test regression subset green (incl. template bundle suite); ruff clean.

Stacked on #264 (template-hub) — merge that first.

Tomas Pflanzer and others added 3 commits June 10, 2026 14:19
… proof bundles

engine/architect.py drives the loop: generate a workflow from a NL
description via the existing generator, execute it live with cassette
recording on (budget- and time-capped, admin_trusted=False), hard-check
the run and LLM-judge the output against the description, and feed
failures back through the generator's refine path. On success the
workflow + recorded cassette are packed into a .sctpl bundle, verified
with the same verify_bundle that gates template installs, and installed
into the community templates dir.

Config: architect_max_iterations (3), architect_budget_usd (1.0),
architect_score_threshold (0.7) with clamping validators.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
POST /api/architect starts an admin-gated async job (in-memory job
store, same pattern as batch runs); GET /api/architect/{job_id} returns
status, the per-iteration progress log, and the final result with
bundle path. CLI: sandcastle architect "<description>" [--input k=v]
[--budget] [--max-iterations] [--threshold] runs the loop synchronously,
prints iteration progress, exits 0 with the bundle path on success and
2 when the loop ends unproven.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… section

Tests mock the LLM surfaces (generator + judge) but run the real
executor against a mocked provider runtime, so the recorded cassette
and packed bundle are genuine - the success test proves the bundle with
verify_bundle. Covers: first-iteration success, refine-then-succeed,
validation-error feedback, budget exceeded aborts cleanly, max
iterations returns best-effort proven=false, hard-check failures skip
the judge, test-input derivation, config defaults, API job lifecycle
(start/poll/404/failure), CLI exit codes. README: 'The Architect'
subsection under Verified Templates.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gizmax

gizmax commented Jun 11, 2026

Copy link
Copy Markdown
Owner Author

Shipped in v0.40.0 (release integration merged to main). Closing — superseded by the 0.40.0 release.

@gizmax gizmax closed this Jun 11, 2026
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.

1 participant