Skip to content

feat(formal-verification): add the specify skill's propose, create and check forms - #16704

Merged
kyle-sexton merged 5 commits into
mainfrom
feat/formal-verification-specify
Nov 17, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
feat/formal-verification-specify

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Refs: #15773

Summary

Adds /formal-verification:specify, slice 2 of 3 of the formal-verification plugin: a bare form that proposes the promise worth proving, create "<promise>" that writes a consumer formal-<area> skill and proves a seeded break is caught, and check, a deterministic pass or fail gate on the consumer contract. This pull request delivers every done-when item of #15773 except the two dogfood items.

Fix

  • New skill plugins/formal-verification/skills/specify/ with a tool-neutral choose-a-tool.md; it names no verification tool, installs none, and reaches other skills only by slash reference with an "if installed" fallback.
  • New plugins/formal-verification/scripts/check.mjs (read-only): fails on missing or wrong frontmatter, a missing or out-of-order section, a missing or invalid sync.yaml, a sync commit that is not an ancestor of HEAD, a covered path missing at HEAD, or no run command; warns on stale coverage (on_stale: fail makes it fail) and on verification skills outside the contract.
  • CI Status gains two steps that run the default branch's copy of check.mjs over .claude/skills/formal-* of the event commit. No pull request code runs, the folder is fixed on the command line, the step has a two-minute limit, and both steps skip until the script is on the default branch, so they do not run on this pull request.
  • create checks the enforcement ladder's opt-in first: with no opt-in in the project instructions it goes on only on a person's yes for that run, and unattended it reports blocked: formal verification not opted in.
  • A sync commit and a seeded break's commit must already be on the default branch, since a squash or rebase merge discards a branch-only commit; check.mjs --default-ref <ref> fails one that is not, and the CI Status step passes the default branch's ref.
  • check.mjs refuses symlinks and paths that leave the project, matches covers globs in linear time, turns git's lazy fetch off and quotes every name it prints.
  • lib/config-cascade.mjs exports fileState and escapes for that containment check, so each plugin carrying a synced copy takes a patch fragment.
  • Both carry-refusal lists name the formal-verification files the CI Status job now loads.
  • AGENTS.md opts this repository in to the enforcement ladder's formal-verification rung.
  • Her sentence "TLA+ is the default" is replaced by "No tool is the default", recorded in docs/upstream/cursor-pstack.md with ADR 0101 as the reason.

Verification

  • node --test on check.test.mjs: 49 of 49 pass; each new test failed against the previous script first. The toolchain, merge-holds and config-cascade suites pass.
  • The CI Status step's layout reproduced locally on this pull request's test merge commit (blobless clone, sparse checkout of .claude/skills/, the script from a separate copy, --default-ref refs/remotes/origin/main): 1 formal-<area> skill(s), 0 failure(s), 0 warning(s), exit 0, against the existing formal-claim-protocol skill. A ref that does not resolve prints one warning and exits 0.
  • Two independent reads before this pull request opened: a security read of the new steps ("safe after fixes"; each fix is in this branch) and an item-by-item read of the done-when list.
  • Left out: the new CI Status steps on a real runner (they skip until this merges; the first pull request after the merge is watched), paid eval runs of the three new sp-* cases, and the full .github suite, which CI runs.

Related

Remaining

  • The formal-verification dogfood takes a promise other than the claim protocol from the bare form's proposal through create, and its seeded break is caught.
  • If the dogfood's proposed tool does not resolve or is not installed, the run records that and takes the next candidate.

#15773 is finished when the dogfood pull request lands, after the owner's yes on the bare form's proposal.

🤖 Generated with Claude Code

kyle-sexton and others added 3 commits November 17, 2026 00:34
…d check forms

/formal-verification:specify proposes the promise most worth proving
(bare, writes nothing), builds one formal-<area> skill with a seeded
break caught in a throwaway git worktree (create "<promise>", with
--unattended as a dry run), and runs the contract check (check). It
names no verification tool and installs none; the tool is chosen for
the consumer's repository and recorded only in its formal-<area> skill
(ADR 0101), replacing her "TLA+ is the default".

scripts/check.mjs is the deterministic contract check, with tests. The
CI Status job runs the default branch's copy over the head's
.claude/skills/formal-* folders as data. AGENTS.md opts this repository
in to the enforcement ladder's formal-verification rung.

Refs: #15773

Co-Authored-By: Claude Opus 5.5 <[email protected]>
check.mjs refuses a symlinked formal-area folder, SKILL.md or sync.yaml
and a skills folder or named folder outside the repository, through the
cascade's fileState and escapes, now exported to every carrier. Globs
match by a linear NFA, git runs with lazy fetch off, every name and path
in the report is JSON-quoted, outside_model entries must be
repository-relative, ## Run must give the command on a line of its own,
and sections must keep the contract's order.

The CI Status step checks out only .claude/skills from the event commit,
passes --skills-dir .claude/skills, and has a two-minute timeout. Both
carry-refusal lists add the plugin's defaults and schemas. The plugin
description keeps the chart and setup text from main.

Refs: #15773

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 17, 2026 06:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T06:20:39.092545Z 8f62ef0 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8f62ef0c19

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…ate on the ladder opt-in

globMatch left the **/ state after any character, so src/**/lock.js
matched src/unlock.js. The state now leaves only after a / or at once
for zero folders, and stays linear.

create reads a synced copy of the enforcement ladder and checks that the
project instructions opt in to its formal-verification rung before any
proposal or write: attended, it goes on only on a yes for the run;
unattended, it reports blocked: formal verification not opted in. The
bare form says whether the repository has opted in.

Refs: #15773

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 44030201615

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 10e3f14f88937e1f2851a6587c32f2eb6ffce5c8: read 8 of 8 changed file(s); 0 finding(s), 0 as inline comments.

Security review: incremental, 472eaa2..10e3f14

I found no security issues in this push. This lane already reviewed an earlier head, so this pass reports only CRITICAL and IMPORTANT findings.

critical-findings: 0

What I checked

CI Status step (.github/workflows/pr-require-checks.yml, the formal-skills check step)

  • The step adds DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} through env: and uses it as the quoted shell variable "refs/remotes/origin/$DEFAULT_BRANCH". The value is never interpolated into run: text, so there is no expression injection.
  • Only the repository owner can set the default branch name, so a pull request author does not control it.
  • The step still runs the default branch's .base/ copy of check.mjs. Its if: gates, timeout-minutes: 2 and the job's permissions: are unchanged.
  • The step is not one of the ci-status hold steps. It only adds a way to fail, so it widens nothing.

check.mjs --default-ref (plugins/formal-verification/scripts/check.mjs L123-L127, L239-L243)

  • Option injection. A ref that starts with - is refused before any git call. The ref then goes to git rev-parse --verify -q --end-of-options <ref>^{commit} as an argv list, so it cannot become a git option.
  • Commit values. ctx.defaultRef holds the resolved hex SHA, not the raw text. entry.commit and seeded_break.commit already had to match the full-SHA regex in syncProblems (L170, L180) before they reach cat-file or merge-base.
  • Printed output. The ref text appears in output only through q() (JSON.stringify), so a value holding a newline cannot start a :: workflow command.
  • Unresolved ref. A ref that does not resolve prints a WARN and skips the new check. That is a contract-quality check, not a security control, so this fail-open path is not a security finding.

Instruction surfaces (specify/SKILL.md, reference/create.md, reference/formal-skill.md, README.md, the changelog fragment)

  • The diff only adds requirements: sync and seeded-break commits must be on the default branch, and the scratch worktree starts at the sync commit instead of HEAD. It removes or softens no guardrail.
  • The worktree command still uses --detach, and the worktree is still removed afterwards.

Tests (check.test.mjs): changes to tests only, with no security surface.

Other notes

  • Settled threads. The **/ glob thread on check.mjs L73-L75 is marked lines changed since resolution: no, and this push does not touch those lines. The create.md opt-in thread is marked yes, but this push only adds the default-branch commit guidance and does not reopen the opt-in point.
  • Prior summary note now addressed. The earlier review noted that the description promised --default-ref, but the diff did not contain it. This push adds it in both the script and the CI Status step, so the description now matches the code.
  • Spend. None. The change adds a few git calls to an existing two-minute step.

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 10e3f14f88937e1f2851a6587c32f2eb6ffce5c8: read 8 of 8 changed file(s); 0 finding(s), 0 as inline comments.

Code review: incremental, 472eaa2b..10e3f14f (8 files), blocking only

This lane already reviewed an earlier head, so this pass reports only blocking findings and manifest flags. I found no blocking findings.

The earlier blocking finding is fixed. It said that a sync or seeded-break commit taken from the feature branch is lost in a squash merge, and that the PR body claimed a fix the diff did not contain. This push adds that fix:

  • check.mjs: now accepts --default-ref.
    • It resolves the ref once with rev-parse --verify -q --end-of-options <ref>^{commit} and refuses a ref that starts with - (check.mjs#L266-L271).
    • It then fails both the sync commit and seeded_break.commit when either is not an ancestor of that ref (check.mjs#L239-L243).
  • CI step: passes --default-ref "refs/remotes/origin/$DEFAULT_BRANCH", with the branch name taken from github.event.repository.default_branch through env: rather than interpolated into the script (pr-require-checks.yml#L5587-L5589).
    • The checkout uses fetch-depth: 0, so the remote-tracking ref should exist on both pull_request and merge_group events. That ref behaviour of actions/checkout is the author's claim; I did not verify it.
  • create.md:
    • It now records the merge base, or a later default-branch commit, as the sync commit.
    • It makes the seeded-break worktree from that sync commit instead of HEAD.
    • It says the stale-coverage warning is expected until a change that edits covered code lands.
  • Docs: formal-skill.md, README.md, SKILL.md and the changelog fragment describe the same behaviour.

Checked and fine at this head

  • Rollout order: the CI step runs .base/…/check.mjs, and the step is skipped until the script is on the base branch. The new flag and the workflow line that passes it therefore reach main in the same merge, so no run can pass --default-ref to an older script that would reject it with exit code 2.

  • New tests: five tests cover these cases:

    • both commits on main pass;
    • a sync commit only on the feature branch fails, without the duplicate "not an ancestor of HEAD" line;
    • a seeded-break commit only on the feature branch fails, with the exact message;
    • with no flag, the earlier behaviour is unchanged;
    • a ref that does not resolve warns once and exits 0.

    The test repository is created with init -b main, so the main ref resolves.

  • Settled thread on the globMatch lines (check.mjs lines 73-75): those lines are unchanged since it was resolved, so I did not raise it again.

Plugin manifest: this push changes no plugin.json or marketplace.json. The fragment stays bump: minor for a new plugin skill.

Closing issue: the PR context file has no closing-issue section (the PR body says Refs: #15773), so there are no acceptance criteria to check.

Spend (not a hold): the default-branch check adds two more git calls per sync.yaml entry inside the existing 2-minute CI step.

I ran nothing and dispatched no verifier subagent; I read the incremental diff in full and the surrounding code at head. The author's test results are unverified here.

Verifier dropped 0 of 0 candidates.

…e default branch

A sync commit only a feature branch holds passes on the pull request
but is discarded by a squash or rebase merge, so check then fails in the
merge queue and on every later change. The contract and create now say
both commits are default-branch commits (the merge base or later, with
identical covered files), and the sync commit moves in a follow-up once
a change to the covered code lands.

check.mjs takes --default-ref: a commit not on that ref fails, and a ref
that does not resolve warns once and skips the check. The CI Status step
passes refs/remotes/origin/<default branch>, which the fetch-depth 0
checkout fetches on pull_request and merge_group alike.

Refs: #15773

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit cee9e4d Nov 17, 2026
93 of 94 checks passed
@kyle-sexton
kyle-sexton deleted the feat/formal-verification-specify branch November 17, 2026 07:31
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant