Repository navigation
Inbox: your rules in each agent's own instructions file - #3598
Merged
Merged
Conversation
The note block now carries the person's Rules for your agents after its own lines, under the reminder's existing lead, inside the same v9 markers. With no rules the block is byte for byte today's. Saving rules in Settings rewrites every untouched note (refreshInboxNotes, same guarantees). The Claude Code, Pi and OpenCode reminders leave the rules out when the agent's own note file holds them. Settings names every agent the rules do not reach. For #3555
- Rules holding the marker prefix or a memory header anywhere stay out of the note (a U+2028/U+2029/CR line start no longer slips a second end marker in). - An unreadable config.json writes no note at start and refuses an add, instead of reading as "no rules". - Settings' "Not sent to" lines: a throw shows none; no line for Cursor, a declined agent or rules the note cannot carry; the fix only where Settings -> Agents can do it. - OpenCode decides per request (cached stat); the mod reads its rules file again at the first prompt and at compaction. - Per-agent note previews follow the shared-file rule. - Tests for the mod, Pi and OpenCode wiring and the save path; docs.
- OpenCode reads config.json's rules again when the file changed (one stat per request) and the Claude Code mod at each first prompt and compaction, so a saved R2 the Inbox wrote into the note is never followed by R1 in the reminder. - Settings stays silent only for the person's own no: a file the automatic add left alone on purpose (read-only, hard-linked, pasted without markers) and rules the note cannot carry are named, with no fix where nothing can be turned on. - environment.md: OpenCode 2's bytes change with the rules and the note.
backnotprop
marked this pull request as ready for review
November 17, 2026 16:44
# Conflicts: # apps/hook/server/inbox-command.ts # docs/agent-guides/server-and-storage.md
…eview points - The Pi extension decides "the note holds the rules" per host: only Pi's own note counts for Pi. Oh My Pi reads its own agent folder, where the Inbox writes no note, so its reminder always carries the rules, and each session it switches to gets a reminder decided then (piReminderFollower). - Settings → Prompts: "Turn them on" when the line names several agents. - The first-run note dialog previews what each agent really gets: its own rules where it has them, one block per distinct note, named when they differ. - The doc comment of inboxNoteHoldsAgentRules sits on its function again.
Takes in #3567 (the person's rules and reminder in the MCP server's instructions). Settings → Prompts keeps both kinds of line true: an agent connected through MCP (inbox/agents.json) gets no "Not sent to …: no note" line while the MCP instructions carry the shared rules; the MCP room lines are unchanged. The docs say where the rules now reach Codex, Gemini CLI and Qwen Code twice (note and MCP instructions) as a known limit.
The note's rules now come from config.json only once the Inbox's turned-on mark says on (noteRulesConfig). Before that, a note added with plannotator inbox --notes, a refresh and the window's preview are today's block byte for byte, and Cursor's copy carries no rules. A test runs the add, the refresh and the preview with the mark absent, then turns it on.
An initialize on this computer's /mcp leaves the rules out of the MCP instructions when the client is Codex (codex-mcp-client) or Gemini CLI (gemini-cli-mcp-client), the Inbox is turned on, and that agent's note holds exactly those rules (the check the reminders make). Any other client, note state or connection gets them as before.
…r MCP The note leaves out rules longer than INBOX_REMINDER_MAX_CHARS, as it already does for rules with a marker, and is never written where it would take the file past 1 MiB (without the rules then, else not at all), so the Inbox can always take it out again. The Claude Code mod leaves the rules out of its reminder only in a session proven to load its rules file (Claude Code's own prompt and VS Code panel); a T3 Code thread, Orca or another host keeps them. The MCP instructions carry the rules for every client again, as on main: the Inbox cannot tell which file a connecting agent reads (Codex clears its MCP server's environment, so CODEX_HOME never reaches the shim), and leaving them out gave an agent with another home none at all.
# Conflicts: # apps/hook/hooks/mod/enabled.ts # apps/hook/hooks/mod/register.ts # apps/pi-extension/inbox.ts # docs/agent-guides/server-and-storage.md # packages/inbox/components/AgentsSettings.tsx # packages/server/inbox-agent-notes.ts # packages/server/inbox.ts # packages/shared/config.ts
Oh My Pi's Inbox tool default (resolvePiInboxTool) now also decides the Pi reminder with the person's rules.
DuongCoder04
pushed a commit
to DuongCoder04/plannotator
that referenced
this pull request
Nov 29, 2026
Move the marker from f00a501 to b74c769 and list the additive ./inbox-* changes core 0.25.37 carries from backnotprop#4161, backnotprop#4172, backnotprop#4194, backnotprop#3595, backnotprop#4186, backnotprop#3676 and backnotprop#3598.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Your rules from Settings → Prompts → "Rules for your agents" now also go into the Plannotator note in each agent's own instructions file (
~/.codex/AGENTS.md,~/.gemini/GEMINI.md, Claude Code'srules/plannotator-inbox.mdand the others), only between Plannotator's own two marker lines. Claude Code, Pi and OpenCode get them once: their session reminder leaves them out while the note holds them. Codex, Gemini CLI and Qwen Code get them in their file and also, when they connect through MCP, in the MCP server's instructions, so twice there, never none.This push (2026-11-28, fourth): main merged
9ecdd463c603(0.29.7, with Inbox for code review only #4067 "the Inbox for code review only"), a plain merge: 8 conflicts, all resolved by hand. No word a person or agent reads changed, and no new Settings sentence; for the full Inbox the feature works as before.inbox-review-only-notes.ts), main's structure kept:noteRulesConfigreads main'sinboxAgentWords): an add by hand, a refresh and the preview give today's block. The notes are out as main takes them out.isOwnNoteBlockwith the file: the record that names it), so it is never saved as the person's edit, and it goes back with the rules set by then, as the plain note does.refresh), never beside another writer.packages/server/inbox-review-only-note-rules.test.ts(5 tests, scratch home and data dir, no Inbox), each checked red then green.This push (2026-11-28, third): the independent review's three changes
An independent review read the whole PR and asked for three changes before merge. The rule behind each one is the PR's own: twice is better than never.
M1. The note never takes more than Settings saves, or a file past 1 MiB (
packages/server/inbox-agent-notes.ts).noteSafeleaves rules longer thanINBOX_REMINDER_MAX_CHARS(9,000 characters) out of the note, the same way as rules that hold a marker. Only a hand-edited config.json has such rules. The note is then today's block. The holds check finds no rules in it, so no host leaves them out of its reminder because of the note.AGENT_FILE_MAX_BYTES(1 MiB). Past that sizereadAgentFilerefuses the file for good, and switching the note off, a refresh or uninstall could not take the note out again. The note goes in without the rules in that case. Where even that does not fit, nothing is written: the add gives the existing "can't be edited: it is larger than 1 MiB", and the refresh givesrefused. The records follow the block that is really written.M2. A T3 Code thread keeps the rules in its reminder (
apps/hook/hooks/mod/inbox-note-rules.ts,claudeSessionNoteFile). The mod leaves the rules out of the reminder only in a session that is proven to loadrules/plannotator-inbox.md: Claude Code's own prompt, or its VS Code panel (claude-vscode). A T3 thread runs Claude through the Agent SDK, which is not proven to load that file. A T3 thread, Orca's panel and any other host keep the rules in the reminder: twice there, never none.M3. The MCP skip is gone. The MCP instructions always carry the rules again, as on main. The push before this one left them out for Codex and Gemini CLI when the note in the Inbox's environment held them. That could give zero, because the Inbox cannot tell which file a connecting agent reads:
CODEX_HOMEnever reaches the shim. An Inbox that the shim started has noCODEX_HOMEeither.inbox/agents.jsonrecords only the file that the MCP entry is in, as the Inbox found it. It does not tie a connecting process to a home.context.fileName.There is no clean way for the shim to report which file its agent reads, so the skip was removed, not guarded. The
/mcproute is main's line again, byte for byte, andinbox-mcp-note-rules.tsis removed.Tests:
inbox-agent-note-rules.test.ts: rules of 9,001 characters; a file near 1 MiB (add, refresh, removal byte for byte); a grown file with a note that has rules; a file that even today's block would push past 1 MiB.CODEX_HOMEorGEMINI_CLI_HOMEthan the Inbox's gets them in the instructions.Red and green were checked for each new test. Without the writer change, the 4 size tests fail. With the old MCP skip put back, the 2 "note holds" cases and the 2 other-home cases fail. With the mod's session check ignored, the T3 test fails. The
/mcproute test ininbox-prompts.test.tsnow expects Codex and Gemini CLI to get the rules. That file starts an Inbox, so it runs in CI only.No word that a person or agent reads has changed. The note, its lead, the rules, the MCP instructions, the Settings lines and the CLI lines are byte for byte the same. Only developer docs were corrected (
inbox-foundation.md,environment.md).Earlier push (2026-11-28, second), now withdrawn in part
That push left the rules out of the MCP instructions for Codex and Gemini CLI when the note held them. The review found that this could give zero (see M3 above), so this push removes it.
Earlier push (2026-11-28)
The PR was held on 19 Nov until the Inbox had an opt-in gate (#3729). That gate is on main now, so that push brought the PR up to date and put its new behavior behind the gate.
52e35600480d(a plain merge, no rebase): merge commite8246d14fa7b. Main had not changed the note writer (inbox-agent-notes.ts), so the note's bytes and every word that this PR adds stayed the same. There were 6 conflicts, all of them additions on both sides:inbox-command.ts;setupPiInbox(main'sisInboxTurnedOngate is kept, and the rules-aware reminder follows it);e283b499cd04): a note carries the person's rules only after the person has turned the Inbox on (noteRulesConfigininbox-agent-notes.ts). Before that, three things give today's block byte for byte: a note written withplannotator inbox --notes(main runs this before the gate), a refresh, and the window's preview. Cursor's copy has no rules either. A new test runs the add, the refresh and the preview with no turned-on mark, then turns the Inbox on, and the rules then appear once. With the gate removed, the test fails.generated/folder), and the two suites that start an Inbox (inbox-prompts.test.ts,inbox-agent-notes-refresh.test.ts). CI runs them.For #3555
What a person notices
plannotator inbox --notes cursor, includes the rules.What changed
packages/server/inbox-agent-notes.ts). With rules set, the v9 body is followed by a blank line, the reminder's existingINBOX_RULES_LEAD, and the rules, all inside the same markers. No fixed line is new or reworded, and the version is still v9.<!-- plannotator-inbox:or a Gemini/Qwen memory header anywhere (not only at a line start), and rules longer than 9,000 characters.prior_sha256), so a crash between the record write and the note write still repairs itself.refreshInboxNotesafter any rules change, as the Inbox start already does. A refresh that fails cannot fail the save.loadConfigOrNull): the start refresh writes nothing, and an add is refused. A failed read therefore never rewrites notes as if there were no rules.inboxNoteHoldsRulesis copied into the mod, as the other contract helpers are.rules/plannotator-inbox.mdat session start, again at a conversation's first prompt, and at each compaction, when Claude Code reads its memory files again. The compact hook's value follows. The mod does this only in Claude Code's own prompt and its VS Code panel (M2).inboxReminderRulesWatch: one stat, and it reads the file again only when its size, mtime or inode changed).inboxConfigWatch, one stat, read again only when the file changed; the mod:currentRules). A save rewrites the note, so a comparison with the rules from the session's start would send the old rules again. A read that fails keeps the last rules.prompts.rules.unsentlists the agents that miss the rules.note_textsholds per-agent previews (a file that two agents share previews the block it would really get).AgentRules.tsxshows the "Not sent to …" lines. A line never says something false:inboxAgentNotes.askedalso records the files that the automatic add skipped on purpose. The file itself tells those apart (read-only, hard-linked, pasted without markers), and they are still named.PLANNOTATOR_INBOX_NOTES=0, and not for OpenCode with no AGENTS.md).inbox-foundation.mdgets a new bullet.inbox-window.mddescribes the "Not sent to …" lines.environment.mdnames Qwen Code with Codex and Gemini CLI.server-and-storage.md, the settings row and the/api/inbox/agentsrow (note_texts) are updated.Who gets the rules how many times (after this push)
CODEX_HOME/GEMINI_CLI_HOMEtooinitialize)Rules over 9,000 characters (only a hand-edited config.json) fit no channel, as on main: the reminder and the MCP instructions leave text that does not fit out whole, and the note now leaves them out too.
Known limits (documented, no code)
PLANNOTATOR_INBOX_NOTES=0, an unreadable config.json) stay in that agent's file. Settings says nothing about it.<!--, an open code fence, a NUL or a lone surrogate go into the note as they are written. Only the marker strings and the memory headers are kept out.~/.codex/AGENTS.mdand the others). Those files are often in a dotfiles repository and are written through symlinks.initialize. A rules change reaches it at its next session.inboxNoteHoldsRules), or those agents read the rules a third time.Linked machines: rules live in each machine's own config, and nothing crosses machines.
How it was tested
packages/server/inbox-agent-note-rules.test.ts(59 tests, no Inbox started) covers:CODEX_HOME/GEMINI_CLI_HOME, and every client;Other tests:
inbox-prompts.test.tsstarts an Inbox, so it runs in CI. Its route tests check four things:/mcp, Codex and Gemini CLI get the rules even while the note holds them;promptsSettings.test.tsxfor the "Not sent to …" lines. It checks which agents are named, the reason and whether a fix is offered, not the wording.apps/hook/hooks/mod/inbox-note-rules.test.ts: the path, a failed read, the compact hook's value, and a T3 thread against Claude Code's own prompt;apps/pi-extension/inbox-note-rules.test.ts;apps/opencode-plugin/inbox-note-rules.test.ts, including a note that changes between requests.$.env.getliterals (4), OpenCode's note rules (4), the Inbox structure check (5), and the docs size check (3).inbox-agent-icon-still.ts, which this PR does not touch and which is the same file as on main.Clean-room test of the agent-facing text, with a fresh agent and only a Codex-style
AGENTS.mdin a scratch folder: