agent-personalizer 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -1
- package/CONTRIBUTING.md +3 -3
- package/README.md +12 -10
- package/RELEASING.md +8 -7
- package/SECURITY.md +1 -1
- package/bin/agent-personalizer.js +21 -32
- package/bin/cli-util.cjs +28 -0
- package/bin/global.cjs +4 -4
- package/bin/install-plan.cjs +4 -3
- package/bin/learn.cjs +10 -3
- package/bin/sessions.cjs +195 -35
- package/bin/uninstall.cjs +3 -3
- package/check/gate.cjs +116 -17
- package/docs/guarantees.md +1 -1
- package/docs/install.md +6 -6
- package/docs/learning.md +7 -7
- package/docs/paste-guide.md +8 -6
- package/docs/tiers.md +1 -1
- package/hooks/README.md +17 -1
- package/hooks/gemini-cli/session-start.sh +15 -0
- package/llms.txt +6 -4
- package/package.json +6 -3
- package/render/onboarding.cjs +30 -47
- package/render/render.cjs +24 -15
- package/rules/00-read-the-profile-first.md +3 -0
- package/rules/20-one-owner-per-rule.md +3 -0
- package/rules/30-folder-index-is-part-of-the-change.md +3 -0
- package/rules/40-sign-every-edit.md +4 -1
- package/skills/agent-personalizer/SKILL.md +104 -0
- package/templates/GEMINI.md +30 -0
- package/examples/freelance-illustrator/.agent-personalizer.json +0 -57
- package/examples/freelance-illustrator/AGENTS.md +0 -244
- package/examples/freelance-illustrator/AGENT_ONBOARDING.md +0 -67
- package/examples/freelance-illustrator/CLAUDE.md +0 -248
- package/examples/freelance-illustrator/LEARNED.md +0 -14
- package/examples/freelance-illustrator/USER.md +0 -54
- package/examples/freelance-illustrator/notes/README.md +0 -39
- package/examples/freelance-illustrator/notes/decisions.md +0 -18
- package/examples/freelance-illustrator/notes/inbox/2026-09-03-shot-list-for-six-prints.md +0 -14
- package/examples/freelance-illustrator/notes/inbox/README.md +0 -19
- package/examples/freelance-illustrator/notes/sessions/2026-W36.md +0 -41
- package/examples/freelance-illustrator/rules/00-read-the-profile-first.md +0 -24
- package/examples/freelance-illustrator/rules/10-evidence-before-assertion.md +0 -24
- package/examples/freelance-illustrator/rules/20-one-owner-per-rule.md +0 -24
- package/examples/freelance-illustrator/rules/30-folder-index-is-part-of-the-change.md +0 -26
- package/examples/freelance-illustrator/rules/40-sign-every-edit.md +0 -25
- package/examples/freelance-illustrator/rules/50-output-style.md +0 -21
- package/examples/freelance-illustrator/rules/60-act-or-ask.md +0 -30
- package/examples/freelance-illustrator/rules/65-ask-before-it-repeats.md +0 -18
- package/examples/freelance-illustrator/rules/70-their-words-point-at-the-thing.md +0 -15
- package/examples/freelance-illustrator/rules/80-symptoms-are-not-causes.md +0 -15
- package/examples/freelance-illustrator/rules/90-surface-what-they-cant-see.md +0 -15
- package/examples/freelance-illustrator/rules/README.md +0 -61
- package/examples/lab-technician/.agent-personalizer.json +0 -38
- package/examples/lab-technician/AGENTS.md +0 -243
- package/examples/lab-technician/AGENT_ONBOARDING.md +0 -64
- package/examples/lab-technician/CLAUDE.md +0 -247
- package/examples/lab-technician/LEARNED.md +0 -14
- package/examples/lab-technician/USER.md +0 -53
- package/examples/lab-technician/notes/README.md +0 -26
- package/examples/lab-technician/notes/decisions.md +0 -4
- package/examples/lab-technician/notes/inbox/2026-10-06-observation-table.md +0 -3
- package/examples/lab-technician/notes/inbox/README.md +0 -7
- package/examples/lab-technician/notes/sessions/2026-W41.md +0 -7
- package/examples/lab-technician/rules/00-read-the-profile-first.md +0 -24
- package/examples/lab-technician/rules/10-evidence-before-assertion.md +0 -24
- package/examples/lab-technician/rules/20-one-owner-per-rule.md +0 -24
- package/examples/lab-technician/rules/30-folder-index-is-part-of-the-change.md +0 -26
- package/examples/lab-technician/rules/40-sign-every-edit.md +0 -25
- package/examples/lab-technician/rules/50-output-style.md +0 -21
- package/examples/lab-technician/rules/60-act-or-ask.md +0 -30
- package/examples/lab-technician/rules/65-ask-before-it-repeats.md +0 -18
- package/examples/lab-technician/rules/70-their-words-point-at-the-thing.md +0 -15
- package/examples/lab-technician/rules/80-symptoms-are-not-causes.md +0 -15
- package/examples/lab-technician/rules/90-surface-what-they-cant-see.md +0 -15
- package/examples/lab-technician/rules/README.md +0 -61
- package/examples/product-designer/.agent-personalizer.json +0 -38
- package/examples/product-designer/AGENTS.md +0 -243
- package/examples/product-designer/AGENT_ONBOARDING.md +0 -63
- package/examples/product-designer/CLAUDE.md +0 -247
- package/examples/product-designer/LEARNED.md +0 -14
- package/examples/product-designer/USER.md +0 -53
- package/examples/product-designer/notes/README.md +0 -26
- package/examples/product-designer/notes/decisions.md +0 -4
- package/examples/product-designer/notes/inbox/2026-10-06-cancellation-wording.md +0 -8
- package/examples/product-designer/notes/inbox/README.md +0 -7
- package/examples/product-designer/notes/sessions/2026-W41.md +0 -7
- package/examples/product-designer/rules/00-read-the-profile-first.md +0 -24
- package/examples/product-designer/rules/10-evidence-before-assertion.md +0 -24
- package/examples/product-designer/rules/20-one-owner-per-rule.md +0 -24
- package/examples/product-designer/rules/30-folder-index-is-part-of-the-change.md +0 -26
- package/examples/product-designer/rules/40-sign-every-edit.md +0 -25
- package/examples/product-designer/rules/50-output-style.md +0 -21
- package/examples/product-designer/rules/60-act-or-ask.md +0 -30
- package/examples/product-designer/rules/65-ask-before-it-repeats.md +0 -18
- package/examples/product-designer/rules/70-their-words-point-at-the-thing.md +0 -15
- package/examples/product-designer/rules/80-symptoms-are-not-causes.md +0 -15
- package/examples/product-designer/rules/90-surface-what-they-cant-see.md +0 -15
- package/examples/product-designer/rules/README.md +0 -61
package/bin/sessions.cjs
CHANGED
|
@@ -7,6 +7,7 @@ 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
|
|
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')) {
|
|
@@ -157,33 +234,35 @@ async function discover(home, sources, state) {
|
|
|
157
234
|
}
|
|
158
235
|
}
|
|
159
236
|
await walk(path.join(app, 'sessions'));
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (stat) state.memoryFiles.push({ file, mtimeMs: stat.mtimeMs });
|
|
237
|
+
await collectMemoryDir(path.join(app, 'memories'), state);
|
|
238
|
+
const memoriesV2 = path.join(app, 'memories_v2');
|
|
239
|
+
if (await statPath(memoriesV2, 'directory', state)) {
|
|
240
|
+
await collectMemoryDir(memoriesV2, state);
|
|
241
|
+
await collectMemoryDir(path.join(memoriesV2, 'rollout_summaries'), state);
|
|
166
242
|
}
|
|
167
243
|
}
|
|
168
244
|
}
|
|
169
245
|
if (sources.has('gemini-cli')) {
|
|
170
|
-
const
|
|
171
|
-
|
|
246
|
+
const geminiRoots = [path.join(home, '.gemini')];
|
|
247
|
+
const cacheRoot = path.join(home, '.cache');
|
|
248
|
+
if (await statPath(cacheRoot, 'directory', state)) geminiRoots.push(path.join(cacheRoot, '.gemini'));
|
|
249
|
+
for (const app of geminiRoots) {
|
|
250
|
+
if (!await statPath(app, 'directory', state)) continue;
|
|
172
251
|
const tmp = path.join(app, 'tmp');
|
|
173
|
-
if (await statPath(tmp, 'directory', state))
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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'); }
|
|
252
|
+
if (!await statPath(tmp, 'directory', state)) continue;
|
|
253
|
+
const projects = state.allProjects ? await children(tmp, state) : await geminiProjectDirs(app, tmp, state);
|
|
254
|
+
for (const project of projects) {
|
|
255
|
+
const dir = path.join(tmp, project);
|
|
256
|
+
if (!await statPath(dir, 'directory', state)) continue;
|
|
257
|
+
for (const name of await children(path.join(dir, 'chats'), state)) {
|
|
258
|
+
if (name.startsWith('session-') && name.endsWith('.jsonl')) await candidate(path.join(dir, 'chats', name), 'gemini-cli', project, 'gemini', state);
|
|
259
|
+
else if (name.startsWith('session-') && name.endsWith('.json')) await candidate(path.join(dir, 'chats', name), 'gemini-cli', project, 'gemini-json', state);
|
|
186
260
|
}
|
|
261
|
+
const logs = path.join(dir, 'logs.json');
|
|
262
|
+
try {
|
|
263
|
+
await fs.promises.lstat(logs);
|
|
264
|
+
await candidate(logs, 'gemini-cli', project, 'gemini-logs', state);
|
|
265
|
+
} catch (error) { if (error.code !== 'ENOENT') bump(state, 'unreadable'); }
|
|
187
266
|
}
|
|
188
267
|
}
|
|
189
268
|
}
|
|
@@ -346,31 +425,112 @@ async function readCodex(file, state) {
|
|
|
346
425
|
return session.messages.length ? [session] : [];
|
|
347
426
|
}
|
|
348
427
|
|
|
428
|
+
function finalizeGeminiMessages(session, messages, state) {
|
|
429
|
+
for (const message of messages) {
|
|
430
|
+
if (!message || typeof message !== 'object') continue;
|
|
431
|
+
messageTimestamp(session, message.timestamp);
|
|
432
|
+
if (message.type !== 'user') continue;
|
|
433
|
+
const text = typedText(geminiMessageItems(message.content), state);
|
|
434
|
+
if (text) session.messages.push(text);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
349
438
|
async function readGemini(file, state) {
|
|
350
439
|
const session = baseSession(file);
|
|
351
|
-
let known = false,
|
|
440
|
+
let known = false, automation = false;
|
|
441
|
+
const byId = new Map();
|
|
442
|
+
const putMessage = message => {
|
|
443
|
+
if (!message || typeof message !== 'object') return;
|
|
444
|
+
const key = typeof message.id === 'string' && message.id ? message.id : Symbol();
|
|
445
|
+
byId.set(key, message);
|
|
446
|
+
};
|
|
352
447
|
const ok = await scanLines(file.file, state, line => {
|
|
353
448
|
const record = parsedLine(line, state);
|
|
354
449
|
if (!record) return;
|
|
355
450
|
if (typeof record.sessionId === 'string') { session.sessionId = record.sessionId; known = true; }
|
|
356
|
-
if (record
|
|
357
|
-
|
|
358
|
-
|
|
451
|
+
if (record.kind === 'subagent') { automation = true; known = true; }
|
|
452
|
+
if (typeof record.startTime === 'string') messageTimestamp(session, record.startTime);
|
|
453
|
+
if (typeof record.lastUpdated === 'string') messageTimestamp(session, record.lastUpdated);
|
|
454
|
+
if (record.$set && typeof record.$set === 'object' && !Array.isArray(record.$set)) {
|
|
455
|
+
known = true;
|
|
456
|
+
if (typeof record.$set.sessionId === 'string') session.sessionId = record.$set.sessionId;
|
|
457
|
+
if (record.$set.kind === 'subagent') automation = true;
|
|
458
|
+
if (typeof record.$set.lastUpdated === 'string') messageTimestamp(session, record.$set.lastUpdated);
|
|
459
|
+
if (Object.prototype.hasOwnProperty.call(record.$set, 'messages')) {
|
|
460
|
+
if (Array.isArray(record.$set.messages)) {
|
|
461
|
+
byId.clear();
|
|
462
|
+
for (const msg of record.$set.messages) putMessage(msg);
|
|
463
|
+
} else bump(state, 'unknown_format');
|
|
464
|
+
}
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
if (typeof record.$rewindTo === 'string') {
|
|
468
|
+
known = true;
|
|
469
|
+
if (!byId.has(record.$rewindTo)) byId.clear();
|
|
470
|
+
else {
|
|
471
|
+
let drop = false;
|
|
472
|
+
for (const key of [...byId.keys()]) {
|
|
473
|
+
if (key === record.$rewindTo) drop = true;
|
|
474
|
+
if (drop) byId.delete(key);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
if (record.$patch && typeof record.$patch === 'object' && !Array.isArray(record.$patch)) {
|
|
480
|
+
known = true;
|
|
481
|
+
const patch = record.$patch;
|
|
482
|
+
const updates = Array.isArray(patch.updates) ? patch.updates : (typeof patch.id === 'string' ? [patch] : []);
|
|
483
|
+
for (const u of updates) {
|
|
484
|
+
if (!u || typeof u !== 'object' || typeof u.id !== 'string' || !byId.has(u.id)) continue;
|
|
485
|
+
const current = byId.get(u.id);
|
|
486
|
+
const next = { ...current };
|
|
487
|
+
if (Object.prototype.hasOwnProperty.call(u, 'content')) next.content = u.content;
|
|
488
|
+
if (Object.prototype.hasOwnProperty.call(u, 'displayContent')) next.displayContent = u.displayContent;
|
|
489
|
+
byId.set(u.id, next);
|
|
490
|
+
}
|
|
491
|
+
if (Array.isArray(patch.removeIds)) {
|
|
492
|
+
for (const id of patch.removeIds) if (typeof id === 'string') byId.delete(id);
|
|
493
|
+
}
|
|
494
|
+
if (Array.isArray(patch.orderIds)) {
|
|
495
|
+
const reordered = new Map();
|
|
496
|
+
for (const id of patch.orderIds) if (typeof id === 'string' && byId.has(id)) reordered.set(id, byId.get(id));
|
|
497
|
+
for (const [k, v] of byId.entries()) if (!reordered.has(k)) reordered.set(k, v);
|
|
498
|
+
byId.clear();
|
|
499
|
+
for (const [k, v] of reordered.entries()) byId.set(k, v);
|
|
500
|
+
}
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
if (typeof record.type === 'string' && ['user', 'gemini', 'assistant', 'info', 'error', 'warning'].includes(record.type)) {
|
|
504
|
+
known = true;
|
|
505
|
+
putMessage(record);
|
|
359
506
|
}
|
|
360
507
|
});
|
|
361
508
|
if (!ok) return [];
|
|
362
|
-
|
|
363
|
-
|
|
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
|
-
}
|
|
509
|
+
if (automation) { bump(state, 'automation_session'); return []; }
|
|
510
|
+
finalizeGeminiMessages(session, byId.values(), state);
|
|
370
511
|
if (!known) bump(state, 'unknown_format');
|
|
371
512
|
return session.messages.length ? [session] : [];
|
|
372
513
|
}
|
|
373
514
|
|
|
515
|
+
async function readGeminiJson(file, state) {
|
|
516
|
+
const session = baseSession(file);
|
|
517
|
+
const lines = [];
|
|
518
|
+
const ok = await scanLines(file.file, state, line => { lines.push(line); });
|
|
519
|
+
if (!ok) return [];
|
|
520
|
+
let record;
|
|
521
|
+
try { record = JSON.parse(lines.join('\n')); }
|
|
522
|
+
catch { bump(state, 'malformed_line'); return []; }
|
|
523
|
+
if (!record || Array.isArray(record) || typeof record !== 'object') { bump(state, 'unknown_format'); return []; }
|
|
524
|
+
if (record.kind === 'subagent') { bump(state, 'automation_session'); return []; }
|
|
525
|
+
const known = typeof record.sessionId === 'string' || Array.isArray(record.messages);
|
|
526
|
+
if (!known) { bump(state, 'unknown_format'); return []; }
|
|
527
|
+
if (typeof record.sessionId === 'string') session.sessionId = record.sessionId;
|
|
528
|
+
if (typeof record.startTime === 'string') messageTimestamp(session, record.startTime);
|
|
529
|
+
if (typeof record.lastUpdated === 'string') messageTimestamp(session, record.lastUpdated);
|
|
530
|
+
if (Array.isArray(record.messages)) finalizeGeminiMessages(session, record.messages, state);
|
|
531
|
+
return session.messages.length ? [session] : [];
|
|
532
|
+
}
|
|
533
|
+
|
|
374
534
|
async function readGeminiLogs(file, state) {
|
|
375
535
|
const grouped = new Map();
|
|
376
536
|
// Old logs are JSON arrays. Frame one entry at a time instead of buffering the array.
|
|
@@ -460,7 +620,7 @@ async function readSessions({ home = resolveHome(), projectDir = process.cwd(),
|
|
|
460
620
|
const bounded = state.candidates.filter(file => file.source === 'gemini-cli').length < 2;
|
|
461
621
|
const sortKey = session => session.timestampMs ?? session.mtimeMs;
|
|
462
622
|
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 };
|
|
623
|
+
const readers = { claude: readClaude, codex: readCodex, gemini: readGemini, 'gemini-json': readGeminiJson, 'gemini-logs': readGeminiLogs };
|
|
464
624
|
for (const file of state.candidates) {
|
|
465
625
|
if (!maximum) break;
|
|
466
626
|
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 ~/.
|
|
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
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
usage:
|
|
11
11
|
node check/gate.cjs [--dir <root>] [--list <file>] scan; exit 0 clean, 1 on hits, 2 on setup error
|
|
12
|
+
node check/gate.cjs --history [--dir <root>] [--list <file>] scan current files and reachable history
|
|
12
13
|
node check/gate.cjs --self-test prove the gate can go red on a seeded hit
|
|
13
14
|
node check/gate.cjs --help | -h · --version | -v
|
|
14
15
|
|
|
@@ -33,7 +34,9 @@
|
|
|
33
34
|
A working-tree path whose parent directory is a symlink is NOT read (the file would be outside
|
|
34
35
|
the scan root); the index blob for that path is still scanned, and the skip is counted and
|
|
35
36
|
printed. What this gate is: a check for the exact strings you listed. What it is not: a proof
|
|
36
|
-
that no personal data ships. Unknown terms
|
|
37
|
+
that no personal data ships. Unknown terms and binary files in the working tree are outside it. --history also
|
|
38
|
+
checks reachable blobs, filenames, commit messages and tag names, including binary blobs,
|
|
39
|
+
against the list, private home paths and credential-shaped strings.
|
|
37
40
|
*/
|
|
38
41
|
const fs = require('fs');
|
|
39
42
|
const path = require('path');
|
|
@@ -41,11 +44,15 @@ const os = require('os');
|
|
|
41
44
|
const { execFileSync } = require('child_process');
|
|
42
45
|
|
|
43
46
|
const SKIP_DIRS = new Set(['.git']); // --all means every file; git mode lets .gitignore decide about node_modules
|
|
47
|
+
const PRIVATE_CLASSES = [
|
|
48
|
+
['P_PATH', /\/(?:Users|home)\/(?!you\b|user\b|example\b|runner\b|name\b)[^/\s"'`),;]+/i],
|
|
49
|
+
['P_TOKEN', /(?<![A-Za-z0-9_-])(?:(?:gh[pousr]_|github_pat_|npm_)[A-Za-z0-9_]{20,}|sk-(?:proj-)?[A-Za-z0-9_-]{20,}|AKIA[A-Z0-9]{16}|xox[baprs]-[A-Za-z0-9-]{20,}|AIza[A-Za-z0-9_-]{30,})|-----BEGIN (?:RSA |EC |OPENSSH |DSA )?PRIVATE KEY-----/]
|
|
50
|
+
];
|
|
44
51
|
|
|
45
52
|
function die(msg) { console.error(`GATE SETUP ERROR: ${msg}`); process.exit(2); }
|
|
46
53
|
|
|
47
54
|
const VALUE_OPTS = ['--dir', '--list'];
|
|
48
|
-
const FLAG_OPTS = ['--self-test', '--all', '--help', '-h', '--version', '-v'];
|
|
55
|
+
const FLAG_OPTS = ['--self-test', '--all', '--history', '--help', '-h', '--version', '-v'];
|
|
49
56
|
/* Parse argv once, strictly: value options at most once each, flags at most once, nothing unknown. */
|
|
50
57
|
function parseArgs() {
|
|
51
58
|
const out = {};
|
|
@@ -134,10 +141,50 @@ function* walk(root) {
|
|
|
134
141
|
}
|
|
135
142
|
}
|
|
136
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
|
+
|
|
137
184
|
function allowedSpans(lineLower, allow) {
|
|
138
185
|
const spans = [];
|
|
139
186
|
for (const a of allow) {
|
|
140
|
-
const al = a
|
|
187
|
+
const al = fold(a);
|
|
141
188
|
if (!al.length) continue;
|
|
142
189
|
let i = lineLower.indexOf(al);
|
|
143
190
|
while (i !== -1) { spans.push([i, i + al.length]); i = lineLower.indexOf(al, i + al.length); }
|
|
@@ -154,6 +201,33 @@ function git(root, args, input) {
|
|
|
154
201
|
return execFileSync('git', ['-C', root, ...args], { input, maxBuffer: 1 << 28 });
|
|
155
202
|
}
|
|
156
203
|
|
|
204
|
+
/* Scan every reachable object and every name in every reachable tree. A git failure,
|
|
205
|
+
malformed object or oversized response refuses the scan rather than dropping coverage. */
|
|
206
|
+
function* historyItems(root) {
|
|
207
|
+
const repo = git(root, ['rev-parse', '--show-toplevel']).toString('utf8').trim();
|
|
208
|
+
const commits = git(repo, ['rev-list', '--all']).toString('ascii').trim().split('\n').filter(Boolean);
|
|
209
|
+
const objects = git(repo, ['rev-list', '--objects', '--all', '--no-object-names']).toString('ascii').trim().split('\n').filter(Boolean);
|
|
210
|
+
for (const oid of commits) {
|
|
211
|
+
const bytes = git(repo, ['cat-file', 'commit', oid]);
|
|
212
|
+
const boundary = bytes.indexOf(Buffer.from('\n\n'));
|
|
213
|
+
if (boundary < 0) throw Error('malformed commit');
|
|
214
|
+
yield { rel: '', label: `history:${oid}:message`, bytes: bytes.subarray(boundary + 2), history: true };
|
|
215
|
+
const entries = git(repo, ['ls-tree', '-r', '-z', '--full-tree', oid]);
|
|
216
|
+
for (const entry of entries.toString('utf8').split('\0').filter(Boolean)) {
|
|
217
|
+
const tab = entry.indexOf('\t');
|
|
218
|
+
if (tab < 0) throw Error('malformed tree entry');
|
|
219
|
+
yield { rel: entry.slice(tab + 1), label: `history:${oid}:filename`, bytes: Buffer.alloc(0), history: true, nameOnly: true };
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
for (const oid of objects) {
|
|
223
|
+
if (!/^[0-9a-f]{40,64}$/.test(oid)) throw Error('malformed object id');
|
|
224
|
+
if (git(repo, ['cat-file', '-t', oid]).toString('ascii').trim() !== 'blob') continue;
|
|
225
|
+
yield { rel: '', label: `history:${oid}:blob`, bytes: git(repo, ['cat-file', 'blob', oid]), history: true };
|
|
226
|
+
}
|
|
227
|
+
const tags = git(repo, ['for-each-ref', '--format=%(refname:strip=2)', 'refs/tags']).toString('utf8').split('\n').filter(Boolean);
|
|
228
|
+
for (const tag of tags) yield { rel: tag, label: 'history:tag', bytes: Buffer.alloc(0), history: true, nameOnly: true };
|
|
229
|
+
}
|
|
230
|
+
|
|
157
231
|
function* gitItems(root) {
|
|
158
232
|
const stage = git(root, ['ls-files', '-z', '--stage']).toString('utf8');
|
|
159
233
|
const cached = [];
|
|
@@ -265,7 +339,7 @@ function fileSet(root, all) {
|
|
|
265
339
|
return { items: walkItems(root), mode: 'walk' };
|
|
266
340
|
}
|
|
267
341
|
|
|
268
|
-
function scan(root, list, listFile, all) {
|
|
342
|
+
function scan(root, list, listFile, all, history = false) {
|
|
269
343
|
root = fs.realpathSync(root); // every caller, self-test included, compares real paths
|
|
270
344
|
const hits = [];
|
|
271
345
|
const scannedPaths = new Set();
|
|
@@ -276,32 +350,45 @@ function scan(root, list, listFile, all) {
|
|
|
276
350
|
scan.mode = set.mode;
|
|
277
351
|
// The list file is excluded by its exact resolved path, never by its display label, and
|
|
278
352
|
// only as a working-tree copy: if git has it in the INDEX it would ship, so that is exit 2.
|
|
279
|
-
|
|
353
|
+
let items = set.items;
|
|
354
|
+
if (history) {
|
|
355
|
+
if (!insideGitRepo(root)) die('--history requires a git work tree');
|
|
356
|
+
try { items = [...items, ...historyItems(root)]; } catch (e) { die(`history enumeration failed: ${e.message}`); }
|
|
357
|
+
}
|
|
358
|
+
for (const item of items) {
|
|
280
359
|
if (skipPath && path.resolve(root, item.rel) === skipPath) {
|
|
281
360
|
if (/\(index/.test(item.label)) die(`the forbidden list itself is tracked by git (${item.rel}). It must never ship: run \`git rm --cached ${item.rel}\` and add it to .gitignore.`);
|
|
282
361
|
continue;
|
|
283
362
|
}
|
|
284
363
|
files++;
|
|
364
|
+
if (history) {
|
|
365
|
+
for (const [rule, pattern] of PRIVATE_CLASSES) {
|
|
366
|
+
if (pattern.test(item.rel)) hits.push({ file: item.history ? item.label : '(path)', line: 0, rule });
|
|
367
|
+
if (!item.nameOnly) item.bytes.toString('utf8').split('\n').forEach((line, n) => {
|
|
368
|
+
if (pattern.test(line)) hits.push({ file: item.history ? item.label : item.rel, line: n + 1, rule });
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
}
|
|
285
372
|
// the PATH first: one scan per item, labelled "(path)", never covered by allow spans of the text
|
|
286
|
-
if (!scannedPaths.has(item.rel)) {
|
|
287
|
-
scannedPaths.add(item.rel);
|
|
288
|
-
const lower = item.rel
|
|
373
|
+
if (!scannedPaths.has(item.rel) || item.history) {
|
|
374
|
+
if (!item.history) scannedPaths.add(item.rel);
|
|
375
|
+
const lower = fold(item.rel), spans = allowedSpans(lower, list.allow);
|
|
289
376
|
for (const term of list.terms) {
|
|
290
|
-
const t = term
|
|
291
|
-
while (i !== -1) { if (!spans.some(([x, y]) => i >= x && i + t.length <= y)) hits.push({ file: `${item.rel} (path)`, line: 0,
|
|
377
|
+
const t = fold(term); let i = lower.indexOf(t);
|
|
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); }
|
|
292
379
|
}
|
|
293
380
|
}
|
|
294
|
-
if (isBinary(item.bytes)) continue;
|
|
381
|
+
if (!item.history && isBinary(item.bytes)) continue;
|
|
295
382
|
const lines = item.bytes.toString('utf8').split('\n');
|
|
296
383
|
lines.forEach((line, n) => {
|
|
297
|
-
const lower = line
|
|
384
|
+
const lower = fold(line);
|
|
298
385
|
const spans = allowedSpans(lower, list.allow);
|
|
299
386
|
for (const term of list.terms) {
|
|
300
|
-
const t = term
|
|
387
|
+
const t = fold(term);
|
|
301
388
|
let i = lower.indexOf(t);
|
|
302
389
|
while (i !== -1) {
|
|
303
390
|
const inside = spans.some(([a, b]) => i >= a && i + t.length <= b);
|
|
304
|
-
if (!inside) hits.push({ file: item.label, line: n + 1,
|
|
391
|
+
if (!inside) hits.push({ file: item.label, line: n + 1, rule: 'P_LIST' });
|
|
305
392
|
i = lower.indexOf(t, i + 1);
|
|
306
393
|
}
|
|
307
394
|
}
|
|
@@ -344,11 +431,23 @@ function main() {
|
|
|
344
431
|
root = fs.realpathSync(root); // same canonical form as the list path, so the exclusion compares like with like
|
|
345
432
|
const listFile = path.resolve(arg('--list', path.join(__dirname, 'forbidden.local.txt')));
|
|
346
433
|
const all = !!arg('--all', false);
|
|
347
|
-
const
|
|
348
|
-
|
|
434
|
+
const history = !!arg('--history', false);
|
|
435
|
+
let list;
|
|
436
|
+
if (history && !arg('--list', null)) {
|
|
437
|
+
try { fs.lstatSync(listFile); list = loadList(listFile); }
|
|
438
|
+
catch (e) { if (e.code === 'ENOENT') list = { terms: [], allow: [] }; else die(`cannot inspect private list (${e.code || 'unknown error'})`); }
|
|
439
|
+
} else list = loadList(listFile);
|
|
440
|
+
const redact = text => {
|
|
441
|
+
const clean = redactByFold(text, list.terms);
|
|
442
|
+
return PRIVATE_CLASSES.some(([, pattern]) => pattern.test(clean)) ? '[redacted path]' : clean;
|
|
443
|
+
};
|
|
444
|
+
const { hits, files, skipped } = scan(root, list, listFile, all, history);
|
|
445
|
+
for (const k of skipped) console.log(`skipped ${redact(k)} (outside the scan root; not read)`);
|
|
349
446
|
if (hits.length) {
|
|
350
447
|
console.log(`GATE FAILED: ${hits.length} hit(s)`);
|
|
351
|
-
for (const h of hits)
|
|
448
|
+
for (const h of hits) {
|
|
449
|
+
console.log(` ${redact(h.file)}${h.line ? ':' + h.line : ''} ${h.rule}`);
|
|
450
|
+
}
|
|
352
451
|
process.exit(1);
|
|
353
452
|
}
|
|
354
453
|
console.log(`gate clean: 0 hits across ${files} files, text and paths (${scan.mode === 'git' ? 'files git would ship, index blobs included' : 'every file under --dir'}; ${skipped.length} skipped)`);
|
package/docs/guarantees.md
CHANGED
|
@@ -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.
|
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
|
|
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
|
|
|
@@ -95,7 +95,7 @@ npx agent-personalizer --global --uninstall
|
|
|
95
95
|
|
|
96
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.
|
|
97
97
|
|
|
98
|
-
Select only `claude`, `agents` and `
|
|
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
|
|
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
|
|
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)
|
|
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
|
|
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
|
|