diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..5dfde5e --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,33 @@ +name: pages + +# Serves site/ at https://azank1.github.io/seamkit/ whenever it changes on main. +on: + push: + branches: [main] + paths: ['site/**', '.github/workflows/pages.yml'] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + # Action SHAs resolved with `gh api repos///commits/` on 2026-10-21. + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 + with: + path: site + - id: deployment + uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 diff --git a/README.md b/README.md index 4e10912..6f52c75 100644 --- a/README.md +++ b/README.md @@ -199,8 +199,10 @@ Next, in order: 5. Approvals that an agent cannot forge, policy and rulings elicited from a human, and a static console. 6. Blast-radius classification, sandbox parity, and hook packs for coding agents. -The design is in [`docs/architecture.md`](docs/architecture.md), and the survey of existing tools, with what each one -does and does not cover, is in [`docs/prior-art.md`](docs/prior-art.md). +The setup guide, with diagrams, copy-in recipes for agents and CI, and the build tracker, is at +[azank1.github.io/seamkit](https://azank1.github.io/seamkit/). The design is in +[`docs/architecture.md`](docs/architecture.md), and the survey of existing tools, with what each one does and does not +cover, is in [`docs/prior-art.md`](docs/prior-art.md). ## Development diff --git a/docs/architecture.md b/docs/architecture.md index 633b632..6e248e9 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1,7 +1,9 @@ # Architecture -Status: draft for review. The product is called seamkit and its command is `seamkit`. This document also calls it -"the harness", the generic term for what it is. +Status: M1 and M2 are accepted: they are built, tested and released in 0.1.0, and the sections they cover describe the +code. M3 to M8 are proposed: each is confirmed, or changed with the change recorded under "Changes made while building", +when its milestone ships. The product is called seamkit and its command is `seamkit`. This document also calls it "the +harness", the generic term for what it is. ## 1. Purpose and design spine @@ -517,18 +519,19 @@ phone passkey or a hardware key, policy runs approvals at level 1 and every appr ### Revised milestones On 2026-10-15, with M1 and M2 done and the repository going public, the maintainer moved the work that makes seamkit -usable by strangers ahead of the remaining checks: the npm package and the GitHub Action first, then the MCP server. +usable by strangers ahead of the remaining checks: the npm package and the GitHub Action first, then the MCP server. On +2026-10-21 the maintainer accepted M1 and M2 as built and kept M3 to M8 as proposals. | M | Scope | Done when | State | |---|---|---|---| -| M1 | repository scaffold, `core` verdict algebra, event writer for the state branch, CLI skeleton with exit codes, replay | unit tests cover every outcome, including zero rows as `examined_nothing`, and a replay test reproduces every verdict | done | -| M2 | `readback` with the version-endpoint and bundle-marker adapters, version ancestry, the fake production, `seamkit audit` with zero configuration, `seamkit stamp` | the demo history sorts into live, not proven, not live and nothing to prove, and the audit runs against commit.city | done | -| M3 | the `seamkit` npm package; a GitHub Action that reads back after deploys and reports a check run | `npx seamkit audit` works on a clean machine, and the Action posts a check run on a sample repository | next | -| M4 | MCP server with read-only tools mirroring the CLI, Claude Code plugin packaging | an MCP client runs an audit and receives the verdicts and the outcome | | -| M5 | `carry` and the split rule | given a production version behind main, carry lists the riding pull requests by title, and a hand deploy blocks | | -| M6 | `card` and `gate` with the GitHub adapter | `seamkit gate` lists each open pull request with its verdict and the exact missing items | | -| M7 | elicitation for policy and rulings, approvals at levels 1 and 3, the init interview, the static console | an MCP client completes init and a ruling round trip, an approval passed as an argument is refused, and the console renders from policy and state alone | | -| M8 | `radius`, `parity`, hook packs for Cursor and Codex | unclassified stops, and the three parity outcomes are tested | | +| M1 | repository scaffold, `core` verdict algebra, event writer for the state branch, CLI skeleton with exit codes, replay | unit tests cover every outcome, including zero rows as `examined_nothing`, and a replay test reproduces every verdict | done, accepted | +| M2 | `readback` with the version-endpoint and bundle-marker adapters, version ancestry, the fake production, `seamkit audit` with zero configuration, `seamkit stamp` | the demo history sorts into live, not proven, not live and nothing to prove, and the audit runs against commit.city | done, accepted | +| M3 | the `seamkit` npm package; a GitHub Action that reads back after deploys and reports a check run | `npx seamkit audit` works on a clean machine, and the Action posts a check run on a sample repository | in progress, proposed | +| M4 | MCP server with read-only tools mirroring the CLI, Claude Code plugin packaging | an MCP client runs an audit and receives the verdicts and the outcome | proposed | +| M5 | `carry` and the split rule | given a production version behind main, carry lists the riding pull requests by title, and a hand deploy blocks | proposed | +| M6 | `card` and `gate` with the GitHub adapter | `seamkit gate` lists each open pull request with its verdict and the exact missing items | proposed | +| M7 | elicitation for policy and rulings, approvals at levels 1 and 3, the init interview, the static console | an MCP client completes init and a ruling round trip, an approval passed as an argument is refused, and the console renders from policy and state alone | proposed | +| M8 | `radius`, `parity`, hook packs for Cursor and Codex | unclassified stops, and the three parity outcomes are tested | proposed | ### Changes made while building diff --git a/site/index.html b/site/index.html new file mode 100644 index 0000000..f603027 --- /dev/null +++ b/site/index.html @@ -0,0 +1,1078 @@ + + + + + +seamkit + + + + + + + + +
+
+ + / build tracker and setup guide +
+ v0.1.0 + npm + GitHub +
+
+
+ +
+ +
+
+
+
Engineer's guide
+

Put a readback after every deploy.

+

seamkit is a command that proves each merged change is live in production. It reads your git history, + asks production which commit it runs, and exits 0 only when the change is there. This guide wires it into the + three places that ship code: your terminal, your coding agent, and your CI.

+
+ +
+
+ +
+
+ + + +
+ + +
+
Build
+

Where seamkit stands

+

Our working view of the build. Milestones, tasks and the log live in one data block at the top of this + page's script; update it as work lands, and every view below follows.

+
+ +
+ +
+
Build
+

Milestones

+

Each milestone has a "done when" written before it starts, taken from the architecture document. A + milestone is done when that sentence is true and shown, not when its code merges.

+
+
+ +
+
Build
+

Log

+
    +
    + +
    +
    Build
    +

    Open decisions

    +
    + + + +
    DecisionRecommendationOwner
    +
    +
    + + +
    +
    Understand
    +

    The shipping loop, and the step it closes

    +

    Most pipelines stop at "deployed". seamkit adds the last step: read production back, compare it with + the history, and hand a verdict to whoever shipped the change, whether that was a person, an agent or a CI job.

    + +
    +
    + + The shipping loop: a change goes from author to production, and seamkit readback reads both the history and production, then returns an exit code to the author and records the run in a ledger branch. + + + + + + + + + 1 + You or an agent + writes the change + + + 2 + Pull request + + seamkit-card + + + 3 + Merge to main + card kept in message + + + 4 + Build + seamkit stamp + + + 5 + Deploy + your host or CLI + + + 6 + Production + /version.json + + + + + + + + + + + 7 + seamkit readback + is each merged change in what production runs? + + + + + reads git history + + + + + GET version + bundle + + + + Exit code + --json + 0 live · 1 not live · 3 can't look + + + + done, retry or alert + + + + seamkit/state branch + every run, content-addressed + + + record + earlier sightings + +
    +
    Steps 1 to 6 are your existing pipeline. seamkit adds two small things to it, a card in the pull + request (optional) and a stamp in the build, and then step 7: a read-only check whose exit code goes back to whoever + shipped. The ledger branch is what lets a later run tell "rolled back" from "never arrived".
    +
    +
    + + +
    +
    Understand
    +

    Inside one run

    +

    Adapters read the world and report what they saw. A pure core judges those observations with no network, + no clock and no model. The shell prints the verdicts, exits with the outcome and records the run. Because the judge is + pure, seamkit replay can recompute every recorded verdict from the ledger.

    + +
    +
    + + Inside one run: inputs are read by adapters into observations, the pure core turns observations into verdicts, and the shell writes the exit code, the output and an event that replay can recompute. + + + + + + INPUTS + ADAPTERS · read-only + CORE · pure + SHELL · outputs + + + Git history + first parent of main + + + Production URL + plain GET, no secrets + + + Ledger + earlier recorded runs + + + git + changes, cards, ancestry + version document + which commit is running + served bundle + same-origin files, digests + records what it read, + never a verdict + + + + + + + Judge + contained? merge-base + markers: present, absent, + contradicted, unreadable + state: live, not live, + not proven, nothing to prove + outcome by severity + no I/O · no clock · no model + + + observations → + + + Exit code + 0 · 1 · 3 · 4 (2 = bad usage) + + + Text or one --json document + reasons, examined, not examined + + + Event on seamkit/state + observations + verdicts, + file named by its SHA-256 + + + + + verdicts → + + + + seamkit replay: recompute, must match + +
    +
    Why this shape matters for automation: the only thing that can make a run pass is an observation the + core judged, and every judgment can be re-run later. An agent cannot talk its way to exit 0, and a CI log is not the + only record of what happened.
    +
    +
    + + +
    +
    Understand
    +

    Exit codes are the interface

    +

    Every automation in this guide branches on these five codes and nothing else. Every non-zero code means + "not a pass", so && chains stop safely.

    +
    +
    0pass

    Examined, and every change is live.

    +
    1fail

    A change is not live, or not proven. Retry while a deploy rolls out; alert after.

    +
    3examined nothing

    seamkit could not look. Fix what it could not read; the output says what.

    +
    4unclassified

    No rule covers it. Stop for a human. Never retry.

    +
    2usage

    Bad arguments or configuration. No verdict. Printed to stderr.

    +
    +
    + + +
    +
    1

    Install and run your first audit

    +
    works todayterminal
    +

    Run it from the repository that production is built from. audit needs no configuration: it checks the + last 20 changes on your default branch, then prints advice for every gap it found.

    +
    +
    +
    Try it once
    +
    cd your-repo
    +npx seamkit audit --url https://your.app
    +
    +
    +
    Pin it in the project
    +
    npm install --save-dev --save-exact seamkit@0.1.0
    +npx seamkit version   # 0.1.0
    +
    +
    +

    The first audit of most sites exits 3, "examined nothing", because production does not yet say which + commit it runs. That is the expected start. Step 2 fixes it.

    +
    + + +
    +
    2

    Make production name its commit

    +
    works todaybuild
    +

    Readback needs one fact from production: the full commit id it was built from. Pick the option that matches how you + build. seamkit looks for /version.json, then /api/version, then /version.

    +
    +
    +
    Static or bundled sites
    +
    package.json
    {
    +  "scripts": {
    +    "prebuild": "seamkit stamp --out public/version.json",
    +    "build": "vite build"
    +  }
    +}
    +

    Stamp prefers git. Where the build has no history, it uses + the commit your CI or host provides (VERCEL_GIT_COMMIT_SHA, GITHUB_SHA, + CF_PAGES_COMMIT_SHA, COMMIT_REF and others) and records which one.

    +
    +
    +
    Apps with a server route
    +
    app/api/version/route.tsNext.js on Vercel
    export function GET() {
    +  return Response.json(
    +    { commit: process.env.VERCEL_GIT_COMMIT_SHA },
    +    { headers: { 'cache-control': 'no-store' } },
    +  );
    +}
    +

    Any server can answer {"commit": "<40 hex>"}. + seamkit also reads fields named sha or git.commit.id that other tools serve.

    +
    +
    +
    check it
    curl -s https://your.app/version.json
    +{ "schema": "seamkit.version/1", "commit": "492378ccca806fd3c85ea55dfaf69bdb7ff16838", "dirty": false, "source": "git", "ref": "main" }
    +npx seamkit audit --url https://your.app      # now proves changes by version
    +

    A build stamped from a working tree with uncommitted changes is reported as unreadable, never + trusted. Use seamkit stamp --require-clean in CI to refuse such builds outright.

    +
    + + +
    +
    3

    Start the ledger

    +
    works todayrepository
    +

    Without history, seamkit can only say a change is not proven. With a ledger, it can say a change was live + and has left production, which is what a rollback looks like. The ledger is a branch in your own repository, written + with git plumbing that never touches your working tree, index or HEAD.

    +
    npx seamkit state init       # create the seamkit/state branch
    +npx seamkit audit --url https://your.app   # recorded as an event from now on
    +npx seamkit state sync       # share it: merge with the remote branch and push, never forced
    +npx seamkit state verify     # every event file matches its SHA-256 name
    +npx seamkit replay           # recompute every recorded verdict; fails if any differs
    +
    + + +
    +
    4

    Prove more than the version with scope cards

    +
    works todaypull requestsoptional
    +

    The version proves a change's commit is deployed. A card proves the change does what it claims in the build: it + names text that production's served files must contain, or a separate version document, such as a server function's. + Agents can write cards, because a card is a fenced block in the pull request description.

    +
    +
    pull request description
    ```seamkit-card
    +card: 1
    +intent: Show a saved indicator after a note is synced.
    +layers: [frontend]
    +targets: [web]
    +markers:
    +  - kind: bundle
    +    text: "data-sync-state"
    +releaseNote: Notes now show when they were last saved.
    +```
    +
    +

    One repository setting is required. Readback reads cards from merge commits, and GitHub copies the + description into the merge commit only when the default commit message is Pull request title and + description. Set it under Settings, General, Pull Requests, for merge commits and squash merges.

    +

    A marker must be text in the built output. A component name or a comment exists only in source + and will never be found; readback says so when the version shows the change is deployed.

    +
    +
    +
    + + +
    +
    Automate
    +

    Where to trigger it, and what to do with the answer

    +

    One command, four places to call it. Each trigger runs the same readback and branches on the same exit + codes, so a verdict means the same thing in your terminal, in an agent's session and in CI.

    +
    +
    + + Four triggers (an agent hook, a make target, CI after a deployment, and a scheduled CI job) all run seamkit readback, whose exit code leads to one of four actions. + + + + TRIGGER + CHECK + EXIT CODE → ACTION + + + Coding agent hook + after a deploy command · step 6 + + make ship + deploy, then wait for live · step 5 + + CI after a deployment + deployment_status: success · step 8 + + CI on a schedule + catches rollbacks · step 8 + + + + + + + + seamkit readback + --url · --pr N or --last N + --json for programs + + + + + + + + 0 · live + mark shipped, close the task + + 1 · not live or not proven + retry during rollout, then alert + + 3 · examined nothing + fix what it could not read + + 4 · unclassified + stop and ask a human + +
    +
    Retry rule: right after a deploy, the host may still serve the old build for a minute, so retry on + 1 and 3 until a deadline. Never retry 2 or 4: neither will change by waiting.
    +
    +
    + + +
    +
    5

    Your terminal: deploy, then wait for live

    +
    works todaybashmake
    +

    This script is the building block for every trigger below. It retries readback of the newest change on the default + branch until production shows it or the deadline passes, and keeps polling runs out of the ledger.

    +
    scripts/wait-live.sh
    #!/usr/bin/env bash
    +# Wait until production runs the newest change on the default branch.
    +# usage: scripts/wait-live.sh https://your.app [seconds]
    +url="$1"; deadline=$(( $(date +%s) + ${2:-300} ))
    +git fetch --quiet origin
    +while :; do
    +  npx seamkit readback --url "$url" --last 1 --no-record
    +  code=$?
    +  case $code in
    +    0) npx seamkit readback --url "$url" --last 1 >/dev/null; exit 0 ;;  # live: record it once
    +    2|4) exit $code ;;                                                # waiting will not help
    +  esac
    +  [ "$(date +%s)" -ge "$deadline" ] && exit $code
    +  sleep 15
    +done
    +
    Makefile
    DEPLOY ?= vercel deploy --prod       # or your own deploy command
    +URL    ?= https://your.app
    +
    +ship:
    +	$(DEPLOY)
    +	./scripts/wait-live.sh $(URL) 300
    +

    Now make ship fails unless production actually runs the change, and the failure prints + which change and why.

    +
    + + +
    +
    6

    Coding agents: no "shipped" without exit 0

    +
    works todayClaude CodeCodexCursor
    +

    Agents report work as done when the pull request merges. Two layers stop that: an instruction every agent reads, and, + in Claude Code, a hook that checks every deploy command the agent runs.

    +
    AGENTS.md or CLAUDE.md
    ## Shipping
    +After a deploy, run `npx seamkit readback --url https://your.app --pr <number> --json`.
    +The change is shipped only when it exits 0. Exit 1 means it is not live or not proven, and
    +exit 3 means production could not be examined. Report the reasons; never call a change done
    +on any other exit code.
    +
    +
    .claude/settings.json
    {
    +  "hooks": {
    +    "PostToolUse": [{
    +      "matcher": "Bash",
    +      "hooks": [{
    +        "type": "command",
    +        "command": "\"$CLAUDE_PROJECT_DIR\"/scripts/after-deploy.sh"
    +      }]
    +    }]
    +  }
    +}
    +
    scripts/after-deploy.sh
    #!/usr/bin/env bash
    +# Runs after each shell command; acts only on deploys.
    +cmd=$(jq -r '.tool_input.command // ""')
    +case "$cmd" in
    +  *"vercel deploy"*|*"npm run deploy"*) ;;
    +  *) exit 0 ;;
    +esac
    +cd "$CLAUDE_PROJECT_DIR"
    +if ! out=$(./scripts/wait-live.sh https://your.app 300 2>&1); then
    +  echo "seamkit: the deploy is not proven live." >&2
    +  echo "$out" | tail -n 20 >&2
    +  exit 2   # stderr is shown to Claude
    +fi
    +
    +

    The hook uses jq to read the command Claude ran from the hook's JSON input. Match the + patterns to your own deploy commands. A packaged hook set for Claude Code, Cursor and Codex is on the roadmap.

    +
    + + +
    +
    7

    Local models and your own DevOps tools

    +
    works todayany language--json
    +

    A local model, an internal bot or a deploy script does not need an SDK. Run the command, read the exit code, and give + the model the reasons. Expose it as a tool like this, and the model can check its own deploys without being able to + fake the result.

    +
    seamkit_tool.py
    import json, subprocess
    +
    +def readback(url: str, pr: int | None = None) -> dict:
    +    """Is the change live in production? Give the model this tool's result as is."""
    +    args = ["npx", "seamkit", "readback", "--url", url, "--json"]
    +    if pr is not None:
    +        args += ["--pr", str(pr)]
    +    p = subprocess.run(args, capture_output=True, text=True)
    +    if p.returncode == 2:                       # usage error: text on stderr, no verdict
    +        return {"exit": 2, "error": p.stderr.strip()}
    +    doc = json.loads(p.stdout)
    +    return {
    +        "exit": p.returncode,                   # 0 shipped; anything else is not
    +        "outcome": doc["outcome"],
    +        "reasons": [r for v in doc["verdicts"] for r in v["reasons"]],
    +    }
    +

    The same pattern works in Go, Rust or a shell pipeline. The exit code is the decision; the JSON is the + explanation. An MCP server that offers these checks as tools to any MCP client is next after the GitHub Action.

    +
    + + +
    +
    8

    CI: verify every production deploy, and watch for rollbacks

    +
    works todayGitHub Actionspackaged Action · M3
    +

    Two workflows cover CI. The first runs when your host reports a successful production deployment to GitHub, as + Vercel does for connected repositories. The second runs on a schedule, so a rollback or a hand deploy is caught even + when nobody deployed through CI. Both carry the ledger, so "not live" means the change really left production.

    +
    +
    .github/workflows/readback.yml
    name: readback
    +on: deployment_status
    +permissions:
    +  contents: write   # only to push seamkit/state
    +jobs:
    +  readback:
    +    if: >-
    +      github.event.deployment_status.state == 'success' &&
    +      github.event.deployment.environment == 'Production'
    +    runs-on: ubuntu-latest
    +    steps:
    +      - uses: actions/checkout@v7
    +        with: { fetch-depth: 0 }
    +      - uses: actions/setup-node@v7
    +        with: { node-version: 22 }
    +      - run: npx --yes seamkit@0.1 state sync
    +      - run: npx --yes seamkit@0.1 readback --url https://your.app --last 20
    +      - if: always()
    +        run: npx --yes seamkit@0.1 state sync
    +
    .github/workflows/watch.yml
    name: production watch
    +on:
    +  schedule: [{ cron: '*/30 * * * *' }]
    +  workflow_dispatch:
    +permissions:
    +  contents: write
    +jobs:
    +  watch:
    +    runs-on: ubuntu-latest
    +    steps:
    +      - uses: actions/checkout@v7
    +        with: { fetch-depth: 0 }
    +      - uses: actions/setup-node@v7
    +        with: { node-version: 22 }
    +      - run: npx --yes seamkit@0.1 state sync
    +      - run: npx --yes seamkit@0.1 readback --url https://your.app --last 20
    +      - if: always()
    +        run: npx --yes seamkit@0.1 state sync
    +
    +

    The first state sync pulls the ledger into the runner, so readback records the run and can see earlier + sightings. The last one pushes the new event, merging rather than forcing if another job pushed first. Ledger commits + carry their own author, so the runner needs no git identity. A failed readback fails the job, and GitHub's usual + notifications tell you.

    +

    Other CI systems need three things: Node 20 or later, the full history (no shallow clone), and push + access to the seamkit/state branch if you keep the ledger there. Pass --branch when the + default branch is not checked out as origin/HEAD.

    +
    + + +
    +
    Reference
    +

    Troubleshooting

    +

    seamkit audit prints advice for each of these. This table is the same advice in one place.

    +
    + + + + + + + + + + + + +
    You seeCauseFix
    Exit 3 for every changeProduction serves no version document, or serves a web page in its place.Step 2. Check with curl that the URL returns JSON with a full commit id.
    "commit unknown to this repository"The local clone has not fetched the deployed commit, or it was deployed from a branch that never merged.git fetch origin. If it persists, someone deployed by hand.
    "shallow clone"CI checked out a single commit.fetch-depth: 0, or git fetch --unshallow.
    Version unreadable, dirty buildThe build was stamped from uncommitted changes.Build from a clean tree; add --require-clean.
    Marker absent although the version contains the changeThe marker text is in source but not in the built output.Use text the bundle really ships, such as an attribute value or a user-facing string.
    "No change carries a seamkit-card"The merge setting drops pull request descriptions.Step 4: "Pull request title and description".
    Exit 2: URL refusedThe URL carries a query string or credentials, and URLs are recorded.Use a plain URL. Readback only needs public GETs.
    "cannot tell not live from not proven"There is no ledger yet.Step 3: seamkit state init.
    +
    +
    + + +
    +
    Reference
    +

    Commands in 0.1.0

    +
    + + + + + + + + + + +
    CommandDoes
    seamkit audit --url UReadback over the last 20 changes, with advice for every gap. --last N, --branch R, --json.
    seamkit readback --url UProve each change, or one with --pr N or --commit C. --last N, --branch R, --version-url V, --record or --no-record, --json.
    seamkit stampWrite the version document: --out F, --commit C, --require-clean.
    seamkit state init | list | verify | syncCreate, list, verify and share the ledger branch. sync --remote R.
    seamkit replay [event]Recompute recorded verdicts; fails if any comes out differently.
    seamkit check NAME · seamkit checksRun one registered check on a recorded input; list the checks.
    +
    +

    The production URL can also come from SEAMKIT_URL. seamkit sends only GETs to + production, writes only the seamkit/state branch, records URLs, commit ids and digests but never content, + and runs no model.

    +
    + + + +
    +
    +
    + +
    + + + + + +