/nanoclaw-e2e:typesafe-docs-driftfrom nanoclaw-e2e
Detect and rank drift between the NanoClaw code and the nanoclaw-docs Mintlify portal with the TypeSafe System One decision API. Deterministic code extracts facts (ncl verbs and flags, environment variables, container_configs and cli_scope, workspace skills, gateway selection, timestamp rules), lexical search picks candidate doc sections, and one fan-out request per fact x section asks contradicts / covers / staleness. Prints DRIFT, MISSING, UNSURE and OK rows with the model's numbers; writes nothing to either repository. The release gate (docs-drift-gate.py) adds the pull requests merged since the last stable tag that touch files the docs cite and never name them, the verified-against stamp check, a baseline for decided rows, and per-page briefs. Use to find doc pages that need a fix at a release, or replay the offline fixture without a key.
Ships in nanoclaw-e2e. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Extract facts from a NanoClaw checkout with deterministic code, find the top doc sections for each fact by lexical search over the docs portal, ask TypeSafe one fan-out request per fact x section pair, gate on the answers, and print a ranked drift report. The model only judges; it never writes text. Phase 2 (an agent writing doc PRs) consumes the JSON this script saves and the briefs the release gate writes from it.
Entry point: typesafe-docs-drift.py (Python 3.10+, standard library only). Offline fixture: nanoclaw-sample.json. Details of the facts, questions, gate and JSON: docs/typesafe-docs-drift.md.
src/cli/resources/*.ts (registerResource definitions: plural,
operations, customOperations with access, declared args or the
--flags named in descriptions, column enums), src/config.ts (readEnvFile([...]) keys and defaults),
src/gateway-providers/index.ts and src/drivers/index.ts (default kinds),
src/**/*.ts process.env.X || 'default' reads, .env.example,
src/db/migrations/*.ts (container_configs columns), the --cli-scope
validation in src/cli/resources/groups.ts, .claude/skills/*/SKILL.md
frontmatter, docs/gateway-seam.md (## Selection and
## How a gateway gets installed, when present) and the ## Timestamps
section of CLAUDE.md. Verified against nanocoai/nanoclaw 6e5008fe.docs.json navigation and the .mdx pages it lists, split
on ##/###/#### headings (changelog pages excluded by default).POST https://api.typesafe.ai/v1/systemone, model
jev-latest, question types noul and score
(API reference,
confidence,
speculative fan-out,
citation check cookbook).Re-check the extractors when src/cli/crud.ts, src/config.ts or the
migration layout changes.
--code, default: the current directory) and a
nanoclaw-docs checkout (--docs). Both are read only.TYPESAFE_API_KEY exported in the shell (live mode only). The script reads
it from the environment at request time, never from a file, and never prints
it. Do not put the key in .env, a fixture, or any file inside a repository.Offline demonstration, no key and no network:
python3 skills/typesafe-docs-drift/scripts/typesafe-docs-drift.py \
--fixture skills/typesafe-docs-drift/fixtures/nanoclaw-sample.json
See the facts, or the fact x section pairs, without calling the API:
python3 skills/typesafe-docs-drift/scripts/typesafe-docs-drift.py --code . --facts-only
python3 skills/typesafe-docs-drift/scripts/typesafe-docs-drift.py --code . --docs ../nanoclaw-docs --plan
Live run from a NanoClaw checkout (about 140 facts, 430 requests, a few minutes at the default concurrency of 4):
export TYPESAFE_API_KEY=... # from your password manager, this shell only
python3 skills/typesafe-docs-drift/scripts/typesafe-docs-drift.py \
--code . --docs ../nanoclaw-docs --record /tmp/drift-record.json
--record saves facts, sections and raw responses so the run can be replayed
with --fixture. Raw answers for every run land in
skills/typesafe-docs-drift/output/ (gitignored) or --output-dir.
Flags: --areas (comma-separated subset of ncl,env,container-config,skills, gateway,timestamps), --limit-facts, --top-k (3), --include-changelog,
--contradicts-threshold (0.7), --covers-threshold (0.7),
--staleness-threshold (0.5, score confidence), --concurrency (4),
--model, --timeout, --json, --strict (exit 1 when any pair failed after
retries; by default failures are listed under partial and the exit status is 0).
docs-drift-gate.py is what to run when a NanoClaw
release is cut. It clones the release and the docs into a scratch directory
(URLs or local paths; neither source is changed) and writes a run directory
with digest.md, gate.json and one brief per page that needs work.
export TYPESAFE_API_KEY=... # this shell only; or use --no-model / --fixture
python3 skills/typesafe-docs-drift/scripts/docs-drift-gate.py \
--release v2026.10.1-rc.1 --baseline ~/path/to/docs-drift-baseline.json
It runs three checks:
--since to override) that change a file some docs page cites,
minus those whose number (four digits or more) the docs history or pages
already name, and minus CI, test and release chores (a ! breaking marker
keeps a change in). A page is hit only by a change merged after the stamp
that cites the file: a stamped commit that already contains the pull request
was verified with it in place. This is the list to work from; pages are
ranked by how many of a pull request's files they cite.{/* verified-against: ... @ <sha> */}
anchor is diffed against the release. On a busy tree most pages come out
stale, so gate.json keeps the full map and the digest only counts it.
Anchors whose SHA is not in the NanoClaw repository (the templates repo, a
rewritten branch) are listed for a manual look.--fixture). A
DRIFT row whose best section never mentions the fact's terms is demoted to
UNSURE. --baseline holds rows a person already decided:
{"entries": [{"fact": "env:X", "status": "held|false-positive|accepted", "reason": "...", "section": "optional#id"}]}.
An entry with a section holds only that section's DRIFT pair, so a second
drifting section is still raised. A partial detector run is reported, and
fails a --strict gate (exit 2).Read digest.md first, then work the briefs in order as stacked draft docs
PRs: each brief lists the pull requests, the cited files they changed, the
detector rows and the docs repo's rules. Nothing in a brief is generated prose.
Bump a page's stamp only for claims re-verified at that SHA, and report product
bugs found on the way instead of documenting around them.
Flags: --release (required), --since, --code-repo, --docs-repo,
--docs-ref (main), --output-dir, --baseline, --fixture, --no-model,
--max-briefs (15), --workdir, --keep, --json, --concurrency,
--strict with --max-undocumented (exit 1 on new DRIFT rows or a longer
queue; the default exit status is 0). Exit 2 is an operational failure.
docs-drift-fix.py prepares and checks the agent loop that turns a gate run into
verified docs edits; the roles, file formats and prompts are in
references/phase2.md. In short: blind inputs for each new DRIFT row, a verifier agent per
row (a wrong row is dropped before anyone drafts), a drafter agent per queued pull request and per kept row, a blind
verifier agent per proposal, and apply, which makes the kept exact-text replacements in a docs worktree. A person
or agent then runs mint validate and makes one local, unsigned commit per concern, stacked. It never calls a model,
pushes, or opens a PR.
Decisions live in the docs repository: docs/drift-baseline.json is read by default. A fact entry holds a detector
row; a pr entry ({"pr": 4088, "status": "no-docs-needed", "reason": "..."}) holds a queued pull request. Changing
the file is an ordinary docs PR, so a maintainer reviews every decision.
At each release, after the GitHub Release read-back:
docs-drift-gate.py --release vX.Y.Z[-rc.N].digest.md and decide (about 15 minutes): for each queued pull request choose "needs docs" or record
no-docs-needed in the baseline. Decisions count once merged in the docs repository; until then pass
--baseline <file>.ledger.md and the diff of those commits (about 5 minutes) before anyone pushes. Open draft docs PRs only on
the maintainer's yes.drift-benchmark.py compares TypeSafe with a
prompt-and-parse LLM (claude -p, tools disabled) on the same recorded pairs:
speed, tokens, cost, parse failures, stability, agreement, and precision/recall
against benchmark-gold.json, whose labels were
written by an LLM-assisted reviewer. With no flags it is offline and scores the
recorded answers only. Method and results:
docs/typesafe-docs-drift.md.
One row per fact, ranked DRIFT (a section contradicts the fact, highest
contradiction first), MISSING (no candidate section covers the fact),
UNSURE (an answer sits between the gates), OK (a section covers the fact
and does not contradict it). Each row names the doc page and heading the
verdict rests on, the contradicts and covers probabilities, the staleness
score with its level (? when the score's confidence is below the gate) and
the code evidence as file:line. The summary counts verdicts per area and
reports tokens and wall time.
DRIFT rows was a docs error: three came from extractor bugs
(enums built from [...CONSTANT] read as empty, a raw empty default), now
fixed, and one from a SKILL.md description that the docs rightly contradict.
Check every row against the code before editing a page.MISSING or UNSURE. Raise --top-k or read the pairs in the JSON.docs/gateway-seam.md and a non-empty .env.example are used when present;
on NanoClaw main at 6e5008fe both are absent, so gateway facts come from
src/gateway-providers/index.ts and the run notes say so.fixtures/benchmark-gold.json (opens in a new tab)fixtures/benchmark-workload.json (opens in a new tab)fixtures/nanoclaw-sample.json (opens in a new tab)references/phase2.md (opens in a new tab)scripts/docs-drift-fix.py (opens in a new tab)scripts/docs-drift-gate.py (opens in a new tab)scripts/drift-benchmark.py (opens in a new tab)scripts/typesafe-docs-drift.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub nanocoai/nanoclaw-oss-dev-tools --plugin nanoclaw-e2e10 skills in this plugin
/e2e-channelsFind the test credentials each NanoClaw messaging channel needs (Slack, Telegram, Discord, Teams and the rest), from a file, NC_E2E_* environment variables or ~/.nanoclaw-e2e/channels/, and report every channel as ready or skipped with the missing variable named. Use before a channel E2E run, to see which channels can be tested, or to fill local credential files from 1Password./e2e-exe-devProvision an exe.dev VM and run a headless NanoClaw install on it end to end — Node/pnpm, Docker, OneCLI, vault secret, agent image, service, a cli-channel agent — then assert the same ping round-trip the setup wizard uses. Use to test a branch or PR on a real machine, to reproduce an install failure, or to bake a reusable base VM. Triggers on "e2e test on exe.dev", "install nanoclaw on a vm", "headless install", "test this branch end to end", "exe.dev"./e2e-