diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index 2e81b95..7cabd3b 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -40,5 +40,6 @@ ], "brandColor": "#111111", "logo": "./assets/icon.svg" - } + }, + "commit": "338650f5324cd04607ab3e55fea32af56a3dbbbf" } diff --git a/.codex-plugin/skills-source.json b/.codex-plugin/skills-source.json new file mode 100644 index 0000000..aaffcb3 --- /dev/null +++ b/.codex-plugin/skills-source.json @@ -0,0 +1,11 @@ +{ + "scope": "bundled-skills", + "repository": "https://github.com/ADanMan/clueless", + "commit": "338650f5324cd04607ab3e55fea32af56a3dbbbf", + "files": { + "skills/clueless-blindspots/SKILL.md": "549be42c82dc0d5a2fff314232767861508d1c920aac5be6a4194935a2dd8175", + "skills/clueless-help/SKILL.md": "83ab61f2abe2b3560d58f792a7fe076987f617cded7a7154648e70cd07aef0b1", + "skills/clueless/SKILL.md": "ab9bccf1b9a21fdaf48522ff0622ff1c7bea04fafbe064d58f92b028a3c13209", + "skills/clueless/references/user-patterns.md": "93a8463021e745d12c9a45735943b5a37a6992ce461c98672ada1b04ee6affae" + } +} diff --git a/docs/skill-provenance.md b/docs/skill-provenance.md new file mode 100644 index 0000000..2efabdb --- /dev/null +++ b/docs/skill-provenance.md @@ -0,0 +1,29 @@ +# Bundled skill source snapshot + +`.codex-plugin/skills-source.json` records the public repository, immutable +commit and SHA-256 of every bundled file under `skills/`. The Codex manifest's +`commit` refers to this **skill snapshot**, not to the whole plugin checkout. +The metadata and hash record are added after the source commit so that the +reference does not try to name its own future Git hash. + +`npm test` checks complete file coverage and content hashes without requiring +Git history, so it also works in a shallow checkout or unpacked source archive. To +compare against the actual Git source, the pinning script reads every tracked +skill file from the named commit and refuses a content mismatch before writing +metadata. + +When changing skills or their references: + +1. Commit the skill changes first. +2. Run `node scripts/pin-skill-source.js "$(git rev-parse HEAD)"`. +3. Run `npm test`, then commit the updated manifest and snapshot record. + +Keep both commits in published history; a squash that removes the referenced +commit would require refreshing the snapshot against a retained source commit. + +This record establishes reproducible source provenance. It is not a security +certification or signed trust attestation. The package does not declare +`verified: true`. In plugin-scanner 2.0.1116, the local +`verification.review-status` adapter checks that boolean alone; passing tests, +an automated scan and code review should not be presented as independent +certification of every future use of a prompt. diff --git a/scripts/pin-skill-source.js b/scripts/pin-skill-source.js new file mode 100644 index 0000000..4b65bc5 --- /dev/null +++ b/scripts/pin-skill-source.js @@ -0,0 +1,33 @@ +#!/usr/bin/env node +// Pin only an existing commit whose tracked skill files match this checkout. +const { execFileSync } = require('node:child_process'); +const { createHash } = require('node:crypto'); +const fs = require('node:fs'); +const path = require('node:path'); +const root = path.join(__dirname, '..'); +const commit = process.argv[2]; + +try { + if (!/^[0-9a-f]{40}$/.test(commit || '')) throw new Error('Pass the full 40-character source commit SHA.'); + const git = (...args) => execFileSync('git', args, { cwd: root }); + git('cat-file', '-e', `${commit}^{commit}`); + const names = git('ls-tree', '-r', '-z', '--name-only', commit, '--', 'skills/').toString().split('\0').filter(Boolean).sort(); + if (!names.length) throw new Error('The source commit has no skill files.'); + const files = {}; + for (const name of names) { + const original = git('show', `${commit}:${name}`); + const current = fs.readFileSync(path.join(root, name)); + if (!original.equals(current)) throw new Error(`${name} differs from the source commit; commit the skill changes first.`); + files[name] = createHash('sha256').update(original).digest('hex'); + } + const manifestPath = path.join(root, '.codex-plugin/plugin.json'); + const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')); + const source = { scope: 'bundled-skills', repository: manifest.repository, commit, files }; + manifest.commit = commit; + fs.writeFileSync(path.join(root, '.codex-plugin/skills-source.json'), JSON.stringify(source, null, 2) + '\n'); + fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n'); + console.log(`Pinned ${names.length} skill files to ${commit}. Run npm test to check complete coverage.`); +} catch (error) { + console.error(error.message); + process.exitCode = 1; +} diff --git a/skills/clueless-blindspots/SKILL.md b/skills/clueless-blindspots/SKILL.md index 1e90b53..696f6d4 100644 --- a/skills/clueless-blindspots/SKILL.md +++ b/skills/clueless-blindspots/SKILL.md @@ -1,13 +1,10 @@ --- name: clueless-blindspots -description: > - Use when the user asks what they are not seeing, what they forgot, what could - go wrong, or what an expert would say about a plan, decision, document, code - change, or setup they already have. Triggers: "what am I missing", "what - don't I know", "poke holes in this", "what would an expert ask", "что я - упускаю", "что я не вижу", or /clueless-blindspots. One-shot review; does not - change the always-on level. +description: "Use when the user asks what they are not seeing, what they forgot, what could go wrong, or what an expert would say about a plan, decision, document, code change, or setup they already have. Triggers: \"what am I missing\", \"what don't I know\", \"poke holes in this\", \"what would an expert ask\", \"что я упускаю\", \"что я не вижу\", or /clueless-blindspots. One-shot review; does not change the always-on level." license: MIT +metadata: + tags: "risk-review, decision-review, verification" + languages: "en" --- Review the thing in front of you as the expert the user doesn't have. Find diff --git a/skills/clueless-help/SKILL.md b/skills/clueless-help/SKILL.md index 797ea7a..9a1fae3 100644 --- a/skills/clueless-help/SKILL.md +++ b/skills/clueless-help/SKILL.md @@ -1,9 +1,10 @@ --- name: clueless-help -description: > - Use when the user asks how clueless works, what its commands or levels are, - or types /clueless-help. +description: "Use when the user asks how clueless works, what its commands or levels are, or types /clueless-help." license: MIT +metadata: + tags: "command-reference, reviewability, agent-skills" + languages: "en" --- Answer with this table and nothing else. diff --git a/skills/clueless/SKILL.md b/skills/clueless/SKILL.md index 705870c..6b3e019 100644 --- a/skills/clueless/SKILL.md +++ b/skills/clueless/SKILL.md @@ -1,13 +1,11 @@ --- name: clueless -description: > - Use when the user explicitly cannot review the output in the current domain, - says they do not understand it or will copy-paste without checking, or requests - clueless mode. Examples: "I know nothing about this", "не разбираюсь", - "сделай за меня". Brevity, "make it nice", and delegation alone do not establish - a knowledge gap. +description: "Use when the user explicitly cannot review the output in the current domain, says they do not understand it or will copy-paste without checking, or requests clueless mode. Examples: \"I know nothing about this\", \"не разбираюсь\", \"сделай за меня\". Brevity, \"make it nice\", and delegation alone do not establish a knowledge gap." argument-hint: "[lite|full|ultra]" license: MIT +metadata: + tags: "reviewability, safe-defaults, verification" + languages: "en" --- # Clueless diff --git a/tests/rules.test.js b/tests/rules.test.js index b120013..22f8321 100644 --- a/tests/rules.test.js +++ b/tests/rules.test.js @@ -3,6 +3,7 @@ const assert = require('node:assert'); const { execFileSync } = require('node:child_process'); const fs = require('node:fs'); const path = require('node:path'); +const { createHash } = require('node:crypto'); const root = path.join(__dirname, '..'); test('rule copies are in sync', () => { @@ -23,6 +24,32 @@ test('plugin manifests agree on version', () => { assert.strictEqual(v('.codex-plugin/plugin.json'), v('package.json')); }); +test('bundled skills match their pinned source snapshot', () => { + const manifest = JSON.parse(fs.readFileSync(path.join(root, '.codex-plugin/plugin.json'), 'utf8')); + const source = JSON.parse(fs.readFileSync(path.join(root, '.codex-plugin/skills-source.json'), 'utf8')); + assert.strictEqual(source.repository, manifest.repository); + assert.match(source.commit, /^[0-9a-f]{40}$/); + assert.strictEqual(source.commit, manifest.commit); + const files = []; + const walk = (dir) => { + for (const entry of fs.readdirSync(path.join(root, dir), { withFileTypes: true })) { + const file = `${dir}/${entry.name}`; + if (entry.isDirectory()) walk(file); + else { + assert.ok(entry.isFile(), `skill snapshot cannot contain a symlink: ${file}`); + files.push(file); + } + } + }; + walk('skills'); + assert.ok(files.length > 0); + assert.deepStrictEqual(Object.keys(source.files).sort(), files.sort(), 'source snapshot must cover every bundled skill file'); + for (const file of files) { + const hash = createHash('sha256').update(fs.readFileSync(path.join(root, file))).digest('hex'); + assert.strictEqual(hash, source.files[file], `refresh the source snapshot after changing ${file}`); + } +}); + test('catalog screenshots resolve to bundled PNG previews', () => { const { interface: ui } = JSON.parse(fs.readFileSync(path.join(root, '.codex-plugin/plugin.json'), 'utf8')); assert.ok(Array.isArray(ui.screenshots) && ui.screenshots.length > 0, 'catalog preview is missing');