agent-personalizer 0.8.4 → 0.8.6

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 (35) hide show
  1. package/CHANGELOG.md +26 -2
  2. package/CONTRIBUTING.md +2 -2
  3. package/README.md +5 -3
  4. package/SECURITY.md +1 -1
  5. package/bin/agent-personalizer.js +6 -4
  6. package/bin/git-exclude.cjs +1 -1
  7. package/bin/global.cjs +10 -5
  8. package/bin/learn.cjs +2 -0
  9. package/bin/sessions.cjs +16 -1
  10. package/docs/install.md +5 -3
  11. package/docs/learning.md +8 -5
  12. package/docs/paste-guide.md +2 -1
  13. package/docs/tiers.md +1 -1
  14. package/examples/freelance-illustrator/.agent-personalizer.json +3 -3
  15. package/examples/freelance-illustrator/AGENTS.md +1 -1
  16. package/examples/freelance-illustrator/AGENT_ONBOARDING.md +2 -2
  17. package/examples/freelance-illustrator/CLAUDE.md +1 -1
  18. package/examples/freelance-illustrator/rules/30-folder-index-is-part-of-the-change.md +2 -2
  19. package/examples/lab-technician/.agent-personalizer.json +3 -3
  20. package/examples/lab-technician/AGENTS.md +1 -1
  21. package/examples/lab-technician/AGENT_ONBOARDING.md +1 -1
  22. package/examples/lab-technician/CLAUDE.md +1 -1
  23. package/examples/lab-technician/rules/30-folder-index-is-part-of-the-change.md +2 -2
  24. package/examples/product-designer/.agent-personalizer.json +3 -3
  25. package/examples/product-designer/AGENTS.md +1 -1
  26. package/examples/product-designer/AGENT_ONBOARDING.md +1 -1
  27. package/examples/product-designer/CLAUDE.md +1 -1
  28. package/examples/product-designer/rules/30-folder-index-is-part-of-the-change.md +2 -2
  29. package/hooks/README.md +5 -3
  30. package/llms.txt +2 -0
  31. package/package.json +1 -1
  32. package/render/onboarding.cjs +6 -3
  33. package/render/render.cjs +2 -2
  34. package/render/targets.json +8 -0
  35. package/rules/30-folder-index-is-part-of-the-change.md +2 -2
package/CHANGELOG.md CHANGED
@@ -2,10 +2,32 @@
2
2
 
3
3
  All notable changes to this repo. Format after [Keep a Changelog](https://keepachangelog.com/en/2.0.0/) 2.0.0; versions follow [SemVer](https://semver.org/). Dates are the day the change was pushed.
4
4
 
5
- Every entry names the adversarial audit round that produced it where one did. Audits are read-only passes against `AUDIT_BRIEF.md`; every finding is reproduced before its fix.
5
+ Every entry names the adversarial audit round that produced it where one did. Audits are read-only passes against the stated release scope; every finding is reproduced before its fix.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.8.6] - 2026-11-03
10
+
11
+ ### Added
12
+
13
+ - Add Hermes Agent as a global target with a marked block in `~/.hermes/SOUL.md`; project installs use the `agents` target.
14
+
15
+ ## [0.8.5] - 2026-10-29
16
+
17
+ ### Fixed
18
+
19
+ - Audit 2026-10-29: find Claude Code sessions for project paths with spaces, dots and underscores while retaining legacy folder names.
20
+ - Audit 2026-10-29: skip whole messages and Codex memory notes that match conservative secret patterns, reporting only the skip count.
21
+ - Audit 2026-10-29: apply the 2,000-character message cap to Codex memory notes, retaining private-term filtering and the 20-file cap.
22
+ - Audit 2026-10-29: disclose global Codex memory scope and secret skips in consent, and document both project and global private lists.
23
+ - Audit 2026-10-29: preserve intra-word underscores in read-first filenames while escaping hostile Markdown.
24
+ - Audit 2026-10-29: refuse local notes paths containing .git, .github or node_modules segments, ignoring case.
25
+ - Audit 2026-10-29: remove the uninstalled folder-template path from rendered home files and refresh all three examples.
26
+ - Audit 2026-10-29: register the project session-start hook through CLAUDE_PROJECT_DIR so it runs from subfolders, and explain user-level absolute paths.
27
+ - Audit 2026-10-29: align memory status, global learning help, level errors, AI target contribution steps and symlink guidance with supported behaviour; remove the inaccessible audit-brief citation.
28
+ - Audit 2026-10-29: warn that profile and off-limits names enter home files that may be committed.
29
+ - Audit 2026-10-29: use short temporary bases for session-path fixtures so deep TMPDIR paths do not cause false failures.
30
+
9
31
  ## [0.8.4] - 2026-10-28
10
32
 
11
33
  ### Added
@@ -331,7 +353,9 @@ Thirteen issues (#3 to #15) filed against `5972b32` by an independent installati
331
353
  - Installer: safe destination resolution, strict options, duplicate `--ai` refused, `--dir` created one level at a time.
332
354
  - Harness: exact exit codes, adversarial fixtures, fault injection for the rollback path.
333
355
 
334
- [Unreleased]: https://github.com/aunysillyme/agent-personalizer/compare/v0.8.4...HEAD
356
+ [Unreleased]: https://github.com/aunysillyme/agent-personalizer/compare/v0.8.6...HEAD
357
+ [0.8.6]: https://github.com/aunysillyme/agent-personalizer/compare/v0.8.5...v0.8.6
358
+ [0.8.5]: https://github.com/aunysillyme/agent-personalizer/compare/v0.8.4...v0.8.5
335
359
  [0.8.4]: https://github.com/aunysillyme/agent-personalizer/compare/v0.8.3...v0.8.4
336
360
  [0.8.3]: https://github.com/aunysillyme/agent-personalizer/compare/v0.8.2...v0.8.3
337
361
  [0.8.2]: https://github.com/aunysillyme/agent-personalizer/compare/v0.8.1...v0.8.2
package/CONTRIBUTING.md CHANGED
@@ -10,7 +10,7 @@ Contributions are welcome: a **new AI target**, a **notes tool**, an **example u
10
10
  ## Running the checks
11
11
 
12
12
  ```bash
13
- npm test # sh test/run.sh: 98 checks, exact exit codes, Linux and macOS
13
+ npm test # sh test/run.sh: 99 checks, exact exit codes, Linux and macOS
14
14
  node test/rollback.test.js "$(mktemp -d)" # after copying examples/freelance-illustrator into it
15
15
  node check/gate.cjs --self-test
16
16
  ```
@@ -26,7 +26,7 @@ The privacy gate (`check/gate.cjs` against a real list) needs a local `check/for
26
26
  ## Adding a notes tool or an AI target
27
27
 
28
28
  - A notes tool is ONE entry in the `TOOL` table at the top of `render/onboarding.cjs` (`kind`, `label`, `name`, `reach`, `posture`); the interview option, the validation and the write section all derive from it. Then a row in `docs/companions.md`, and an installer hint in `bin/agent-personalizer.js` if the tool needs one. Check 60 in the harness iterates every option; add yours to the right loop. Check 74 asserts the interview options equal the table's keys.
29
- - An AI target is an entry in `render/targets.json` plus a row in `docs/paste-guide.md`. If it has a binding, add `binding:<name>` blocks to the rules that need one; unknown binding names are refused.
29
+ - An AI target needs an entry in `render/targets.json`, a row in `docs/paste-guide.md`, and updates to the hardcoded AI lists: `AIS` and `AI_LABEL` in `bin/agent-personalizer.js`, the supported targets in `bin/global.cjs`, the learning and contract target lists in `render/render.cjs`, and `SOURCE` in `bin/learn.cjs`. Set the target's supported modes and local session source where applicable. If it has a binding, add `binding:<name>` blocks to the rules that need one; unknown binding names are refused.
30
30
 
31
31
  ## Pull requests
32
32
 
package/README.md CHANGED
@@ -56,6 +56,8 @@ File generation, re-runs and uninstall run in CI on Linux, macOS and Windows; yo
56
56
  | [model-orchestrator](https://github.com/aunysillyme/model-orchestrator) | Model router for AI coding agents: routes routine work to cheaper models with routing rules, 8 subagents, hooks and a CLI runner |
57
57
  | [repo-build-skill](https://github.com/aunysillyme/repo-build-skill) | Skill pack that teaches your AI to build, release and launch a GitHub repo: stack pick, README, AGENTS.md, llms.txt, repo SEO and AEO, trusted publishing. |
58
58
  | [website-build-skill](https://github.com/aunysillyme/website-build-skill) | A skill pack that turns your AI into an expert website builder: current research, design, code, accessibility, speed, SEO and security, alone or as a team. |
59
+ | [lean-browser-use](https://github.com/aunysillyme/lean-browser-use) | Cut browser use cost by about 25% in Claude Code: fresh runner subagent, bulk reads, three guards and a token meter. One npx command |
60
+ | [lean-computer-use](https://github.com/aunysillyme/lean-computer-use) | Background Mac computer control for AI agents: desk tools, a fresh runner subagent, retry guards and a transcript token meter, installed with one command |
59
61
  <!-- set:end -->
60
62
 
61
63
  ## Choose your setup
@@ -77,10 +79,10 @@ npx agent-personalizer --dir . --ai claude,agents --level 1 --yes --defaults
77
79
  For every project, install one global level-1 profile:
78
80
 
79
81
  ```bash
80
- npx agent-personalizer --global --ai claude,agents,gemini --yes
82
+ npx agent-personalizer --global --ai claude,agents,gemini,hermes --yes
81
83
  ```
82
84
 
83
- The source lives in `~/.agent-personalizer/`; marked blocks go to `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md` and `~/.gemini/GEMINI.md`. User text outside the blocks stays byte for byte. `--global` supports those three targets and level 1; it excludes `--dir`. Re-run with `--global`, learn across all projects with `learn --global`, and remove owned global content with `--global --uninstall`. See [global installation](docs/install.md#every-project-with-one-profile).
85
+ The source lives in `~/.agent-personalizer/`; marked blocks go to `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md`, `~/.gemini/GEMINI.md` and `~/.hermes/SOUL.md` for the selected targets. User text outside the blocks stays byte for byte. For Hermes in a project, use `--ai agents` for `AGENTS.md`. `--global` supports these four targets and level 1; it excludes `--dir`. Re-run with `--global`, learn across all projects with `learn --global`, and remove owned global content with `--global --uninstall`. See [global installation](docs/install.md#every-project-with-one-profile).
84
86
 
85
87
  Levels 1 and 2 carry the Core 5: read the profile first, evidence before assertion, output style, act or ask, and ask before it repeats. Level 3 retains all eleven, with each target's existing surface and signature selection.
86
88
 
@@ -211,7 +213,7 @@ Contributions are welcome: a new AI target, a notes tool, an example user, or a
211
213
 
212
214
  Pull requests are accepted under the [contributor license agreement](CLA.md); the checkbox in the pull request template records your agreement.
213
215
 
214
- The harness (`test/run.sh: 98 checks`) tests exact exit codes and adversarial fixtures. The real forbidden-list check stays local and prints a skip when the private list is absent.
216
+ The harness (`test/run.sh: 99 checks`) tests exact exit codes and adversarial fixtures. The real forbidden-list check stays local and prints a skip when the private list is absent.
215
217
 
216
218
  ## License
217
219
 
package/SECURITY.md CHANGED
@@ -18,4 +18,4 @@ In scope: `bin/`, including session reading, learning and removal, `render/`, `c
18
18
 
19
19
  ## What is already done
20
20
 
21
- Every release passes an adversarial read-only audit (see `CHANGELOG.md`, each entry names its round) and a 98-check harness with exact exit codes, on Linux and macOS in CI. The deferred residuals are stated in the code headers: TOCTOU between check and write, unicode look-alikes in the gate, the named `--dir` being followed once via realpath, and a hard process kill between two renames. On Windows, `O_NOFOLLOW` is unavailable to the flag the uninstaller opens tracked files with; nothing depends on it there, because the delete loop re-probes every path with `lstat` immediately before each unlink, so no destructive path exists without it.
21
+ Every release passes an adversarial read-only audit (see `CHANGELOG.md`, each entry names its round) and a 99-check harness with exact exit codes, on Linux and macOS in CI. The deferred residuals are stated in the code headers: TOCTOU between check and write, unicode look-alikes in the gate, the named `--dir` being followed once via realpath, and a hard process kill between two renames. On Windows, `O_NOFOLLOW` is unavailable to the flag the uninstaller opens tracked files with; nothing depends on it there, because the delete loop re-probes every path with `lstat` immediately before each unlink, so no destructive path exists without it.
@@ -24,7 +24,7 @@ const onboarding = require(path.join(PKG, 'render', 'onboarding.cjs'));
24
24
  const markers = require(path.join(PKG, 'render', 'render.cjs')); // markerState, for the preflight; render.cjs runs nothing on require
25
25
  const { installPlan, validateInventory, knownVersions, ownership, migrateHome, recordedHash } = require('./install-plan.cjs');
26
26
  const AIS = ['claude', 'agents', 'gemini', 'chatgpt', 'prompt'];
27
- const AI_LABEL = { claude: 'Claude (Claude Code, Claude apps)', agents: 'Codex / Cursor / anything that reads AGENTS.md', gemini: 'Gemini', chatgpt: 'ChatGPT custom instructions', prompt: 'a plain system prompt (shareable, no profile)' };
27
+ const AI_LABEL = { claude: 'Claude (Claude Code, Claude apps)', agents: 'Codex / Cursor / Hermes / anything that reads AGENTS.md', gemini: 'Gemini', chatgpt: 'ChatGPT custom instructions', prompt: 'a plain system prompt (shareable, no profile)' };
28
28
 
29
29
  let committing = false;
30
30
  function die(msg) { if (committing) throw new markers.Refusal(msg); console.error(`agent-personalizer: ${msg}`); process.exit(2); }
@@ -36,11 +36,12 @@ const USAGE = `agent-personalizer ${require(path.join(PKG, 'package.json')).vers
36
36
  npx agent-personalizer [--dir <folder>] [--ai claude,agents,gemini,chatgpt,prompt] [--level 1|2|3]
37
37
  [--answers <file.json> | --answers - | --defaults] [--full] [--yes]
38
38
  [--help | -h] [--version | -v]
39
- npx agent-personalizer --global [--ai claude,agents,gemini] [--yes]
39
+ npx agent-personalizer --global [--ai claude,agents,gemini,hermes] [--yes]
40
40
  npx agent-personalizer --global --uninstall [--dry]
41
41
  npx agent-personalizer --uninstall --dir <folder> [--dry]
42
42
 
43
43
  npx agent-personalizer learn [--dir <folder>] [--all-projects] [--yes]
44
+ npx agent-personalizer learn --global [--yes]
44
45
  npx agent-personalizer learn --forget [--dir <folder>]
45
46
 
46
47
  First interactive install: choose your AIs, then choose whether to read your recent sessions.
@@ -142,7 +143,7 @@ function readConfig(root, level) {
142
143
  if (!cfg || typeof cfg !== 'object' || Array.isArray(cfg)) die('.agent-personalizer.json must be an object');
143
144
  if ('targets' in cfg) {
144
145
  if (!Array.isArray(cfg.targets)) die('.agent-personalizer.json "targets" must be a list');
145
- const KNOWN = [...AIS, 'onboarding'];
146
+ const KNOWN = [...AIS, 'hermes', 'onboarding'];
146
147
  const bad = cfg.targets.filter(t => !KNOWN.includes(t));
147
148
  if (bad.length) die(`.agent-personalizer.json lists unknown target(s): ${bad.join(', ')} (known: ${KNOWN.join(', ')}); fix or remove them`);
148
149
  if (new Set(cfg.targets).size !== cfg.targets.length) die('.agent-personalizer.json lists a target twice');
@@ -251,6 +252,7 @@ async function commitPlan(root, { writes, removals = [], outputPaths, prepare, f
251
252
 
252
253
  async function main() {
253
254
  if (ARGS['--global']) return require('./global.cjs').run({ args: ARGS, commitPlan, probe, readConfig, ask });
255
+ if (ARGS['--ai'] && ARGS['--ai'].split(',').some(t => t.trim() === 'hermes')) die('Hermes reads AGENTS.md inside a project; use --ai agents (or --global --ai hermes for every Hermes session).');
254
256
  if (ARGS.command === 'learn') {
255
257
  for (const opt of ['--ai', '--level', '--answers', '--defaults', '--quick', '--full', '--uninstall', '--dry'])
256
258
  if (opt in ARGS) die(`${opt} is not a learn option`);
@@ -294,7 +296,7 @@ async function main() {
294
296
  .filter(([folder]) => fs.existsSync(path.join(home, folder))).map(([, ai]) => ai) : [];
295
297
  ais = await ask('\nAIs', ais || (found.length ? found.join(',') : 'claude,agents'));
296
298
  }
297
- if (!/^[1-4]$/.test(String(level))) die('level must be exactly 1, 2 or 3');
299
+ if (!/^[1-4]$/.test(String(level))) die('level must be 1, 2 or 3 (4 is accepted as 3)');
298
300
  level = Number(level);
299
301
  if (level === 4) console.log('note: --level 4 installs exactly what --level 3 installs. For model routing, see https://github.com/aunysillyme/model-orchestrator');
300
302
  const targets = String(ais || '').split(',').map(s => s.trim()).filter(Boolean);
@@ -86,7 +86,7 @@ function protect(root, log = console.log) {
86
86
  const tracked = git(where.top, ['ls-files', '--', ...PRIVATE.map(p => where.prefix ? `${where.prefix}/${p}` : p)]).out.split('\n').filter(Boolean);
87
87
  if (tracked.length) log(`WARNING: git already tracks ${tracked.join(', ')}; an exclude cannot hide a tracked file. Run git rm --cached on it if it should stay private.`);
88
88
  const shared = SHARED_PERSONAL.filter(p => fs.existsSync(path.join(root, p)));
89
- if (shared.length) log(`NOTE: ${shared.join(', ')} carry your profile, entries or answers and stay committable, since projects often share them. Review them before committing.`);
89
+ if (shared.length) log(`NOTE: ${shared.join(', ')} carry your profile, entries and answers, including names under off-limits. CLAUDE.md, AGENTS.md and GEMINI.md may be committed. Review them before committing.`);
90
90
  }
91
91
 
92
92
  function unprotect(root, { dry = false, log = console.log } = {}) {
package/bin/global.cjs CHANGED
@@ -8,7 +8,7 @@ const onboarding = require('../render/onboarding.cjs');
8
8
  const { sha256, validateInventory } = require('./install-plan.cjs');
9
9
  const SOURCE = '.agent-personalizer';
10
10
  const CONFIG = `${SOURCE}/.agent-personalizer.json`;
11
- const TARGETS = { claude: '.claude/CLAUDE.md', agents: '.codex/AGENTS.md', gemini: '.gemini/GEMINI.md' };
11
+ const TARGETS = { claude: '.claude/CLAUDE.md', agents: '.codex/AGENTS.md', gemini: '.gemini/GEMINI.md', hermes: '.hermes/SOUL.md' };
12
12
  const HASH = /^[a-f0-9]{64}$/;
13
13
  const refuse = message => { throw new renderer.Refusal(message); };
14
14
 
@@ -29,7 +29,7 @@ function validateGlobal(cfg) {
29
29
  if (!Object.hasOwn(TARGETS, key) || !info || typeof info.created !== 'boolean' || !HASH.test(info.blockHash) || !HASH.test(info.fileHash)
30
30
  || !['', '\n', '\n\n'].includes(info.separator) || typeof info.appended !== 'boolean') refuse('invalid global target ownership');
31
31
  }
32
- if (cfg.globalDirectories !== undefined && (!Array.isArray(cfg.globalDirectories) || cfg.globalDirectories.some(rel => ![SOURCE, '.claude', '.codex', '.gemini'].includes(rel)))) refuse('invalid global directory inventory');
32
+ if (cfg.globalDirectories !== undefined && (!Array.isArray(cfg.globalDirectories) || cfg.globalDirectories.some(rel => ![SOURCE, '.claude', '.codex', '.gemini', '.hermes'].includes(rel)))) refuse('invalid global directory inventory');
33
33
  }
34
34
 
35
35
  async function run({ args, commitPlan, probe, readConfig, ask }) {
@@ -67,10 +67,10 @@ async function execute({ args, commitPlan, probe, readConfig, ask }) {
67
67
  const interactive = !!process.stdin.isTTY && !args['--yes'];
68
68
  if (!stored.cfgExists && !interactive && (!args['--yes'] || !args['--ai'])) refuse('non-interactive --global needs --ai and --yes');
69
69
  let ais = args['--ai'] || (stored.cfgExists ? stored.cfg.targets.filter(t => t !== 'onboarding').join(',') : 'claude,agents');
70
- if (interactive && !stored.cfgExists) ais = await ask('Global AIs (claude,agents,gemini)', ais);
70
+ if (interactive && !stored.cfgExists) ais = await ask('Global AIs (claude,agents,gemini,hermes)', ais);
71
71
  const targets = ais.split(',').map(s => s.trim()).filter(Boolean);
72
72
  if (!targets.length || new Set(targets).size !== targets.length) refuse('choose each global AI once');
73
- for (const key of targets) if (!Object.hasOwn(TARGETS, key)) refuse(`--global supports only claude, agents and gemini (unsupported target: ${key})`);
73
+ for (const key of targets) if (!Object.hasOwn(TARGETS, key)) refuse(`--global supports only claude, agents, gemini and hermes (unsupported target: ${key})`);
74
74
  if (args['--answers'] && args['--defaults']) refuse('--answers and --defaults are exclusive');
75
75
  let answers = stored.prevAnswers || onboarding.defaults();
76
76
  if (args['--answers']) {
@@ -139,10 +139,15 @@ async function execute({ args, commitPlan, probe, readConfig, ask }) {
139
139
  const outputPaths = new Set([CONFIG, ...writes.map(p => p.rel)]);
140
140
  await commitPlan(root, { writes, outputPaths,
141
141
  prepare(newDirectories) {
142
- cfg.globalDirectories = [...new Set([...(old.globalDirectories || []), ...[...newDirectories].filter(rel => [SOURCE, '.claude', '.codex', '.gemini'].includes(rel))])].sort();
142
+ cfg.globalDirectories = [...new Set([...(old.globalDirectories || []), ...[...newDirectories].filter(rel => [SOURCE, '.claude', '.codex', '.gemini', '.hermes'].includes(rel))])].sort();
143
143
  writes.push({ rel: CONFIG, bytes: Buffer.from(JSON.stringify(cfg, null, 2) + '\n') });
144
144
  }
145
145
  });
146
+ if (targets.includes('hermes') && process.env.HERMES_HOME) {
147
+ let hermesHome = path.resolve(process.env.HERMES_HOME);
148
+ try { hermesHome = fs.realpathSync(hermesHome); } catch (_) {}
149
+ if (hermesHome !== path.join(root, '.hermes')) console.warn('Warning: Hermes reads SOUL.md from HERMES_HOME; the block was written to ~/.hermes/SOUL.md.');
150
+ }
146
151
  if (learnRequested) await require('./learn.cjs').learn({ dir: profileRoot, consented: true, allProjects: true });
147
152
  console.log(`Global profile installed. Re-run with --global after editing ${profileRoot}.`);
148
153
  }
package/bin/learn.cjs CHANGED
@@ -21,12 +21,14 @@ agent-personalizer can read up to 20 of your most recent sessions from ${scope}
21
21
  that Claude Code, Codex and Gemini CLI still keep, to find corrections you repeat.
22
22
  · ${scopeHint}
23
23
  · Only what you typed, never the AI's replies.
24
+ · Messages that look like secrets are skipped.
24
25
  · Stays on this computer, saved to .agent-personalizer/digest.md.
25
26
  · Your AI reads that file next time you open it, like anything you share with it.
26
27
  · Other people's details in there? Add their names to your private list first.
27
28
  · Delete it any time: npx agent-personalizer learn --forget
28
29
  (your AI app's own history stays as it is)
29
30
  · Codex's own memory notes are included when you choose Codex.
31
+ They are global to your Codex account, not limited to this folder.
30
32
  · When your AI reads the file, its provider sees these messages again.
31
33
  · Work or client accounts: check your agreement before reusing their sessions.
32
34
  · Not affiliated with Anthropic, OpenAI or Google. Their formats can change.
package/bin/sessions.cjs CHANGED
@@ -17,7 +17,7 @@ function bump(state, reason, count = 1) {
17
17
 
18
18
  function claudeProjectNames(projectDir) {
19
19
  const absolute = path.resolve(projectDir);
20
- return [...new Set([absolute.replace(/[\\/]/g, '-'), absolute.replace(/[:\\/]/g, '-')])];
20
+ return [...new Set([absolute.replace(/[\\/]/g, '-'), absolute.replace(/[:\\/]/g, '-'), absolute.replace(/[^a-zA-Z0-9]/g, '-'), absolute.replace(/[^a-zA-Z0-9_]/g, '-')])];
21
21
  }
22
22
 
23
23
  function belongsToProject(cwd, projectDir) {
@@ -29,6 +29,17 @@ function belongsToProject(cwd, projectDir) {
29
29
  /* Both sides are compared in NFC and lower case: macOS often stores accents decomposed (NFD),
30
30
  which would otherwise let a listed name through. Audit 0.8.0 F2. */
31
31
  const CTRL = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g;
32
+ const SECRETS = [
33
+ /-----BEGIN (?:[A-Z0-9]+ )*PRIVATE KEY-----/i,
34
+ /sk-[A-Za-z0-9_-]{20,}/,
35
+ /(?:gh[pousr]_|github_pat_)[A-Za-z0-9_]+/,
36
+ /AKIA[A-Z0-9]{16}/,
37
+ /xox[baprs]-[A-Za-z0-9-]+/,
38
+ /AIza[A-Za-z0-9_-]{20,}/,
39
+ /Bearer\s+[A-Za-z0-9._~+\/-]{20,}/i,
40
+ /(?:api[_-]?key|secret|token|password|passwd)["']?\s*[:=]\s*\S{8,}/i
41
+ ];
42
+ const secretMatch = text => SECRETS.some(pattern => pattern.test(String(text).replace(CTRL, '')));
32
43
  const fold = (text) => String(text).replace(CTRL, '').normalize('NFC').toLowerCase();
33
44
  const compact = (text) => fold(text).replace(/\s+/g, '');
34
45
  function privateMatch(text, terms) {
@@ -60,6 +71,7 @@ function cutContextBlocks(text) {
60
71
 
61
72
  function typedText(items, state) {
62
73
  if (!items.length) { bump(state, 'non_typed'); return null; }
74
+ if (secretMatch(items.join('\n')) || secretMatch(items.join(''))) { bump(state, 'secret'); return null; }
63
75
  // A private match drops the whole message, including its other text items.
64
76
  if (privateMatch(items.join('\n'), state.privateTerms) || privateMatch(items.join(''), state.privateTerms)) { bump(state, 'private_match'); return null; }
65
77
  const kept = [];
@@ -73,6 +85,7 @@ function typedText(items, state) {
73
85
  if (text) kept.push(text);
74
86
  }
75
87
  const text = kept.join('\n');
88
+ if (secretMatch(text) || secretMatch(kept.join(''))) { bump(state, 'secret'); return null; }
76
89
  if (privateMatch(text, state.privateTerms) || privateMatch(kept.join(''), state.privateTerms)) { bump(state, 'private_match'); return null; }
77
90
  if (!text) { bump(state, 'empty_message'); return null; }
78
91
  if (text.length > 2000) { bump(state, 'long_message'); return null; }
@@ -423,7 +436,9 @@ async function readMemory(file, state) {
423
436
  if (!await scanLines(file.file, state, line => lines.push(line))) return null;
424
437
  const text = lines.join('\n').replace(CTRL, '').trim();
425
438
  if (!text) return null;
439
+ if (secretMatch(text)) { bump(state, 'secret'); return null; }
426
440
  if (privateMatch(text, state.privateTerms)) { bump(state, 'private_match'); return null; }
441
+ if (text.length > 2000) { bump(state, 'long_message'); return null; }
427
442
  return { file: file.file, text, date: new Date(file.mtimeMs).toISOString() };
428
443
  }
429
444
 
package/docs/install.md CHANGED
@@ -65,7 +65,7 @@ Use [`examples/answers.json`](../examples/answers.json) as a complete example, i
65
65
  | Flag | Purpose |
66
66
  |---|---|
67
67
  | `--dir <folder>` | Destination folder; prompted in interactive mode. |
68
- | `--global` | Apply a level-1 profile across projects through Claude Code, Codex and Gemini CLI home files. Excludes `--dir` and levels 2/3. |
68
+ | `--global` | Apply a level-1 profile across projects through Claude Code, Codex, Gemini CLI and Hermes Agent home files. Excludes `--dir` and levels 2/3. |
69
69
  | `--ai claude,agents,gemini,chatgpt,prompt` | Comma-separated targets. Choose the ones you use. |
70
70
  | `--level 1`, `--level 2`, `--level 3` | Profile and home files; add local notes; add editable rules and mechanisms. |
71
71
  | `--answers <file.json>` or `--answers -` | Set onboarding answers without questions. |
@@ -84,14 +84,14 @@ Installer exit codes: `0` completed, `1` unexpected error, `2` refused or invali
84
84
  ## Every project with one profile
85
85
 
86
86
  ```bash
87
- npx agent-personalizer --global --ai claude,agents,gemini --yes
87
+ npx agent-personalizer --global --ai claude,agents,gemini,hermes --yes
88
88
  npx agent-personalizer --global
89
89
  npx agent-personalizer learn --global --yes
90
90
  npx agent-personalizer --global --uninstall --dry
91
91
  npx agent-personalizer --global --uninstall
92
92
  ```
93
93
 
94
- `--global` keeps the level-1 profile source (`USER.md`, `LEARNED.md`, onboarding and configuration) in `~/.agent-personalizer/`. It writes a marked block to `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md` and `~/.gemini/GEMINI.md` for the selected targets. Paths use `HOME`, with `USERPROFILE` as the Windows fallback when `HOME` is missing or empty. The selected value must be a non-empty absolute path. Global instructions name the profile's full path so they work from any project. Start a new AI session to load them; client instruction precedence still applies.
94
+ `--global` keeps the level-1 profile source (`USER.md`, `LEARNED.md`, onboarding and configuration) in `~/.agent-personalizer/`. It writes a marked block to `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md`, `~/.gemini/GEMINI.md` and `~/.hermes/SOUL.md` for the selected targets. For Hermes in a project, use `--ai agents` to write `AGENTS.md`. Hermes reads its global `SOUL.md` from `HERMES_HOME` when set; the installer warns if that differs from `~/.hermes`. Paths use `HOME`, with `USERPROFILE` as the Windows fallback when `HOME` is missing or empty. The selected value must be a non-empty absolute path. Global instructions name the profile's full path so they work from any project. Start a new AI session to load them; client instruction precedence still applies.
95
95
 
96
96
  Select only `claude`, `agents` and `gemini`. Other targets, `--dir` and levels 2/3 are refused. A headless first install needs `--ai` and `--yes`; level 1 is implicit. `--answers` and `--defaults` work as with project installs. A re-run keeps saved targets and answers.
97
97
 
@@ -99,6 +99,8 @@ Global learning always includes sessions from all projects and still needs conse
99
99
 
100
100
  Global files keep user text outside the markers byte for byte, including line endings and a missing final newline. Existing files and parents must be regular files and directories, never symlinks. The whole plan is checked before writes; a failed write restores changed files and newly created empty directories through the project installer's atomic rename and rollback path.
101
101
 
102
+ `--global` refuses a symlinked `HOME` and a symlinked `~/.claude/CLAUDE.md`, including links maintained by dotfile managers. Use a project install with `--dir` instead. For a linked `HOME`, you can set `HOME` to its real absolute directory; global home files must still be regular files. To keep a dotfile manager's symlinks, use the project install and copy the instructions through your dotfile manager.
103
+
102
104
  Global uninstall removes unchanged marked blocks and owned profile files. It deletes a home file only if install created it and no other content remains. Edited blocks, profiles and learned entries stay, with the configuration kept for review. Install-created empty directories are removed; other home files and settings stay in place.
103
105
 
104
106
  ## Learning commands
package/docs/learning.md CHANGED
@@ -8,17 +8,18 @@ The first interactive install asks which AIs you use, then shows this consent sc
8
8
 
9
9
  ```text
10
10
  Learn from your past sessions?
11
- agent-personalizer can read up to 20 of your most recent sessions from this
12
- project that Claude Code, Codex and Gemini CLI still keep, to find corrections you repeat.
13
- · By default, only sessions for this --dir project are included.
11
+ agent-personalizer can read up to 20 of your most recent sessions from the --dir project
12
+ that Claude Code, Codex and Gemini CLI still keep, to find corrections you repeat.
14
13
  · Use --all-projects to include sessions from other projects.
15
14
  · Only what you typed, never the AI's replies.
15
+ · Messages that look like secrets are skipped.
16
16
  · Stays on this computer, saved to .agent-personalizer/digest.md.
17
17
  · Your AI reads that file next time you open it, like anything you share with it.
18
18
  · Other people's details in there? Add their names to your private list first.
19
19
  · Delete it any time: npx agent-personalizer learn --forget
20
20
  (your AI app's own history stays as it is)
21
21
  · Codex's own memory notes are included when you choose Codex.
22
+ They are global to your Codex account, not limited to this folder.
22
23
  · When your AI reads the file, its provider sees these messages again.
23
24
  · Work or client accounts: check your agreement before reusing their sessions.
24
25
  · Not affiliated with Anthropic, OpenAI or Google. Their formats can change.
@@ -48,7 +49,7 @@ The saved AI selection chooses the sources. The reader takes up to 20 of the new
48
49
 
49
50
  By default, only sessions associated with the `--dir` folder or one of its subfolders are included. Claude Code and Codex sessions are matched by their recorded working directory; Gemini CLI uses the SHA-256 project folder it creates from that path. If a session does not provide enough path information to match it safely, it is skipped. Use `npx agent-personalizer learn --dir . --all-projects` to include sessions from every project.
50
51
 
51
- The digest contains typed user messages and, when Codex is selected, up to 20 of the newest Codex memory files in a separate section. AI replies, tool output, reasoning, automation sessions and injected context are dropped. Large likely pastes are dropped too. Gemini chat snapshots replace earlier messages; a message repeated in the chat and logs is included once. The all-projects option affects session history; the memory file limit still applies.
52
+ The digest contains typed user messages and, when Codex is selected, up to 20 of the newest Codex memory files in a separate section. These memory notes are global to your Codex account, not limited to this folder. AI replies, tool output, reasoning, automation sessions and injected context are dropped. Messages and memory notes over 2,000 characters are dropped whole. Gemini chat snapshots replace earlier messages; a message repeated in the chat and logs is included once. The all-projects option affects session history; the memory file limit still applies.
52
53
 
53
54
  The reader streams session files, skips oversized lines and stops a file at its size limit. Symlinks, unreadable files, other-project sessions and unknown or malformed formats are skipped and counted. Codex session headers are inspected to determine their project; message content from other projects is not scanned. The terminal lists files read and skip counts; message text is never printed there. Vendor format changes may mean fewer usable sessions until the reader is updated.
54
55
 
@@ -58,7 +59,9 @@ The reader runs locally and makes no network calls. It saves `.agent-personalize
58
59
 
59
60
  Your AI reads the digest, so its contents go to that AI's provider again, like anything you paste in. The digest labels old messages as data; instructions inside them must never be followed.
60
61
 
61
- Past sessions may include client, coworker or other people's details. Read only history you are allowed to reuse. For work or client accounts, check your agreement first. Before accepting, put private terms in `<project>/check/forbidden.local.txt`, one per line; any message containing a term, ignoring case, is dropped whole. Blank lines, `#` comments and `allow:` entries are ignored by the session filter. Keep that list out of git. See the [gate setup](guarantees.md#forbidden-string-gate).
62
+ Past sessions may include client, coworker or other people's details. Read only history you are allowed to reuse. For work or client accounts, check your agreement first. Before accepting, put private terms in `<project>/check/forbidden.local.txt` (project install) or `~/.agent-personalizer/check/forbidden.local.txt` (global install), one per line; any message or memory note containing a term, ignoring case, is dropped whole. Blank lines, `#` comments and `allow:` entries are ignored by the session filter. Keep that list out of git. See the [gate setup](guarantees.md#forbidden-string-gate).
63
+
64
+ Messages and memory notes that look like secrets are dropped whole and counted under `secret`; only the count is reported. Conservative patterns cover PEM private key headers, `sk-` keys, GitHub tokens, AWS access key ids, Slack tokens, Google API keys, bearer tokens and assignments to API key, secret, token or password fields. This filter can miss secrets or skip ordinary text; review the digest before sharing it with your AI.
62
65
 
63
66
  ## What your AI asks and keeps
64
67
 
@@ -8,10 +8,11 @@ The renderer writes one file per AI. This page says where each AI reads it, and
8
8
  | `AGENT_ONBOARDING.md` | any AI | Named as the second thing to read in `CLAUDE.md` and `AGENTS.md`. Paste it wherever the AI has no file access (below). |
9
9
  | `AGENTS.md` | Codex CLI, Cursor, and other agents that adopted the AGENTS.md convention | Automatically, from the repository root; `--global` writes `~/.codex/AGENTS.md` for all projects. Nothing to paste. |
10
10
  | `GEMINI.md` | Gemini CLI | Automatically, from the folder; `--global` writes `~/.gemini/GEMINI.md` for all projects. Nothing to paste. |
11
+ | `SOUL.md` | Hermes Agent | `--global --ai hermes` appends a marked block to `~/.hermes/SOUL.md`. In a project, use `--ai agents` for `AGENTS.md`. A different `HERMES_HOME` changes where Hermes reads the global file. |
11
12
  | `chatgpt-box1.txt`, `chatgpt-box2.txt` and `chatgpt-custom-instructions.md` | ChatGPT | Profile and response text to paste, with a preview and counts. |
12
13
  | `system-prompt.md` | anything with a system-prompt field, shared bots, API calls | Paste as the system prompt. Universal rules only, no profile, safe to share. |
13
14
 
14
- Use `npx agent-personalizer --global --ai claude,agents,gemini --yes` for one profile across projects. Its source lives in `~/.agent-personalizer/`; re-run with `--global` after editing it and start a new client session. Global mode accepts only these three targets and level 1, excludes `--dir`, preserves text outside its markers and supports `--global --uninstall`. See [global installation](install.md#every-project-with-one-profile).
15
+ Use `npx agent-personalizer --global --ai claude,agents,gemini,hermes --yes` for one profile across projects. Its source lives in `~/.agent-personalizer/`; re-run with `--global` after editing it and start a new client session. Global mode accepts these four targets and level 1, excludes `--dir`, preserves text outside its markers and supports `--global --uninstall`. See [global installation](install.md#every-project-with-one-profile).
15
16
 
16
17
  ---
17
18
 
package/docs/tiers.md CHANGED
@@ -79,7 +79,7 @@ A word on the stories below: each is one setup's experience of what held and wha
79
79
 
80
80
  **Prevents.** The AI treating its own guess as your ruling. An inference written down without a status reads, next session, like something you decided.
81
81
 
82
- **Story.** A memory file said the user preferred a certain tool. The user had never said so; an earlier session had inferred it from one choice. Three sessions built on it. The status field exists so the next session can tell the difference between "she said" and "I guessed," and so a contradicted fact gets marked `superseded` with a pointer rather than silently overwritten.
82
+ **Story.** A memory file said the user preferred a certain tool. The user had never said so; an earlier session had inferred it from one choice. Three sessions built on it. The status field exists so the next session can tell the difference between "she said" and "I guessed." When the user rejects an entry, mark it `declined` and keep the correction in its evidence rather than silently overwriting it.
83
83
 
84
84
  **Rule inside the tier.** Ask before keeping an entry as confirmed. A no is recorded as declined and never asked again. Re-render after an entry changes; `--check` catches an unrendered edit. The digest of past messages is temporary evidence, separate from the entries: `learn --forget` removes it, and uninstall keeps `LEARNED.md` once it holds anything you wrote. See [learning.md](learning.md).
85
85
 
@@ -50,8 +50,8 @@
50
50
  "obsidian_tc": "yes"
51
51
  },
52
52
  "installed": {
53
- "CLAUDE.md": "3ea7661f6ea1ad2f23072c20bc952ea0cf3d2acafdc486edee86f095266dc979",
54
- "AGENTS.md": "e870580a758b363c07e767e040f683e32890d0248726d0bcd4f0be0d83f3f423",
55
- "AGENT_ONBOARDING.md": "d4657e01cf5e8f1ac87e29e67e7bd1fe8a43152736611efc3f246ecc99aeb8b5"
53
+ "CLAUDE.md": "4a303e42182c9affef6bcf14cd77045fae24f02ff8f1fef7e1f84e8c03aef2f2",
54
+ "AGENTS.md": "9cfedced547c961885e57814e3bc2f9122e16bfda2da0e5901dd61f3cf3f3bec",
55
+ "AGENT_ONBOARDING.md": "8921de612c1b03c2fd5420fa7fa9928598b5f9c5398ae44e19ff07fd0af01e5d"
56
56
  }
57
57
  }
@@ -155,7 +155,7 @@ In practice: when you change a file in a folder, fix that folder's README in the
155
155
 
156
156
  Never hand-type fields the system derives (an `updated:` date pulled from version control, for instance). Edit the prose, not the derived keys.
157
157
 
158
- Same template. Check the index before reporting a write as done.
158
+ Check the folder's README before reporting a write as done.
159
159
 
160
160
  > Written after: an AI trusted a folder index that described a file deleted two weeks earlier, and built a plan on it. Agents read a notes folder by trusting the index over the files, because that is what an index is for.
161
161
  > Prevents: a stale index, which is worse than a missing one because it is believed.
@@ -25,7 +25,7 @@ _Generated by agent-personalizer from your saved preferences (stored in `.agent-
25
25
  ### Read this first, in order
26
26
 
27
27
  - USER.md
28
- - AGENT\_ONBOARDING.md
28
+ - AGENT_ONBOARDING.md
29
29
  - notes/README.md
30
30
  - rules/
31
31
  - notes/decisions.md
@@ -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.8.4/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.8.6/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.
@@ -155,7 +155,7 @@ In practice: when you change a file in a folder, fix that folder's README in the
155
155
 
156
156
  Never hand-type fields the system derives (an `updated:` date pulled from version control, for instance). Edit the prose, not the derived keys.
157
157
 
158
- Template: `templates/FOLDER_README.md`. The rule is restated inside the template so a folder carries its own contract.
158
+ Restate this rule in each folder's README so the folder carries its own contract.
159
159
 
160
160
  > Written after: an AI trusted a folder index that described a file deleted two weeks earlier, and built a plan on it. Agents read a notes folder by trusting the index over the files, because that is what an index is for.
161
161
  > Prevents: a stale index, which is worse than a missing one because it is believed.
@@ -16,10 +16,10 @@ In practice: when you change a file in a folder, fix that folder's README in the
16
16
  Never hand-type fields the system derives (an `updated:` date pulled from version control, for instance). Edit the prose, not the derived keys.
17
17
 
18
18
  ## binding:claude
19
- Template: `templates/FOLDER_README.md`. The rule is restated inside the template so a folder carries its own contract.
19
+ Restate this rule in each folder's README so the folder carries its own contract.
20
20
 
21
21
  ## binding:agents
22
- Same template. Check the index before reporting a write as done.
22
+ Check the folder's README before reporting a write as done.
23
23
 
24
24
  ## origin
25
25
  Written after: an AI trusted a folder index that described a file deleted two weeks earlier, and built a plan on it. Agents read a notes folder by trusting the index over the files, because that is what an index is for.
@@ -31,8 +31,8 @@
31
31
  ]
32
32
  },
33
33
  "installed": {
34
- "CLAUDE.md": "8bb89d845cd9471e5f357dd9c905f9dc5f4b83dc0531d14ba051b5691a884443",
35
- "AGENTS.md": "4ecab4f98605736f8b3185fa8df3a9484ba3d64d5312ece5d131c2316fab92d6",
36
- "AGENT_ONBOARDING.md": "94f4081f591bc7aac0921b53c21769e8e48cd85a52bc47f1abb09b1054c66bca"
34
+ "CLAUDE.md": "a99162f0f7f2df9e6debd8bfeede565196d6c47c79f4794fc267ec8a8e9fe86b",
35
+ "AGENTS.md": "24d092e5f5e31b769c9049c948b9c6fa89cd270f9ee92bbe752e2ebbb5b97ecb",
36
+ "AGENT_ONBOARDING.md": "37ebf0f4cf6261285b8891e15938c64a2795933a38a187d8e6cda2be42f9e66e"
37
37
  }
38
38
  }
@@ -154,7 +154,7 @@ In practice: when you change a file in a folder, fix that folder's README in the
154
154
 
155
155
  Never hand-type fields the system derives (an `updated:` date pulled from version control, for instance). Edit the prose, not the derived keys.
156
156
 
157
- Same template. Check the index before reporting a write as done.
157
+ Check the folder's README before reporting a write as done.
158
158
 
159
159
  > Written after: an AI trusted a folder index that described a file deleted two weeks earlier, and built a plan on it. Agents read a notes folder by trusting the index over the files, because that is what an index is for.
160
160
  > Prevents: a stale index, which is worse than a missing one because it is believed.
@@ -25,7 +25,7 @@ _Generated by agent-personalizer from your saved preferences (stored in `.agent-
25
25
  ### Read this first, in order
26
26
 
27
27
  - USER.md
28
- - AGENT\_ONBOARDING.md
28
+ - AGENT_ONBOARDING.md
29
29
  - `notes/README.md`, the rules of the folder you may write into, before writing there.
30
30
 
31
31
  ### Where you may write
@@ -154,7 +154,7 @@ In practice: when you change a file in a folder, fix that folder's README in the
154
154
 
155
155
  Never hand-type fields the system derives (an `updated:` date pulled from version control, for instance). Edit the prose, not the derived keys.
156
156
 
157
- Template: `templates/FOLDER_README.md`. The rule is restated inside the template so a folder carries its own contract.
157
+ Restate this rule in each folder's README so the folder carries its own contract.
158
158
 
159
159
  > Written after: an AI trusted a folder index that described a file deleted two weeks earlier, and built a plan on it. Agents read a notes folder by trusting the index over the files, because that is what an index is for.
160
160
  > Prevents: a stale index, which is worse than a missing one because it is believed.
@@ -16,10 +16,10 @@ In practice: when you change a file in a folder, fix that folder's README in the
16
16
  Never hand-type fields the system derives (an `updated:` date pulled from version control, for instance). Edit the prose, not the derived keys.
17
17
 
18
18
  ## binding:claude
19
- Template: `templates/FOLDER_README.md`. The rule is restated inside the template so a folder carries its own contract.
19
+ Restate this rule in each folder's README so the folder carries its own contract.
20
20
 
21
21
  ## binding:agents
22
- Same template. Check the index before reporting a write as done.
22
+ Check the folder's README before reporting a write as done.
23
23
 
24
24
  ## origin
25
25
  Written after: an AI trusted a folder index that described a file deleted two weeks earlier, and built a plan on it. Agents read a notes folder by trusting the index over the files, because that is what an index is for.
@@ -31,8 +31,8 @@
31
31
  ]
32
32
  },
33
33
  "installed": {
34
- "CLAUDE.md": "6a058809841d4a98458b955c20373ea09740aface4f9465766dee64d54f5eee5",
35
- "AGENTS.md": "636fdb3ce93ca17f04e79200e618ccf9ad324abe8cbe7d6d3cc730eb744a433d",
36
- "AGENT_ONBOARDING.md": "08103273f0edea5da6c38ed79ce51113a9f040f98f357badc95b3f4e6fcfbcc3"
34
+ "CLAUDE.md": "7104eeb98b6e23dfe690f083ee2c42966ceddab20403be40b127d9ff083f2bce",
35
+ "AGENTS.md": "4b8b44fb95e7533315c2adee1342c0efea3551ea48246274a7b7ba31251fd516",
36
+ "AGENT_ONBOARDING.md": "0c9fe728be7635c6b341c951d75740a191dac2107cc4f3ddc6855ec27450081d"
37
37
  }
38
38
  }
@@ -154,7 +154,7 @@ In practice: when you change a file in a folder, fix that folder's README in the
154
154
 
155
155
  Never hand-type fields the system derives (an `updated:` date pulled from version control, for instance). Edit the prose, not the derived keys.
156
156
 
157
- Same template. Check the index before reporting a write as done.
157
+ Check the folder's README before reporting a write as done.
158
158
 
159
159
  > Written after: an AI trusted a folder index that described a file deleted two weeks earlier, and built a plan on it. Agents read a notes folder by trusting the index over the files, because that is what an index is for.
160
160
  > Prevents: a stale index, which is worse than a missing one because it is believed.
@@ -25,7 +25,7 @@ _Generated by agent-personalizer from your saved preferences (stored in `.agent-
25
25
  ### Read this first, in order
26
26
 
27
27
  - USER.md
28
- - AGENT\_ONBOARDING.md
28
+ - AGENT_ONBOARDING.md
29
29
  - `notes/README.md`, the rules of the folder you may write into, before writing there.
30
30
 
31
31
  ### Where you may write
@@ -154,7 +154,7 @@ In practice: when you change a file in a folder, fix that folder's README in the
154
154
 
155
155
  Never hand-type fields the system derives (an `updated:` date pulled from version control, for instance). Edit the prose, not the derived keys.
156
156
 
157
- Template: `templates/FOLDER_README.md`. The rule is restated inside the template so a folder carries its own contract.
157
+ Restate this rule in each folder's README so the folder carries its own contract.
158
158
 
159
159
  > Written after: an AI trusted a folder index that described a file deleted two weeks earlier, and built a plan on it. Agents read a notes folder by trusting the index over the files, because that is what an index is for.
160
160
  > Prevents: a stale index, which is worse than a missing one because it is believed.
@@ -16,10 +16,10 @@ In practice: when you change a file in a folder, fix that folder's README in the
16
16
  Never hand-type fields the system derives (an `updated:` date pulled from version control, for instance). Edit the prose, not the derived keys.
17
17
 
18
18
  ## binding:claude
19
- Template: `templates/FOLDER_README.md`. The rule is restated inside the template so a folder carries its own contract.
19
+ Restate this rule in each folder's README so the folder carries its own contract.
20
20
 
21
21
  ## binding:agents
22
- Same template. Check the index before reporting a write as done.
22
+ Check the folder's README before reporting a write as done.
23
23
 
24
24
  ## origin
25
25
  Written after: an AI trusted a folder index that described a file deleted two weeks earlier, and built a plan on it. Agents read a notes folder by trusting the index over the files, because that is what an index is for.
package/hooks/README.md CHANGED
@@ -1,23 +1,25 @@
1
1
  # hooks/
2
2
 
3
- Tier 3 from the tiers doc (https://github.com/aunysillyme/agent-personalizer/blob/v0.8.4/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.8.6/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
 
7
7
  ## Claude Code
8
8
 
9
- `claude-code/session-start.sh` prints the contract (it runs `render/render.cjs --contract`, so it needs the level-3 install beside it). Register it in `.claude/settings.json` (project) or `~/.claude/settings.json` (global):
9
+ `claude-code/session-start.sh` prints the contract (it runs `render/render.cjs --contract`, so it needs the level-3 install beside it). Register it in the project's `.claude/settings.json`:
10
10
 
11
11
  ```json
12
12
  {
13
13
  "hooks": {
14
14
  "SessionStart": [
15
- { "hooks": [ { "type": "command", "command": "sh hooks/claude-code/session-start.sh" } ] }
15
+ { "hooks": [ { "type": "command", "command": "sh \"$CLAUDE_PROJECT_DIR/hooks/claude-code/session-start.sh\"" } ] }
16
16
  ]
17
17
  }
18
18
  }
19
19
  ```
20
20
 
21
+ For user-level `~/.claude/settings.json`, use the absolute path to the installed project instead, for example `sh "/path/to/project/hooks/claude-code/session-start.sh"`. The script resolves its project root from its own location, so it also works when the session starts in a subfolder.
22
+
21
23
  The hook's stdout lands in the session context before your first message. That is the whole mechanism. If `node` is missing the hook exits non-zero and says so on stderr, so a session that starts without its contract is visible, not silent. The contract carries the onboarding block first (always-ask, off-limits, write policy, then style), so a token budget trims style before it trims a restriction.
22
24
 
23
25
  The contract is target-aware: `--contract-target claude` applies each rule's `surfaces` filter. Personal blocks are included by default because the hook runs in your own project; add `--no-personal` for a shared machine.
package/llms.txt CHANGED
@@ -26,6 +26,8 @@ Session data stays local until the user's AI reads it and sends it to its provid
26
26
  - [model-orchestrator](https://github.com/aunysillyme/model-orchestrator): Model router for AI coding agents: routes routine work to cheaper models with routing rules, 8 subagents, hooks and a CLI runner
27
27
  - [repo-build-skill](https://github.com/aunysillyme/repo-build-skill): Skill pack that teaches your AI to build, release and launch a GitHub repo: stack pick, README, AGENTS.md, llms.txt, repo SEO and AEO, trusted publishing.
28
28
  - [website-build-skill](https://github.com/aunysillyme/website-build-skill): A skill pack that turns your AI into an expert website builder: current research, design, code, accessibility, speed, SEO and security, alone or as a team.
29
+ - [lean-browser-use](https://github.com/aunysillyme/lean-browser-use): Cut browser use cost by about 25% in Claude Code: fresh runner subagent, bulk reads, three guards and a token meter. One npx command
30
+ - [lean-computer-use](https://github.com/aunysillyme/lean-computer-use): Background Mac computer control for AI agents: desk tools, a fresh runner subagent, retry guards and a transcript token meter, installed with one command
29
31
  <!-- set:end -->
30
32
 
31
33
  ## Optional
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-personalizer",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "description": "AI custom instructions from approved entries: a profile and rules for Claude Code, Codex, Cursor, Gemini CLI 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.8.4';
20
+ const VERSION = '0.8.6';
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
@@ -173,6 +173,9 @@ function validate(input) {
173
173
  // no "..", no empty segment, no backslash, nothing but [A-Za-z0-9._ -] per segment.
174
174
  if (kindOf(out) === 'disk' && !SAFE_REL.test(out.notes_path))
175
175
  throw new Error(`"notes_path" for ${out.notes_tool} must be a relative folder path such as "notes" or "docs/vault" (letters, digits, space, . _ -, segments joined by /; no leading /, no ..)`);
176
+ const reserved = out.notes_path.split('/').find(segment => ['.git', '.github', 'node_modules'].includes(segment.toLowerCase()));
177
+ if (kindOf(out) === 'disk' && reserved)
178
+ throw new Error(`"notes_path" must not contain the reserved segment "${reserved}"`);
176
179
  const owned = ['.agent-personalizer', '.agent-personalizer.json', '.claude', 'render', 'rules', 'check', 'hooks', 'USER.md', 'LEARNED.md', 'CLAUDE.md', 'AGENTS.md', 'GEMINI.md', 'AGENT_ONBOARDING.md', 'system-prompt.md', 'chatgpt-custom-instructions.md', 'chatgpt-box1.txt', 'chatgpt-box2.txt'];
177
180
  if (kindOf(out) === 'disk' && owned.some(p => out.notes_path.toLowerCase() === p.toLowerCase() || out.notes_path.toLowerCase().startsWith(p.toLowerCase() + '/')))
178
181
  throw new Error('"notes_path" must be outside agent-personalizer tool-owned paths, including .agent-personalizer/');
@@ -361,7 +364,7 @@ _Generated by agent-personalizer from your saved preferences (stored in \`.agent
361
364
 
362
365
  ### Read this first, in order
363
366
 
364
- ${bullets(a.read_first.map(md), 'USER.md')}
367
+ ${bullets(a.read_first.map(entryMd), 'USER.md')}
365
368
  - ${pending ? `Nothing else yet: there is no notes folder to read, and no folder README (${notesLater(base)} and its README). See § Where you may write below.` : tool.kind === 'cloud' ? `The index ${unit} of "${md(a.notes_path)}", before writing there.` : `\`${base}/README.md\`, the rules of the folder you may write into, before writing there.`}
366
369
  ${a.tracker !== 'none' ? `- The task tracker (${md(a.tracker)}): what is open and what is already decided, before proposing work.\n` : ''}
367
370
  ### Where you may write
@@ -449,7 +452,7 @@ function contractBlock(a, opts) {
449
452
  `Always ask before: ${a.always_ask.join(', ') || 'nothing declared'}.`,
450
453
  a.off_limits.length ? `Off limits in any output: ${a.off_limits.map(md).join(', ')}.` : null,
451
454
  writesLine(a, opts),
452
- files ? `Read first: ${a.read_first.map(md).join(' → ')}.` : null,
455
+ files ? `Read first: ${a.read_first.map(entryMd).join(' → ')}.` : null,
453
456
  `Directness: ${label(Q.tone, a.tone)}. Length: ${label(Q.length, a.length)}. When wrong: ${label(Q.mistakes, a.mistakes)}. When unsure: ${youLabel(Q.unsure, a.unsure)}.`,
454
457
  `Open with ${label(Q.lead_with, a.lead_with)}; ${label(Q.structure, a.structure)}; evidence ${label(Q.evidence, a.evidence)}.${a.signature === 'yes' ? ' Sign every edit to a note (one `Last edited by:` line, overwritten).' : ''}`,
455
458
  a.never.length ? `Never: ${a.never.map(md).join('; ')}.` : null,
package/render/render.cjs CHANGED
@@ -324,7 +324,7 @@ function renderRule(rule, target) {
324
324
  stored answers (defaults when none are stored, so a rule set without saved answers still renders) */
325
325
  function rulesFor(rules, key, answers) {
326
326
  const a = answers || onboarding.defaults();
327
- return rules.filter(r => (!Array.isArray(r.meta.surfaces) || r.meta.surfaces.includes(key))
327
+ return rules.filter(r => (!Array.isArray(r.meta.surfaces) || r.meta.surfaces.includes(key) || (key === 'hermes' && r.meta.surfaces.includes('agents')))
328
328
  && (!r.meta.requires || a[r.meta.requires.answer] === r.meta.requires.value));
329
329
  }
330
330
  const rulesAtLevel = (rules, cfg) => cfg && (cfg.level === 1 || cfg.level === 2) ? rules.filter(r => CORE_RULE_FILES.has(r.file)) : rules;
@@ -412,7 +412,7 @@ function renderTarget(key, target, profile, rules, cfg, root, learned) {
412
412
  if (target.profile && profile) lines.push('## Profile', '', profile.body, '');
413
413
  if (target.personal && target.profile) {
414
414
  lines.push(onboarding.entriesBlock(learned), '', `_LEARNED.md source: ${learned.hash}_`, '');
415
- if (['claude', 'agents', 'gemini'].includes(key)) lines.push(onboarding.learningProcedure(), '');
415
+ if (['claude', 'agents', 'gemini', 'hermes'].includes(key)) lines.push(onboarding.learningProcedure(), '');
416
416
  }
417
417
  lines.push('## Rules', '');
418
418
  for (const r of rulesFor(rules, key, answers)) lines.push(renderRule(r, target), '');
@@ -23,6 +23,14 @@
23
23
  "profile": true,
24
24
  "header": "Rendered instructions for Gemini"
25
25
  },
26
+ "hermes": {
27
+ "file": "SOUL.md",
28
+ "binding": "hermes",
29
+ "personal": true,
30
+ "origin": true,
31
+ "profile": true,
32
+ "header": "Rendered instructions for Hermes Agent"
33
+ },
26
34
  "chatgpt": {
27
35
  "file": "chatgpt-custom-instructions.md",
28
36
  "binding": "chatgpt",
@@ -16,10 +16,10 @@ In practice: when you change a file in a folder, fix that folder's README in the
16
16
  Never hand-type fields the system derives (an `updated:` date pulled from version control, for instance). Edit the prose, not the derived keys.
17
17
 
18
18
  ## binding:claude
19
- Template: `templates/FOLDER_README.md`. The rule is restated inside the template so a folder carries its own contract.
19
+ Restate this rule in each folder's README so the folder carries its own contract.
20
20
 
21
21
  ## binding:agents
22
- Same template. Check the index before reporting a write as done.
22
+ Check the folder's README before reporting a write as done.
23
23
 
24
24
  ## origin
25
25
  Written after: an AI trusted a folder index that described a file deleted two weeks earlier, and built a plan on it. Agents read a notes folder by trusting the index over the files, because that is what an index is for.