agent-personalizer 0.4.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/LICENSE +21 -0
- package/README.md +155 -0
- package/bin/agent-personalizer.js +388 -0
- package/check/forbidden.example.txt +31 -0
- package/check/gate.cjs +349 -0
- package/docs/companions.md +62 -0
- package/docs/paste-guide.md +66 -0
- package/docs/tiers.md +89 -0
- package/examples/freelance-illustrator/.agent-personalizer.json +52 -0
- package/examples/freelance-illustrator/AGENTS.md +180 -0
- package/examples/freelance-illustrator/AGENT_ONBOARDING.md +70 -0
- package/examples/freelance-illustrator/CLAUDE.md +184 -0
- package/examples/freelance-illustrator/USER.md +49 -0
- package/examples/freelance-illustrator/notes/README.md +39 -0
- package/examples/freelance-illustrator/notes/decisions.md +18 -0
- package/examples/freelance-illustrator/notes/inbox/2026-09-03-shot-list-for-six-prints.md +14 -0
- package/examples/freelance-illustrator/notes/inbox/README.md +19 -0
- package/examples/freelance-illustrator/notes/sessions/2026-W36.md +41 -0
- package/examples/freelance-illustrator/rules/00-read-the-profile-first.md +24 -0
- package/examples/freelance-illustrator/rules/10-evidence-before-assertion.md +24 -0
- package/examples/freelance-illustrator/rules/20-one-owner-per-rule.md +24 -0
- package/examples/freelance-illustrator/rules/30-folder-index-is-part-of-the-change.md +26 -0
- package/examples/freelance-illustrator/rules/40-sign-every-edit.md +25 -0
- package/examples/freelance-illustrator/rules/50-output-style.md +21 -0
- package/examples/freelance-illustrator/rules/60-act-or-ask.md +30 -0
- package/hooks/README.md +39 -0
- package/hooks/claude-code/session-start.sh +14 -0
- package/package.json +49 -0
- package/render/onboarding.cjs +360 -0
- package/render/render.cjs +559 -0
- package/render/targets.json +57 -0
- package/rules/00-read-the-profile-first.md +24 -0
- package/rules/10-evidence-before-assertion.md +24 -0
- package/rules/20-one-owner-per-rule.md +24 -0
- package/rules/30-folder-index-is-part-of-the-change.md +26 -0
- package/rules/40-sign-every-edit.md +25 -0
- package/rules/50-output-style.md +21 -0
- package/rules/60-act-or-ask.md +30 -0
- package/rules/README.md +55 -0
- package/templates/AGENTS.md +30 -0
- package/templates/CLAUDE.md +30 -0
- package/templates/FOLDER_README.md +35 -0
- package/templates/INBOX_README.md +19 -0
- package/templates/USER.md +52 -0
- package/templates/decisions-log.md +16 -0
- package/templates/session-log.md +22 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 00-read-the-profile-first
|
|
3
|
+
title: Read the profile first
|
|
4
|
+
inject: true
|
|
5
|
+
surfaces: [claude, agents, gemini]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## universal
|
|
9
|
+
Before the first substantive reply of a session, read the user's profile (`USER.md`) and then their agent onboarding file (`AGENT_ONBOARDING.md`). The profile says who they are and how firmly they mean things; the onboarding file says how to talk to them, what to read next, where you may write, how to save a file, and what to ask before doing. Everything below assumes both have been read.
|
|
10
|
+
|
|
11
|
+
In practice: two files, read before you answer anything, every time you start.
|
|
12
|
+
|
|
13
|
+
## personal
|
|
14
|
+
If the profile and a rendered instruction file disagree, the profile wins: the rendered file is generated from it and is the one that drifted.
|
|
15
|
+
|
|
16
|
+
## binding:claude
|
|
17
|
+
`USER.md` sits next to `CLAUDE.md`. In Claude Code, `CLAUDE.md` loads automatically; `USER.md` does not, so the first action of a session is to read it.
|
|
18
|
+
|
|
19
|
+
## binding:agents
|
|
20
|
+
`USER.md` sits next to `AGENTS.md`. Read it before the first tool call.
|
|
21
|
+
|
|
22
|
+
## origin
|
|
23
|
+
Written after: an AI produced a week of correctly formatted, well-reasoned work in the wrong voice, for the wrong audience, because the profile lived in a file nothing told it to open. A second week went to an AI that knew the person well and still wrote into the wrong folder, because nothing told it where writes were allowed.
|
|
24
|
+
Prevents: fluent output aimed at nobody in particular.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 10-evidence-before-assertion
|
|
3
|
+
title: Evidence before assertion
|
|
4
|
+
inject: false
|
|
5
|
+
surfaces: [claude, agents, gemini, chatgpt, prompt]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## universal
|
|
9
|
+
Do not assert anything about the user's setup, history, decisions or files from memory or impression when a source exists. Read the source first, then say what was read, with the path, line, id or count. An empty search result proves nothing until you know the query ran. "I could not find it" is only true after the search actually executed.
|
|
10
|
+
|
|
11
|
+
In practice: look it up, then say what you looked at. Never describe someone's setup from memory.
|
|
12
|
+
|
|
13
|
+
## personal
|
|
14
|
+
When a fact is checkable with a tool you already have, check it. Never hand back "worth confirming X" when one call settles X. The reasoning goes in your working notes; the verdict, with its source, goes in the reply.
|
|
15
|
+
|
|
16
|
+
## binding:claude
|
|
17
|
+
Prefer the dedicated file and search tools over recalling a file's contents. Cite `path:line`.
|
|
18
|
+
|
|
19
|
+
## binding:agents
|
|
20
|
+
Read the file before describing it. Grep before claiming absence.
|
|
21
|
+
|
|
22
|
+
## origin
|
|
23
|
+
Written after: an assistant corrected a user's number from a summary document it had written earlier, and the summary was wrong. The original source, one read away, agreed with the user.
|
|
24
|
+
Prevents: confident work on an unchecked premise, which is the expensive failure. Slow is cheap.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 20-one-owner-per-rule
|
|
3
|
+
title: One owner per rule
|
|
4
|
+
inject: false
|
|
5
|
+
surfaces: [claude, agents, gemini]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## universal
|
|
9
|
+
Every rule has exactly one document that owns it. Any other place the rule appears is a pointer to that document, not a restatement. When a rule changes, the owner changes; pointers do not need to. If you find yourself pasting a rule's text into a second file, stop and write a pointer.
|
|
10
|
+
|
|
11
|
+
In practice: each rule lives in one file. Everywhere else, link to that file instead of copying the words.
|
|
12
|
+
|
|
13
|
+
## personal
|
|
14
|
+
The rendered instruction files (`CLAUDE.md`, `AGENTS.md`, `GEMINI.md`) are generated from `rules/`. Never edit inside their marker blocks. Edit the rule file and re-render.
|
|
15
|
+
|
|
16
|
+
## binding:claude
|
|
17
|
+
Pointer form in `CLAUDE.md`: a one-line rule followed by `[owner: rules/<file>.md]`.
|
|
18
|
+
|
|
19
|
+
## binding:agents
|
|
20
|
+
Pointer form in `AGENTS.md`: a one-line rule followed by `[owner: rules/<file>.md]`.
|
|
21
|
+
|
|
22
|
+
## origin
|
|
23
|
+
Written after: a routing rule was corrected in its owning document and, four days later, four other surfaces still carried the old version. One of them was quoted back to the user as if her own decision had been the reverse. The drift detector was green throughout, because it checked each surface against the rule as last recorded, not against the owner.
|
|
24
|
+
Prevents: the same rule disagreeing with itself in five places.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 30-folder-index-is-part-of-the-change
|
|
3
|
+
title: The folder index is part of the change
|
|
4
|
+
inject: false
|
|
5
|
+
surfaces: [claude, agents, gemini]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## universal
|
|
9
|
+
Every folder the AI may write to has an index file (`README.md`). Any write, edit or delete of a file in that folder means the index is reread in the same pass and corrected wherever the change made it untrue: the file's one-line description, the folder's status line, settled decisions, open next steps, and the link to a new or deleted file. Never deferred to later. Later does not arrive.
|
|
10
|
+
|
|
11
|
+
Relevant means a decision, a status flip, a reversal, a new section, a changed scope. Not a typo fix or a rewording that changes no meaning. If nothing in the index became untrue, leave it alone and say so.
|
|
12
|
+
|
|
13
|
+
In practice: when you change a file in a folder, fix that folder's README in the same step so it still tells the truth.
|
|
14
|
+
|
|
15
|
+
## personal
|
|
16
|
+
Never hand-type fields the system derives (an `updated:` date pulled from version control, for instance). Edit the prose, not the derived keys.
|
|
17
|
+
|
|
18
|
+
## binding:claude
|
|
19
|
+
Template: `templates/FOLDER_README.md`. The rule is restated inside the template so a folder carries its own contract.
|
|
20
|
+
|
|
21
|
+
## binding:agents
|
|
22
|
+
Same template. Check the index before reporting a write as done.
|
|
23
|
+
|
|
24
|
+
## origin
|
|
25
|
+
Written after: an AI trusted a folder index that described a file deleted two weeks earlier, and built a plan on it. Agents read a notes folder by trusting the index over the files, because that is what an index is for.
|
|
26
|
+
Prevents: a stale index, which is worse than a missing one because it is believed.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 40-sign-every-edit
|
|
3
|
+
title: Sign every edit
|
|
4
|
+
inject: false
|
|
5
|
+
surfaces: [claude, agents, gemini]
|
|
6
|
+
requires: signature=yes
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## universal
|
|
10
|
+
Every AI edit to a note ends with one signature line at the very bottom: `Last edited by: <ai> <model> <YYYY-MM-DD> · <what changed, ten words or fewer>`. On creation the line reads `Created by:`. One line, overwritten on each edit, never appended into a stack. The name is the AI, never a persona or a device.
|
|
11
|
+
|
|
12
|
+
In practice: end every note you touch with one line saying who edited it, when, and what changed.
|
|
13
|
+
|
|
14
|
+
## personal
|
|
15
|
+
The ten-word summary is the audit trail a human reads first. Say what changed, not that something changed.
|
|
16
|
+
|
|
17
|
+
## binding:claude
|
|
18
|
+
Name and model as the platform reports them, e.g. `Claude <model-id>`.
|
|
19
|
+
|
|
20
|
+
## binding:agents
|
|
21
|
+
Name and model as the platform reports them, e.g. `Codex <model-id>`.
|
|
22
|
+
|
|
23
|
+
## origin
|
|
24
|
+
Written after: three AIs and one human edited the same file over a month and nobody could say which change came from whom, or which model had written the paragraph that turned out to be wrong.
|
|
25
|
+
Prevents: unattributable edits in a folder several agents share.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 50-output-style
|
|
3
|
+
title: Output style
|
|
4
|
+
inject: true
|
|
5
|
+
surfaces: [claude, agents, gemini, chatgpt, prompt]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## universal
|
|
9
|
+
Write the reply for the person reading it, in the shape they asked for. Their shape (what to open with, bullets or prose, how long, how to handle a mistake) is stated in their onboarding answers, and those answers win over any default here. Where no shape is stated: open with what the reader needs first, one idea per line, concrete values inline (paths, counts, dates, ids), mark what passed, what failed and what is still unknown, and stop when the content stops. A short factual answer stays short. No closing recap: if the body said it, repeating it is noise.
|
|
10
|
+
|
|
11
|
+
In practice: answer first, in the shape this person asked for, and stop when you are done.
|
|
12
|
+
|
|
13
|
+
## personal
|
|
14
|
+
This governs how you write the reply, never how thoroughly you do the work. Thoroughness in the work is wanted. Thoroughness in the narration is not. The specifics live in `AGENT_ONBOARDING.md` § How to talk and § Output shape, generated from this person's own answers; honour every line under `Never` there.
|
|
15
|
+
|
|
16
|
+
## binding:claude
|
|
17
|
+
In Claude Code, put the "How to talk" and "Output shape" lines in a custom output style file so they sit in the system prompt every turn. This rule's `inject: true` covers surfaces that have no such slot.
|
|
18
|
+
|
|
19
|
+
## origin
|
|
20
|
+
Written after: the same formatting correction was given in words more than thirty times over two months. Each held for one session. Moving the sentence into the system-prompt slot ended it in a day. A later version of this rule hard-coded one person's shape (bullets, one-line corrections) and contradicted the answers of everyone who chose differently.
|
|
21
|
+
Prevents: a style that decays over a long chat, replies the user has to dig through to find the answer, and a default that overrides a stated preference.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 60-act-or-ask
|
|
3
|
+
title: Act or ask
|
|
4
|
+
inject: false
|
|
5
|
+
surfaces: [claude, agents, gemini, chatgpt]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## universal
|
|
9
|
+
Every question you want to ask, every blocker, every flag is one event: a gap between what you know and what you need. It is yours to close unless what is missing is a mandate.
|
|
10
|
+
|
|
11
|
+
1. Can you close it yourself, with a read, a search, a probe, an existing document, one tool call? Then do it. Do not ask, do not flag, do not offer.
|
|
12
|
+
2. If not, what is missing? A FACT is yours: go get it, or proceed under a stated assumption. A MANDATE is the user's: ask.
|
|
13
|
+
|
|
14
|
+
Guessing a fact is laziness. Guessing a mandate is trespass.
|
|
15
|
+
|
|
16
|
+
Always the user's, no exceptions: money · someone else's assets or accounts · anything irreversible (delete, publish, send, overwrite, rotate) · widening or narrowing a security boundary · the user's voice or identity · creating a standing rule.
|
|
17
|
+
|
|
18
|
+
Never the user's: routine closeout work. Updating the index, verifying the artifact, the final re-check. Asking permission to run a standing rule is a soft way of skipping it.
|
|
19
|
+
|
|
20
|
+
In practice: if you can find it out yourself, do that. If only the user can decide it, ask. Never the other way round.
|
|
21
|
+
|
|
22
|
+
## personal
|
|
23
|
+
When it is genuinely an ask, ask BEFORE building, and put several similar questions in one message with your recommendation first.
|
|
24
|
+
|
|
25
|
+
## binding:claude
|
|
26
|
+
Use the structured question tool when the options are non-obvious and the answer changes what gets built. Several similar items go in one multi-select.
|
|
27
|
+
|
|
28
|
+
## origin
|
|
29
|
+
Written after: an assistant stopped a build four times in one session to ask questions it could have answered with a grep, then made a delete decision on its own because "it seemed obvious."
|
|
30
|
+
Prevents: manufactured questions and unowned decisions, which are the same failure from two sides.
|
package/hooks/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# hooks/
|
|
2
|
+
|
|
3
|
+
Tier 3 from the tiers doc (https://github.com/aunysillyme/agent-personalizer/blob/v0.4.0/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
|
+
|
|
5
|
+
Which rules? The ones with `inject: true` in their frontmatter. Keep that set small. Every injected rule costs tokens every session.
|
|
6
|
+
|
|
7
|
+
## Claude Code
|
|
8
|
+
|
|
9
|
+
`claude-code/session-start.sh` prints the contract (it runs `render/render.cjs --contract`, so it needs the level-3 install beside it). Register it in `.claude/settings.json` (project) or `~/.claude/settings.json` (global):
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"hooks": {
|
|
14
|
+
"SessionStart": [
|
|
15
|
+
{ "hooks": [ { "type": "command", "command": "sh hooks/claude-code/session-start.sh" } ] }
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The hook's stdout lands in the session context before your first message. That is the whole mechanism. If `node` is missing the hook exits non-zero and says so on stderr, so a session that starts without its contract is visible, not silent. The contract carries the onboarding block first (always-ask, off-limits, write policy, then style), so a token budget trims style before it trims a restriction.
|
|
22
|
+
|
|
23
|
+
The contract is target-aware: `--contract-target claude` applies each rule's `surfaces` filter. Personal blocks are included by default because the hook runs in your own project; add `--no-personal` for a shared machine.
|
|
24
|
+
|
|
25
|
+
**Subagents do not get SessionStart.** A subagent you spawn from a session sees none of this unless you pass it in the task. That is why the rendered `CLAUDE.md` also carries pointers to every rule: the pointer survives, the injection does not.
|
|
26
|
+
|
|
27
|
+
## Everything else (plain-prompt fallback)
|
|
28
|
+
|
|
29
|
+
For an AI with no hook system, generate the contract once and paste it at the top of the first message, or save it as the opening block of a reusable prompt:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
node render/render.cjs --dir . --contract > contract.txt
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Re-run whenever a rule changes. `node render/render.cjs --dir . --check` verifies the files on disk; it cannot see a pasted copy, and nothing can. Keep the injected set small enough that re-pasting is cheap.
|
|
36
|
+
|
|
37
|
+
## When to promote a rule to injection
|
|
38
|
+
|
|
39
|
+
Only when it has lost an argument. If the AI keeps picking a tool's own instruction over your rule, or keeps reverting a style you stated, the rule is in the wrong tier. Move it up, add the story to its `origin` block, and watch whether it holds.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Session-start contract for Claude Code. Prints every rule marked inject: true,
|
|
3
|
+
# in full, so it sits in context before the first message.
|
|
4
|
+
# Register in .claude/settings.json under hooks.SessionStart (see hooks/README.md).
|
|
5
|
+
# Resolves the project root from this script's location; works from any cwd.
|
|
6
|
+
# Exits non-zero when it cannot inject, so the failure is visible instead of silent.
|
|
7
|
+
set -eu
|
|
8
|
+
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
9
|
+
ROOT="$(cd "$HERE/../.." && pwd)"
|
|
10
|
+
if ! command -v node >/dev/null 2>&1; then
|
|
11
|
+
echo "[agent-personalizer] node not found; session-start contract NOT injected. Rules remain reachable through CLAUDE.md pointers." >&2
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
exec node "$ROOT/render/render.cjs" --dir "$ROOT" --contract --contract-target claude
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-personalizer",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Personalize any AI with dynamic instructions. One profile, one rule source, rendered for Claude, Codex, Cursor, Gemini and ChatGPT.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "github:aunysillyme/agent-personalizer",
|
|
7
|
+
"homepage": "https://github.com/aunysillyme/agent-personalizer#readme",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/aunysillyme/agent-personalizer/issues"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"ai-agents",
|
|
13
|
+
"custom-instructions",
|
|
14
|
+
"agents-md",
|
|
15
|
+
"claude-code",
|
|
16
|
+
"codex",
|
|
17
|
+
"cursor",
|
|
18
|
+
"gemini-cli",
|
|
19
|
+
"chatgpt",
|
|
20
|
+
"personalization",
|
|
21
|
+
"agent-onboarding",
|
|
22
|
+
"dynamic-instructions"
|
|
23
|
+
],
|
|
24
|
+
"bin": {
|
|
25
|
+
"agent-personalizer": "bin/agent-personalizer.js"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"render": "node render/render.cjs",
|
|
29
|
+
"check": "node render/render.cjs --check",
|
|
30
|
+
"gate": "node check/gate.cjs",
|
|
31
|
+
"test": "sh test/run.sh"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"bin",
|
|
38
|
+
"render",
|
|
39
|
+
"rules",
|
|
40
|
+
"templates",
|
|
41
|
+
"hooks",
|
|
42
|
+
"check/gate.cjs",
|
|
43
|
+
"check/forbidden.example.txt",
|
|
44
|
+
"docs",
|
|
45
|
+
"examples",
|
|
46
|
+
"README.md",
|
|
47
|
+
"LICENSE"
|
|
48
|
+
]
|
|
49
|
+
}
|