# AGENTS.md - working conventions for agents on this repo coreforge is the **shell** the struct family ships new sites from: the landing rig, the docs rig, and the CI/release plumbing, with the brand as data. Humans are the primary audience; this file doubles as the agent cheat sheet so nobody re-learns the same lessons from scratch. See the sibling docs: [README.md](./README.md) (product + box contents), [DEPLOY.md](./DEPLOY.md) (deploy + release runbook), [CHANGELOG.md](./CHANGELOG.md) (the release log), [MANIFEST.md](./MANIFEST.md) (per-file receipts), and [labs/TASKS.md](./labs/TASKS.md) (the rolling work log). ## Layout ```text site.config.js THE site identity - the ONE file a rebrand edits bin/coreforge.mjs the CLI: create / sync / build / check / doctor (+ the release verbs) lib/ the TOOL (versioned once, imported by adopters) gates/ the check-*.cjs family (frontmatter/links/style/fiction/liquid/theme/language/birth/census) root.cjs / root.mjs resolve the SITE root (walk up to site.config.js) identity.mjs validates site.config.js's shape (url/docs.host/docs.url/docs.baseurl) sync.mjs fans the identity out to the non-JS surfaces template.mjs builds templates/site/ from the dogfood tree lint-packs.cjs the packstruct wrapper verb release-notes.cjs extracts the CHANGELOG section the GH release body uses verify-release.cjs the post-publish trust ladder (npm + GH release) unwrap-prose.cjs flows hard-wrapped prose in living surfaces check-action-pins.cjs refuses a floating Action ref (pins, never floats) scripts/ the family-canon tools that travel by COPY, not import ship-from-download.cjs the phone publish lane (Termux recipe, scripted) templates/site/ the copy source `coreforge create` stamps (GENERATED - npm run template): web/ + docs/ + site.config.js + .gitignore + packs/ + the standalone CI (docs lane, its caller, the staging fast-forward); the tool-coupled publish.yml + test.yml are excluded until `create` stamps an adopter's own templates/adopter/ the two CI lanes `create` stamps INTO an adopter (test.yml + publish.yml), wired to the installed `coreforge` package (not the dogfood's lib/) web/ the prestruct landing shell (React/Vite, prerendered) - the dogfood src/styles.css the ENTIRE design system - semantic tokens only src/site.js the web bundle's accessor for site.config.js src/components/ Nav / Footer / ThemeSwitch / navItems (one nav vocabulary) src/pages/ placeholder pages - replace, keep route shape ssr.config.js prestruct's config - an ADAPTER over site.config.js docs/ the Jekyll docs rig - the dogfood _layouts/default.html header, sidebar, pagefind search, theme tokens _data/nav.yml (yours to add) - sidebar sections come from here .github/workflows/ docs-deploy.yml (a thin caller of the one docs lane in dhaupin/freestruct) + publish.yml (npm OIDC) + test.yml (the shell battery) + staging-ff-sync.yml labs/TASKS.md the rolling work log - append entries as you ship MANIFEST.md every extracted file -> source SHA + engine pins packs/README.md the /packs contract (see below) - packs live in packs/public// ``` The tool (`lib/`) and the site (`web/` + `docs/` + `site.config.js`) are separate halves. The tool is versioned once and reaches adopters by `npm install`; the site is the dogfood, left in place (PRD 7/9). `templates/site/` is generated from the dogfood by `lib/template.mjs` - never hand-edit it; run `npm run template`. ## House rules (each one paid for in real bugs) 1. **Tokens own the palette.** Every color rides semantic variables (`--paper/--surface/--raised/--ink/--ink-soft/--accent/--moss/--err/...`); the light theme is a second block of the SAME token set; a layout class never hardcodes a hex. Re-brand = edit `site.config.js` (identity, nav, routes) + the token block. Nothing else moves: the JS surfaces import the config, and `npm run sync` regenerates the engine-owned files (`web/ssr.config.js`, `docs/freestruct.config.yml`) and the static surfaces; the brand census gate refuses a literal that lives anywhere else. `site.config.js` is concern-named on purpose - a product-named config would force prestruct/freestruct to depend on coreforge (see labs/prd-flowforge.md 5.1). 2. **Theme is one attribute.** `` + a no-flash inline bootstrap; both switch icons always render (CSS picks), so prerender and hydration agree byte-for-byte. Icon is the action (sun shows in dark mode - clicking goes light), the shared family convention. 3. **Gates fail at cause.** Every `lib/gates/check-*.cjs` names file:line. When a bug is caught twice, it becomes a gate - add a signature/check the same day, never bend a check to silence it. 4. **Pins never float.** prestruct (npm), freestruct (workflow install), the pagefind scrape, and every GitHub Action (SHA-pinned, the human tag in a comment) are pinned in the workflow files. Bumping a pin moves the [MANIFEST.md](./MANIFEST.md) row in the SAME commit. 5. **Adopt explicitly, extract honestly.** New sites diff this rig and replace only brand data (tokens, nav vocabulary, pages, copy). When this rig takes a fix FROM a family repo, transcribe with receipts - never invent shapes from memory. The identity must be well-formed before it fans out: `lib/identity.mjs` refuses a scheme-less `docs.host` (a scheme-less value bakes a broken-link failure into the docs lane), and `create` validates before it writes, so a bad answer set stamps nothing. 6. **The stamp ships NEUTRAL brand art.** Binary art cannot be tokenized, so `lib/template.mjs` excludes the shell's own mark (`EXCLUDE_ART`) and ships the hand-kept placeholder in `templates/site/` instead; a separation guard refuses a rebuild that made any placeholder byte-identical to the dogfood's. An adopter replaces the placeholder with their own art (see `DEPLOY.md`). 7. **Determinism.** Same inputs -> same bytes for anything generated; no wall clock in shipped surfaces. 8. **The log is the memory.** Every agent session appends its receipts to [labs/TASKS.md](./labs/TASKS.md) and versioned changes to [CHANGELOG.md](./CHANGELOG.md) - the next agent should never have to guess what happened. 9. **Prose flow.** Living prose never hard-wraps at commit time: paragraphs flow, and `lib/unwrap-prose.cjs` joins hard-wrapped prose without touching frontmatter, fences, indented code, tables, headings, thematic breaks, or HTML blocks. Dated history keeps its era wording. ## The /packs ecosystem (the family contract) `packs/` is where optional extension packs live: `packs/public//` (tracked, shipped) and `packs/local//` (gitignored, private). A pack is a `pack.json` manifest plus its entry module. The manifest grammar is SPEC 1 - [packs/README.md](./packs/README.md) links the spec, the two profile reference implementations (crashtest: `scenario`, poststruct: `check`), and the lint tool (packstruct). Empty in the shell on purpose. ## Common commands ```bash npm ci && npm test # hermetic install + the node:test spine npm run check && npm run lint:docs # the five gates + the birth-gate lane npm run lint:packs # packstruct over packs/ (exit 2 names the fix) node bin/coreforge.mjs doctor . # the truth battery (config + residue + sync + gates) npm install --prefix web && npm run build --prefix web # "N/N pages rendered" is healthy cd docs && bundle exec jekyll build # optional locally; CI proves it (see DEPLOY.md #22) ``` `prepublishOnly` = `npm test && npm run check && npm run lint:docs && npm run lint:pins`, so the publish ladder cannot mint a tarball from a red battery (the gate in `publish.yml` additionally refuses 0.x and a tag that disagrees with the packaged version, then attaches the served tarball to the release and runs the post-publish trust ladder in `lib/verify-release.cjs`). ## Version protocol (0.9.0 today) Version surfaces: `package.json` and `web/package.json` - kept EQUAL by a same-commit bump, and held there by the version-truth census leg (`npm test`, issue #28) so a release commit physically cannot move one without the others. A release = bump both + the README Status line + a CHANGELOG entry + tag `vX.Y.Z` + push the tag; the release workflow publishes to npm via Trusted Publishing (OIDC - no publish tokens anywhere) and its gate refuses 0.x and a tag that disagrees with the packaged version (issue #23/#29). The retry ritual lives in [DEPLOY.md](./DEPLOY.md). Pack manifests are OUTSIDE this protocol - their semver is theirs.