diff --git a/docs/AGENT_ASSEMBLY_PLAN.md b/docs/AGENT_ASSEMBLY_PLAN.md index b2e497a..b864e3d 100644 --- a/docs/AGENT_ASSEMBLY_PLAN.md +++ b/docs/AGENT_ASSEMBLY_PLAN.md @@ -2,13 +2,12 @@ ## Status -**Stage:** Phase 2 complete for required fixtures (P1 + P2 under `recipes/`). -No hosted skill or MCP surface yet. 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 what the Pegma stack already packages -(typed, tested, pin-able components). +**Stage:** Phase 3 complete (hosted assembly skill). No MCP surface yet. +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 +what the Pegma stack already packages (typed, tested, pin-able components). -**Phase 0–2 artifacts:** +**Phase 0–3 artifacts:** | Artifact | Path | | --- | --- | @@ -21,6 +20,8 @@ backend functions as bespoke code) and what the Pegma stack already packages | Published catalog | `https://pegma.dev/catalog.json` (build emit) | | P1 fixture (Northshelf accounts) | `recipes/cf-passkey-accounts/` | | P2 fixture (Yard Loan outbox) | `recipes/storage-audit-mail-outbox/` | +| Hosted assembly skill (raw) | `https://pegma.dev/skill.md` (`public/skill.md`) | +| Skill install notes | `https://pegma.dev/skill` (`src/pages/skill.astro`) | **Goal:** An agent given a short product description chooses the right `@pegma/*` packages, respects their refusals, and wires them at an explicit @@ -291,13 +292,24 @@ P3–P6 remain pending. Deferred D1–D2 still wait on package publication. `/examples` indexes those recipes and quotes only fixture (or package README) sources. -### Phase 3 — Hosted skill +### Phase 3 — Hosted skill ✓ Publish a stable skill document (URL + raw markdown) that encodes assembly judgment and the lookup workflow. Provide short install notes for common tools (project rules / skills directories / plugin snippets) without pretending one universal skill registry exists. +Shipped: + +| Surface | Path / URL | +| --- | --- | +| Skill markdown | `public/skill.md` → `https://pegma.dev/skill.md` | +| Install notes | `src/pages/skill.astro` → `https://pegma.dev/skill` | +| Index links | `public/llms.txt`, footer agent links | + +The skill teaches judgment only; versions and package sets stay in +`catalog.json`. + **Exit:** a human can add the Pegma skill to a major coding agent in one sitting; the skill does not hardcode package versions. diff --git a/public/llms.txt b/public/llms.txt index 43e3063..f8a9a76 100644 --- a/public/llms.txt +++ b/public/llms.txt @@ -74,6 +74,14 @@ status, design decisions, and non-goals. - Schema and recipe backlog (source docs): https://github.com/pegma-dev/pegma.dev/tree/main/docs/catalog +## Assembly skill (agents) + +- [skill.md](https://pegma.dev/skill.md): short judgment skill — assemble over + generate, explicit composition root, treat refuses as hard constraints, + lookup catalog → component → green recipe → fixture. Does **not** hardcode + package versions; re-fetch the catalog. Install notes: + [https://pegma.dev/skill](https://pegma.dev/skill). + ## Site - [The stack](https://pegma.dev/stack): every component — owns, refuses, @@ -83,6 +91,7 @@ status, design decisions, and non-goals. - [Examples](https://pegma.dev/examples): composition recipes with CI-tested fixtures under recipes/ (P1 accounts, P2 audit/mail outbox) plus snippets lifted from package READMEs; each block cites its source. +- [Skill](https://pegma.dev/skill): install notes for the assembly skill. - [Account](https://pegma.dev/account): the static shell for pegma.dev's D1-backed first-party Identity reference consumer. The Worker pins the exact Identity, Authorization adapter, Sessions, Mail, rate-limit, and storage diff --git a/public/skill.md b/public/skill.md new file mode 100644 index 0000000..db83e22 --- /dev/null +++ b/public/skill.md @@ -0,0 +1,105 @@ +--- +name: pegma +description: > + Assemble hosts from Pegma MIT backend packages instead of regenerating + sessions, identity, rate limits, mail outboxes, audit trails, and similar + capabilities. Use when building or wiring first-party accounts, storage, + authorization, health, logging, or other Pegma composition. +--- + +# Pegma — assemble, do not regenerate + +Pegma is a family of MIT-licensed backend packages a **host application +composes**. Governing principle: + +> Optimize for a fresh agent context window. Minimize what must be read to +> make a correct change; mechanize how the change proves itself correct +> (types and tests over prose). + +You assemble typed, pin-able packages. You do not re-implement their +contracts as bespoke code on every project. + +## Hard rules + +1. **Assembly over generation.** Prefer `@pegma/*` for solved problems + (sessions, identity, rate limits, mail outbox, audit, storage, health, + spine contracts). Do not invent a parallel implementation. + +2. **Explicit composition root.** Wire packages once in an obvious place + (composition module / host bootstrap). No autodiscovery story. + +3. **Pin exact 0.x versions.** Never invent versions or ranges. Read + pins from the composition catalog (below). Early 0.x APIs are unstable. + +4. **Refusals are hard constraints.** Each component states what it + **refuses** in the catalog (and package README). Treat those lists as + part of the contract. Do not hardcode refusal catalogs in this skill — + re-fetch `catalog.json` when package behavior may have changed. + +5. **Unpublished packages are unusable for production assembly.** If the + catalog marks a package `published: false` or a component + `publishUsability: unpublished`, do not ship on it. Prefer a deferred + recipe or wait for publication. + +6. **Synthetic recipes only for copy-oriented examples.** Catalog and + `/examples` quote CI-tested fixtures and public package sources. Do not + copy commercial host route maps, tenancy models, or ops topology. + +7. **Prove with types and tests.** Do not paper over the compiler. Prefer + the package's conformance patterns and fixture tests over freehand + wiring. + +## Lookup workflow (progressive disclosure) + +Do **not** dump monorepos into context. Fetch the minimum for the next +decision: + +1. **Catalog (facts)** — `https://pegma.dev/catalog.json` + Components, owns/refuses, deps, adapters, publish flags, exact npm + pins when known, recipe intents + fixture citations. + +2. **Component detail** — catalog entry → GitHub README / plan links + How to construct the package and what the host must provide. + +3. **Recipe** — catalog `recipes[]` with `fixture.status === "green"` + Synthetic intent + selected packages/adapters + anti-patterns. + +4. **Fixture source** — public path cited by the recipe + CI-tested composition code under `recipes/` on pegma.dev (or package + README/conformance). Quote that code; do not invent snippets. + +Index (short): `https://pegma.dev/llms.txt` +Human stack pages: `https://pegma.dev/stack` +Recipe index: `https://pegma.dev/examples` +This skill (judgment only): `https://pegma.dev/skill.md` + +## How to assemble + +1. Restate the product intent in one paragraph (honest scope). +2. Fetch `catalog.json`. Filter by `capabilityTags` / owns / refuses. +3. Drop anything unpublished if the host needs production assembly. +4. Match a green recipe when one fits; otherwise compose from component + entries with the same explicit-root discipline. +5. Choose storage adapters for the host (e.g. Cloudflare D1 vs Azure + Tables vs memory for tests only). Memory is never a durability claim. +6. Wire at one composition root: store → limiters / identity / sessions / + mail / audit actions as needed. Host owns HTTP, cookies, secrets, DNS, + UI, and provider ports. +7. Pin versions from the catalog. Install those exact packages. +8. Prove with `tsc` / tests. Prefer package conformance and recipe fixture + patterns. + +## What this skill does **not** hold + +- Full package encyclopedia (versions, owns lists, recipes) — **catalog** +- UI framework religion (React vs Astro vs other) unless a fixture includes + a host shell +- Commercial product architecture +- An LLM “Pegma copilot” backend — reasoning stays in your agent; Pegma + returns structured, citable facts + +## When package facts change + +Update consumers by refreshing `catalog.json` (and its compile inputs). +Do **not** hardcode package versions in this skill file. Re-fetch the +catalog on each assembly task. diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro index aa8d04a..33d52f2 100644 --- a/src/layouts/Base.astro +++ b/src/layouts/Base.astro @@ -63,6 +63,13 @@ const nav = [ pegma-dev/pegma.dev — it deploys on Cloudflare, the ecosystem's second reference environment.
++ Agents: + install skill · + skill.md · + catalog.json · + llms.txt +