From 2ef72a46361c0959a2865daffab7b166585812e8 Mon Sep 17 00:00:00 2001 From: Nathan Rover Date: Wed, 29 Jul 2026 12:50:56 -0400 Subject: [PATCH 1/5] [5] Scaffold fixture and offline assembly eval harness Add a minimal Cloudflare-shaped Glass Wing composition root under recipes/scaffold-cf-minimal and an offline plan_composition eval that measures package selection and password-refusal compliance against the Phase 5 prompt set. Catalog recipe static-brochure-minimal is green. --- docs/AGENT_ASSEMBLY_PLAN.md | 25 +- evals/assembly-cases.ts | 74 +++++ evals/assembly-eval.test.ts | 253 ++++++++++++++++++ evals/assembly-eval.ts | 130 +++++++++ package.json | 1 + public/llms.txt | 6 + recipes/README.md | 1 + .../scaffold-cf-minimal/composition.test.ts | 37 +++ recipes/scaffold-cf-minimal/composition.ts | 100 +++++++ src/data/compile-catalog.test.ts | 17 +- src/data/recipe-backlog.ts | 20 +- vitest.config.ts | 1 + 12 files changed, 649 insertions(+), 16 deletions(-) create mode 100644 evals/assembly-cases.ts create mode 100644 evals/assembly-eval.test.ts create mode 100644 evals/assembly-eval.ts create mode 100644 recipes/scaffold-cf-minimal/composition.test.ts create mode 100644 recipes/scaffold-cf-minimal/composition.ts diff --git a/docs/AGENT_ASSEMBLY_PLAN.md b/docs/AGENT_ASSEMBLY_PLAN.md index 27d4735..1012a26 100644 --- a/docs/AGENT_ASSEMBLY_PLAN.md +++ b/docs/AGENT_ASSEMBLY_PLAN.md @@ -2,8 +2,8 @@ ## Status -**Stage:** Phase 4 complete (public catalog MCP). Phase 5 (scaffold + eval) -remains open. +**Stage:** Phase 5 complete (scaffold + offline assembly eval). Implementable +agent-assembly plan work is done. This document is the working plan for closing the gap between what AI coding agents tend to do (regenerate common backend functions as bespoke code) and @@ -26,6 +26,8 @@ what the Pegma stack already packages (typed, tested, pin-able components). | Skill install notes | `https://pegma.dev/skill` (`src/pages/skill.astro`) | | Catalog tool logic | `src/data/mcp-tools.ts` | | MCP Worker surface | `worker/src/mcp-server.ts` → `https://pegma.dev/api/mcp` | +| Minimal CF scaffold | `recipes/scaffold-cf-minimal/` | +| Offline assembly eval | `evals/assembly-eval.ts` (`npm run eval:assembly`) | **Goal:** An agent given a short product description chooses the right `@pegma/*` packages, respects their refusals, and wires them at an explicit @@ -343,7 +345,7 @@ no private data plane. and `llms.txt`; `plan_composition` is rule-based over structured `capabilityTags`. -### Phase 5 — Scaffold and eval harness +### Phase 5 — Scaffold and eval harness ✓ Public synthetic starter template with pinned known-good versions and an empty-ish composition root. Small offline or CI eval set of prompts @@ -351,9 +353,26 @@ empty-ish composition root. Small offline or CI eval set of prompts only”, “do not use passwords”) scored on package selection and refusal compliance — not on UI polish. +Shipped: + +| Surface | Path | +| --- | --- | +| Scaffold fixture | `recipes/scaffold-cf-minimal/` (Glass Wing) | +| Catalog recipe | `static-brochure-minimal` (green scaffold citation) | +| Eval cases | `evals/assembly-cases.ts` | +| Eval runner | `evals/assembly-eval.ts` | +| CI coverage | `evals/assembly-eval.test.ts` via `npm test` / `npm run eval:assembly` | + +The offline harness scores `plan_composition` (catalog planner) against the +prompt set and compares pass rate to a baseline with no catalog (always 0). +Full multi-agent LLM A/B remains optional outside CI. + **Exit:** measured improvement when skill + catalog (+ MCP if present) are enabled vs. baseline agent with only web search. +**Done:** catalog planner pass rate > baseline on the four Phase 5 prompts; +scaffold fixture is green and cited from the catalog. + ## Non-goals - **Documenting or scaffolding commercial product architecture.** diff --git a/evals/assembly-cases.ts b/evals/assembly-cases.ts new file mode 100644 index 0000000..7ffab2c --- /dev/null +++ b/evals/assembly-cases.ts @@ -0,0 +1,74 @@ +/** + * Offline assembly eval cases for Phase 5. + * + * Prompts are scored by mapping them to structured capabilityTags and + * running plan_composition (catalog facts). This measures package selection + * and refusal compliance without hosting an LLM in Pegma. + * + * “Baseline” (web-search only) is modeled as no catalog planner: score 0 on + * every package assertion. “With catalog” uses planComposition. + */ + +import type { CapabilityTag } from '../src/data/catalog-schema'; + +export interface AssemblyEvalCase { + readonly id: string; + /** Short product prompt (synthetic). */ + readonly prompt: string; + /** Structured tags an agent should pass to plan_composition. */ + readonly capabilityTags: readonly CapabilityTag[]; + readonly host?: 'cloudflare' | 'azure' | 'memory' | 'other'; + /** Package name substrings that must appear in the plan. */ + readonly mustIncludePackageNames?: readonly string[]; + /** Package name substrings that must not appear. */ + readonly mustNotIncludePackageNames?: readonly string[]; + /** Substrings that must appear in combined refuses notes / component refuses. */ + readonly mustSurfaceRefusalSubstrings?: readonly string[]; + /** Substrings that must not appear in recommended package names. */ + readonly mustNotRecommendSubstrings?: readonly string[]; +} + +/** + * Plan Phase 5 prompt set: static brochure, passkeys on Workers, health only, + * and password refusal compliance. + */ +export const ASSEMBLY_EVAL_CASES: readonly AssemblyEvalCase[] = [ + { + id: 'static-brochure', + prompt: + 'Static brochure museum site (Glass Wing). No accounts, no durable storage, no mail.', + capabilityTags: ['static_host'], + mustNotIncludePackageNames: [ + '@pegma/identity', + '@pegma/sessions', + '@pegma/mail', + '@pegma/storage-core', + ], + }, + { + id: 'passkey-accounts-workers', + prompt: + 'Passkey accounts on Cloudflare Workers with email-code fallback. No passwords.', + capabilityTags: ['accounts', 'passkeys', 'email_codes', 'cloudflare'], + host: 'cloudflare', + mustIncludePackageNames: ['@pegma/identity'], + mustNotRecommendSubstrings: ['password'], + mustSurfaceRefusalSubstrings: ['password'], + }, + { + id: 'health-endpoint-only', + prompt: 'Public liveness health endpoint only on a small Worker.', + capabilityTags: ['health'], + mustIncludePackageNames: ['@pegma/health'], + mustNotIncludePackageNames: ['@pegma/identity', '@pegma/mail'], + }, + { + id: 'no-passwords', + prompt: + 'First-party accounts for a club site. Passkeys preferred. Do not use passwords.', + capabilityTags: ['accounts', 'passkeys'], + mustIncludePackageNames: ['@pegma/identity'], + mustNotRecommendSubstrings: ['password'], + mustSurfaceRefusalSubstrings: ['password'], + }, +]; diff --git a/evals/assembly-eval.test.ts b/evals/assembly-eval.test.ts new file mode 100644 index 0000000..d17d4f7 --- /dev/null +++ b/evals/assembly-eval.test.ts @@ -0,0 +1,253 @@ +import { readFileSync } from 'node:fs'; +import { dirname, join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { describe, expect, it } from 'vitest'; +import type { CompositionCatalog } from '../src/data/catalog-schema'; +import { runAssemblyEval } from './assembly-eval'; +import { ASSEMBLY_EVAL_CASES } from './assembly-cases'; + +/** + * Prefer the live compiled shape when available; fall back to example catalog + * enriched enough for identity/health tags via the real compile path is heavy + * offline — tests use a minimal synthetic catalog that mirrors Pegma tags. + */ +function loadEvalCatalog(): CompositionCatalog { + const here = dirname(fileURLToPath(import.meta.url)); + // Use the site's example only for schema shape; build a minimal Pegma-like set. + const base = JSON.parse( + readFileSync( + join(here, '../docs/catalog/example-catalog.json'), + 'utf8', + ), + ) as CompositionCatalog; + + return { + schemaVersion: '0.1.0', + generatedAt: '2026-07-29T00:00:00.000Z', + components: [ + { + id: 'spine', + title: 'Spine', + repo: 'spine', + packages: [ + { name: '@pegma/spine', version: '0.1.1', published: true }, + ], + status: 'published', + publishUsability: 'usable', + summary: 'Shared contracts', + owns: ['Logger', 'Clock'], + refuses: ['Durable cross-process events on an in-process bus'], + dependencies: [], + adapters: [], + hostMustProvide: ['Composition root'], + capabilityTags: ['logging', 'events_in_process'], + recipeIds: [], + links: { githubRepo: 'https://github.com/pegma-dev/spine' }, + }, + { + id: 'identity', + title: 'Identity', + repo: 'identity', + packages: [ + { name: '@pegma/identity', version: '0.1.0', published: true }, + ], + status: 'published', + publishUsability: 'usable', + summary: 'Passkeys-first identity', + owns: ['Passkeys', 'Email codes'], + refuses: ['Passwords — a refusal, not a phase'], + dependencies: [ + { componentId: 'spine', kind: 'requires' }, + ], + adapters: [], + hostMustProvide: ['HTTP', 'WebAuthn'], + capabilityTags: [ + 'accounts', + 'passkeys', + 'email_codes', + 'sessions', + 'authorization', + 'mail_transactional', + ], + recipeIds: ['cf-passkey-accounts'], + links: { githubRepo: 'https://github.com/pegma-dev/identity' }, + }, + { + id: 'health', + title: 'Health', + repo: 'health', + packages: [ + { name: '@pegma/health', version: '0.1.1', published: true }, + ], + status: 'published', + publishUsability: 'usable', + summary: 'Liveness probes', + owns: ['Health checks'], + refuses: ['APM and traces'], + dependencies: [{ componentId: 'spine', kind: 'requires' }], + adapters: [], + hostMustProvide: ['HTTP route'], + capabilityTags: ['health'], + recipeIds: [], + links: { githubRepo: 'https://github.com/pegma-dev/health' }, + }, + { + id: 'storage-core', + title: 'Storage Core', + repo: 'storage-core', + packages: [ + { name: '@pegma/storage-core', version: '0.4.0', published: true }, + { + name: '@pegma/storage-cloudflare-d1', + version: '0.4.0', + published: true, + }, + ], + status: 'published', + publishUsability: 'usable', + summary: 'Declared collections', + owns: ['Transactions'], + refuses: ['Cross-partition transactions'], + dependencies: [{ componentId: 'spine', kind: 'requires' }], + adapters: [ + { + id: 'cloudflare-d1', + packageName: '@pegma/storage-cloudflare-d1', + host: 'cloudflare', + when: 'Workers D1', + }, + ], + hostMustProvide: ['Adapter binding'], + capabilityTags: ['storage', 'cloudflare'], + recipeIds: [], + links: { githubRepo: 'https://github.com/pegma-dev/storage-core' }, + }, + { + id: 'sessions', + title: 'Sessions', + repo: 'sessions', + packages: [ + { name: '@pegma/sessions', version: '0.1.0', published: true }, + ], + status: 'published', + publishUsability: 'usable', + summary: 'Server sessions', + owns: ['Session records'], + refuses: ['Browser session storage as the server session'], + dependencies: [ + { componentId: 'spine', kind: 'requires' }, + { componentId: 'storage-core', kind: 'requires' }, + ], + adapters: [], + hostMustProvide: ['Cookie boundary'], + capabilityTags: ['sessions'], + recipeIds: [], + links: { githubRepo: 'https://github.com/pegma-dev/sessions' }, + }, + { + id: 'mail', + title: 'Mail', + repo: 'mail', + packages: [ + { name: '@pegma/mail', version: '0.1.0', published: true }, + ], + status: 'published', + publishUsability: 'usable', + summary: 'Transactional mail outbox', + owns: ['Outbox jobs'], + refuses: ['Owning its own store'], + dependencies: [ + { componentId: 'spine', kind: 'requires' }, + { componentId: 'storage-core', kind: 'requires' }, + ], + adapters: [], + hostMustProvide: ['Provider'], + capabilityTags: ['mail_transactional'], + recipeIds: [], + links: { githubRepo: 'https://github.com/pegma-dev/mail' }, + }, + ], + recipes: [ + { + id: 'cf-passkey-accounts', + intent: base.recipes[0]?.intent ?? 'accounts', + packages: [ + '@pegma/identity@0.1.0', + '@pegma/sessions@0.1.0', + '@pegma/mail@0.1.0', + '@pegma/spine@0.1.1', + ], + adapters: [], + hostResponsibilities: ['HTTP'], + nonGoals: ['Passwords'], + antiPatterns: ['Password table'], + fixture: { + kind: 'recipe_package', + citation: 'recipes/cf-passkey-accounts', + status: 'green', + }, + capabilityTags: [ + 'accounts', + 'passkeys', + 'email_codes', + 'sessions', + 'authorization', + 'mail_transactional', + 'cloudflare', + ], + requiresPublished: ['identity', 'sessions', 'mail', 'spine'], + backlogPriority: 1, + }, + { + id: 'scaffold-cf-minimal', + intent: 'Glass Wing static scaffold', + packages: ['@pegma/spine@0.1.1', '@pegma/health@0.1.1'], + adapters: [], + hostResponsibilities: ['Worker fetch'], + nonGoals: ['Accounts'], + antiPatterns: ['Pulling identity for later'], + fixture: { + kind: 'scaffold', + citation: 'recipes/scaffold-cf-minimal', + status: 'green', + }, + capabilityTags: ['static_host', 'health', 'cloudflare'], + requiresPublished: ['spine', 'health'], + backlogPriority: 6, + }, + ], + }; +} + +describe('assembly eval harness (Phase 5)', () => { + it('defines the plan prompt set', () => { + expect(ASSEMBLY_EVAL_CASES.map((c) => c.id).sort()).toEqual( + [ + 'health-endpoint-only', + 'no-passwords', + 'passkey-accounts-workers', + 'static-brochure', + ].sort(), + ); + }); + + it('baseline (no catalog) scores 0', () => { + const report = runAssemblyEval(null, 'baseline'); + expect(report.passRate).toBe(0); + expect(report.passed).toBe(0); + expect(report.total).toBe(ASSEMBLY_EVAL_CASES.length); + }); + + it('catalog planner improves pass rate over baseline', () => { + const catalog = loadEvalCatalog(); + const baseline = runAssemblyEval(null, 'baseline'); + const withCatalog = runAssemblyEval(catalog, 'catalog'); + expect(withCatalog.passRate).toBeGreaterThan(baseline.passRate); + expect(withCatalog.passed).toBeGreaterThan(0); + // All four cases should pass on the synthetic Pegma-shaped catalog. + expect(withCatalog.passRate).toBe(1); + for (const c of withCatalog.cases) { + expect(c.pass, `${c.id}: ${JSON.stringify(c.checks)}`).toBe(true); + } + }); +}); diff --git a/evals/assembly-eval.ts b/evals/assembly-eval.ts new file mode 100644 index 0000000..4d94ffa --- /dev/null +++ b/evals/assembly-eval.ts @@ -0,0 +1,130 @@ +/** + * Offline eval runner: score plan_composition against ASSEMBLY_EVAL_CASES. + */ + +import type { CompositionCatalog } from '../src/data/catalog-schema'; +import { planComposition } from '../src/data/mcp-tools'; +import { + ASSEMBLY_EVAL_CASES, + type AssemblyEvalCase, +} from './assembly-cases'; + +export interface CaseScore { + readonly id: string; + readonly pass: boolean; + readonly checks: readonly { readonly name: string; readonly pass: boolean; readonly detail?: string }[]; + readonly packageNames: readonly string[]; +} + +export interface EvalReport { + readonly schema: 'pegma.assembly_eval.v1'; + readonly mode: 'baseline' | 'catalog'; + readonly total: number; + readonly passed: number; + readonly passRate: number; + readonly cases: readonly CaseScore[]; +} + +function scoreCase( + catalog: CompositionCatalog | null, + c: AssemblyEvalCase, + mode: 'baseline' | 'catalog', +): CaseScore { + if (mode === 'baseline' || !catalog) { + // No catalog planner → cannot satisfy package selection assertions. + const checks = [ + { + name: 'catalog_available', + pass: false, + detail: 'baseline has no plan_composition', + }, + ]; + return { + id: c.id, + pass: false, + checks, + packageNames: [], + }; + } + + const plan = planComposition(catalog, { + capabilityTags: c.capabilityTags, + host: c.host, + productionOnly: true, + }); + const packageNames = plan.packages.map((p) => p.name); + const refuseBlob = [ + ...plan.notes, + ...plan.components.flatMap((comp) => { + const full = catalog.components.find((x) => x.id === comp.id); + return full?.refuses ?? []; + }), + ].join(' | '); + + const checks: { name: string; pass: boolean; detail?: string }[] = []; + + for (const name of c.mustIncludePackageNames ?? []) { + const pass = packageNames.some((p) => p.includes(name) || p === name); + checks.push({ + name: `must_include:${name}`, + pass, + detail: pass ? undefined : `packages=${packageNames.join(',')}`, + }); + } + + for (const name of c.mustNotIncludePackageNames ?? []) { + const pass = !packageNames.some((p) => p.includes(name) || p === name); + checks.push({ + name: `must_not_include:${name}`, + pass, + detail: pass ? undefined : `found in ${packageNames.join(',')}`, + }); + } + + for (const sub of c.mustNotRecommendSubstrings ?? []) { + const lower = sub.toLowerCase(); + const pass = !packageNames.some((p) => p.toLowerCase().includes(lower)); + checks.push({ + name: `must_not_recommend_substring:${sub}`, + pass, + }); + } + + for (const sub of c.mustSurfaceRefusalSubstrings ?? []) { + const pass = refuseBlob.toLowerCase().includes(sub.toLowerCase()); + checks.push({ + name: `must_surface_refusal:${sub}`, + pass, + detail: pass ? undefined : 'refusal not found in notes/component refuses', + }); + } + + // Empty checks (static site with only must-not): still require no failures. + if (checks.length === 0) { + checks.push({ name: 'no_assertions', pass: true }); + } + + return { + id: c.id, + pass: checks.every((x) => x.pass), + checks, + packageNames, + }; +} + +export function runAssemblyEval( + catalog: CompositionCatalog | null, + mode: 'baseline' | 'catalog', + cases: readonly AssemblyEvalCase[] = ASSEMBLY_EVAL_CASES, +): EvalReport { + const scored = cases.map((c) => scoreCase(catalog, c, mode)); + const passed = scored.filter((s) => s.pass).length; + return { + schema: 'pegma.assembly_eval.v1', + mode, + total: scored.length, + passed, + passRate: scored.length === 0 ? 0 : passed / scored.length, + cases: scored, + }; +} diff --git a/package.json b/package.json index 6b91daf..fd821b9 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "test": "vitest run --config vitest.config.ts && vitest run --config vitest.d1.config.ts", "test:node": "vitest run --config vitest.config.ts", "test:d1": "vitest run --config vitest.d1.config.ts", + "eval:assembly": "vitest run --config vitest.config.ts evals/assembly-eval.test.ts", "preview": "astro preview", "worker:dev": "wrangler dev -c worker/wrangler.jsonc", "worker:deploy": "wrangler deploy -c worker/wrangler.jsonc", diff --git a/public/llms.txt b/public/llms.txt index 78c402d..783cdb5 100644 --- a/public/llms.txt +++ b/public/llms.txt @@ -97,6 +97,12 @@ status, design decisions, and non-goals. `get_recipe`, `plan_composition`. Public catalog facts only; no private data plane; no auth for reads. Config notes: https://pegma.dev/skill +## Scaffold (agents) + +- Minimal Cloudflare-shaped composition root (Glass Wing synthetic scaffold): + https://github.com/pegma-dev/pegma.dev/tree/main/recipes/scaffold-cf-minimal + Empty-ish root with optional health; pin versions from catalog.json. + ## Site - [The stack](https://pegma.dev/stack): every component — owns, refuses, diff --git a/recipes/README.md b/recipes/README.md index 926ef9e..2af1ecf 100644 --- a/recipes/README.md +++ b/recipes/README.md @@ -7,6 +7,7 @@ CI-tested composition sketches for agents. Product names and domains are | --- | --- | --- | | `cf-passkey-accounts` | Northshelf Branch — passkey + email-code accounts on a Cloudflare-shaped host | [`cf-passkey-accounts/`](./cf-passkey-accounts/) | | `storage-audit-mail-outbox` | Yard Loan — inventory mutation + audit + mail job in one transaction | [`storage-audit-mail-outbox/`](./storage-audit-mail-outbox/) | +| `static-brochure-minimal` (scaffold) | Glass Wing — empty-ish CF composition root + optional health | [`scaffold-cf-minimal/`](./scaffold-cf-minimal/) | ## Rules diff --git a/recipes/scaffold-cf-minimal/composition.test.ts b/recipes/scaffold-cf-minimal/composition.test.ts new file mode 100644 index 0000000..279ac8e --- /dev/null +++ b/recipes/scaffold-cf-minimal/composition.test.ts @@ -0,0 +1,37 @@ +import { fixedClock } from '@pegma/spine'; +import { describe, expect, it } from 'vitest'; +import { createGlassWingComposition, GLASS_WING } from './composition'; + +describe('scaffold-cf-minimal (Glass Wing)', () => { + it('builds an empty-ish composition root without health', () => { + const composition = createGlassWingComposition({ + clock: fixedClock('2026-07-29T00:00:00.000Z'), + }); + expect(composition.withHealth).toBe(false); + expect(composition.health).toBeUndefined(); + expect(composition.clock.now()).toBe('2026-07-29T00:00:00.000Z'); + }); + + it('optionally exposes a public health probe at the composition root', async () => { + const composition = createGlassWingComposition({ + clock: fixedClock('2026-07-29T00:00:00.000Z'), + withHealth: true, + }); + expect(composition.withHealth).toBe(true); + expect(composition.health).toBeTypeOf('function'); + const res = await composition.health!(); + expect(res.status).toBeGreaterThanOrEqual(200); + expect(res.status).toBeLessThan(600); + expect(res.body).toMatchObject({ + service: GLASS_WING.service, + }); + }); + + it('does not invent accounts, storage, or mail wiring', () => { + const composition = createGlassWingComposition({ withHealth: true }); + expect(composition).not.toHaveProperty('identity'); + expect(composition).not.toHaveProperty('sessions'); + expect(composition).not.toHaveProperty('store'); + expect(composition).not.toHaveProperty('mailWorker'); + }); +}); diff --git a/recipes/scaffold-cf-minimal/composition.ts b/recipes/scaffold-cf-minimal/composition.ts new file mode 100644 index 0000000..44f8817 --- /dev/null +++ b/recipes/scaffold-cf-minimal/composition.ts @@ -0,0 +1,100 @@ +/** + * Recipe / scaffold: scaffold-cf-minimal + * + * Synthetic starter: “Glass Wing” — a fictional static museum site Worker + * with an explicit composition root and optional public health probe. + * Empty-ish on purpose: agents modify this skeleton instead of inventing + * composition from scratch. + * + * Known-good pins (align with catalog.json at scaffold time): + * @pegma/spine@0.1.1 + * @pegma/health@0.1.1 + * + * Not a branded product clone. No accounts, storage, or mail unless the + * agent deliberately adds them from the catalog. + */ + +import { + createDetailCheck, + createProcessCheck, + runHealthChecks, + toHealthResponse, + type HealthResult, +} from '@pegma/health'; +import { + systemClock, + type Clock, + type Logger, +} from '@pegma/spine'; + +/** Fictional museum static site. */ +export const GLASS_WING = { + service: 'glass-wing-site', + siteOrigin: 'https://glasswing.example', +} as const; + +export interface GlassWingCompositionOptions { + readonly clock?: Clock; + readonly logger?: Logger; + /** When true, include a process health check only (no storage ping). */ + readonly withHealth?: boolean; +} + +export interface GlassWingComposition { + readonly clock: Clock; + readonly logger: Logger | undefined; + readonly withHealth: boolean; + /** + * Optional liveness handler. Present only when `withHealth` is true. + * Host wires this to GET /health (or equivalent). + */ + readonly health?: () => Promise<{ + readonly status: number; + readonly body: unknown; + }>; +} + +const silentLogger: Logger = { + log() { + /* scaffold: host replaces Logger at the composition root */ + }, +}; + +/** + * Explicit composition root for a minimal Cloudflare-shaped Worker host. + * Wire packages here — do not autodiscover. + */ +export function createGlassWingComposition( + options: GlassWingCompositionOptions = {}, +): GlassWingComposition { + const clock = options.clock ?? systemClock; + const logger = options.logger; + const withHealth = options.withHealth === true; + + if (!withHealth) { + return { clock, logger, withHealth: false }; + } + + const healthLogger = logger ?? silentLogger; + + return { + clock, + logger, + withHealth: true, + health: async () => { + const result: HealthResult = await runHealthChecks({ + service: GLASS_WING.service, + logger: healthLogger, + checks: [ + createProcessCheck(), + createDetailCheck('scaffold', { + synthetic: true, + site: GLASS_WING.siteOrigin, + }), + ], + }); + const { status, body } = toHealthResponse(result); + return { status, body }; + }, + }; +} diff --git a/src/data/compile-catalog.test.ts b/src/data/compile-catalog.test.ts index 1f1103b..73cc519 100644 --- a/src/data/compile-catalog.test.ts +++ b/src/data/compile-catalog.test.ts @@ -106,12 +106,19 @@ describe('compileCompositionCatalog', () => { for (const recipe of catalog.recipes) { expect(recipe.intent).not.toMatch(/retiregolden/i); } + const scaffold = catalog.recipes.find((r) => r.id === 'static-brochure-minimal')!; + expect(scaffold.fixture).toMatchObject({ + kind: 'scaffold', + status: 'green', + }); + expect(scaffold.fixture.citation).toContain('recipes/scaffold-cf-minimal'); // Unshipped backlog recipes remain non-green (no invented wiring). - const pendingOrNone = catalog.recipes.filter( - (r) => - r.id !== 'cf-passkey-accounts' && - r.id !== 'storage-audit-mail-outbox', - ); + const greenIds = new Set([ + 'cf-passkey-accounts', + 'storage-audit-mail-outbox', + 'static-brochure-minimal', + ]); + const pendingOrNone = catalog.recipes.filter((r) => !greenIds.has(r.id)); for (const recipe of pendingOrNone) { expect(recipe.fixture.status).not.toBe('green'); } diff --git a/src/data/recipe-backlog.ts b/src/data/recipe-backlog.ts index 6545993..d651d1d 100644 --- a/src/data/recipe-backlog.ts +++ b/src/data/recipe-backlog.ts @@ -185,22 +185,26 @@ export const RECIPE_BACKLOG: readonly CatalogRecipe[] = [ { id: 'static-brochure-minimal', intent: - 'A fictional static museum site (Glass Wing) needs no accounts, no durable storage, and no mail — teaching agents to select nothing extra.', - packages: [], + 'A fictional static museum site (Glass Wing) needs no accounts, no durable storage, and no mail — teaching agents to select nothing extra. Optional Worker health probe only.', + packages: ['@pegma/spine@0.1.1', '@pegma/health@0.1.1'], adapters: [], - hostResponsibilities: ['Static hosting only'], + hostResponsibilities: [ + 'Static hosting and optional Worker fetch route', + 'Explicit composition root (empty-ish until features are added)', + ], nonGoals: ['Accounts, sessions, databases'], antiPatterns: [ 'Pulling identity/sessions for later', 'Inventing a database for a static site', ], fixture: { - kind: 'pending', - citation: 'docs/catalog/RECIPE_BACKLOG.md#p6--static-brochure-minimal', - status: 'pending', + kind: 'scaffold', + citation: + 'https://github.com/pegma-dev/pegma.dev/tree/main/recipes/scaffold-cf-minimal', + status: 'green', }, - capabilityTags: ['static_host'], - requiresPublished: [], + capabilityTags: ['static_host', 'health', 'cloudflare'], + requiresPublished: ['spine', 'health'], backlogPriority: 6, }, { diff --git a/vitest.config.ts b/vitest.config.ts index 25705b2..c65b2af 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -6,6 +6,7 @@ export default defineConfig({ 'worker/src/**/*.test.ts', 'src/**/*.test.ts', 'recipes/**/*.test.ts', + 'evals/**/*.test.ts', ], exclude: ['**/node_modules/**', '**/*.d1.test.ts'], testTimeout: 30_000, From 060b64a142ce726b9e9320500c1dddcf78def8f2 Mon Sep 17 00:00:00 2001 From: Nathan Rover Date: Wed, 29 Jul 2026 13:02:46 -0400 Subject: [PATCH 2/5] [5] Address review: static scaffold tags, real catalog eval, honest baseline Drop health from static-brochure-minimal capability tags so static_host plans select the scaffold without capturing pure-health traffic. Score the eval against compileCompositionCatalog with fixed npm pins. Baseline is an empty plan scored with the same assertions, not a forced fail. --- docs/AGENT_ASSEMBLY_PLAN.md | 12 +- docs/catalog/RECIPE_BACKLOG.md | 12 +- evals/assembly-cases.ts | 17 +- evals/assembly-eval.test.ts | 314 ++++++++++----------------------- evals/assembly-eval.ts | 134 ++++++++++---- recipes/README.md | 2 +- src/data/recipe-backlog.ts | 11 +- 7 files changed, 225 insertions(+), 277 deletions(-) diff --git a/docs/AGENT_ASSEMBLY_PLAN.md b/docs/AGENT_ASSEMBLY_PLAN.md index 1012a26..48bc37c 100644 --- a/docs/AGENT_ASSEMBLY_PLAN.md +++ b/docs/AGENT_ASSEMBLY_PLAN.md @@ -363,15 +363,17 @@ Shipped: | Eval runner | `evals/assembly-eval.ts` | | CI coverage | `evals/assembly-eval.test.ts` via `npm test` / `npm run eval:assembly` | -The offline harness scores `plan_composition` (catalog planner) against the -prompt set and compares pass rate to a baseline with no catalog (always 0). -Full multi-agent LLM A/B remains optional outside CI. +The offline harness scores `plan_composition` over the **compiled** catalog +against the prompt set. Baseline is an empty plan (agent never fetches the +catalog): same package/refusal assertions, scored honestly — not forced to +zero. Catalog mode must beat baseline pass rate. Full multi-agent LLM A/B +(web search vs skill+catalog+MCP) remains optional outside CI. **Exit:** measured improvement when skill + catalog (+ MCP if present) are enabled vs. baseline agent with only web search. -**Done:** catalog planner pass rate > baseline on the four Phase 5 prompts; -scaffold fixture is green and cited from the catalog. +**Done:** compiled-catalog planner pass rate > baseline on the four Phase 5 +prompts; scaffold fixture is green and cited from the catalog. ## Non-goals diff --git a/docs/catalog/RECIPE_BACKLOG.md b/docs/catalog/RECIPE_BACKLOG.md index 081a0a2..b23f244 100644 --- a/docs/catalog/RECIPE_BACKLOG.md +++ b/docs/catalog/RECIPE_BACKLOG.md @@ -72,15 +72,17 @@ deferred). | **requiresPublished** | spine, logger-adapters | | **Fixture** | pending | -### P6 — `static-brochure-minimal` +### P6 — `static-brochure-minimal` (scaffold) | | | | --- | --- | -| **Intent** | A fictional static museum site (“Glass Wing”) needs no accounts, no durable storage, and no mail — only honest stack awareness (and optional health if a Worker exists). Teaches agents to **select nothing extra**. | -| **Packages** | none required; optional `@pegma/health` if a Worker liveness route exists | +| **Intent** | A fictional static museum site (“Glass Wing”) needs no accounts, no durable storage, and no mail — only honest stack awareness. Teaches agents to **select nothing extra**. Optional Worker health is host-owned (`withHealth`), not a required catalog capability. | +| **Packages (pinned)** | `@pegma/spine@0.1.1` (optional `@pegma/health` only if the host enables a liveness route) | +| **Host must provide** | Static hosting / optional Worker fetch; explicit empty-ish composition root | | **Anti-patterns** | Pulling identity/sessions “for later”; inventing a database for a static site | -| **requiresPublished** | (none) | -| **Fixture** | pending — may be skill/eval only with empty composition root | +| **requiresPublished** | spine | +| **capabilityTags** | `static_host`, `cloudflare` (no `health` — leave pure health planning to health-public-liveness) | +| **Fixture** | green — [`recipes/scaffold-cf-minimal/`](../../recipes/scaffold-cf-minimal/) | ## Deferred (unpublished packages) diff --git a/evals/assembly-cases.ts b/evals/assembly-cases.ts index 7ffab2c..f200338 100644 --- a/evals/assembly-cases.ts +++ b/evals/assembly-cases.ts @@ -2,11 +2,13 @@ * Offline assembly eval cases for Phase 5. * * Prompts are scored by mapping them to structured capabilityTags and - * running plan_composition (catalog facts). This measures package selection - * and refusal compliance without hosting an LLM in Pegma. + * running plan_composition over the **compiled** catalog (same path as + * catalog.json). This measures package selection and refusal compliance + * without hosting an LLM in Pegma. * - * “Baseline” (web-search only) is modeled as no catalog planner: score 0 on - * every package assertion. “With catalog” uses planComposition. + * Baseline models an agent that never consults the catalog: empty package + * set and no catalog refuse notes. Assertions are scored honestly against + * that empty plan (must-include fails; pure must-not-include may pass). */ import type { CapabilityTag } from '../src/data/catalog-schema'; @@ -26,6 +28,10 @@ export interface AssemblyEvalCase { readonly mustSurfaceRefusalSubstrings?: readonly string[]; /** Substrings that must not appear in recommended package names. */ readonly mustNotRecommendSubstrings?: readonly string[]; + /** Primary recipe id that must be selected (catalog mode). */ + readonly mustPrimaryRecipeId?: string; + /** Primary recipe id that must not be selected (catalog mode). */ + readonly mustNotPrimaryRecipeId?: string; } /** @@ -38,6 +44,7 @@ export const ASSEMBLY_EVAL_CASES: readonly AssemblyEvalCase[] = [ prompt: 'Static brochure museum site (Glass Wing). No accounts, no durable storage, no mail.', capabilityTags: ['static_host'], + mustPrimaryRecipeId: 'static-brochure-minimal', mustNotIncludePackageNames: [ '@pegma/identity', '@pegma/sessions', @@ -61,6 +68,8 @@ export const ASSEMBLY_EVAL_CASES: readonly AssemblyEvalCase[] = [ capabilityTags: ['health'], mustIncludePackageNames: ['@pegma/health'], mustNotIncludePackageNames: ['@pegma/identity', '@pegma/mail'], + // Do not send agents to the static museum scaffold for a health-only plan. + mustNotPrimaryRecipeId: 'static-brochure-minimal', }, { id: 'no-passwords', diff --git a/evals/assembly-eval.test.ts b/evals/assembly-eval.test.ts index d17d4f7..906a728 100644 --- a/evals/assembly-eval.test.ts +++ b/evals/assembly-eval.test.ts @@ -1,225 +1,76 @@ -import { readFileSync } from 'node:fs'; -import { dirname, join } from 'node:path'; -import { fileURLToPath } from 'node:url'; -import { describe, expect, it } from 'vitest'; +import { describe, expect, it, beforeAll } from 'vitest'; +import { + clearNpmVersionCache, + compileCompositionCatalog, +} from '../src/data/compile-catalog'; +import { components } from '../src/data/components'; import type { CompositionCatalog } from '../src/data/catalog-schema'; import { runAssemblyEval } from './assembly-eval'; import { ASSEMBLY_EVAL_CASES } from './assembly-cases'; +const FIXED_AT = '2026-07-29T12:00:00.000Z'; +const NO_STAGES: Record = Object.fromEntries( + components.map((c) => [c.repo, null]), +); + /** - * Prefer the live compiled shape when available; fall back to example catalog - * enriched enough for identity/health tags via the real compile path is heavy - * offline — tests use a minimal synthetic catalog that mirrors Pegma tags. + * Deterministic npm pins matching known-good published versions used by + * recipe backlog pins and the site worker. Never hits the network. */ -function loadEvalCatalog(): CompositionCatalog { - const here = dirname(fileURLToPath(import.meta.url)); - // Use the site's example only for schema shape; build a minimal Pegma-like set. - const base = JSON.parse( - readFileSync( - join(here, '../docs/catalog/example-catalog.json'), - 'utf8', - ), - ) as CompositionCatalog; +const EVAL_NPM: Record = { + '@pegma/spine': '0.1.1', + '@pegma/storage-core': '0.4.0', + '@pegma/storage-azure-tables': '0.4.0', + '@pegma/storage-cloudflare-d1': '0.4.0', + '@pegma/storage-blobs': '0.1.0', + '@pegma/storage-azure-blob': '0.1.0', + '@pegma/storage-cloudflare-r2': '0.1.0', + '@pegma/storage-s3': '0.1.0', + '@pegma/authorization-contracts': '0.1.2', + '@pegma/authorization-core': '0.1.2', + '@pegma/authorization-policy': '0.1.2', + '@pegma/authorization-auth0': '0.1.2', + '@pegma/authorization-stripe': '0.1.2', + '@pegma/authorization-storage': '0.1.2', + '@pegma/authorization-tokens': '0.1.2', + '@pegma/authorization-identity': '0.1.2', + '@pegma/audit': '0.1.0', + '@pegma/support-desk-contracts': '0.1.0', + '@pegma/support-desk-core': '0.1.0', + '@pegma/support-desk-application': '0.1.0', + '@pegma/support-desk-templates': '0.1.0', + '@pegma/webhooks': null, // unpublished for production assembly + '@pegma/sessions': '0.1.0', + '@pegma/mail': '0.1.0', + '@pegma/billing-core': null, + '@pegma/identity': '0.1.0', + '@pegma/rate-limit': '0.1.0', + '@pegma/logger-tee': '0.1.1', + '@pegma/logger-applicationinsights': '0.1.1', + '@pegma/logger-cloudflare': '0.1.1', + '@pegma/logger-datadog': '0.1.1', + '@pegma/health': '0.1.1', +}; - return { - schemaVersion: '0.1.0', - generatedAt: '2026-07-29T00:00:00.000Z', - components: [ - { - id: 'spine', - title: 'Spine', - repo: 'spine', - packages: [ - { name: '@pegma/spine', version: '0.1.1', published: true }, - ], - status: 'published', - publishUsability: 'usable', - summary: 'Shared contracts', - owns: ['Logger', 'Clock'], - refuses: ['Durable cross-process events on an in-process bus'], - dependencies: [], - adapters: [], - hostMustProvide: ['Composition root'], - capabilityTags: ['logging', 'events_in_process'], - recipeIds: [], - links: { githubRepo: 'https://github.com/pegma-dev/spine' }, - }, - { - id: 'identity', - title: 'Identity', - repo: 'identity', - packages: [ - { name: '@pegma/identity', version: '0.1.0', published: true }, - ], - status: 'published', - publishUsability: 'usable', - summary: 'Passkeys-first identity', - owns: ['Passkeys', 'Email codes'], - refuses: ['Passwords — a refusal, not a phase'], - dependencies: [ - { componentId: 'spine', kind: 'requires' }, - ], - adapters: [], - hostMustProvide: ['HTTP', 'WebAuthn'], - capabilityTags: [ - 'accounts', - 'passkeys', - 'email_codes', - 'sessions', - 'authorization', - 'mail_transactional', - ], - recipeIds: ['cf-passkey-accounts'], - links: { githubRepo: 'https://github.com/pegma-dev/identity' }, - }, - { - id: 'health', - title: 'Health', - repo: 'health', - packages: [ - { name: '@pegma/health', version: '0.1.1', published: true }, - ], - status: 'published', - publishUsability: 'usable', - summary: 'Liveness probes', - owns: ['Health checks'], - refuses: ['APM and traces'], - dependencies: [{ componentId: 'spine', kind: 'requires' }], - adapters: [], - hostMustProvide: ['HTTP route'], - capabilityTags: ['health'], - recipeIds: [], - links: { githubRepo: 'https://github.com/pegma-dev/health' }, - }, - { - id: 'storage-core', - title: 'Storage Core', - repo: 'storage-core', - packages: [ - { name: '@pegma/storage-core', version: '0.4.0', published: true }, - { - name: '@pegma/storage-cloudflare-d1', - version: '0.4.0', - published: true, - }, - ], - status: 'published', - publishUsability: 'usable', - summary: 'Declared collections', - owns: ['Transactions'], - refuses: ['Cross-partition transactions'], - dependencies: [{ componentId: 'spine', kind: 'requires' }], - adapters: [ - { - id: 'cloudflare-d1', - packageName: '@pegma/storage-cloudflare-d1', - host: 'cloudflare', - when: 'Workers D1', - }, - ], - hostMustProvide: ['Adapter binding'], - capabilityTags: ['storage', 'cloudflare'], - recipeIds: [], - links: { githubRepo: 'https://github.com/pegma-dev/storage-core' }, - }, - { - id: 'sessions', - title: 'Sessions', - repo: 'sessions', - packages: [ - { name: '@pegma/sessions', version: '0.1.0', published: true }, - ], - status: 'published', - publishUsability: 'usable', - summary: 'Server sessions', - owns: ['Session records'], - refuses: ['Browser session storage as the server session'], - dependencies: [ - { componentId: 'spine', kind: 'requires' }, - { componentId: 'storage-core', kind: 'requires' }, - ], - adapters: [], - hostMustProvide: ['Cookie boundary'], - capabilityTags: ['sessions'], - recipeIds: [], - links: { githubRepo: 'https://github.com/pegma-dev/sessions' }, - }, - { - id: 'mail', - title: 'Mail', - repo: 'mail', - packages: [ - { name: '@pegma/mail', version: '0.1.0', published: true }, - ], - status: 'published', - publishUsability: 'usable', - summary: 'Transactional mail outbox', - owns: ['Outbox jobs'], - refuses: ['Owning its own store'], - dependencies: [ - { componentId: 'spine', kind: 'requires' }, - { componentId: 'storage-core', kind: 'requires' }, - ], - adapters: [], - hostMustProvide: ['Provider'], - capabilityTags: ['mail_transactional'], - recipeIds: [], - links: { githubRepo: 'https://github.com/pegma-dev/mail' }, - }, - ], - recipes: [ - { - id: 'cf-passkey-accounts', - intent: base.recipes[0]?.intent ?? 'accounts', - packages: [ - '@pegma/identity@0.1.0', - '@pegma/sessions@0.1.0', - '@pegma/mail@0.1.0', - '@pegma/spine@0.1.1', - ], - adapters: [], - hostResponsibilities: ['HTTP'], - nonGoals: ['Passwords'], - antiPatterns: ['Password table'], - fixture: { - kind: 'recipe_package', - citation: 'recipes/cf-passkey-accounts', - status: 'green', - }, - capabilityTags: [ - 'accounts', - 'passkeys', - 'email_codes', - 'sessions', - 'authorization', - 'mail_transactional', - 'cloudflare', - ], - requiresPublished: ['identity', 'sessions', 'mail', 'spine'], - backlogPriority: 1, - }, - { - id: 'scaffold-cf-minimal', - intent: 'Glass Wing static scaffold', - packages: ['@pegma/spine@0.1.1', '@pegma/health@0.1.1'], - adapters: [], - hostResponsibilities: ['Worker fetch'], - nonGoals: ['Accounts'], - antiPatterns: ['Pulling identity for later'], - fixture: { - kind: 'scaffold', - citation: 'recipes/scaffold-cf-minimal', - status: 'green', - }, - capabilityTags: ['static_host', 'health', 'cloudflare'], - requiresPublished: ['spine', 'health'], - backlogPriority: 6, - }, - ], - }; +async function compileEvalCatalog(): Promise { + clearNpmVersionCache(); + return compileCompositionCatalog({ + generatedAt: FIXED_AT, + stageByRepo: NO_STAGES, + npmLookup: async (name) => + Object.prototype.hasOwnProperty.call(EVAL_NPM, name) + ? EVAL_NPM[name]! + : null, + }); } describe('assembly eval harness (Phase 5)', () => { + let catalog: CompositionCatalog; + + beforeAll(async () => { + catalog = await compileEvalCatalog(); + }); + it('defines the plan prompt set', () => { expect(ASSEMBLY_EVAL_CASES.map((c) => c.id).sort()).toEqual( [ @@ -231,23 +82,44 @@ describe('assembly eval harness (Phase 5)', () => { ); }); - it('baseline (no catalog) scores 0', () => { + it('compiles the real catalog artifact (not a hand-built twin)', () => { + expect(catalog.schemaVersion).toBe('0.1.0'); + expect(catalog.components.length).toBe(components.length); + const scaffold = catalog.recipes.find((r) => r.id === 'static-brochure-minimal'); + expect(scaffold?.fixture.status).toBe('green'); + expect(scaffold?.fixture.citation).toContain('scaffold-cf-minimal'); + expect(scaffold?.capabilityTags).toEqual(['static_host', 'cloudflare']); + expect(scaffold?.capabilityTags).not.toContain('health'); + }); + + it('baseline scores assertions against an empty plan (not forced all-fail)', () => { const report = runAssemblyEval(null, 'baseline'); - expect(report.passRate).toBe(0); - expect(report.passed).toBe(0); - expect(report.total).toBe(ASSEMBLY_EVAL_CASES.length); + // Static brochure may pass (must-not-include only); include cases fail. + const byId = Object.fromEntries(report.cases.map((c) => [c.id, c])); + expect(byId['static-brochure']?.pass).toBe(true); + expect(byId['passkey-accounts-workers']?.pass).toBe(false); + expect(byId['health-endpoint-only']?.pass).toBe(false); + expect(byId['no-passwords']?.pass).toBe(false); + expect(report.passRate).toBeGreaterThan(0); + expect(report.passRate).toBeLessThan(1); }); - it('catalog planner improves pass rate over baseline', () => { - const catalog = loadEvalCatalog(); + it('catalog planner improves pass rate over baseline on compiled catalog', () => { const baseline = runAssemblyEval(null, 'baseline'); const withCatalog = runAssemblyEval(catalog, 'catalog'); expect(withCatalog.passRate).toBeGreaterThan(baseline.passRate); - expect(withCatalog.passed).toBeGreaterThan(0); - // All four cases should pass on the synthetic Pegma-shaped catalog. - expect(withCatalog.passRate).toBe(1); for (const c of withCatalog.cases) { expect(c.pass, `${c.id}: ${JSON.stringify(c.checks)}`).toBe(true); } + expect(withCatalog.passRate).toBe(1); + + const staticCase = withCatalog.cases.find((c) => c.id === 'static-brochure')!; + expect(staticCase.primaryRecipeId).toBe('static-brochure-minimal'); + + const healthCase = withCatalog.cases.find((c) => c.id === 'health-endpoint-only')!; + expect(healthCase.primaryRecipeId).not.toBe('static-brochure-minimal'); + expect(healthCase.packageNames.some((p) => p.includes('@pegma/health'))).toBe( + true, + ); }); }); diff --git a/evals/assembly-eval.ts b/evals/assembly-eval.ts index 4d94ffa..3e277dd 100644 --- a/evals/assembly-eval.ts +++ b/evals/assembly-eval.ts @@ -1,5 +1,9 @@ /** * Offline eval runner: score plan_composition against ASSEMBLY_EVAL_CASES. + * + * - catalog mode: planComposition over a CompositionCatalog + * - baseline mode: empty package set + no refuse notes (agent never fetched + * the catalog). Same assertions as catalog mode — not a forced all-fail. */ import type { CompositionCatalog } from '../src/data/catalog-schema'; @@ -12,8 +16,13 @@ import { export interface CaseScore { readonly id: string; readonly pass: boolean; - readonly checks: readonly { readonly name: string; readonly pass: boolean; readonly detail?: string }[]; + readonly checks: readonly { + readonly name: string; + readonly pass: boolean; + readonly detail?: string; + }[]; readonly packageNames: readonly string[]; + readonly primaryRecipeId: string | null; } export interface EvalReport { @@ -25,43 +34,22 @@ export interface EvalReport { readonly cases: readonly CaseScore[]; } -function scoreCase( - catalog: CompositionCatalog | null, - c: AssemblyEvalCase, - mode: 'baseline' | 'catalog', -): CaseScore { - if (mode === 'baseline' || !catalog) { - // No catalog planner → cannot satisfy package selection assertions. - const checks = [ - { - name: 'catalog_available', - pass: false, - detail: 'baseline has no plan_composition', - }, - ]; - return { - id: c.id, - pass: false, - checks, - packageNames: [], - }; +function primaryRecipeIdFromNotes(notes: readonly string[]): string | null { + for (const n of notes) { + const m = /^primary recipe:\s*([^\s;]+)/.exec(n); + if (m) return m[1] ?? null; } + return null; +} - const plan = planComposition(catalog, { - capabilityTags: c.capabilityTags, - host: c.host, - productionOnly: true, - }); - const packageNames = plan.packages.map((p) => p.name); - const refuseBlob = [ - ...plan.notes, - ...plan.components.flatMap((comp) => { - const full = catalog.components.find((x) => x.id === comp.id); - return full?.refuses ?? []; - }), - ].join(' | '); - - const checks: { name: string; pass: boolean; detail?: string }[] = []; +function scoreAssertions( + c: AssemblyEvalCase, + packageNames: readonly string[], + refuseBlob: string, + primaryRecipeId: string | null, + mode: 'baseline' | 'catalog', +): CaseScore['checks'][number][] { + const checks: CaseScore['checks'][number][] = []; for (const name of c.mustIncludePackageNames ?? []) { const pass = packageNames.some((p) => p.includes(name) || p === name); @@ -99,16 +87,88 @@ function scoreCase( }); } - // Empty checks (static site with only must-not): still require no failures. + // Recipe identity checks only apply when a catalog plan exists. + if (mode === 'catalog' && c.mustPrimaryRecipeId) { + const pass = primaryRecipeId === c.mustPrimaryRecipeId; + checks.push({ + name: `must_primary_recipe:${c.mustPrimaryRecipeId}`, + pass, + detail: pass ? undefined : `primary=${primaryRecipeId ?? 'none'}`, + }); + } + + if (mode === 'catalog' && c.mustNotPrimaryRecipeId) { + const pass = primaryRecipeId !== c.mustNotPrimaryRecipeId; + checks.push({ + name: `must_not_primary_recipe:${c.mustNotPrimaryRecipeId}`, + pass, + detail: pass ? undefined : `primary=${primaryRecipeId}`, + }); + } + if (checks.length === 0) { checks.push({ name: 'no_assertions', pass: true }); } + return checks; +} + +function scoreCase( + catalog: CompositionCatalog | null, + c: AssemblyEvalCase, + mode: 'baseline' | 'catalog', +): CaseScore { + if (mode === 'baseline' || !catalog) { + // Agent never fetched catalog facts: empty install set, no refuse notes. + const packageNames: string[] = []; + const refuseBlob = ''; + const primaryRecipeId = null; + const checks = scoreAssertions( + c, + packageNames, + refuseBlob, + primaryRecipeId, + 'baseline', + ); + return { + id: c.id, + pass: checks.every((x) => x.pass), + checks, + packageNames, + primaryRecipeId, + }; + } + + const plan = planComposition(catalog, { + capabilityTags: c.capabilityTags, + host: c.host, + productionOnly: true, + }); + const packageNames = plan.packages.map((p) => p.name); + const refuseBlob = [ + ...plan.notes, + ...plan.components.flatMap((comp) => { + const full = catalog.components.find((x) => x.id === comp.id); + return full?.refuses ?? []; + }), + ].join(' | '); + const primaryRecipeId = + plan.recipes[0]?.id ?? primaryRecipeIdFromNotes(plan.notes); + + const checks = scoreAssertions( + c, + packageNames, + refuseBlob, + primaryRecipeId, + 'catalog', + ); + return { id: c.id, pass: checks.every((x) => x.pass), checks, packageNames, + primaryRecipeId, }; } diff --git a/recipes/README.md b/recipes/README.md index 2af1ecf..1f89fd4 100644 --- a/recipes/README.md +++ b/recipes/README.md @@ -7,7 +7,7 @@ CI-tested composition sketches for agents. Product names and domains are | --- | --- | --- | | `cf-passkey-accounts` | Northshelf Branch — passkey + email-code accounts on a Cloudflare-shaped host | [`cf-passkey-accounts/`](./cf-passkey-accounts/) | | `storage-audit-mail-outbox` | Yard Loan — inventory mutation + audit + mail job in one transaction | [`storage-audit-mail-outbox/`](./storage-audit-mail-outbox/) | -| `static-brochure-minimal` (scaffold) | Glass Wing — empty-ish CF composition root + optional health | [`scaffold-cf-minimal/`](./scaffold-cf-minimal/) | +| `static-brochure-minimal` (scaffold) | Glass Wing — empty-ish CF composition root; optional health is host-owned | [`scaffold-cf-minimal/`](./scaffold-cf-minimal/) | ## Rules diff --git a/src/data/recipe-backlog.ts b/src/data/recipe-backlog.ts index d651d1d..3d0d40c 100644 --- a/src/data/recipe-backlog.ts +++ b/src/data/recipe-backlog.ts @@ -185,12 +185,13 @@ export const RECIPE_BACKLOG: readonly CatalogRecipe[] = [ { id: 'static-brochure-minimal', intent: - 'A fictional static museum site (Glass Wing) needs no accounts, no durable storage, and no mail — teaching agents to select nothing extra. Optional Worker health probe only.', - packages: ['@pegma/spine@0.1.1', '@pegma/health@0.1.1'], + 'A fictional static museum site (Glass Wing) needs no accounts, no durable storage, and no mail — teaching agents to select nothing extra. Optional Worker health probe is host-owned (withHealth), not a required composition capability.', + packages: ['@pegma/spine@0.1.1'], adapters: [], hostResponsibilities: [ 'Static hosting and optional Worker fetch route', 'Explicit composition root (empty-ish until features are added)', + 'Optional @pegma/health probe when a public liveness route is desired', ], nonGoals: ['Accounts, sessions, databases'], antiPatterns: [ @@ -203,8 +204,10 @@ export const RECIPE_BACKLOG: readonly CatalogRecipe[] = [ 'https://github.com/pegma-dev/pegma.dev/tree/main/recipes/scaffold-cf-minimal', status: 'green', }, - capabilityTags: ['static_host', 'health', 'cloudflare'], - requiresPublished: ['spine', 'health'], + // Ambient-only tags so pure static_host plans match; do not attach `health` + // here (that belongs to health-public-liveness once green). + capabilityTags: ['static_host', 'cloudflare'], + requiresPublished: ['spine'], backlogPriority: 6, }, { From 81329cf70ebb70599cb8885c175b6d7d28a65f53 Mon Sep 17 00:00:00 2001 From: Nathan Rover Date: Wed, 29 Jul 2026 13:15:25 -0400 Subject: [PATCH 3/5] [5] Fix ambient scaffold matching and spine-only fixture Ambient-only recipes match only ambient-only requests so cloudflare does not steal primary for storage plans. Scaffold no longer imports @pegma/health (catalog packages stay spine-only). Clarify offline baseline as no-catalog, not a simulated web-search LLM. --- docs/AGENT_ASSEMBLY_PLAN.md | 13 +++-- docs/catalog/RECIPE_BACKLOG.md | 4 +- evals/assembly-cases.ts | 7 ++- evals/assembly-eval.ts | 5 +- .../scaffold-cf-minimal/composition.test.ts | 7 ++- recipes/scaffold-cf-minimal/composition.ts | 57 ++++++++----------- src/data/mcp-tools.test.ts | 31 ++++++++++ src/data/mcp-tools.ts | 4 ++ 8 files changed, 78 insertions(+), 50 deletions(-) diff --git a/docs/AGENT_ASSEMBLY_PLAN.md b/docs/AGENT_ASSEMBLY_PLAN.md index 48bc37c..0e2f432 100644 --- a/docs/AGENT_ASSEMBLY_PLAN.md +++ b/docs/AGENT_ASSEMBLY_PLAN.md @@ -364,16 +364,17 @@ Shipped: | CI coverage | `evals/assembly-eval.test.ts` via `npm test` / `npm run eval:assembly` | The offline harness scores `plan_composition` over the **compiled** catalog -against the prompt set. Baseline is an empty plan (agent never fetches the -catalog): same package/refusal assertions, scored honestly — not forced to -zero. Catalog mode must beat baseline pass rate. Full multi-agent LLM A/B -(web search vs skill+catalog+MCP) remains optional outside CI. +against the prompt set. Offline baseline is a **no-catalog** empty plan +(agent never fetches catalog facts): same package/refusal assertions, scored +honestly. Catalog mode must beat that pass rate. That is the automated gate; +full multi-agent LLM A/B (web search vs skill+catalog+MCP) remains optional +outside CI and is not claimed by the unit harness alone. **Exit:** measured improvement when skill + catalog (+ MCP if present) are enabled vs. baseline agent with only web search. -**Done:** compiled-catalog planner pass rate > baseline on the four Phase 5 -prompts; scaffold fixture is green and cited from the catalog. +**Done:** compiled-catalog planner pass rate > offline no-catalog baseline on +the four Phase 5 prompts; scaffold fixture is green and cited from the catalog. ## Non-goals diff --git a/docs/catalog/RECIPE_BACKLOG.md b/docs/catalog/RECIPE_BACKLOG.md index b23f244..a5bd7f0 100644 --- a/docs/catalog/RECIPE_BACKLOG.md +++ b/docs/catalog/RECIPE_BACKLOG.md @@ -77,11 +77,11 @@ deferred). | | | | --- | --- | | **Intent** | A fictional static museum site (“Glass Wing”) needs no accounts, no durable storage, and no mail — only honest stack awareness. Teaches agents to **select nothing extra**. Optional Worker health is host-owned (`withHealth`), not a required catalog capability. | -| **Packages (pinned)** | `@pegma/spine@0.1.1` (optional `@pegma/health` only if the host enables a liveness route) | +| **Packages (pinned)** | `@pegma/spine@0.1.1` only (fixture does not import `@pegma/health`; host may add health from the catalog) | | **Host must provide** | Static hosting / optional Worker fetch; explicit empty-ish composition root | | **Anti-patterns** | Pulling identity/sessions “for later”; inventing a database for a static site | | **requiresPublished** | spine | -| **capabilityTags** | `static_host`, `cloudflare` (no `health` — leave pure health planning to health-public-liveness) | +| **capabilityTags** | `static_host`, `cloudflare` (ambient-only; pure health planning stays on the health component / health-public-liveness) | | **Fixture** | green — [`recipes/scaffold-cf-minimal/`](../../recipes/scaffold-cf-minimal/) | ## Deferred (unpublished packages) diff --git a/evals/assembly-cases.ts b/evals/assembly-cases.ts index f200338..cb96023 100644 --- a/evals/assembly-cases.ts +++ b/evals/assembly-cases.ts @@ -6,9 +6,10 @@ * catalog.json). This measures package selection and refusal compliance * without hosting an LLM in Pegma. * - * Baseline models an agent that never consults the catalog: empty package - * set and no catalog refuse notes. Assertions are scored honestly against - * that empty plan (must-include fails; pure must-not-include may pass). + * Offline “no-catalog” baseline: empty package set and no refuse notes + * (agent never fetched catalog facts). Same assertions as catalog mode. + * This is not a full web-search LLM A/B — it measures the planner gate + * against a no-catalog agent. Live multi-agent eval remains out of band. */ import type { CapabilityTag } from '../src/data/catalog-schema'; diff --git a/evals/assembly-eval.ts b/evals/assembly-eval.ts index 3e277dd..2d654b9 100644 --- a/evals/assembly-eval.ts +++ b/evals/assembly-eval.ts @@ -2,8 +2,9 @@ * Offline eval runner: score plan_composition against ASSEMBLY_EVAL_CASES. * * - catalog mode: planComposition over a CompositionCatalog - * - baseline mode: empty package set + no refuse notes (agent never fetched - * the catalog). Same assertions as catalog mode — not a forced all-fail. + * - baseline mode (“no-catalog”): empty package set + no refuse notes. + * Same assertions as catalog mode — not a forced all-fail, and not a + * simulated web-search LLM. Live multi-agent A/B remains out of band. */ import type { CompositionCatalog } from '../src/data/catalog-schema'; diff --git a/recipes/scaffold-cf-minimal/composition.test.ts b/recipes/scaffold-cf-minimal/composition.test.ts index 279ac8e..232a991 100644 --- a/recipes/scaffold-cf-minimal/composition.test.ts +++ b/recipes/scaffold-cf-minimal/composition.test.ts @@ -12,7 +12,7 @@ describe('scaffold-cf-minimal (Glass Wing)', () => { expect(composition.clock.now()).toBe('2026-07-29T00:00:00.000Z'); }); - it('optionally exposes a public health probe at the composition root', async () => { + it('optionally exposes a host-owned liveness handler without @pegma/health', async () => { const composition = createGlassWingComposition({ clock: fixedClock('2026-07-29T00:00:00.000Z'), withHealth: true, @@ -20,10 +20,11 @@ describe('scaffold-cf-minimal (Glass Wing)', () => { expect(composition.withHealth).toBe(true); expect(composition.health).toBeTypeOf('function'); const res = await composition.health!(); - expect(res.status).toBeGreaterThanOrEqual(200); - expect(res.status).toBeLessThan(600); + expect(res.status).toBe(200); expect(res.body).toMatchObject({ service: GLASS_WING.service, + status: 'ok', + scaffold: true, }); }); diff --git a/recipes/scaffold-cf-minimal/composition.ts b/recipes/scaffold-cf-minimal/composition.ts index 44f8817..93e1fec 100644 --- a/recipes/scaffold-cf-minimal/composition.ts +++ b/recipes/scaffold-cf-minimal/composition.ts @@ -2,25 +2,19 @@ * Recipe / scaffold: scaffold-cf-minimal * * Synthetic starter: “Glass Wing” — a fictional static museum site Worker - * with an explicit composition root and optional public health probe. - * Empty-ish on purpose: agents modify this skeleton instead of inventing - * composition from scratch. + * with an explicit composition root. Empty-ish on purpose: agents modify + * this skeleton instead of inventing composition from scratch. * - * Known-good pins (align with catalog.json at scaffold time): + * Known-good pins (align with catalog.json / recipe packages): * @pegma/spine@0.1.1 - * @pegma/health@0.1.1 + * + * Optional health: host may add @pegma/health later; this fixture does not + * import it so the catalog package list (spine only) stays honest. * * Not a branded product clone. No accounts, storage, or mail unless the * agent deliberately adds them from the catalog. */ -import { - createDetailCheck, - createProcessCheck, - runHealthChecks, - toHealthResponse, - type HealthResult, -} from '@pegma/health'; import { systemClock, type Clock, @@ -36,7 +30,11 @@ export const GLASS_WING = { export interface GlassWingCompositionOptions { readonly clock?: Clock; readonly logger?: Logger; - /** When true, include a process health check only (no storage ping). */ + /** + * When true, expose a minimal host-owned liveness handler that does **not** + * depend on @pegma/health — teaches the composition-root shape only. + * For production probes, prefer composing @pegma/health at the host. + */ readonly withHealth?: boolean; } @@ -54,12 +52,6 @@ export interface GlassWingComposition { }>; } -const silentLogger: Logger = { - log() { - /* scaffold: host replaces Logger at the composition root */ - }, -}; - /** * Explicit composition root for a minimal Cloudflare-shaped Worker host. * Wire packages here — do not autodiscover. @@ -75,26 +67,23 @@ export function createGlassWingComposition( return { clock, logger, withHealth: false }; } - const healthLogger = logger ?? silentLogger; - return { clock, logger, withHealth: true, health: async () => { - const result: HealthResult = await runHealthChecks({ - service: GLASS_WING.service, - logger: healthLogger, - checks: [ - createProcessCheck(), - createDetailCheck('scaffold', { - synthetic: true, - site: GLASS_WING.siteOrigin, - }), - ], - }); - const { status, body } = toHealthResponse(result); - return { status, body }; + // Minimal host-owned probe — not @pegma/health. Agents that want + // composable probes should install and wire @pegma/health from the catalog. + return { + status: 200, + body: { + service: GLASS_WING.service, + status: 'ok', + scaffold: true, + site: GLASS_WING.siteOrigin, + now: clock.now(), + }, + }; }, }; } diff --git a/src/data/mcp-tools.test.ts b/src/data/mcp-tools.test.ts index db6c183..197915b 100644 --- a/src/data/mcp-tools.test.ts +++ b/src/data/mcp-tools.test.ts @@ -111,6 +111,37 @@ describe('plan_composition', () => { ).toBe(true); }); + it('does not let ambient-only recipes win when core tags are requested', () => { + const catalog = { + ...exampleCatalog, + recipes: [ + ...exampleCatalog.recipes, + { + id: 'ambient-scaffold', + intent: 'Ambient-only scaffold', + packages: ['@example/contracts'], + adapters: [], + hostResponsibilities: [], + nonGoals: [], + antiPatterns: [], + fixture: { + kind: 'scaffold' as const, + citation: 'recipes/x', + status: 'green' as const, + }, + capabilityTags: ['static_host', 'cloudflare'] as const, + requiresPublished: ['example-contracts'], + backlogPriority: 1, + }, + ], + }; + const plan = planComposition(catalog, { + capabilityTags: ['storage', 'cloudflare'], + productionOnly: false, + }); + expect(plan.recipes.map((r) => r.id)).not.toContain('ambient-scaffold'); + }); + it('filters adapter packages by host', () => { const plan = planComposition(exampleCatalog, { capabilityTags: ['storage', 'cloudflare'], diff --git a/src/data/mcp-tools.ts b/src/data/mcp-tools.ts index 19cc917..418cd6a 100644 --- a/src/data/mcp-tools.ts +++ b/src/data/mcp-tools.ts @@ -132,6 +132,10 @@ function meaningfulCoverage( const itemCore = coreTags(itemTags); const reqCore = coreTags(requested); if (itemCore.length === 0) { + // Ambient-only items (e.g. static scaffold): match only ambient-only + // requests. Do not let `cloudflare` alone steal primary when the agent + // also asked for storage/accounts/etc. + if (reqCore.length > 0) return false; return tagOverlap(itemTags, requested) > 0; } const overlap = tagOverlap(itemCore, reqCore.length > 0 ? reqCore : requested); From 001bf078eb1061eac4479b34b0b998b20ef57ee4 Mon Sep 17 00:00:00 2001 From: Nathan Rover Date: Wed, 29 Jul 2026 13:26:48 -0400 Subject: [PATCH 4/5] [5] Preserve requested logging; align plan exit and README Allow ambient-only components that share non-host ambient tags (logging) on mixed plans while still blocking host-only scaffold theft. Qualify the Store requirement for storage fixtures only. Align Phase 5 exit criteria with the offline no-catalog gate. --- docs/AGENT_ASSEMBLY_PLAN.md | 13 ++++++++---- recipes/README.md | 7 ++++++- src/data/mcp-tools.test.ts | 40 ++++++++++++++++++++++++++++++++++++- src/data/mcp-tools.ts | 23 +++++++++++++++++---- 4 files changed, 73 insertions(+), 10 deletions(-) diff --git a/docs/AGENT_ASSEMBLY_PLAN.md b/docs/AGENT_ASSEMBLY_PLAN.md index 0e2f432..8a4586f 100644 --- a/docs/AGENT_ASSEMBLY_PLAN.md +++ b/docs/AGENT_ASSEMBLY_PLAN.md @@ -370,11 +370,16 @@ honestly. Catalog mode must beat that pass rate. That is the automated gate; full multi-agent LLM A/B (web search vs skill+catalog+MCP) remains optional outside CI and is not claimed by the unit harness alone. -**Exit:** measured improvement when skill + catalog (+ MCP if present) are -enabled vs. baseline agent with only web search. +**Exit (automated):** offline compiled-catalog planner pass rate strictly +greater than the offline **no-catalog** baseline on the four Phase 5 prompts; +scaffold fixture green and catalog-cited. -**Done:** compiled-catalog planner pass rate > offline no-catalog baseline on -the four Phase 5 prompts; scaffold fixture is green and cited from the catalog. +**Exit (optional, out of band):** full multi-agent LLM A/B (web search only vs +skill + catalog + MCP) remains available for human/operator measurement and is +not required for the CI gate. + +**Done:** automated exit met — compiled-catalog pass rate > no-catalog baseline +on the four prompts; scaffold fixture is green and cited from the catalog. ## Non-goals diff --git a/recipes/README.md b/recipes/README.md index 1f89fd4..80f12a5 100644 --- a/recipes/README.md +++ b/recipes/README.md @@ -21,8 +21,13 @@ CI-tested composition sketches for agents. Product names and domains are ## Production vs test adapters -Composition roots **require** an injected `Store`. Tests pass +Fixtures that use Storage Core (`cf-passkey-accounts`, +`storage-audit-mail-outbox`) **require** an injected `Store`. Tests pass `createMemoryStore()` explicitly so CI stays fast and free of cloud credentials; production hosts inject a durable adapter (for example Cloudflare D1 for `cf-passkey-accounts`). Memory is never a silent default and never a durability claim. + +The static scaffold (`scaffold-cf-minimal` / `static-brochure-minimal`) is +**Store-free** by design — empty-ish until the agent adds features from the +catalog. diff --git a/src/data/mcp-tools.test.ts b/src/data/mcp-tools.test.ts index 197915b..e81163f 100644 --- a/src/data/mcp-tools.test.ts +++ b/src/data/mcp-tools.test.ts @@ -111,7 +111,7 @@ describe('plan_composition', () => { ).toBe(true); }); - it('does not let ambient-only recipes win when core tags are requested', () => { + it('does not let host-ambient-only recipes win when core tags are requested', () => { const catalog = { ...exampleCatalog, recipes: [ @@ -142,6 +142,44 @@ describe('plan_composition', () => { expect(plan.recipes.map((r) => r.id)).not.toContain('ambient-scaffold'); }); + it('keeps explicitly requested logging on mixed core+ambient plans', () => { + const catalog = { + ...exampleCatalog, + components: [ + ...exampleCatalog.components, + { + id: 'logger-adapters', + title: 'Logger Adapters', + repo: 'logger-adapters', + packages: [ + { + name: '@example/logger-tee', + version: '0.0.1', + published: true, + }, + ], + status: 'published' as const, + publishUsability: 'usable' as const, + summary: 'Logger sinks', + owns: ['Logger adapters'], + refuses: ['APM'], + dependencies: [], + adapters: [], + hostMustProvide: ['Composition root Logger'], + capabilityTags: ['logging'] as const, + recipeIds: [], + links: { githubRepo: 'https://github.com/example/logger-adapters' }, + }, + ], + }; + const plan = planComposition(catalog, { + capabilityTags: ['storage', 'logging'], + productionOnly: false, + }); + expect(plan.components.some((c) => c.id === 'logger-adapters')).toBe(true); + expect(plan.packages.map((p) => p.name)).toContain('@example/logger-tee'); + }); + it('filters adapter packages by host', () => { const plan = planComposition(exampleCatalog, { capabilityTags: ['storage', 'cloudflare'], diff --git a/src/data/mcp-tools.ts b/src/data/mcp-tools.ts index 418cd6a..1583d1b 100644 --- a/src/data/mcp-tools.ts +++ b/src/data/mcp-tools.ts @@ -132,10 +132,25 @@ function meaningfulCoverage( const itemCore = coreTags(itemTags); const reqCore = coreTags(requested); if (itemCore.length === 0) { - // Ambient-only items (e.g. static scaffold): match only ambient-only - // requests. Do not let `cloudflare` alone steal primary when the agent - // also asked for storage/accounts/etc. - if (reqCore.length > 0) return false; + // Ambient-only items (logger-adapters, static scaffold, spine, …). + const hostAmbient = new Set([ + 'cloudflare', + 'azure', + 'static_host', + ]); + const requestedNonHostAmbient = requested.filter( + (t) => AMBIENT_TAGS.has(t) && !hostAmbient.has(t), + ); + if (reqCore.length > 0) { + // Mixed request: admit ambient-only items only when a non-host ambient + // capability was explicitly requested (e.g. logging + accounts). + // Host tags alone (cloudflare) must not select the static scaffold. + return ( + tagOverlap(itemTags, requestedNonHostAmbient) > 0 && + tagOverlap(itemTags, requested) > 0 + ); + } + // Ambient-only request: any overlapping ambient tag is enough. return tagOverlap(itemTags, requested) > 0; } const overlap = tagOverlap(itemCore, reqCore.length > 0 ? reqCore : requested); From ce0c6e575d6a9bd6bca8d5c799de8ade5bd73d03 Mon Sep 17 00:00:00 2001 From: Nathan Rover Date: Wed, 29 Jul 2026 13:37:44 -0400 Subject: [PATCH 5/5] [5] Require static_host for Glass Wing scaffold selection Drop bare cloudflare from static-brochure-minimal capability tags so a host-only plan does not recommend the static scaffold. --- docs/catalog/RECIPE_BACKLOG.md | 2 +- evals/assembly-eval.test.ts | 3 ++- src/data/recipe-backlog.ts | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/catalog/RECIPE_BACKLOG.md b/docs/catalog/RECIPE_BACKLOG.md index a5bd7f0..03e098f 100644 --- a/docs/catalog/RECIPE_BACKLOG.md +++ b/docs/catalog/RECIPE_BACKLOG.md @@ -81,7 +81,7 @@ deferred). | **Host must provide** | Static hosting / optional Worker fetch; explicit empty-ish composition root | | **Anti-patterns** | Pulling identity/sessions “for later”; inventing a database for a static site | | **requiresPublished** | spine | -| **capabilityTags** | `static_host`, `cloudflare` (ambient-only; pure health planning stays on the health component / health-public-liveness) | +| **capabilityTags** | `static_host` only (not bare `cloudflare` — host-tag alone must not select this scaffold) | | **Fixture** | green — [`recipes/scaffold-cf-minimal/`](../../recipes/scaffold-cf-minimal/) | ## Deferred (unpublished packages) diff --git a/evals/assembly-eval.test.ts b/evals/assembly-eval.test.ts index 906a728..5ebc61f 100644 --- a/evals/assembly-eval.test.ts +++ b/evals/assembly-eval.test.ts @@ -88,8 +88,9 @@ describe('assembly eval harness (Phase 5)', () => { const scaffold = catalog.recipes.find((r) => r.id === 'static-brochure-minimal'); expect(scaffold?.fixture.status).toBe('green'); expect(scaffold?.fixture.citation).toContain('scaffold-cf-minimal'); - expect(scaffold?.capabilityTags).toEqual(['static_host', 'cloudflare']); + expect(scaffold?.capabilityTags).toEqual(['static_host']); expect(scaffold?.capabilityTags).not.toContain('health'); + expect(scaffold?.capabilityTags).not.toContain('cloudflare'); }); it('baseline scores assertions against an empty plan (not forced all-fail)', () => { diff --git a/src/data/recipe-backlog.ts b/src/data/recipe-backlog.ts index 3d0d40c..1d98331 100644 --- a/src/data/recipe-backlog.ts +++ b/src/data/recipe-backlog.ts @@ -204,9 +204,9 @@ export const RECIPE_BACKLOG: readonly CatalogRecipe[] = [ 'https://github.com/pegma-dev/pegma.dev/tree/main/recipes/scaffold-cf-minimal', status: 'green', }, - // Ambient-only tags so pure static_host plans match; do not attach `health` - // here (that belongs to health-public-liveness once green). - capabilityTags: ['static_host', 'cloudflare'], + // Only static_host (not bare cloudflare) so host-tag-only plans do not + // select the Glass Wing scaffold. Do not attach `health` here. + capabilityTags: ['static_host'], requiresPublished: ['spine'], backlogPriority: 6, },