Skip to content

feat(mac): ask follow-ups on the answer card - #2

Open
innbuld wants to merge 2 commits into
mainfrom
feat/llm-follow-up
Open

innbuld wants to merge 2 commits into
mainfrom
feat/llm-follow-up

Conversation

@innbuld

@innbuld innbuld commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

What

Once LLM mode answers, you can keep the conversation going from the card. Under each answer there is now an Ask a follow-up… field with an ASK button. Type a question about the answer, or a request like "shorter", "explain step 2" or "in French", and press Enter. The card shows THINKING with your follow-up, then the new answer, and you can keep going.

How

  • LLM.swift
    • Question gets a .followUp(String) case.
    • A new Turn (question + answer) holds the conversation.
    • Asker.ask(_:after:config:done:) sends the earlier turns with the new question.
      • API key: they go as alternating user/assistant messages.
      • claude CLI: its stream-json input only takes user messages, so the earlier answers are written into that one message, each after the question it answered.
    • The system prompt tells Claude that follow-ups may come.
  • AnswerPanel.swift
    • Adds the reply field and ASK button. Both show under an answer or an error and are hidden while thinking.
    • The card's countdown is held while the field has focus or text.
    • Esc in the field still closes the card.
    • Cmd+X/C/V/A are wired up on the card, because the app has no Edit menu (this also makes Cmd+C work on selected answer text).
  • main.swift
    • Keeps the conversation for the card that is up.
    • A new copy or screenshot starts a fresh conversation, and closing the card (or the cat leaving) forgets it.
    • Follow-ups are user-initiated, so they go even while paused, like Ask about what I copied now.
  • READMEs document the feature.

The card stays until you close it

  • The llmAnswerSeconds countdown (120 s) and its setting are removed, so the card closes only with ✕ or Esc. An old settings file that still has the key is fine: unknown keys are ignored.
  • The screen going off or the Mac locking no longer sends the cat and card home while an answer is up. Coming back does not schedule a visit on top of it.
  • A display change (plugging or unplugging a monitor) still sends the cat home, because its stage may no longer exist.

The card is still a non-activating panel. It takes the keyboard only when you click into the field, and your app stays in front.

Testing

  • swiftc -typecheck on all sources: no errors or warnings.
  • Re-ran the typecheck and the offscreen render after removing the countdown.
  • Rendered the card offscreen in the thinking, answer, follow-up-thinking and error states to check the layout.
  • End to end through Asker with a real Claude call:
    • Asked "What is 17 * 23?" and got 391.
    • Then asked the follow-up "Now divide that by 3", sent with the history, and got 130.333…, so the context carries over.

Under each answer the card now has an "Ask a follow-up…" field with an
ASK button. Enter sends the follow-up to Claude with the conversation so
far (the first copy or screenshot included), and the reply replaces the
answer on the same card, so you can keep asking.

- Question gains a .followUp case; Asker takes the earlier turns. With an
  API key they go as alternating messages; the claude CLI takes only user
  messages, so earlier answers are written into the one message.
- The card holds its countdown while you type, Esc still closes it, and
  Cmd+X/C/V/A work in it (the app has no Edit menu).
- A new copy or screenshot starts a fresh conversation; closing the card
  forgets it.
The card no longer closes on its own. The llmAnswerSeconds countdown is
gone (and with it the setting), so only ✕ or Esc closes it. The screen
going off or the Mac locking no longer sends the cat and card home while
an answer is up, and coming back does not schedule a visit over it.
/// the answer and the follow-up field.
override func performKeyEquivalent(with event: NSEvent) -> Bool {
let actions: [String: Selector] = [
"x": #selector(NSText.cut(_:)), "c": #selector(NSText.copy(_:)),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cmd+X or Cmd+C on text in the follow-up field puts that text on the clipboard. The copy watcher only skips text found in lastAnswer (main.swift:194), so with "Answer what I copy" on, the pet answers the draft follow-up as a new question and wipes the conversation. Mark these copies as ours: set onCopy / ownChange after a cut or copy from the card, or have isOwnText also skip text that came from the field.

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.

2 participants