agent-personalizer 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ Every entry names the adversarial audit round that produced it where one did. Au
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.9.1] - 2026-11-10
10
+
11
+ ### Security
12
+
13
+ - Harden release automation, HTML sanitization and privacy checks.
14
+
9
15
  ## [0.9.0] - 2026-11-04
10
16
 
11
17
  ### Added
@@ -366,7 +372,8 @@ Thirteen issues (#3 to #15) filed against `5972b32` by an independent installati
366
372
  - Installer: safe destination resolution, strict options, duplicate `--ai` refused, `--dir` created one level at a time.
367
373
  - Harness: exact exit codes, adversarial fixtures, fault injection for the rollback path.
368
374
 
369
- [Unreleased]: https://github.com/aunysillyme/agent-personalizer/compare/v0.9.0...HEAD
375
+ [Unreleased]: https://github.com/aunysillyme/agent-personalizer/compare/v0.9.1...HEAD
376
+ [0.9.1]: https://github.com/aunysillyme/agent-personalizer/compare/v0.9.0...v0.9.1
370
377
  [0.9.0]: https://github.com/aunysillyme/agent-personalizer/compare/v0.8.7...v0.9.0
371
378
  [0.8.7]: https://github.com/aunysillyme/agent-personalizer/compare/v0.8.6...v0.8.7
372
379
  [0.8.6]: https://github.com/aunysillyme/agent-personalizer/compare/v0.8.5...v0.8.6
package/RELEASING.md CHANGED
@@ -6,14 +6,15 @@ Maintainer notes. Follow the steps below for version sites, rendering, checks an
6
6
  2. Move `[Unreleased]` to `[X.Y.Z] - YYYY-MM-DD`, add the compare link at the bottom, and point the `[Unreleased]` link at `vX.Y.Z...HEAD`.
7
7
  3. Set the version in the three places the harness pins together: `package.json`, `const VERSION` in `render/onboarding.cjs` (it builds the docs URL every installed file links to), and the tiers link in `hooks/README.md`.
8
8
  4. Re-render the example, because its files carry that version-keyed docs URL: `node render/render.cjs --dir examples/freelance-illustrator`, then the same command with `--check` must print nothing. Skipping this step is the one thing that has turned a release commit red, twice.
9
- 5. `sh test/run.sh` green locally (the count guard included). Push `main`; CI green on that commit.
10
- 6. `git tag -a vX.Y.Z -m "X.Y.Z: <one line>"` and `git push origin main vX.Y.Z`.
11
- 7. `gh release create vX.Y.Z --title X.Y.Z --notes "<the changelog section>"`.
12
- 8. `gh workflow run publish.yml --ref main -f tag=vX.Y.Z`, then `gh run watch <run id> --exit-status`.
9
+ 5. Before a public flip, and after any history rewrite, run `node check/gate.cjs --history` with the maintainer private list and review each reported location. On this repo's existing public history it reports known fixture and hash strings, so here it is a review step and its exit code does not gate a release.
10
+ 6. `sh test/run.sh` green locally (the count guard included). Push `main`; CI green on that commit.
11
+ 7. `git tag -a vX.Y.Z -m "X.Y.Z: <one line>"` and `git push origin main vX.Y.Z`.
12
+ 8. `gh release create vX.Y.Z --title X.Y.Z --notes "<the changelog section>"`.
13
+ 9. `gh workflow run publish.yml --ref main -f tag=vX.Y.Z`, then `gh run watch <run id> --exit-status`.
13
14
 
14
15
  **Verify.** `npm view agent-personalizer@X.Y.Z version` prints `X.Y.Z` (query the exact version: the bare `npm view agent-personalizer version` can lag a minute behind the run), and `https://registry.npmjs.org/-/npm/v1/attestations/agent-personalizer@X.Y.Z` returns a Sigstore bundle. In a fresh temp dir, `npx --yes agent-personalizer@X.Y.Z --version` prints the new version.
15
16
 
16
- **How `publish.yml` works.** Manual `workflow_dispatch` with the tag as its input, live since 0.4.1. 0.4.0 was published by hand from the tag checkout by a logged-in maintainer (`npm publish --access public`, no provenance is possible from a laptop), because npm only lets a trusted publisher be configured in the settings of a package that already exists. The job resolves the input through `refs/tags/` and checks out that commit by SHA, so a branch with a tag-like name cannot be published; the tag must equal the `package.json` version; it runs on Node 24 and fails unless the bundled npm is 11.5.1 or later (the trusted-publishing minimum; no global npm install, since 0.8.4), runs the harness, then `npm publish --provenance --access public` with `id-token: write`. No npm token is stored anywhere. The trusted publisher on npm is GitHub Actions, this repository, workflow file `publish.yml`, direct publish allowed.
17
+ **How `publish.yml` works.** Manual `workflow_dispatch` with the tag as its input, live since 0.4.1. 0.4.0 was published by hand from the tag checkout by a logged-in maintainer (`npm publish --access public`, no provenance is possible from a laptop), because npm only lets a trusted publisher be configured in the settings of a package that already exists. The job resolves the input through `refs/tags/` and checks out that commit by SHA, so a branch with a tag-like name cannot be published; the tag must equal the `package.json` version; it runs on Node 24 and fails unless the bundled npm is 11.5.1 or later (the trusted-publishing minimum; no global npm install, since 0.8.4), runs the harness, packs and smoke-tests one tarball, then uploads it for a separate job to publish with `id-token: write`. No npm token is stored anywhere. The trusted publisher on npm is GitHub Actions, this repository, workflow file `publish.yml`, direct publish allowed.
17
18
 
18
19
  **Two things GitHub will not tell you.** A workflow file it cannot parse is dropped silently: `gh workflow run` says the workflow has no `workflow_dispatch` trigger, and the workflow list shows the file path where its name should be. It happened here once over an unquoted `: ` in a step name; the harness now parses both workflow files. This guide ships in the tarball so its offline links work. Workflow-only changes can land without a package release.
19
20
 
package/check/gate.cjs CHANGED
@@ -9,6 +9,7 @@
9
9
 
10
10
  usage:
11
11
  node check/gate.cjs [--dir <root>] [--list <file>] scan; exit 0 clean, 1 on hits, 2 on setup error
12
+ node check/gate.cjs --history [--dir <root>] [--list <file>] scan current files and reachable history
12
13
  node check/gate.cjs --self-test prove the gate can go red on a seeded hit
13
14
  node check/gate.cjs --help | -h · --version | -v
14
15
 
@@ -33,7 +34,9 @@
33
34
  A working-tree path whose parent directory is a symlink is NOT read (the file would be outside
34
35
  the scan root); the index blob for that path is still scanned, and the skip is counted and
35
36
  printed. What this gate is: a check for the exact strings you listed. What it is not: a proof
36
- that no personal data ships. Unknown terms, history and binary files are outside it.
37
+ that no personal data ships. Unknown terms and binary files in the working tree are outside it. --history also
38
+ checks reachable blobs, filenames, commit messages and tag names, including binary blobs,
39
+ against the list, private home paths and credential-shaped strings.
37
40
  */
38
41
  const fs = require('fs');
39
42
  const path = require('path');
@@ -41,11 +44,15 @@ const os = require('os');
41
44
  const { execFileSync } = require('child_process');
42
45
 
43
46
  const SKIP_DIRS = new Set(['.git']); // --all means every file; git mode lets .gitignore decide about node_modules
47
+ const PRIVATE_CLASSES = [
48
+ ['P_PATH', /\/(?:Users|home)\/(?!you\b|user\b|example\b|runner\b|name\b)[^/\s"'`),;]+/i],
49
+ ['P_TOKEN', /(?<![A-Za-z0-9_-])(?:(?:gh[pousr]_|github_pat_|npm_)[A-Za-z0-9_]{20,}|sk-(?:proj-)?[A-Za-z0-9_-]{20,}|AKIA[A-Z0-9]{16}|xox[baprs]-[A-Za-z0-9-]{20,}|AIza[A-Za-z0-9_-]{30,})|-----BEGIN (?:RSA |EC |OPENSSH |DSA )?PRIVATE KEY-----/]
50
+ ];
44
51
 
45
52
  function die(msg) { console.error(`GATE SETUP ERROR: ${msg}`); process.exit(2); }
46
53
 
47
54
  const VALUE_OPTS = ['--dir', '--list'];
48
- const FLAG_OPTS = ['--self-test', '--all', '--help', '-h', '--version', '-v'];
55
+ const FLAG_OPTS = ['--self-test', '--all', '--history', '--help', '-h', '--version', '-v'];
49
56
  /* Parse argv once, strictly: value options at most once each, flags at most once, nothing unknown. */
50
57
  function parseArgs() {
51
58
  const out = {};
@@ -154,6 +161,33 @@ function git(root, args, input) {
154
161
  return execFileSync('git', ['-C', root, ...args], { input, maxBuffer: 1 << 28 });
155
162
  }
156
163
 
164
+ /* Scan every reachable object and every name in every reachable tree. A git failure,
165
+ malformed object or oversized response refuses the scan rather than dropping coverage. */
166
+ function* historyItems(root) {
167
+ const repo = git(root, ['rev-parse', '--show-toplevel']).toString('utf8').trim();
168
+ const commits = git(repo, ['rev-list', '--all']).toString('ascii').trim().split('\n').filter(Boolean);
169
+ const objects = git(repo, ['rev-list', '--objects', '--all', '--no-object-names']).toString('ascii').trim().split('\n').filter(Boolean);
170
+ for (const oid of commits) {
171
+ const bytes = git(repo, ['cat-file', 'commit', oid]);
172
+ const boundary = bytes.indexOf(Buffer.from('\n\n'));
173
+ if (boundary < 0) throw Error('malformed commit');
174
+ yield { rel: '', label: `history:${oid}:message`, bytes: bytes.subarray(boundary + 2), history: true };
175
+ const entries = git(repo, ['ls-tree', '-r', '-z', '--full-tree', oid]);
176
+ for (const entry of entries.toString('utf8').split('\0').filter(Boolean)) {
177
+ const tab = entry.indexOf('\t');
178
+ if (tab < 0) throw Error('malformed tree entry');
179
+ yield { rel: entry.slice(tab + 1), label: `history:${oid}:filename`, bytes: Buffer.alloc(0), history: true, nameOnly: true };
180
+ }
181
+ }
182
+ for (const oid of objects) {
183
+ if (!/^[0-9a-f]{40,64}$/.test(oid)) throw Error('malformed object id');
184
+ if (git(repo, ['cat-file', '-t', oid]).toString('ascii').trim() !== 'blob') continue;
185
+ yield { rel: '', label: `history:${oid}:blob`, bytes: git(repo, ['cat-file', 'blob', oid]), history: true };
186
+ }
187
+ const tags = git(repo, ['for-each-ref', '--format=%(refname:strip=2)', 'refs/tags']).toString('utf8').split('\n').filter(Boolean);
188
+ for (const tag of tags) yield { rel: tag, label: 'history:tag', bytes: Buffer.alloc(0), history: true, nameOnly: true };
189
+ }
190
+
157
191
  function* gitItems(root) {
158
192
  const stage = git(root, ['ls-files', '-z', '--stage']).toString('utf8');
159
193
  const cached = [];
@@ -265,7 +299,7 @@ function fileSet(root, all) {
265
299
  return { items: walkItems(root), mode: 'walk' };
266
300
  }
267
301
 
268
- function scan(root, list, listFile, all) {
302
+ function scan(root, list, listFile, all, history = false) {
269
303
  root = fs.realpathSync(root); // every caller, self-test included, compares real paths
270
304
  const hits = [];
271
305
  const scannedPaths = new Set();
@@ -276,22 +310,35 @@ function scan(root, list, listFile, all) {
276
310
  scan.mode = set.mode;
277
311
  // The list file is excluded by its exact resolved path, never by its display label, and
278
312
  // only as a working-tree copy: if git has it in the INDEX it would ship, so that is exit 2.
279
- for (const item of set.items) {
313
+ let items = set.items;
314
+ if (history) {
315
+ if (!insideGitRepo(root)) die('--history requires a git work tree');
316
+ try { items = [...items, ...historyItems(root)]; } catch (e) { die(`history enumeration failed: ${e.message}`); }
317
+ }
318
+ for (const item of items) {
280
319
  if (skipPath && path.resolve(root, item.rel) === skipPath) {
281
320
  if (/\(index/.test(item.label)) die(`the forbidden list itself is tracked by git (${item.rel}). It must never ship: run \`git rm --cached ${item.rel}\` and add it to .gitignore.`);
282
321
  continue;
283
322
  }
284
323
  files++;
324
+ if (history) {
325
+ for (const [rule, pattern] of PRIVATE_CLASSES) {
326
+ if (pattern.test(item.rel)) hits.push({ file: item.history ? item.label : '(path)', line: 0, rule });
327
+ if (!item.nameOnly) item.bytes.toString('utf8').split('\n').forEach((line, n) => {
328
+ if (pattern.test(line)) hits.push({ file: item.history ? item.label : item.rel, line: n + 1, rule });
329
+ });
330
+ }
331
+ }
285
332
  // the PATH first: one scan per item, labelled "(path)", never covered by allow spans of the text
286
- if (!scannedPaths.has(item.rel)) {
287
- scannedPaths.add(item.rel);
333
+ if (!scannedPaths.has(item.rel) || item.history) {
334
+ if (!item.history) scannedPaths.add(item.rel);
288
335
  const lower = item.rel.toLowerCase(), spans = allowedSpans(lower, list.allow);
289
336
  for (const term of list.terms) {
290
337
  const t = term.toLowerCase(); let i = lower.indexOf(t);
291
- while (i !== -1) { if (!spans.some(([x, y]) => i >= x && i + t.length <= y)) hits.push({ file: `${item.rel} (path)`, line: 0, term }); i = lower.indexOf(t, i + 1); }
338
+ while (i !== -1) { if (!spans.some(([x, y]) => i >= x && i + t.length <= y)) hits.push({ file: item.history ? item.label : `${item.rel} (path)`, line: 0, rule: 'P_LIST' }); i = lower.indexOf(t, i + 1); }
292
339
  }
293
340
  }
294
- if (isBinary(item.bytes)) continue;
341
+ if (!item.history && isBinary(item.bytes)) continue;
295
342
  const lines = item.bytes.toString('utf8').split('\n');
296
343
  lines.forEach((line, n) => {
297
344
  const lower = line.toLowerCase();
@@ -301,7 +348,7 @@ function scan(root, list, listFile, all) {
301
348
  let i = lower.indexOf(t);
302
349
  while (i !== -1) {
303
350
  const inside = spans.some(([a, b]) => i >= a && i + t.length <= b);
304
- if (!inside) hits.push({ file: item.label, line: n + 1, term });
351
+ if (!inside) hits.push({ file: item.label, line: n + 1, rule: 'P_LIST' });
305
352
  i = lower.indexOf(t, i + 1);
306
353
  }
307
354
  }
@@ -344,11 +391,23 @@ function main() {
344
391
  root = fs.realpathSync(root); // same canonical form as the list path, so the exclusion compares like with like
345
392
  const listFile = path.resolve(arg('--list', path.join(__dirname, 'forbidden.local.txt')));
346
393
  const all = !!arg('--all', false);
347
- const { hits, files, skipped } = scan(root, loadList(listFile), listFile, all);
348
- for (const k of skipped) console.log(`skipped ${k} (outside the scan root; not read)`);
394
+ const history = !!arg('--history', false);
395
+ let list;
396
+ if (history && !arg('--list', null)) {
397
+ try { fs.lstatSync(listFile); list = loadList(listFile); }
398
+ catch (e) { if (e.code === 'ENOENT') list = { terms: [], allow: [] }; else die(`cannot inspect private list (${e.code || 'unknown error'})`); }
399
+ } else list = loadList(listFile);
400
+ const redact = text => {
401
+ const clean = list.terms.reduce((value, term) => value.replace(new RegExp(term.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gi'), '[redacted]'), text);
402
+ return PRIVATE_CLASSES.some(([, pattern]) => pattern.test(clean)) ? '[redacted path]' : clean;
403
+ };
404
+ const { hits, files, skipped } = scan(root, list, listFile, all, history);
405
+ for (const k of skipped) console.log(`skipped ${redact(k)} (outside the scan root; not read)`);
349
406
  if (hits.length) {
350
407
  console.log(`GATE FAILED: ${hits.length} hit(s)`);
351
- for (const h of hits) console.log(` ${h.file}${h.line ? ':' + h.line : ''} "${h.term}"`);
408
+ for (const h of hits) {
409
+ console.log(` ${redact(h.file)}${h.line ? ':' + h.line : ''} ${h.rule}`);
410
+ }
352
411
  process.exit(1);
353
412
  }
354
413
  console.log(`gate clean: 0 hits across ${files} files, text and paths (${scan.mode === 'git' ? 'files git would ship, index blobs included' : 'every file under --dir'}; ${skipped.length} skipped)`);
@@ -52,6 +52,6 @@
52
52
  "installed": {
53
53
  "CLAUDE.md": "4a303e42182c9affef6bcf14cd77045fae24f02ff8f1fef7e1f84e8c03aef2f2",
54
54
  "AGENTS.md": "9cfedced547c961885e57814e3bc2f9122e16bfda2da0e5901dd61f3cf3f3bec",
55
- "AGENT_ONBOARDING.md": "ee4fc9f7711e0a0db261501dea9161e94a015cc4faedcb83a04867da5eca134a"
55
+ "AGENT_ONBOARDING.md": "bd8681ae5c859c49f4c1ab3dbf51f7ac6241906931f7449f7fcf79234465249a"
56
56
  }
57
57
  }
@@ -34,7 +34,7 @@ _Generated by agent-personalizer from your saved preferences (stored in `.agent-
34
34
 
35
35
  ### Where you may write
36
36
 
37
- - **Notes live in Obsidian:** reach them as the vault at `notes/`, through **obsidian-tc** (governed MCP: folder ACLs, human-in-the-loop confirmation for destructive tools, audit log) rather than raw filesystem access; see https://github.com/aunysillyme/agent-personalizer/blob/v0.9.0/docs/companions.md.
37
+ - **Notes live in Obsidian:** reach them as the vault at `notes/`, through **obsidian-tc** (governed MCP: folder ACLs, human-in-the-loop confirmation for destructive tools, audit log) rather than raw filesystem access; see https://github.com/aunysillyme/agent-personalizer/blob/v0.9.1/docs/companions.md.
38
38
  - You may create and edit files anywhere under `notes/`, under that folder's rules. Nowhere else without being asked.
39
39
  - **Every folder you write into has a README.** Any write, edit or delete means that README is corrected in the same pass: the file's one-line description, the folder's status, settled decisions, next steps. A stale index is worse than none, because the next agent believes it.
40
40
  - **Session log:** append a dated section to this week's note in `notes/sessions/`. **Decisions:** one line each in `notes/decisions.md`. **Inbox:** one file per item in `notes/inbox/`; finished items are deleted, not marked done.
package/hooks/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # hooks/
2
2
 
3
- Tier 3 from the tiers doc (https://github.com/aunysillyme/agent-personalizer/blob/v0.9.0/docs/tiers.md): the few rules that must be in context at the moment of decision, injected in full at the start of every session. Injection puts the text in front of the model; whether the model follows it is up to the model and the host. This is the strongest placement available, not a guarantee.
3
+ Tier 3 from the tiers doc (https://github.com/aunysillyme/agent-personalizer/blob/v0.9.1/docs/tiers.md): the few rules that must be in context at the moment of decision, injected in full at the start of every session. Injection puts the text in front of the model; whether the model follows it is up to the model and the host. This is the strongest placement available, not a guarantee.
4
4
 
5
5
  Which rules? The ones with `inject: true` in their frontmatter. Keep that set small. Every injected rule costs tokens every session.
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-personalizer",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "AI custom instructions from approved entries: a profile and rules for Claude Code, Codex, Cursor, Gemini CLI, Hermes Agent and ChatGPT, kept in sync from one source.",
5
5
  "author": "aunysillyme (https://github.com/aunysillyme)",
6
6
  "license": "MIT",
@@ -17,7 +17,7 @@
17
17
  DOCS points at the matching tag on GitHub so an installed copy never links to a file the
18
18
  destination does not have.
19
19
  */
20
- const VERSION = '0.9.0';
20
+ const VERSION = '0.9.1';
21
21
  const DOCS = `https://github.com/aunysillyme/agent-personalizer/blob/v${VERSION}/docs`;
22
22
 
23
23
  /* THE single source for notes tools. Add a tool here and nowhere else: the saved choice option, the