agent-personalizer 0.9.1 → 0.10.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 (99) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/CONTRIBUTING.md +3 -3
  3. package/README.md +12 -10
  4. package/RELEASING.md +2 -2
  5. package/SECURITY.md +1 -1
  6. package/bin/agent-personalizer.js +21 -32
  7. package/bin/cli-util.cjs +28 -0
  8. package/bin/global.cjs +4 -4
  9. package/bin/install-plan.cjs +4 -3
  10. package/bin/learn.cjs +10 -3
  11. package/bin/sessions.cjs +195 -35
  12. package/bin/uninstall.cjs +3 -3
  13. package/check/gate.cjs +46 -6
  14. package/docs/guarantees.md +1 -1
  15. package/docs/install.md +6 -6
  16. package/docs/learning.md +7 -7
  17. package/docs/paste-guide.md +8 -6
  18. package/docs/tiers.md +1 -1
  19. package/hooks/README.md +17 -1
  20. package/hooks/gemini-cli/session-start.sh +15 -0
  21. package/llms.txt +6 -4
  22. package/package.json +6 -3
  23. package/render/onboarding.cjs +30 -47
  24. package/render/render.cjs +24 -15
  25. package/rules/00-read-the-profile-first.md +3 -0
  26. package/rules/20-one-owner-per-rule.md +3 -0
  27. package/rules/30-folder-index-is-part-of-the-change.md +3 -0
  28. package/rules/40-sign-every-edit.md +4 -1
  29. package/skills/agent-personalizer/SKILL.md +104 -0
  30. package/templates/GEMINI.md +30 -0
  31. package/examples/freelance-illustrator/.agent-personalizer.json +0 -57
  32. package/examples/freelance-illustrator/AGENTS.md +0 -244
  33. package/examples/freelance-illustrator/AGENT_ONBOARDING.md +0 -67
  34. package/examples/freelance-illustrator/CLAUDE.md +0 -248
  35. package/examples/freelance-illustrator/LEARNED.md +0 -14
  36. package/examples/freelance-illustrator/USER.md +0 -54
  37. package/examples/freelance-illustrator/notes/README.md +0 -39
  38. package/examples/freelance-illustrator/notes/decisions.md +0 -18
  39. package/examples/freelance-illustrator/notes/inbox/2026-09-03-shot-list-for-six-prints.md +0 -14
  40. package/examples/freelance-illustrator/notes/inbox/README.md +0 -19
  41. package/examples/freelance-illustrator/notes/sessions/2026-W36.md +0 -41
  42. package/examples/freelance-illustrator/rules/00-read-the-profile-first.md +0 -24
  43. package/examples/freelance-illustrator/rules/10-evidence-before-assertion.md +0 -24
  44. package/examples/freelance-illustrator/rules/20-one-owner-per-rule.md +0 -24
  45. package/examples/freelance-illustrator/rules/30-folder-index-is-part-of-the-change.md +0 -26
  46. package/examples/freelance-illustrator/rules/40-sign-every-edit.md +0 -25
  47. package/examples/freelance-illustrator/rules/50-output-style.md +0 -21
  48. package/examples/freelance-illustrator/rules/60-act-or-ask.md +0 -30
  49. package/examples/freelance-illustrator/rules/65-ask-before-it-repeats.md +0 -18
  50. package/examples/freelance-illustrator/rules/70-their-words-point-at-the-thing.md +0 -15
  51. package/examples/freelance-illustrator/rules/80-symptoms-are-not-causes.md +0 -15
  52. package/examples/freelance-illustrator/rules/90-surface-what-they-cant-see.md +0 -15
  53. package/examples/freelance-illustrator/rules/README.md +0 -61
  54. package/examples/lab-technician/.agent-personalizer.json +0 -38
  55. package/examples/lab-technician/AGENTS.md +0 -243
  56. package/examples/lab-technician/AGENT_ONBOARDING.md +0 -64
  57. package/examples/lab-technician/CLAUDE.md +0 -247
  58. package/examples/lab-technician/LEARNED.md +0 -14
  59. package/examples/lab-technician/USER.md +0 -53
  60. package/examples/lab-technician/notes/README.md +0 -26
  61. package/examples/lab-technician/notes/decisions.md +0 -4
  62. package/examples/lab-technician/notes/inbox/2026-10-06-observation-table.md +0 -3
  63. package/examples/lab-technician/notes/inbox/README.md +0 -7
  64. package/examples/lab-technician/notes/sessions/2026-W41.md +0 -7
  65. package/examples/lab-technician/rules/00-read-the-profile-first.md +0 -24
  66. package/examples/lab-technician/rules/10-evidence-before-assertion.md +0 -24
  67. package/examples/lab-technician/rules/20-one-owner-per-rule.md +0 -24
  68. package/examples/lab-technician/rules/30-folder-index-is-part-of-the-change.md +0 -26
  69. package/examples/lab-technician/rules/40-sign-every-edit.md +0 -25
  70. package/examples/lab-technician/rules/50-output-style.md +0 -21
  71. package/examples/lab-technician/rules/60-act-or-ask.md +0 -30
  72. package/examples/lab-technician/rules/65-ask-before-it-repeats.md +0 -18
  73. package/examples/lab-technician/rules/70-their-words-point-at-the-thing.md +0 -15
  74. package/examples/lab-technician/rules/80-symptoms-are-not-causes.md +0 -15
  75. package/examples/lab-technician/rules/90-surface-what-they-cant-see.md +0 -15
  76. package/examples/lab-technician/rules/README.md +0 -61
  77. package/examples/product-designer/.agent-personalizer.json +0 -38
  78. package/examples/product-designer/AGENTS.md +0 -243
  79. package/examples/product-designer/AGENT_ONBOARDING.md +0 -63
  80. package/examples/product-designer/CLAUDE.md +0 -247
  81. package/examples/product-designer/LEARNED.md +0 -14
  82. package/examples/product-designer/USER.md +0 -53
  83. package/examples/product-designer/notes/README.md +0 -26
  84. package/examples/product-designer/notes/decisions.md +0 -4
  85. package/examples/product-designer/notes/inbox/2026-10-06-cancellation-wording.md +0 -8
  86. package/examples/product-designer/notes/inbox/README.md +0 -7
  87. package/examples/product-designer/notes/sessions/2026-W41.md +0 -7
  88. package/examples/product-designer/rules/00-read-the-profile-first.md +0 -24
  89. package/examples/product-designer/rules/10-evidence-before-assertion.md +0 -24
  90. package/examples/product-designer/rules/20-one-owner-per-rule.md +0 -24
  91. package/examples/product-designer/rules/30-folder-index-is-part-of-the-change.md +0 -26
  92. package/examples/product-designer/rules/40-sign-every-edit.md +0 -25
  93. package/examples/product-designer/rules/50-output-style.md +0 -21
  94. package/examples/product-designer/rules/60-act-or-ask.md +0 -30
  95. package/examples/product-designer/rules/65-ask-before-it-repeats.md +0 -18
  96. package/examples/product-designer/rules/70-their-words-point-at-the-thing.md +0 -15
  97. package/examples/product-designer/rules/80-symptoms-are-not-causes.md +0 -15
  98. package/examples/product-designer/rules/90-surface-what-they-cant-see.md +0 -15
  99. package/examples/product-designer/rules/README.md +0 -61
package/CHANGELOG.md CHANGED
@@ -6,6 +6,27 @@ Every entry names the adversarial audit round that produced it where one did. Au
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.10.0] - 2026-11-18
10
+
11
+ ### Added
12
+
13
+ - Add `templates/GEMINI.md` pointer headers, `## binding:gemini` rule sections, `.gemini/commands/personalize.toml` for `/personalize`, `hooks/gemini-cli/session-start.sh` emitting `SessionStart` `additionalContext` JSON, and Google Antigravity (`~/.gemini/config/GEMINI.md`, 24,000-byte cap) documentation (#48).
14
+ - Read Codex `memories_v2/` (`MEMORY.md`, `memory_summary.md`, `rollout_summaries/*.md`) alongside legacy `~/.codex/memories/` (#46).
15
+ - Ship `skills/agent-personalizer/SKILL.md` in the npm package (#50).
16
+
17
+ ### Changed
18
+
19
+ - Require Node.js 22 or later and run CI on Node 22, 24 and 26 (Active LTS) (#49).
20
+ - Pack `examples/answers.json` instead of full rendered example subdirectories, remove unused pre-0.8.0 interview exports from `render/onboarding.cjs`, share CLI helpers in `bin/cli-util.cjs`, and make `test/rollback.test.js` self-seeding (#50).
21
+ - Document ChatGPT's 5,000-character paid and 1,500-character Free/Go limits, update `--global` and Hermes Agent target lists across docs and issue templates, add `/docs/guides/` section anchors, and expand CLI `--help` synopses (#49).
22
+
23
+ ### Fixed
24
+
25
+ - Audit 2026-11-17: resolve Gemini CLI `v0.42+` project slugs from `projects.json` and `.project_root` (including subfolders and `~/.cache/.gemini/tmp`), and reconstruct Gemini CLI `v0.40+` append-only `.jsonl` (`MessageRecord`, string and part-array `content`, `$patch`, `$rewindTo`), `session-*.json` files and `subagent` filtering (#46).
26
+ - Audit 2026-11-17: normalize Unicode to `NFC` in `check/gate.cjs` and collapse whitespace in `bin/learn.cjs` path redaction (#47).
27
+ - Audit 2026-11-17: scope `bin/global.cjs` path qualification to installer boilerplate and rules so user `USER.md` prose and `LEARNED.md` entries are never rewritten, and isolate `HOME` in `scripts/record-demo.sh` (#47).
28
+ - Audit 2026-11-17: sync and pin `website/release-fallback.json` to `package.json`, fix the `docs/install.md` `--global` target list, and tailor the `learn --global` completion hint (#48, #49).
29
+
9
30
  ## [0.9.1] - 2026-11-10
10
31
 
11
32
  ### Security
@@ -372,7 +393,8 @@ Thirteen issues (#3 to #15) filed against `5972b32` by an independent installati
372
393
  - Installer: safe destination resolution, strict options, duplicate `--ai` refused, `--dir` created one level at a time.
373
394
  - Harness: exact exit codes, adversarial fixtures, fault injection for the rollback path.
374
395
 
375
- [Unreleased]: https://github.com/aunysillyme/agent-personalizer/compare/v0.9.1...HEAD
396
+ [Unreleased]: https://github.com/aunysillyme/agent-personalizer/compare/v0.10.0...HEAD
397
+ [0.10.0]: https://github.com/aunysillyme/agent-personalizer/compare/v0.9.1...v0.10.0
376
398
  [0.9.1]: https://github.com/aunysillyme/agent-personalizer/compare/v0.9.0...v0.9.1
377
399
  [0.9.0]: https://github.com/aunysillyme/agent-personalizer/compare/v0.8.7...v0.9.0
378
400
  [0.8.7]: https://github.com/aunysillyme/agent-personalizer/compare/v0.8.6...v0.8.7
package/CONTRIBUTING.md CHANGED
@@ -10,8 +10,8 @@ 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: 101 checks, exact exit codes, Linux and macOS
14
- node test/rollback.test.js "$(mktemp -d)" # after copying examples/freelance-illustrator into it
13
+ npm test # sh test/run.sh: 102 checks, exact exit codes, Linux and macOS
14
+ node test/rollback.test.js
15
15
  node check/gate.cjs --self-test
16
16
  ```
17
17
 
@@ -25,7 +25,7 @@ The privacy gate (`check/gate.cjs` against a real list) needs a local `check/for
25
25
 
26
26
  ## Adding a notes tool or an AI target
27
27
 
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.
28
+ - A notes tool is ONE entry in the `TOOL` table at the top of `render/onboarding.cjs` (`kind`, `label`, `name`, `reach`, `posture`); the saved choice options, validation and 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 saved options equal the table's keys.
29
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
package/README.md CHANGED
@@ -14,7 +14,7 @@
14
14
  npx agent-personalizer
15
15
  ```
16
16
 
17
- ![A 14-second tour: answer a few questions once, one profile and rule source becomes each AI's own file, the drift check keeps them in sync, and the closing card shows the install command.](https://raw.githubusercontent.com/aunysillyme/agent-personalizer/main/docs/trailer.gif)
17
+ ![Earlier product tour showing one profile and rule source rendered into each AI's own file, kept in sync by the drift check.](https://raw.githubusercontent.com/aunysillyme/agent-personalizer/main/docs/trailer.gif)
18
18
 
19
19
  ## What it sets up
20
20
 
@@ -25,8 +25,8 @@ npx agent-personalizer
25
25
  | Local session digest | With your yes, recent typed messages your AI uses to ask up to five evidence-backed questions. |
26
26
  | `AGENT_ONBOARDING.md` | Your AI's reading order, writing policy, off-limits topics and approval steps. |
27
27
  | `CLAUDE.md` | Your profile and selected rules in Claude Code's project instruction file. |
28
- | `AGENTS.md` | Your profile and selected rules in the project file used by Codex and Cursor. |
29
- | `GEMINI.md` | Your profile and selected rules in Gemini CLI's instruction file. |
28
+ | `AGENTS.md` | Your profile and selected rules in the project file used by Codex, Cursor and Hermes Agent. |
29
+ | `GEMINI.md` | Your profile and selected rules in Gemini CLI and Google Antigravity's instruction file. |
30
30
  | ChatGPT paste files | `chatgpt-box1.txt` for your profile and `chatgpt-box2.txt` for response instructions, plus a preview with counts. |
31
31
  | `system-prompt.md` | Shareable universal rules for another chat app, bot or API. |
32
32
  | Notes folder, level 2 | A folder index, weekly session template, decisions log and inbox for local or fallback notes tools. |
@@ -41,7 +41,7 @@ npx agent-personalizer
41
41
 
42
42
  Start your AI in the installed project folder. Ask it which instruction file loaded and what your writing policy is. Confirm those answers against AGENT_ONBOARDING.md before the first write.
43
43
 
44
- If you accepted session reading, Claude Code's `/personalize`, or the procedure in Codex and Gemini CLI's home files, asks up to five questions with a count and a short quote. Yes records a confirmed entry; no records a declined entry that is never asked again. Every approved entry reaches your selected personal AI files. As you work, a second correction of the same thing prompts one "Make it a rule?" question.
44
+ If you accepted session reading, `/personalize` in Claude Code and Gemini CLI, or the procedure in Codex's home file, asks up to five questions with a count and a short quote. Yes records a confirmed entry; no records a declined entry that is never asked again. Every approved entry reaches your selected personal AI files. As you work, a second correction of the same thing prompts one "Make it a rule?" question.
45
45
 
46
46
  For ChatGPT, open Settings → Personalization and enable customization. Copy the exported profile (`chatgpt-box1.txt`) and response instructions (`chatgpt-box2.txt`) into the fields your current interface provides, checking its displayed limits. Re-paste after updates; the [paste guide](docs/paste-guide.md) covers each app.
47
47
 
@@ -56,8 +56,10 @@ 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 |
59
+ | [lean-browser-use](https://github.com/aunysillyme/lean-browser-use) | Cut Claude Code browser use cost 3% to 25% (about 14% in 2 runs): fresh runner subagent, bulk reads, 3 guards and a token meter. One npx command. |
60
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 |
61
+ | [decompose](https://github.com/aunysillyme-dev/aunx-decompose) | Task planner and wave checker for AI coding agents: splits prompts into checkable units and parallel waves, rejecting cycles and overlapping writes |
62
+ | [aunx-skills](https://github.com/aunysillyme-dev/aunx-skills) | Ten standalone agent skills for Claude Code, Codex, Cursor and Gemini CLI: full output keeper, number guard, docs fetch ladder, rename sweep and more |
61
63
  <!-- set:end -->
62
64
 
63
65
  ## Choose your setup
@@ -86,7 +88,7 @@ The source lives in `~/.agent-personalizer/`; marked blocks go to `~/.claude/CLA
86
88
 
87
89
  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.
88
90
 
89
- Node 22 or 24 (active LTS) is recommended; 18 or later runs. Published on npm with provenance. [Installation](docs/install.md) covers scripted answers, every flag, notes tools and manual copying.
91
+ Node 24 or 26 (active LTS) is recommended; 22 or later runs. Published on npm with provenance. [Installation](docs/install.md) covers scripted answers, every flag, notes tools and manual copying.
90
92
 
91
93
  The tool runs locally after `npx` fetches the package. The installer and renderer make no network calls and send no telemetry. Project writes stay inside the folder you name; global writes use the profile and selected home paths above. Edited source files are preserved and named.
92
94
 
@@ -94,7 +96,7 @@ The tool runs locally after `npx` fetches the package. The installer and rendere
94
96
 
95
97
  With your yes, learning reads up to 20 recent sessions kept by your selected Claude Code, Codex or Gemini CLI apps, plus Codex memory notes. It keeps typed messages, drops AI replies and tool output, and saves one local `.agent-personalizer/digest.md` ignored by git. The terminal lists files and counts, never message text. Your AI reads the digest, so its contents go to that provider again, like anything you paste in.
96
98
 
97
- Reuse only history you are allowed to share. Past sessions can include other people's details; put their names or other private terms in `check/forbidden.local.txt` before accepting. Check your agreement for work or client accounts. `npx agent-personalizer learn --forget` deletes the digest, and uninstall removes unchanged recorded digest files; both leave your AI apps' history alone. agent-personalizer is not affiliated with Anthropic, OpenAI or Google, and their saved formats can change. See [learning and privacy](docs/learning.md).
99
+ Reuse only history you are allowed to share. Past sessions can include other people's details; put their names or other private terms in `check/forbidden.local.txt` before accepting. Check your agreement for work or client accounts. `npx agent-personalizer learn --forget` deletes the digest, and uninstall removes unchanged recorded digest files; both leave your AI apps' history alone. agent-personalizer is not affiliated with Anthropic, OpenAI, Google, Anysphere or Nous Research, and their saved formats can change. See [learning and privacy](docs/learning.md).
98
100
 
99
101
  ## Keep it in sync
100
102
 
@@ -121,7 +123,7 @@ node render/render.cjs --dir . --check
121
123
 
122
124
  ## Put the contract in context
123
125
 
124
- At level 3, [register the Claude Code hook](hooks/README.md) to inject the onboarding restrictions and `inject: true` rules at session start. For another AI, generate a prompt to paste into its first message:
126
+ At level 3, [register the Claude Code or Gemini CLI hook](hooks/README.md) to inject the onboarding restrictions and `inject: true` rules at session start. For another AI, generate a prompt to paste into its first message:
125
127
 
126
128
  ```bash
127
129
  node render/render.cjs --dir . --contract > contract.txt
@@ -157,7 +159,7 @@ npx agent-personalizer --dir . --answers my-answers.json
157
159
 
158
160
  ## Common questions
159
161
 
160
- ### How do I share custom instructions across Claude Code, Codex, Cursor and ChatGPT?
162
+ ### How do I share custom instructions across Claude Code, Codex, Cursor, Gemini CLI, Hermes Agent and ChatGPT?
161
163
 
162
164
  Run `npx agent-personalizer` and select the AIs you use. One profile and rule source produce the instructions each target can carry; ChatGPT gets its profile and selected session rules as paste files.
163
165
 
@@ -213,7 +215,7 @@ Contributions are welcome: a new AI target, a notes tool, an example user, or a
213
215
 
214
216
  Pull requests are accepted under the [contributor license agreement](CLA.md); the checkbox in the pull request template records your agreement.
215
217
 
216
- The harness (`test/run.sh: 101 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.
218
+ The harness (`test/run.sh: 102 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.
217
219
 
218
220
  ## License
219
221
 
package/RELEASING.md CHANGED
@@ -4,8 +4,8 @@ Maintainer notes. Follow the steps below for version sites, rendering, checks an
4
4
 
5
5
  1. Every change in the release has a `CHANGELOG.md` line under `[Unreleased]`, naming the audit round or issue that produced it where one did.
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
- 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
- 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.
7
+ 3. Set the version in the four places the harness pins together: `package.json`, `const VERSION` in `render/onboarding.cjs` (it builds the docs URL every installed file links to), the tiers link in `hooks/README.md`, and `website/release-fallback.json` (plus its `publishedAt` date).
8
+ 4. Re-render all three example directories (`examples/freelance-illustrator`, `examples/lab-technician`, `examples/product-designer`), because their 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
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
10
  6. `sh test/run.sh` green locally (the count guard included). Push `main`; CI green on that commit.
11
11
  7. `git tag -a vX.Y.Z -m "X.Y.Z: <one line>"` and `git push origin main vX.Y.Z`.
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 101-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 102-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.
@@ -11,13 +11,13 @@ const fs = require('fs');
11
11
  const path = require('path');
12
12
  const readline = require('readline');
13
13
  const { resolveHome } = require('./home.cjs');
14
+ const { sha256, parseCliArgs } = require('./cli-util.cjs');
14
15
  const crypto = require('crypto');
15
16
  const { execFileSync } = require('child_process');
16
- const sha256 = (bytes) => crypto.createHash('sha256').update(bytes).digest('hex');
17
- // CLAUDE.md and AGENTS.md are written here as a pointer template only; render.cjs (run at the
17
+ // CLAUDE.md, AGENTS.md and GEMINI.md are written here as a pointer template only; render.cjs (run at the
18
18
  // end of main()) splices in the rendered block and records the final bytes it wrote, so their
19
19
  // hash is recorded there, once, against the complete file.
20
- const HOME_NAMES = new Set(['CLAUDE.md', 'AGENTS.md']);
20
+ const HOME_NAMES = new Set(['CLAUDE.md', 'AGENTS.md', 'GEMINI.md']);
21
21
 
22
22
  const PKG = path.resolve(__dirname, '..');
23
23
  const onboarding = require(path.join(PKG, 'render', 'onboarding.cjs'));
@@ -34,14 +34,14 @@ const FLAG_OPTS = ['--global', '--forget', '--all-projects', '--yes', '--default
34
34
  const USAGE = `agent-personalizer ${require(path.join(PKG, 'package.json')).version}
35
35
 
36
36
  npx agent-personalizer [--dir <folder>] [--ai claude,agents,gemini,chatgpt,prompt] [--level 1|2|3]
37
- [--answers <file.json> | --answers - | --defaults] [--full] [--yes]
38
- [--help | -h] [--version | -v]
39
- npx agent-personalizer --global [--ai claude,agents,gemini,hermes] [--yes]
37
+ [--answers <file.json> | --answers - | --defaults] [--compact]
38
+ [--precommit] [--full] [--yes] [--help | -h] [--version | -v]
39
+ npx agent-personalizer --global [--ai claude,agents,gemini,hermes] [--compact] [--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
+ npx agent-personalizer learn --global [--yes | --forget]
45
45
  npx agent-personalizer learn --forget [--dir <folder>]
46
46
 
47
47
  First interactive install: choose your AIs, then choose whether to read your recent sessions.
@@ -65,25 +65,7 @@ const USAGE = `agent-personalizer ${require(path.join(PKG, 'package.json')).vers
65
65
  exit codes: 0 ok · 1 unexpected error · 2 refused or invalid input
66
66
  `;
67
67
  /* Parse argv once, strictly: value options at most once each, flags at most once, nothing unknown. */
68
- function parseArgs() {
69
- const out = {};
70
- const argv = process.argv.slice(2);
71
- for (let i = 0; i < argv.length; i++) {
72
- const a = argv[i];
73
- if (i === 0 && a === 'learn') { out.command = a; continue; }
74
- if (VALUE_OPTS.includes(a)) {
75
- if (a in out) die(`${a} given more than once`);
76
- const v = argv[i + 1];
77
- if (v === undefined || v === '' || v.startsWith('--')) die(`${a} needs a non-empty value`);
78
- out[a] = v; i++;
79
- } else if (FLAG_OPTS.includes(a)) {
80
- if (a in out) die(`${a} given more than once`);
81
- out[a] = true;
82
- } else die(`unknown option "${a}" (known: ${[...VALUE_OPTS, ...FLAG_OPTS].join(', ')})`);
83
- }
84
- return out;
85
- }
86
- const ARGS = parseArgs();
68
+ const ARGS = parseCliArgs(process.argv.slice(2), { valueOpts: VALUE_OPTS, flagOpts: FLAG_OPTS, commands: ['learn'], onError: die });
87
69
  function arg(name, dflt) { return name in ARGS ? ARGS[name] : dflt; }
88
70
  if (ARGS['--help'] || ARGS['-h']) { process.stdout.write(USAGE); process.exit(0); }
89
71
  if (ARGS['--version'] || ARGS['-v']) { process.stdout.write(require(path.join(PKG, 'package.json')).version + '\n'); process.exit(0); }
@@ -227,7 +209,7 @@ async function commitPlan(root, { writes, removals = [], outputPaths, prepare, f
227
209
  for (const p of writes) {
228
210
  assertSaved(p.rel);
229
211
  touched.add(p.rel);
230
- const mode = p.rel === 'hooks/claude-code/session-start.sh' ? 0o755 : saved.get(p.rel)?.mode;
212
+ const mode = (p.rel === 'hooks/claude-code/session-start.sh' || p.rel === 'hooks/gemini-cli/session-start.sh') ? 0o755 : saved.get(p.rel)?.mode;
231
213
  replace(p.rel, p.bytes, mode);
232
214
  if (p.report) console.log(p.report);
233
215
  }
@@ -477,15 +459,22 @@ async function main() {
477
459
  const ms = markers.markerState(text, name);
478
460
  return ms.kind === 'one' ? text.slice(0, ms.bStart) + text.slice(ms.eEnd) : text;
479
461
  };
480
- for (const name of ['CLAUDE.md', 'AGENTS.md']) {
481
- if (keptRuleTargets.has(name === 'CLAUDE.md' ? 'claude' : 'agents') || adoptedRuleTargets.has(name === 'CLAUDE.md' ? 'claude' : 'agents')) continue;
462
+ for (const [name, targetKey] of [['CLAUDE.md', 'claude'], ['AGENTS.md', 'agents'], ['GEMINI.md', 'gemini']]) {
463
+ if (keptRuleTargets.has(targetKey) || adoptedRuleTargets.has(targetKey)) continue;
482
464
  const prior = previousPlan.find(p => p.rel === name);
483
465
  const next = plan.find(p => p.rel === name);
484
466
  if (!prior || !next) continue;
485
467
  const { full, exists } = probe(root, name);
486
468
  if (!exists || !fs.lstatSync(full).isFile()) continue;
487
469
  const current = fs.readFileSync(full, 'utf8');
488
- if (outside(current, name) !== outside(prior.text, name)) preservedTargets.add(name === 'CLAUDE.md' ? 'claude' : 'agents');
470
+ // Pre-0.10.0 GEMINI.md had no pointer header; adopt the new pointer template cleanly if untouched.
471
+ if (name === 'GEMINI.md' && markers.markerState(current, name).kind === 'one' && outside(current, name).trim() === '' && installedHashes[name] === sha256(fs.readFileSync(full))) {
472
+ const upgraded = markers.splice(next.text, markers.between(current, name), name);
473
+ upgrades.push({ rel: name, bytes: Buffer.from(upgraded), report: `update ${name} (added pointer header)` });
474
+ installedHashes[name] = sha256(Buffer.from(upgraded));
475
+ continue;
476
+ }
477
+ if (outside(current, name) !== outside(prior.text, name)) preservedTargets.add(targetKey);
489
478
  const migration = migrateHome(current, prior.text, next.text, text => markers.markerState(text, name));
490
479
  for (const line of migration.edited) console.log(`kept ${name} (edited pointer; manual review): ${line}`);
491
480
  if (migration.changed) {
@@ -620,7 +609,7 @@ async function main() {
620
609
  // Which of the files just written an AI picks up on its own, and which a human still has to paste.
621
610
  // Claude Code reads CLAUDE.md from the folder; claude.ai reads no files at all, and the success
622
611
  // text used to say nothing about that.
623
- const AUTO = { claude: 'CLAUDE.md (Claude Code)', agents: 'AGENTS.md (Codex, Cursor, anything that reads AGENTS.md)', gemini: 'GEMINI.md (Gemini CLI)' };
612
+ const AUTO = { claude: 'CLAUDE.md (Claude Code)', agents: 'AGENTS.md (Codex, Cursor, Hermes Agent, anything that reads AGENTS.md)', gemini: 'GEMINI.md (Gemini CLI, Google Antigravity)' };
624
613
  const PASTE = {
625
614
  claude: 'claude.ai and the Claude apps read no files: paste the body of USER.md, then AGENT_ONBOARDING.md, into the project or profile instructions',
626
615
  chatgpt: 'ChatGPT: open Settings → Personalization and enable customization. Copy the exported profile (chatgpt-box1.txt) and response instructions (chatgpt-box2.txt) into the fields your current interface provides, checking its displayed limits',
@@ -639,7 +628,7 @@ async function main() {
639
628
  `Which file each AI reads, and what to re-paste after you change an answer: ${DOCS}/paste-guide.md`,
640
629
  ].filter(Boolean).join('\n '));
641
630
  if (level >= 2 && kind !== 'cloud') steps.push(`Read ${base}/README.md before letting an AI write into ${base}/.`);
642
- if (level >= 3) steps.push('Register hooks/claude-code/session-start.sh (see hooks/README.md) and copy check/forbidden.example.txt to check/forbidden.local.txt.');
631
+ if (level >= 3) steps.push('Register hooks/claude-code/session-start.sh or hooks/gemini-cli/session-start.sh (see hooks/README.md) and copy check/forbidden.example.txt to check/forbidden.local.txt.');
643
632
  console.log('\nNext:');
644
633
  steps.forEach((step, i) => console.log(` ${i + 1}. ${step}`));
645
634
  if (answers.notes_tool === 'obsidian') console.log(answers.obsidian_tc === 'yes'
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ const crypto = require('node:crypto');
4
+
5
+ const sha256 = bytes => crypto.createHash('sha256').update(bytes).digest('hex');
6
+
7
+ function parseCliArgs(argv, { valueOpts = [], flagOpts = [], commands = [], onError }) {
8
+ const out = {};
9
+ for (let i = 0; i < argv.length; i++) {
10
+ const a = argv[i];
11
+ if (i === 0 && commands.includes(a)) { out.command = a; continue; }
12
+ if (valueOpts.includes(a)) {
13
+ if (a in out) onError(`${a} given more than once`);
14
+ const v = argv[i + 1];
15
+ if (v === undefined || v === '' || v.startsWith('--')) onError(`${a} needs a non-empty value`);
16
+ out[a] = v;
17
+ i++;
18
+ } else if (flagOpts.includes(a)) {
19
+ if (a in out) onError(`${a} given more than once`);
20
+ out[a] = true;
21
+ } else {
22
+ onError(`unknown option "${a}" (known: ${[...valueOpts, ...flagOpts].join(', ')})`);
23
+ }
24
+ }
25
+ return out;
26
+ }
27
+
28
+ module.exports = { sha256, parseCliArgs };
package/bin/global.cjs CHANGED
@@ -112,13 +112,13 @@ async function execute({ args, commitPlan, probe, readConfig, ask }) {
112
112
  createdDirectories: old.createdDirectories || [], globalFiles: { ...(old.globalFiles || {}) }, toolingVersion: require('../package.json').version };
113
113
  if (args['--compact']) cfg.compact = true;
114
114
  const renderCfg = { ...cfg, onboarding: answers };
115
- const rendered = renderer.renderedContents(profileRoot, renderCfg, { profileSource: decode(user, 'USER.md'), learned });
116
115
  const qualify = text => text
117
- .replace(/`USER\.md` sits next to `(?:CLAUDE|AGENTS)\.md`\./g, 'Read `USER.md` from the global profile source.')
116
+ .replace(/`USER\.md` sits next to `(?:CLAUDE|AGENTS|GEMINI)\.md`\.(?: In (?:Claude Code|Gemini CLI and Google Antigravity), `(?:CLAUDE|GEMINI)\.md` loads automatically;)?/g, 'Read `USER.md` from the global profile source.')
118
117
  .replace(/"npx agent-personalizer --dir \.", or "node render\/render\.cjs --dir \." at level 3/g, '"npx agent-personalizer --global"')
119
118
  .replace(/(^|[^A-Za-z0-9_./-])(USER\.md|LEARNED\.md|AGENT_ONBOARDING\.md|\.agent-personalizer\.json|\.agent-personalizer\/digest\.md)(?![A-Za-z0-9_/-])/g, (_, prefix, rel) => prefix + path.join(profileRoot, rel));
119
+ const rendered = renderer.renderedContents(profileRoot, renderCfg, { profileSource: decode(user, 'USER.md'), learned, boilerplate: qualify });
120
120
  for (const entry of rendered) {
121
- if (entry.key === 'onboarding') { writeSource(entry.rel, Buffer.from(renderer.splice(null, qualify(entry.block), entry.rel))); continue; }
121
+ if (entry.key === 'onboarding') { writeSource(entry.rel, Buffer.from(renderer.splice(null, entry.block, entry.rel))); continue; }
122
122
  const rel = TARGETS[entry.key];
123
123
  const found = probe(root, rel);
124
124
  if (found.exists && !fs.lstatSync(found.full).isFile()) refuse(`${rel} is not a regular file`);
@@ -128,7 +128,7 @@ async function execute({ args, commitPlan, probe, readConfig, ask }) {
128
128
  if (ms.kind === 'one' && !Object.hasOwn(cfg.globalFiles, entry.key)) {
129
129
  refuse(`${rel}: foreign agent-personalizer block; remove the block from <!-- agent-personalizer:begin --> through <!-- agent-personalizer:end -->, then re-run --global. Nothing was written`);
130
130
  }
131
- const block = `Profile source: \`${path.join(profileRoot, 'USER.md')}\`. Read \`${path.join(profileRoot, 'AGENT_ONBOARDING.md')}\` for working preferences.\n\n` + qualify(entry.block);
131
+ const block = `Profile source: \`${path.join(profileRoot, 'USER.md')}\`. Read \`${path.join(profileRoot, 'AGENT_ONBOARDING.md')}\` for working preferences.\n\n` + entry.block;
132
132
  const output = renderer.splice(text, block, rel);
133
133
  if (output.length > renderer.FILE_BUDGET) console.log(`OVER BUDGET ${rel} (${output.length} characters, budget ${renderer.FILE_BUDGET}; --compact shortens rules)`);
134
134
  if (renderer.markerState(output, rel).kind !== 'one' || renderer.between(output, rel) !== block) refuse(`${rel}: generated block would not re-parse; nothing was written`);
@@ -3,11 +3,10 @@
3
3
  // the static release table recognizes untouched copies from before hashes were recorded.
4
4
  const fs = require('fs');
5
5
  const path = require('path');
6
- const crypto = require('crypto');
6
+ const { sha256 } = require('./cli-util.cjs');
7
7
  const PKG = path.resolve(__dirname, '..');
8
8
  const onboarding = require('../render/onboarding.cjs');
9
- const RUNTIME_FILES = ['render/render.cjs', 'render/targets.json', 'render/onboarding.cjs', 'hooks/README.md', 'hooks/claude-code/session-start.sh', 'check/gate.cjs', 'check/forbidden.example.txt'];
10
- const sha256 = bytes => crypto.createHash('sha256').update(bytes).digest('hex');
9
+ const RUNTIME_FILES = ['render/render.cjs', 'render/targets.json', 'render/onboarding.cjs', 'hooks/README.md', 'hooks/claude-code/session-start.sh', 'hooks/gemini-cli/session-start.sh', 'check/gate.cjs', 'check/forbidden.example.txt'];
11
10
  const stripSignature = text => text.split('\n').filter(line => !line.includes('40-sign-every-edit.md') && !/^`?Last edited by:/.test(line)).join('\n');
12
11
 
13
12
  function recordedHash(cfg, rel) {
@@ -102,6 +101,7 @@ function installPlan({ answers, level, targets, notesScaffolded, legacyRules = f
102
101
  // Entries belong to the user as soon as the template is written, even untouched.
103
102
  plan.push({ rel: 'LEARNED.md', text: fs.readFileSync(path.join(PKG, 'templates', 'LEARNED.md'), 'utf8'), firstOnly: true });
104
103
  if (targets.includes('claude')) plan.push({ rel: '.claude/commands/personalize.md', text: onboarding.learningProcedure() + '\n' });
104
+ if (targets.includes('gemini')) plan.push({ rel: '.gemini/commands/personalize.toml', text: onboarding.geminiPersonalizeToml() });
105
105
  // rules/ is copied at level 3, where it becomes yours to edit; levels 1 and 2 render from the package's rules
106
106
  if (level >= 3) for (const f of fs.readdirSync(path.join(PKG, 'rules')).sort()) {
107
107
  if (noSig && f === '40-sign-every-edit.md') continue;
@@ -145,6 +145,7 @@ function installPlan({ answers, level, targets, notesScaffolded, legacyRules = f
145
145
  const POINTER = 'pointer file; the renderer fills its block below';
146
146
  if (targets.includes('claude')) plan.push({ rel: 'CLAUDE.md', text: home('CLAUDE.md'), note: POINTER });
147
147
  if (targets.includes('agents')) plan.push({ rel: 'AGENTS.md', text: home('AGENTS.md'), note: POINTER });
148
+ if (targets.includes('gemini')) plan.push({ rel: 'GEMINI.md', text: home('GEMINI.md'), note: POINTER });
148
149
  if (level >= 2 && kind !== 'cloud') { // a cloud tool's notes are not local files; no folder named after a workspace
149
150
  mdCopy(`${base}/README.md`, path.join(PKG, 'templates', 'FOLDER_README.md'));
150
151
  mdCopy(`${base}/sessions/TEMPLATE-week.md`, path.join(PKG, 'templates', 'session-log.md'));
package/bin/learn.cjs CHANGED
@@ -3,6 +3,7 @@
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
5
  const { resolveHome } = require('./home.cjs');
6
+ const { sha256 } = require('./cli-util.cjs');
6
7
  const crypto = require('crypto');
7
8
  const readline = require('readline');
8
9
  const renderer = require('../render/render.cjs');
@@ -93,7 +94,12 @@ function quote(text) {
93
94
  function label(text, terms = []) {
94
95
  const clean = String(text).replace(/[\r\n\u0000-\u001f\u007f]/g, ' ').replace(/agent-personalizer:/g, 'agent-personalizer&#58;');
95
96
  const folded = clean.normalize('NFC').toLowerCase();
96
- return terms.some(term => folded.includes(String(term).normalize('NFC').toLowerCase())) ? '[private path]' : clean;
97
+ const collapsed = folded.replace(/\s+/g, '');
98
+ return terms.some(raw => {
99
+ const term = String(raw).normalize('NFC').toLowerCase().trim();
100
+ const tight = term.replace(/\s+/g, '');
101
+ return (term && folded.includes(term)) || (tight && collapsed.includes(tight));
102
+ }) ? '[private path]' : clean;
97
103
  }
98
104
  function shownFile(file, home, terms) {
99
105
  const relative = path.relative(home, file);
@@ -137,7 +143,6 @@ function replace(root, rel, text) {
137
143
  } finally { if (fs.existsSync(tmp)) fs.unlinkSync(tmp); }
138
144
  }
139
145
 
140
- const sha256 = bytes => crypto.createHash('sha256').update(bytes).digest('hex');
141
146
  function canOverwrite(cfg, prior, rel) {
142
147
  if (!prior.exists) return true;
143
148
  if (!cfg.installed || !Object.hasOwn(cfg.installed, rel)) return false;
@@ -182,7 +187,9 @@ async function learn({ dir = '.', yes = false, consented = false, allProjects =
182
187
  console.log(`Files checked: ${data.filesChecked}. Files read: ${data.filesRead.length}. Sessions: ${data.sessions.length}. Memory notes: ${data.memories.length}.`);
183
188
  console.log(`Skipped by reason: ${Object.entries(data.skipped).map(([reason, count]) => `${reason}: ${count}`).join(', ') || 'none'}`);
184
189
  console.log(`Digest: ${path.join(root, DIGEST)}`);
185
- console.log('Next: open your AI in this folder. It asks up to 5 questions from this digest, one at a time (in Claude Code, /personalize starts them).');
190
+ console.log(cfg.global
191
+ ? 'Next: open a new AI session in any project. It asks up to 5 questions from this digest, one at a time.'
192
+ : 'Next: open your AI in this folder. It asks up to 5 questions from this digest, one at a time (in Claude Code and Gemini CLI, /personalize starts them).');
186
193
  return true;
187
194
  }
188
195