From 0b6bfc9b474e52eb848ead5fc5770dd6a411acf7 Mon Sep 17 00:00:00 2001
From: Overbaker <172112093+Overbaker@users.noreply.github.com>
Date: Mon, 23 Nov 2026 10:24:56 +0000
Subject: [PATCH] docs(seo): add visual README diagrams, llms.txt, and
contributor onboarding
---
CONTRIBUTING.md | 20 +++++++
README.md | 106 +++++++++++++++++++++++-------------
docs/images/hero-banner.svg | 72 ++++++++++++++++++++++++
docs/images/two-planes.svg | 62 +++++++++++++++++++++
llms.txt | 28 ++++++++++
5 files changed, 250 insertions(+), 38 deletions(-)
create mode 100644 CONTRIBUTING.md
create mode 100644 docs/images/hero-banner.svg
create mode 100644 docs/images/two-planes.svg
create mode 100644 llms.txt
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..9657fed
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,20 @@
+# Contributing to square² (方方)
+
+Contributions, rule engine adapters, and bug reports are welcome!
+
+## Local Verification
+
+Requires **Node.js ≥ 22**:
+
+```sh
+npm install
+npm run typecheck
+npm test
+```
+
+## Guidelines
+
+1. **Zero runtime dependencies**: Keep runtime code in plain Node.js ≥ 22 without adding third-party production dependencies.
+2. **Repo-agnostic**: Never reference private or consumer-specific repository names, paths, or domains.
+3. **Self-tested rules**: Any new built-in rule or adapter must include positive (`bad/`) and negative (`good/`) fixtures.
+4. Keep PRs focused on a single concern and open a [Discussion](https://github.com/Overbaker/square2/discussions) or [Issue](https://github.com/Overbaker/square2/issues) before large design changes.
diff --git a/README.md b/README.md
index b725167..eacb30a 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,34 @@
-# square² (方方)
+
+
+
-square² is a repo-agnostic skeleton with two planes. The **deterministic gate** runs a validated rule catalogue through engine adapters, subtracts a ratcheting baseline and expiring exceptions, and fails only on new violations, each printed with the fix (`Instead:`). The **advisory cross-family review** has a model from a different family than the code's authors review new commits and publish findings as issues; it never blocks anything.
+
+
+
+
+
+
-Status: v0.1 in progress. Both planes are advisory: square² reports and opens issues; it does not block merges.
+
-Docs: [gate rules](docs/dune-rules.md) · [consumer guide](docs/consumer-guide.md) · [trust model](docs/trust-model.md) · [auth](docs/auth.md). Templates for a consumer repository (workflows, `.square2/`, pre-push hook) are in [`templates/consumer/`](templates/consumer/).
+---
-Zero runtime dependencies. Requires Node >= 22.
+**square² (方方)** is a **zero-dependency**, repo-agnostic governance skeleton (Node ≥ 22, MIT) built around two non-blocking planes: a **deterministic ratcheting quality gate** that fails only on *new* regressions with concrete `Instead:` fixes, and an **advisory cross-family AI code review** where a different model family audits commits in a credential-isolated read-only copy.
+
+## Two-Plane Architecture
+
+
+
+
+
+## Quick Start
```sh
npm install
@@ -14,58 +36,66 @@ npm run typecheck
npm test
```
-CI (`.github/workflows/ci.yml`) runs the same plus an agnosticism grep whose word list is the
-repository secret `SQ2_FORBIDDEN_PATTERN` (an extended regex, masked in logs), so the public
-repository never names a consumer. Without the secret (forks) that step is skipped.
+Drop-in consumer workflows, `.square2/` configs, and pre-push hooks live in [`templates/consumer/`](templates/consumer/).
-License: MIT.
+## CLI Commands
-## Commands
+Run from your repo root (or pass `--root `). Exit codes: `0` pass · `1` violations · `2` tool/config/vendor error.
-Run from the repository root (or pass `--root `). Exit codes: `0` pass, `1` violations, `2` square² could not run (catalogue, self-test, engine, vendor or usage error).
-
-| Command | What it does |
+| Command | Purpose |
|---|---|
-| `square2 check [--only ] [--format text\|github] [--report ] [--base ] [--rev ]` | Self-test, then run every enabled rule, subtract `.square2/baseline.json` and live exceptions, and print `[ID] path:line message — Instead: …` lines. `--report ` writes the JSON report (nothing is written without it). With `--base`, also enforce the baseline ratchet and exception immutability against that commit (all-zero sha = no previous commit; an unknown sha exits 2). With `--rev`, gate that commit's tree in a temporary worktree instead of the working tree (the pre-push hook uses this). |
-| `square2 config get ` | Print one scalar of `.square2/config.yaml` (exit 1 when unset); the review workflow reads `branch` with it. |
-| `square2 selftest [--only ]` | Every enabled rule must fire on `.square2/fixtures//bad/` and stay silent on `good/`. |
-| `square2 baseline show \| shrink \| grow --approval ` | Inspect, shrink (drop entries no longer observed), or grow (cite an entry of `.square2/approvals.yaml`) the baseline. |
-| `square2 exceptions lint [--base ]` | Validate `.square2/exceptions.yaml`. |
-| `square2 vendor --from --ref [--into ]` | Copy square² into `tools/square2/` and pin it in `.square2/lock.json`; the vendored runner refuses to run if its tree changes. |
-| `square2 replay --rule (--commit \| --since ) [--out ]` | Run one rule on history in a temporary worktree: does it fire newly on `` and not on its parent; or which commits in the window it fires on (with `grade: null` per firing). |
-| `square2 review prepare \| run \| validate \| publish \| guard-env` | The daily review in three steps with separate credentials: `prepare` (context and tree archive), `run` (codex on a read-only copy, no GitHub token), `publish` (validated findings as issues, state). See [docs/consumer-guide.md](docs/consumer-guide.md). |
-| `square2 publish-gate [--report ] [--branch ] [--test]` | Publish new gate violations as issues (configured branch only, unless `--test`). |
-| `square2 budget` | Month-to-date Actions minutes of the square² workflows; warns on the state issue over the threshold. |
-
-`` is a comma-separated list of id globs such as `S2-DEP-*,S2-SUPPRESS-*`. `--square2-dir ` (or `SQUARE2_DIR`) reads the catalogue from another directory.
-
-## Configuration (`.square2/config.yaml`)
+| `square2 check [--only ] [--format text\|github] [--report ] [--base ] [--rev ]` | Self-test enabled rules, subtract `.square2/baseline.json` + live exceptions, print `[ID] path:line — Instead: …`. Enforces baseline ratchet & exception immutability with `--base`. |
+| `square2 selftest [--only ]` | Verify every enabled rule fires on `.square2/fixtures//bad/` and stays silent on `good/`. |
+| `square2 baseline show \| shrink \| grow --approval ` | Inspect, shrink resolved entries, or grow baseline citing `.square2/approvals.yaml`. |
+| `square2 exceptions lint [--base ]` | Validate `.square2/exceptions.yaml` TTLs and immutability. |
+| `square2 vendor --from --ref [--into ]` | Copy square² into `tools/square2/` and pin `tree_sha256` in `.square2/lock.json`. |
+| `square2 replay --rule (--commit \| --since ) [--out ]` | Replay a candidate rule on git history in a temporary worktree before enabling it. |
+| `square2 review prepare \| run \| validate \| publish \| guard-env` | 3-stage daily cross-family review (`prepare` → read-only `run` with no GH token → `validate`/`publish`). |
+| `square2 publish-gate [--report ] [--branch ] [--test]` | Open GitHub issues for new gate violations on the configured branch. |
+| `square2 budget` | Track month-to-date Actions minutes against your threshold. |
+| `square2 config get ` | Print a scalar from `.square2/config.yaml`. |
+
+
+Configuration (.square2/config.yaml) & Pluggable Engines
```yaml
approvers:
- some-login
max_exception_ttl_days: 90
-require_provenance: false # true: every enabled rule needs born_from and a replay report
+require_provenance: false # true: every enabled rule needs born_from + replay report
generated:
- apps/web/generated/**
engines:
ruff:
- command: # block list; e.g. a workspace venv or uv
- - uv
- - run
- - --project
- - python
- - ruff
+ command: [uv, run, --project, python, ruff]
depcruise:
config: .dependency-cruiser.cjs
eslint:
config: eslint.config.mjs
```
-Engines: `depcruise` and `eslint` run the repository's own installed tools; `ruff` runs the configured command; `suppressions` is built in; `command` runs `options.argv` (with `{root}` replaced by the tree to scan) and reads one JSON object per line: `{"path": "src/a.ts", "line": 3, "subject": "what is wrong"}`.
+Supported engines: `depcruise`, `eslint`, `ruff`, built-in `suppressions`, and custom `command` (JSON-lines `{"path","line","subject"}`). `` accepts globs like `S2-DEP-*,S2-SUPPRESS-*`; `--square2-dir` / `SQUARE2_DIR` points to an alternate catalogue.
+
+
+
+
+Tamper-Evident Vendoring & CI Agnosticism
+
+- **Vendoring**: `square2 vendor` pins `tree_sha256` in `.square2/lock.json`. Any unexpected modification exits `2` with `[S2-VENDOR-TAMPERED]`.
+ Threat model: detects accidental edits of the vendored copy; a committer can always change policy, which review of the commit must catch.
+- **CI Agnosticism**: `.github/workflows/ci.yml` runs `typecheck`, `test`, and an optional agnosticism grep using `SQ2_FORBIDDEN_PATTERN` (skipped on forks) so the public skeleton never leaks consumer names.
+
+
+
+
+FAQ
+
+- **Does square² block PR merges?** Both planes are advisory by default (`v0.1`): square² reports violations and opens issues without blocking merges.
+- **Why split AI review into 3 steps?** Keeping `review run` strictly read-only with **zero GitHub token** ensures an untrusted model call cannot mutate repository state or exfiltrate write credentials.
+- **Why zero runtime dependencies?** Vendoring square² into `tools/square2/` stays fast, auditable, and immune to supply-chain churn.
-## Vendoring
+
-`square2 vendor` copies square² into the repository and pins the copy in `.square2/lock.json`. Verification is mandatory as soon as `.square2/config.yaml` declares `vendored_path`, a lock exists, or the running copy carries the `.square2-vendored` marker: the lock's `path` must be a plain repo-relative path and the tree there must hash to `tree_sha256`, else every command exits 2 with `[S2-VENDOR-TAMPERED]`.
+---
-Threat model: detects accidental edits of the vendored copy; a committer can always change policy, which review of the commit must catch.
+Licensed under **MIT** ([LICENSE](LICENSE)). See [CONTRIBUTING.md](CONTRIBUTING.md) to contribute.
diff --git a/docs/images/hero-banner.svg b/docs/images/hero-banner.svg
new file mode 100644
index 0000000..5805daf
--- /dev/null
+++ b/docs/images/hero-banner.svg
@@ -0,0 +1,72 @@
+
diff --git a/docs/images/two-planes.svg b/docs/images/two-planes.svg
new file mode 100644
index 0000000..86174c9
--- /dev/null
+++ b/docs/images/two-planes.svg
@@ -0,0 +1,62 @@
+
diff --git a/llms.txt b/llms.txt
new file mode 100644
index 0000000..c130a2b
--- /dev/null
+++ b/llms.txt
@@ -0,0 +1,28 @@
+# square² / 方方 (Overbaker/square2)
+
+> Zero-dependency, repo-agnostic governance skeleton (Node.js ≥ 22, MIT) combining a **deterministic ratcheting quality gate** with **credential-isolated advisory cross-family AI code review**.
+
+## Two Planes
+
+1. **Plane 1 — Deterministic Ratcheting Gate (`square2 check`)**:
+ - Self-tests every enabled rule against `.square2/fixtures//good/` and `bad/` before scanning.
+ - Runs pluggable engine adapters (`eslint`, `ruff`, `depcruise`, built-in `suppressions`, or custom JSON-lines `command`).
+ - Subtracts `.square2/baseline.json` and expiring `.square2/exceptions.yaml` (enforcing baseline ratchet & exception immutability against `--base `), reporting only new regressions with actionable `Instead:` fixes.
+2. **Plane 2 — Advisory Cross-Family AI Review (`square2 review`)**:
+ - Splits daily AI commit review into 3 credential-isolated steps: `prepare` (diff context + read-only archive), `run` (a model from a different family reviews a read-only copy with **no GitHub token**), and `validate` / `publish` (schema-validated non-blocking GitHub issues).
+ - Advisory by design: never blocks merges.
+
+## Security & Portability
+
+- **Zero Runtime Dependencies**: Plain Node.js ≥ 22 ES modules.
+- **Tamper-Evident Vendoring (`square2 vendor`)**: Copies square² into `tools/square2/` and pins `tree_sha256` in `.square2/lock.json`; exits `2` with `[S2-VENDOR-TAMPERED]` on unexpected edits.
+- **History Replay (`square2 replay`)**: Test any candidate rule against historical commits in a temporary worktree before enabling it.
+
+## Links
+
+- [Repository & README](https://github.com/Overbaker/square2)
+- [Consumer Guide](https://github.com/Overbaker/square2/blob/main/docs/consumer-guide.md)
+- [Trust Model](https://github.com/Overbaker/square2/blob/main/docs/trust-model.md)
+- [Gate Rules](https://github.com/Overbaker/square2/blob/main/docs/dune-rules.md)
+- [Contributing](https://github.com/Overbaker/square2/blob/main/CONTRIBUTING.md)
+- [Discussions](https://github.com/Overbaker/square2/discussions)