Registry Mirror
Skip to content

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

Part 2 of the approved "inbox-agent-awareness" work (approval decisions 4 and 8). Part 1 (auto-add, uninstall, CLI) and part 3 (global note, Settings → Agents, install prompt) are separate PRs.

What changes

inboxReminder (config.json; a boolean for every host or one per host, e.g. { "inboxReminder": { "claude-code": false } }). On by default wherever the session has plannotator_inbox, never without it. No env var of its own: PLANNOTATOR_INBOX_TOOL / inboxTool gate it through the tool.

  • resolveInboxReminder(config, env, host) = resolveInboxTool(...) && (configuredInboxReminder(config, host) ?? true) in packages/shared/config.ts.
  • The mod's mirror resolveInboxReminderEnabled (apps/hook/hooks/mod/enabled.ts), kept equal by enabled.test.ts over every combination.

The line (INBOX_REMINDER_TEXT, connection contract, copied into the mod): "Plannotator Inbox is on: when you finish long work, or need a decision the person isn't here to give, send it with plannotator_inbox send_message and keep going. Their reply comes back here."

Host Where Once / cache
Claude Code mod prompt.context block plannotatorInbox once per conversation, after the system prompt and tools, never invalidated
Pi hidden before_agent_start message, customType: "plannotator-inbox-reminder" first prompt of the session; not again after /reload / /resume (the branch is read); again only after a compaction that summarized it away; never systemPrompt
OpenCode 2 context hook, composed into the system part every request that offers plannotator_inbox (primary agents, not title requests), same bytes each time
OpenCode 1 experimental.chat.system.transform every request, same bytes

The Pi "Ask this session" bridge ignores the reminder's customType (it can ride the run answering a question).

Claude Code gets plannotator_inbox before the Inbox ever ran (decision 8). discoverInboxTools falls back to a bundled list (apps/hook/hooks/mod/inbox-default-tools.ts), generated from a real Inbox's /mcp tools/list by bun run scripts/sync-mod-inbox-tools.ts and pinned by inbox-default-tools.test.ts, which fails when an Inbox MCP tool changes without a re-sync. Until inbox/inbox.json exists, the link sends no HTTP request and writes no file (no lease, no claims folder). The first call starts the Inbox with plannotator inbox --background (no tab), and the wake polls from then on. PLANNOTATOR_INBOX_TOOL=0 / inboxTool: false still means no tool and no reminder.

Deviations from the approval record

  • OpenCode 1 has no wake, so it gets INBOX_REMINDER_TEXT_NO_WAKE ("… Call wait_for_reply when you need their answer.") instead of "Their reply comes back here." DESIGN §3 requires the texts to stay truthful per host.
  • OpenCode 1 has no subagent check. That check would need a session-messages request on every call. OpenCode 2 has the check (kind primary).
  • The long-turn trigger (HOOKS.md ranked idea 1) is not built. The approval asks only for the session-start line.

Tests

  • apps/hook/hooks/mod/enabled.test.ts: the reminder mirror against the shared resolver.
  • apps/hook/hooks/mod/inbox-default-tools.test.ts: the bundled list equals a real Inbox's tools/list.
  • apps/hook/hooks/mod/inbox.test.ts (real Inbox, real processes): proof 01 is now "no registry: the tool from the bundled list, 0 HTTP requests and no files in 2.5 s, the first call starts the Inbox and lands its message, and the wake polls after".
  • apps/hook/tests/register.test.ts (engine harness, scripts/test-claude-code-mod.sh, 28/28 on Claude Code 2.1.296): the tool is registered with no registry and nothing is asked or written; the first call runs plannotator inbox --background; the reminder block appears once and is identical across calls; no block with inboxReminder off or PLANNOTATOR_INBOX_TOOL=0.
  • apps/pi-extension/inbox.test.ts (real Pi 0.84.4 in RPC mode):
    • one reminder on the first prompt, none without the tool;
    • the second request keeps the first one's messages as its exact prefix, and the reminder is not in the system prompt;
    • the same session reopened adds none;
    • inboxReminder.pi: false sends none.
    • Plus entriesCarryReminder cases.
  • apps/pi-extension/pi-session-bridge.test.ts: the reminder in the answering run is not a take-over.
  • apps/opencode-plugin/inbox-reminder.test.ts, inbox.test.ts (OpenCode 1 entry), inbox-v2.test.ts: the line appears once with identical bytes on the next request. The inbox-v2.test.ts assertion runs only in CI, where opencode2 is installed.
  • tests/never-touch-the-real-inbox.test.ts, tests/package-bunfig.test.ts, bun run typecheck all pass.

Not run locally: the Pi 0.79.1 floor job (PI_TEST_OLD_CLI). Pi on 0.84.4 accumulates before_agent_start messages from several handlers, so the reminder sits beside the plan framing.

…tool before the first run

- inboxReminder (config.json, a boolean or one per host; on by default
  wherever the session has plannotator_inbox): resolveInboxReminder /
  configuredInboxReminder in packages/shared/config.ts, mirrored by the
  mod's resolveInboxReminderEnabled. No env var of its own: the tool
  switch gates it.
- INBOX_REMINDER_TEXT (and INBOX_REMINDER_TEXT_NO_WAKE for OpenCode 1) in
  the connection contract.
- Claude Code mod: a prompt.context block (plannotatorInbox) once per
  conversation, only with the tool and the switch on.
- Claude Code mod: plannotator_inbox is registered before the Inbox ever
  ran, from a bundled tool list (inbox-default-tools.ts, generated by
  scripts/sync-mod-inbox-tools.ts and pinned to a real Inbox's /mcp). The
  link stays silent (no HTTP, no files) until a call starts the Inbox.
- Pi: a hidden before_agent_start message (plannotator-inbox-reminder) on
  the session's first prompt, not repeated after /reload or /resume,
  re-delivered only after a compaction that summarized it away; the
  Ask-this-session bridge never reads it as a take-over.
- OpenCode 2: a composed system line on requests that offer the tool
  (primary agents, not title requests); OpenCode 1: the no-wake line in
  experimental.chat.system.transform.
…e lazy tool transform

registerInboxOpenCode2 reports whether the host's tool draft took the tool,
but OpenCode 2 applies a tool transform per request, so at plugin setup the
answer is still false and the context hook was never registered. Gate on the
connection being found; addInboxReminder already checks each request's own
tool list, so the line still never names a tool the agent lacks. Proved on
the real opencode2 2.0.19 (inbox-v2.test.ts, 5/5).
- The reminder speaks only for an Inbox that has run here: the Claude Code
  mod still registers plannotator_inbox before the first run (bundled list),
  but adds the prompt.context block only when inbox/inbox.json existed at
  the first session.start. Pi and OpenCode already need the registry for
  the tool.
- Claude Code names the tool by the full name $.tool.register returned
  (inboxReminderText), so tool search finds the deferred tool. Fixed per
  process.
- OpenCode 2 without session.prompt (tool registered wakes:false) gets the
  wait_for_reply wording (openCode2InboxReminder).
- OpenCode 1: the line is its own system part (never merged into the
  host's parts), and only for an agent that has the tool: not a subagent,
  not an agent whose tools switch plannotator_inbox off (wildcards too).
- Docs: no "Settings writes inboxReminder" claim yet; OpenCode's line is on
  every request; Claude Code's tool needs no first run.
- Tests: engine harness for no registry (tool, no reminder), -p (none), a
  refused tool.register (none), the full name; OpenCode 1 agent gating and
  part layout; OpenCode 2 no-wake wording.
@backnotprop

Copy link
Copy Markdown
Owner Author

Review fixes, merged with main (#1885 and #1891 included). No force-push.

  • fb8912494 OpenCode 1:
    • The reminder line now goes at the end of the LAST system part. The text before it stays byte for byte and the part count never changes (Fix OpenCode plugin Jinja template corruption with Qwen3.6 #1114). With 1.18's single part it stays one part.
    • An agent lookup that fails reuses the session's last answer (no answer yet: no line), so the prompt cannot flip between requests. getOpenCodeAgents answering nothing counts as a failed lookup.
    • The test now sends a one-part system prompt as 1.18 does. It also covers several parts and the failed-lookup cases.
  • 8c1d8cb46 OpenCode 2 Inbox wake: keep the event subscription when the tool transform is lazy #1891 follow-up:
    • registerInboxOpenCode2 takes an optional { signal } that ends the wakes (their event subscription and lease timers).
    • The event-driven test stops its wake afterwards.
    • A new test covers the draft without add: nothing is registered and the wakes stop at once.

Local runs: apps/opencode-plugin 373 tests (0 fail, 3 skip). Typecheck is clean.

@backnotprop
backnotprop merged commit a74742f into main Oct 13, 2026
32 checks passed
@backnotprop
backnotprop deleted the feat/inbox-session-reminder branch October 13, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant