Skip to content

feat: ship a /planbridge-last skill to annotate the agent's most recent message #182

@blimmer

Description

@blimmer

What's the problem?

One of the highest-leverage uses of PlanBridge in practice is: the agent just produced a wall of text (an architecture explanation, a proposed migration, a draft commit message, a code-review summary, a brainstorming section), and you want to mark it up inline rather than typing prose corrections back into the terminal.

Today this is achievable, but only as an undocumented trick: /planbridge-open the last thing you said (or similar plain-language phrasing) and hope the agent resolves it correctly. That works often enough to be useful, but it depends on:

  1. The user knowing this prompt pattern exists at all (no discoverability — it's not in the autocomplete picker).
  2. The agent interpreting the temporal reference consistently (varies by harness, varies by model version).
  3. The agent copying its prior turn verbatim rather than paraphrasing or summarizing (the default failure mode without explicit instruction).
  4. The agent not emitting a preamble like "Sure, let me open that for you" before invoking the command — because that preamble becomes the new "last thing."

Two of these are fixable in a docs recipe. The other two (discoverability + reliable agent behavior) are not.

Proposed solution

Ship a dedicated /planbridge-last skill in the planbridge@contextbridge plugin, parallel to /planbridge-open. Its job: grab the agent's most recent assistant message and open it in PlanBridge for annotation.

Mechanism. The skill instructs the agent to pipe its prior turn verbatim to contextbridge open via stdin. No new CLI subcommand needed — contextbridge open already accepts piped content. The skill is a thin SKILL.md that tells the agent exactly what to do.

Source location. packages/skills/sources/planbridge-last/SKILL.md. Renders to harnessIntegrations/claude/skills/planbridge-last/SKILL.md and harnessIntegrations/codex/skills/planbridge-last/SKILL.md via bun run skills:generate. Register in packages/skills/src/codex.ts so the CLI embeds it for Codex install. Run bun run skills:check && bun run --cwd packages/cli test CodexInstaller per the standard skill-add flow.

Proposed SKILL.md. Mirrors the structure of planbridge-open (when-to-use / how-to-invoke / what-happens / what-to-do-with-output / limitations) so the two skills feel like siblings:

---
name: planbridge-last
description: Open your most recent assistant message in the PlanBridge browser UI for human annotation. Use when the user wants to annotate or give feedback on the wall of text you just wrote.
---

# Annotate your most recent message in PlanBridge

Opens your most recent assistant message in the PlanBridge browser UI, where the user can leave inline annotations and general comments. Their feedback is returned on stdout.

## When to use

Use this skill when the user wants to mark up something you just said. Typical triggers:

- "Let me annotate that"
- "Open the last thing you said in PlanBridge"
- "I want to mark up what you just wrote"
- You just produced a long block of prose (a spec, a section, a summary, a draft) and the user wants to give targeted feedback rather than type corrections back

## How to invoke

**Do not send any commentary or status message before running the command.** The command targets your most recent rendered message, so a preamble like "Sure, opening that now" can mistakenly become the thing being annotated. Run the command first; speak after.

Pipe your prior message verbatim into `contextbridge open` via stdin. Preserve all markdown formatting and code blocks. Do not paraphrase, summarize, or rewrite — the user wants to annotate the exact text you produced, not a cleaned-up version.

    printf %s "<your prior message, verbatim>" | contextbridge open

{{#if (eq harness.id "codex")}}
{{> codex/sandbox-escalation}}
{{/if}}

Run the command yourself rather than telling the user to invoke shell syntax manually.

## What happens

1. PlanBridge starts a local browser session and prints the URL.
2. The user annotates in the browser. Block on the CLI until they submit.
3. The CLI prints a markdown summary of the user's feedback to stdout.

## What to do with the output

Treat the comments the way you'd treat a colleague's review notes — context for the next step, not a checklist to silently execute.

- If the user left no annotations, acknowledge briefly and continue.
- If the user left annotations, respond conversationally. They may want edits, may want discussion, may be flagging things for later. When in doubt, ask what they want to do next.

## Limitations

Only your most recent assistant message is opened. To annotate a file on disk, an earlier message, or a specific section, use `planbridge-open` instead.

Very long messages (5k+ words) may drift or truncate during verbatim reproduction. For specs and other content of that size, save the content to a file first and use `planbridge-open` against the path.

Note the Codex sandbox-escalation partial inclusion ({{> codex/sandbox-escalation}}) — same pattern planbridge-open uses, so Codex users get the right escalation guidance when the browser launch hits the sandbox.

Naming. /planbridge-last. Short, parallel in length to /planbridge-open, and the most natural mapping from the prompt trick users already reach for ("the last thing you said"). The SKILL.md disambiguates that "last" means the prior assistant message.

Alternatives you considered

Docs recipe under recipes/. The original framing of this issue. Cheap to ship, zero install footprint. Loses on discoverability (invisible in the autocomplete picker) and reliability (every user has to discover their own phrasing, and the verbatim/preamble issues live in the user's prompt rather than in a SKILL.md the agent always reads). Probably still worth doing as a follow-up after the skill ships — the recipe becomes "use /planbridge-last" plus when-to-reach-for-it guidance.

Extend planbridge-open's SKILL.md to handle temporal references. Add a paragraph telling the agent: "If the argument is a temporal reference like 'the last thing you said,' copy your prior turn verbatim." Cheaper, no new install plumbing, no fragmented surface. Rejected because: (1) it overloads a skill whose name and description are anchored to opening files/specs, (2) it adds preamble-suppression logic to a skill that doesn't need it for its primary use case, and (3) it doesn't fix discoverability — users still have to know the prompt trick exists.

CLI-side transcript parsing. A contextbridge last subcommand that reads the harness's transcript file (~/.claude/projects/*.jsonl, Codex's session format, etc.) and extracts the most recent rendered assistant message directly. Most robust — fully decouples from model behavior, no context-window cost for verbatim regeneration, no preamble footgun. Rejected because every harness needs its own adapter and the transcript formats are not stable contracts. The per-harness maintenance tax isn't justified for a single skill. Worth revisiting if reliability turns out to be a problem in practice, or if multiple future skills need transcript access.

Additional context

Known failure modes to test before shipping:

  • Preamble drift. If the agent emits any text before invoking the command, that text becomes "the last message." The "do not send commentary first" instruction has to be unambiguous in SKILL.md, and we should test that both harnesses honor it across model versions.
  • Verbatim reproduction ceiling. For very long messages, the agent may drift, truncate, or "helpfully" reformat during stdin generation. The docs-recipe approach has the same ceiling. Worth measuring before publishing a recommended message-length limit.
  • Hidden-state divergence. The agent's prior message ≠ what was rendered to the user when tool calls, thinking blocks, or other non-rendered content sit between the user's last input and the agent's prose. Rare for the prose-annotation use case but worth flagging in the skill's Limitations section.
  • Silent degradation tied to model behavior. If future models regress on verbatim reproduction, this skill quietly gets less reliable. The CLI-side parsing alternative doesn't have this property — it's a real cost of the lighter approach.

Related work:

Follow-up after the skill ships:

  • Recipe page under recipes/ showing concrete prompts where /planbridge-last shines (long agent prose, brainstorming sections, draft commit messages, code-review summaries).
  • Mention in usage/open.mdx as the sibling skill.
  • Entry in llms.txt so LLM/crawler consumers see it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions