veristack 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,23 +1,42 @@
1
1
  # Veristack (`vstack`)
2
2
 
3
- **Replace test theater and silent regressions with deterministic verification gates.**
3
+ **Replace test theater, slop asymmetry, and silent regressions with deterministic verification gates.**
4
4
  Warning, veristack is "slop" :)
5
5
 
6
- Veristack is a deterministic **9-rung verification ladder (`R0 → R8`)**, cross-language static and invariant analyzer (`vstack`), native linter/analyzer kit, runnable formal proof suite (including **Bend 2**), and portable agent skill for **TypeScript/JS, C#/.NET, Rust, Python, Go, SQL, and Shell**.
6
+ Veristack is a deterministic **9-rung verification ladder (`R0 → R8`)**, cross-language static and invariant analyzer (`vstack`), native linter/analyzer kit, runnable formal proof suite (**Bend 2**), anti-slop PR review briefer, and portable agent skill for **TypeScript/JS, C#/.NET, Rust, Python, Go, SQL, and Shell**.
7
7
 
8
- > **Core rule:** Push every check as far down the ladder toward `R0` as possible while keeping the real failure mechanism intact. Checks run faster, flake masking disappears, and coding agents spend fewer tokens repairing broken code.
8
+ > **Core rule:** Push every check as far down the ladder toward `R0` as possible while preserving the real failure mechanism, prefer subtraction over additive workarounds, and reserve human review for the highest-stakes decisions.
9
9
 
10
10
  ---
11
11
 
12
- ## The Problem It Solves
12
+ ## Why Veristack Exists
13
13
 
14
- AI-assisted repositories fail in three recurring ways:
14
+ Inspired in part by [The No AI Slop Manifesto](https://gist.github.com/dexhorthy/4cc96f01be5b1208519e75dad250a948) (*AIE Code Summit 2026* — Dex Horthy, Lauren Tan / `@poteto`, et al.), Veristack targets four compounding failure modes in AI-assisted engineering:
15
15
 
16
- 1. **Test theater:** heavily mocked unit tests and slow E2E suites that mirror buggy implementations, pass when behavior breaks, and hide failures behind `retries: 3`, `|| true`, or `continue-on-error: true`.
17
- 2. **Defects by omission:** boolean flag soup admitting impossible states, wall-clock duration math, release-stripped production assertions, unchecked slices, and swallowed errors.
16
+ 1. **Test theater:** heavily mocked unit tests and slow E2E suites that mirror buggy code and mask failures behind `retries: 3`, `|| true`, or `continue-on-error: true`.
17
+ 2. **Defects by omission:** boolean flag soup admitting impossible states, wall-clock duration math, release-stripped production assertions, unchecked slices, and swallowed catches.
18
18
  3. **Silent invariant loss:** an agent fixes one issue while quietly deleting an earlier null guard, bounds check, `try/finally` cleanup, or comparison clause.
19
+ 4. **Slop asymmetry & compounding context rot:** thousand-line additive PRs, ten-page doc dumps, layered workarounds, and stale `AGENTS.md` pointers that shift review burden onto humans and teach the next agent bad habits.
19
20
 
20
- Veristack converts practices from software engineering, Lean/Toyota production systems, silicon verification, and safety-critical software into fast, repeatable CLI and CI gates.
21
+ ---
22
+
23
+ ## Quick Start
24
+
25
+ Runs on **Node.js `>= 18`** or **[Bun](https://bun.sh) `>= 1.2.0`** via npm, pnpm, or Bun. Optional native toolchains (`dotnet`, `cargo`, `uv`, `go`, `bend`) verify their matching reference suites.
26
+
27
+ ```bash
28
+ # Run immediately with npx or bunx
29
+ npx veristack scan .
30
+ bunx veristack scan .
31
+
32
+ # Or install as a dev dependency
33
+ npm install -D veristack # or: pnpm add -D veristack / bun add -d veristack
34
+ npx vstack scan . --json # Full ladder + anti-slop + agent-doc report
35
+ npx vstack diff-cheats . --base origin/main --fail
36
+ npx vstack review-brief . --base origin/main --md
37
+ ```
38
+
39
+ Run `npx vstack --help` for the complete command and flag reference. From a local clone, run `bun run check` to self-verify Veristack.
21
40
 
22
41
  ---
23
42
 
@@ -26,7 +45,7 @@ Veristack converts practices from software engineering, Lean/Toyota production s
26
45
  Every check belongs on the lowest rung that still catches the defect:
27
46
 
28
47
  ```text
29
- R0 Static Locks, Anti-Slop & Anti-Cheat (< 2 s | 100% files)
48
+ R0 Static Locks, Anti-Slop & Agent-Doc Hygiene (< 2 s | 100% files)
30
49
  R1 Types, Explicit State Machines & Structure (1–10 s | 100% files)
31
50
  R2 Pure Logic, Data Tables, MC/DC & PBT (10ms–2s | 15–40 specs)
32
51
  R3 Stateful MBT, Cross-Coverage, Host & Twins (0.2–5 s | 5–15 suites)
@@ -39,99 +58,70 @@ R8 Live Production Verification & Boot BIST (Always | 3–10 probes)
39
58
 
40
59
  ---
41
60
 
42
- ## Quick Start
61
+ ## Core Capabilities
43
62
 
44
- Runs on **Node.js `>= 18`** or **[Bun](https://bun.sh) `>= 1.2.0`** via npm, pnpm, or Bun. Optional native toolchains (`dotnet`, `cargo`, `uv`, `go`, `bend`) verify their matching reference suites.
63
+ ### 1. Invariant Detection & Mechanical Proofs
64
+ - **Diff Invariant-Loss & AST Predicate Weakening (`vstack diff-cheats`):** catches dropped null/bounds/error/cleanup/lock/timeout/auth guards (`diff-invariant-guard-dropped`) and weakened `if`/`&&`/`||`/bound predicates (`diff-predicate-weakened`) when a diff drops protection without matching test assertions. On a 320-pair historical OSS bug-fix replay corpus (`vstack bench --replay`), this catches **58.1% (`186/320`)** combined (**312/320** regression-free).
65
+ - **Repo-Wide Statistical Belief Mining (`vstack scan`):** infers the codebase's own invariants (`>= 75%` adherence, `N >= 4`) to flag outlier omitted null checks, missing `finally`/`defer`/`with` cleanups, and unprotected sibling routes.
66
+ - **Bend 2 Universal Laws (`vstack laws --verify` + `vstack scan`):** pairs CODEOWNERS-locked [LAWS.bend](templates/bend2-reference/LAWS.bend) with [PROOF.bend](templates/bend2-reference/PROOF.bend) over [Model.bend](templates/bend2-reference/Model.bend), verified by `bend --check-only` alongside [.verification/laws/universal-laws.laws.json](.verification/laws/universal-laws.laws.json) **and** statically projected across TS/JS, C#, Rust, Python, and Go (`law-monotonic-terminal-state`, `law-saturating-underflow`, `law-zero-cap-clamp`, `law-codec-roundtrip-asymmetry`, `law-unwind-unpaired`).
67
+ - **Daikon-Style Dynamic Invariants (`vstack invariants`):** infers runtime bounds, non-null, enum-domain, sorted-array, and relational invariants from JSON traces and fails CI when a locked `.verification/invariants.json` invariant breaks.
45
68
 
46
- ```bash
47
- # Run immediately with npx or bunx
48
- npx veristack scan .
49
- bunx veristack scan .
50
-
51
- # Or install as a dev dependency in your repo
52
- npm install -D veristack # or: pnpm add -D veristack / bun add -d veristack
53
- npx vstack scan . --json # Machine-readable report for coding agents
54
- npx vstack diff-cheats . --base origin/main --fail
55
- ```
56
-
57
- Run `npx veristack --help` (or `vstack --help`) for the complete command and flag list. From a local clone, run `bun run check` to self-verify Veristack.
69
+ ### 2. Anti-Slop Review & Knowledge-Base Hygiene
70
+ - **Stakes-Ranked Human Review Brief (`vstack review-brief`):** measures PR slop-asymmetry (non-lockfile lines added, shotgun-surgery directory spread, doc-dump volume, additive-only deletion ratio, newly added `HACK`/`WORKAROUND` or fallback-swallow catches, and `diff-cheats` hits), sorts changed files into a **Must Review First** queue, explicitly lists where automated checks are blind, and outputs a paste-ready `--md` ownership & AI-disclosure checklist.
71
+ - **Agent Instruction Hygiene (`vstack scan`):** audits `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `REVIEW.md`, `.cursorrules`, and `copilot-instructions.md` for context bloat (`agent-doc-bloat`), dead repo file references (`agent-doc-stale-path`), and mechanical rules stuck in prose (`agent-doc-unpromoted-rules`).
72
+ - **Anti-Cheat, Supply-Chain & Brownfield Locks:** blocks `continue-on-error: true`, `|| true`, `--no-verify`, test skips/retries, unpinned third-party GitHub Actions, missing `persist-credentials: false` on OIDC workflows, stealth `.vstack.json`/`.verification/invariants.json` weakening, and supports auto-shrinking `--ratchet` baselines, `.verification/chokepoints.json`, `vstack formal-sync`, `red-before-fix`, `mcdc`, `spc`, `big-o`, and 90/10 BYO System 1 circuits (`vstack circuit list`).
58
73
 
59
74
  ---
60
75
 
61
76
  ## Per-Repo Configuration (`.vstack.json`)
62
77
 
63
- Teams can turn off style rules that conflict with an existing ADR, adjust severities, or ignore directories by adding `.vstack.json` (or `.verification/vstack.json`) at the repo root:
78
+ Adjust rule severities or ignore directories via `.vstack.json` (or `.verification/vstack.json`) at the repo root:
64
79
 
65
80
  ```json
66
81
  {
67
82
  "rules": {
68
83
  "no-comments": "off",
69
84
  "max-file-lines": "off",
70
- "long-file": "off",
71
85
  "rust-prod-unwrap-or-expect": "warn"
72
86
  },
73
87
  "ignore": ["spikes/**"]
74
88
  }
75
89
  ```
76
90
 
77
- Once committed, `vstack diff-cheats` watches `.vstack.json` (and `.verification/invariants.json` / `.vstackignore`) so future PRs cannot quietly disable rules without human review. You can also pass `--config <file>` or `--disable rule1,rule2` for ad-hoc scans.
91
+ Once committed, `vstack diff-cheats` watches `.vstack.json`, `.vstackignore`, and `.verification/invariants.json` so future PRs cannot quietly relax gates without human review.
78
92
 
79
93
  ---
80
94
 
81
95
  ## Multi-Language Coverage (7 Benchmarked Languages)
82
96
 
83
- Every language below is covered by a living `caught/` vs `clean/` precision benchmark under [examples/](examples/README.md) (`vstack bench . --fail`: **196/196 recall, 0 clean FPs, 0 adversarial comment/string-wrapped FPs**):
97
+ Every language is verified by a living `caught/` vs `clean/` precision benchmark under [examples/](examples/README.md) (`vstack bench . --fail`: **196/196 recall, 0 clean FPs, 0 adversarial comment/string-wrapped FPs**):
84
98
 
85
99
  | Language | Static & Native Enforcement (`R0`–`R1`) | Runnable Reference & Formal Proof (`R2`–`R5`) | Guide |
86
100
  | :--- | :--- | :--- | :--- |
87
- | **TypeScript / JS** | `oxc-parser` AST, cross-file import graph, [oxlint-no-comments.mjs](lint/oxlint-no-comments.mjs), [oxlint-explicit-state-machine.mjs](lint/oxlint-explicit-state-machine.mjs) | `src/` + `tests/` ([formal-verification.test.ts](tests/formal-verification.test.ts)) | [typescript.md](skill/references/languages/typescript.md) |
88
- | **C# / .NET 10** | Roslyn [VStack.Analyzers](lint/csharp/VStack.Analyzers/) (`VSTACK001`–`VSTACK004`), `TreatWarningsAsErrors` | [templates/csharp-reference/](templates/csharp-reference/) (BFS formal proof, Dafny, `FsCheck`, `Stryker.NET`) | [csharp.md](skill/references/languages/csharp.md) |
89
- | **Rust (2024)** | `unsafe_code = "forbid"`, Clippy `unwrap_used`/`expect_used`/`wildcard_enum_match_arm = "deny"`, `rust-prod-unwrap-or-expect` | [templates/rust-reference/](templates/rust-reference/) (`stateright` BFS, Kani, `proptest`, `cargo-mutants`) | [rust.md](skill/references/languages/rust.md) |
90
- | **Python (3.12+)** | `ruff` strict + `S101` prod assert ban, `mypy --strict`, `assert_never` | [templates/python-reference/](templates/python-reference/) (`hypothesis` PBT/MBT, BFS formal check, `mutmut`) | [python.md](skill/references/languages/python.md) |
91
- | **Go (1.23+)** | Concurrency/channel/UTF-8/path guards + [.golangci.yml](templates/go-reference/.golangci.yml) (`errcheck`, `bodyclose`, `gosec`, `exhaustive`, `bidichk`) | [templates/go-reference/](templates/go-reference/) (JSON transition table, `testing/quick` PBT + stateful MBT, `go test -race`) | [templates/go-reference/](templates/go-reference/order.go) |
92
- | **SQL & Shell** | Postgres lock-timeout, RLS fail-open, `LIMIT` without `ORDER BY`, `= NULL`, `pkill -f`, argv secret & `PATH` guards | [examples/sql/](examples/sql/manifest.json), [examples/shell/](examples/shell/manifest.json) | [examples/README.md](examples/README.md) |
93
-
94
- ---
95
-
96
- ## Invariant Detection & Mechanical Proofs
97
-
98
- Static pattern rules alone catch known footguns, not broken domain invariants. Veristack combines four complementary invariant layers:
99
-
100
- 1. **Diff Invariant-Loss & AST Predicate Weakening (`vstack diff-cheats`):** Detects dropped null/bounds/error/cleanup/lock/timeout/auth guards (`diff-invariant-guard-dropped`) and stripped `if` branches, `&&`/`||` clauses, or `<=`/`>=`/`===` bounds (`diff-predicate-weakened`) when a PR removes protection without adding matching test assertions. On a 320-pair historical OSS bug-fix replay corpus (`vstack bench --replay`), this catches **58.1% (`186/320`)** combined (**56.3%** regression immunity, **312/320** regression-free).
101
- 2. **Repo-Wide Statistical Belief Mining (`vstack scan`):** Infers the codebase's own invariants across call sites (`>= 75%` adherence, `N >= 4`) to flag outlier omitted null checks (`invariant-deviant-null-check`), missing `finally`/`defer`/`with` cleanups (`invariant-deviant-paired-cleanup`), and unprotected sibling route handlers (`invariant-deviant-route-auth`).
102
- 3. **Bend 2 Universal Laws (`vstack laws --verify`):** Pairs a CODEOWNERS-locked [LAWS.bend](templates/bend2-reference/LAWS.bend) spec with [PROOF.bend](templates/bend2-reference/PROOF.bend) over [Model.bend](templates/bend2-reference/Model.bend) (idempotency, monotonic terminal states, total saturating math, zero-cap bounds, codec round-trip, and stack unwind), verified directly by `bend --check-only` (and `--verdict` with the Lean BendTT kernel when `$BENDTT` is set) alongside [.verification/laws/universal-laws.laws.json](.verification/laws/universal-laws.laws.json) across all 6 toolchains.
103
- 4. **Daikon-Style Dynamic Invariants (`vstack invariants`):** Infers runtime bounds, non-null, enum-domain, sorted-array, and relational (`result <= args.amount`) invariants from JSON execution traces, diffs them against a locked `.verification/invariants.json` baseline, and fails CI when a behavioral invariant breaks.
104
-
105
- ---
106
-
107
- ## Key Capabilities & Gates
108
-
109
- - **Anti-cheat & supply-chain locks:** catches `continue-on-error: true`, `|| true`, `--no-verify`, test skips/retries, unpinned third-party GitHub Actions, missing `permissions:`/`timeout-minutes`/`concurrency`, blanket suppressions, and stealth edits to `.vstack.json` / `.verification/invariants.json`.
110
- - **Brownfield ratchets & choke points:** auto-shrinking `--ratchet` baselines for legacy adoption, `.verification/chokepoints.json` for project-specific banned primitives, and `vstack formal-sync` commit-drift checks.
111
- - **Zero-defect engineering utilities:** `red-before-fix`, `mcdc` independence vectors, `spc` drift control charts, empirical `big-o` scaling fits, and 4 deterministic-first 90/10 BYO System 1 circuits (`vstack circuit list`).
101
+ | **TypeScript / JS** | `oxc-parser` AST (`anti-slop`, `landmines`, `internal/` boundaries, cross-file graph) + unified Oxlint plugin (`veristack/lint`) | `src/` + `tests/` ([formal-verification.test.ts](tests/formal-verification.test.ts)) | [typescript.md](skill/references/languages/typescript.md) |
102
+ | **C# / .NET 10** | Roslyn [VStack.Analyzers](lint/csharp/VStack.Analyzers/) (`VSTACK001`–`VSTACK004`), `TreatWarningsAsErrors` | [templates/csharp-reference/](templates/csharp-reference/) (BFS proof, Dafny, `FsCheck`, `Stryker.NET`) | [csharp.md](skill/references/languages/csharp.md) |
103
+ | **Rust (2024)** | `unsafe_code = "forbid"`, Clippy `unwrap_used`/`expect_used`/`wildcard_enum_match_arm = "deny"` | [templates/rust-reference/](templates/rust-reference/) (`stateright`, Kani, `proptest`, `cargo-mutants`) | [rust.md](skill/references/languages/rust.md) |
104
+ | **Python (3.12+)** | `ruff` strict + `S101` prod assert ban, `mypy --strict`, `assert_never` | [templates/python-reference/](templates/python-reference/) (`hypothesis` PBT/MBT, BFS proof, `mutmut`) | [python.md](skill/references/languages/python.md) |
105
+ | **Go (1.23+)** | Concurrency/channel/UTF-8/path guards + [.golangci.yml](templates/go-reference/.golangci.yml) | [templates/go-reference/](templates/go-reference/order.go) (table, `testing/quick` PBT + stateful MBT, `-race`) | [examples/go/](examples/go/manifest.json) |
106
+ | **SQL & Shell** | Lock-timeout, RLS fail-open, `LIMIT` without `ORDER BY`, `= NULL`, `pkill -f`, argv secret & `PATH` guards | [examples/sql/](examples/sql/manifest.json), [examples/shell/](examples/shell/manifest.json) | [examples/README.md](examples/README.md) |
112
107
 
113
108
  ---
114
109
 
115
110
  ## Portable Agent Skill
116
111
 
117
- Install [skill/](skill/) into `~/.agents/skills/veristack` or `~/.claude/skills/veristack` so coding agents run `vstack scan . --json` before designing or refactoring verification suites:
112
+ Install [skill/](skill/) into `~/.agents/skills/veristack` or `~/.claude/skills/veristack` so coding agents run `vstack scan . --json` before designing checks and `vstack review-brief` before opening PRs:
118
113
 
119
- - [skill/SKILL.md](skill/SKILL.md) — 9-rung ladder, shared vocabulary, and 4-phase workflow
120
- - [skill/references/01-test-and-verification-index.md](skill/references/01-test-and-verification-index.md) — All 42 mechanisms (`V01`–`V42`)
121
- - [skill/references/02-linter-and-antislop-stack.md](skill/references/02-linter-and-antislop-stack.md) — `R0`–`R1` linter architecture & ratchets
122
- - [skill/references/03-pushdown-protocol-and-budgets.md](skill/references/03-pushdown-protocol-and-budgets.md) — Routing matrix, budgets & CI speed
123
- - [skill/references/05-formal-verification.md](skill/references/05-formal-verification.md) — Formal verification playbook (`R5 / V25`)
124
- - [skill/references/06-system1-circuits.md](skill/references/06-system1-circuits.md) — 90/10 BYO System 1 circuit runtime
125
- - [skill/references/07-zero-defect-cross-discipline.md](skill/references/07-zero-defect-cross-discipline.md) — Lean, Silicon & Safety-Critical verification
114
+ - [skill/SKILL.md](skill/SKILL.md) — 9-rung ladder, leading vocabulary, and 4-phase workflow
115
+ - [skill/references/](skill/references/) — progressively disclosed playbooks (`01`–`07`) and per-language guides
126
116
 
127
117
  ---
128
118
 
129
119
  ## Local Verification Across All Toolchains
130
120
 
131
121
  ```bash
132
- bun run check # TS/JS/Bun + self-scan + 110 tests
122
+ bun run check # TS/JS/Bun test suite, no-comments, state-machines & self-scan
133
123
  bun run test:laws # Bend 2 proofs + Go + Rust + Python + C# + TS law witnesses
134
- bun run test:go # go vet + go test -race (table, PBT, stateful MBT)
124
+ bun run test:go # go vet + go test -race
135
125
  bun run test:rust # rustfmt + clippy -D warnings + proptest + stateright
136
126
  bun run test:python # ruff + mypy --strict + pytest + hypothesis
137
127
  bun run test:csharp # Roslyn VStack.Analyzers + .NET 10 reference solution
@@ -139,11 +129,12 @@ bun run test:csharp # Roslyn VStack.Analyzers + .NET 10 reference solution
139
129
 
140
130
  ---
141
131
 
142
- ## Attribution & Clean-Room Notice
132
+ ## Inspiration & Clean-Room Attribution
143
133
 
144
- Veristack is an original, from-scratch MIT implementation synthesizing ideas from open-source tooling and reliability literature:
134
+ Veristack is an original, from-scratch MIT implementation synthesizing ideas from anti-slop engineering, open-source tooling, and reliability literature:
145
135
 
146
- - **Open-source inspiration:** [`deterministic-machines/deslop-please`](https://github.com/deterministic-machines/deslop-please), [`dmmulroy/anti-slop`](https://github.com/dmmulroy/anti-slop), [`@interfere/landmines`](https://github.com/interfere-inc/landmines), [`mattpocock/skills`](https://github.com/mattpocock/skills), [`cursor/plugins` (`pstack`)](https://github.com/cursor/plugins/tree/main/pstack), [`bendlang/bend`](https://github.com/bendlang/bend), [`antithesishq/bombadil`](https://github.com/antithesishq/bombadil), and [`tigerbeetle/tigerbeetle`](https://github.com/tigerbeetle/tigerbeetle) (`TIGER_STYLE.md`).
136
+ - **Anti-slop & human-judgment inspiration:** [The No AI Slop Manifesto](https://gist.github.com/dexhorthy/4cc96f01be5b1208519e75dad250a948) (*AIE Code Summit 2026* — Dex Horthy, Lauren Tan / `@poteto`, et al.) and [*Why Software Factories Fail*](https://github.com/humanlayer/advanced-context-engineering-for-coding-agents/blob/main/wsff.md).
137
+ - **Open-source tooling inspiration:** [`deterministic-machines/deslop-please`](https://github.com/deterministic-machines/deslop-please), [`dmmulroy/anti-slop`](https://github.com/dmmulroy/anti-slop), [`@interfere/landmines`](https://github.com/interfere-inc/landmines), [`mattpocock/skills`](https://github.com/mattpocock/skills) (including `writing-for-agents`), [`cursor/plugins` (`pstack`)](https://github.com/cursor/plugins/tree/main/pstack), [`bendlang/bend`](https://github.com/bendlang/bend), [`antithesishq/bombadil`](https://github.com/antithesishq/bombadil), and [`tigerbeetle/tigerbeetle`](https://github.com/tigerbeetle/tigerbeetle) (`TIGER_STYLE.md`).
147
138
  - **Research & literature:** Dawson Engler et al. (*Bugs as Deviant Behavior*, SOSP 2001), Michael Ernst et al. (*Daikon Dynamic Invariant Detection*), Matteo Vaccari (*Tests as Data*), John Ousterhout (*A Philosophy of Software Design*), Meta Engineering (*Just-in-Time Catching Test Generation*, `arXiv:2601.22832`), TypeSafe AI (JEV), Shopify Packwerk, Shigeo Shingo (*Poka-Yoke*), Toyota (*Jidoka* / *A3*), Shewhart (*SPC*), NASA JPL (*Power of 10*), DO-178C (*MC/DC*), SQLite (*TH3*), and seL4.
148
139
 
149
140
  See [skill/references/04-source-patterns-digest.md](skill/references/04-source-patterns-digest.md) for the full traceability map.