@sabaiway/agent-workflow-kit 20.1.0 → 20.2.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,29 @@ Semantically versioned ([semver](https://semver.org)), newest first. The `versio
4
4
  is the current release. `upgrade` mode reads a project's `docs/ai/.workflow-version` and applies
5
5
  every `migrations/<version>-<slug>.md` newer than it, in semver order.
6
6
 
7
+ ## 20.2.0 — the project rules check is offered as a gate of every project (AD-219)
8
+
9
+ **Your project's rules can now stop a red gate run, not only a commit.** The check that each rules theme's effective
10
+ file still matches the record it was built from, `project-rules/rules-cli.mjs --check`, joins the kit checkers that
11
+ `checker-gates.mjs` and the upgrade's `tier` step offer as gates of your project:
12
+
13
+ - `node <kit>/tools/checker-gates.mjs --cwd <project>` previews a fifth line, `project-rules`, after `spec-coverage`,
14
+ offered on every deployment, one with no rules theme laid yet included; an offered line is followed by its entry,
15
+ `node "<kit>/tools/project-rules/rules-cli.mjs" --check`, and `--apply` (or the `tier` yes) writes it add-only, as
16
+ for the other four.
17
+ - The gate passes over a theme the check answers `current` or `absent` and stops on one it answers `drift` or `record`,
18
+ naming the remedy `/agent-workflow-kit upgrade`; unlike the commit hook's rules line, it waits for no theme to be
19
+ `current` first.
20
+ - A decline of `checker-gates-declared` you recorded earlier stays current and covers the new candidate; the preview
21
+ above and `--apply --only project-rules` still reach it.
22
+ - If your `docs/ai/gates.json` already declares a `project-rules` gate with `--cwd .` (the form `/agent-workflow-kit
23
+ rules` runs), the preview prints `project-rules: id-taken` and, once no other candidate is offered, every upgrade reads its
24
+ `checker-gates-declared` item as undecidable. Drop `--cwd`
25
+ and its value from that gate's cmd: the gate runner already runs every cmd from the project root, and the preview
26
+ then prints `project-rules: declared`.
27
+
28
+ Contracts: checker-gates revision 2, project-rules revision 11.
29
+
7
30
  ## 20.1.0 — the size check leaves the kit's own folder `scripts/agent-workflow` alone (AD-218)
8
31
 
9
32
  **A coming kit release can move its scripts into one folder of your project without stopping a single commit.** The
package/SKILL.md CHANGED
@@ -3,7 +3,7 @@ name: agent-workflow-kit
3
3
  description: Deploy or upgrade a portable AI-agent memory-and-workflow system in any project. Use when the user wants to bootstrap `docs/ai/` + an entry-point `AGENTS.md` (+ `CLAUDE.md` alias) + cap/archive/index enforcement in a new or existing repo, set up the Memory Map and session protocols, install the docs-rotation pre-commit hook, or run `/agent-workflow-kit` / `/agent-workflow-kit upgrade`. Triggers on phrases like "set up the memory system", "deploy the AI workflow here", "bootstrap docs/ai", "upgrade the workflow". New to the epic, story and task tier? Run `/agent-workflow-kit tier`. A typed decision with a confidence from Jev? Run `/agent-workflow-kit jev`.
4
4
  disable-model-invocation: true
5
5
  metadata:
6
- version: '20.1.0'
6
+ version: '20.2.0'
7
7
  ---
8
8
 
9
9
  # agent-workflow-kit
package/capability.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "schema": 1,
4
4
  "name": "agent-workflow-kit",
5
5
  "kind": "composition-root",
6
- "version": "20.1.0",
6
+ "version": "20.2.0",
7
7
  "provides": [],
8
8
  "roles": {},
9
9
  "detect": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sabaiway/agent-workflow-kit",
3
- "version": "20.1.0",
3
+ "version": "20.2.0",
4
4
  "description": "Portable, cross-agent memory & workflow for AI coding agents — Claude Code, Codex, Cursor, Devin Desktop. One command deploys an AGENTS.md entry point + docs/ai context with cap/archive/index enforcement into any repo.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -23,7 +23,7 @@ Declared gates can also be **auto-approved** (no permission prompt on a byte-exa
23
23
 
24
24
  **Candidate line — the source-size gate (opt-in, never auto-seeded).** A project declaring the source-size practice (`docs/ai/source-size.json`) can declare its checker as one more gate, offered **only over a MINTED schema-2 practice** — an absent config has nothing to offer, an authored-but-unminted one is withheld by name rather than declaring a gate that would refuse, and a minted schema-1 one is withheld naming its `--write-baseline` move. Adoption is ONE consented verb, `node ${CLAUDE_SKILL_DIR}/tools/source-size-check.mjs --adopt --reason "<text>" [--cwd <project>]`: it mints the record and declares this gate and NOTHING else, is idempotent once adopted, and with no config refuses with the exact file to author. The advisor surfaces it as the `source-size` item, reading a declared cmd as one of THREE claims rather than a yes/no — **canonical** (this copy — answered), **tool-elsewhere** (the same shape resolving to a DIFFERENT real copy — a vendored deployment, converging on a `source-size-copy` acknowledgement, never on `--adopt`, which would collide on the declared id), **not-the-tool** (a gate merely CARRYING the id is a squatter: rename it, or repoint its cmd at this `--check` form) — in that precedence. An unminted record stays the same attention outcome for either copy, and no acknowledgement silences it.
25
25
 
26
- **Candidate lines — the kit's own checkers (opt-in, one consented verb).** `control-bytes`, `plan-shape`, `spec-check` and `spec-coverage` can each be declared as a gate of your project: `node ${CLAUDE_SKILL_DIR}/tools/checker-gates.mjs --cwd <project>` previews them and writes nothing. Each is offered only over a state where its checker runs by design: `control-bytes` over a `.git` directory or gitfile at the project root, `plan-shape` on any deployment, `spec-check` over a regular `docs/ai/specs/index.md`, `spec-coverage` over a regular `docs/ai/spec-coverage.json` beside that store root. An offered checker prints its paste-ready entry line; the upgrade's `tier` ask writes the offered entries on your explicit yes — add-only, placed by the rule below, not stamp-gated, after the preview printed the disclosure below. An entry it wrote is removed by hand from `docs/ai/gates.json`: the verb never un-declares. `epic-shape` and `queue-audit` take a project operand and `doc-parity` checks only the kit's own package, so none of them is offered.
26
+ **Candidate lines — the kit's own checkers (opt-in, one consented verb).** `control-bytes`, `plan-shape`, `spec-check`, `spec-coverage` and `project-rules` can each be declared as a gate of your project: `node ${CLAUDE_SKILL_DIR}/tools/checker-gates.mjs --cwd <project>` previews them and writes nothing. Each is offered only over a state where its checker runs by design: `control-bytes` over a `.git` directory or gitfile at the project root, `plan-shape` and `project-rules` on any deployment, `spec-check` over a regular `docs/ai/specs/index.md`, `spec-coverage` over a regular `docs/ai/spec-coverage.json` beside that store root. An offered checker prints its paste-ready entry line; the upgrade's `tier` ask writes the offered entries on your explicit yes — add-only, placed by the rule below, not stamp-gated, after the preview printed the disclosure below. An entry it wrote is removed by hand from `docs/ai/gates.json`: the verb never un-declares. `epic-shape` and `queue-audit` take a project operand and `doc-parity` checks only the kit's own package, so none of them is offered.
27
27
 
28
28
  **Consent-gated filling — the init preview, not part of the runner (D9).** The template `gates.json` is seeded EMPTY; FILLING it is a consented preview at init (`node ${CLAUDE_SKILL_DIR}/tools/gates-init.mjs --cwd <project>`, dry-run by default — prints the derived entries and **writes NOTHING**; `--apply [--only <id>]…` writes exactly the consented entries on your explicit yes; add-only, id collisions refused). **Placement, not blind appending:** a consented entry lands at the END, except that a non-checker entry goes **BEFORE** a trailing canonical coverage checker — that checker must stay last, so appending after it would write a declaration the validator refuses, leaving a hand edit as the only lane on any final-capable declaration. Existing entries are never modified, removed or reordered. The offer derivation is **closed-world** (AD-052): only a terminating-class script NAME (test / lint / type-check / build — never dev/watch/serve, never a write-mode or release/publish/deploy variant) whose BODY is a member of the literal runner allowlist is offered — membership, never blocklist screening: the worst case is a legit command not offered, never a dangerous one offered. The offered cmd is the uniform hook-free **`COREPACK_ENABLE_NETWORK=0 <pm> exec -- <allowlisted-body>`** — `exec` runs a command, not a named script, so no pre/post hook can fire (npm/pnpm/yarn alike; never `<pm> run <name>`, which re-exposes hooks), and the Corepack env prefix blocks a hostile `packageManager` pin from fetching the PM binary before exec. npm is pinned `--offline --script-shell /bin/sh`; pnpm/yarn refuse an absent runner without network (a user-installed cache/global/PATH runner executing is user machine state — part of the disclosed residual); a family without a verified fail-closed exec contract is WITHHELD loudly. A screened-out body is always named — and when nothing but kit checkers remains, the preview says so in plain words: the offer carries **no project-verification gate at all**. **Disclose before the yes** (the preview prints it): gates.json is a PRIVILEGED file — the wired hook auto-approves byte-exact declared commands — and a script gate runs project-controlled tooling the preview does not sandbox (safe-by-construction = the OFFER DERIVATION). At upgrade, step 3's run-list changes an existing gates.json only through the consented legacy migration and, under the `tier` ask, `tools/checker-gates.mjs` (`${CLAUDE_SKILL_DIR}/references/modes/upgrade.md`).
29
29
 
@@ -4,12 +4,14 @@
4
4
  // (part checker-gates-read). No CLI (refuseDirectRun); nothing here writes.
5
5
  import { lstatSync } from 'node:fs';
6
6
  import { dirname, join, resolve } from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
7
8
  import { CHECKER_CLAIM, classifyCheckerClaim, dqUnsafePath } from './checker-claim.mjs';
8
9
  import { refuseDirectRun } from './direct-run.mjs';
9
10
  import { readRegularFileNoFollow } from './fs-read-nofollow.mjs';
10
11
  import { GATES_REL, KIT_CHECKER_CLAIMS, coverageDeclarationDefects, validateDeclaration } from './gates-declaration.mjs';
11
12
  import { escapeForLine, isLineUnsafe } from './source-size-core.mjs';
12
13
 
14
+ const KIT_TOOLS_DIR = dirname(fileURLToPath(import.meta.url));
13
15
  const DEPLOYMENT_CHAIN = ['.', 'docs', 'docs/ai'];
14
16
  const NOT_APPLICABLE_CODES = new Set(['ENOENT', 'ENOTDIR']);
15
17
  const OK = 'ok';
@@ -78,6 +80,7 @@ export const CHECKER_GATE_CANDIDATES = Object.freeze([
78
80
  'No work without a specification — every in-scope tool is governed by a contract, or named in the shrink-only debt',
79
81
  requiring(COVERAGE_SCOPE, STORE_ROOT),
80
82
  ),
83
+ candidate('project-rules', 'Project rules — each theme\'s effective file matches the record of what it was built from', requiring()),
81
84
  ]);
82
85
 
83
86
  const claimOf = (id) => KIT_CHECKER_CLAIMS.find((claim) => claim.id === id);
@@ -119,7 +122,7 @@ const claimState = ({ id, screen }, gates, root) => {
119
122
  return taken ? { state: CANDIDATE_STATES.idTaken, detail: taken.cmd } : {};
120
123
  };
121
124
 
122
- const toolPathOf = ({ basename, screen }, deps) => join(deps.kitToolsDir ?? dirname(screen.canonical), basename);
125
+ const toolPathOf = ({ path }, deps) => join(deps.kitToolsDir ?? KIT_TOOLS_DIR, path);
123
126
  const isUnrenderable = (path) => dqUnsafePath(path) || isLineUnsafe(path);
124
127
 
125
128
  const judgeCandidate = ({ id, title, probe }, rendered, gates, root, deps) => {
@@ -225,16 +225,20 @@ export const isReviewDependentGate = (gate, projectDir) =>
225
225
  // "does this declaration verify the PROJECT?" through the review-dependent predicate alone read a
226
226
  // matrix of nothing but that gate as project verification. Three surfaces asked it, each knowing a
227
227
  // different half; this is the one home, so a future kit checker is added once.
228
- // KIT_CHECKER_CLAIMS is the one statement of the four declarable kit checkers' basenames, tails and
228
+ // KIT_CHECKER_CLAIMS is the one statement of the declarable kit checkers' basenames, paths, tails and
229
229
  // canonical paths (docs/ai/specs/kit/tier/checker-gates/, part checker-claim-tail).
230
- const kitCheckerClaim = (id, basename, tail) => Object.freeze({
231
- id, basename, tail, screen: checkerClaimTool(basename, fileURLToPath(new URL(`./${basename}`, import.meta.url)), tail),
232
- });
230
+ const kitCheckerClaim = (id, path, tail) => {
231
+ const basename = path.split('/').at(-1);
232
+ return Object.freeze({
233
+ id, basename, path, tail, screen: checkerClaimTool(basename, fileURLToPath(new URL(`./${path}`, import.meta.url)), tail),
234
+ });
235
+ };
233
236
  export const KIT_CHECKER_CLAIMS = Object.freeze([
234
237
  kitCheckerClaim('control-bytes', 'control-bytes.mjs', '--check'),
235
238
  kitCheckerClaim('plan-shape', 'plan-shape-cli.mjs', '--check --in-flight'),
236
239
  kitCheckerClaim('spec-check', 'spec-check-cli.mjs', '--all'),
237
240
  kitCheckerClaim('spec-coverage', 'spec-coverage-cli.mjs', '--check'),
241
+ kitCheckerClaim('project-rules', 'project-rules/rules-cli.mjs', '--check'),
238
242
  ]);
239
243
 
240
244
  export const isKitOwnedCheckerGate = (gate, projectDir) =>