@tayomi/deterministic-gates 0.0.0-stage → 0.3.0

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.
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "tayomi-deterministic-gates",
3
+ "owner": {
4
+ "name": "Pierre Moati",
5
+ "url": "https://github.com/mopi1402"
6
+ },
7
+ "plugins": [
8
+ {
9
+ "name": "deterministic-gates",
10
+ "source": "./",
11
+ "description": "Gates that run on what each turn changed and send the agent back until they pass.",
12
+ "version": "0.3.0"
13
+ }
14
+ ]
15
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
3
+ "name": "deterministic-gates",
4
+ "version": "0.3.0",
5
+ "description": "Deterministic backpressure for coding agents: gates that run on what each turn changed and send the agent back until they pass.",
6
+ "author": {
7
+ "name": "Pierre Moati",
8
+ "url": "https://github.com/mopi1402"
9
+ },
10
+ "repository": "https://github.com/mopi1402/tayomi-deterministic-gates",
11
+ "license": "MIT",
12
+ "keywords": ["coding-agents", "quality-gates", "backpressure", "hooks"]
13
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "deterministic-gates",
3
+ "version": "0.3.0",
4
+ "description": "Deterministic backpressure for coding agents: gates that run on what each turn changed and send the agent back until they pass.",
5
+ "author": {
6
+ "name": "Pierre Moati",
7
+ "url": "https://github.com/mopi1402"
8
+ },
9
+ "repository": "https://github.com/mopi1402/tayomi-deterministic-gates",
10
+ "license": "MIT",
11
+ "keywords": ["coding-agents", "quality-gates", "backpressure", "hooks"],
12
+ "interface": {
13
+ "displayName": "Deterministic Gates",
14
+ "shortDescription": "Runs the gates of the repo on what each turn changed, and sends the agent back until they pass.",
15
+ "longDescription": "Deterministic backpressure for coding agents. At the end of each turn, the gates of the repo run on the files the turn changed: a linter, a type checker, the related tests, a dead-code finder. A gate is a tool, never a model. If a gate fails, the agent is sent back once with the report. The gates live in .gates.json; the catalog of the plugin lists the ones worth copying.",
16
+ "developerName": "Pierre Moati",
17
+ "category": "Developer Tools",
18
+ "websiteURL": "https://github.com/mopi1402/tayomi-deterministic-gates"
19
+ }
20
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pierre Moati
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,128 @@
1
- # Temporary Holding Version
1
+ <p align="center"> <img src="docs/images/tayomi-deterministic-gates.png" alt="deterministic-gates" width="220"/> </p>
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # deterministic-gates
4
+
5
+ Deterministic backpressure for coding agents. At the end of each turn, the gates run on what the agent changed. A gate is a tool, never a model: a linter, a type checker, the related tests, a dead-code finder. If a gate fails, the agent is sent back with the report until it fixes the gate or says why it leaves it, while the context is fresh.
6
+
7
+ CI stays the authority for slow and full checks. The gates catch what the agent just wrote, so the review sees what slipped through.
8
+
9
+ ## Install
10
+
11
+ The engine works with any agent that speaks the hook protocol Claude Code and Codex share: one hook runs as a session starts, one as a prompt arrives, another as the agent stops. It needs Node 24.2 or later, has no runtime dependency, and does nothing outside git or in a repo with no gates file.
12
+
13
+ ### Claude Code
14
+
15
+ ```
16
+ /plugin marketplace add mopi1402/tayomi-deterministic-gates
17
+ /plugin install deterministic-gates@tayomi-deterministic-gates
18
+ ```
19
+
20
+ To enable it for one repo only, declare the marketplace and the plugin in that repo's `.claude/settings.json`:
21
+
22
+ ```json
23
+ {
24
+ "extraKnownMarketplaces": {
25
+ "tayomi-deterministic-gates": {
26
+ "source": { "source": "github", "repo": "mopi1402/tayomi-deterministic-gates" }
27
+ }
28
+ },
29
+ "enabledPlugins": { "deterministic-gates@tayomi-deterministic-gates": true }
30
+ }
31
+ ```
32
+
33
+ ### Codex
34
+
35
+ ```
36
+ codex plugin marketplace add mopi1402/tayomi-deterministic-gates
37
+ codex plugin add deterministic-gates@tayomi-deterministic-gates
38
+ ```
39
+
40
+ Codex runs no hook you have not reviewed: in a session, open `/hooks` and trust the three hooks of the plugin. A plugin update that changes a script asks for a new review.
41
+
42
+ ## Configure the gates
43
+
44
+ The gates of a repo live in `.gates.json` at its root, committed. Each one names a command, and the files that make it run:
45
+
46
+ ```json
47
+ {
48
+ "gates": [
49
+ {
50
+ "name": "lint",
51
+ "severity": "error",
52
+ "files": "\\.(ts|tsx)$",
53
+ "run": ["eslint", "--max-warnings", "0", "--no-warn-ignored", "{files}"]
54
+ }
55
+ ]
56
+ }
57
+ ```
58
+
59
+ | Field | Meaning |
60
+ | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
+ | `name` | Lowercase words joined by hyphens. |
62
+ | `severity` | `error` sends the agent back. `off` never runs. There is no warning, because nobody acts on one. |
63
+ | `files` | A regular expression on the repo-relative paths. The gate runs when the turn changed a match, a deleted file included. |
64
+ | `run` | The command, then its arguments. See below. |
65
+ | `compare` | `turn-start`: the command runs on the whole project as the turn starts, and only the lines of output the turn added fail the gate. For a tool that exits with 0 when it finds problems. |
66
+ | `ignoreLines` | A regular expression for lines of output that never count as new, such as a header with a total. |
67
+ | `timeoutSeconds` | Less time for this gate than the check has, never more. |
68
+
69
+ The first word of `run` is looked up in this order, so a gate can run Node, Python, Go or any other program:
70
+
71
+ 1. a script of this engine under `{engine}/`, such as `{engine}/src/helpers/new-clones.ts`;
72
+ 2. a script of the repo by its path, run on the interpreter of its extension: `.ts`, `.js` and `.mjs` on Node, `.py` on `python3`;
73
+ 3. a package of the repo's `node_modules`, run through its command, such as `eslint`;
74
+ 4. a program: by its path in the repo, such as `.venv/bin/ruff`, or by its name on the `PATH`, such as `go`, `gofmt` or `ruff`.
75
+
76
+ A tool the repo pins beats one on the `PATH`, so write the pinned form when there is one, such as `["uv", "run", "ruff", ...]`. A gate whose program is not installed never runs, and the other gates still do. As a prompt arrives, the agent is asked to install the tool and you are told which gates are off. It is asked once, and again only when the list of missing tools changes or the session starts again.
77
+
78
+ A gate whose entry is wrong, such as with an unknown field, is left out and named in the summary, and the other gates still run.
79
+
80
+ Next to `gates`, `maxTimeoutSeconds` is the time the gates of a check have, all together: 45 seconds by default. They start at once, and a gate still running then is stopped. It shows out of time, neither green nor red, and never sends the agent back, since nobody knows what it would have said. A slower check belongs in CI.
81
+
82
+ The summary names the six slowest green gates and counts the rest, as in `... +5`. Set `"showAllPasses": true` next to `gates` to name every one of them, six to a line. A value in `.gates.local.json` wins, so each developer can choose for themselves.
83
+
84
+ Next to `gates`, `maxSendBacks` is the most times a turn sends the agent back: 5 by default, and 0 never sends it back. Past it, the agent hands back and the summary says why. A value in `.gates.local.json` wins.
85
+
86
+ In the arguments, `{files}` expands to the changed files the gate looks at, and `{turn}` to the commit that holds the tree as the turn started.
87
+
88
+ ## Pick gates from the catalog
89
+
90
+ `catalog/` lists the gates worth copying into a repo, one file per technology, each entry with what the gate catches and the tools it requires; `catalog/index.html` is the same content as a page. The engine reads only `.gates.json`: copy a gate there, install what it requires, and adapt its `files` to the layout of the repo.
91
+
92
+ ## Override the gates for yourself
93
+
94
+ Each developer can add `.gates.local.json` next to `.gates.json`, and add it to `.gitignore`. A local entry with the name of a shared gate changes only the fields it gives, such as `{ "name": "typecheck", "timeoutSeconds": 20 }`. Any other local entry adds a gate.
95
+
96
+ ## How a turn is checked
97
+
98
+ 1. When a prompt arrives, the engine records the working tree as a commit that no branch points to, without touching the index, the files or any branch.
99
+ 2. When the agent stops, it records the tree again and lists the files the turn changed.
100
+ 3. Each gate with a matching file runs, all of them in parallel, with the gates as the turn started.
101
+ 4. If a gate fails, the agent is sent back with the reports, told to fix the code and never the check. Each stop is checked again from the turn start, so a fix that breaks another gate is caught. The agent is sent back until each red gate is fixed or waived, up to `maxSendBacks` times a turn.
102
+ 5. The agent may leave a gate red only when it cannot be fixed, when fixing it goes against what you asked, or when you have to settle a question first. It then writes, in its last message, one line per gate: `[deterministic-gates:<gate>]: waive "<reason>"`. Codex hides the line, as markdown does, and Claude Code shows it. The summary shows the gate in orange, with the reason under it. A waiver lasts the turn, and falls when the report of its gate changes. `check`, and so CI, never reads one: a gate that fails there fails.
103
+
104
+ [docs/turn.md](docs/turn.md) draws the rest: where the start comes from, how a compared gate reads its report, what the engine keeps between turns, and what the lock covers.
105
+
106
+ To check the whole repo, as before adopting the gates or in a pre-push hook:
107
+
108
+ ```
109
+ node src/cli.ts check
110
+ ```
111
+
112
+ Every gate runs on every file that matches, and the command exits with 1 when a gate fails.
113
+
114
+ ## Develop
115
+
116
+ ```
117
+ pnpm install --frozen-lockfile
118
+ pnpm check
119
+ pnpm integration
120
+ ```
121
+
122
+ This repo runs under its own gates, in its `.gates.json`, and no gate runs a whole test suite at the end of a turn: that is what `pnpm check`, `pnpm integration` and `node src/cli.ts check` are for.
123
+
124
+ `integration/` holds a sample project per catalog. The integration tests play an agent's turn on each, with no agent and no model: a clean change passes every gate, and each gate catches the fault written for it. To add a gate to a catalog, edit its file, write its fault, and run `pnpm catalog` to regenerate the page.
125
+
126
+ ## License
127
+
128
+ MIT
@@ -0,0 +1,92 @@
1
+ {
2
+ "title": "Go",
3
+ "description": "Gates for a Go module. The toolchain comes from the PATH. The first build of a cold cache is slow, which is why these gates allow 60 seconds.",
4
+ "gates": [
5
+ {
6
+ "description": "Builds every package of the module.",
7
+ "requires": [
8
+ {
9
+ "tool": "go",
10
+ "install": "https://go.dev/doc/install"
11
+ }
12
+ ],
13
+ "gate": {
14
+ "name": "build",
15
+ "severity": "error",
16
+ "files": "(\\.go|(^|/)go\\.(mod|sum))$",
17
+ "run": ["go", "build", "./..."]
18
+ }
19
+ },
20
+ {
21
+ "description": "Runs go vet on every package: the suspicious constructs the compiler accepts.",
22
+ "requires": [
23
+ {
24
+ "tool": "go",
25
+ "install": "https://go.dev/doc/install"
26
+ }
27
+ ],
28
+ "gate": {
29
+ "name": "vet",
30
+ "severity": "error",
31
+ "files": "(\\.go|(^|/)go\\.(mod|sum))$",
32
+ "run": ["go", "vet", "./..."]
33
+ }
34
+ },
35
+ {
36
+ "description": "Fails on the files the turn left unformatted. gofmt -l lists them and exits with 0, so the gate compares its list with the one as the turn started.",
37
+ "requires": [
38
+ {
39
+ "tool": "gofmt",
40
+ "install": "comes with Go: https://go.dev/doc/install"
41
+ }
42
+ ],
43
+ "gate": {
44
+ "name": "format",
45
+ "severity": "error",
46
+ "files": "\\.go$",
47
+ "run": ["gofmt", "-l", "."],
48
+ "compare": "turn-start"
49
+ }
50
+ },
51
+ {
52
+ "description": "Runs the tests of every package. Go caches the result of a package that did not change, so only the packages the turn touched run again.",
53
+ "requires": [
54
+ {
55
+ "tool": "go",
56
+ "install": "https://go.dev/doc/install"
57
+ }
58
+ ],
59
+ "gate": {
60
+ "name": "test",
61
+ "severity": "error",
62
+ "files": "(\\.go|(^|/)go\\.(mod|sum))$",
63
+ "run": ["go", "test", "./..."]
64
+ }
65
+ },
66
+ {
67
+ "description": "Lints with golangci-lint, and reports only the issues created since the turn started (--new-from-rev).",
68
+ "requires": [
69
+ {
70
+ "tool": "golangci-lint",
71
+ "install": "https://golangci-lint.run/docs/welcome/install/"
72
+ }
73
+ ],
74
+ "gate": {
75
+ "name": "lint",
76
+ "severity": "error",
77
+ "files": "\\.go$",
78
+ "run": ["golangci-lint", "run", "--new-from-rev", "{turn}"]
79
+ }
80
+ },
81
+ {
82
+ "description": "Fails on the rule suppressions the turn added, never on the ones already there: nolint and go:nolint. The cheapest green is to silence the rule, and this is the gate that refuses it.",
83
+ "requires": [],
84
+ "gate": {
85
+ "name": "no-new-suppressions",
86
+ "severity": "error",
87
+ "files": "\\.go$",
88
+ "run": ["{engine}/src/helpers/new-suppressions.ts", "{turn}", "{files}"]
89
+ }
90
+ }
91
+ ]
92
+ }