@devrik-tools/claude-gates 0.7.0 → 0.7.1

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.
Files changed (44) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/README.es.md +6 -0
  3. package/README.md +5 -0
  4. package/package.json +1 -1
  5. package/plugins/gates/.claude-plugin/plugin.json +1 -1
  6. package/plugins/gates/hooks/gates/atomic-commit/index.mjs +2 -2
  7. package/plugins/gates/hooks/gates/audit-before-build/index.mjs +2 -2
  8. package/plugins/gates/hooks/gates/autonomous-mode/index.mjs +1 -1
  9. package/plugins/gates/hooks/gates/bash-commands/index.mjs +3 -3
  10. package/plugins/gates/hooks/gates/block-remote-publish/index.mjs +2 -2
  11. package/plugins/gates/hooks/gates/brief-approved/index.mjs +1 -1
  12. package/plugins/gates/hooks/gates/brief-before-delegate/index.mjs +3 -3
  13. package/plugins/gates/hooks/gates/circuit-breaker/index.mjs +1 -1
  14. package/plugins/gates/hooks/gates/dependency-skills/index.mjs +1 -1
  15. package/plugins/gates/hooks/gates/diagnosis-before-patch/index.mjs +1 -1
  16. package/plugins/gates/hooks/gates/feature-catalog/index.mjs +2 -2
  17. package/plugins/gates/hooks/gates/force-parallel/index.mjs +1 -1
  18. package/plugins/gates/hooks/gates/forge-flow/index.mjs +2 -2
  19. package/plugins/gates/hooks/gates/implementation-pipeline/index.mjs +1 -1
  20. package/plugins/gates/hooks/gates/intent-flow/index.mjs +3 -3
  21. package/plugins/gates/hooks/gates/lint-commit/index.mjs +2 -2
  22. package/plugins/gates/hooks/gates/mandatory-flow/index.mjs +3 -3
  23. package/plugins/gates/hooks/gates/neutral-spanish/index.mjs +1 -1
  24. package/plugins/gates/hooks/gates/never-assume/index.mjs +1 -1
  25. package/plugins/gates/hooks/gates/no-blocking/index.mjs +1 -1
  26. package/plugins/gates/hooks/gates/no-coauthor/index.mjs +1 -1
  27. package/plugins/gates/hooks/gates/no-lint-suppression/index.mjs +1 -1
  28. package/plugins/gates/hooks/gates/no-memory-dependency/index.mjs +1 -1
  29. package/plugins/gates/hooks/gates/no-reconfirm/index.mjs +1 -1
  30. package/plugins/gates/hooks/gates/protected-paths/index.mjs +2 -2
  31. package/plugins/gates/hooks/gates/recurrence-lock/index.mjs +1 -1
  32. package/plugins/gates/hooks/gates/reuse-before-build/index.mjs +2 -2
  33. package/plugins/gates/hooks/gates/risk-level/index.mjs +3 -3
  34. package/plugins/gates/hooks/gates/root-cause-first/index.mjs +1 -1
  35. package/plugins/gates/hooks/gates/root-whitelist/index.mjs +1 -1
  36. package/plugins/gates/hooks/gates/rule-skill-autodiscovery/index.mjs +2 -2
  37. package/plugins/gates/hooks/gates/sdd-specs/index.mjs +3 -3
  38. package/plugins/gates/hooks/gates/staged-lint/index.mjs +2 -2
  39. package/plugins/gates/hooks/gates/stop-pending/index.mjs +1 -2
  40. package/plugins/gates/hooks/gates/test-after-implementation/index.mjs +1 -1
  41. package/plugins/gates/hooks/gates/test-matrix/index.mjs +1 -1
  42. package/plugins/gates/hooks/gates/tool-map/index.mjs +1 -1
  43. package/plugins/gates/hooks/lib/hook-io.mjs +1 -1
  44. package/plugins/tasks/.claude-plugin/plugin.json +1 -1
@@ -11,13 +11,13 @@
11
11
  "name": "gates",
12
12
  "source": "./plugins/gates",
13
13
  "description": "PreToolUse gates: destructive-command blocks, protected paths, delegation/spec/quality rules, tool-discovery and forge-pipeline enforcement. Which gates run is decided by .ai/config.json (project) or ~/.claude/claude-gates/config.json (global).",
14
- "version": "0.7.0"
14
+ "version": "0.7.1"
15
15
  },
16
16
  {
17
17
  "name": "tasks",
18
18
  "source": "./plugins/tasks",
19
19
  "description": "Deterministic task tracking: the model registers tasks via the CLI, a UserPromptSubmit hook reminds of open tasks every few messages, and a SessionStart hook lists active tasks when a session opens.",
20
- "version": "0.7.0"
20
+ "version": "0.7.1"
21
21
  }
22
22
  ]
23
23
  }
package/README.es.md CHANGED
@@ -56,6 +56,12 @@ Si algún gate bloquea, la herramienta no se ejecuta.
56
56
  - **WARN**: la acción necesita criterio → el gate inyecta un aviso y deja seguir.
57
57
  - **Silencio**: el caso común. Un gate no molesta si no hay nada que objetar.
58
58
 
59
+ Todo mensaje DENY/WARN lleva el prefijo `[configKey]` — el nombre exacto de la clave para
60
+ buscar (o apagar/ajustar) bajo `"gates"` en `.ai/config.json`, por ejemplo
61
+ `[blockPathsOutsideRootWhitelist] '...' no está en la whitelist.` significa que la
62
+ configuración es `blockPathsOutsideRootWhitelist` en la tabla de abajo, no otro nombre que
63
+ haya que adivinar o traducir desde un id corto de gate.
64
+
59
65
  Cada gate es **autocontenido** (solo Node built-ins, sin dependencias en tiempo de
60
66
  ejecución), así que funciona aunque instales uno suelto por fuera.
61
67
 
package/README.md CHANGED
@@ -55,6 +55,11 @@ If any gate blocks, the tool does not run.
55
55
  - **WARN**: the action needs judgment → the gate injects a note and lets it proceed.
56
56
  - **Silence**: the common path. A gate never nags when there is nothing to object to.
57
57
 
58
+ Every DENY/WARN message is prefixed `[configKey]` — the exact key name to look up (or turn
59
+ off/tune) under `"gates"` in `.ai/config.json`, e.g. `[blockPathsOutsideRootWhitelist] '...'
60
+ is not on the whitelist.` means the setting is `blockPathsOutsideRootWhitelist` in the table
61
+ below, not some other name you'd have to guess or map from a short gate id.
62
+
58
63
  Every gate is **self-contained** (Node built-ins only, no runtime dependencies), so it
59
64
  works even if you install one on its own.
60
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devrik-tools/claude-gates",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Installable, deterministic gates (hooks) for Claude Code: block destructive commands, protected paths, and enforce delegation/spec/quality rules. Configurable per project.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gates",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Deterministic gates for Claude Code: destructive-command blocks, protected paths, delegation briefs, spec-driven flow and session-start validation. Selection lives in config, not in code.",
5
5
  "author": {
6
6
  "name": "Devrik"
@@ -208,7 +208,7 @@ runGate(
208
208
 
209
209
  if (countedNatures.size > maxNatures) {
210
210
  deny(
211
- GATE_ID,
211
+ CONFIG_KEY,
212
212
  `This commit mixes ${countedNatures.size} kinds of change ` +
213
213
  `(${[...countedNatures].join(', ')}) — a commit should be one cohesive change ` +
214
214
  `(max ${maxNatures}). Split it: stage and commit one nature at a time (e.g. the ` +
@@ -219,7 +219,7 @@ runGate(
219
219
 
220
220
  if (counted.length > maxFiles) {
221
221
  deny(
222
- GATE_ID,
222
+ CONFIG_KEY,
223
223
  `This commit stages ${counted.length} reviewable files (max ${maxFiles}) — too large ` +
224
224
  `to review as one unit. Split it into smaller, cohesive commits (docs/assets/` +
225
225
  `generated files are not counted). Add "${escapeHatch}" for one deliberately broad commit.`,
@@ -53,7 +53,7 @@ function checkDelegation(toolInput) {
53
53
  if (AUDIT_EVIDENCE_PATTERN.test(prompt)) return;
54
54
 
55
55
  deny(
56
- GATE_ID,
56
+ CONFIG_KEY,
57
57
  'Delegating creation of a new script/checker/gate/hook/linter/tool without evidence of a prior audit. State what you searched and why no existing tool covers this (e.g. "audited and no existing tool...").',
58
58
  );
59
59
  }
@@ -84,7 +84,7 @@ function checkWrite(toolInput, parameters) {
84
84
  if (INLINE_JUSTIFICATION_PATTERN.test(content)) return;
85
85
 
86
86
  deny(
87
- GATE_ID,
87
+ CONFIG_KEY,
88
88
  `Creating a new executable tool at ${filePath} without a justification comment (e.g. "justification: ..."). Document why no existing tool covers this before building a new one.`,
89
89
  );
90
90
  }
@@ -45,6 +45,6 @@ runGate(
45
45
  },
46
46
  ({ toolName }) => {
47
47
  if (!toolInGroups(toolName, QUESTION_GROUPS)) return;
48
- deny(GATE_ID, DENY_MESSAGE);
48
+ deny(CONFIG_KEY, DENY_MESSAGE);
49
49
  },
50
50
  );
@@ -173,7 +173,7 @@ function checkDestructive(command, parameters) {
173
173
  : [entry, 'Destructive command is not allowed.'],
174
174
  );
175
175
  for (const [source, reason] of denyPairs) {
176
- if (compile(source).test(normalized)) deny(GATE_ID, reason);
176
+ if (compile(source).test(normalized)) deny(CONFIG_KEY, reason);
177
177
  }
178
178
 
179
179
  // rm -rf over a protected area: areas read from config at runtime, so editing
@@ -184,12 +184,12 @@ function checkDestructive(command, parameters) {
184
184
  rmRfAreas.length > 0 &&
185
185
  compile(rmRfSourceFrom(rmRfAreas)).test(command)
186
186
  ) {
187
- deny(GATE_ID, "'rm -rf' over a protected area is not allowed.");
187
+ deny(CONFIG_KEY, "'rm -rf' over a protected area is not allowed.");
188
188
  }
189
189
 
190
190
  if (parameters.embeddedInterpreterEnabled) {
191
191
  const reason = checkEmbeddedInterpreter(command);
192
- if (reason) deny(GATE_ID, reason);
192
+ if (reason) deny(CONFIG_KEY, reason);
193
193
  }
194
194
  }
195
195
 
@@ -131,9 +131,9 @@ runGate(
131
131
  for (const [source, reason] of parameters.publishRules) {
132
132
  const pattern = compile(source);
133
133
  if (isShell) {
134
- if (pattern.test(shellCommand)) deny(GATE_ID, reason);
134
+ if (pattern.test(shellCommand)) deny(CONFIG_KEY, reason);
135
135
  } else if (hasRealPublishIntent(command, pattern)) {
136
- deny(GATE_ID, reason);
136
+ deny(CONFIG_KEY, reason);
137
137
  }
138
138
  }
139
139
  },
@@ -203,7 +203,7 @@ runGate(
203
203
  if (unapproved.length === 0) return;
204
204
 
205
205
  deny(
206
- GATE_ID,
206
+ CONFIG_KEY,
207
207
  `This implementation delegation cites feature(s) [${unapproved.join(', ')}] ` +
208
208
  'whose brief/contract has no recorded approval. Paste the FULL brief into the ' +
209
209
  'chat, get an explicit confirmation from the user (not a vague "dale"/"sigamos" ' +
@@ -209,7 +209,7 @@ function denyTooShort(prompt) {
209
209
  const excerpt = prompt.slice(0, PROMPT_EXCERPT_LENGTH);
210
210
  const ellipsis = prompt.length > PROMPT_EXCERPT_LENGTH ? '…' : '';
211
211
  deny(
212
- GATE_ID,
212
+ CONFIG_KEY,
213
213
  `This delegation asks for implementation ("${excerpt}${ellipsis}") in a ${prompt.length}-character ` +
214
214
  'prompt — too short to carry a goal, steps and a done-when criterion. State what this aims to ' +
215
215
  'achieve, what concretely needs doing (as a list or steps), and how completion is verified, then ' +
@@ -222,7 +222,7 @@ function reportMissingSignals(missing) {
222
222
 
223
223
  if (missing.length < TOTAL_REQUIRED_SIGNALS) {
224
224
  warn(
225
- GATE_ID,
225
+ CONFIG_KEY,
226
226
  `This implementation delegation does not recognizably state: ${missing.join('; ')}. ` +
227
227
  'If it is already there under different wording, proceed — this is only a warning. ' +
228
228
  'Otherwise add it before the subagent starts blind.',
@@ -231,7 +231,7 @@ function reportMissingSignals(missing) {
231
231
  }
232
232
 
233
233
  deny(
234
- GATE_ID,
234
+ CONFIG_KEY,
235
235
  'This delegation asks for implementation but states neither as a list nor recognizable prose: ' +
236
236
  `${missing.join('; ')}. Add to the prompt: (1) the GOAL — what this aims to achieve; ` +
237
237
  '(2) the STEPS — concrete files/actions, as a list; (3) the CRITERION — how completion is ' +
@@ -448,7 +448,7 @@ function identityKey(signature) {
448
448
 
449
449
  function denyRepeatedAttempt(count) {
450
450
  deny(
451
- GATE_ID,
451
+ CONFIG_KEY,
452
452
  `This same task received ${count} consecutive attempts (same goal, same scope and the same files) ` +
453
453
  'in this session, regardless of which subagent_type carried it. STOP retrying and ASK THE USER ' +
454
454
  'for help now: state what you tried, what blocked it, and the specific decision or input you need ' +
@@ -112,7 +112,7 @@ runGate(
112
112
  if (unmatched.length === 0) return;
113
113
 
114
114
  deny(
115
- GATE_ID,
115
+ CONFIG_KEY,
116
116
  `New dependencies without a matching skill in ${parameters.projectSkillsDir}: ${unmatched.join(', ')}. ` +
117
117
  'Add a skill documenting how to use each (directory name matching or containing the ' +
118
118
  'package name), OR, if a dependency genuinely needs no skill, declare it in ' +
@@ -41,7 +41,7 @@ runGate(
41
41
  if (!touchesTimeout) return;
42
42
 
43
43
  warn(
44
- GATE_ID,
44
+ CONFIG_KEY,
45
45
  'Diagnosis before patch: you are adjusting a timeout/deadline/retry value. Before changing a value to fix a symptom ("X is slow/fails"), confirm you read the evidence that proves the cause (a log line from the failing provider/process, not a hypothesis). A timeout should measure inactivity, not total time: a process that is progressing should not be cut off.',
46
46
  );
47
47
  },
@@ -61,7 +61,7 @@ runGate(
61
61
  // Base, non-negotiable: `done` is never written directly to the catalog.
62
62
  if (DONE_STATUS_PATTERN.test(content)) {
63
63
  deny(
64
- GATE_ID,
64
+ CONFIG_KEY,
65
65
  `Writing 'status: done' directly to ${catalogFileName} is not allowed. ` +
66
66
  'Only a review/QA subagent or a validated automated process may close a feature.',
67
67
  );
@@ -74,7 +74,7 @@ runGate(
74
74
  .length;
75
75
  if (inProgressCount > maxInProgress) {
76
76
  deny(
77
- GATE_ID,
77
+ CONFIG_KEY,
78
78
  `${catalogFileName} would have ${inProgressCount} features 'in_progress'; ` +
79
79
  `the maximum allowed is ${maxInProgress}.`,
80
80
  );
@@ -122,7 +122,7 @@ runGate(
122
122
  if (nextCount < threshold) return;
123
123
 
124
124
  warn(
125
- GATE_ID,
125
+ CONFIG_KEY,
126
126
  WARN_MESSAGE.replace('{count}', String(nextCount))
127
127
  .replace(
128
128
  '{windowSeconds}',
@@ -121,11 +121,11 @@ runGate(
121
121
  const result = await forgeRunState(root, forgeDatabasePath);
122
122
 
123
123
  if (result.state === 'active') return; // pipeline is running → allow
124
- if (result.state === 'none') deny(GATE_ID, DENY_MESSAGE); // no run → block
124
+ if (result.state === 'none') deny(CONFIG_KEY, DENY_MESSAGE); // no run → block
125
125
  // state 'unknown': the DB could not be read. Allow so a broken lookup never freezes work,
126
126
  // but surface it loudly — a silent allow here would disable the enforcer without a trace.
127
127
  warn(
128
- GATE_ID,
128
+ CONFIG_KEY,
129
129
  `forge enforcement is degraded: the forge DB could not be read (${result.reason}). ` +
130
130
  'Allowing this action, but the pipeline is NOT being enforced. Check that forge is ' +
131
131
  `installed and ${forgeDatabasePath} is readable, or turn this gate off if intended.`,
@@ -175,7 +175,7 @@ runGate(
175
175
  const lines = missingStages.map((stage) => ` ${stage.line}`).join('\n');
176
176
 
177
177
  deny(
178
- GATE_ID,
178
+ CONFIG_KEY,
179
179
  `This delegation is going to build code but skips ${missingStages.length} pipeline ` +
180
180
  `stage(s). ${details} ${
181
181
  isHighRisk
@@ -181,7 +181,7 @@ function missingSignals(prompt) {
181
181
 
182
182
  function denyUnresolvedUnknown() {
183
183
  deny(
184
- GATE_ID,
184
+ CONFIG_KEY,
185
185
  'This request touches a high-impact signal (money/auth/persisted data/public contract/' +
186
186
  'irreversible/production) AND declares an unresolved UNKNOWN. Do not relaunch assuming an ' +
187
187
  'answer — ask the user what to decide about that UNKNOWN before delegating again.',
@@ -192,7 +192,7 @@ function denyTooShortForScopeList(prompt) {
192
192
  const excerpt = prompt.slice(0, PROMPT_EXCERPT_LENGTH);
193
193
  const ellipsis = prompt.length > PROMPT_EXCERPT_LENGTH ? '…' : '';
194
194
  deny(
195
- GATE_ID,
195
+ CONFIG_KEY,
196
196
  `This implementation request ("${excerpt}${ellipsis}") does not carry a scope list: missing IN ` +
197
197
  'SCOPE, OUT OF SCOPE and EDGE CASES. Add it to the prompt before relaunching.',
198
198
  );
@@ -200,7 +200,7 @@ function denyTooShortForScopeList(prompt) {
200
200
 
201
201
  function denyMissingSignals(missing) {
202
202
  deny(
203
- GATE_ID,
203
+ CONFIG_KEY,
204
204
  `This implementation request does not declare, in recognizable form: ${missing.join('; ')}. ` +
205
205
  'Add what is missing to the prompt before relaunching this delegation.',
206
206
  );
@@ -133,7 +133,7 @@ runGate(
133
133
  // timeout kill). A commit gate that cannot evaluate must not silently permit — deny
134
134
  // with the spawn error so the user can fix the environment, not guess.
135
135
  deny(
136
- GATE_ID,
136
+ CONFIG_KEY,
137
137
  `Could not run the lint command ("${lintCommand}"): ${result.error.message}. Fix ` +
138
138
  'the lint setup or set lintCommand/blockCommitWithFailingLint in .ai/config.json.',
139
139
  );
@@ -143,7 +143,7 @@ runGate(
143
143
  const combinedOutput =
144
144
  `${result.stdout ?? ''}\n${result.stderr ?? ''}`.trim();
145
145
  deny(
146
- GATE_ID,
146
+ CONFIG_KEY,
147
147
  `Lint failed (exit ${result.status}) — commit blocked until it passes:\n` +
148
148
  `${tailLines(combinedOutput, OUTPUT_TAIL_LINES)}`,
149
149
  );
@@ -125,7 +125,7 @@ function readSlug(pointerPath) {
125
125
  function checkLiveTask(pointerPath) {
126
126
  if (!existsSync(pointerPath)) {
127
127
  deny(
128
- GATE_ID,
128
+ CONFIG_KEY,
129
129
  `This delegation is going to implement, but there is no live task: ${pointerPath} ` +
130
130
  'does not exist. Start a task pointing to it before delegating, or declare ' +
131
131
  'LEVEL: QUESTION/MICRO if this is not implementation.',
@@ -135,7 +135,7 @@ function checkLiveTask(pointerPath) {
135
135
  const slug = readSlug(pointerPath);
136
136
  if (!slug) {
137
137
  deny(
138
- GATE_ID,
138
+ CONFIG_KEY,
139
139
  `${pointerPath} exists but is empty. An active-task pointer with no slug is not ` +
140
140
  'a live task. Write the task slug into it before delegating.',
141
141
  );
@@ -144,7 +144,7 @@ function checkLiveTask(pointerPath) {
144
144
  const taskDirectory = join(process.cwd(), '.ai', 'pipeline', slug);
145
145
  if (!hasTaskContract(taskDirectory)) {
146
146
  deny(
147
- GATE_ID,
147
+ CONFIG_KEY,
148
148
  `The active task '${slug}' has no contract on disk: none of ` +
149
149
  `${TASK_CONTRACT_FILES.join(', ')} exists under ${taskDirectory}. ` +
150
150
  'Write the contract before implementing.',
@@ -94,7 +94,7 @@ runGate(
94
94
 
95
95
  const unique = [...new Set(hits)].slice(0, MAX_REPORTED_MARKERS);
96
96
  deny(
97
- GATE_ID,
97
+ CONFIG_KEY,
98
98
  `Text being written contains regional Spanish markers: ${unique.join(', ')}. ` +
99
99
  'Rewrite in neutral Spanish before writing. If the regional wording is intentional ' +
100
100
  `(a literal quote, a test fixture, a captured log, a data sample), add the marker ` +
@@ -49,7 +49,7 @@ runGate(
49
49
  if (hits.length === 0) return;
50
50
 
51
51
  warn(
52
- GATE_ID,
52
+ CONFIG_KEY,
53
53
  `Content contains conjecture phrasing without stated verification: ${hits.join(', ')}. Verify before asserting instead of assuming.`,
54
54
  );
55
55
  },
@@ -153,7 +153,7 @@ runGate(
153
153
  for (const [source, reason] of blockingPairs) {
154
154
  if (compile(source).test(command)) {
155
155
  deny(
156
- GATE_ID,
156
+ CONFIG_KEY,
157
157
  `${reason} If this wait is genuinely justified, add "${marker} <concrete reason>" ` +
158
158
  'to the command and try again. A declared wait is a decision; a silent one is an oversight.',
159
159
  );
@@ -116,7 +116,7 @@ runGate(
116
116
  if (!match) return;
117
117
 
118
118
  deny(
119
- GATE_ID,
119
+ CONFIG_KEY,
120
120
  `This commit message carries an AI/agent attribution trailer (matched "${match}"). ` +
121
121
  'Remove it — no Co-Authored-By, no "Generated with", no session trailer. If this ' +
122
122
  `commit legitimately must keep a co-author (e.g. importing external history), add ` +
@@ -173,7 +173,7 @@ runGate(
173
173
  if (!offender) return;
174
174
 
175
175
  deny(
176
- GATE_ID,
176
+ CONFIG_KEY,
177
177
  `This write silences the linter/type-checker instead of fixing the code: "${offender}". ` +
178
178
  'Fix the underlying issue rather than turning the check off. If this is a genuine, ' +
179
179
  `documented false positive, put "${escapeHatch} <reason>" on the same line so the ` +
@@ -128,7 +128,7 @@ runGate(
128
128
 
129
129
  const quotedPhrases = phrases.map((phrase) => `"${phrase}"`).join(', ');
130
130
  deny(
131
- GATE_ID,
131
+ CONFIG_KEY,
132
132
  `This delegation depends on the subagent remembering something (${quotedPhrases}), but a ` +
133
133
  'fresh subagent has none of this conversation. Put the data IN the prompt, in a file it ' +
134
134
  'reads, a flag, or an already-persisted decision. If the phrase directs the subagent’s ' +
@@ -197,6 +197,6 @@ runGate(
197
197
  parameters.overlapThreshold,
198
198
  );
199
199
  if (notices.length === 0) return;
200
- warn(GATE_ID, notices.join('\n\n'));
200
+ warn(CONFIG_KEY, notices.join('\n\n'));
201
201
  },
202
202
  );
@@ -87,7 +87,7 @@ function checkWrite(toolInput, protectedPaths) {
87
87
  const target = writtenPathOf(toolInput);
88
88
  if (target && isProtectedPath(target, protectedPaths)) {
89
89
  deny(
90
- GATE_ID,
90
+ CONFIG_KEY,
91
91
  `Writing to '${target}' is not allowed: it matches a protected path (${protectedPaths.join(', ')}).`,
92
92
  );
93
93
  }
@@ -110,7 +110,7 @@ function checkShellCommand(toolInput, protectedPaths, mutatingCommands) {
110
110
 
111
111
  if (targetsProtected) {
112
112
  deny(
113
- GATE_ID,
113
+ CONFIG_KEY,
114
114
  `This command targets a protected path (${protectedPaths.join(', ')}) with a mutating operation. ` +
115
115
  'Reading (echo/cat/grep) is fine; modifying it is not.',
116
116
  );
@@ -84,7 +84,7 @@ runGate(
84
84
 
85
85
  const names = openRecurrences.map((entry) => entry.class).join(', ');
86
86
  deny(
87
- GATE_ID,
87
+ CONFIG_KEY,
88
88
  `Registered recurring issue classes are still open and at/above threshold: ${names}. Resolve or close them before proceeding.`,
89
89
  );
90
90
  },
@@ -224,7 +224,7 @@ function checkDelegation(toolInput, cwd, parameters) {
224
224
  const prompt = delegationPromptOf(toolInput);
225
225
  if (!isBuildIntent(prompt)) return;
226
226
  if (buildIsCleared(prompt, cwd, parameters, null)) return;
227
- deny(GATE_ID, DENY_MESSAGE);
227
+ deny(CONFIG_KEY, DENY_MESSAGE);
228
228
  }
229
229
 
230
230
  /** Write: block a new tool-like file that is not cleared by content, map, or an installed dep. */
@@ -237,7 +237,7 @@ function checkWrite(toolInput, cwd, parameters) {
237
237
  const content = writtenContentOf(toolInput);
238
238
  const toolBaseName = basename(filePath).replace(/\.[^.]+$/, '');
239
239
  if (buildIsCleared(content, cwd, parameters, toolBaseName)) return;
240
- deny(GATE_ID, DENY_MESSAGE);
240
+ deny(CONFIG_KEY, DENY_MESSAGE);
241
241
  }
242
242
 
243
243
  runGate(
@@ -191,7 +191,7 @@ function denyNoLevelDeclared(prompt) {
191
191
  const excerpt = prompt.slice(0, PROMPT_EXCERPT_LENGTH);
192
192
  const ellipsis = prompt.length > PROMPT_EXCERPT_LENGTH ? '…' : '';
193
193
  deny(
194
- GATE_ID,
194
+ CONFIG_KEY,
195
195
  `This implementation delegation ("${excerpt}${ellipsis}") does not declare its risk LEVEL. Add a ` +
196
196
  'line such as "LEVEL: STANDARD" (or QUESTION/MICRO/HIGH-RISK, whichever fits) before relaunching ' +
197
197
  'this delegation.',
@@ -200,7 +200,7 @@ function denyNoLevelDeclared(prompt) {
200
200
 
201
201
  function denyAmbiguousLevel(levels) {
202
202
  deny(
203
- GATE_ID,
203
+ CONFIG_KEY,
204
204
  `This delegation declares multiple different risk levels (${[...new Set(levels)].join(', ')}) — ` +
205
205
  'it is not clear which one governs this task. Declare a single, unambiguous LEVEL for this ' +
206
206
  'delegation (remove any decoy/reference mention of a different level) before relaunching.',
@@ -209,7 +209,7 @@ function denyAmbiguousLevel(levels) {
209
209
 
210
210
  function denyLevelContradictsSignal(level, signal) {
211
211
  deny(
212
- GATE_ID,
212
+ CONFIG_KEY,
213
213
  `This delegation declares LEVEL: ${level}, but the request touches the risk signal "${signal}" near ` +
214
214
  'an implementation verb (not quoted, not the topic of a documentary deliverable) — that requires ' +
215
215
  `LEVEL: HIGH-RISK, not ${level}. Raise the declaration to HIGH-RISK before relaunching.`,
@@ -43,7 +43,7 @@ runGate(
43
43
  if (!matched) return;
44
44
 
45
45
  deny(
46
- GATE_ID,
46
+ CONFIG_KEY,
47
47
  `Content matches a patch-without-diagnosis marker (${matched.source}). Identify and fix the root cause before patching; do not defer with a "fix later" marker.`,
48
48
  );
49
49
  },
@@ -205,7 +205,7 @@ runGate(
205
205
  filesWhitelist,
206
206
  foldersWhitelist,
207
207
  );
208
- if (reason) deny(GATE_ID, reason);
208
+ if (reason) deny(CONFIG_KEY, reason);
209
209
  }
210
210
  },
211
211
  );
@@ -163,7 +163,7 @@ runGate(
163
163
  if (configsTampered(before)) {
164
164
  revertConfigs(before);
165
165
  deny(
166
- GATE_ID,
166
+ CONFIG_KEY,
167
167
  `Discovered rule/skill script ${relative(projectRoot, script)} attempted to modify gate security configuration (.ai/config.json or the global config). The change was reverted and the action is blocked.`,
168
168
  );
169
169
  return;
@@ -171,7 +171,7 @@ runGate(
171
171
 
172
172
  if (failed) {
173
173
  deny(
174
- GATE_ID,
174
+ CONFIG_KEY,
175
175
  `Sub-gate failed: ${relative(projectRoot, script)}. Fix it before continuing.`,
176
176
  );
177
177
  return;
@@ -153,7 +153,7 @@ function denyIfAdvancedFeatureLacksContract(features, treeRoot) {
153
153
  if (!feature?.name || !ADVANCED_STATUSES.has(feature.status)) continue;
154
154
  if (contractExistsFor(treeRoot, feature.name)) continue;
155
155
  deny(
156
- GATE_ID,
156
+ CONFIG_KEY,
157
157
  `Feature '${feature.name}' is set to '${feature.status}' but has no non-empty ` +
158
158
  `contract (${CONTRACT_FILES.join(', ')}) under the discovered contract tree.`,
159
159
  );
@@ -171,7 +171,7 @@ function checkCatalogWrite(toolInput, catalogPath, treeRoot) {
171
171
  // still targets the catalog is suspicious on its own -- a spec_ready/done transition
172
172
  // hidden behind a malformed payload must not be silently allowed through.
173
173
  deny(
174
- GATE_ID,
174
+ CONFIG_KEY,
175
175
  `The write to ${CATALOG_FILE_NAME} does not parse as JSON. A catalog write that ` +
176
176
  'cannot be verified for the spec-contract invariant is not allowed; fix the JSON ' +
177
177
  'or write valid content.',
@@ -213,7 +213,7 @@ function checkDelegation(toolInput, treeRoot, exemptSubagents) {
213
213
  );
214
214
  if (missing.length === citedFeatures.length) {
215
215
  deny(
216
- GATE_ID,
216
+ CONFIG_KEY,
217
217
  `This implementation delegation cites feature(s) [${missing.join(', ')}] with no ` +
218
218
  `non-empty contract (${CONTRACT_FILES.join(', ')}) on disk. Write the contract ` +
219
219
  'before implementing.',
@@ -133,7 +133,7 @@ function runLintOverStaged(lintCommand, files, cwd, timeoutMs) {
133
133
  function denyIfLintFailed(result, lintCommand, escapeHatch) {
134
134
  if (result.error) {
135
135
  deny(
136
- GATE_ID,
136
+ CONFIG_KEY,
137
137
  `Could not run the lint command ("${lintCommand}") over the staged files: ` +
138
138
  `${result.error.message}. Fix the lint setup or set lintCommand/` +
139
139
  `${CONFIG_KEY} in .ai/config.json.`,
@@ -144,7 +144,7 @@ function denyIfLintFailed(result, lintCommand, escapeHatch) {
144
144
  `${result.stdout ?? ''}\n${result.stderr ?? ''}`.trim();
145
145
  const outputTail = tailLines(combinedOutput, OUTPUT_TAIL_LINES);
146
146
  deny(
147
- GATE_ID,
147
+ CONFIG_KEY,
148
148
  `The files you staged fail lint — commit blocked until your own changes are clean ` +
149
149
  `(the rest of the repo is not checked). Fix them, or add "${escapeHatch}" to the ` +
150
150
  `commit command for a deliberate exception:\n${outputTail}`,
@@ -50,7 +50,6 @@ import { dirname, join } from 'node:path';
50
50
  import { isGateEnabled, gateParameters } from '../../lib/config.mjs';
51
51
  import { readHookPayload } from '../../lib/hook-io.mjs';
52
52
 
53
- const GATE_ID = 'stop-pending';
54
53
  const CONFIG_KEY = 'blockStopWithPendingTasks';
55
54
 
56
55
  const PROJECT_ROOT_MARKERS = ['.git', '.ai'];
@@ -153,7 +152,7 @@ function main() {
153
152
  if (blockingTasks.length === 0) return allow();
154
153
 
155
154
  return block(
156
- `[${GATE_ID}] There are ${blockingTasks.length} pending task(s) still active for this ` +
155
+ `[${CONFIG_KEY}] There are ${blockingTasks.length} pending task(s) still active for this ` +
157
156
  `project:\n${describeTasks(blockingTasks)}\n` +
158
157
  'Close each before ending the turn: `task close <id> --evidence "..."` when done, ' +
159
158
  'or `task abandon <id> --reason "..."` when it will not be finished. A task left ' +
@@ -107,7 +107,7 @@ runGate(
107
107
  if (!pairedImplementationChanged) return;
108
108
 
109
109
  deny(
110
- GATE_ID,
110
+ CONFIG_KEY,
111
111
  `Creating test ${testFileName} after its paired implementation was already modified ` +
112
112
  '(uncommitted). Write the test before or alongside the implementation, not after — a ' +
113
113
  'test that passes the first time it runs proves nothing about the change. If this is a ' +
@@ -175,7 +175,7 @@ runGate(
175
175
 
176
176
  const lines = missing.map((entry) => ` ${entry.line}`).join('\n');
177
177
  deny(
178
- GATE_ID,
178
+ CONFIG_KEY,
179
179
  `Missing ${missing.length} test type(s) the requirement makes mandatory. Test types ` +
180
180
  'are chosen ACCORDING TO THE REQUIREMENT: E2E if it touches money/auth/persistence, ' +
181
181
  'visual/QA if it touches UI, and always unit or mutation. ' +
@@ -129,7 +129,7 @@ function recordTool(mapPath, normalizedPath, auditLine, toolMapFile) {
129
129
  );
130
130
  } catch (error) {
131
131
  warn(
132
- GATE_ID,
132
+ CONFIG_KEY,
133
133
  `Could not record this tool in ${toolMapFile}: ${error?.message ?? error}. ` +
134
134
  'The build proceeds, but the discovery was not remembered.',
135
135
  );
@@ -359,7 +359,7 @@ export async function runGate(gate, check) {
359
359
  });
360
360
  } catch (error) {
361
361
  deny(
362
- gate.id,
362
+ gate.configKey,
363
363
  `The gate failed to evaluate and blocks the action for safety: ${error?.message ?? error}.`,
364
364
  );
365
365
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tasks",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Deterministic task tracking for Claude Code: persists tasks the model registers via the CLI, reminds of open tasks on a message counter, and lists active tasks on session start.",
5
5
  "author": {
6
6
  "name": "Devrik"