agent-personalizer 0.10.1 → 0.10.2
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 +16 -1
- package/README.md +15 -14
- package/bin/agent-personalizer.js +24 -21
- package/bin/install-plan.cjs +10 -6
- package/bin/sessions.cjs +17 -5
- package/check/gate.cjs +76 -30
- package/docs/companions.md +8 -8
- package/docs/guarantees.md +1 -1
- package/docs/paste-guide.md +5 -4
- package/examples/answers.json +1 -1
- package/hooks/README.md +1 -1
- package/hooks/gemini-cli/session-start.sh +19 -7
- package/llms.txt +2 -1
- package/package.json +22 -9
- package/render/onboarding.cjs +8 -8
- package/skills/agent-personalizer/SKILL.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,20 @@ Every entry names the adversarial audit round that produced it where one did. Au
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.10.2] - 2026-11-29
|
|
10
|
+
|
|
11
|
+
### Security
|
|
12
|
+
|
|
13
|
+
- Bump `ossf/scorecard-action` to 2.6.0 (#56) and `github/codeql-action/upload-sarif` to 4.39.5 (#57) in `.github/workflows/scorecard.yml`.
|
|
14
|
+
- Replace sequential HTML attribute entity decoding in `website/check.mjs` with single-pass entity lookup so `&` sequences are never double-unescaped, add `--offline` to the `publish.yml` tarball smoke install, enforce HTTPS TLS 1.2+ in `notify-dev-site.yml`, and run `website/` security and live-build checks in `harness.yml`.
|
|
15
|
+
- Tighten `P_TOKEN` in `check/gate.cjs` so Base62 `npm_` and `gh[pousr]_` token patterns still flag credentials while snake_case `npm_config_*` environment variables in `scripts/record-demo.sh` do not trigger false positives during `--history` scans.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Rename the Obsidian vault MCP companion from `obsidian-tc` to `reliquary-tc` across docs and companion guidance (#55), and add `.github/workflows/notify-dev-site.yml` to refresh product-site metadata on release.
|
|
20
|
+
- Speed up `check/gate.cjs` (`git cat-file --batch` history scanning, pre-folded NFC terms and whole-file fast-path filtering), defer heavy module loading after `--help` and `--version` in `bin/agent-personalizer.js`, run `hooks/gemini-cli/session-start.sh` in-process with an explicit missing-`node` check, cache `known-hashes.json` lookups in `bin/install-plan.cjs`, and precompile private terms in `bin/sessions.cjs`.
|
|
21
|
+
- Align `package.json` `description` (151 characters) with `set.json`, point `package.json` `homepage` at `https://agent-personalizer.aunysillyme.dev`, expand npm discovery `keywords`, add `REPO_SETTINGS.md`, add explicit AI search crawler allow directives in `website/build.mjs`, and update `README.md`, `docs/paste-guide.md`, `llms.txt` and `skills/agent-personalizer/SKILL.md` for Gemini (via Antigravity CLI), Claude Code `@AGENTS.md` imports and standalone common-question answers.
|
|
22
|
+
|
|
9
23
|
## [0.10.1] - 2026-11-18
|
|
10
24
|
|
|
11
25
|
### Fixed
|
|
@@ -402,7 +416,8 @@ Thirteen issues (#3 to #15) filed against `5972b32` by an independent installati
|
|
|
402
416
|
- Installer: safe destination resolution, strict options, duplicate `--ai` refused, `--dir` created one level at a time.
|
|
403
417
|
- Harness: exact exit codes, adversarial fixtures, fault injection for the rollback path.
|
|
404
418
|
|
|
405
|
-
[Unreleased]: https://github.com/aunysillyme/agent-personalizer/compare/v0.10.
|
|
419
|
+
[Unreleased]: https://github.com/aunysillyme/agent-personalizer/compare/v0.10.2...HEAD
|
|
420
|
+
[0.10.2]: https://github.com/aunysillyme/agent-personalizer/compare/v0.10.1...v0.10.2
|
|
406
421
|
[0.10.1]: https://github.com/aunysillyme/agent-personalizer/compare/v0.10.0...v0.10.1
|
|
407
422
|
[0.10.0]: https://github.com/aunysillyme/agent-personalizer/compare/v0.9.1...v0.10.0
|
|
408
423
|
[0.9.1]: https://github.com/aunysillyme/agent-personalizer/compare/v0.9.0...v0.9.1
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/agent-personalizer) [](https://github.com/aunysillyme/agent-personalizer/actions/workflows/harness.yml) [](https://github.com/aunysillyme/agent-personalizer/blob/main/CHANGELOG.md) [](LICENSE) [](https://scorecard.dev/viewer/?uri=github.com/aunysillyme/agent-personalizer)
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**AI custom instructions kept in sync across every AI you use:** Claude Code, Codex, Cursor, Gemini CLI, Gemini (via Antigravity CLI), Hermes Agent and ChatGPT, rendered from one source.
|
|
6
6
|
|
|
7
7
|
**The problem:** Custom instructions live in each app separately, drift apart and fade over a long chat.
|
|
8
8
|
|
|
@@ -26,7 +26,7 @@ npx agent-personalizer
|
|
|
26
26
|
| `AGENT_ONBOARDING.md` | Your AI's reading order, writing policy, off-limits topics and approval steps. |
|
|
27
27
|
| `CLAUDE.md` | Your profile and selected rules in Claude Code's project instruction file. |
|
|
28
28
|
| `AGENTS.md` | Your profile and selected rules in the project file used by Codex, Cursor and Hermes Agent. |
|
|
29
|
-
| `GEMINI.md` | Your profile and selected rules in Gemini CLI and
|
|
29
|
+
| `GEMINI.md` | Your profile and selected rules in the instruction file read by Gemini CLI and Gemini (via Antigravity CLI). |
|
|
30
30
|
| ChatGPT paste files | `chatgpt-box1.txt` for your profile and `chatgpt-box2.txt` for response instructions, plus a preview with counts. |
|
|
31
31
|
| `system-prompt.md` | Shareable universal rules for another chat app, bot or API. |
|
|
32
32
|
| Notes folder, level 2 | A folder index, weekly session template, decisions log and inbox for local or fallback notes tools. |
|
|
@@ -60,6 +60,7 @@ File generation, re-runs and uninstall run in CI on Linux, macOS and Windows; yo
|
|
|
60
60
|
| [lean-computer-use](https://github.com/aunysillyme/lean-computer-use) | Background Mac computer control for AI agents: desk tools, a fresh runner subagent, retry guards and a transcript token meter, installed with one command |
|
|
61
61
|
| [decompose](https://github.com/aunysillyme-dev/aunx-decompose) | Task planner and wave checker for AI coding agents: splits prompts into checkable units and parallel waves, rejecting cycles and overlapping writes |
|
|
62
62
|
| [aunx-skills](https://github.com/aunysillyme-dev/aunx-skills) | Ten standalone agent skills for Claude Code, Codex, Cursor and Gemini CLI: full output keeper, number guard, docs fetch ladder, rename sweep and more |
|
|
63
|
+
| [stack](https://github.com/aunysillyme-dev/stack) | AI tools list for everything you build with AI: curated stacks of tools, models and workflows as open JSON. Video and design live, more coming. |
|
|
63
64
|
<!-- set:end -->
|
|
64
65
|
|
|
65
66
|
## Choose your setup
|
|
@@ -154,34 +155,34 @@ npx agent-personalizer --dir . --answers my-answers.json
|
|
|
154
155
|
|
|
155
156
|
| Tool | What it gives you |
|
|
156
157
|
|---|---|
|
|
157
|
-
| [
|
|
158
|
+
| [reliquary-tc](https://github.com/The-40-Thieves/reliquary-tc) | Governed Obsidian access: configure folder permissions from your off-limits answer and human approval from your always-ask answer. |
|
|
158
159
|
| [The Context Layer](https://sierracatalina.com/context-layer) | Purpose-bound context with receipts; its decide and vault stages apply your write policy and off-limits boundaries. |
|
|
159
160
|
|
|
160
161
|
## Common questions
|
|
161
162
|
|
|
162
163
|
### How do I share custom instructions across Claude Code, Codex, Cursor, Gemini CLI, Hermes Agent and ChatGPT?
|
|
163
164
|
|
|
164
|
-
Run `npx agent-personalizer`
|
|
165
|
+
Run `npx agent-personalizer` to generate native instruction files for every selected AI from one `USER.md` profile, `LEARNED.md` log and rule source. Coding agents load their generated files automatically, while ChatGPT gets plain-text exports (`chatgpt-box1.txt` and `chatgpt-box2.txt`) ready to paste.
|
|
165
166
|
|
|
166
|
-
###
|
|
167
|
+
### What is the difference between CLAUDE.md, AGENTS.md, GEMINI.md and SOUL.md?
|
|
167
168
|
|
|
168
|
-
|
|
169
|
+
`agent-personalizer` writes each AI's native instruction file from the same source: `CLAUDE.md` for Claude Code, `AGENTS.md` for Codex, Cursor and project-level Hermes Agent, `GEMINI.md` for Gemini CLI and Gemini (via Antigravity CLI), and `~/.hermes/SOUL.md` for global Hermes Agent installs. See [What it sets up](#what-it-sets-up) and the [paste guide](docs/paste-guide.md) for loading details.
|
|
169
170
|
|
|
170
|
-
### How do I
|
|
171
|
+
### How do I set one global AI profile across all of my repositories?
|
|
171
172
|
|
|
172
|
-
|
|
173
|
+
Run `npx agent-personalizer --global --ai claude,agents,gemini,hermes --yes` to store one shared profile in `~/.agent-personalizer/` and sync marked blocks into `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md` (or `$CODEX_HOME/AGENTS.md`), `~/.gemini/GEMINI.md` and `~/.hermes/SOUL.md` while preserving existing text outside the markers.
|
|
173
174
|
|
|
174
|
-
### How do I
|
|
175
|
+
### How do I update my AI profile or change an onboarding answer?
|
|
175
176
|
|
|
176
|
-
|
|
177
|
+
Run `npx agent-personalizer --dir . --answers my-answers.json` to apply new onboarding preferences, or edit `USER.md`, `LEARNED.md` and `rules/` directly in a level-3 `agent-personalizer` install and run `node render/render.cjs --dir .` before re-pasting changed chat exports.
|
|
177
178
|
|
|
178
|
-
### How do I
|
|
179
|
+
### How do I check generated AI instruction files for drift in CI?
|
|
179
180
|
|
|
180
|
-
|
|
181
|
+
Run `node render/render.cjs --dir . --check` in a level-3 `agent-personalizer` setup to verify every generated block and ChatGPT paste file against `USER.md`, `LEARNED.md` and `rules/`. Exit 0 confirms the files match their sources, exit 1 names drifted files and exit 2 refuses invalid input.
|
|
181
182
|
|
|
182
|
-
### How do I uninstall agent-personalizer
|
|
183
|
+
### How do I uninstall agent-personalizer without losing my notes or edits?
|
|
183
184
|
|
|
184
|
-
Preview with `npx agent-personalizer --uninstall --dir . --dry`, then run `npx agent-personalizer --uninstall --dir .`.
|
|
185
|
+
Preview removal with `npx agent-personalizer --uninstall --dir . --dry`, then run `npx agent-personalizer --uninstall --dir .`. `agent-personalizer` compares recorded SHA-256 hashes, removes unchanged generated files and digests, restores untouched host files byte for byte, and keeps edited files, user-written notes and any `LEARNED.md` with entries.
|
|
185
186
|
|
|
186
187
|
## Uninstall
|
|
187
188
|
|
|
@@ -9,29 +9,18 @@
|
|
|
9
9
|
*/
|
|
10
10
|
const fs = require('fs');
|
|
11
11
|
const path = require('path');
|
|
12
|
-
const readline = require('readline');
|
|
13
|
-
const { resolveHome, resolveCodexHome, walkRealChain, hasNonEmptyOverride } = require('./home.cjs');
|
|
14
12
|
const { sha256, parseCliArgs } = require('./cli-util.cjs');
|
|
15
|
-
const crypto = require('crypto');
|
|
16
|
-
const { execFileSync } = require('child_process');
|
|
17
|
-
// CLAUDE.md, AGENTS.md and GEMINI.md are written here as a pointer template only; render.cjs (run at the
|
|
18
|
-
// end of main()) splices in the rendered block and records the final bytes it wrote, so their
|
|
19
|
-
// hash is recorded there, once, against the complete file.
|
|
20
|
-
const HOME_NAMES = new Set(['CLAUDE.md', 'AGENTS.md', 'GEMINI.md']);
|
|
21
13
|
|
|
22
14
|
const PKG = path.resolve(__dirname, '..');
|
|
23
|
-
const
|
|
24
|
-
const markers = require(path.join(PKG, 'render', 'render.cjs')); // markerState, for the preflight; render.cjs runs nothing on require
|
|
25
|
-
const { installPlan, validateInventory, knownVersions, ownership, migrateHome, recordedHash } = require('./install-plan.cjs');
|
|
26
|
-
const AIS = ['claude', 'agents', 'gemini', 'chatgpt', 'prompt'];
|
|
27
|
-
const AI_LABEL = { claude: 'Claude (Claude Code, Claude apps)', agents: 'Codex / Cursor / Hermes / anything that reads AGENTS.md', gemini: 'Gemini', chatgpt: 'ChatGPT custom instructions', prompt: 'a plain system prompt (shareable, no profile)' };
|
|
15
|
+
const PKG_VERSION = require(path.join(PKG, 'package.json')).version;
|
|
28
16
|
|
|
29
17
|
let committing = false;
|
|
30
|
-
|
|
18
|
+
let markers = null;
|
|
19
|
+
function die(msg) { if (committing && markers) throw new markers.Refusal(msg); console.error(`agent-personalizer: ${msg}`); process.exit(2); }
|
|
31
20
|
|
|
32
21
|
const VALUE_OPTS = ['--dir', '--ai', '--level', '--answers'];
|
|
33
22
|
const FLAG_OPTS = ['--global', '--forget', '--all-projects', '--yes', '--defaults', '--quick', '--full', '--compact', '--precommit', '--uninstall', '--dry', '--help', '--version', '-h', '-v'];
|
|
34
|
-
const USAGE = `agent-personalizer ${
|
|
23
|
+
const USAGE = `agent-personalizer ${PKG_VERSION}
|
|
35
24
|
|
|
36
25
|
npx agent-personalizer [--dir <folder>] [--ai claude,agents,gemini,chatgpt,prompt] [--level 1|2|3]
|
|
37
26
|
[--answers <file.json> | --answers - | --defaults] [--compact]
|
|
@@ -68,7 +57,21 @@ const USAGE = `agent-personalizer ${require(path.join(PKG, 'package.json')).vers
|
|
|
68
57
|
const ARGS = parseCliArgs(process.argv.slice(2), { valueOpts: VALUE_OPTS, flagOpts: FLAG_OPTS, commands: ['learn'], onError: die });
|
|
69
58
|
function arg(name, dflt) { return name in ARGS ? ARGS[name] : dflt; }
|
|
70
59
|
if (ARGS['--help'] || ARGS['-h']) { process.stdout.write(USAGE); process.exit(0); }
|
|
71
|
-
if (ARGS['--version'] || ARGS['-v']) { process.stdout.write(
|
|
60
|
+
if (ARGS['--version'] || ARGS['-v']) { process.stdout.write(PKG_VERSION + '\n'); process.exit(0); }
|
|
61
|
+
|
|
62
|
+
const readline = require('readline');
|
|
63
|
+
const crypto = require('crypto');
|
|
64
|
+
const { execFileSync } = require('child_process');
|
|
65
|
+
const { resolveHome, resolveCodexHome, walkRealChain, hasNonEmptyOverride } = require('./home.cjs');
|
|
66
|
+
// CLAUDE.md, AGENTS.md and GEMINI.md are written here as a pointer template only; render.cjs (run at the
|
|
67
|
+
// end of main()) splices in the rendered block and records the final bytes it wrote, so their
|
|
68
|
+
// hash is recorded there, once, against the complete file.
|
|
69
|
+
const HOME_NAMES = new Set(['CLAUDE.md', 'AGENTS.md', 'GEMINI.md']);
|
|
70
|
+
const onboarding = require(path.join(PKG, 'render', 'onboarding.cjs'));
|
|
71
|
+
markers = require(path.join(PKG, 'render', 'render.cjs')); // markerState, for the preflight; render.cjs runs nothing on require
|
|
72
|
+
const { installPlan, validateInventory, knownVersions, ownership, migrateHome, recordedHash } = require('./install-plan.cjs');
|
|
73
|
+
const AIS = ['claude', 'agents', 'gemini', 'chatgpt', 'prompt'];
|
|
74
|
+
const AI_LABEL = { claude: 'Claude (Claude Code, Claude apps)', agents: 'Codex / Cursor / Hermes / anything that reads AGENTS.md', gemini: 'Gemini', chatgpt: 'ChatGPT custom instructions', prompt: 'a plain system prompt (shareable, no profile)' };
|
|
72
75
|
|
|
73
76
|
async function ask(q, dflt, saved = false) {
|
|
74
77
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -440,7 +443,7 @@ async function main() {
|
|
|
440
443
|
const installedHashes = { ...(cfg.installed && typeof cfg.installed === 'object' ? cfg.installed : {}) };
|
|
441
444
|
const createdDirectories = new Set(cfg.createdDirectories || []);
|
|
442
445
|
const toolingVersions = { ...(cfg.toolingVersions || {}) };
|
|
443
|
-
const toolingVersion =
|
|
446
|
+
const toolingVersion = PKG_VERSION;
|
|
444
447
|
const legacy = cfgExists && !!prevAnswers && !Object.hasOwn(cfg, 'installed');
|
|
445
448
|
|
|
446
449
|
console.log(`\nInstalling level ${level} for ${targets.join(', ')} into ${root}\nOnboarding answers: ${answersSource}\n`);
|
|
@@ -631,7 +634,7 @@ async function main() {
|
|
|
631
634
|
continue;
|
|
632
635
|
}
|
|
633
636
|
if (existing.equals(bytes)) {
|
|
634
|
-
installedHashes[p.rel] =
|
|
637
|
+
installedHashes[p.rel] = owner.hash;
|
|
635
638
|
if (p.src || p.rel.startsWith('rules/')) toolingVersions[p.rel] = toolingVersion;
|
|
636
639
|
console.log(`kept ${p.rel} (unchanged)`);
|
|
637
640
|
continue;
|
|
@@ -732,9 +735,9 @@ async function main() {
|
|
|
732
735
|
if (level >= 3) steps.push('Register hooks/claude-code/session-start.sh or hooks/gemini-cli/session-start.sh (see hooks/README.md) and copy check/forbidden.example.txt to check/forbidden.local.txt.');
|
|
733
736
|
console.log('\nNext:');
|
|
734
737
|
steps.forEach((step, i) => console.log(` ${i + 1}. ${step}`));
|
|
735
|
-
if (answers.notes_tool === 'obsidian') console.log(answers.
|
|
736
|
-
? `\nCompanion: the onboarding file routes the AI through
|
|
737
|
-
: `\nCompanion: your notes are an Obsidian vault and the AI will work on the folder directly.
|
|
738
|
+
if (answers.notes_tool === 'obsidian') console.log(answers.reliquary_tc === 'yes'
|
|
739
|
+
? `\nCompanion: the onboarding file routes the AI through reliquary-tc; configure its folder ACLs from your off-limits answer and its human-in-the-loop list from your always-ask answer. See ${DOCS}/companions.md`
|
|
740
|
+
: `\nCompanion: your notes are an Obsidian vault and the AI will work on the folder directly. reliquary-tc would give it governed access (folder ACLs, human-in-the-loop, audit log): \`npx reliquary-tc /path/to/vault\`, then set reliquary_tc to yes through --answers. See ${DOCS}/companions.md`);
|
|
738
741
|
else if (answers.notes_tool === 'notion' || answers.notes_tool === 'google-docs') console.log(`\nCompanion: connect ${answers.notes_tool === 'notion' ? 'Notion' : 'Google Drive / Docs'} through your AI's own connector settings (where the app offers one); the onboarding file already names the door and the write posture, and tells the AI to make no filesystem writes for these notes. See ${DOCS}/companions.md`);
|
|
739
742
|
else if (answers.notes_tool === 'apple-notes') console.log(`\nCompanion: Apple Notes needs a separately installed local Apple Notes MCP; no AI app ships one built in. Until you connect one, the onboarding file already limits the AI to reading and creating new notes. See ${DOCS}/companions.md`);
|
|
740
743
|
else if (answers.notes_tool === 'other') console.log(`\nNote: "${answers.notes_tool_name || 'your notes tool'}" is unknown to this kit; the onboarding file tells the AI to ask before its first write there and to use the local fallback folder notes/ meanwhile.`);
|
package/bin/install-plan.cjs
CHANGED
|
@@ -22,16 +22,20 @@ function validateInventory(cfg) {
|
|
|
22
22
|
if ('createdDirectories' in cfg && (!Array.isArray(cfg.createdDirectories) || cfg.createdDirectories.some(rel => !validPath(rel)) || new Set(cfg.createdDirectories).size !== cfg.createdDirectories.length)) throw new Error('"createdDirectories" must be a unique list of relative paths');
|
|
23
23
|
if ('toolingVersions' in cfg && (!cfg.toolingVersions || typeof cfg.toolingVersions !== 'object' || Array.isArray(cfg.toolingVersions))) throw new Error('"toolingVersions" must be an object');
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
let cachedKnownFiles = null;
|
|
26
|
+
function knownVersions(rel, bytes, precomputedHash) {
|
|
27
|
+
cachedKnownFiles ||= require('./known-hashes.json').files;
|
|
28
|
+
const hashes = cachedKnownFiles[rel] || {};
|
|
29
|
+
const hash = precomputedHash || sha256(bytes);
|
|
28
30
|
return Object.entries(hashes).filter(([, variants]) => Object.values(variants).includes(hash)).map(([version]) => version.slice(1));
|
|
29
31
|
}
|
|
30
32
|
function ownership(cfg, rel, bytes, { legacy = false, expected } = {}) {
|
|
31
33
|
const recorded = recordedHash(cfg, rel);
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
34
|
+
const hash = sha256(bytes);
|
|
35
|
+
const savedVersion = (cfg.toolingVersions || {})[rel] || cfg.toolingVersion;
|
|
36
|
+
const versions = (recorded === undefined ? legacy : !savedVersion) ? knownVersions(rel, bytes, hash) : [];
|
|
37
|
+
const version = savedVersion || versions.at(-1);
|
|
38
|
+
return { unedited: recorded !== undefined ? hash === recorded : legacy && (versions.length > 0 || (expected && bytes.equals(expected))), version, hash };
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
// Match one semantic pointer slot at a time, then compare the whole original line.
|
package/bin/sessions.cjs
CHANGED
|
@@ -45,12 +45,24 @@ const SECRETS = [
|
|
|
45
45
|
const secretMatch = text => SECRETS.some(pattern => pattern.test(String(text).replace(CTRL, '')));
|
|
46
46
|
const fold = (text) => String(text).replace(CTRL, '').normalize('NFC').toLowerCase();
|
|
47
47
|
const compact = (text) => fold(text).replace(/\s+/g, '');
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
48
|
+
function compilePrivateTerms(privateTerms) {
|
|
49
|
+
if (!Array.isArray(privateTerms) || !privateTerms.length) return [];
|
|
50
|
+
const out = [];
|
|
51
|
+
for (const raw of privateTerms) {
|
|
52
|
+
if (typeof raw !== 'string') continue;
|
|
52
53
|
const term = fold(raw).trim();
|
|
53
54
|
const tight = compact(raw);
|
|
55
|
+
if (term || tight) out.push({ term, tight });
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function privateMatch(text, terms) {
|
|
61
|
+
if (!terms.length) return false;
|
|
62
|
+
const lower = fold(text);
|
|
63
|
+
const collapsed = lower.replace(/\s+/g, '');
|
|
64
|
+
return terms.some(entry => {
|
|
65
|
+
const { term, tight } = typeof entry === 'string' ? { term: fold(entry).trim(), tight: compact(entry) } : entry;
|
|
54
66
|
return (term && lower.includes(term)) || (tight && collapsed.includes(tight));
|
|
55
67
|
});
|
|
56
68
|
}
|
|
@@ -641,7 +653,7 @@ async function readSessions({ home, codexHome, projectDir = process.cwd(), allPr
|
|
|
641
653
|
home: resolvedHome, codexHome: resolvedCodexHome, projectDir, allProjects,
|
|
642
654
|
geminiProjectHash: crypto.createHash('sha256').update(projectDir).digest('hex'),
|
|
643
655
|
candidates: [], memoryFiles: [], filesRead: [], filesChecked: 0, skipped: {},
|
|
644
|
-
privateTerms:
|
|
656
|
+
privateTerms: compilePrivateTerms(privateTerms)
|
|
645
657
|
};
|
|
646
658
|
await discover(state.home, selectedSources, state);
|
|
647
659
|
state.candidates.sort((a, b) => b.mtimeMs - a.mtimeMs || a.file.localeCompare(b.file));
|
package/check/gate.cjs
CHANGED
|
@@ -46,7 +46,7 @@ const { execFileSync } = require('child_process');
|
|
|
46
46
|
const SKIP_DIRS = new Set(['.git']); // --all means every file; git mode lets .gitignore decide about node_modules
|
|
47
47
|
const PRIVATE_CLASSES = [
|
|
48
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]_|
|
|
49
|
+
['P_TOKEN', /(?<![A-Za-z0-9_-])(?:(?:gh[pousr]_|npm_)[A-Za-z0-9]{20,}|github_pat_[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
50
|
];
|
|
51
51
|
|
|
52
52
|
function die(msg) { console.error(`GATE SETUP ERROR: ${msg}`); process.exit(2); }
|
|
@@ -181,11 +181,9 @@ function redactByFold(text, terms) {
|
|
|
181
181
|
|
|
182
182
|
const fold = text => String(text).normalize('NFC').toLowerCase();
|
|
183
183
|
|
|
184
|
-
function allowedSpans(lineLower,
|
|
184
|
+
function allowedSpans(lineLower, foldedAllow) {
|
|
185
185
|
const spans = [];
|
|
186
|
-
for (const
|
|
187
|
-
const al = fold(a);
|
|
188
|
-
if (!al.length) continue;
|
|
186
|
+
for (const al of foldedAllow) {
|
|
189
187
|
let i = lineLower.indexOf(al);
|
|
190
188
|
while (i !== -1) { spans.push([i, i + al.length]); i = lineLower.indexOf(al, i + al.length); }
|
|
191
189
|
}
|
|
@@ -203,26 +201,54 @@ function git(root, args, input) {
|
|
|
203
201
|
|
|
204
202
|
/* Scan every reachable object and every name in every reachable tree. A git failure,
|
|
205
203
|
malformed object or oversized response refuses the scan rather than dropping coverage. */
|
|
204
|
+
function* batchCatFile(repo, oids) {
|
|
205
|
+
if (!oids.length) return;
|
|
206
|
+
for (const oid of oids) if (!/^[0-9a-f]{40,64}$/.test(oid)) throw Error('malformed object id');
|
|
207
|
+
const out = git(repo, ['cat-file', '--batch'], oids.join('\n') + '\n');
|
|
208
|
+
let pos = 0;
|
|
209
|
+
for (const oid of oids) {
|
|
210
|
+
const nl = out.indexOf(0x0a, pos);
|
|
211
|
+
if (nl === -1) throw Error(`short cat-file output for ${oid}`);
|
|
212
|
+
const header = out.subarray(pos, nl).toString('ascii');
|
|
213
|
+
const hm = header.match(/^([0-9a-f]+) (\w+) (\d+)$/);
|
|
214
|
+
if (!hm) throw Error(`unexpected cat-file header for ${oid}: ${header}`);
|
|
215
|
+
const size = Number(hm[3]);
|
|
216
|
+
const body = out.subarray(nl + 1, nl + 1 + size);
|
|
217
|
+
if (body.length !== size || out[nl + 1 + size] !== 0x0a) throw Error(`truncated cat-file body for ${oid}`);
|
|
218
|
+
pos = nl + 1 + size + 1;
|
|
219
|
+
yield { oid, type: hm[2], bytes: body };
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
206
223
|
function* historyItems(root) {
|
|
207
224
|
const repo = git(root, ['rev-parse', '--show-toplevel']).toString('utf8').trim();
|
|
208
225
|
const commits = git(repo, ['rev-list', '--all']).toString('ascii').trim().split('\n').filter(Boolean);
|
|
209
226
|
const objects = git(repo, ['rev-list', '--objects', '--all', '--no-object-names']).toString('ascii').trim().split('\n').filter(Boolean);
|
|
210
|
-
|
|
211
|
-
|
|
227
|
+
const treeNamesCache = new Map();
|
|
228
|
+
for (const { oid, type, bytes } of batchCatFile(repo, commits)) {
|
|
229
|
+
if (type !== 'commit') throw Error('malformed commit');
|
|
212
230
|
const boundary = bytes.indexOf(Buffer.from('\n\n'));
|
|
213
231
|
if (boundary < 0) throw Error('malformed commit');
|
|
214
232
|
yield { rel: '', label: `history:${oid}:message`, bytes: bytes.subarray(boundary + 2), history: true };
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
233
|
+
const treeMatch = bytes.subarray(0, boundary).toString('ascii').match(/^tree ([0-9a-f]{40,64})$/m);
|
|
234
|
+
const treeKey = treeMatch ? treeMatch[1] : oid;
|
|
235
|
+
let names = treeNamesCache.get(treeKey);
|
|
236
|
+
if (!names) {
|
|
237
|
+
const entries = git(repo, ['ls-tree', '-r', '-z', '--full-tree', treeKey]);
|
|
238
|
+
names = entries.toString('utf8').split('\0').filter(Boolean).map(entry => {
|
|
239
|
+
const tab = entry.indexOf('\t');
|
|
240
|
+
if (tab < 0) throw Error('malformed tree entry');
|
|
241
|
+
return entry.slice(tab + 1);
|
|
242
|
+
});
|
|
243
|
+
treeNamesCache.set(treeKey, names);
|
|
244
|
+
}
|
|
245
|
+
for (const name of names) {
|
|
246
|
+
yield { rel: name, label: `history:${oid}:filename`, bytes: Buffer.alloc(0), history: true, nameOnly: true };
|
|
220
247
|
}
|
|
221
248
|
}
|
|
222
|
-
for (const oid of objects) {
|
|
223
|
-
if (
|
|
224
|
-
|
|
225
|
-
yield { rel: '', label: `history:${oid}:blob`, bytes: git(repo, ['cat-file', 'blob', oid]), history: true };
|
|
249
|
+
for (const { oid, type, bytes } of batchCatFile(repo, objects)) {
|
|
250
|
+
if (type !== 'blob') continue;
|
|
251
|
+
yield { rel: '', label: `history:${oid}:blob`, bytes, history: true };
|
|
226
252
|
}
|
|
227
253
|
const tags = git(repo, ['for-each-ref', '--format=%(refname:strip=2)', 'refs/tags']).toString('utf8').split('\n').filter(Boolean);
|
|
228
254
|
for (const tag of tags) yield { rel: tag, label: 'history:tag', bytes: Buffer.alloc(0), history: true, nameOnly: true };
|
|
@@ -355,38 +381,58 @@ function scan(root, list, listFile, all, history = false) {
|
|
|
355
381
|
if (!insideGitRepo(root)) die('--history requires a git work tree');
|
|
356
382
|
try { items = [...items, ...historyItems(root)]; } catch (e) { die(`history enumeration failed: ${e.message}`); }
|
|
357
383
|
}
|
|
384
|
+
const foldedTerms = list.terms.map(fold).filter(Boolean);
|
|
385
|
+
const foldedAllow = list.allow.map(fold).filter(Boolean);
|
|
358
386
|
for (const item of items) {
|
|
359
387
|
if (skipPath && path.resolve(root, item.rel) === skipPath) {
|
|
360
388
|
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.`);
|
|
361
389
|
continue;
|
|
362
390
|
}
|
|
363
391
|
files++;
|
|
392
|
+
let decodedText = null;
|
|
393
|
+
let splitLines = null;
|
|
394
|
+
const getText = () => (decodedText === null ? (decodedText = item.bytes.toString('utf8')) : decodedText);
|
|
395
|
+
const getLines = () => (splitLines === null ? (splitLines = getText().split('\n')) : splitLines);
|
|
364
396
|
if (history) {
|
|
365
397
|
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
|
|
368
|
-
|
|
369
|
-
|
|
398
|
+
if (item.rel && pattern.test(item.rel)) hits.push({ file: item.history ? item.label : '(path)', line: 0, rule });
|
|
399
|
+
if (!item.nameOnly && pattern.test(getText())) {
|
|
400
|
+
getLines().forEach((line, n) => {
|
|
401
|
+
if (pattern.test(line)) hits.push({ file: item.history ? item.label : item.rel, line: n + 1, rule });
|
|
402
|
+
});
|
|
403
|
+
}
|
|
370
404
|
}
|
|
371
405
|
}
|
|
372
406
|
// the PATH first: one scan per item, labelled "(path)", never covered by allow spans of the text
|
|
373
|
-
if (!scannedPaths.has(item.rel) || item.history) {
|
|
407
|
+
if (foldedTerms.length && (!scannedPaths.has(item.rel) || item.history)) {
|
|
374
408
|
if (!item.history) scannedPaths.add(item.rel);
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
const
|
|
378
|
-
|
|
409
|
+
if (item.rel) {
|
|
410
|
+
const lower = fold(item.rel);
|
|
411
|
+
const matchedPathTerms = foldedTerms.filter(t => lower.includes(t));
|
|
412
|
+
if (matchedPathTerms.length) {
|
|
413
|
+
const spans = allowedSpans(lower, foldedAllow);
|
|
414
|
+
for (const t of matchedPathTerms) {
|
|
415
|
+
let i = lower.indexOf(t);
|
|
416
|
+
while (i !== -1) {
|
|
417
|
+
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' });
|
|
418
|
+
i = lower.indexOf(t, i + 1);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
379
422
|
}
|
|
380
423
|
}
|
|
424
|
+
if (!foldedTerms.length || item.nameOnly) continue;
|
|
381
425
|
if (!item.history && isBinary(item.bytes)) continue;
|
|
382
|
-
const
|
|
383
|
-
|
|
426
|
+
const fullLower = fold(getText());
|
|
427
|
+
const activeTerms = foldedTerms.filter(t => fullLower.includes(t));
|
|
428
|
+
if (!activeTerms.length) continue;
|
|
429
|
+
getLines().forEach((line, n) => {
|
|
384
430
|
const lower = fold(line);
|
|
385
|
-
|
|
386
|
-
for (const
|
|
387
|
-
const t = fold(term);
|
|
431
|
+
let spans = null;
|
|
432
|
+
for (const t of activeTerms) {
|
|
388
433
|
let i = lower.indexOf(t);
|
|
389
434
|
while (i !== -1) {
|
|
435
|
+
spans ||= allowedSpans(lower, foldedAllow);
|
|
390
436
|
const inside = spans.some(([a, b]) => i >= a && i + t.length <= b);
|
|
391
437
|
if (!inside) hits.push({ file: item.label, line: n + 1, rule: 'P_LIST' });
|
|
392
438
|
i = lower.indexOf(t, i + 1);
|
package/docs/companions.md
CHANGED
|
@@ -4,16 +4,16 @@ This repo tells an AI *how to behave with you*. Two optional companions govern o
|
|
|
4
4
|
|
|
5
5
|
| Your saved setting | Without a companion | Through a configured companion |
|
|
6
6
|
|---|---|---|
|
|
7
|
-
| **Always ask before** delete / publish / send / spend | the AI remembering |
|
|
8
|
-
| **Off limits** folders | the AI remembering |
|
|
9
|
-
| **Write policy** (freely / logs and inbox only / ask first) | the AI remembering |
|
|
7
|
+
| **Always ask before** delete / publish / send / spend | the AI remembering | reliquary-tc: destructive tools fail closed until a human confirms |
|
|
8
|
+
| **Off limits** folders | the AI remembering | reliquary-tc: folder ACL deny, per caller |
|
|
9
|
+
| **Write policy** (freely / logs and inbox only / ask first) | the AI remembering | reliquary-tc: per-folder read / write / delete scopes; Context Layer: memory writes stay proposals until approved |
|
|
10
10
|
| **Evidence inline** | the AI citing what it read | Context Layer: every disclosure and action leaves a receipt |
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## reliquary-tc (for Obsidian vaults)
|
|
15
15
|
|
|
16
|
-
**What it is.** A governed MCP server over Obsidian vaults: https://github.com/The-40-Thieves/
|
|
16
|
+
**What it is.** A governed MCP server over Obsidian vaults: https://github.com/The-40-Thieves/reliquary-tc (AGPL-3.0). Its own README states the problem it exists for: an agent with raw filesystem access to a vault "can do real damage", and most Obsidian MCP servers hand that access over with an API key between the agent and everything you have written.
|
|
17
17
|
|
|
18
18
|
**What it adds** (its words, condensed):
|
|
19
19
|
- **Governed writes**: every call runs through auth → scopes → folder ACL → read-only kill switch → idempotency → throttle → human-in-the-loop confirmation → audit log. You decide which folders an agent may read, write or delete, per vault and per caller; destructive operations fail closed until a human approves.
|
|
@@ -23,11 +23,11 @@ This repo tells an AI *how to behave with you*. Two optional companions govern o
|
|
|
23
23
|
|
|
24
24
|
**Try it**:
|
|
25
25
|
```bash
|
|
26
|
-
npx
|
|
26
|
+
npx reliquary-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 `
|
|
30
|
+
**How it pairs with this repo.** Answer `notes_tool: obsidian` and `reliquary_tc: yes` and the rendered `AGENT_ONBOARDING.md` tells the AI to reach the vault through reliquary-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 reliquary-tc. Calls routed through reliquary-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 `reliquary_tc: no` (the default) and the AI works on the vault folder directly, with the onboarding file naming what reliquary-tc would add.
|
|
31
31
|
|
|
32
32
|
---
|
|
33
33
|
|
|
@@ -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` |
|
|
54
|
+
| `obsidian` | reliquary-tc (above) when `reliquary_tc: yes`, else the vault folder on disk | your write policy; enforced on reliquary-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 |
|
package/docs/guarantees.md
CHANGED
|
@@ -79,7 +79,7 @@ The onboarding manual tells the AI where it may write, what is off limits and wh
|
|
|
79
79
|
|
|
80
80
|
To make those answers govern tool access, configure a [companion](companions.md):
|
|
81
81
|
|
|
82
|
-
- **
|
|
82
|
+
- **reliquary-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
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/paste-guide.md
CHANGED
|
@@ -7,7 +7,7 @@ The renderer writes one file per AI. This page says where each AI reads it, and
|
|
|
7
7
|
| `CLAUDE.md` | Claude Code | Automatically, from the project, or `~/.claude/CLAUDE.md` for every project with `--global`. Nothing to paste. |
|
|
8
8
|
| `AGENT_ONBOARDING.md` | any AI | Named as the second thing to read in `CLAUDE.md`, `AGENTS.md` and `GEMINI.md`. Paste or upload it where the AI does not read your local folder directly (below). |
|
|
9
9
|
| `AGENTS.md` | Codex CLI, Cursor, Hermes Agent, and other agents that adopted the AGENTS.md convention | Automatically, from the repository root; `--global` writes `~/.codex/AGENTS.md` (or `$CODEX_HOME/AGENTS.md` when `CODEX_HOME` is set) for all projects. Nothing to paste. |
|
|
10
|
-
| `GEMINI.md` | Gemini CLI and
|
|
10
|
+
| `GEMINI.md` | Gemini CLI and Gemini (via Antigravity CLI) | Automatically, from the folder; `--global` writes `~/.gemini/GEMINI.md` for all projects (also read by Google Antigravity alongside `~/.gemini/config/GEMINI.md`). Nothing to paste. |
|
|
11
11
|
| `SOUL.md` | Hermes Agent | `--global --ai hermes` appends a marked block to `~/.hermes/SOUL.md`. In a project, use `--ai agents` for `AGENTS.md`. A different `HERMES_HOME` changes where Hermes reads the global file. |
|
|
12
12
|
| `chatgpt-box1.txt`, `chatgpt-box2.txt` and `chatgpt-custom-instructions.md` | ChatGPT | Profile and response text to paste, with a preview and counts. |
|
|
13
13
|
| `system-prompt.md` | anything with a system-prompt field, shared bots, API calls | Paste as the system prompt. Universal rules only, no profile, safe to share. |
|
|
@@ -21,6 +21,7 @@ Use `npx agent-personalizer --global --ai claude,agents,gemini,hermes --yes` for
|
|
|
21
21
|
1. Run the installer in the project folder. `CLAUDE.md` and `AGENT_ONBOARDING.md` land there and Claude Code reads `CLAUDE.md` on every session.
|
|
22
22
|
2. For rules that must win at the moment of decision, register the session-start hook: see [`hooks/README.md`](../hooks/README.md). It prints the inject-marked rules and your onboarding block into context before your first message.
|
|
23
23
|
3. For your output style specifically, Claude Code has a custom output-style slot that lives in the system prompt every turn (`/output-style`). Put the "How to talk" and "Output shape" lines from `AGENT_ONBOARDING.md` there; a style in the system prompt is re-sent every turn, so it does not fade the way a file read once does. Tier 1 in [tiers.md](tiers.md).
|
|
24
|
+
4. In contributor repositories that standardize on a single shared `AGENTS.md` instead of separate rendered blocks, a minimal `CLAUDE.md` containing `@AGENTS.md` imports `AGENTS.md` directly into Claude Code.
|
|
24
25
|
|
|
25
26
|
## claude.ai (web and desktop apps), Claude Projects
|
|
26
27
|
|
|
@@ -56,11 +57,11 @@ Verified against [OpenAI's Codex AGENTS.md documentation](https://developers.ope
|
|
|
56
57
|
|
|
57
58
|
Reads `AGENTS.md` at the project root. Older setups use `.cursor/rules/`; if yours does, point one rule file at `AGENTS.md` rather than copying its text, so there is one owner.
|
|
58
59
|
|
|
59
|
-
## Gemini CLI and
|
|
60
|
+
## Gemini CLI and Gemini (via Antigravity CLI)
|
|
60
61
|
|
|
61
|
-
Gemini CLI reads `GEMINI.md` from the folder (and parent folders), plus `~/.gemini/GEMINI.md` when installed with `--global --ai gemini`. Project installs also add `.gemini/commands/personalize.toml` for `/personalize`, and level-3 installs provide `hooks/gemini-cli/session-start.sh` for `.gemini/settings.json` (see [`hooks/README.md`](../hooks/README.md)).
|
|
62
|
+
Gemini CLI reads `GEMINI.md` from the folder (and parent folders), plus `~/.gemini/GEMINI.md` when installed with `--global --ai gemini`. Project installs also add `.gemini/commands/personalize.toml` for `/personalize`, and level-3 installs provide `hooks/gemini-cli/session-start.sh` for `.gemini/settings.json` (see [`hooks/README.md`](../hooks/README.md)). Standalone Gemini CLI consumer `Login with Google` for Google AI Pro and Ultra accounts was deprecated in June 2026 in favor of Gemini API keys or Gemini (via Antigravity CLI); both runners read the same `GEMINI.md` output.
|
|
62
63
|
|
|
63
|
-
Google Antigravity
|
|
64
|
+
Google Antigravity (including Gemini (via Antigravity CLI)) discovers directory `GEMINI.md` and `AGENTS.md` files from the current directory up to the repository root with deduplication, and reads `~/.gemini/GEMINI.md` alongside its managed global target `~/.gemini/config/GEMINI.md` (which enforces a 24,000-byte per-file limit after includes, plus modular `~/.gemini/config/rules/*.md` files with YAML frontmatter). Use `--compact` if a custom rule set approaches the 20,000-character warning budget.
|
|
64
65
|
|
|
65
66
|
## Anything else
|
|
66
67
|
|
package/examples/answers.json
CHANGED
package/hooks/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# hooks/
|
|
2
2
|
|
|
3
|
-
Tier 3 from the tiers doc (https://github.com/aunysillyme/agent-personalizer/blob/v0.10.
|
|
3
|
+
Tier 3 from the tiers doc (https://github.com/aunysillyme/agent-personalizer/blob/v0.10.2/docs/tiers.md): the few rules that must be in context at the moment of decision, injected in full at the start of every session. Injection puts the text in front of the model; whether the model follows it is up to the model and the host. This is the strongest placement available, not a guarantee.
|
|
4
4
|
|
|
5
5
|
Which rules? The ones with `inject: true` in their frontmatter. Keep that set small. Every injected rule costs tokens every session.
|
|
6
6
|
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
# Gemini CLI SessionStart hook: injects the rendered session-start contract as JSON additionalContext.
|
|
3
3
|
set -eu
|
|
4
|
-
|
|
4
|
+
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
ROOT="$(cd "$HERE/../.." && pwd)"
|
|
6
|
+
if ! command -v node >/dev/null 2>&1; then
|
|
7
|
+
echo "[agent-personalizer] node not found; session-start contract NOT injected. Rules remain reachable through GEMINI.md pointers." >&2
|
|
8
|
+
exit 1
|
|
9
|
+
fi
|
|
5
10
|
exec node -e '
|
|
6
|
-
const { spawnSync } = require("child_process");
|
|
7
11
|
const path = require("path");
|
|
8
12
|
const root = process.argv[1];
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
const chunks = [];
|
|
14
|
+
const origWrite = process.stdout.write.bind(process.stdout);
|
|
15
|
+
process.stdout.write = (chunk, encoding) => {
|
|
16
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk), typeof encoding === "string" ? encoding : "utf8"));
|
|
17
|
+
return true;
|
|
18
|
+
};
|
|
19
|
+
process.argv = [process.execPath, path.join(root, "render/render.cjs"), "--dir", root, "--contract", "--contract-target", "gemini"];
|
|
20
|
+
try {
|
|
21
|
+
require(path.join(root, "render/render.cjs")).main();
|
|
22
|
+
} finally {
|
|
23
|
+
process.stdout.write = origWrite;
|
|
13
24
|
}
|
|
14
|
-
|
|
25
|
+
const text = Buffer.concat(chunks).toString("utf8");
|
|
26
|
+
process.stdout.write(JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: text } }) + "\n");
|
|
15
27
|
' "$ROOT"
|
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# agent-personalizer
|
|
2
2
|
|
|
3
|
-
> AI custom instructions from approved entries: a profile and rules for Claude Code, Codex, Cursor, Gemini CLI, Hermes Agent and ChatGPT, rendered from one source and kept in sync.
|
|
3
|
+
> AI custom instructions from approved entries: a profile and rules for Claude Code, Codex, Cursor, Gemini CLI, Gemini (via Antigravity CLI), Hermes Agent and ChatGPT, rendered from one source and kept in sync.
|
|
4
4
|
|
|
5
5
|
Install with `npx agent-personalizer`. Node 24 or 26 (active LTS) is recommended; 22 or later runs. Headless setup: `npx agent-personalizer --dir . --ai claude,agents --level 1 --yes --defaults`.
|
|
6
6
|
|
|
@@ -30,6 +30,7 @@ Session data stays local until the user's AI reads it and sends it to its provid
|
|
|
30
30
|
- [lean-computer-use](https://github.com/aunysillyme/lean-computer-use): Background Mac computer control for AI agents: desk tools, a fresh runner subagent, retry guards and a transcript token meter, installed with one command
|
|
31
31
|
- [decompose](https://github.com/aunysillyme-dev/aunx-decompose): Task planner and wave checker for AI coding agents: splits prompts into checkable units and parallel waves, rejecting cycles and overlapping writes
|
|
32
32
|
- [aunx-skills](https://github.com/aunysillyme-dev/aunx-skills): Ten standalone agent skills for Claude Code, Codex, Cursor and Gemini CLI: full output keeper, number guard, docs fetch ladder, rename sweep and more
|
|
33
|
+
- [stack](https://github.com/aunysillyme-dev/stack): AI tools list for everything you build with AI: curated stacks of tools, models and workflows as open JSON. Video and design live, more coming.
|
|
33
34
|
<!-- set:end -->
|
|
34
35
|
|
|
35
36
|
## Optional
|
package/package.json
CHANGED
|
@@ -1,38 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-personalizer",
|
|
3
|
-
"version": "0.10.
|
|
4
|
-
"description": "AI custom instructions from approved entries: a profile and rules for Claude Code, Codex, Cursor, Gemini CLI
|
|
3
|
+
"version": "0.10.2",
|
|
4
|
+
"description": "AI custom instructions from approved entries: a profile and rules for Claude Code, Codex, Cursor, Gemini CLI and ChatGPT, kept in sync from one source.",
|
|
5
5
|
"author": "aunysillyme (https://github.com/aunysillyme)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/aunysillyme",
|
|
8
8
|
"repository": "github:aunysillyme/agent-personalizer",
|
|
9
|
-
"homepage": "https://
|
|
9
|
+
"homepage": "https://agent-personalizer.aunysillyme.dev",
|
|
10
10
|
"bugs": {
|
|
11
11
|
"url": "https://github.com/aunysillyme/agent-personalizer/issues"
|
|
12
12
|
},
|
|
13
13
|
"keywords": [
|
|
14
14
|
"ai-agents",
|
|
15
|
+
"coding-agents",
|
|
15
16
|
"custom-instructions",
|
|
16
17
|
"agents-md",
|
|
18
|
+
"claude-md",
|
|
19
|
+
"gemini-md",
|
|
20
|
+
"soul-md",
|
|
17
21
|
"claude-code",
|
|
18
22
|
"codex",
|
|
23
|
+
"openai-codex",
|
|
19
24
|
"cursor",
|
|
25
|
+
"windsurf",
|
|
26
|
+
"copilot",
|
|
20
27
|
"gemini-cli",
|
|
28
|
+
"antigravity",
|
|
21
29
|
"google-antigravity",
|
|
22
30
|
"hermes-agent",
|
|
23
31
|
"chatgpt",
|
|
32
|
+
"agent-skills",
|
|
33
|
+
"skill-pack",
|
|
34
|
+
"dotfiles",
|
|
35
|
+
"context-engineering",
|
|
24
36
|
"personalization",
|
|
25
37
|
"agent-onboarding",
|
|
26
|
-
"
|
|
27
|
-
"claude-md",
|
|
28
|
-
"gemini-md",
|
|
38
|
+
"claude-code-hooks",
|
|
29
39
|
"system-prompt",
|
|
40
|
+
"prompt-engineering",
|
|
30
41
|
"ai-memory",
|
|
42
|
+
"llms-txt",
|
|
43
|
+
"obsidian",
|
|
44
|
+
"mcp",
|
|
31
45
|
"llm",
|
|
32
46
|
"cli",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"prompt-engineering"
|
|
47
|
+
"nodejs",
|
|
48
|
+
"zero-dependencies"
|
|
36
49
|
],
|
|
37
50
|
"bin": {
|
|
38
51
|
"agent-personalizer": "bin/agent-personalizer.js"
|
package/render/onboarding.cjs
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
DOCS points at the matching tag on GitHub so an installed copy never links to a file the
|
|
18
18
|
destination does not have.
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = '0.10.
|
|
20
|
+
const VERSION = '0.10.2';
|
|
21
21
|
const DOCS = `https://github.com/aunysillyme/agent-personalizer/blob/v${VERSION}/docs`;
|
|
22
22
|
|
|
23
23
|
/* THE single source for notes tools. Add a tool here and nowhere else: the saved choice option, the
|
|
@@ -26,10 +26,10 @@ const DOCS = `https://github.com/aunysillyme/agent-personalizer/blob/v${VERSION}
|
|
|
26
26
|
readonly = no agent door today, so writes fall back to a local folder; other = named by the user,
|
|
27
27
|
conservative posture. p = location escaped for a code span, q = location escaped for prose. */
|
|
28
28
|
const TOOL = {
|
|
29
|
-
'obsidian': { kind: 'disk', label: 'an Obsidian vault (pairs with
|
|
29
|
+
'obsidian': { kind: 'disk', label: 'an Obsidian vault (pairs with reliquary-tc, see the companions doc)', name: 'Obsidian',
|
|
30
30
|
reach: (p, q, n, tc) => tc
|
|
31
|
-
? `the vault at \`${p}/\`, through **
|
|
32
|
-
: `the vault at \`${p}/\` as plain files (
|
|
31
|
+
? `the vault at \`${p}/\`, through **reliquary-tc** (governed MCP: folder ACLs, human-in-the-loop confirmation for destructive tools, audit log) rather than raw filesystem access; see ${DOCS}/companions.md`
|
|
32
|
+
: `the vault at \`${p}/\` as plain files (reliquary-tc is not installed; ${DOCS}/companions.md explains what it would add: folder ACLs, human-in-the-loop confirmation, an audit log)`, posture: null },
|
|
33
33
|
'notion': { kind: 'cloud', label: 'Notion', name: 'Notion', unit: 'page', reach: (p, q) => `the workspace "${q}" through Notion's own MCP connector`, posture: 'Write only into the pages or databases named in this file. Propose a new top-level page; never create one unasked.' },
|
|
34
34
|
'google-docs': { kind: 'cloud', label: 'Google Docs / Drive', name: 'Google Docs', unit: 'doc', reach: (p, q) => `"${q}" through the Google Drive / Docs connector`, posture: 'Draft into a doc named for the topic. Never edit the existing text of a shared doc without being asked.' },
|
|
35
35
|
'apple-notes': { kind: 'cloud', label: 'Apple Notes', name: 'Apple Notes', unit: 'note', reach: (p, q) => `the "${q}" folder through a separately installed local Apple Notes MCP (not built into any AI app; the user installs and connects it)`, posture: 'Read, and create new notes. Never edit or delete an existing note.' },
|
|
@@ -40,7 +40,7 @@ const TOOL = {
|
|
|
40
40
|
'other': { kind: 'other', label: 'something else (name it in the next answer)', name: null, reach: (p, q) => `"${q}"`, posture: 'Ask before the first write into it, and say which tool and location you mean. Until told otherwise, write only to the local fallback folder below.' },
|
|
41
41
|
};
|
|
42
42
|
/* name comes back RAW and is md-escaped exactly once at each prose render site */
|
|
43
|
-
const toolFor = (a) => { const t = TOOL[a.notes_tool]; return { kind: t.kind, unit: t.unit, posture: t.posture, name: t.name || a.notes_tool_name || 'an unnamed notes tool', reach: t.reach(esc(a.notes_path), md(a.notes_path), a.notes_tool_name || '', a.
|
|
43
|
+
const toolFor = (a) => { const t = TOOL[a.notes_tool]; return { kind: t.kind, unit: t.unit, posture: t.posture, name: t.name || a.notes_tool_name || 'an unnamed notes tool', reach: t.reach(esc(a.notes_path), md(a.notes_path), a.notes_tool_name || '', a.reliquary_tc === 'yes') }; };
|
|
44
44
|
const FALLBACK = 'notes';
|
|
45
45
|
/* kind without rendering anything (safe before validation completes) */
|
|
46
46
|
const kindOf = (a) => TOOL[a.notes_tool].kind;
|
|
@@ -96,7 +96,7 @@ const QUESTIONS = [
|
|
|
96
96
|
{ id: 'read_first', type: 'list', default: ['USER.md', 'AGENT_ONBOARDING.md'] },
|
|
97
97
|
{ id: 'notes_tool', type: 'choice', default: 'folder',
|
|
98
98
|
options: Object.entries(TOOL).map(([k, t]) => [k, t.label]) },
|
|
99
|
-
{ id: '
|
|
99
|
+
{ id: 'reliquary_tc', type: 'choice', default: 'no',
|
|
100
100
|
options: [['no', 'not installed; the AI works on the vault folder directly'], ['yes', 'installed and connected; the AI reaches the vault through it']] },
|
|
101
101
|
{ id: 'notes_tool_name', type: 'text', default: '' },
|
|
102
102
|
{ id: 'notes_path', type: 'text', default: 'notes' },
|
|
@@ -402,7 +402,7 @@ function writesLine(a, opts) {
|
|
|
402
402
|
const where = t.kind === 'cloud' ? `${md(t.name)} "${md(a.notes_path)}" through its connector, no filesystem writes`
|
|
403
403
|
: t.kind === 'readonly' ? `${md(t.name)} is read-only for you; the local fallback folder is ${esc(FALLBACK)}/`
|
|
404
404
|
: t.kind === 'other' ? `${md(t.name)} is unknown here: ask before the first write there; local fallback folder ${esc(FALLBACK)}/ meanwhile`
|
|
405
|
-
: `${md(t.name)} at ${esc(a.notes_path)}/${a.notes_tool === 'obsidian' && a.
|
|
405
|
+
: `${md(t.name)} at ${esc(a.notes_path)}/${a.notes_tool === 'obsidian' && a.reliquary_tc === 'yes' ? ', through reliquary-tc' : ''}`;
|
|
406
406
|
return `Writes: ${WRITE_POLICY[a.write_policy]}. Notes: ${where}.`;
|
|
407
407
|
}
|
|
408
408
|
function contractBlock(a, opts) {
|
|
@@ -419,7 +419,7 @@ function contractBlock(a, opts) {
|
|
|
419
419
|
'## How to work with this person', '',
|
|
420
420
|
`Always ask before: ${a.always_ask.join(', ') || 'nothing declared'}.`,
|
|
421
421
|
a.off_limits.length ? `Off limits in any output: ${a.off_limits.map(md).join(', ')}.` : null,
|
|
422
|
-
notesPending(a, opts) ? a.write_policy === 'notes-freely' ? 'Writes: no notes folder yet. Create nothing unasked. Once it exists, under its rules; nowhere else unasked.' : `Writes: no notes folder yet. ${WRITE_POLICY_PENDING[a.write_policy]}.` : kindOf(a) === 'disk' && a.write_policy === 'notes-freely' ? `Writes: under ${esc(a.notes_path)}/ rules only, nowhere else unasked. Notes: ${md(toolFor(a).name)}${a.
|
|
422
|
+
notesPending(a, opts) ? a.write_policy === 'notes-freely' ? 'Writes: no notes folder yet. Create nothing unasked. Once it exists, under its rules; nowhere else unasked.' : `Writes: no notes folder yet. ${WRITE_POLICY_PENDING[a.write_policy]}.` : kindOf(a) === 'disk' && a.write_policy === 'notes-freely' ? `Writes: under ${esc(a.notes_path)}/ rules only, nowhere else unasked. Notes: ${md(toolFor(a).name)}${a.reliquary_tc === 'yes' && a.notes_tool === 'obsidian' ? ', through reliquary-tc' : ''}.` : writesLine(a, opts),
|
|
423
423
|
`Tone: ${tone}. Length: ${length}. Wrong: ${mistakes}. Unsure: ${unsure}.`,
|
|
424
424
|
`Open with ${lead}; ${structure}; ${evidence}.${a.signature === 'yes' ? ' Sign note edits: one Last edited by line, overwritten.' : ''}`,
|
|
425
425
|
a.never.length ? `Never: ${a.never.map(md).join('; ')}.` : null,
|
|
@@ -72,7 +72,7 @@ The installer and renderer run locally with no network calls or telemetry after
|
|
|
72
72
|
|---|---|
|
|
73
73
|
| `USER.md`, `LEARNED.md`, `AGENT_ONBOARDING.md` | Profile, approved or declined entries, and reading order, writing policy and approval steps. |
|
|
74
74
|
| `.agent-personalizer.json` | Saved targets, level, answers and installed-file history. |
|
|
75
|
-
| `CLAUDE.md`, `AGENTS.md`, `GEMINI.md` | Selected AI instruction files for Claude Code, Codex/Cursor/Hermes Agent and Gemini CLI/
|
|
75
|
+
| `CLAUDE.md`, `AGENTS.md`, `GEMINI.md` | Selected AI instruction files for Claude Code, Codex/Cursor/Hermes Agent and Gemini CLI / Gemini (via Antigravity CLI). |
|
|
76
76
|
| `chatgpt-box1.txt`, `chatgpt-box2.txt` and `chatgpt-custom-instructions.md` (a preview with counts) | Selected ChatGPT profile and response instructions to paste manually. |
|
|
77
77
|
| `system-prompt.md` | Selected shareable universal rules, without learned entries. |
|
|
78
78
|
| `.claude/commands/personalize.md`, `.gemini/commands/personalize.toml` | Claude Code and Gemini CLI `/personalize` commands. |
|