Skip to content

feat(annotate): approve/reject flow for spec-driven development frameworks #570

Closed

Description

@punk-dev-robot

Context

Spec-driven development frameworks (spec-kit, kiro, openspec, etc.) are replacing traditional plan mode in AI coding workflows. Instead of a single plan file, these frameworks generate multiple markdown artifacts (spec.md, plan.md, tasks.md, research.md, data-model.md) that go through iterative review cycles.

Plannotator's annotation UI is a perfect fit for reviewing these artifacts — inline, targeted feedback on markdown is exactly what's needed. I've built integrations for both Claude Code (PostToolUse hook) and OpenCode (event plugin) that trigger plannotator annotate whenever a spec artifact is written.

The value proposition is significant: every spec-driven framework generates multiple markdown files per feature, each needing human review. Plannotator could be the universal review layer across all of them.

Problem

plannotator annotate currently has no approve/accept exit path. The UI shows Close and Annotate buttons, but no Approve.

This creates three issues:

  1. No "looks good" signal: Closing without feedback returns "Annotation session closed without feedback" on stdout. There's no way to distinguish "I reviewed this and it's fine" from "I dismissed this without looking."

  2. Claude Code hook breaks: The Claude Code hook (source) runs as a blocking PostToolUse hook. Any stdout from plannotator triggers a block — including the "closed without feedback" message. This means every spec file write gets blocked with no way to approve.

  3. OpenCode plugin works around it, but incompletely: The OpenCode plugin (source) runs async and sends annotations back as a session prompt. Empty stdout = no action, which is better. But "closed without feedback" still produces stdout, and there's still no explicit approve signal.

Proposed Solution

Add an Approve (or Accept) button to the annotation UI for plannotator annotate:

  • Approve: exits with code 0 and empty stdout (or a structured {"decision": "approved"} if downstream hooks want to distinguish approved from dismissed)
  • Annotate: existing behavior — exits with annotations on stdout
  • Close/Dismiss: exits with code 0 and empty stdout (current behavior for no annotations, but currently outputs the "closed without feedback" message)

Optionally:

  • A --gate or --review-mode flag that explicitly enables the 3-button (Approve/Annotate/Dismiss) UX for hook integrations
  • Structured JSON output mode (--json) so hooks can parse the decision cleanly

Why This Matters Beyond Plan Mode

Plannotator currently shines for plan review. But spec-driven development is where the volume is:

  • A single feature generates 4-6 markdown files (spec, plan, tasks, research, data-model, quickstart)
  • Each goes through clarify → review → approve cycles
  • Multiple frameworks exist (spec-kit, kiro, openspec) with the same pattern
  • All of them need a human-in-the-loop review step for markdown artifacts

A working approve/reject flow for plannotator annotate would make plannotator the universal review tool for all of these frameworks.

Related Issues

Environment

  • plannotator binary: ~/.local/bin/plannotator (installed ~April 14, 2026)
  • Claude Code: PostToolUse Python hook
  • OpenCode: Bun event plugin
  • OS: macOS Darwin 25.4.0

Activity

  1. backnotprop commented on Apr 15, 2026

    @backnotprop
    Owner

    Great details provided. Thank you.

  2. backnotprop commented on Apr 15, 2026

    @backnotprop
    Owner

    I will prioritize this soon, possibly tonight or the next day, unless somebody else wants to take it on.

  3. punk-dev-robot commented on Apr 16, 2026

    @punk-dev-robot
    ContributorAuthor

    if you leave some pointers i could give it a try this weekend

  4. leoreisdias commented on Apr 17, 2026

    @leoreisdias
    Contributor

    Man, this would be huge! Totally amazing idea. I have been testing a lot of SDD tools from GSD to BMAD, and the idea of having a tool like Plannotator in the middle is really cool.

    Let me know if I could help with something!

  5. backnotprop commented on Apr 18, 2026

    @backnotprop
    Owner

    Man, this would be huge! Totally amazing idea. I have been testing a lot of SDD tools from GSD to BMAD, and the idea of having a tool like Plannotator in the middle is really cool.

    Let me know if I could help with something!

    If you have a specific idea of what would work best with you - that would be great.

  6. backnotprop commented on Apr 18, 2026

    @backnotprop
    Owner

    I'm around all weekend at a sf hackathon putting a bow on plannotator real time collab rooms.

    Happy to meet with others to discuss this feature direction

  7. backnotprop commented on Apr 23, 2026

    @backnotprop
    Owner

    Hey @punk-dev-robot and @leoreisdias, I'm developing this now. We'll cut a release tonight. Please review these flags:

    • --gate: enables the three-way UX (Approve / Annotate / Close) in the UI.
    • --json: emits structured {"decision":"...","feedback":"..."} stdout for explicit hook routing.

    Stdout matrix:

         Flags      │        UX        │         Approve         │          Close           │                 Annotate
    ─────────────── ┼──────────────────┼─────────────────────────┼──────────────────────────┼───────────────────────────────────────────────
     (none)         │  2-button        │  n/a                    │  empty                   │  feedback (plaintext)
     --gate         │  3-button        │  empty                  │  empty                   │  feedback (plaintext)
     --json         │  2-button        │  n/a                    │  {"decision":"dismissed"}│  {"decision":"annotated","feedback":"..."}
     --gate --json  │  3-button        │  {"decision":"approved"}│  {"decision":"dismissed"}│  {"decision":"annotated","feedback":"..."}
    

    Key property for your spec-kit hook: in --gate mode without --json, Approve and Close are both empty stdout, so your existing PostToolUse block-on-any-stdout hook works unchanged. Only Annotate blocks. Add --json if you want explicit approved-vs-dismissed routing.

    Also shipping: the "Annotation session closed without feedback." stdout leak gets dropped unconditionally.

    Parity across Claude Code, OpenCode, and Pi: same --gate semantics regardless of harness. For annotate-last there's a companion recipe that uses the same flag on a Stop hook (turn-by-turn review gate).

    Draft PR: #606

    Would love your eyes on the flag names and the matrix before I lock them in.

  8. 5 remaining items

  9. leoreisdias commented on Apr 24, 2026

    @leoreisdias
    Contributor

    @backnotprop you nailed it!

  10. backnotprop commented on Apr 24, 2026

    @backnotprop
    Owner

    Follow-up: --hook replaces --silent-approve

    After shipping #606, we reviewed the Claude Code hook docs and Codex hook docs and discovered that --silent-approve doesn't work with either hook system:

    • Claude Code PostToolUse: plain text stdout is added to transcript as context — it doesn't block. Only {"decision":"block","reason":"..."} actually blocks.
    • Codex PostToolUse: plain text stdout is ignored entirely. Only JSON responses are processed.
    • Claude Code Stop: plain text stdout goes to debug log only. Only {"decision":"block","reason":"..."} prevents stopping.

    So the "naive hooks that treat any stdout as a block signal" pattern doesn't exist in either system. Our --json format ({"decision":"approved"}) also isn't recognized — the hook protocol only understands decision: "block".

    The fix (PR #610): --hook replaces --silent-approve and emits hook-native JSON directly:

    plannotator annotate "$FILE" --hook
    
    Decision Output
    Approve empty stdout (hook passes)
    Close empty stdout (hook passes)
    Annotate {"decision":"block","reason":"<feedback>"} (hook blocks)

    --hook implies --gate (three-button UX). Works with both Claude Code and Codex hooks without a wrapper script. --gate and --json remain unchanged for slash command and wrapper script use cases.

  11. added a commit that references this issue on Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions