@olegkoval/agent-skills 1.83.0 → 1.84.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.
Files changed (40) hide show
  1. package/adapters/claude/olko-github-pr/skills/lekker-review/SKILL.md +13 -3
  2. package/adapters/claude/olko-github-pr/skills/lekker-review/references/boundary-evidence.md +73 -0
  3. package/adapters/claude/olko-github-pr/skills/lekker-review/references/codex-workflow.md +5 -0
  4. package/adapters/claude/olko-github-pr/skills/lekker-review/references/defect-evaluation.md +82 -0
  5. package/adapters/claude/olko-github-pr/skills/lekker-review/references/evidence-efficiency-ablation.md +59 -0
  6. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/boundary-probe-contract.mjs +33 -0
  7. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/boundary-probe-runner.mjs +92 -0
  8. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/boundary-probe.mjs +22 -0
  9. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/boundary-report.mjs +2 -2
  10. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/boundary-source.mjs +3 -2
  11. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/boundary-validation.mjs +97 -0
  12. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/evidence-bundle.mjs +30 -13
  13. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/evidence-packet.mjs +74 -0
  14. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/stage-ledger.mjs +96 -0
  15. package/package.json +1 -1
  16. package/plugins/olko-apple-kit/.claude-plugin/plugin.json +1 -1
  17. package/plugins/olko-creative/.claude-plugin/plugin.json +1 -1
  18. package/plugins/olko-garmin-kit/.claude-plugin/plugin.json +1 -1
  19. package/plugins/olko-git-tools/.claude-plugin/plugin.json +1 -1
  20. package/plugins/olko-github-pr/.claude-plugin/plugin.json +1 -1
  21. package/plugins/olko-github-pr/skills/lekker-review/SKILL.md +13 -3
  22. package/plugins/olko-github-pr/skills/lekker-review/references/boundary-evidence.md +73 -0
  23. package/plugins/olko-github-pr/skills/lekker-review/references/codex-workflow.md +5 -0
  24. package/plugins/olko-github-pr/skills/lekker-review/references/defect-evaluation.md +82 -0
  25. package/plugins/olko-github-pr/skills/lekker-review/references/evidence-efficiency-ablation.md +59 -0
  26. package/plugins/olko-github-pr/skills/lekker-review/scripts/boundary-probe-contract.mjs +33 -0
  27. package/plugins/olko-github-pr/skills/lekker-review/scripts/boundary-probe-runner.mjs +92 -0
  28. package/plugins/olko-github-pr/skills/lekker-review/scripts/boundary-probe.mjs +22 -0
  29. package/plugins/olko-github-pr/skills/lekker-review/scripts/boundary-report.mjs +2 -2
  30. package/plugins/olko-github-pr/skills/lekker-review/scripts/boundary-source.mjs +3 -2
  31. package/plugins/olko-github-pr/skills/lekker-review/scripts/boundary-validation.mjs +97 -0
  32. package/plugins/olko-github-pr/skills/lekker-review/scripts/evidence-bundle.mjs +30 -13
  33. package/plugins/olko-github-pr/skills/lekker-review/scripts/evidence-packet.mjs +74 -0
  34. package/plugins/olko-github-pr/skills/lekker-review/scripts/stage-ledger.mjs +96 -0
  35. package/plugins/olko-obsidian/.claude-plugin/plugin.json +1 -1
  36. package/plugins/olko-product/.claude-plugin/plugin.json +1 -1
  37. package/plugins/olko-reflection/.claude-plugin/plugin.json +1 -1
  38. package/plugins/olko-release/.claude-plugin/plugin.json +1 -1
  39. package/plugins/olko-skill-meta/.claude-plugin/plugin.json +1 -1
  40. package/plugins/olko-web-ops/.claude-plugin/plugin.json +1 -1
@@ -0,0 +1,74 @@
1
+ import { createHash } from 'node:crypto'
2
+ import { readFileSync } from 'node:fs'
3
+ import { fileURLToPath } from 'node:url'
4
+
5
+ const sha256 = value => createHash('sha256').update(value).digest('hex')
6
+ const record = value => value && typeof value === 'object' && !Array.isArray(value)
7
+ const unavailable = reason => ({ schema: 1, status: 'unavailable', reason })
8
+
9
+ function reportIntegrity(boundary) {
10
+ if (boundary?.captureStatus !== 'available') return false
11
+ const report = boundary.report
12
+ if (!record(report)) return false
13
+ const bytes = Buffer.from(JSON.stringify(report, null, 2) + '\n')
14
+ return sha256(bytes) === boundary.reportSha256
15
+ }
16
+
17
+ function filePatches(diff, paths) {
18
+ const chunks = diff.split(/(?=^diff --git )/m).filter(Boolean)
19
+ return paths.flatMap(path => {
20
+ const chunk = chunks.find(value => value.startsWith(`diff --git a/${path} b/${path}\n`))
21
+ if (!chunk) return []
22
+ return [{ path, patch: chunk.trimEnd(), ranges: [...chunk.matchAll(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/gm)].map(m => ({ start: Number(m[1]), count: Number(m[2] ?? 1) })) }]
23
+ })
24
+ }
25
+
26
+ export function projectEvidencePacket(bundleBytes, expectedSha256, { dimension, paths, maxBytes = 32768 } = {}) {
27
+ try {
28
+ if (!Buffer.isBuffer(bundleBytes) || sha256(bundleBytes) !== expectedSha256) return unavailable('full bundle hash mismatch')
29
+ const bundle = JSON.parse(bundleBytes.toString('utf8'))
30
+ if (!record(bundle) || bundle.schema !== 1 || bundle.git?.status !== 'available' || !record(bundle.git.diff)
31
+ || typeof bundle.git.diff.text !== 'string' || sha256(Buffer.from(bundle.git.diff.text)) !== bundle.git.diff.sha256) return unavailable('full evidence bundle is invalid')
32
+ if (typeof dimension !== 'string' || !dimension || !Array.isArray(paths) || !paths.length
33
+ || paths.some(path => typeof path !== 'string' || !bundle.git.changedPaths.includes(path))
34
+ || !Number.isSafeInteger(maxBytes) || maxBytes < 256 || maxBytes > 262144) return unavailable('packet scope or size budget is invalid')
35
+ const sourceRanges = filePatches(bundle.git.diff.text, paths)
36
+ if (sourceRanges.length !== paths.length) return unavailable('selected source patch is missing from the full diff')
37
+ const diagnostics = bundle.lint?.captureStatus === 'available' && Array.isArray(bundle.lint.report)
38
+ ? bundle.lint.report.filter(row => paths.includes(row.filePath ?? row.file ?? row.filename)) : []
39
+ const boundary = bundle.boundary
40
+ if (boundary?.captureStatus === 'available' && !reportIntegrity(boundary)) return unavailable('boundary report hash mismatch')
41
+ const report = boundary?.report
42
+ if (boundary?.captureStatus === 'available' && (report.provenance?.baseSha !== bundle.git.provenance?.baseSha
43
+ || report.provenance?.headSha !== bundle.git.provenance?.headSha || !bundle.git.changedPaths.includes(report.source))) return unavailable('boundary provenance does not match the full bundle')
44
+ const candidate = report?.reducedCounterexample && report.candidates?.find(row => row.id === report.reducedCounterexample.id)
45
+ const packet = { schema: 1, status: 'available', mode: 'shadow-projection', dimension, scope: { paths: [...paths].sort(), omittedPaths: bundle.git.changedPaths.filter(path => !paths.includes(path)), omittedContextReviewed: false, wholeDiffPassRequired: true },
46
+ provenance: { baseSha: bundle.git.provenance?.baseSha, headSha: bundle.git.provenance?.headSha,
47
+ diffSha256: bundle.git.diff.sha256, fullBundleSha256: expectedSha256,
48
+ boundaryReportSha256: boundary?.captureStatus === 'available' ? boundary.reportSha256 : null },
49
+ sourceRanges, lint: bundle.lint?.captureStatus === 'available' ? { status: 'available', diagnostics } : { status: 'unavailable', reason: bundle.lint?.reason ?? 'lint evidence absent' },
50
+ boundary: boundary?.captureStatus === 'available' ? { status: candidate ? 'candidate' : 'no-candidate', source: report.source,
51
+ contract: report.contract, provenance: report.provenance,
52
+ witness: candidate ? { input: candidate.input, inputSha256: candidate.inputSha256, outcomes: candidate.outcomes,
53
+ reducedScope: report.reducedCounterexample.scope, failure: boundary.summary?.reducedFailure } : null }
54
+ : { status: 'unavailable', reason: boundary?.reason ?? 'boundary evidence absent' },
55
+ coverageGaps: { omittedChangedPaths: bundle.git.changedPaths.filter(path => !paths.includes(path)), notApplicableDiagnosticsOmitted: (bundle.lint?.report?.length ?? 0) - diagnostics.length,
56
+ omittedContextReviewed: false, broadDiffReviewRequired: true } }
57
+ packet.packetBytes = 0
58
+ packet.fullBundleBytes = bundleBytes.length
59
+ let packetBytes = Buffer.byteLength(JSON.stringify(packet))
60
+ while (packet.packetBytes !== packetBytes) { packet.packetBytes = packetBytes; packetBytes = Buffer.byteLength(JSON.stringify(packet)) }
61
+ if (packetBytes > maxBytes) return unavailable('projected packet exceeds configured byte budget')
62
+ return packet
63
+ } catch { return unavailable('bundle or packet input is malformed') }
64
+ }
65
+
66
+ function main(argv) {
67
+ const value = key => { const at = argv.indexOf(`--${key}`); return at < 0 ? null : argv[at + 1] }
68
+ const file = value('bundle'), hash = value('sha256'), dimension = value('dimension'), paths = argv.flatMap((arg, i) => arg === '--path' ? [argv[i + 1]] : [])
69
+ if (!file || !hash || !dimension || !paths.length) { console.error('usage: evidence-packet.mjs --bundle <full-bundle.json> --sha256 <trusted-bundle-sha256> --dimension <name> --path <changed-path> [--path <changed-path>] [--max-bytes <n>]'); process.exitCode = 2; return }
70
+ try { console.log(JSON.stringify(projectEvidencePacket(readFileSync(file), hash, { dimension, paths, maxBytes: Number(value('max-bytes') ?? 32768) }))) }
71
+ catch { console.log(JSON.stringify(unavailable('explicit bundle could not be read'))); process.exitCode = 2 }
72
+ }
73
+
74
+ if (process.argv[1] === fileURLToPath(import.meta.url)) main(process.argv.slice(2))
@@ -0,0 +1,96 @@
1
+ import { readFileSync } from 'node:fs'
2
+ import { fileURLToPath } from 'node:url'
3
+
4
+ const counters = ['inputTokens', 'cachedInputTokens', 'outputTokens']
5
+ const record = value => value && typeof value === 'object' && !Array.isArray(value)
6
+ const unavailable = reason => ({ schema: 1, status: 'unavailable', reason, stages: [] })
7
+
8
+ function validCount(value) { return Number.isSafeInteger(value) && value >= 0 }
9
+
10
+ export function buildStageLedger(manifest, adjudication) {
11
+ if (!record(manifest) || manifest.schema !== 1 || !Array.isArray(manifest.sessions)) return unavailable('explicit session manifest is missing or malformed')
12
+ const seen = new Set(), stages = new Map()
13
+ for (const session of manifest.sessions) {
14
+ if (!record(session) || typeof session.sessionId !== 'string' || !session.sessionId || typeof session.stage !== 'string' || !session.stage) return unavailable('session identity or stage is invalid')
15
+ if (seen.has(session.sessionId)) return unavailable('duplicate session identity')
16
+ seen.add(session.sessionId)
17
+ let stage = stages.get(session.stage)
18
+ if (!stage) { stage = { name: session.stage, sessions: 0, status: 'available', inputTokens: 0, cachedInputTokens: 0, uncachedInputTokens: 0, outputTokens: 0, elapsedSeconds: [], unavailableSessions: 0 }; stages.set(session.stage, stage) }
19
+ if (session.status !== 'available') { stage.status = 'partial'; stage.unavailableSessions += 1; continue }
20
+ if (!record(session.usage) || counters.some(key => !validCount(session.usage[key])) || session.usage.cachedInputTokens > session.usage.inputTokens
21
+ || session.elapsedSeconds !== undefined && !(typeof session.elapsedSeconds === 'number' && Number.isFinite(session.elapsedSeconds) && session.elapsedSeconds >= 0)) return unavailable('session counters or elapsed observation are invalid')
22
+ stage.sessions += 1
23
+ stage.inputTokens += session.usage.inputTokens
24
+ stage.cachedInputTokens += session.usage.cachedInputTokens
25
+ stage.uncachedInputTokens += session.usage.inputTokens - session.usage.cachedInputTokens
26
+ stage.outputTokens += session.usage.outputTokens
27
+ if (session.elapsedSeconds !== undefined) stage.elapsedSeconds.push(session.elapsedSeconds)
28
+ }
29
+ const claims = adjudication?.claims
30
+ let outcome = { status: 'unavailable', confirmedDefects: [], falseAlarms: null, duplicates: null, unknownDiscovery: null, unknownVerification: null }
31
+ if (record(adjudication) && adjudication.schema === 1 && Array.isArray(claims)) {
32
+ if (claims.some(item => !record(item) || !['confirmed', 'false-alarm', 'duplicate', 'unresolved'].includes(item.verdict))) return unavailable('adjudication claim is malformed')
33
+ for (const stage of stages.values()) { stage.discoveredDefects = []; stage.verifiedDefects = [] }
34
+ const confirmed = claims.filter(item => item?.verdict === 'confirmed')
35
+ const ids = confirmed.map(item => item.defectId).filter(id => typeof id === 'string' && id)
36
+ outcome = { status: 'available', confirmedDefects: [...new Set(ids)], falseAlarms: claims.filter(item => item.verdict === 'false-alarm').length,
37
+ duplicates: claims.filter(item => item.verdict === 'duplicate').length, unresolved: claims.filter(item => item.verdict === 'unresolved').length,
38
+ unknownDiscovery: 0, unknownVerification: 0 }
39
+ for (const item of confirmed) {
40
+ if (typeof item.defectId !== 'string' || !item.defectId) return unavailable('confirmed claim lacks a defect identity')
41
+ for (const [field, value] of [['discoveredDefects', item.discoveryStage], ['verifiedDefects', item.verificationStage]]) {
42
+ const bucket = field === 'discoveredDefects' ? 'unknownDiscovery' : 'unknownVerification'
43
+ if (!stages.has(value)) outcome[bucket] += 1
44
+ else {
45
+ const stage = stages.get(value)
46
+ stage[field] ??= []
47
+ stage[field].push(item.defectId)
48
+ }
49
+ }
50
+ }
51
+ for (const stage of stages.values()) {
52
+ stage.discoveredDefects = [...new Set(stage.discoveredDefects ?? [])]
53
+ stage.verifiedDefects = [...new Set(stage.verifiedDefects ?? [])]
54
+ }
55
+ }
56
+ for (const stage of stages.values()) {
57
+ if (stage.status === 'partial') for (const key of ['inputTokens', 'cachedInputTokens', 'uncachedInputTokens', 'outputTokens']) stage[key] = null
58
+ else for (const key of ['inputTokens', 'cachedInputTokens', 'uncachedInputTokens', 'outputTokens']) if (!Number.isSafeInteger(stage[key])) return unavailable('stage totals exceed safe integer range')
59
+ }
60
+ return { schema: 1, status: 'available', stages: [...stages.values()], outcomes: outcome }
61
+ }
62
+
63
+ export function buildStageLedgerFromFiles(manifest, adjudication) {
64
+ if (!record(manifest) || manifest.schema !== 1 || !Array.isArray(manifest.runs)) return buildStageLedger(manifest, adjudication)
65
+ const sessions = []
66
+ for (const [index, run] of manifest.runs.entries()) {
67
+ if (!record(run) || typeof run.stage !== 'string' || !run.stage || typeof run.usageFile !== 'string' || !run.usageFile) return unavailable('run manifest needs explicit stage and usageFile entries')
68
+ let saved
69
+ try { saved = JSON.parse(readFileSync(run.usageFile, 'utf8')) } catch {
70
+ sessions.push({ sessionId: `${run.stage}:unavailable:${index}`, stage: run.stage, status: 'unavailable' }); continue
71
+ }
72
+ if (!record(saved) || saved.available !== true || !Array.isArray(saved.sessions) || saved.sessions.length === 0) {
73
+ sessions.push({ sessionId: `${run.stage}:unavailable:${index}`, stage: run.stage, status: 'unavailable' }); continue
74
+ }
75
+ for (const [sessionIndex, row] of saved.sessions.entries()) {
76
+ if (!record(row)) { sessions.push({ sessionId: `${run.stage}:malformed:${index}:${sessionIndex}`, stage: run.stage, status: 'unavailable' }); continue }
77
+ sessions.push({ sessionId: row.sessionId, stage: run.stage,
78
+ status: row.usage ? 'available' : 'unavailable', usage: row.usage && {
79
+ inputTokens: row.usage.input_tokens, cachedInputTokens: row.usage.cached_input_tokens,
80
+ outputTokens: row.usage.output_tokens }, elapsedSeconds: row.wallSeconds })
81
+ }
82
+ }
83
+ const claims = Array.isArray(adjudication?.claims) ? adjudication.claims
84
+ : Array.isArray(adjudication?.evaluations) ? adjudication.evaluations.flatMap(item => item?.decisions ?? []) : null
85
+ return buildStageLedger({ schema: 1, sessions }, claims ? { schema: 1, claims } : null)
86
+ }
87
+
88
+ function main(argv) {
89
+ const arg = name => { const i = argv.indexOf(`--${name}`); return i < 0 ? null : argv[i + 1] }
90
+ const manifest = arg('manifest'), adjudication = arg('adjudication')
91
+ if (!manifest || manifest.startsWith('--')) { console.error('usage: stage-ledger.mjs --manifest <saved-session-manifest.json> [--adjudication <saved-adjudication.json>]'); process.exitCode = 2; return }
92
+ try { console.log(JSON.stringify(buildStageLedgerFromFiles(JSON.parse(readFileSync(manifest, 'utf8')), adjudication ? JSON.parse(readFileSync(adjudication, 'utf8')) : null))) }
93
+ catch { console.log(JSON.stringify(unavailable('explicit artifact could not be read'))); process.exitCode = 2 }
94
+ }
95
+
96
+ if (process.argv[1] === fileURLToPath(import.meta.url)) main(process.argv.slice(2))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olegkoval/agent-skills",
3
- "version": "1.83.0",
3
+ "version": "1.84.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-apple-kit",
3
3
  "description": "Build and ship Apple platform apps: macOS menubar apps, App Store submissions.",
4
- "version": "1.83.0",
4
+ "version": "1.84.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-creative",
3
3
  "description": "Creative and personal projects: photo galleries, music players, listings, wiki editing.",
4
- "version": "1.83.0",
4
+ "version": "1.84.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-garmin-kit",
3
3
  "description": "Build, test and publish Garmin Connect IQ watch faces.",
4
- "version": "1.83.0",
4
+ "version": "1.84.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-git-tools",
3
3
  "description": "Everyday git and GitHub CLI operations: conventional commits, branch hygiene.",
4
- "version": "1.83.0",
4
+ "version": "1.84.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-github-pr",
3
3
  "description": "Drive GitHub pull requests to merge-ready: review-bot loops, CI fixes, descriptions, dependency triage.",
4
- "version": "1.83.0",
4
+ "version": "1.84.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -695,10 +695,20 @@ helper before assembling context. Never run a copy from the reviewed worktree:
695
695
  ```sh
696
696
  node "<SKILL_ROOT>/scripts/evidence-bundle.mjs" \
697
697
  --worktree "<scratchpad>/worktree.json" > "<scratchpad>/evidence-bundle.json"
698
- jq 'del(.git.diff.text, .lint.report)' "<scratchpad>/evidence-bundle.json" \
698
+ jq 'del(.git.diff.text, .lint.report, .boundary.report.results)' "<scratchpad>/evidence-bundle.json" \
699
699
  > "<scratchpad>/static-evidence.json"
700
700
  ```
701
701
 
702
+ Boundary probes are optional and remain off unless the operator explicitly
703
+ opts in with `--trusted-boundary-opt-in`, `--boundary-config`, and
704
+ `--boundary-out`. The fixed trusted CLI adapter reads only exact base/head
705
+ source from observed Git evidence. Follow
706
+ [`references/boundary-evidence.md`](references/boundary-evidence.md) for the
707
+ local configuration. Include the compact boundary status, provenance, candidate
708
+ summary, and verified reduced failure code with its stderr hash/path in semantic review context. Treat candidates as evidence for
709
+ review; they never create findings or a clean verdict automatically. If opted
710
+ in collection is unavailable, preserve its reason in the bundle.
711
+
702
712
  Check each exit status and re-read the JSON. Missing tools, nonzero exits or
703
713
  malformed output make this collection unavailable: preserve diagnostics and
704
714
  set both context paths below to null. Do not silently pass an empty file.
@@ -706,8 +716,8 @@ When Git evidence is available, its provenance base/head must match the
706
716
  review's selected commit pair; a mismatch invalidates the collection, never
707
717
  changes the review target. Unavailable Git or lint stays explicitly unknown.
708
718
 
709
- The compact view removes only duplicate raw diff text and lint report data.
710
- Keep the full bundle for provenance and detail; semantic review still reads
719
+ The compact view removes duplicate raw diff text, lint report data, and raw
720
+ boundary invocation rows, but retains the reduced failure reference after its raw stderr hash is checked. Keep the full bundle for provenance and detail; semantic review still reads
711
721
  DIFF_FILE and existing lint/preflight inputs. Do not replace changedPaths,
712
722
  project rules or the mandatory risk check with a different Git diff. Reuse
713
723
  available pinned inventory instead of recollecting it in every review agent.
@@ -0,0 +1,73 @@
1
+ # Boundary probe evidence
2
+
3
+ Boundary probing is opt-in. It is not enabled for PRs by default and does not
4
+ accept arbitrary command strings from PR content. The registered Node filename
5
+ operation executes a trusted source captured from the exact base and head
6
+ commits named by observed Git evidence, using a fixed CLI protocol. A repaired
7
+ commit is optional and must be named in the local configuration.
8
+
9
+ Create a local JSON configuration outside the reviewed worktree:
10
+
11
+ ```json
12
+ {
13
+ "schema": 1,
14
+ "trustedRoot": "/absolute/path/to/trusted/repository",
15
+ "repoSlug": "agent-skills",
16
+ "seed": 20261108,
17
+ "maxInputs": 32,
18
+ "suffix": "",
19
+ "repairedCommit": "<optional exact 40-character commit SHA>"
20
+ }
21
+ ```
22
+
23
+ Use the existing evidence-bundle helper with explicit local consent:
24
+
25
+ ```sh
26
+ node "<SKILL_ROOT>/scripts/evidence-bundle.mjs" \
27
+ --worktree "<scratchpad>/worktree.json" \
28
+ --trusted-boundary-opt-in \
29
+ --boundary-config "<local-config.json>" \
30
+ --boundary-out "<scratchpad>/boundary-artifacts"
31
+ ```
32
+
33
+ The adapter independently recollects Git evidence and requires the fixed
34
+ `run-log.mjs` path in the observed changed-path list. It observes the filesystem
35
+ component limit in the output filesystem, uses only nonempty ASCII slug inputs,
36
+ and accepts 8–88 generated inputs (plus bounded reduction) per run, never more
37
+ than 100 invocations per source, with a five-second invocation timeout.
38
+ The generated report records the seed, full inputs and hashes, exact source
39
+ commits and hashes, adapter/generator hashes, Node version, exit codes, and raw
40
+ stdout/stderr artifact paths. An error, timeout, stale identity, invalid input,
41
+ missing file, hash mismatch, or exhausted reduction budget is unavailable. The
42
+ trusted CLI runs with a minimal environment in a temporary working/state
43
+ directory; this is not an operating-system filesystem sandbox, so only opt in
44
+ for code already trusted by the operator.
45
+
46
+ The reduced candidate's raw stderr is rehashed before its fixed `ENAMETOOLONG`
47
+ failure code and stderr hash/path enter the compact reviewer packet. A missing,
48
+ changed, or escaping stderr artifact makes the boundary capture unavailable.
49
+ The evidence is a composed trusted CLI probe. A passing reproduction is an
50
+ evidence candidate for human semantic review, never an automatic finding or a
51
+ clean verdict. The compact reviewer context retains status, provenance, and
52
+ candidate/minimal-input summaries while raw runs remain in the full bundle.
53
+ # Explicit filename adapter
54
+
55
+ Boundary probing stays opt-in. The current adapter can be pointed at a changed
56
+ repository-relative Node module with `sourcePath` and the fixed
57
+ `node-fs.mkdtempSync.filename` operation. It still invokes only the built-in
58
+ `start` CLI protocol; configuration cannot supply commands. Applicability is
59
+ manual: no automatic AST or data-flow detection is claimed. Inputs are
60
+ nonempty ASCII target slugs; UTF-8 target generation is unsupported. The
61
+ independent property is that each valid target produces a component within the
62
+ observed filesystem byte limit. Full stdout/stderr, pinned source bytes,
63
+ invocation outcomes, and the reduced witness remain in the audit report.
64
+
65
+ ## Shadow evidence projection
66
+
67
+ `evidence-packet.mjs` projects selected changed-path patches, matching lint
68
+ diagnostics, and the compact boundary witness from a saved full bundle. Pass the
69
+ full bundle's independently recorded SHA-256, dimension, and exact changed paths.
70
+ The packet stays separate from the immutable bundle, rejects hash mismatch,
71
+ and fails closed when its byte budget is exceeded. It is opt-in shadow output;
72
+ omitted paths and diagnostics remain explicit gaps, and every consumer must
73
+ still review the whole diff.
@@ -84,6 +84,11 @@ bounded task:
84
84
  stale/unavailable facts to the coordinator rather than silently retargeting
85
85
  or recollecting them per agent. It does not replace semantic investigation,
86
86
  the authoritative diff, or required schema/completion/verification gates.
87
+ If opted-in static evidence contains boundary data, inspect its capture status,
88
+ source provenance, candidate/reduced-input summary, and verified reduced failure
89
+ code with its stderr hash/path as evidence only. An
90
+ unavailable probe stays unknown; a candidate never creates a finding or clean
91
+ verdict without semantic verification.
87
92
  3. Review only the target diff. Do not edit files, run git writes, post to
88
93
  GitHub, or communicate externally.
89
94
  4. Write the shared result contract to
@@ -0,0 +1,82 @@
1
+ # Defect-aware evaluation
2
+
3
+ The existing `eval-runner.mjs` mode remains a location-based legacy heuristic.
4
+ Use `--defects` only for a local, human-approved frozen corpus with reproduced
5
+ defect contracts. It reads data files and never executes reviewed PR code.
6
+
7
+ ## Inputs
8
+
9
+ The manifest records full commit identities, expected runs, and defect contracts:
10
+
11
+ ```json
12
+ {
13
+ "schema": 1,
14
+ "defects": [{
15
+ "id": "DEFECT-1",
16
+ "contract": "Supported long run targets must create an archive without ENAMETOOLONG.",
17
+ "reproductionEvidence": "oracle/reproduction.md"
18
+ }],
19
+ "cases": [{
20
+ "id": "case-buggy",
21
+ "headSha": "<40-character commit SHA>",
22
+ "expectedDefects": ["DEFECT-1"],
23
+ "expectedRuns": 1
24
+ }]
25
+ }
26
+ ```
27
+
28
+ Each results entry carries the completed run identity and the exact findings JSON
29
+ bytes as a string. The evaluator hashes the UTF-8 bytes; formatting changes
30
+ therefore invalidate the adjudication. Include a row for every expected run.
31
+
32
+ ```json
33
+ {"runs":[{"caseId":"case-buggy","runId":"review-001","status":"completed",
34
+ "headSha":"<same full SHA>","findingsBytes":"[{\"file\":\"src/a.js\",\"line\":3,\"severity\":\"important\"}]"}]}
35
+ ```
36
+
37
+ Adjudication is separate from the findings and binds the exact run, commit, and
38
+ finding bytes. Every finding index needs exactly one verdict, rationale, and
39
+ evidence reference. A confirmed verdict also needs a defect ID; use a new ID for
40
+ a candidate defect not yet in the registry.
41
+
42
+ ```json
43
+ {"evaluations":[{"runId":"review-001","headSha":"<same full SHA>",
44
+ "findingsSha256":"<64-character SHA-256>","decisions":[
45
+ {"findingIndex":0,"verdict":"confirmed","defectId":"DEFECT-1",
46
+ "rationale":"Matches the reproduction contract","evidence":"adjudication/DEFECT-1.md"}]}]}
47
+ ```
48
+
49
+ Run the opt-in scorer:
50
+
51
+ ```sh
52
+ node "${SKILL_ROOT}/scripts/eval-runner.mjs" --defects \
53
+ --manifest <manifest.json> --results <defect-runs.json> \
54
+ --adjudication <adjudication.json>
55
+ ```
56
+
57
+ ## Reading the result
58
+
59
+ `available` and `coverageComplete` must both be true before treating corpus
60
+ metrics as complete. Missing, duplicate, malformed, unresolved, or mismatched
61
+ evidence keeps coverage unavailable. A newly confirmed defect remains visible
62
+ but requires corpus adjudication and is not added to the recall denominator.
63
+
64
+ - Recall is expected defect IDs detected, deduplicated once per case run.
65
+ - Precision is confirmed finding decisions divided by confirmed plus false-alarm
66
+ finding decisions. Repeated claims count here because each finding is a
67
+ separate decision; `uniqueConfirmedDefects` reports deduplicated IDs.
68
+ - False alarms are explicit adjudications, not inferred from severity.
69
+ - False alarms per review and clean alarm rate use fully adjudicated runs.
70
+ - `distinctCases` counts case IDs represented; it does not claim statistical
71
+ independence between related cases.
72
+ - Empty precision or recall denominators are `null`, never zero.
73
+
74
+ ## Measurement protocol
75
+
76
+ Evaluate only previously unseen cases with frozen base, buggy, and fixed commits
77
+ and a reproduced contract for each known defect. Hide arm identity and version
78
+ labels from adjudicators; provide the finding text and contract needed to judge
79
+ each claim. Randomize paired case/version order. Record cost for all agents and
80
+ retries in both arms. Report missing
81
+ coverage and unresolved judgments. This harness does not establish a benefit
82
+ claim; that requires a completed, blinded comparison over the frozen protocol.
@@ -0,0 +1,59 @@
1
+ # Evidence projection ablation: preregistration draft
2
+
3
+ This is a future experiment design only. Do not run it as part of implementation.
4
+ The four-case 2026-11-08 screen failed promotion and its cases are now known
5
+ development fixtures. Freeze a new holdout before any model call.
6
+
7
+ ## Arms and scope
8
+
9
+ - Baseline: the assigned dimension reviewer receives the full immutable evidence
10
+ bundle and the same review inputs as today.
11
+ - Projection: that reviewer receives the deterministic, hash-verified packet
12
+ for its assigned dimension. A whole-diff safety pass receives the same full
13
+ diff in both arms; its reviewer count, prompt, proof policy, and routing stay
14
+ fixed. Omitted packet context is never marked reviewed.
15
+ - Use the same pinned model, effort, tools, prompts, timeout, and retry policy in
16
+ both arms. Run one case-arm at a time; alternate arm order within each pair.
17
+
18
+ ## Corpus and procedure
19
+
20
+ Freeze at least 30 independent PR-level pairs from at least three repositories,
21
+ covering three or more defect families. Prefer real bug-introducing commits and
22
+ their repairs; include safe controls and near-boundary changes with explicit
23
+ contracts. Keep root causes and repositories disjoint from packet-development
24
+ fixtures. Record base/head SHAs, contracts, valid-input assumptions, expected
25
+ findings, and immutable source hashes before unblinding. Adjudicators see claims
26
+ and evidence without the arm label.
27
+
28
+ Run three paired repetitions per PR with counterbalanced order and no retries.
29
+ The PR is the sampling unit; repetitions are nested observations, not new PRs.
30
+ Record every reviewer, coordinator, and verification session once from explicit
31
+ saved manifests, plus measured setup/adjudication minutes. Preserve cached,
32
+ uncached, total input, and output tokens separately. Record elapsed observations
33
+ separately; do not sum overlapping durations or convert token sums to currency.
34
+ The primary all-in cost uses invoice-backed provider charges plus a frozen
35
+ hourly rate for measured setup, coordination, adjudication, and verification.
36
+ Freeze provider rates, currency, and labor rate before collection. If charges or
37
+ labor measurements are unavailable, report the resource vector and leave the
38
+ cost endpoint unavailable; do not promote on token totals alone.
39
+
40
+ ## Analysis and stop rules
41
+
42
+ Before collection, freeze the smallest worthwhile all-in cost reduction, the
43
+ defect-recall non-inferiority margin, a hard review-cost ceiling, and the
44
+ maximum sample size. Report paired PR-level differences and 95% cluster
45
+ bootstrap intervals, resampling PRs while keeping their repetitions together.
46
+ Include false alarms, duplicate claims, unavailable evidence, packet bytes, all
47
+ review/coordinator/verification usage, and manual time. Byte reduction is a
48
+ mechanism check, not the efficiency endpoint.
49
+
50
+ Stop immediately on cross-tenant/data exposure, a missed critical defect, stale
51
+ provenance accepted as available, or budget exhaustion. Otherwise evaluate at
52
+ 30 pairs; add only the predeclared next batch when intervals are too wide, up to
53
+ the frozen maximum. Promote only if the cost interval clears the worthwhile
54
+ effect and the recall interval stays within its safety margin. Otherwise retain
55
+ shadow mode and report the result as inconclusive or failed.
56
+
57
+ No sample-size or quality claim is supported by the existing four-case screen.
58
+ The coordinator must approve the frozen corpus, thresholds, and spend ceiling
59
+ before this experiment is launched.
@@ -0,0 +1,33 @@
1
+ import { createHash } from 'node:crypto'
2
+ import { readFileSync } from 'node:fs'
3
+ import { fileURLToPath } from 'node:url'
4
+
5
+ const HELPER_MODULES = Object.freeze(['boundary-cases.mjs', 'boundary-filesystem.mjs', 'boundary-invocation.mjs', 'boundary-probe-contract.mjs', 'boundary-probe-runner.mjs', 'boundary-report.mjs', 'boundary-source.mjs', 'boundary-validation.mjs', 'git-evidence.mjs'])
6
+ const sha256 = value => createHash('sha256').update(value).digest('hex')
7
+
8
+ export const unavailable = reason => ({ schema: 1, status: 'unavailable', reason, candidates: [] })
9
+
10
+ export function observedChangedPath(bundle, source) {
11
+ return bundle?.git?.status === 'available' && Array.isArray(bundle.git.changedPaths)
12
+ && bundle.git.changedPaths.includes(source) && /^[a-f0-9]{40,64}$/.test(bundle.git.provenance?.baseSha ?? '')
13
+ && /^[a-f0-9]{40,64}$/.test(bundle.git.provenance?.headSha ?? '')
14
+ }
15
+
16
+ export function validProbeConfig(config) {
17
+ return config && typeof config === 'object' && !Array.isArray(config) && config.schema === 1
18
+ && typeof config.trustedRoot === 'string' && typeof config.repoSlug === 'string'
19
+ && /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(config.repoSlug)
20
+ && (config.suffix === undefined || typeof config.suffix === 'string') && /^[a-z0-9]*$/.test(config.suffix ?? '')
21
+ && (config.inputKind === undefined || config.inputKind === 'ascii')
22
+ && (config.sourcePath === undefined && config.operation === undefined && config.expectedProperty === undefined
23
+ || typeof config.sourcePath === 'string' && /^(?:[A-Za-z0-9._-]+\/)*[A-Za-z0-9._-]+\.mjs$/.test(config.sourcePath)
24
+ && config.operation === 'node-fs.mkdtempSync.filename'
25
+ && config.expectedProperty === 'valid ASCII targets produce a component within the observed byte limit')
26
+ && Number.isSafeInteger(config.seed)
27
+ && (config.maxInputs === undefined || Number.isSafeInteger(config.maxInputs) && config.maxInputs >= 8 && config.maxInputs <= 88)
28
+ }
29
+
30
+ export function hashBoundaryHelpers(adapterUrl) {
31
+ return Object.fromEntries(HELPER_MODULES.map(name => [name,
32
+ sha256(readFileSync(fileURLToPath(new URL(`./${name}`, adapterUrl))))]))
33
+ }
@@ -0,0 +1,92 @@
1
+ import { createHash } from 'node:crypto'
2
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
3
+ import { join, resolve } from 'node:path'
4
+ import { fileURLToPath } from 'node:url'
5
+ import { observeComponentLimit } from './boundary-filesystem.mjs'
6
+ import { runTrustedCli } from './boundary-invocation.mjs'
7
+ import { generateBoundaryCases } from './boundary-cases.mjs'
8
+ import { assembleBoundaryReport, isBoundaryCandidate } from './boundary-report.mjs'
9
+ import { readTrustedSource, RUN_LOG_SOURCE } from './boundary-source.mjs'
10
+ import { hashBoundaryHelpers, observedChangedPath, unavailable, validProbeConfig } from './boundary-probe-contract.mjs'
11
+ import { collectGitEvidence } from './git-evidence.mjs'
12
+
13
+ const sha256 = value => createHash('sha256').update(value).digest('hex')
14
+
15
+ export function runBoundaryProbe({ config, worktreePath, mergeBase, headSha, outputDir, optIn = false }) {
16
+ if (!optIn) return unavailable('explicit trusted-probe opt-in is required')
17
+ const sourcePath = config?.sourcePath ?? RUN_LOG_SOURCE
18
+ const git = collectGitEvidence({ worktreePath, mergeBase, headSha })
19
+ const evidenceBundle = { git }
20
+ if (!observedChangedPath(evidenceBundle, sourcePath)) return unavailable('trusted adapter path is absent from observed Git changed paths')
21
+ if (!validProbeConfig(config)) {
22
+ return unavailable('trusted adapter configuration is missing or malformed')
23
+ }
24
+ try {
25
+ const root = resolve(config.trustedRoot)
26
+ const out = resolve(outputDir)
27
+ if (existsSync(out)) throw new Error('output directory already exists; refusing to overwrite evidence')
28
+ mkdirSync(out, { recursive: false })
29
+ const componentLimit = observeComponentLimit(out)
30
+ if (config.maxComponentBytes !== undefined && config.maxComponentBytes !== componentLimit) throw new Error('configured component limit differs from observed filesystem limit')
31
+ const provenance = evidenceBundle.git.provenance
32
+ const commits = { original: provenance.baseSha, defective: provenance.headSha,
33
+ ...(config.repairedCommit ? { repaired: config.repairedCommit } : {}) }
34
+ const roles = Object.keys(commits)
35
+ const sources = Object.fromEntries(roles.map(role => [role, readTrustedSource(root, commits[role], sourcePath)]))
36
+ const internalPrefix = `${'0'.repeat(15)}-${config.repoSlug}-`
37
+ const cases = generateBoundaryCases({ seed: config.seed, limit: componentLimit,
38
+ prefix: internalPrefix, suffix: config.suffix ?? '', count: config.maxInputs ?? 32, kinds: ['ascii'] })
39
+ .filter(item => /^[a-z0-9-]+$/.test(item.input))
40
+ const suffixBytes = Buffer.byteLength(config.suffix ?? '')
41
+ const room = componentLimit - Buffer.byteLength(internalPrefix) - suffixBytes
42
+ const requiredLengths = [room - 1 + suffixBytes, room + suffixBytes, room + 1 + suffixBytes]
43
+ if (cases.length > 88 || requiredLengths.some(length => !cases.some(item => item.inputBytes === length))) {
44
+ throw new Error('insufficient boundary coverage or input budget leaves no room for bounded reduction')
45
+ }
46
+ for (const [role, source] of Object.entries(sources)) writeFileSync(join(out, `${role}.source.mjs`), source.bytes)
47
+ const results = cases.map(item => {
48
+ const runs = Object.fromEntries(Object.entries(sources).map(([role, source]) => [role,
49
+ runTrustedCli({ source, target: item.input, repoSlug: config.repoSlug, outputDir: out, id: `${item.id}-${role}` })]))
50
+ return { id: item.id, kind: item.kind, input: item.input, inputSha256: item.inputSha256,
51
+ inputBytes: item.inputBytes, prefix: internalPrefix, suffix: config.suffix ?? '',
52
+ status: item.status, artifactRoot: out, runs }
53
+ })
54
+ const shrinkResults = []
55
+ let reduced = null
56
+ const firstCandidate = results.find(isBoundaryCandidate)
57
+ if (firstCandidate) {
58
+ let low = 0, high = firstCandidate.input.length, best = firstCandidate
59
+ for (let step = 0; step < 10 && high - low > 1 && results.length + shrinkResults.length < 100; step += 1) {
60
+ const middle = Math.floor((low + high) / 2), input = firstCandidate.input.slice(0, middle)
61
+ const runs = Object.fromEntries(Object.entries(sources).map(([role, source]) => [role,
62
+ runTrustedCli({ source, target: input, repoSlug: config.repoSlug, outputDir: out, id: `shrink-${step}-${role}` })]))
63
+ const row = { id: `shrink-${step}`, kind: 'ascii', input, inputSha256: sha256(input), inputBytes: Buffer.byteLength(input),
64
+ prefix: internalPrefix, suffix: config.suffix ?? '', status: 'available', artifactRoot: out, runs }
65
+ shrinkResults.push(row)
66
+ if (isBoundaryCandidate(row)) { high = middle; best = row } else low = middle
67
+ }
68
+ if (high - low > 1) throw new Error('bounded counterexample reduction exhausted invocation coverage')
69
+ reduced = best
70
+ }
71
+ const report = assembleBoundaryReport({ source: sourcePath,
72
+ provenance: { trustedRoot: root, repoSlug: config.repoSlug,
73
+ baseSha: provenance.baseSha, headSha: provenance.headSha,
74
+ sources: Object.fromEntries(Object.entries(sources).map(([role, source]) => [role,
75
+ { commit: source.commit, sha256: source.sha256 }])) },
76
+ seed: config.seed, componentLimit, prefixSha256: sha256(internalPrefix),
77
+ suffixSha256: sha256(config.suffix ?? ''), cases, results, shrinkResults, outputDir: out, reduced })
78
+ report.contract = { ...report.contract, operation: config.operation ?? 'node-fs.mkdtempSync.filename',
79
+ expectedProperty: config.expectedProperty ?? 'valid ASCII targets produce a component within the observed byte limit',
80
+ generator: 'seeded ASCII slug boundary lengths with bounded binary shrink',
81
+ applicability: 'source path must appear in observed changed paths', invocationBudget: { inputs: config.maxInputs ?? 32, shrinkSteps: 10, timeoutMs: 5000 } }
82
+ report.provenance.adapterSha256 = sha256(readFileSync(fileURLToPath(new URL('./boundary-probe.mjs', import.meta.url))))
83
+ report.provenance.generatorSha256 = sha256(readFileSync(fileURLToPath(new URL('./boundary-cases.mjs', import.meta.url))))
84
+ report.provenance.moduleSha256 = hashBoundaryHelpers(import.meta.url)
85
+ report.provenance.runtime = process.version
86
+ const bytes = Buffer.from(JSON.stringify(report, null, 2) + '\n')
87
+ writeFileSync(join(out, 'boundary-report.json'), bytes)
88
+ return { ...report, reportSha256: sha256(bytes), reportFile: join(out, 'boundary-report.json') }
89
+ } catch (error) {
90
+ return unavailable(`trusted boundary probe failed: ${error.message}`)
91
+ }
92
+ }