Skip to content

Chat: insert from chat (explicit save + Go-model tool) #51

Description

@mikkisguy

Parent

Chat Interface — Design Spec (docs/superpowers/specs/2026-06-19-chat-interface-design.md)

What to build

Let the user save content from chat into ShadowBrain, two ways:

  • Explicit "Save to ShadowBrain" action on any user or assistant message →
    opens a type picker, writes via the existing POST /api/items. Works for
    both targets.
  • Model-driven save_to_shadowbrain tool (Vercel AI SDK) — active only
    when the target is an OpenCode Go model and the thread has
    allow_model_save enabled. The AI SDK executes it locally in our process;
    it writes via the items helper (direct DB write, not an HTTP self-call) and
    returns the new item id.

Surface inline confirmation ("Saved as note #123"). The tool is not active for
the Hermes target in v1 — Hermes-side grounding/insert is via the explicit
action (or future MCP; see spec §Open Questions).

Acceptance criteria

  • "Save to ShadowBrain" action on user & assistant messages with a type picker → creates a content_item
  • save_to_shadowbrain({ type, content, title?, tags? }) tool executes locally for Go-model targets and returns the new item id
  • tool registered only when target.provider === 'opencode-go' and allow_model_save is true
  • allow_model_save toggle persisted on the thread
  • saved items appear in browse/search (they enter content_items + FTS like any item)
  • inline confirmation shown after a save (tool or button)
  • tool failure → error returned to the model; button failure → inline message, input preserved
  • tests: insert via tool (mocked Go model) and via explicit button

Blocked by

References

  • docs/superpowers/specs/2026-06-19-chat-interface-design.md — §Components (Insert: save_to_shadowbrain), §Non-Goals, §Open Questions

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions