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/bin/sessions.cjs CHANGED
@@ -2,11 +2,12 @@
2
2
 
3
3
  const fs = require('node:fs');
4
4
  const path = require('node:path');
5
- const { resolveHome } = require('./home.cjs');
5
+ const { resolveHome, resolveCodexHome, walkRealChain } = require('./home.cjs');
6
6
  const crypto = require('node:crypto');
7
7
 
8
8
  const MAX_LINE = 8 * 1024 * 1024;
9
9
  const MAX_FILE = 64 * 1024 * 1024;
10
+ const MAX_META = 1024 * 1024;
10
11
  const MAX_MEMORIES = 20;
11
12
  const SOURCES = new Set(['claude-code', 'codex', 'gemini-cli']);
12
13
  const CONTEXT_HEADERS = ['# AGENTS.md instructions', '# Files mentioned by the user', '# Response annotations', '# Browser comments'];
@@ -22,7 +23,9 @@ function claudeProjectNames(projectDir) {
22
23
 
23
24
  function belongsToProject(cwd, projectDir) {
24
25
  if (typeof cwd !== 'string' || !path.isAbsolute(cwd)) return false;
25
- const relative = path.relative(projectDir, path.resolve(cwd));
26
+ const left = process.platform === 'win32' ? path.resolve(projectDir).toLowerCase() : path.resolve(projectDir);
27
+ const right = process.platform === 'win32' ? path.resolve(cwd).toLowerCase() : path.resolve(cwd);
28
+ const relative = path.relative(left, right);
26
29
  return relative === '' || (relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative));
27
30
  }
28
31
 
@@ -98,6 +101,16 @@ function textItems(content, type) {
98
101
  return content.filter(item => item && typeof item === 'object' && item.type === type && typeof item.text === 'string').map(item => item.text);
99
102
  }
100
103
 
104
+ function geminiMessageItems(content) {
105
+ if (typeof content === 'string') return [content];
106
+ if (!Array.isArray(content)) return [];
107
+ return content.flatMap(item => {
108
+ if (typeof item === 'string') return [item];
109
+ if (item && typeof item === 'object' && typeof item.text === 'string' && (!item.type || item.type === 'text')) return [item.text];
110
+ return [];
111
+ });
112
+ }
113
+
101
114
  async function statPath(file, kind, state, count = false) {
102
115
  if (count) state.filesChecked += 1;
103
116
  try {
@@ -125,6 +138,70 @@ async function candidate(file, source, project, format, state) {
125
138
  if (stat) state.candidates.push({ file, source, project, format, mtimeMs: stat.mtimeMs });
126
139
  }
127
140
 
141
+ // Streamed bounded read for small metadata files (projects.json, .project_root) without counting as a session file.
142
+ async function readSmallMeta(file, state) {
143
+ const relative = path.relative(state.home, file);
144
+ if (relative.startsWith(`..${path.sep}`) || relative === '..' || path.isAbsolute(relative)) return null;
145
+ let current = state.home;
146
+ if (!await statPath(current, 'directory', state)) return null;
147
+ for (const name of relative.split(path.sep).slice(0, -1)) {
148
+ current = path.join(current, name);
149
+ if (!await statPath(current, 'directory', state)) return null;
150
+ }
151
+ const before = await statPath(file, 'file', state);
152
+ if (!before || before.size > MAX_META) return null;
153
+ try {
154
+ const handle = await fs.promises.open(file, fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW || 0));
155
+ try {
156
+ const after = await handle.stat();
157
+ if (!after.isFile() || before.ino !== after.ino || before.dev !== after.dev || after.size > MAX_META) return null;
158
+ const chunks = [];
159
+ let total = 0;
160
+ const stream = handle.createReadStream({ autoClose: false, highWaterMark: 16 * 1024, start: 0, end: MAX_META - 1 });
161
+ for await (const chunk of stream) {
162
+ total += chunk.length;
163
+ if (total > MAX_META) return null;
164
+ chunks.push(chunk);
165
+ }
166
+ return Buffer.concat(chunks, total).toString('utf8');
167
+ } finally { await handle.close(); }
168
+ } catch { return null; }
169
+ }
170
+
171
+ async function geminiProjectDirs(app, tmp, state) {
172
+ const slugs = new Set([state.geminiProjectHash]);
173
+ const registries = [...new Set([path.join(app, 'projects.json'), path.join(state.home, '.gemini', 'projects.json')])];
174
+ for (const regFile of registries) {
175
+ const registryText = await readSmallMeta(regFile, state);
176
+ if (!registryText) continue;
177
+ try {
178
+ const parsed = JSON.parse(registryText);
179
+ if (parsed && typeof parsed === 'object' && parsed.projects && typeof parsed.projects === 'object' && !Array.isArray(parsed.projects)) {
180
+ for (const [registeredPath, slug] of Object.entries(parsed.projects)) {
181
+ if (typeof slug === 'string' && slug && !slug.includes('/') && !slug.includes('\\') && slug !== '.' && slug !== '..' && belongsToProject(registeredPath, state.projectDir)) {
182
+ slugs.add(slug);
183
+ }
184
+ }
185
+ }
186
+ } catch { /* ignore malformed registry */ }
187
+ }
188
+ for (const name of await children(tmp, state)) {
189
+ if (slugs.has(name)) continue;
190
+ const marker = await readSmallMeta(path.join(tmp, name, '.project_root'), state);
191
+ if (marker && belongsToProject(marker.trim(), state.projectDir)) slugs.add(name);
192
+ }
193
+ return [...slugs];
194
+ }
195
+
196
+ async function collectMemoryDir(dir, state) {
197
+ for (const name of await children(dir, state)) {
198
+ if (!name.endsWith('.md')) continue;
199
+ const file = path.join(dir, name);
200
+ const stat = await statPath(file, 'file', state, true);
201
+ if (stat) state.memoryFiles.push({ file, mtimeMs: stat.mtimeMs });
202
+ }
203
+ }
204
+
128
205
  async function discover(home, sources, state) {
129
206
  if (!await statPath(home, 'directory', state)) return;
130
207
  if (sources.has('claude-code')) {
@@ -144,8 +221,19 @@ async function discover(home, sources, state) {
144
221
  }
145
222
  }
146
223
  if (sources.has('codex')) {
147
- const app = path.join(home, '.codex');
148
- if (await statPath(app, 'directory', state)) {
224
+ let app = state.codexHome || path.join(home, '.codex');
225
+ let chainOk = true;
226
+ if (app !== path.join(home, '.codex')) {
227
+ try {
228
+ const chain = walkRealChain(app, { allowDarwinRootLink: true, action: 'skipped' });
229
+ if (chain.missingDirs.length) chainOk = false;
230
+ else app = chain.dir;
231
+ } catch (err) {
232
+ bump(state, /is a symlink/.test(err.message) ? 'symlink' : 'non_regular');
233
+ chainOk = false;
234
+ }
235
+ }
236
+ if (chainOk && await statPath(app, 'directory', state)) {
149
237
  async function walk(dir) {
150
238
  for (const name of await children(dir, state)) {
151
239
  const file = path.join(dir, name);
@@ -157,43 +245,61 @@ async function discover(home, sources, state) {
157
245
  }
158
246
  }
159
247
  await walk(path.join(app, 'sessions'));
160
- const memories = path.join(app, 'memories');
161
- for (const name of await children(memories, state)) {
162
- if (!name.endsWith('.md')) continue;
163
- const file = path.join(memories, name);
164
- const stat = await statPath(file, 'file', state, true);
165
- if (stat) state.memoryFiles.push({ file, mtimeMs: stat.mtimeMs });
248
+ await collectMemoryDir(path.join(app, 'memories'), state);
249
+ const memoriesV2 = path.join(app, 'memories_v2');
250
+ if (await statPath(memoriesV2, 'directory', state)) {
251
+ await collectMemoryDir(memoriesV2, state);
252
+ await collectMemoryDir(path.join(memoriesV2, 'rollout_summaries'), state);
166
253
  }
167
254
  }
168
255
  }
169
256
  if (sources.has('gemini-cli')) {
170
- const app = path.join(home, '.gemini');
171
- if (await statPath(app, 'directory', state)) {
257
+ const geminiRoots = [path.join(home, '.gemini')];
258
+ const cacheRoot = path.join(home, '.cache');
259
+ if (await statPath(cacheRoot, 'directory', state)) geminiRoots.push(path.join(cacheRoot, '.gemini'));
260
+ for (const app of geminiRoots) {
261
+ if (!await statPath(app, 'directory', state)) continue;
172
262
  const tmp = path.join(app, 'tmp');
173
- if (await statPath(tmp, 'directory', state)) {
174
- const projects = state.allProjects ? await children(tmp, state) : [state.geminiProjectHash];
175
- for (const project of projects) {
176
- const dir = path.join(tmp, project);
177
- if (!await statPath(dir, 'directory', state)) continue;
178
- for (const name of await children(path.join(dir, 'chats'), state)) {
179
- if (name.startsWith('session-') && name.endsWith('.jsonl')) await candidate(path.join(dir, 'chats', name), 'gemini-cli', project, 'gemini', state);
180
- }
181
- const logs = path.join(dir, 'logs.json');
182
- try {
183
- await fs.promises.lstat(logs);
184
- await candidate(logs, 'gemini-cli', project, 'gemini-logs', state);
185
- } catch (error) { if (error.code !== 'ENOENT') bump(state, 'unreadable'); }
263
+ if (!await statPath(tmp, 'directory', state)) continue;
264
+ const projects = state.allProjects ? await children(tmp, state) : await geminiProjectDirs(app, tmp, state);
265
+ for (const project of projects) {
266
+ const dir = path.join(tmp, project);
267
+ if (!await statPath(dir, 'directory', state)) continue;
268
+ for (const name of await children(path.join(dir, 'chats'), state)) {
269
+ if (name.startsWith('session-') && name.endsWith('.jsonl')) await candidate(path.join(dir, 'chats', name), 'gemini-cli', project, 'gemini', state);
270
+ else if (name.startsWith('session-') && name.endsWith('.json')) await candidate(path.join(dir, 'chats', name), 'gemini-cli', project, 'gemini-json', state);
186
271
  }
272
+ const logs = path.join(dir, 'logs.json');
273
+ try {
274
+ await fs.promises.lstat(logs);
275
+ await candidate(logs, 'gemini-cli', project, 'gemini-logs', state);
276
+ } catch (error) { if (error.code !== 'ENOENT') bump(state, 'unreadable'); }
187
277
  }
188
278
  }
189
279
  }
190
280
  }
191
281
 
192
282
  async function safeOpen(file, state) {
193
- // Recheck each path within HOME immediately before opening to catch replaced links.
194
- const relative = path.relative(state.home, file);
195
- if (relative.startsWith(`..${path.sep}`) || relative === '..' || path.isAbsolute(relative)) return null;
196
- let current = state.home;
283
+ // Recheck each path within HOME (or active CODEX_HOME) immediately before opening to catch replaced links.
284
+ let codexRoot = null;
285
+ if (state.codexHome && state.codexHome !== path.join(state.home, '.codex')) {
286
+ try {
287
+ const chain = walkRealChain(state.codexHome, { allowDarwinRootLink: true, action: 'skipped' });
288
+ if (!chain.missingDirs.length) codexRoot = chain.dir;
289
+ } catch { return null; }
290
+ }
291
+ const roots = codexRoot ? [codexRoot, state.home] : [state.home];
292
+ let baseRoot = null, relative = null;
293
+ for (const candidateRoot of roots) {
294
+ const rel = path.relative(candidateRoot, file);
295
+ if (!rel.startsWith(`..${path.sep}`) && rel !== '..' && !path.isAbsolute(rel)) {
296
+ baseRoot = candidateRoot;
297
+ relative = rel;
298
+ break;
299
+ }
300
+ }
301
+ if (!baseRoot) return null;
302
+ let current = baseRoot;
197
303
  if (!await statPath(current, 'directory', state)) return null;
198
304
  const parts = relative.split(path.sep);
199
305
  for (const name of parts.slice(0, -1)) {
@@ -346,31 +452,112 @@ async function readCodex(file, state) {
346
452
  return session.messages.length ? [session] : [];
347
453
  }
348
454
 
455
+ function finalizeGeminiMessages(session, messages, state) {
456
+ for (const message of messages) {
457
+ if (!message || typeof message !== 'object') continue;
458
+ messageTimestamp(session, message.timestamp);
459
+ if (message.type !== 'user') continue;
460
+ const text = typedText(geminiMessageItems(message.content), state);
461
+ if (text) session.messages.push(text);
462
+ }
463
+ }
464
+
349
465
  async function readGemini(file, state) {
350
466
  const session = baseSession(file);
351
- let known = false, messages = [];
467
+ let known = false, automation = false;
468
+ const byId = new Map();
469
+ const putMessage = message => {
470
+ if (!message || typeof message !== 'object') return;
471
+ const key = typeof message.id === 'string' && message.id ? message.id : Symbol();
472
+ byId.set(key, message);
473
+ };
352
474
  const ok = await scanLines(file.file, state, line => {
353
475
  const record = parsedLine(line, state);
354
476
  if (!record) return;
355
477
  if (typeof record.sessionId === 'string') { session.sessionId = record.sessionId; known = true; }
356
- if (record.$set && Object.prototype.hasOwnProperty.call(record.$set, 'messages')) {
357
- if (Array.isArray(record.$set.messages)) { messages = record.$set.messages; known = true; }
358
- else bump(state, 'unknown_format');
478
+ if (record.kind === 'subagent') { automation = true; known = true; }
479
+ if (typeof record.startTime === 'string') messageTimestamp(session, record.startTime);
480
+ if (typeof record.lastUpdated === 'string') messageTimestamp(session, record.lastUpdated);
481
+ if (record.$set && typeof record.$set === 'object' && !Array.isArray(record.$set)) {
482
+ known = true;
483
+ if (typeof record.$set.sessionId === 'string') session.sessionId = record.$set.sessionId;
484
+ if (record.$set.kind === 'subagent') automation = true;
485
+ if (typeof record.$set.lastUpdated === 'string') messageTimestamp(session, record.$set.lastUpdated);
486
+ if (Object.prototype.hasOwnProperty.call(record.$set, 'messages')) {
487
+ if (Array.isArray(record.$set.messages)) {
488
+ byId.clear();
489
+ for (const msg of record.$set.messages) putMessage(msg);
490
+ } else bump(state, 'unknown_format');
491
+ }
492
+ return;
493
+ }
494
+ if (typeof record.$rewindTo === 'string') {
495
+ known = true;
496
+ if (!byId.has(record.$rewindTo)) byId.clear();
497
+ else {
498
+ let drop = false;
499
+ for (const key of [...byId.keys()]) {
500
+ if (key === record.$rewindTo) drop = true;
501
+ if (drop) byId.delete(key);
502
+ }
503
+ }
504
+ return;
505
+ }
506
+ if (record.$patch && typeof record.$patch === 'object' && !Array.isArray(record.$patch)) {
507
+ known = true;
508
+ const patch = record.$patch;
509
+ const updates = Array.isArray(patch.updates) ? patch.updates : (typeof patch.id === 'string' ? [patch] : []);
510
+ for (const u of updates) {
511
+ if (!u || typeof u !== 'object' || typeof u.id !== 'string' || !byId.has(u.id)) continue;
512
+ const current = byId.get(u.id);
513
+ const next = { ...current };
514
+ if (Object.prototype.hasOwnProperty.call(u, 'content')) next.content = u.content;
515
+ if (Object.prototype.hasOwnProperty.call(u, 'displayContent')) next.displayContent = u.displayContent;
516
+ byId.set(u.id, next);
517
+ }
518
+ if (Array.isArray(patch.removeIds)) {
519
+ for (const id of patch.removeIds) if (typeof id === 'string') byId.delete(id);
520
+ }
521
+ if (Array.isArray(patch.orderIds)) {
522
+ const reordered = new Map();
523
+ for (const id of patch.orderIds) if (typeof id === 'string' && byId.has(id)) reordered.set(id, byId.get(id));
524
+ for (const [k, v] of byId.entries()) if (!reordered.has(k)) reordered.set(k, v);
525
+ byId.clear();
526
+ for (const [k, v] of reordered.entries()) byId.set(k, v);
527
+ }
528
+ return;
529
+ }
530
+ if (typeof record.type === 'string' && ['user', 'gemini', 'assistant', 'info', 'error', 'warning'].includes(record.type)) {
531
+ known = true;
532
+ putMessage(record);
359
533
  }
360
534
  });
361
535
  if (!ok) return [];
362
- for (const message of messages) {
363
- if (!message) continue;
364
- messageTimestamp(session, message.timestamp);
365
- if (message.type !== 'user') continue;
366
- const items = Array.isArray(message.content) ? message.content.filter(item => item && typeof item.text === 'string' && (!item.type || item.type === 'text')).map(item => item.text) : [];
367
- const text = typedText(items, state);
368
- if (text) session.messages.push(text);
369
- }
536
+ if (automation) { bump(state, 'automation_session'); return []; }
537
+ finalizeGeminiMessages(session, byId.values(), state);
370
538
  if (!known) bump(state, 'unknown_format');
371
539
  return session.messages.length ? [session] : [];
372
540
  }
373
541
 
542
+ async function readGeminiJson(file, state) {
543
+ const session = baseSession(file);
544
+ const lines = [];
545
+ const ok = await scanLines(file.file, state, line => { lines.push(line); });
546
+ if (!ok) return [];
547
+ let record;
548
+ try { record = JSON.parse(lines.join('\n')); }
549
+ catch { bump(state, 'malformed_line'); return []; }
550
+ if (!record || Array.isArray(record) || typeof record !== 'object') { bump(state, 'unknown_format'); return []; }
551
+ if (record.kind === 'subagent') { bump(state, 'automation_session'); return []; }
552
+ const known = typeof record.sessionId === 'string' || Array.isArray(record.messages);
553
+ if (!known) { bump(state, 'unknown_format'); return []; }
554
+ if (typeof record.sessionId === 'string') session.sessionId = record.sessionId;
555
+ if (typeof record.startTime === 'string') messageTimestamp(session, record.startTime);
556
+ if (typeof record.lastUpdated === 'string') messageTimestamp(session, record.lastUpdated);
557
+ if (Array.isArray(record.messages)) finalizeGeminiMessages(session, record.messages, state);
558
+ return session.messages.length ? [session] : [];
559
+ }
560
+
374
561
  async function readGeminiLogs(file, state) {
375
562
  const grouped = new Map();
376
563
  // Old logs are JSON arrays. Frame one entry at a time instead of buffering the array.
@@ -442,12 +629,16 @@ async function readMemory(file, state) {
442
629
  return { file: file.file, text, date: new Date(file.mtimeMs).toISOString() };
443
630
  }
444
631
 
445
- async function readSessions({ home = resolveHome(), projectDir = process.cwd(), allProjects = false, sources = [], limit = 20, privateTerms = [] } = {}) {
632
+ async function readSessions({ home, codexHome, projectDir = process.cwd(), allProjects = false, sources = [], limit = 20, privateTerms = [] } = {}) {
446
633
  const selectedSources = new Set(Array.isArray(sources) ? sources.filter(source => SOURCES.has(source)) : []);
447
634
  const maximum = Number.isInteger(limit) && limit >= 0 ? Math.min(limit, 20) : 20;
448
635
  projectDir = path.resolve(projectDir);
636
+ const resolvedHome = path.resolve(resolveHome(home));
637
+ const resolvedCodexHome = codexHome !== undefined
638
+ ? path.resolve(resolveCodexHome(resolvedHome, codexHome))
639
+ : (home === undefined ? path.resolve(resolveCodexHome(resolvedHome)) : path.join(resolvedHome, '.codex'));
449
640
  const state = {
450
- home: path.resolve(resolveHome(home)), projectDir, allProjects,
641
+ home: resolvedHome, codexHome: resolvedCodexHome, projectDir, allProjects,
451
642
  geminiProjectHash: crypto.createHash('sha256').update(projectDir).digest('hex'),
452
643
  candidates: [], memoryFiles: [], filesRead: [], filesChecked: 0, skipped: {},
453
644
  privateTerms: Array.isArray(privateTerms) ? privateTerms.filter(term => typeof term === 'string' && fold(term).trim()).map(fold) : []
@@ -460,7 +651,7 @@ async function readSessions({ home = resolveHome(), projectDir = process.cwd(),
460
651
  const bounded = state.candidates.filter(file => file.source === 'gemini-cli').length < 2;
461
652
  const sortKey = session => session.timestampMs ?? session.mtimeMs;
462
653
  const compare = (a, b) => sortKey(b) - sortKey(a) || a.file.localeCompare(b.file) || a.sessionId.localeCompare(b.sessionId);
463
- const readers = { claude: readClaude, codex: readCodex, gemini: readGemini, 'gemini-logs': readGeminiLogs };
654
+ const readers = { claude: readClaude, codex: readCodex, gemini: readGemini, 'gemini-json': readGeminiJson, 'gemini-logs': readGeminiLogs };
464
655
  for (const file of state.candidates) {
465
656
  if (!maximum) break;
466
657
  if (bounded && sessions.length === maximum && file.mtimeMs < sortKey(sessions[maximum - 1])) break;
package/bin/uninstall.cjs CHANGED
@@ -8,8 +8,8 @@ const renderer = require('../render/render.cjs');
8
8
  const onboarding = require('../render/onboarding.cjs');
9
9
  const TARGETS = require('../render/targets.json');
10
10
  const { installPlan, recordedHash, validateInventory } = require('./install-plan.cjs');
11
+ const { sha256 } = require('./cli-util.cjs');
11
12
  const CONFIG = '.agent-personalizer.json';
12
- const sha256 = (bytes) => crypto.createHash('sha256').update(bytes).digest('hex');
13
13
 
14
14
  function refuse(message) { throw new renderer.Refusal(message); }
15
15
  // Install appends "\n" + block + "\n" to a pre-existing file that ends in a newline
@@ -92,7 +92,7 @@ function run(dir, dry) {
92
92
  // The renderer consults this path even at level 1. Validate it before rendering.
93
93
  const notesScaffolded = !!probe(`${base}/README.md`);
94
94
  const recipe = installPlan({ answers, level, targets: cfg.targets, notesScaffolded }).plan;
95
- const homeNames = new Set(['CLAUDE.md', 'AGENTS.md']);
95
+ const homeNames = new Set(['CLAUDE.md', 'AGENTS.md', 'GEMINI.md']);
96
96
  const expected = new Map();
97
97
  for (const p of recipe) {
98
98
  if (homeNames.has(p.rel) || p.rel === 'LEARNED.md') continue; // entries always belong to the user
@@ -308,7 +308,7 @@ function run(dir, dry) {
308
308
  }
309
309
  console.log(`kept ${CONFIG} (tracked files remain; review the kept paths above)`);
310
310
  }
311
- if (level >= 3) console.log('Manual step: remove any SessionStart entry for hooks/claude-code/session-start.sh from .claude/settings.json or ~/.claude/settings.json if you registered it. Settings are kept.');
311
+ if (level >= 3) console.log('Manual step: remove any SessionStart entry for hooks/claude-code/session-start.sh or hooks/gemini-cli/session-start.sh from .claude/settings.json, ~/.claude/settings.json, .gemini/settings.json or ~/.gemini/settings.json if you registered it. Settings are kept.');
312
312
  }
313
313
 
314
314
  module.exports = { uninstall };
package/check/gate.cjs CHANGED
@@ -141,10 +141,50 @@ function* walk(root) {
141
141
  }
142
142
  }
143
143
 
144
+ function redactByFold(text, terms) {
145
+ const normalized = String(text).normalize('NFC');
146
+ const foldedTerms = terms.map(fold).filter(Boolean);
147
+ if (!foldedTerms.length || !normalized) return normalized;
148
+ const map = [];
149
+ let lower = '';
150
+ for (let i = 0; i < normalized.length;) {
151
+ const cp = normalized.codePointAt(i);
152
+ const step = cp > 0xffff ? 2 : 1;
153
+ const chunk = normalized.slice(i, i + step).toLowerCase();
154
+ for (let k = 0; k < chunk.length; k++) map.push([i, i + step]);
155
+ lower += chunk;
156
+ i += step;
157
+ }
158
+ const ranges = [];
159
+ for (const t of foldedTerms) {
160
+ let idx = lower.indexOf(t);
161
+ while (idx !== -1) {
162
+ ranges.push([map[idx][0], map[idx + t.length - 1][1]]);
163
+ idx = lower.indexOf(t, idx + 1);
164
+ }
165
+ }
166
+ if (!ranges.length) return normalized;
167
+ ranges.sort((a, b) => a[0] - b[0] || b[1] - a[1]);
168
+ const merged = [ranges[0].slice()];
169
+ for (let i = 1; i < ranges.length; i++) {
170
+ const prev = merged[merged.length - 1];
171
+ if (ranges[i][0] <= prev[1]) prev[1] = Math.max(prev[1], ranges[i][1]);
172
+ else merged.push(ranges[i].slice());
173
+ }
174
+ let out = '', pos = 0;
175
+ for (const [start, end] of merged) {
176
+ out += normalized.slice(pos, start) + '[redacted]';
177
+ pos = end;
178
+ }
179
+ return out + normalized.slice(pos);
180
+ }
181
+
182
+ const fold = text => String(text).normalize('NFC').toLowerCase();
183
+
144
184
  function allowedSpans(lineLower, allow) {
145
185
  const spans = [];
146
186
  for (const a of allow) {
147
- const al = a.toLowerCase();
187
+ const al = fold(a);
148
188
  if (!al.length) continue;
149
189
  let i = lineLower.indexOf(al);
150
190
  while (i !== -1) { spans.push([i, i + al.length]); i = lineLower.indexOf(al, i + al.length); }
@@ -332,19 +372,19 @@ function scan(root, list, listFile, all, history = false) {
332
372
  // the PATH first: one scan per item, labelled "(path)", never covered by allow spans of the text
333
373
  if (!scannedPaths.has(item.rel) || item.history) {
334
374
  if (!item.history) scannedPaths.add(item.rel);
335
- const lower = item.rel.toLowerCase(), spans = allowedSpans(lower, list.allow);
375
+ const lower = fold(item.rel), spans = allowedSpans(lower, list.allow);
336
376
  for (const term of list.terms) {
337
- const t = term.toLowerCase(); let i = lower.indexOf(t);
377
+ const t = fold(term); let i = lower.indexOf(t);
338
378
  while (i !== -1) { if (!spans.some(([x, y]) => i >= x && i + t.length <= y)) hits.push({ file: item.history ? item.label : `${item.rel} (path)`, line: 0, rule: 'P_LIST' }); i = lower.indexOf(t, i + 1); }
339
379
  }
340
380
  }
341
381
  if (!item.history && isBinary(item.bytes)) continue;
342
382
  const lines = item.bytes.toString('utf8').split('\n');
343
383
  lines.forEach((line, n) => {
344
- const lower = line.toLowerCase();
384
+ const lower = fold(line);
345
385
  const spans = allowedSpans(lower, list.allow);
346
386
  for (const term of list.terms) {
347
- const t = term.toLowerCase();
387
+ const t = fold(term);
348
388
  let i = lower.indexOf(t);
349
389
  while (i !== -1) {
350
390
  const inside = spans.some(([a, b]) => i >= a && i + t.length <= b);
@@ -398,7 +438,7 @@ function main() {
398
438
  catch (e) { if (e.code === 'ENOENT') list = { terms: [], allow: [] }; else die(`cannot inspect private list (${e.code || 'unknown error'})`); }
399
439
  } else list = loadList(listFile);
400
440
  const redact = text => {
401
- const clean = list.terms.reduce((value, term) => value.replace(new RegExp(term.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gi'), '[redacted]'), text);
441
+ const clean = redactByFold(text, list.terms);
402
442
  return PRIVATE_CLASSES.some(([, pattern]) => pattern.test(clean)) ? '[redacted path]' : clean;
403
443
  };
404
444
  const { hits, files, skipped } = scan(root, list, listFile, all, history);
@@ -1,8 +1,8 @@
1
1
  # Companion tools
2
2
 
3
- This repo tells an AI *how to behave with you*. Two companions govern *what it can touch* and *what it is allowed to carry*. Neither is required; both make the onboarding answers enforceable instead of advisory.
3
+ This repo tells an AI *how to behave with you*. Two optional companions govern operations routed through them. Properly configured, they enforce folder ACLs, approval gates or context receipts on calls through that companion; they do not block direct filesystem tools, shell commands or other connectors unless your host's own tool permissions or OS sandbox restrict those paths.
4
4
 
5
- | Your saved setting | What enforces it without a companion | With a companion |
5
+ | Your saved setting | Without a companion | Through a configured companion |
6
6
  |---|---|---|
7
7
  | **Always ask before** delete / publish / send / spend | the AI remembering | obsidian-tc: destructive tools fail closed until a human confirms |
8
8
  | **Off limits** folders | the AI remembering | obsidian-tc: folder ACL deny, per caller |
@@ -27,7 +27,7 @@ npx obsidian-tc /path/to/vault
27
27
  ```
28
28
  Lexical search and every note tool work immediately; semantic and graph retrieval need an embeddings backend (Ollama by default). Also ships as a Docker image, an `.mcpb` bundle, and standalone binaries.
29
29
 
30
- **How it pairs with this repo.** Answer `notes_tool: obsidian` and `obsidian_tc: yes` and the rendered `AGENT_ONBOARDING.md` tells the AI to reach the vault through obsidian-tc rather than the filesystem; your **off-limits** and **always-ask** answers become the folder ACL and the human-in-the-loop list you configure there. Same intent, now enforced. Answer `obsidian_tc: no` (the default) and the AI works on the vault folder directly, with the onboarding file naming what obsidian-tc would add.
30
+ **How it pairs with this repo.** Answer `notes_tool: obsidian` and `obsidian_tc: yes` and the rendered `AGENT_ONBOARDING.md` tells the AI to reach the vault through obsidian-tc rather than the filesystem; your **off-limits** and **always-ask** answers map to the folder ACL and human-in-the-loop list you configure in obsidian-tc. Calls routed through obsidian-tc enforce those rules; disable or sandbox raw filesystem and shell access in your AI host if you want the agent confined to that door. Answer `obsidian_tc: no` (the default) and the AI works on the vault folder directly, with the onboarding file naming what obsidian-tc would add.
31
31
 
32
32
  ---
33
33
 
@@ -43,7 +43,7 @@ Lexical search and every note tool work immediately; semantic and graph retrieva
43
43
  - **Write policy** "logs and inbox only" or "ask before every write" is the Layer's rule that memory writes remain proposals until approved.
44
44
  - **Off limits** is the Layer's vault stage: originals that never enter a bundle.
45
45
  - **Always ask before** is the Layer's decide stage: allow, reduce, approve or deny by action and recipient.
46
- Running several agents is where it earns its keep (the hand-off layer, which this repo does not install): each delegation carries a purpose-bound bundle and returns a receipt, so you can answer "who saw what, and why" after the fact. The repo's `AGENT_ONBOARDING.md` is the human-readable policy; the Context Layer is how you make a machine enforce and record it.
46
+ Running several agents is where it earns its keep (the hand-off layer, which this repo does not install): each delegation carries a purpose-bound bundle and returns a receipt, so you can answer "who saw what, and why" after the fact. The repo's `AGENT_ONBOARDING.md` is the human-readable policy; the Context Layer enforces and records it for context bundles and actions mediated by the Layer, alongside whatever host permissions or sandboxing govern direct local tools.
47
47
 
48
48
  ---
49
49
 
@@ -51,7 +51,7 @@ Running several agents is where it earns its keep (the hand-off layer, which thi
51
51
 
52
52
  | `notes_tool` answer | How an AI reaches it | Write posture rendered into the onboarding file |
53
53
  |---|---|---|
54
- | `obsidian` | obsidian-tc (above) when `obsidian_tc: yes`, else the vault folder on disk | your write policy, enforced by obsidian-tc's ACL when configured |
54
+ | `obsidian` | obsidian-tc (above) when `obsidian_tc: yes`, else the vault folder on disk | your write policy; enforced on obsidian-tc calls when its ACL is configured (host permissions still govern direct disk tools) |
55
55
  | `logseq` / `folder` | the folder on disk | your write policy, under each folder's README |
56
56
  | `notion` | Notion's own MCP connector | writes only into the pages or databases you name; the AI proposes new top-level pages, never creates them unasked |
57
57
  | `google-docs` | the Google Drive / Docs connector | the AI drafts into a doc named for the topic and never edits a shared doc's existing text without being asked |
@@ -21,12 +21,12 @@ The check measures rendered-file consistency. The [instruction tiers](tiers.md)
21
21
  The installer validates answers, configuration, source files and target marker structure before its write phase. The renderer validates its full target plan before replacing files.
22
22
 
23
23
  - **Paths:** paths beneath the installation root must be real files and directories. Symlinks and paths outside the root are refused. Local notes paths must sit outside tool-owned paths, including `.agent-personalizer/`.
24
- - **Git exclude:** the one write outside the installed files. Inside a git work tree, the installer adds `USER.md`, `LEARNED.md`, `.agent-personalizer.json` and the ChatGPT paste files to the repo's `.git/info/exclude` (the path `git rev-parse --git-path info/exclude` names) in one block marked with the install folder. Re-runs replace that block; it is never committed. A folder git already ignores is left alone, a symlinked or unwritable exclude file gets a warning instead, and so does a private file git already tracks. `CLAUDE.md`, `AGENTS.md`, `GEMINI.md` and `AGENT_ONBOARDING.md` stay committable with a note to review them.
24
+ - **Git metadata:** local Git metadata in an enclosing Git work tree is the only write target outside the installed folder, and is never committed. On install, the installer adds `USER.md`, `LEARNED.md`, `.agent-personalizer.json` and the ChatGPT paste files to the repo's `.git/info/exclude` (the path `git rev-parse --git-path info/exclude` names) in one block marked with the install folder; re-runs replace that block. At level 3, passing `--precommit` also wraps the repo's local `hooks/pre-commit` and preserves any prior hook as `pre-commit.agent-personalizer-original` (see [Forbidden-string gate](#forbidden-string-gate)). A folder git already ignores is left alone, a symlinked or unwritable exclude file gets a warning instead, and so does a private file git already tracks. `CLAUDE.md`, `AGENTS.md`, `GEMINI.md` and `AGENT_ONBOARDING.md` stay committable with a note to review them.
25
25
  - **Markers:** each target may have one correctly ordered generated block or be ready for its first block. Malformed blocks are refused.
26
26
  - **Encoding:** sources and targets must contain valid UTF-8; invalid bytes are refused instead of re-encoded.
27
27
  - **Existing work:** edited and pre-existing profiles, notes templates, rules and tools are kept and named. Untouched installer-owned files update to the current answers and package. Obsolete untouched copies are removed; edited copies stay and are named.
28
28
  - **Recovery:** the installer validates its complete plan before writing and restores changed files on failure. The renderer stages targets and their ownership configuration together with backups and rolls back a failed write. An incomplete restore keeps and names its backup with exit `2`.
29
- - **Local operation:** the tool uses HOME to find the AI apps' folders. Before consent, it may check whether `~/.claude`, `~/.codex` and `~/.gemini` exist for target pre-selection; it opens or lists their contents only after a yes. A non-interactive install and a re-run never read sessions. The tool makes no network calls and sends no telemetry. `npx` fetches the package before execution.
29
+ - **Local operation:** the tool uses `HOME` (and `CODEX_HOME` when set) to find the AI apps' folders. Before consent, it may check whether `~/.claude`, `~/.codex` (or `$CODEX_HOME`) and `~/.gemini` exist for target pre-selection; it opens or lists their contents only after a yes. A non-interactive install and a re-run never read sessions. The tool makes no network calls and sends no telemetry. `npx` fetches the package before execution.
30
30
 
31
31
  On a re-run, each home-file line that byte-matches the previous template is migrated to the new template or removed when obsolete. An edited pointer stays byte for byte and is named with its file and line for manual review. Other outer text stays byte for byte. The renderer owns only the marked block.
32
32
 
@@ -55,7 +55,7 @@ Fill it with the identifiers you want to catch and add `check/forbidden.local.tx
55
55
  node check/gate.cjs --dir .
56
56
  ```
57
57
 
58
- The gate checks listed strings against file text and relative paths. In a git work tree it scans staged blobs, changed working copies and untracked files that git would include. `--all` scans the folder directly. It never follows symlinks.
58
+ The gate normalizes Unicode to NFC and checks listed strings (ignoring case) against file text and relative paths. In a git work tree it scans staged blobs, changed working copies and untracked files that git would include. `--all` scans the folder directly. It never follows symlinks.
59
59
 
60
60
  - **Exit `0`:** the scan completed with no listed strings found.
61
61
  - **Exit `1`:** one or more listed strings were found.
@@ -82,4 +82,4 @@ To make those answers govern tool access, configure a [companion](companions.md)
82
82
  - **obsidian-tc:** folder access controls and human approval for destructive Obsidian operations.
83
83
  - **The Context Layer:** purpose-bound context, approval decisions and receipts for actions and disclosures.
84
84
 
85
- These controls live in the companion's configuration. Saved onboarding answers record the policy and render the instructions that refer to it.
85
+ These controls live in the companion's configuration and apply to calls routed through that companion; direct filesystem, shell or other connector access still depends on your AI host's tool permissions and sandbox. Saved onboarding answers record the policy and render the instructions that refer to it.
package/docs/install.md CHANGED
@@ -4,7 +4,7 @@ The installer writes a profile, a learning log, an onboarding manual and the ins
4
4
 
5
5
  ## Requirements
6
6
 
7
- Node 22 or 24 (active LTS) is recommended; 18 or later runs. The installer, renderer and gate run on macOS, Linux and Windows. The shell harness and session-start hook need a POSIX shell; use WSL or Git Bash on Windows.
7
+ Node 24 or 26 (active LTS) is recommended; 22 or later runs. The installer, renderer and gate run on macOS, Linux and Windows. The shell harness and session-start hooks need a POSIX shell; use WSL or Git Bash on Windows.
8
8
 
9
9
  ## Interactive setup
10
10
 
@@ -93,9 +93,9 @@ npx agent-personalizer --global --uninstall --dry
93
93
  npx agent-personalizer --global --uninstall
94
94
  ```
95
95
 
96
- `--global` keeps the level-1 profile source (`USER.md`, `LEARNED.md`, onboarding and configuration) in `~/.agent-personalizer/`. It writes a marked block to `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md`, `~/.gemini/GEMINI.md` and `~/.hermes/SOUL.md` for the selected targets. For Hermes in a project, use `--ai agents` to write `AGENTS.md`. Hermes reads its global `SOUL.md` from `HERMES_HOME` when set; the installer warns if that differs from `~/.hermes`. Paths use `HOME`, with `USERPROFILE` as the Windows fallback when `HOME` is missing or empty. The selected value must be a non-empty absolute path. Global instructions name the profile's full path so they work from any project. Start a new AI session to load them; client instruction precedence still applies.
96
+ `--global` keeps the level-1 profile source (`USER.md`, `LEARNED.md`, onboarding and configuration) in `~/.agent-personalizer/`. It writes a marked block to `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md` (or `$CODEX_HOME/AGENTS.md` when `CODEX_HOME` is set to a non-empty absolute path), `~/.gemini/GEMINI.md` and `~/.hermes/SOUL.md` for the selected targets. When a non-empty `AGENTS.override.md` exists in the active Codex home, Codex gives it precedence over `AGENTS.md`; the installer warns without modifying the override. For Hermes in a project, use `--ai agents` to write `AGENTS.md`. Hermes reads its global `SOUL.md` from `HERMES_HOME` when set; the installer warns if that differs from `~/.hermes`. Paths use `HOME`, with `USERPROFILE` as the Windows fallback when `HOME` is missing or empty. `HOME` (and `CODEX_HOME` when set) must be a non-empty absolute path, never a symlink. Global instructions name the profile's full path so they work from any project. Start a new AI session to load them; client instruction precedence still applies.
97
97
 
98
- Select only `claude`, `agents` and `gemini`. Other targets, `--dir` and levels 2/3 are refused. A headless first install needs `--ai` and `--yes`; level 1 is implicit. `--answers` and `--defaults` work as with project installs. A re-run keeps saved targets and answers.
98
+ Select only `claude`, `agents`, `gemini` and `hermes`. Other targets, `--dir` and levels 2/3 are refused. A headless first install needs `--ai` and `--yes`; level 1 is implicit. `--answers` and `--defaults` work as with project installs. A re-run keeps saved targets and answers.
99
99
 
100
100
  Global learning always includes sessions from all projects and still needs consent. Its digest is `~/.agent-personalizer/.agent-personalizer/digest.md`; use `learn --global --forget` to remove it. The learning procedure is included in each selected home file.
101
101
 
@@ -117,9 +117,9 @@ npx agent-personalizer learn --forget --dir .
117
117
 
118
118
  ## What each level adds
119
119
 
120
- - **Level 1:** `USER.md`, `LEARNED.md`, `AGENT_ONBOARDING.md`, the files for your AI targets, and `.agent-personalizer.json`. Claude Code also receives `.claude/commands/personalize.md`. The Core 5 render from the package: read the profile first, evidence before assertion, output style, act or ask, and ask before it repeats. With no installed apps detected, the default selection is `claude,agents`.
120
+ - **Level 1:** `USER.md`, `LEARNED.md`, `AGENT_ONBOARDING.md`, the files for your AI targets, and `.agent-personalizer.json`. Claude Code receives `.claude/commands/personalize.md` and Gemini CLI receives `.gemini/commands/personalize.toml`. The Core 5 render from the package: read the profile first, evidence before assertion, output style, act or ask, and ask before it repeats. With no installed apps detected, the default selection is `claude,agents`.
121
121
  - **Level 2:** the same five rules, plus a local notes scaffold with `README.md`, `sessions/TEMPLATE-week.md`, `decisions.md` and `inbox/README.md`. Disk tools use your `notes_path`; read-only and other tools use the local `notes/` fallback. Cloud tools get connector pointers and keep their notes in their service.
122
- - **Level 3:** all eleven rules (subject to target and signature selection), your editable `rules/` copy, `render/` tools, the Claude Code session-start hook and the forbidden-string gate. [Register the hook](../hooks/README.md) in your AI settings and [configure the gate](guarantees.md#forbidden-string-gate).
122
+ - **Level 3:** all eleven rules (subject to target and signature selection), your editable `rules/` copy, `render/` tools, the Claude Code and Gemini CLI session-start hooks and the forbidden-string gate. [Register the hook](../hooks/README.md) in your AI settings and [configure the gate](guarantees.md#forbidden-string-gate).
123
123
 
124
124
  An existing local notes scaffold is detected at any level. Edited notes and rule files stay yours and are named in the install log. Untouched installer copies update on re-runs. At level 3, a `signature: no` answer omits the signature rule and its template lines; answering yes includes the signature line.
125
125
 
@@ -158,7 +158,7 @@ npm_config_cache=./.npm-cache npx agent-personalizer
158
158
 
159
159
  ## Manual copying
160
160
 
161
- For a setup without Node, download this repository and copy [`templates/USER.md`](../templates/USER.md) plus [`templates/CLAUDE.md`](../templates/CLAUDE.md) or [`templates/AGENTS.md`](../templates/AGENTS.md) into your project. Fill in the profile and adapt the home template's pointers to the files you keep. For a chat app, paste the profile body into its instruction field.
161
+ For a setup without Node, download this repository and copy [`templates/USER.md`](../templates/USER.md) plus [`templates/CLAUDE.md`](../templates/CLAUDE.md), [`templates/AGENTS.md`](../templates/AGENTS.md) or [`templates/GEMINI.md`](../templates/GEMINI.md) into your project. Fill in the profile and adapt the home template's pointers to the files you keep. For a chat app, paste the profile body into its instruction field.
162
162
 
163
163
  Consent-gated session learning, automatic rendering and the drift check are available when you use the Node installer. [The paste guide](paste-guide.md) covers manual app setup.
164
164
 
@@ -181,7 +181,7 @@ The uninstaller reads `/path/to/project/.agent-personalizer.json` and compares f
181
181
  - **Notes scaffold:** unchanged historically installed templates are removed. Edited templates are kept and named; user-written notes stay byte for byte. A directory is removed only when the install recorded that it created it and it is empty.
182
182
  - **Git exclude:** after the configuration is removed, the block install added to `.git/info/exclude` for this folder is removed, and the rest of the file stays byte for byte. While an edited file keeps the configuration, the block stays too.
183
183
  - **Rules and tools:** unchanged installed copies are removed file by file, including the session-start hook. Edited copies stay.
184
- - **Hook registration:** remove the matching `SessionStart` entry from `.claude/settings.json` or `~/.claude/settings.json` yourself. The uninstaller prints this step; it never edits settings outside the installation.
184
+ - **Hook registration:** remove any matching `SessionStart` entry from `.claude/settings.json`, `~/.claude/settings.json`, `.gemini/settings.json` or `~/.gemini/settings.json` yourself. The uninstaller prints this step; it never edits settings outside the installation.
185
185
  - **Paths:** the whole removal plan is preflighted before the first unlink, and each path is re-probed before it is unlinked. The uninstaller never follows symlinks, deletes recursively or removes a path outside the named folder. A refused preflight leaves the removal plan unapplied.
186
186
  - **Configuration:** `.agent-personalizer.json` is removed last, only after every path it tracks is gone or, for a pre-existing home file, has had its block removed. An edited file the uninstaller retained keeps the configuration available for review.
187
187