@sabaiway/agent-workflow-kit 1.29.0 → 1.30.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 +57 -0
- package/README.md +2 -0
- package/SKILL.md +37 -3
- package/bridges/antigravity-cli-bridge/SKILL.md +1 -1
- package/bridges/antigravity-cli-bridge/bin/agy-review.sh +145 -4
- package/bridges/antigravity-cli-bridge/bin/agy-review.test.mjs +169 -1
- package/bridges/antigravity-cli-bridge/capability.json +3 -2
- package/bridges/codex-cli-bridge/SKILL.md +1 -1
- package/bridges/codex-cli-bridge/bin/codex-review.sh +120 -3
- package/bridges/codex-cli-bridge/bin/codex-review.test.mjs +132 -0
- package/bridges/codex-cli-bridge/capability.json +3 -2
- package/capability.json +1 -1
- package/package.json +1 -1
- package/references/templates/agent_rules.md +3 -2
- package/references/templates/handover.md +1 -0
- package/tools/commands.mjs +15 -1
- package/tools/detect-backends.mjs +2 -0
- package/tools/grounding.mjs +263 -0
- package/tools/procedures.mjs +50 -5
- package/tools/recipes.mjs +78 -12
- package/tools/review-state.mjs +395 -0
- package/tools/set-recipe.mjs +15 -5
|
@@ -52,7 +52,16 @@ Grounding:
|
|
|
52
52
|
Round-2 / resume:
|
|
53
53
|
(none — one-shot; a follow-up review is a fresh run)
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
Receipt:
|
|
56
|
+
side effect — a successful review appends one JSON receipt line to
|
|
57
|
+
<git dir>/agent-workflow-review-receipts.jsonl (AW_REVIEW_RECEIPTS overrides): fingerprint =
|
|
58
|
+
sha256 over the canonical uncommitted-state payload (staged diff + unstaged diff +
|
|
59
|
+
untracked-not-ignored contents — the review-payload domain) in code mode, the artifact-file
|
|
60
|
+
sha256 in plan mode; verdict parsed from the mandated literal verdict line (schema mode: the
|
|
61
|
+
verdict field); always fresh:true (one-shot) + grounded:true (native AGENTS.md auto-merge,
|
|
62
|
+
factsHash null); a write failure warns, never fails the review
|
|
63
|
+
|
|
64
|
+
Environment: CODEX_REVIEW_SCHEMA=1 (structured JSON findings), CODEX_HARD_TIMEOUT (seconds, default 1800), CODEX_PROBE=1 (throwaway probe only), AW_REVIEW_RECEIPTS (receipt file override).
|
|
56
65
|
Requires at run time: the codex CLI on PATH, a ChatGPT-subscription login, a git work tree with a root AGENTS.md (--help needs none of these).
|
|
57
66
|
HELP
|
|
58
67
|
exit 0
|
|
@@ -61,6 +70,10 @@ esac
|
|
|
61
70
|
|
|
62
71
|
DEFAULT_CODEX_MODEL="gpt-5.5"
|
|
63
72
|
DEFAULT_CODEX_EFFORT="xhigh"
|
|
73
|
+
# Review-receipt identity (AD-038). AW_BRIDGE_VERSION mirrors this bridge's SKILL.md/capability.json
|
|
74
|
+
# version (drift-guarded by codex-review.test.mjs against capability.json).
|
|
75
|
+
AW_RECEIPT_BACKEND="codex"
|
|
76
|
+
AW_BRIDGE_VERSION="2.2.0"
|
|
64
77
|
CODEX_MODEL="${CODEX_MODEL:-$DEFAULT_CODEX_MODEL}"
|
|
65
78
|
CODEX_EFFORT="${CODEX_EFFORT:-$DEFAULT_CODEX_EFFORT}"
|
|
66
79
|
# Generous hard cap for a slow xhigh review (subscription latency varies).
|
|
@@ -140,8 +153,10 @@ if [[ "${CODEX_REVIEW_SCHEMA:-}" == "1" ]]; then
|
|
|
140
153
|
OUTPUT_FORMAT_CODE="$_json_fmt"
|
|
141
154
|
OUTPUT_FORMAT_PLAN="$_json_fmt"
|
|
142
155
|
else
|
|
143
|
-
|
|
144
|
-
|
|
156
|
+
# The verdict line is machine-parsed into the review receipt (AD-038) — mandate ONE exact literal.
|
|
157
|
+
_verdict_fmt="End with EXACTLY ONE final verdict line in this literal, machine-parsed form (that word pair alone on the line, nothing else): 'Verdict: ship' or 'Verdict: revise' or 'Verdict: rethink'."
|
|
158
|
+
OUTPUT_FORMAT_CODE="Output findings ONLY, one per line, as: [blocker|major|minor|nit] — file:line — issue — suggested fix. ${_verdict_fmt}"
|
|
159
|
+
OUTPUT_FORMAT_PLAN="Output findings ONLY, one per line, as: [blocker|major|minor|nit] — location — issue — suggested change. ${_verdict_fmt}"
|
|
145
160
|
fi
|
|
146
161
|
|
|
147
162
|
# True (exit 0) when $1 looks BINARY: a NUL byte in the first 8 KiB (git's own
|
|
@@ -153,6 +168,81 @@ is_binary() {
|
|
|
153
168
|
[[ "${nul:-0}" -gt 0 ]]
|
|
154
169
|
}
|
|
155
170
|
|
|
171
|
+
# --- Review receipts (AD-038) — byte-identical in codex-review.sh and agy-review.sh ---------------
|
|
172
|
+
# sha256 hex of stdin. sha256sum, else shasum -a 256; neither → warn + fail (the caller records a
|
|
173
|
+
# null fingerprint — a null never satisfies the review-state checker, fail-safe direction).
|
|
174
|
+
sha256_stdin() {
|
|
175
|
+
if command -v sha256sum >/dev/null 2>&1; then sha256sum | awk '{print $1}'
|
|
176
|
+
elif command -v shasum >/dev/null 2>&1; then shasum -a 256 | awk '{print $1}'
|
|
177
|
+
else
|
|
178
|
+
echo "warning: no sha256sum/shasum on PATH — cannot compute the review fingerprint." >&2
|
|
179
|
+
return 1
|
|
180
|
+
fi
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
# The canonical uncommitted-state fingerprint payload (code mode). Domain == the review payload:
|
|
184
|
+
# tracked staged + unstaged changes + untracked-not-ignored file contents (binary/symlink/non-regular
|
|
185
|
+
# untracked paths ride as name-only notes, mirroring the assembled change set). The prose definition
|
|
186
|
+
# lives in capability.json roles.review.contract.receipt (both bridges, lockstep); the kit checker
|
|
187
|
+
# (tools/review-state.mjs) implements the SAME serialization in node — cross-checked by the kit's
|
|
188
|
+
# review-fingerprint-parity.test.mjs.
|
|
189
|
+
emit_fingerprint_payload() {
|
|
190
|
+
git diff --cached --no-ext-diff
|
|
191
|
+
git diff --no-ext-diff
|
|
192
|
+
local path
|
|
193
|
+
while IFS= read -r -d '' path; do
|
|
194
|
+
if [[ -L "$path" ]]; then
|
|
195
|
+
printf 'untracked-symlink:%s -> %s\n' "$path" "$(readlink -- "$path" 2>/dev/null || echo '?')"
|
|
196
|
+
elif [[ ! -f "$path" ]]; then
|
|
197
|
+
printf 'untracked-nonregular:%s\n' "$path"
|
|
198
|
+
elif is_binary "$path"; then
|
|
199
|
+
printf 'untracked-binary:%s\n' "$path"
|
|
200
|
+
else
|
|
201
|
+
printf 'untracked:%s\n' "$path"
|
|
202
|
+
cat -- "$path"
|
|
203
|
+
fi
|
|
204
|
+
done < <(git ls-files --others --exclude-standard -z)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
# sha256 of the canonical payload, emitted from the work-tree ROOT (a subdir invocation hashes the
|
|
208
|
+
# same bytes). Empty output on failure (no git tree / no sha256 tool) — recorded as null.
|
|
209
|
+
compute_tree_fingerprint() {
|
|
210
|
+
( cd "$(git rev-parse --show-toplevel)" && emit_fingerprint_payload ) | sha256_stdin
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
# JSON-encode a receipt scalar: empty → null, else a quoted string (every value comes from a closed
|
|
214
|
+
# vocabulary or a hex digest — no escaping needed by construction).
|
|
215
|
+
receipt_json_scalar() {
|
|
216
|
+
if [[ -z "${1:-}" ]]; then printf 'null'; else printf '"%s"' "$1"; fi
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
# write_review_receipt <artifact|""> <fresh: true|false> <fingerprint|""> <verdict> <grounded: true|false> <factsHash|"">
|
|
220
|
+
# Appends ONE receipt line (the AD-038 fixture shape) as a side effect of a SUCCESSFUL review —
|
|
221
|
+
# to $AW_REVIEW_RECEIPTS when set, else <git dir>/agent-workflow-review-receipts.jsonl (inside the
|
|
222
|
+
# git dir by construction, so it is never committable). Fail-safe: every failure here warns loudly
|
|
223
|
+
# and returns 0 — a missing receipt fails the kit's review-state CHECKER, never the review run.
|
|
224
|
+
write_review_receipt() {
|
|
225
|
+
local artifact="$1" fresh="$2" fingerprint="$3" verdict="$4" grounded="$5" facts_hash="$6"
|
|
226
|
+
local receipts="${AW_REVIEW_RECEIPTS:-}"
|
|
227
|
+
if [[ -z "$receipts" ]]; then
|
|
228
|
+
local receipt_git_dir
|
|
229
|
+
if ! receipt_git_dir="$(git rev-parse --absolute-git-dir 2>/dev/null)"; then
|
|
230
|
+
echo "warning: not inside a git work tree and AW_REVIEW_RECEIPTS is unset — skipping the review receipt." >&2
|
|
231
|
+
return 0
|
|
232
|
+
fi
|
|
233
|
+
receipts="$receipt_git_dir/agent-workflow-review-receipts.jsonl"
|
|
234
|
+
fi
|
|
235
|
+
local line
|
|
236
|
+
line="$(printf '{"schema":1,"artifact":%s,"fresh":%s,"fingerprint":%s,"backend":"%s","verdict":"%s","grounded":%s,"factsHash":%s,"wrapperVersion":"%s","timestamp":"%s"}' \
|
|
237
|
+
"$(receipt_json_scalar "$artifact")" "$fresh" "$(receipt_json_scalar "$fingerprint")" \
|
|
238
|
+
"$AW_RECEIPT_BACKEND" "$verdict" "$grounded" "$(receipt_json_scalar "$facts_hash")" \
|
|
239
|
+
"$AW_BRIDGE_VERSION" "$(date -u +%Y-%m-%dT%H:%M:%SZ)")"
|
|
240
|
+
if ! printf '%s\n' "$line" >>"$receipts" 2>/dev/null; then
|
|
241
|
+
echo "warning: could not append the review receipt to $receipts — the review itself succeeded;" >&2
|
|
242
|
+
echo " the review-state gate will read the current tree as un-receipted." >&2
|
|
243
|
+
fi
|
|
244
|
+
}
|
|
245
|
+
|
|
156
246
|
# Emit the full review surface to stdout: repo map, status, staged + unstaged
|
|
157
247
|
# diffs, and the CONTENTS of every untracked REGULAR file (NUL-safe iteration).
|
|
158
248
|
# Symlinks are shown as their target (never followed — no out-of-repo leak); other
|
|
@@ -191,6 +281,9 @@ assemble_code_diff() {
|
|
|
191
281
|
mode="${1:-}"
|
|
192
282
|
shift || true
|
|
193
283
|
|
|
284
|
+
REVIEW_ARTIFACT=""
|
|
285
|
+
REVIEW_FINGERPRINT=""
|
|
286
|
+
|
|
194
287
|
case "$mode" in
|
|
195
288
|
plan)
|
|
196
289
|
target="${1:-}"
|
|
@@ -203,6 +296,9 @@ case "$mode" in
|
|
|
203
296
|
echo "error: unexpected arguments after plan file: $*" >&2
|
|
204
297
|
exit 2
|
|
205
298
|
fi
|
|
299
|
+
# Plan-mode receipt identity: the artifact-file sha256 (informational-only for the tree checker).
|
|
300
|
+
REVIEW_ARTIFACT="plan"
|
|
301
|
+
REVIEW_FINGERPRINT="$(sha256_stdin <"$target" || true)"
|
|
206
302
|
fence_plan="Do not read files outside this git working tree; the plan above plus the in-repo code it references are your whole surface."
|
|
207
303
|
directive="You are REVIEWING an implementation plan — ADVISORY ONLY. You are in a read-only sandbox: do NOT edit, create, or delete any file, and do NOT rewrite the plan. Obey the project's Hard Constraints from its root AGENTS.md (already merged into your context). Read the plan below and the relevant repository code it references. ${fence_plan} ${OUTPUT_FORMAT_PLAN} Cover: correctness risks, missing or mis-ordered steps, ambiguities a cold executor would trip on, violated project Hard Constraints, scope creep, and missing verification/gates."
|
|
208
304
|
prompt="${directive}"$'\n\nPLAN:\n'"$(cat -- "$target")"
|
|
@@ -214,6 +310,10 @@ case "$mode" in
|
|
|
214
310
|
echo "codex-review: no uncommitted changes to review — the working tree is clean." >&2
|
|
215
311
|
exit 0
|
|
216
312
|
fi
|
|
313
|
+
# The canonical fingerprint of the tree codex is about to review — computed at assembly time
|
|
314
|
+
# (BEFORE the EXIT trap can fire), so the receipt attests exactly the reviewed state.
|
|
315
|
+
REVIEW_ARTIFACT="code"
|
|
316
|
+
REVIEW_FINGERPRINT="$(compute_tree_fingerprint || true)"
|
|
217
317
|
# Assemble DIRECTLY to a git-dir-local temp file (git-invisible + worktree /
|
|
218
318
|
# submodule safe; 600 perms). Measuring size from the file keeps the whole
|
|
219
319
|
# change set off the bash-variable path (no NUL drop, byte-accurate size).
|
|
@@ -370,3 +470,20 @@ else
|
|
|
370
470
|
echo "warning: codex produced no final-message file — printing the run-trace tail instead." >&2
|
|
371
471
|
tail -n 40 "$trace"
|
|
372
472
|
fi
|
|
473
|
+
|
|
474
|
+
# --- Review receipt (AD-038): parse the verdict, append one receipt line ------
|
|
475
|
+
# Text mode parses the mandated literal 'Verdict: <ship|revise|rethink>' line; CODEX_REVIEW_SCHEMA=1
|
|
476
|
+
# reads the schema's "verdict" field instead; absent either way → "unknown" (recorded, never guessed).
|
|
477
|
+
verdict=""
|
|
478
|
+
if [[ -f "$out" && -s "$out" ]]; then
|
|
479
|
+
if [[ "${CODEX_REVIEW_SCHEMA:-}" == "1" ]]; then
|
|
480
|
+
verdict="$(sed -nE 's/.*"verdict"[[:space:]]*:[[:space:]]*"(ship|revise|rethink)".*/\1/p' "$out" | tail -n1)"
|
|
481
|
+
else
|
|
482
|
+
verdict="$(sed -nE 's/^Verdict: (ship|revise|rethink)[[:space:]]*$/\1/p' "$out" | tail -n1)"
|
|
483
|
+
fi
|
|
484
|
+
fi
|
|
485
|
+
[[ -z "$verdict" ]] && verdict="unknown"
|
|
486
|
+
# codex is grounded by construction (AGENTS.md auto-merge + the precomputed change set): grounded
|
|
487
|
+
# true, factsHash null (native grounding — no separate facts payload exists). Every codex run is a
|
|
488
|
+
# full fresh run (one-shot, no resume) → fresh:true.
|
|
489
|
+
write_review_receipt "$REVIEW_ARTIFACT" true "$REVIEW_FINGERPRINT" "$verdict" true ""
|
|
@@ -8,6 +8,7 @@ import { tmpdir } from 'node:os';
|
|
|
8
8
|
import { join, dirname, resolve } from 'node:path';
|
|
9
9
|
import { fileURLToPath } from 'node:url';
|
|
10
10
|
import { spawnSync } from 'node:child_process';
|
|
11
|
+
import { createHash } from 'node:crypto';
|
|
11
12
|
|
|
12
13
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
13
14
|
const WRAPPER = join(HERE, 'codex-review.sh');
|
|
@@ -641,6 +642,12 @@ describe('codex-review.sh — --help contract (manifest-pinned)', () => {
|
|
|
641
642
|
setEq(got, (REVIEW_CONTRACT.continue ?? []).map(norm), 'help continue ⟷ manifest continue');
|
|
642
643
|
assert.deepEqual(REVIEW_CONTRACT.continue, [], 'codex-review is one-shot — no continue descriptor');
|
|
643
644
|
});
|
|
645
|
+
|
|
646
|
+
it('Receipt renders the manifest receipt contract verbatim (AD-038 three-way lockstep)', () => {
|
|
647
|
+
const help = runHelp('--help').stdout;
|
|
648
|
+
assert.equal(norm(helpSection(help, 'Receipt:').join(' ')), norm(REVIEW_CONTRACT.receipt));
|
|
649
|
+
assert.match(REVIEW_CONTRACT.receipt, /sha256 over the canonical uncommitted-state payload/, 'the fingerprint definition lives in the manifest contract');
|
|
650
|
+
});
|
|
644
651
|
});
|
|
645
652
|
|
|
646
653
|
describe('codex-review.sh — source-level reverse guard (parser arms ⟷ manifest)', () => {
|
|
@@ -667,3 +674,128 @@ describe('codex-review.sh — source-level reverse guard (parser arms ⟷ manife
|
|
|
667
674
|
}
|
|
668
675
|
});
|
|
669
676
|
});
|
|
677
|
+
|
|
678
|
+
// ── review receipts (AD-038) ─────────────────────────────────────────────────────
|
|
679
|
+
// The normative fixture (docs: the AD-038 plan Decisions — copied verbatim; field VALUES with
|
|
680
|
+
// dynamic content are asserted by shape):
|
|
681
|
+
const RECEIPT_FIXTURE = JSON.parse(
|
|
682
|
+
'{"schema":1,"artifact":"code","fresh":true,"fingerprint":"<sha256hex>","backend":"codex","verdict":"revise","grounded":true,"factsHash":null,"wrapperVersion":"2.2.0","timestamp":"2026-07-03T12:00:00Z"}',
|
|
683
|
+
);
|
|
684
|
+
const RECEIPTS_REL = join('.git', 'agent-workflow-review-receipts.jsonl');
|
|
685
|
+
const readReceipts = (repo) => {
|
|
686
|
+
const p = join(repo, RECEIPTS_REL);
|
|
687
|
+
if (!existsSync(p)) return [];
|
|
688
|
+
return readFileSync(p, 'utf8').trim().split('\n').filter(Boolean).map((l) => JSON.parse(l));
|
|
689
|
+
};
|
|
690
|
+
const sha256Hex = (buf) => createHash('sha256').update(buf).digest('hex');
|
|
691
|
+
|
|
692
|
+
describe('codex-review.sh — review receipts (AD-038)', () => {
|
|
693
|
+
it('a successful code review appends ONE fixture-shaped receipt (text-mode verdict parse)', () => {
|
|
694
|
+
const sb = makeSandbox();
|
|
695
|
+
const r = run(sb, { env: { CODEX_FAKE_FINAL: '[major] — a.txt:1 — x — y\nVerdict: revise' } });
|
|
696
|
+
const receipts = readReceipts(sb.repo);
|
|
697
|
+
rmSync(sb.root, { recursive: true, force: true });
|
|
698
|
+
assert.equal(r.status, 0, r.stderr);
|
|
699
|
+
assert.equal(receipts.length, 1, 'exactly one receipt line');
|
|
700
|
+
const receipt = receipts[0];
|
|
701
|
+
assert.deepEqual(Object.keys(receipt), Object.keys(RECEIPT_FIXTURE), 'fixture key set + order');
|
|
702
|
+
assert.equal(receipt.schema, 1);
|
|
703
|
+
assert.equal(receipt.artifact, 'code');
|
|
704
|
+
assert.equal(receipt.fresh, true, 'every codex run is a fresh one-shot');
|
|
705
|
+
assert.match(receipt.fingerprint, /^[0-9a-f]{64}$/, 'a real sha256 hex fingerprint');
|
|
706
|
+
assert.equal(receipt.backend, 'codex');
|
|
707
|
+
assert.equal(receipt.verdict, 'revise', 'the mandated literal verdict line is parsed');
|
|
708
|
+
assert.equal(receipt.grounded, true, 'codex is grounded by construction');
|
|
709
|
+
assert.equal(receipt.factsHash, null, 'native grounding — no separate facts payload');
|
|
710
|
+
assert.equal(receipt.wrapperVersion, MANIFEST.version, 'receipt version ⟷ capability.json version');
|
|
711
|
+
assert.match(receipt.timestamp, /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/);
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
it('the code-mode fingerprint tracks the uncommitted state (same tree → same hash; edit → different)', () => {
|
|
715
|
+
const sb = makeSandbox();
|
|
716
|
+
// Route the fake-codex capture files to /dev/null so the runs themselves leave the repo
|
|
717
|
+
// byte-identical (the default capture files land inside the repo and would change the tree).
|
|
718
|
+
const quiet = { CODEX_FAKE_ARGV: '/dev/null', CODEX_FAKE_ENV: '/dev/null', CODEX_FAKE_STDIN: '/dev/null', CODEX_FAKE_FINAL: 'Verdict: ship' };
|
|
719
|
+
run(sb, { env: quiet });
|
|
720
|
+
run(sb, { env: quiet });
|
|
721
|
+
writeFileSync(join(sb.repo, 'pending.txt'), 'edited after the first two reviews\n');
|
|
722
|
+
run(sb, { env: quiet });
|
|
723
|
+
const receipts = readReceipts(sb.repo);
|
|
724
|
+
rmSync(sb.root, { recursive: true, force: true });
|
|
725
|
+
assert.equal(receipts.length, 3);
|
|
726
|
+
assert.equal(receipts[0].fingerprint, receipts[1].fingerprint, 'an unchanged tree re-fingerprints identically');
|
|
727
|
+
assert.notEqual(receipts[1].fingerprint, receipts[2].fingerprint, 'an edited tree changes the fingerprint');
|
|
728
|
+
});
|
|
729
|
+
|
|
730
|
+
it('CODEX_REVIEW_SCHEMA=1 reads the schema verdict field', () => {
|
|
731
|
+
const sb = makeSandbox();
|
|
732
|
+
const r = run(sb, {
|
|
733
|
+
env: { CODEX_REVIEW_SCHEMA: '1', CODEX_FAKE_FINAL: '{"findings":[],"verdict":"ship","notes":"ok"}' },
|
|
734
|
+
});
|
|
735
|
+
const receipts = readReceipts(sb.repo);
|
|
736
|
+
rmSync(sb.root, { recursive: true, force: true });
|
|
737
|
+
assert.equal(r.status, 0, r.stderr);
|
|
738
|
+
assert.equal(receipts[0].verdict, 'ship');
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
it('no parseable verdict → recorded as "unknown", never guessed', () => {
|
|
742
|
+
const sb = makeSandbox();
|
|
743
|
+
const r = run(sb, { env: { CODEX_FAKE_FINAL: 'looks fine to me overall' } });
|
|
744
|
+
const receipts = readReceipts(sb.repo);
|
|
745
|
+
rmSync(sb.root, { recursive: true, force: true });
|
|
746
|
+
assert.equal(r.status, 0, r.stderr);
|
|
747
|
+
assert.equal(receipts[0].verdict, 'unknown');
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
it('plan mode: artifact "plan", fingerprint = the artifact-file sha256', () => {
|
|
751
|
+
const sb = makeSandbox();
|
|
752
|
+
const planBytes = readFileSync(join(sb.repo, 'plan.md'));
|
|
753
|
+
const r = run(sb, { args: ['plan', 'plan.md'], env: { CODEX_FAKE_FINAL: 'Verdict: ship' } });
|
|
754
|
+
const receipts = readReceipts(sb.repo);
|
|
755
|
+
rmSync(sb.root, { recursive: true, force: true });
|
|
756
|
+
assert.equal(r.status, 0, r.stderr);
|
|
757
|
+
assert.equal(receipts[0].artifact, 'plan');
|
|
758
|
+
assert.equal(receipts[0].fingerprint, sha256Hex(planBytes), 'plan fingerprint = file sha256');
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
it('AW_REVIEW_RECEIPTS overrides the receipt destination', () => {
|
|
762
|
+
const sb = makeSandbox();
|
|
763
|
+
const override = join(sb.root, 'my-receipts.jsonl');
|
|
764
|
+
const r = run(sb, { env: { AW_REVIEW_RECEIPTS: override, CODEX_FAKE_FINAL: 'Verdict: ship' } });
|
|
765
|
+
const inGitDir = readReceipts(sb.repo);
|
|
766
|
+
const atOverride = existsSync(override) ? readFileSync(override, 'utf8') : '';
|
|
767
|
+
rmSync(sb.root, { recursive: true, force: true });
|
|
768
|
+
assert.equal(r.status, 0, r.stderr);
|
|
769
|
+
assert.equal(inGitDir.length, 0, 'nothing written to the default path');
|
|
770
|
+
assert.match(atOverride, /"backend":"codex"/);
|
|
771
|
+
});
|
|
772
|
+
|
|
773
|
+
it('a receipt write failure warns loudly but never fails the review (fail-safe direction)', () => {
|
|
774
|
+
const sb = makeSandbox();
|
|
775
|
+
const r = run(sb, {
|
|
776
|
+
env: { AW_REVIEW_RECEIPTS: join(sb.repo, 'no-such-dir', 'r.jsonl'), CODEX_FAKE_FINAL: 'Verdict: ship' },
|
|
777
|
+
});
|
|
778
|
+
rmSync(sb.root, { recursive: true, force: true });
|
|
779
|
+
assert.equal(r.status, 0, 'the review run itself succeeds');
|
|
780
|
+
assert.match(r.stderr, /could not append the review receipt/);
|
|
781
|
+
assert.match(r.stdout, /Verdict: ship/, 'the findings still reach stdout');
|
|
782
|
+
});
|
|
783
|
+
|
|
784
|
+
it('a failed codex run writes NO receipt (only a successful review attests)', () => {
|
|
785
|
+
const sb = makeSandbox();
|
|
786
|
+
const r = run(sb, { env: { CODEX_FAKE_EXIT: '5' } });
|
|
787
|
+
const receipts = readReceipts(sb.repo);
|
|
788
|
+
rmSync(sb.root, { recursive: true, force: true });
|
|
789
|
+
assert.notEqual(r.status, 0);
|
|
790
|
+
assert.equal(receipts.length, 0);
|
|
791
|
+
});
|
|
792
|
+
|
|
793
|
+
it('the clean-tree preflight exits before any receipt is written', () => {
|
|
794
|
+
const sb = makeSandbox({ clean: true });
|
|
795
|
+
const r = run(sb);
|
|
796
|
+
const receipts = readReceipts(sb.repo);
|
|
797
|
+
rmSync(sb.root, { recursive: true, force: true });
|
|
798
|
+
assert.equal(r.status, 0);
|
|
799
|
+
assert.equal(receipts.length, 0, 'no review ran — no receipt');
|
|
800
|
+
});
|
|
801
|
+
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"schema": 1,
|
|
4
4
|
"name": "codex-cli-bridge",
|
|
5
5
|
"kind": "execution-backend",
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.2.0",
|
|
7
7
|
"provides": ["execute", "review"],
|
|
8
8
|
"roles": {
|
|
9
9
|
"execute": {
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"codex-review code [extra focus...]"
|
|
39
39
|
],
|
|
40
40
|
"grounding": "automatic — the wrapper precomputes the full working-tree change set (repo map, status, diffs, untracked contents) and codex auto-merges the root AGENTS.md; no grounding flags",
|
|
41
|
-
"continue": []
|
|
41
|
+
"continue": [],
|
|
42
|
+
"receipt": "side effect — a successful review appends one JSON receipt line to <git dir>/agent-workflow-review-receipts.jsonl (AW_REVIEW_RECEIPTS overrides): fingerprint = sha256 over the canonical uncommitted-state payload (staged diff + unstaged diff + untracked-not-ignored contents — the review-payload domain) in code mode, the artifact-file sha256 in plan mode; verdict parsed from the mandated literal verdict line (schema mode: the verdict field); always fresh:true (one-shot) + grounded:true (native AGENTS.md auto-merge, factsHash null); a write failure warns, never fails the review"
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
},
|
package/capability.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sabaiway/agent-workflow-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.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",
|
|
@@ -18,8 +18,9 @@ Every AI agent working on this project **must** adhere to this protocol before w
|
|
|
18
18
|
### 1.1. Start of Session
|
|
19
19
|
Read in order, then confirm before starting:
|
|
20
20
|
1. `docs/ai/handover.md` — where we left off.
|
|
21
|
-
2. `docs/ai/
|
|
22
|
-
3.
|
|
21
|
+
2. `docs/ai/orchestration.json` — the CONFIGURED orchestration recipes (per activity/slot). Honor them: a silent recipe downgrade is a forbidden substitution.
|
|
22
|
+
3. `docs/ai/active_plan.md` — pick ONE task from "Immediate Priority".
|
|
23
|
+
4. Confirm with the user: *"I'm taking task X. Confirm?"*
|
|
23
24
|
|
|
24
25
|
### 1.2. During Work
|
|
25
26
|
**Before any feature:** read the relevant page spec (`docs/ai/pages/<page>.md`). If behaviour changes, update the spec FIRST so docs and code never diverge.
|
|
@@ -14,6 +14,7 @@ maxLines: 80
|
|
|
14
14
|
|
|
15
15
|
**Last session:** {{DATE}}
|
|
16
16
|
**Branch:** {{BRANCH}}
|
|
17
|
+
**Active recipes:** not recorded yet — paste the configured-recipe line (composed from `docs/ai/orchestration.json`) and refresh it whenever the config changes.
|
|
17
18
|
|
|
18
19
|
## What was done last session
|
|
19
20
|
|
package/tools/commands.mjs
CHANGED
|
@@ -131,7 +131,7 @@ const CATALOG = [
|
|
|
131
131
|
invocation: invocationOf('recipes'),
|
|
132
132
|
group: 'Orchestrate',
|
|
133
133
|
kind: READ_ONLY,
|
|
134
|
-
oneLine: 'See the orchestration recipes (Solo / Reviewed / Council / Delegated)
|
|
134
|
+
oneLine: 'See the orchestration recipes (Solo / Reviewed / Council / Delegated), which one fits this environment, and the configured per-activity line to paste at session start.',
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
137
|
key: 'procedures',
|
|
@@ -147,6 +147,20 @@ const CATALOG = [
|
|
|
147
147
|
kind: WRITER,
|
|
148
148
|
oneLine: 'Set the orchestration recipe for an activity from plain language — previews the change, then writes the config when you confirm.',
|
|
149
149
|
},
|
|
150
|
+
{
|
|
151
|
+
key: 'review-state',
|
|
152
|
+
invocation: invocationOf('review-state'),
|
|
153
|
+
group: 'Orchestrate',
|
|
154
|
+
kind: READ_ONLY,
|
|
155
|
+
oneLine: 'Check that every configured review backend has receipted the current uncommitted tree with a fresh grounded review; --check turns it into a gate exit code.',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
key: 'grounding',
|
|
159
|
+
invocation: invocationOf('grounding'),
|
|
160
|
+
group: 'Orchestrate',
|
|
161
|
+
kind: WRITER,
|
|
162
|
+
oneLine: 'Assemble the verified-facts payload a grounded review runs against — the entry-point Hard Constraints plus a plan’s decision sections; prints it, or writes ONE scratch file with --out.',
|
|
163
|
+
},
|
|
150
164
|
];
|
|
151
165
|
|
|
152
166
|
// Deep-freeze: freeze the array AND every entry, so the catalog is genuinely immutable at runtime
|
|
@@ -88,6 +88,7 @@ const RAW_BACKENDS = [
|
|
|
88
88
|
],
|
|
89
89
|
grounding: 'automatic — the wrapper precomputes the full working-tree change set (repo map, status, diffs, untracked contents) and codex auto-merges the root AGENTS.md; no grounding flags',
|
|
90
90
|
continue: [],
|
|
91
|
+
receipt: 'side effect — a successful review appends one JSON receipt line to <git dir>/agent-workflow-review-receipts.jsonl (AW_REVIEW_RECEIPTS overrides): fingerprint = sha256 over the canonical uncommitted-state payload (staged diff + unstaged diff + untracked-not-ignored contents — the review-payload domain) in code mode, the artifact-file sha256 in plan mode; verdict parsed from the mandated literal verdict line (schema mode: the verdict field); always fresh:true (one-shot) + grounded:true (native AGENTS.md auto-merge, factsHash null); a write failure warns, never fails the review',
|
|
91
92
|
},
|
|
92
93
|
},
|
|
93
94
|
bin: 'codex',
|
|
@@ -120,6 +121,7 @@ const RAW_BACKENDS = [
|
|
|
120
121
|
'agy-review --continue [--decided @f] [--focus "…"]',
|
|
121
122
|
'agy-review --conversation <id> [--decided @f] [--focus "…"]',
|
|
122
123
|
],
|
|
124
|
+
receipt: "side effect — a successful review appends one JSON receipt line to <git dir>/agent-workflow-review-receipts.jsonl (AW_REVIEW_RECEIPTS overrides; plan/diff outside a git tree: warn + skip unless overridden): fingerprint = sha256 over the canonical uncommitted-state payload (staged diff + unstaged diff + untracked-not-ignored contents — the review-payload domain) in code mode, the artifact-file sha256 in plan/diff mode; verdict recorded verbatim from the mandated '### Verdict' section (SHIP / SHIP WITH NITS / REWORK); grounded = whether a NON-EMPTY --facts payload was supplied (an empty payload records grounded:false — fail-closed, the state gate rejects it), factsHash = sha256 of the facts payload; a continuation receipt is fresh:false (informational-only — it cannot attest the folded tree); a write failure warns, never fails the review",
|
|
123
125
|
},
|
|
124
126
|
},
|
|
125
127
|
bin: 'agy',
|