agent-personalizer 0.9.1 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/CONTRIBUTING.md +3 -3
  3. package/README.md +15 -13
  4. package/RELEASING.md +2 -2
  5. package/SECURITY.md +1 -1
  6. package/bin/agent-personalizer.js +128 -38
  7. package/bin/cli-util.cjs +28 -0
  8. package/bin/global.cjs +159 -33
  9. package/bin/home.cjs +69 -4
  10. package/bin/install-plan.cjs +4 -3
  11. package/bin/learn.cjs +15 -7
  12. package/bin/sessions.cjs +235 -44
  13. package/bin/uninstall.cjs +3 -3
  14. package/check/gate.cjs +46 -6
  15. package/docs/companions.md +5 -5
  16. package/docs/guarantees.md +4 -4
  17. package/docs/install.md +7 -7
  18. package/docs/learning.md +10 -10
  19. package/docs/paste-guide.md +13 -10
  20. package/docs/tiers.md +1 -1
  21. package/hooks/README.md +17 -1
  22. package/hooks/gemini-cli/session-start.sh +15 -0
  23. package/llms.txt +6 -4
  24. package/package.json +6 -3
  25. package/render/onboarding.cjs +30 -47
  26. package/render/render.cjs +24 -15
  27. package/rules/00-read-the-profile-first.md +3 -0
  28. package/rules/20-one-owner-per-rule.md +3 -0
  29. package/rules/30-folder-index-is-part-of-the-change.md +3 -0
  30. package/rules/40-sign-every-edit.md +4 -1
  31. package/skills/agent-personalizer/SKILL.md +104 -0
  32. package/templates/GEMINI.md +30 -0
  33. package/examples/freelance-illustrator/.agent-personalizer.json +0 -57
  34. package/examples/freelance-illustrator/AGENTS.md +0 -244
  35. package/examples/freelance-illustrator/AGENT_ONBOARDING.md +0 -67
  36. package/examples/freelance-illustrator/CLAUDE.md +0 -248
  37. package/examples/freelance-illustrator/LEARNED.md +0 -14
  38. package/examples/freelance-illustrator/USER.md +0 -54
  39. package/examples/freelance-illustrator/notes/README.md +0 -39
  40. package/examples/freelance-illustrator/notes/decisions.md +0 -18
  41. package/examples/freelance-illustrator/notes/inbox/2026-09-03-shot-list-for-six-prints.md +0 -14
  42. package/examples/freelance-illustrator/notes/inbox/README.md +0 -19
  43. package/examples/freelance-illustrator/notes/sessions/2026-W36.md +0 -41
  44. package/examples/freelance-illustrator/rules/00-read-the-profile-first.md +0 -24
  45. package/examples/freelance-illustrator/rules/10-evidence-before-assertion.md +0 -24
  46. package/examples/freelance-illustrator/rules/20-one-owner-per-rule.md +0 -24
  47. package/examples/freelance-illustrator/rules/30-folder-index-is-part-of-the-change.md +0 -26
  48. package/examples/freelance-illustrator/rules/40-sign-every-edit.md +0 -25
  49. package/examples/freelance-illustrator/rules/50-output-style.md +0 -21
  50. package/examples/freelance-illustrator/rules/60-act-or-ask.md +0 -30
  51. package/examples/freelance-illustrator/rules/65-ask-before-it-repeats.md +0 -18
  52. package/examples/freelance-illustrator/rules/70-their-words-point-at-the-thing.md +0 -15
  53. package/examples/freelance-illustrator/rules/80-symptoms-are-not-causes.md +0 -15
  54. package/examples/freelance-illustrator/rules/90-surface-what-they-cant-see.md +0 -15
  55. package/examples/freelance-illustrator/rules/README.md +0 -61
  56. package/examples/lab-technician/.agent-personalizer.json +0 -38
  57. package/examples/lab-technician/AGENTS.md +0 -243
  58. package/examples/lab-technician/AGENT_ONBOARDING.md +0 -64
  59. package/examples/lab-technician/CLAUDE.md +0 -247
  60. package/examples/lab-technician/LEARNED.md +0 -14
  61. package/examples/lab-technician/USER.md +0 -53
  62. package/examples/lab-technician/notes/README.md +0 -26
  63. package/examples/lab-technician/notes/decisions.md +0 -4
  64. package/examples/lab-technician/notes/inbox/2026-10-06-observation-table.md +0 -3
  65. package/examples/lab-technician/notes/inbox/README.md +0 -7
  66. package/examples/lab-technician/notes/sessions/2026-W41.md +0 -7
  67. package/examples/lab-technician/rules/00-read-the-profile-first.md +0 -24
  68. package/examples/lab-technician/rules/10-evidence-before-assertion.md +0 -24
  69. package/examples/lab-technician/rules/20-one-owner-per-rule.md +0 -24
  70. package/examples/lab-technician/rules/30-folder-index-is-part-of-the-change.md +0 -26
  71. package/examples/lab-technician/rules/40-sign-every-edit.md +0 -25
  72. package/examples/lab-technician/rules/50-output-style.md +0 -21
  73. package/examples/lab-technician/rules/60-act-or-ask.md +0 -30
  74. package/examples/lab-technician/rules/65-ask-before-it-repeats.md +0 -18
  75. package/examples/lab-technician/rules/70-their-words-point-at-the-thing.md +0 -15
  76. package/examples/lab-technician/rules/80-symptoms-are-not-causes.md +0 -15
  77. package/examples/lab-technician/rules/90-surface-what-they-cant-see.md +0 -15
  78. package/examples/lab-technician/rules/README.md +0 -61
  79. package/examples/product-designer/.agent-personalizer.json +0 -38
  80. package/examples/product-designer/AGENTS.md +0 -243
  81. package/examples/product-designer/AGENT_ONBOARDING.md +0 -63
  82. package/examples/product-designer/CLAUDE.md +0 -247
  83. package/examples/product-designer/LEARNED.md +0 -14
  84. package/examples/product-designer/USER.md +0 -53
  85. package/examples/product-designer/notes/README.md +0 -26
  86. package/examples/product-designer/notes/decisions.md +0 -4
  87. package/examples/product-designer/notes/inbox/2026-10-06-cancellation-wording.md +0 -8
  88. package/examples/product-designer/notes/inbox/README.md +0 -7
  89. package/examples/product-designer/notes/sessions/2026-W41.md +0 -7
  90. package/examples/product-designer/rules/00-read-the-profile-first.md +0 -24
  91. package/examples/product-designer/rules/10-evidence-before-assertion.md +0 -24
  92. package/examples/product-designer/rules/20-one-owner-per-rule.md +0 -24
  93. package/examples/product-designer/rules/30-folder-index-is-part-of-the-change.md +0 -26
  94. package/examples/product-designer/rules/40-sign-every-edit.md +0 -25
  95. package/examples/product-designer/rules/50-output-style.md +0 -21
  96. package/examples/product-designer/rules/60-act-or-ask.md +0 -30
  97. package/examples/product-designer/rules/65-ask-before-it-repeats.md +0 -18
  98. package/examples/product-designer/rules/70-their-words-point-at-the-thing.md +0 -15
  99. package/examples/product-designer/rules/80-symptoms-are-not-causes.md +0 -15
  100. package/examples/product-designer/rules/90-surface-what-they-cant-see.md +0 -15
  101. package/examples/product-designer/rules/README.md +0 -61
package/docs/learning.md CHANGED
@@ -18,8 +18,8 @@ that Claude Code, Codex and Gemini CLI still keep, to find corrections you repea
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
- · Codex's own memory notes are included when you choose Codex.
22
- They are global to your Codex account, not limited to this folder.
21
+ · Local Codex memory notes from your Codex home are included when you choose Codex.
22
+ They span sessions on this machine (or connected host), not just this folder.
23
23
  · When your AI reads the file, its provider sees these messages again.
24
24
  · Work or client accounts: check your agreement before reusing their sessions.
25
25
  · Not affiliated with Anthropic, OpenAI or Google. Their formats can change.
@@ -43,13 +43,13 @@ The saved AI selection chooses the sources. The reader takes up to 20 of the new
43
43
  | Selected target | Local source |
44
44
  |---|---|
45
45
  | `claude` | Claude Code: `~/.claude/projects/<project>/<session>.jsonl`, directly inside each project folder |
46
- | `agents` | Codex: `~/.codex/sessions/**/rollout-*.jsonl`, plus `~/.codex/memories/*.md` |
47
- | `gemini` | Gemini CLI: `~/.gemini/tmp/<hash>/chats/session-*.jsonl` and the older `logs.json` |
46
+ | `agents` | Codex: `~/.codex/sessions/**/rollout-*.jsonl`, plus `~/.codex/memories/*.md` and `~/.codex/memories_v2/**/*.md` (or under `$CODEX_HOME` when set) |
47
+ | `gemini` | Gemini CLI: `~/.gemini/tmp/<slug-or-hash>/chats/session-*.jsonl` (and `.json`), `~/.cache/.gemini/tmp/<slug>/chats/` when sandboxed, and older `logs.json` |
48
48
  | `chatgpt`, `prompt` | No local session reader |
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
+ 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 resolves project slugs from `~/.gemini/projects.json` and `.project_root` markers, with its legacy SHA-256 project folder as a fallback. 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.
51
51
 
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
+ 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 live in the local Codex store for this machine or connected host (`~/.codex` or `$CODEX_HOME`), so they span local Codex work beyond this folder rather than syncing across your OpenAI account. 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 records reconstruct final conversation state across append-only records, snapshots, patches and rewinds; a message repeated in the chat and logs is included once. The all-projects option affects session history; the memory file limit still applies.
53
53
 
54
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.
55
55
 
@@ -65,7 +65,7 @@ Messages and memory notes that look like secrets are dropped whole and counted u
65
65
 
66
66
  ## What your AI asks and keeps
67
67
 
68
- Start your AI in the installed folder. Claude Code has `/personalize`; Codex and Gemini CLI receive the same procedure in their home files. At level 3, the session-start contract points to `/personalize` while a digest has not been handled.
68
+ Start your AI in the installed folder. Claude Code and Gemini CLI have `/personalize`; Codex receives the same procedure in its home file. At level 3, the session-start contract points to `/personalize` (or the home-file procedure for `agents`) while a digest has not been handled.
69
69
 
70
70
  Each question includes a count and one short quote, such as "You've asked me to shorten replies 3 times this week. Make it a rule?" Fewer real patterns means fewer questions. Entries already confirmed or declined are never asked again.
71
71
 
@@ -81,7 +81,7 @@ Each question includes a count and one short quote, such as "You've asked me to
81
81
  - digest: <ISO timestamp>
82
82
  ```
83
83
 
84
- Confirmed entries reach `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, the ChatGPT paste exports and the session-start contract. Declined entries become a "Never ask again" list; the ChatGPT list may be shortened to fit its budget. Proposed entries render nowhere. The shareable system prompt carries no entries.
84
+ Confirmed entries reach `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, global `SOUL.md` when Hermes is selected, the ChatGPT paste exports and the session-start contract. Declined entries become a "Never ask again" list; ChatGPT exports include the complete declined list in full, flag `OVER BUDGET` in the preview when a box exceeds its target limit, and refuse to write when `--strict` is passed. Proposed entries render nowhere. The shareable system prompt carries no entries.
85
85
 
86
86
  After recording answers, the AI marks the digest as asked and re-renders. If it has no shell, it asks you to run `npx agent-personalizer --dir .`. At level 3 you can run `node render/render.cjs --dir .` and `node render/render.cjs --dir . --check`. Re-paste changed ChatGPT exports. As you work, a second correction of the same thing prompts one evidence-backed "Make it a rule?" question.
87
87
 
@@ -97,10 +97,10 @@ npx agent-personalizer --uninstall --dir .
97
97
 
98
98
  ## How the loop closes
99
99
 
100
- The installed home files carry the learning procedure; Claude Code also gets `.claude/commands/personalize.md`. At level 3, the session-start contract points at `/personalize` while a digest id is unasked. Your AI asks the questions, writes the statuses and digest id to `LEARNED.md`, then re-renders. Only current confirmed entries apply. A summary in `USER.md` can lag until an installer re-run; `LEARNED.md` owns entry status.
100
+ The installed home files carry the learning procedure; Claude Code also gets `.claude/commands/personalize.md` and Gemini CLI gets `.gemini/commands/personalize.toml`. At level 3, the session-start contract points at `/personalize` (or the home-file procedure for `agents`) while a digest id is unasked. Your AI asks the questions, writes the statuses and digest id to `LEARNED.md`, then re-renders. Only current confirmed entries apply. A summary in `USER.md` can lag until an installer re-run; `LEARNED.md` owns entry status.
101
101
 
102
102
  Nothing watches the digest or verifies model behaviour in the background. You can verify the files with `npx agent-personalizer --dir .`, then at level 3, `node render/render.cjs --dir . --check`. A clean check exits 0; drift exits 1; invalid input exits 2. Check `LEARNED.md` for the approved or declined line and the digest id under `## Asked`. Re-paste ChatGPT's boxes after changes. With no shell, the AI tells you to run the re-render command.
103
103
 
104
- The reader uses Node 18 built-ins and no network. Formats, unreadable files, symlinks, oversized lines and private matches are counted as skips. The digest header records the selected sources, files and counts; the terminal lists read paths without message text. Report a reader failure or leak through the channels in [SECURITY.md](../SECURITY.md).
104
+ The reader uses Node 22 built-ins and no network. Formats, unreadable files, symlinks, oversized lines and private matches are counted as skips. The digest header records the selected sources, files and counts; the terminal lists read paths without message text. Report a reader failure or leak through the channels in [SECURITY.md](../SECURITY.md).
105
105
 
106
106
  The installer does not upload the digest. Other software can sync or share its containing folder; choose a private local folder if you want the copy to stay on this computer. The local `LEARNED.md` is the source of truth for entries; generated blocks and paste files are checked copies, and the digest is disposable evidence.
@@ -5,9 +5,9 @@ The renderer writes one file per AI. This page says where each AI reads it, and
5
5
  | Rendered file | Who reads it | How it is read |
6
6
  |---|---|---|
7
7
  | `CLAUDE.md` | Claude Code | Automatically, from the project, or `~/.claude/CLAUDE.md` for every project with `--global`. Nothing to paste. |
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
- | `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
- | `GEMINI.md` | Gemini CLI | Automatically, from the folder; `--global` writes `~/.gemini/GEMINI.md` for all projects. Nothing to paste. |
8
+ | `AGENT_ONBOARDING.md` | any AI | Named as the second thing to read in `CLAUDE.md`, `AGENTS.md` and `GEMINI.md`. Paste or upload it where the AI does not read your local folder directly (below). |
9
+ | `AGENTS.md` | Codex CLI, Cursor, Hermes Agent, and other agents that adopted the AGENTS.md convention | Automatically, from the repository root; `--global` writes `~/.codex/AGENTS.md` (or `$CODEX_HOME/AGENTS.md` when `CODEX_HOME` is set) for all projects. Nothing to paste. |
10
+ | `GEMINI.md` | Gemini CLI and Google Antigravity | Automatically, from the folder; `--global` writes `~/.gemini/GEMINI.md` for all projects (also read by Google Antigravity alongside `~/.gemini/config/GEMINI.md`). Nothing to paste. |
11
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. |
12
12
  | `chatgpt-box1.txt`, `chatgpt-box2.txt` and `chatgpt-custom-instructions.md` | ChatGPT | Profile and response text to paste, with a preview and counts. |
13
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. |
@@ -32,32 +32,35 @@ Re-paste after every re-render. `--check` verifies the files on disk; it cannot
32
32
 
33
33
  ## ChatGPT
34
34
 
35
- Open Settings → Personalization and enable customization. Copy the exported profile and response instructions into the fields your current interface provides, checking its displayed limits.
35
+ Open Settings → Personalization (or Settings → Customize ChatGPT on iOS and Android) and enable customization. Copy the exported profile and response instructions into the fields your current interface provides, checking its displayed limits.
36
36
 
37
37
  - **Profile:** `chatgpt-box1.txt` is the plain profile text. An edited or pre-existing `USER.md` is its source too. Confirmed entries from `LEARNED.md` reach the ChatGPT exports.
38
38
  - **Response instructions:** `chatgpt-box2.txt` is the plain onboarding and selected rule text.
39
39
  - **Preview:** `chatgpt-custom-instructions.md` carries both exports inside fences with their character counts.
40
40
 
41
- The configured budget is 1,500 characters per export in `render/targets.json`; your current interface displays its own limits. With onboarding answers, box 1 compacts the generated profile while its structure still parses, and preserves custom profile text in full when it does not. Box 2 places the onboarding block (always-ask, off-limits, write policy, then style) before the selected session rules. Confirmed entries are retained; declined "Never ask again" entries may be shortened to fit the budget. Proposed entries are omitted. The preview reports each count. Over-budget text is written in full and flagged OVER BUDGET; `--strict` refuses the write. Review the text against your displayed limits. For the full onboarding, entries and rule source, create a ChatGPT Project and upload `AGENT_ONBOARDING.md`, `LEARNED.md` and `rules/` as project files.
41
+ The configured baseline budget is 1,500 characters per export in `render/targets.json`: ChatGPT Free and Go accounts cap Custom Instructions at 1,500 characters, while Plus, Pro, Business, Enterprise and Edu accounts allow up to 5,000 characters under Settings → Personalization (`More about you` and `Custom instructions`; `Customize ChatGPT` on mobile). With onboarding answers, box 1 compacts the generated profile while its structure still parses, and preserves custom profile text in full when it does not. Box 2 places the onboarding block (always-ask, off-limits, write policy, then style) before the selected session rules. Confirmed entries and declined "Never ask again" entries are both appended in full; nothing is truncated silently. Proposed entries are omitted. The preview reports each count; over-budget text is written in full and flagged `OVER BUDGET`, while `--strict` refuses the write. Review the text against your account's displayed limits. Account-level Custom Instructions do not read your local project folder directly, whereas file access in ChatGPT depends on the surface, uploads and enabled tools; for the full onboarding, entries and rule source in a ChatGPT Project, upload `AGENT_ONBOARDING.md`, `LEARNED.md` and `rules/` as project files (or add Project instructions under Project settings).
42
42
 
43
43
  ## Codex CLI
44
44
 
45
45
  Run the installer at the repo root, then start Codex in that project. Codex builds its instruction chain once per run:
46
46
 
47
- - **Global guidance:** the first non-empty `AGENTS.override.md` or `AGENTS.md` in the Codex home directory, normally `~/.codex`.
47
+ - **Global guidance:** the first non-empty `AGENTS.override.md` or `AGENTS.md` in the Codex home directory (`~/.codex`, or `$CODEX_HOME` when set). `--global --ai agents` writes to that effective Codex home and warns without modifying `AGENTS.override.md` when a non-empty override shadows `AGENTS.md`.
48
48
  - **Project guidance:** files from the repository root down to the working directory are merged in that order. Deeper files take precedence over earlier guidance. With no project root, discovery checks the working directory.
49
- - **Per directory:** `AGENTS.override.md` is tried before `AGENTS.md`, followed by configured fallback filenames. At most one file is selected per directory.
49
+ - **Per directory:** `AGENTS.override.md` is tried before `AGENTS.md`, followed by configured fallback filenames. At most one file is selected per directory; project installs warn if a non-empty `AGENTS.override.md` in the target folder shadows `AGENTS.md`.
50
50
  - **Size cap:** the combined guidance has a default limit of 32 KiB, configurable with `project_doc_max_bytes`.
51
+ - **Verify in a fresh session:** run `codex --ask-for-approval never "Summarize the current instructions."` (or `"List the instruction sources you loaded."`) from your repository root, check `echo $CODEX_HOME` if global guidance is missing, or inspect `codex -c log_dir=./.codex-log` (`./.codex-log/codex-tui.log`) to confirm which instruction files loaded.
51
52
 
52
- Verified against [OpenAI's Codex AGENTS.md documentation](https://learn.chatgpt.com/docs/agent-configuration/agents-md) on 2026-10-05. Restart Codex after an update so it rebuilds the instruction chain.
53
+ Verified against [OpenAI's Codex AGENTS.md documentation](https://developers.openai.com/codex/guides/agents-md) on 2026-11-18. Restart Codex after an update so it rebuilds the instruction chain.
53
54
 
54
55
  ## Cursor
55
56
 
56
57
  Reads `AGENTS.md` at the project root. Older setups use `.cursor/rules/`; if yours does, point one rule file at `AGENTS.md` rather than copying its text, so there is one owner.
57
58
 
58
- ## Gemini CLI
59
+ ## Gemini CLI and Google Antigravity
59
60
 
60
- Reads `GEMINI.md` from the folder (and parent folders). Run the installer with `--ai gemini` and there is nothing to paste.
61
+ Gemini CLI reads `GEMINI.md` from the folder (and parent folders), plus `~/.gemini/GEMINI.md` when installed with `--global --ai gemini`. Project installs also add `.gemini/commands/personalize.toml` for `/personalize`, and level-3 installs provide `hooks/gemini-cli/session-start.sh` for `.gemini/settings.json` (see [`hooks/README.md`](../hooks/README.md)).
62
+
63
+ Google Antigravity also reads project `GEMINI.md` files (from the workspace root up to the current folder) and `~/.gemini/GEMINI.md` for compatibility; its primary global instruction file is `~/.gemini/config/GEMINI.md`, which enforces a 24,000-byte per-file limit after includes. Use `--compact` if a custom rule set approaches the 20,000-character warning budget.
61
64
 
62
65
  ## Anything else
63
66
 
package/docs/tiers.md CHANGED
@@ -55,7 +55,7 @@ The four file targets have a 20,000-character warning budget for the whole rende
55
55
 
56
56
  **What.** The handful of rules that must win at the moment of decision, injected in full at the start of every session. Not pointers. Full text.
57
57
 
58
- **Where.** A session-start hook (Claude Code has these). For AIs without hooks, a block you paste at the top of the first message, or a saved prompt that starts every session.
58
+ **Where.** A session-start hook (Claude Code and Gemini CLI both support `SessionStart` hooks; see [`hooks/README.md`](../hooks/README.md)). For AIs without hooks, a block you paste at the top of the first message, or a saved prompt that starts every session.
59
59
 
60
60
  **Prevents.** A tool's own instructions beating yours by default. Installed skills, plugins and tool descriptions each say "use me." A rule that says "use the other one first" loses that argument if it is only stated in a document the AI may or may not have opened. Injection makes sure your rule is at least in the room; it does not settle the argument on every host.
61
61
 
package/hooks/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # hooks/
2
2
 
3
- Tier 3 from the tiers doc (https://github.com/aunysillyme/agent-personalizer/blob/v0.9.1/docs/tiers.md): the few rules that must be in context at the moment of decision, injected in full at the start of every session. Injection puts the text in front of the model; whether the model follows it is up to the model and the host. This is the strongest placement available, not a guarantee.
3
+ Tier 3 from the tiers doc (https://github.com/aunysillyme/agent-personalizer/blob/v0.10.1/docs/tiers.md): the few rules that must be in context at the moment of decision, injected in full at the start of every session. Injection puts the text in front of the model; whether the model follows it is up to the model and the host. This is the strongest placement available, not a guarantee.
4
4
 
5
5
  Which rules? The ones with `inject: true` in their frontmatter. Keep that set small. Every injected rule costs tokens every session.
6
6
 
@@ -26,6 +26,22 @@ The contract is target-aware: `--contract-target claude` applies each rule's `su
26
26
 
27
27
  **Subagents do not get SessionStart.** A subagent you spawn from a session sees none of this unless you pass it in the task. That is why the rendered `CLAUDE.md` also carries pointers to every rule: the pointer survives, the injection does not.
28
28
 
29
+ ## Gemini CLI
30
+
31
+ `gemini-cli/session-start.sh` wraps `--contract --contract-target gemini` in Gemini CLI's structured `SessionStart` JSON output (`hookSpecificOutput.additionalContext`), so the contract enters model context rather than displaying only as a terminal status message. Register it in the project's `.gemini/settings.json`:
32
+
33
+ ```json
34
+ {
35
+ "hooks": {
36
+ "SessionStart": [
37
+ { "hooks": [ { "type": "command", "command": "sh \"$GEMINI_PROJECT_DIR/hooks/gemini-cli/session-start.sh\"" } ] }
38
+ ]
39
+ }
40
+ }
41
+ ```
42
+
43
+ For user-level `~/.gemini/settings.json`, use the absolute path to the installed project instead, for example `sh "/path/to/project/hooks/gemini-cli/session-start.sh"`.
44
+
29
45
  ## Everything else (plain-prompt fallback)
30
46
 
31
47
  For an AI with no hook system, generate the contract once and paste it at the top of the first message, or save it as the opening block of a reusable prompt:
@@ -0,0 +1,15 @@
1
+ #!/bin/sh
2
+ # Gemini CLI SessionStart hook: injects the rendered session-start contract as JSON additionalContext.
3
+ set -eu
4
+ ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
5
+ exec node -e '
6
+ const { spawnSync } = require("child_process");
7
+ const path = require("path");
8
+ const root = process.argv[1];
9
+ const r = spawnSync(process.execPath, [path.join(root, "render/render.cjs"), "--dir", root, "--contract", "--contract-target", "gemini"], { encoding: "utf8" });
10
+ if (r.status !== 0) {
11
+ process.stderr.write(r.stderr || r.stdout || "");
12
+ process.exit(r.status || 1);
13
+ }
14
+ process.stdout.write(JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: r.stdout } }) + "\n");
15
+ ' "$ROOT"
package/llms.txt CHANGED
@@ -1,14 +1,14 @@
1
1
  # agent-personalizer
2
2
 
3
- > Answer a few questions once, and every AI you use gets the same profile and the rules it can carry: Claude Code, Codex, Cursor, Gemini CLI, Hermes Agent and ChatGPT, rendered from one source and kept in sync.
3
+ > AI custom instructions from approved entries: a profile and rules for Claude Code, Codex, Cursor, Gemini CLI, Hermes Agent and ChatGPT, rendered from one source and kept in sync.
4
4
 
5
- Install with `npx agent-personalizer`. Node 22 or 24 (active LTS) is recommended; 18 or later runs. Headless setup: `npx agent-personalizer --dir . --ai claude,agents --level 1 --yes --defaults`.
5
+ Install with `npx agent-personalizer`. Node 24 or 26 (active LTS) is recommended; 22 or later runs. Headless setup: `npx agent-personalizer --dir . --ai claude,agents --level 1 --yes --defaults`.
6
6
 
7
7
  The installer asks which AIs you use and whether it may learn from your recent sessions, with No as the default. It writes USER.md, LEARNED.md, AGENT_ONBOARDING.md and each selected AI's instruction files. With a yes, it reads up to 20 recent sessions from Claude Code, Codex and Gemini CLI, plus Codex memory notes, and saves a local digest. The user's AI asks up to five evidence-backed questions; confirmed entries reach every selected personal target and declined entries are never asked again. Level 2 adds local notes scaffolds for local and fallback notes tools. Level 3 adds editable rules, a renderer, a session-start hook, a drift check and a forbidden-string gate.
8
8
 
9
9
  Re-runs ask nothing, keep saved answers and update untouched installed files and pointer lines. Edited copies stay and are named, old notes folders stay in place, and upgrades refresh untouched tools. USER.md supplies every profile export, including ChatGPT; LEARNED.md owns the shared entries. `npx agent-personalizer learn --dir .` asks for consent before collecting new evidence. `learn --forget` deletes the digest. Uninstall keeps a LEARNED.md with entries, removes the digest and restores untouched files byte for byte; neither touches the AI apps' history. Preview removal with `npx agent-personalizer --uninstall --dir . --dry`.
10
10
 
11
- Session data stays local until the user's AI reads it and sends it to its provider again. Only reuse history you may share, filter other people's details with check/forbidden.local.txt and check agreements for work accounts. The tool makes no network calls. It is not affiliated with Anthropic, OpenAI or Google, and their saved formats can change.
11
+ Session data stays local until the user's AI reads it and sends it to its provider again. Only reuse history you may share, filter other people's details with check/forbidden.local.txt and check agreements for work accounts. The tool makes no network calls. It is not affiliated with Anthropic, OpenAI, Google, Anysphere or Nous Research, and their saved formats can change.
12
12
 
13
13
  ## Docs
14
14
 
@@ -26,8 +26,10 @@ 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
29
+ - [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.
30
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
31
+ - [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
32
+ - [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
31
33
  <!-- set:end -->
32
34
 
33
35
  ## Optional
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-personalizer",
3
- "version": "0.9.1",
3
+ "version": "0.10.1",
4
4
  "description": "AI custom instructions from approved entries: a profile and rules for Claude Code, Codex, Cursor, Gemini CLI, Hermes Agent and ChatGPT, kept in sync from one source.",
5
5
  "author": "aunysillyme (https://github.com/aunysillyme)",
6
6
  "license": "MIT",
@@ -18,6 +18,8 @@
18
18
  "codex",
19
19
  "cursor",
20
20
  "gemini-cli",
21
+ "google-antigravity",
22
+ "hermes-agent",
21
23
  "chatgpt",
22
24
  "personalization",
23
25
  "agent-onboarding",
@@ -42,7 +44,7 @@
42
44
  "test": "sh test/run.sh"
43
45
  },
44
46
  "engines": {
45
- "node": ">=18"
47
+ "node": ">=22"
46
48
  },
47
49
  "files": [
48
50
  "bin",
@@ -50,11 +52,12 @@
50
52
  "rules",
51
53
  "templates",
52
54
  "hooks",
55
+ "skills",
53
56
  "check/gate.cjs",
54
57
  "check/forbidden.example.txt",
55
58
  "docs",
56
59
  "!docs/*.gif",
57
- "examples",
60
+ "examples/answers.json",
58
61
  "README.md",
59
62
  "LICENSE",
60
63
  "CLA.md",
@@ -17,7 +17,7 @@
17
17
  DOCS points at the matching tag on GitHub so an installed copy never links to a file the
18
18
  destination does not have.
19
19
  */
20
- const VERSION = '0.9.1';
20
+ const VERSION = '0.10.1';
21
21
  const DOCS = `https://github.com/aunysillyme/agent-personalizer/blob/v${VERSION}/docs`;
22
22
 
23
23
  /* THE single source for notes tools. Add a tool here and nowhere else: the saved choice option, the
@@ -72,52 +72,49 @@ const NOTES_PENDING_MARK = 'no local notes folder yet, so no folder rules yet';
72
72
  const notesLater = (base) => `\`--level 2\` creates \`${base}/\``;
73
73
 
74
74
  const LEGACY = [
75
- { id: 'name', ask: 'What should the AI call you?', type: 'text', default: 'the user' },
76
- { id: 'pronouns', ask: 'Your pronouns (leave blank to skip)', type: 'text', default: '' },
77
- { id: 'work', ask: 'What you do, in one line', type: 'text', default: '' },
78
- { id: 'focus', ask: 'Your current focus, one or two projects', type: 'text', default: '' },
75
+ { id: 'name', type: 'text', default: 'the user' },
76
+ { id: 'pronouns', type: 'text', default: '' },
77
+ { id: 'work', type: 'text', default: '' },
78
+ { id: 'focus', type: 'text', default: '' },
79
79
  ];
80
80
  const QUESTIONS = [
81
- { id: 'tone', ask: 'How direct should the AI be?', type: 'choice', default: 'direct',
81
+ { id: 'tone', type: 'choice', default: 'direct',
82
82
  options: [['direct', 'direct answers, no hedging, say what you think'], ['balanced', 'direct but soften disagreement'], ['gentle', 'lead with what works before what does not']] },
83
- { id: 'length', ask: 'How long should replies be?', type: 'choice', default: 'short',
83
+ { id: 'length', type: 'choice', default: 'short',
84
84
  options: [['short', 'short by default, detail on request'], ['adaptive', 'as long as the question needs'], ['thorough', 'complete every time']] },
85
- { id: 'mistakes', ask: 'When the AI is wrong, how should it handle it?', type: 'choice', default: 'one-line',
85
+ { id: 'mistakes', type: 'choice', default: 'one-line',
86
86
  options: [['one-line', 'state the correction in one line and move on'], ['brief', 'correction plus one line on the cause'], ['full', 'correction plus the full cause']] },
87
- { id: 'unsure', ask: 'When the AI is unsure, what should it do?', type: 'choice', default: 'ask-when-it-changes-the-build',
87
+ { id: 'unsure', type: 'choice', default: 'ask-when-it-changes-the-build',
88
88
  options: [['ask-when-it-changes-the-build', 'settle facts itself; ask only when the answer changes what gets built', 'settle facts yourself; ask only when the answer changes what gets built'], ['ask-first', 'ask before doing anything uncertain'], ['assume-and-say', 'proceed on a stated assumption, never ask']] },
89
- { id: 'lead_with', ask: 'What should a reply open with?', type: 'choice', default: 'verdict',
89
+ { id: 'lead_with', type: 'choice', default: 'verdict',
90
90
  options: [['verdict', 'the answer or the verdict'], ['summary', 'a one-paragraph summary'], ['context', 'the context, then the answer']] },
91
- { id: 'structure', ask: 'How should replies be shaped?', type: 'choice', default: 'bullets',
91
+ { id: 'structure', type: 'choice', default: 'bullets',
92
92
  options: [['bullets', 'lead-in line, then bullets, one item per line'], ['prose', 'short paragraphs'], ['tables-when-comparing', 'bullets by default, a table when comparing three or more things']] },
93
- { id: 'evidence', ask: 'Where should evidence for a claim go?', type: 'choice', default: 'inline',
93
+ { id: 'evidence', type: 'choice', default: 'inline',
94
94
  options: [['inline', 'in the reply: paths, counts, dates'], ['linked', 'a link to where it lives'], ['none', 'not needed']] },
95
- { id: 'never', ask: 'Words, punctuation or habits the AI must never use (comma-separated, blank for none)', type: 'list', default: [] },
96
- { id: 'read_first', ask: 'Files the AI reads first, in order (comma-separated)', type: 'list', default: ['USER.md', 'AGENT_ONBOARDING.md'] },
97
- { id: 'notes_tool', ask: 'Where do your notes live?', type: 'choice', default: 'folder',
95
+ { id: 'never', type: 'list', default: [] },
96
+ { id: 'read_first', type: 'list', default: ['USER.md', 'AGENT_ONBOARDING.md'] },
97
+ { id: 'notes_tool', type: 'choice', default: 'folder',
98
98
  options: Object.entries(TOOL).map(([k, t]) => [k, t.label]) },
99
- { id: 'obsidian_tc', ask: 'Do you use obsidian-tc, the governed MCP?', type: 'choice', default: 'no', when: (a) => a.notes_tool === 'obsidian',
99
+ { id: 'obsidian_tc', type: 'choice', default: 'no',
100
100
  options: [['no', 'not installed; the AI works on the vault folder directly'], ['yes', 'installed and connected; the AI reaches the vault through it']] },
101
- { id: 'notes_tool_name', ask: 'The name of that tool', type: 'text', default: '', when: (a) => a.notes_tool === 'other' },
102
- { id: 'notes_path', ask: 'Where inside it: the folder path (Obsidian, Logseq, plain folder), or the workspace / notebook / folder name (Notion, Google Docs, Apple Notes, others)', type: 'text', default: 'notes' },
103
- { id: 'tracker', ask: 'Your task tracker, if the AI should read it ("none" to skip)', type: 'text', default: 'none' },
104
- { id: 'write_policy', ask: 'How freely may the AI write into your notes?', type: 'choice', default: 'notes-freely',
101
+ { id: 'notes_tool_name', type: 'text', default: '' },
102
+ { id: 'notes_path', type: 'text', default: 'notes' },
103
+ { id: 'tracker', type: 'text', default: 'none' },
104
+ { id: 'write_policy', type: 'choice', default: 'notes-freely',
105
105
  options: [['notes-freely', 'anywhere under the notes folder, under the folder rules'], ['logs-and-inbox-only', 'only the session log, decisions log and inbox'], ['ask-before-every-write', 'ask before every write']] },
106
- { id: 'file_naming', ask: 'File naming for anything the AI creates', type: 'choice', default: 'kebab-case',
106
+ { id: 'file_naming', type: 'choice', default: 'kebab-case',
107
107
  options: [['kebab-case', 'my-note-title.md'], ['snake_case', 'my_note_title.md'], ['any', 'no rule']] },
108
- { id: 'signature', ask: 'Should every AI edit end with a signature line (who, model, date, what changed)?', type: 'choice', default: 'yes',
108
+ { id: 'signature', type: 'choice', default: 'yes',
109
109
  options: [['yes', 'one line, overwritten each edit'], ['no', 'no signature']] },
110
- { id: 'off_limits', ask: 'Folders or topics that never enter shared output (comma-separated, blank for none)', type: 'list', default: [] },
111
- { id: 'always_ask', ask: 'Actions the AI must always ask before (comma-separated from: delete, publish, send, spend, settings, standing-rules; blank for all)', type: 'multi',
110
+ { id: 'off_limits', type: 'list', default: [] },
111
+ { id: 'always_ask', type: 'multi',
112
112
  default: ['delete', 'publish', 'send', 'spend', 'settings', 'standing-rules'],
113
113
  options: [['delete', 'deleting or overwriting anything'], ['publish', 'publishing or posting anything public'], ['send', 'sending a message on your behalf'], ['spend', 'spending money'], ['settings', 'changing account or system settings'], ['standing-rules', 'creating a standing rule, schedule or automation']] },
114
114
  ];
115
115
 
116
116
  const SETTINGS = [...LEGACY, ...QUESTIONS];
117
117
  const IDS = new Set(SETTINGS.map(q => q.id));
118
- // The installer asks only which AIs and whether it may read sessions.
119
- const QUICK = [];
120
- function asks() { return false; }
121
118
  /* only the answers that differ from the defaults: what the installer stores, so the config reads as
122
119
  "what this person chose" and a future default applies to everyone who never chose otherwise */
123
120
  /* PINNED answers are always stored, default or not: they govern what the AI may touch, so a future
@@ -131,15 +128,6 @@ function defaults() {
131
128
  return a;
132
129
  }
133
130
 
134
- /* Interview defaults preserve even an empty saved answer. Asked answers override saved values;
135
- package defaults fill only missing keys. Validation remains the caller's final step. */
136
- function interviewDefault(q, saved) {
137
- return saved && Object.hasOwn(saved, q.id) ? saved[q.id] : q.default;
138
- }
139
- function interviewAnswers(saved, asked = {}) {
140
- return { ...defaults(), ...saved, ...asked };
141
- }
142
-
143
131
  /* Strict validation: unknown keys, wrong types and unknown choices are errors, never defaults.
144
132
  Returns the completed answer set (missing keys take their default). */
145
133
  const RESERVED = /<!--\s*agent-personalizer/i;
@@ -176,22 +164,13 @@ function validate(input) {
176
164
  const reserved = out.notes_path.split('/').find(segment => ['.git', '.github', 'node_modules'].includes(segment.toLowerCase()));
177
165
  if (kindOf(out) === 'disk' && reserved)
178
166
  throw new Error(`"notes_path" must not contain the reserved segment "${reserved}"`);
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'];
167
+ const owned = ['.agent-personalizer', '.agent-personalizer.json', '.claude', '.gemini', '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'];
180
168
  if (kindOf(out) === 'disk' && owned.some(p => out.notes_path.toLowerCase() === p.toLowerCase() || out.notes_path.toLowerCase().startsWith(p.toLowerCase() + '/')))
181
169
  throw new Error('"notes_path" must be outside agent-personalizer tool-owned paths, including .agent-personalizer/');
182
170
  return out;
183
171
  }
184
172
  const SAFE_REL = /^(?!\.\.?(?:\/|$))[A-Za-z0-9._ -]+(?:\/(?!\.\.?(?:\/|$))[A-Za-z0-9._ -]+)*$/;
185
173
 
186
- /* Parse one typed interview answer (a string) for a question; '' means the default. */
187
- function parseAnswer(q, raw) {
188
- const s = String(raw).trim();
189
- if (s === '') return Array.isArray(q.default) ? [...q.default] : q.default;
190
- if (q.type === 'text') return s;
191
- if (q.type === 'choice') return s;
192
- return s.split(',').map(x => x.trim()).filter(Boolean);
193
- }
194
-
195
174
  const label = (q, v) => { const o = q.options && q.options.find(x => x[0] === v); return o ? o[1] : v; };
196
175
  /* The interview asks the HUMAN about the AI, so an option's label is third person ("settle facts
197
176
  itself"). USER.md, AGENT_ONBOARDING.md and the session-start contract all address the AI
@@ -552,4 +531,8 @@ After the questions are answered (or no real patterns exist), add the full diges
552
531
  As you work, on the second correction of the same thing, ask once, naming both moments, "Make it a rule?" Save a yes or no with the same status and re-render. Check confirmed and declined entries before asking.`;
553
532
  }
554
533
 
555
- module.exports = { parseLearned, entriesBlock, learningProcedure, LEGACY, QUESTIONS, QUICK, PINNED, TOOL, VERSION, DOCS, FALLBACK, NOTES_PENDING_MARK, notesPending, asks, defaults, interviewDefault, interviewAnswers, sparse, validate, parseAnswer, renderUser, renderOnboarding, contractBlock, compactProfile, compactProfileFromUser, kindOf, baseFor };
534
+ function geminiPersonalizeToml() {
535
+ return `description = "Review the session learning digest and ask up to 5 preference questions."\nprompt = '''\n${learningProcedure()}\n'''\n`;
536
+ }
537
+
538
+ module.exports = { parseLearned, entriesBlock, learningProcedure, geminiPersonalizeToml, LEGACY, QUESTIONS, PINNED, TOOL, VERSION, DOCS, FALLBACK, notesPending, defaults, sparse, validate, renderUser, renderOnboarding, contractBlock, compactProfile, compactProfileFromUser, kindOf, baseFor };
package/render/render.cjs CHANGED
@@ -4,7 +4,7 @@
4
4
  render.cjs: USER.md + rules/*.md -> per-AI instruction files.
5
5
 
6
6
  usage:
7
- node render/render.cjs [--dir <project>] [--targets claude,agents,gemini,chatgpt,prompt] [--check] [--strict] [--rules <dir>]
7
+ node render/render.cjs [--dir <project>] [--targets claude,agents,gemini,hermes,chatgpt,prompt,onboarding] [--compact] [--check] [--strict] [--rules <dir>]
8
8
  node render/render.cjs [--dir <project>] --contract [--contract-target claude] [--no-personal]
9
9
  node render/render.cjs --help | -h · --version | -v
10
10
 
@@ -270,6 +270,9 @@ function rulesDir(root, explicit) {
270
270
  }
271
271
  function loadRules(root, explicit) {
272
272
  const rdir = rulesDir(root, explicit || null);
273
+ const pkgRules = (() => { try { return fs.realpathSync(path.resolve(__dirname, '..', 'rules')); } catch (_) { return ''; } })();
274
+ const realRdir = (() => { try { return fs.realpathSync(rdir); } catch (_) { return rdir; } })();
275
+ const packageOwned = realRdir === pkgRules;
273
276
  const out = [];
274
277
  for (const f of fs.readdirSync(rdir).sort()) {
275
278
  if (f === 'README.md') continue;
@@ -280,7 +283,7 @@ function loadRules(root, explicit) {
280
283
  const { meta, body } = parseFrontmatter(text, where);
281
284
  const sections = parseSections(body, where);
282
285
  if (!sections.universal) die(`${where}: missing "## universal" block`);
283
- out.push({ file: f, meta, sections });
286
+ out.push({ file: f, meta, sections, packageOwned });
284
287
  }
285
288
  return out;
286
289
  }
@@ -369,14 +372,14 @@ function pendingDigest(root, entries) {
369
372
  } finally { if (fd !== undefined) fs.closeSync(fd); }
370
373
  }
371
374
 
372
- function renderTarget(key, target, profile, rules, cfg, root, learned) {
375
+ function renderTarget(key, target, profile, rules, cfg, root, learned, boilerplate = text => text) {
373
376
  if (target.source === 'onboarding') {
374
377
  if (!cfg || !cfg.onboarding) die(`target "${key}": no onboarding answers in .agent-personalizer.json. Run the installer, or pass --answers <file>`);
375
- return onboarding.renderOnboarding(cfg.onboarding, { notesScaffolded: notesScaffolded(root, cfg.onboarding) });
378
+ return boilerplate(onboarding.renderOnboarding(cfg.onboarding, { notesScaffolded: notesScaffolded(root, cfg.onboarding) }));
376
379
  }
377
380
  rules = rulesAtLevel(rules, cfg);
378
381
  const answers = answersOf(cfg);
379
- const lines = [`## ${target.header}`, '', '_Generated by agent-personalizer from `USER.md`, `LEARNED.md`, `rules/` and your saved preferences. Edit those, then re-render. Do not edit between the markers._', ''];
382
+ const lines = [boilerplate(`## ${target.header}`), '', boilerplate('_Generated by agent-personalizer from `USER.md`, `LEARNED.md`, `rules/` and your saved preferences. Edit those, then re-render. Do not edit between the markers._'), ''];
380
383
  if (target.boxes) {
381
384
  // The profile's own bytes win over stored answers. A generated profile can still be compact,
382
385
  // but custom structure or prose stays in full. Box 2 uses the contract and inject:true rules
@@ -406,26 +409,27 @@ function renderTarget(key, target, profile, rules, cfg, root, learned) {
406
409
  const fenceFor = (text) => { let n = 3; for (const m of text.matchAll(/(`{3,}|~{3,})/g)) n = Math.max(n, m[1].length + 1); return '`'.repeat(n); };
407
410
  const f1 = fenceFor(box1), f2 = fenceFor(box2);
408
411
  renderTarget.boxes = { box1: box1 + '\n', box2: box2 + '\n' }; // plain paste files, written beside the markdown
409
- lines.push('### Box 1: "What would you like ChatGPT to know about you?"', '', '_Copy only the text inside the fence below (or paste the whole of `chatgpt-box1.txt`, the same text as a plain file)._', '', f1, box1, f1, warn('Box 1', box1), '');
410
- lines.push('### Box 2: "How would you like ChatGPT to respond?"', '', '_Copy only the text inside the fence below (or paste the whole of `chatgpt-box2.txt`)._', '', f2, box2, f2, warn('Box 2', box2));
411
- if (!answers) lines.push('', '> No onboarding answers in `.agent-personalizer.json`, so this is the full profile and every rule. Run the installer (it asks) for the compact, budgeted form.');
412
- else lines.push('', `> ChatGPT has no file access, so only the rules marked \`inject: true\` are here (${picked.length}). The rest live in \`rules/\`; for a ChatGPT Project, upload \`AGENT_ONBOARDING.md\` and \`rules/\` as project files instead of pasting.`);
412
+ lines.push('### Box 1: Profile ("More about you" / "What would you like ChatGPT to know about you?")', '', '_Copy only the text inside the fence below (or paste the whole of `chatgpt-box1.txt`, the same text as a plain file)._', '', f1, box1, f1, warn('Box 1', box1), '');
413
+ lines.push('### Box 2: Response instructions ("Custom instructions" / "How would you like ChatGPT to respond?")', '', '_Copy only the text inside the fence below (or paste the whole of `chatgpt-box2.txt`)._', '', f2, box2, f2, warn('Box 2', box2));
414
+ if (!answers) lines.push('', '> No onboarding answers in `.agent-personalizer.json`, so this is the full profile and every rule. Run the installer for the compact, budgeted form.');
415
+ else lines.push('', `> Account-level Custom Instructions do not read your local project folder directly (file access in ChatGPT depends on the surface, uploads and enabled tools), so only the rules marked \`inject: true\` are included here (${picked.length}). Free and Go plans allow up to 1,500 characters in Custom Instructions; Plus, Pro, Business, Enterprise and Edu plans allow up to 5,000 characters (check the limits and field names shown in Settings → Personalization, or Customize ChatGPT on mobile). The remaining rules live in \`rules/\`; for a ChatGPT Project, upload \`AGENT_ONBOARDING.md\`, \`LEARNED.md\` and \`rules/\` as project files.`);
413
416
  renderTarget.overBudget = (renderTarget.overBudget || []).concat(over.map(l => `${target.file}: ${l}`));
414
417
  return lines.join('\n');
415
418
  }
416
419
  if (target.profile && profile) lines.push('## Profile', '', profile.body, '');
417
420
  if (target.personal && target.profile) {
418
- lines.push(onboarding.entriesBlock(learned), '', `_LEARNED.md source: ${learned.hash}_`, '');
419
- if (['claude', 'agents', 'gemini', 'hermes'].includes(key)) lines.push(onboarding.learningProcedure(), '');
421
+ lines.push(onboarding.entriesBlock(learned), '', boilerplate(`_LEARNED.md source: ${learned.hash}_`), '');
422
+ if (['claude', 'agents', 'gemini', 'hermes'].includes(key)) lines.push(boilerplate(onboarding.learningProcedure()), '');
420
423
  }
421
424
  lines.push('## Rules', '');
422
425
  for (const r of rulesFor(rules, key, answers)) {
426
+ const qualifyRule = r.packageOwned ? boilerplate : text => text;
423
427
  if (cfg && cfg.compact && FILE_TARGETS.has(key) && r.meta.inject !== true) {
424
428
  const practice = r.sections.universal.split('\n').find(line => line.startsWith('In practice:'));
425
429
  if (!practice) die(`${r.file}: compact mode needs an In practice: line in the universal block`);
426
430
  const link = cfg.level === 1 || cfg.level === 2 ? `https://github.com/aunysillyme/agent-personalizer/blob/v${onboarding.VERSION}/rules/${r.file}` : `rules/${r.file}`;
427
- lines.push(`- **${r.meta.title || r.meta.id || r.file}**: ${practice} [Full rule](${link})`, '');
428
- } else lines.push(renderRule(r, target), '');
431
+ lines.push(qualifyRule(`- **${r.meta.title || r.meta.id || r.file}**: ${practice} [Full rule](${link})`), '');
432
+ } else lines.push(qualifyRule(renderRule(r, target)), '');
429
433
  }
430
434
  return lines.join('\n').trimEnd();
431
435
  }
@@ -512,7 +516,11 @@ function main() {
512
516
  }
513
517
  if (withPersonal) {
514
518
  out.push(onboarding.entriesBlock(learned), '');
515
- if (['claude', 'agents', 'gemini'].includes(key) && pendingDigest(root, learned)) out.push('[agent-personalizer] New session digest: run /personalize to review up to 5 questions.');
519
+ if (['claude', 'agents', 'gemini'].includes(key) && pendingDigest(root, learned)) {
520
+ out.push(key === 'agents'
521
+ ? '[agent-personalizer] New session digest: follow "Learn from my sessions" in AGENTS.md to review up to 5 questions.'
522
+ : '[agent-personalizer] New session digest: run /personalize to review up to 5 questions.');
523
+ }
516
524
  }
517
525
  process.stdout.write(out.join('\n'));
518
526
  return;
@@ -708,6 +716,7 @@ function renderedContents(root, cfg, options = {}) {
708
716
  const rules = loadRules(root, null);
709
717
  const profile = Object.hasOwn(options, 'profileSource') ? profileFromSource(options.profileSource) : loadProfile(root);
710
718
  const learned = options.learned || readLearned(root);
719
+ const boilerplate = typeof options.boilerplate === 'function' ? options.boilerplate : text => text;
711
720
  renderTarget.boxes = null;
712
721
  renderTarget.overBudget = [];
713
722
  renderTarget.fileBudget = [];
@@ -715,7 +724,7 @@ function renderedContents(root, cfg, options = {}) {
715
724
  const target = TARGETS[key];
716
725
  if (!target) die(`unknown target "${key}"`);
717
726
  safeTargetPath(root, target.file, key);
718
- const block = renderTarget(key, target, profile, rules, cfg, root, learned);
727
+ const block = renderTarget(key, target, profile, rules, cfg, root, learned, boilerplate);
719
728
  const out = [{ key, rel: target.file, block }];
720
729
  if (target.boxes) for (const [which, rel] of Object.entries(target.boxFiles || {})) {
721
730
  safeTargetPath(root, rel, `${key}:${which}`);
@@ -19,6 +19,9 @@ For learned entries, `LEARNED.md` owns the current status; a summary in the prof
19
19
  ## binding:agents
20
20
  `USER.md` sits next to `AGENTS.md`. Read it before the first tool call.
21
21
 
22
+ ## binding:gemini
23
+ `USER.md` sits next to `GEMINI.md`. In Gemini CLI and Google Antigravity, `GEMINI.md` loads automatically; read `USER.md` before the first tool call.
24
+
22
25
  ## origin
23
26
  Written after: an AI produced a week of correctly formatted, well-reasoned work in the wrong voice, for the wrong audience, because the profile lived in a file nothing told it to open. A second week went to an AI that knew the person well and still wrote into the wrong folder, because nothing told it where writes were allowed.
24
27
  Prevents: fluent output aimed at nobody in particular.
@@ -19,6 +19,9 @@ Pointer form in `CLAUDE.md`: a one-line rule followed by `[owner: rules/<file>.m
19
19
  ## binding:agents
20
20
  Pointer form in `AGENTS.md`: a one-line rule followed by `[owner: rules/<file>.md]`.
21
21
 
22
+ ## binding:gemini
23
+ Pointer form in `GEMINI.md`: a one-line rule followed by `[owner: rules/<file>.md]`.
24
+
22
25
  ## origin
23
26
  Written after: a routing rule was corrected in its owning document and, four days later, four other surfaces still carried the old version. One of them was quoted back to the user as if her own decision had been the reverse. The drift detector was green throughout, because it checked each surface against the rule as last recorded, not against the owner.
24
27
  Prevents: the same rule disagreeing with itself in five places.
@@ -21,6 +21,9 @@ Restate this rule in each folder's README so the folder carries its own contract
21
21
  ## binding:agents
22
22
  Check the folder's README before reporting a write as done.
23
23
 
24
+ ## binding:gemini
25
+ Check the folder's README before reporting a write as done.
26
+
24
27
  ## origin
25
28
  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.
26
29
  Prevents: a stale index, which is worse than a missing one because it is believed.
@@ -18,7 +18,10 @@ The ten-word summary is the audit trail a human reads first. Say what changed, n
18
18
  Name and model as the platform reports them, e.g. `Claude <model-id>`.
19
19
 
20
20
  ## binding:agents
21
- Name and model as the platform reports them, e.g. `Codex <model-id>`.
21
+ Name and model as the platform reports them, e.g. `Codex <model-id>`, `Cursor <model-id>` or `Hermes <model-id>`.
22
+
23
+ ## binding:gemini
24
+ Name and model as the platform reports them, e.g. `Gemini <model-id>`.
22
25
 
23
26
  ## origin
24
27
  Written after: three AIs and one human edited the same file over a month and nobody could say which change came from whom, or which model had written the paragraph that turned out to be wrong.