Haruno Knowledge base

Optimizing a prompt

Type one sentence in a prompt field, press AI Optimize, and Haruno rewrites it as a complete prompt. Undo brings your own text back.

  • Mac appAvailableOn the Mac it is in the Playbook editor and the scheduled task sheet.
  • Windows appAvailable

Some fields hold instructions that Haruno will carry out later, with nobody at the keyboard. A short note is often not enough for that. AI Optimize turns one sentence into a full prompt: the goal, the context, the steps and the result you expect.

It is not in the chat message box. It is in the editors for things that run on their own.

Where you find it

The AI Optimize button sits at the end of the label row above these fields:

EditorField
Playbooks (Playbooks ▸ Manage Playbooks…)Instructions
A scheduled taskPrompt
A hook ruleMessage template
A hook ruleInstruction (system prompt)
The Prompt field of a scheduled task, with AI Optimize at the top right.
A scheduled task's Prompt field holding one sentence, with an AI Optimize button at the end of its label row.A scheduled task's Prompt field holding one sentence, with an AI Optimize button at the end of its label row.

How to use it

  1. Write one sentence

    Describe what you want in the field, for example: "Summarize this week's changes in the project folder as a short report."

  2. Press AI Optimize

    The button says "Optimizing…" while Haruno works. You can keep editing meanwhile, but if you change the text before the answer arrives, the answer is dropped and your edit stays.

  3. Read the result

    The rewrite replaces the text in the field. Haruno writes it in the same language as your text.

  4. Keep it or undo it

    Undo appears after a rewrite. It puts back your exact earlier text. It goes away once you use it or edit the new text.

The button is switched off when the field is empty, read-only, or while the editor is saving. Leaving the editor cancels a request that is still running.

What it protects

Some text in these fields must survive the rewrite unchanged, or it would break what runs later.

  • Placeholders are names in curly braces, such as {from}. Every one in your text must still be there, unchanged. In a hook's Message template the rewrite may not add any new text in curly braces at all.
  • A Playbook's argument slots, such as $ARGUMENTS, $0 or the argument names the Playbook declares, must all be kept. The rewrite may not invent new ones.
  • Shell commands in a Playbook, written as an exclamation mark before a command in backticks, must come back exactly as they were. Haruno is told never to write a new one.

If the rewrite breaks one of these rules, Haruno does not use it and your text stays.

When it fails

Your text is always kept, and a message appears under the label.

The messageWhy
"Sign in to Haruno to use AI Optimize."You are not signed in.
"The text is too long to optimize. Shorten it and try again."The text is over 8,000 characters.
"The rewrite changed the placeholders, so your text was kept. Try again."A placeholder or argument slot was lost or added.
"The rewrite changed the shell commands, so your text was kept. Try again."A command in a Playbook was changed.
"Couldn't optimize the text. Your text was kept. Try again."Anything else, including a request that took too long.
The text is sent to Haruno's service

To rewrite a prompt, Haruno sends the text in that field to its service. For a Playbook it also sends the names of the Playbook's arguments. Nothing else from the chat or the project is sent for this.

Last updated · PR #2944 · View this version on GitHub

History (1 version)
  1. Internal knowledge base for staff: site, reader keys, assistant, 197 pages and the PR rule (#2944)
    What changed
    @@ -0,0 +1,72 @@
    +---
    +title: Optimizing a prompt
    +summary: Type one sentence in a prompt field, press AI Optimize, and Haruno rewrites it as a complete prompt. Undo brings your own text back.
    +feature: prompt-optimize
    +covers:
    +  - windows-client/docs/prompt-optimize.md
    +  - windows-client/haruno-webview/web/src/components/PromptOptimizeButton.tsx
    +  - windows-client/haruno-webview/web/src/components/PromptOptimizerContext.tsx
    +  - windows-client/Haruno.Desktop.Services/Chat/PromptOptimizer.cs
    +---
    +
    +Some fields hold instructions that Haruno will carry out later, with nobody at the keyboard. A short note is often not enough for that. **AI Optimize** turns one sentence into a full prompt: the goal, the context, the steps and the result you expect.
    +
    +It is not in the chat message box. It is in the editors for things that run on their own.
    +
    +## Where you find it
    +
    +The **AI Optimize** button sits at the end of the label row above these fields:
    +
    +| Editor | Field |
    +|---|---|
    +| Playbooks (**Playbooks ▸ Manage Playbooks…**) | **Instructions** |
    +| A scheduled task | **Prompt** |
    +| A hook rule | **Message template** |
    +| A hook rule | **Instruction (system prompt)** |
    +
    +<Shot src="/m/173cd4d180be-windows-chat-optimize-light.png" dark="/m/8f08daf37526-windows-chat-optimize-dark.png" alt="A scheduled task's Prompt field holding one sentence, with an AI Optimize button at the end of its label row." caption="The Prompt field of a scheduled task, with AI Optimize at the top right." />
    +
    +## How to use it
    +
    +<Steps>
    +<Step title="Write one sentence">
    +Describe what you want in the field, for example: "Summarize this week's changes in the project folder as a short report."
    +</Step>
    +<Step title="Press AI Optimize">
    +The button says "Optimizing…" while Haruno works. You can keep editing meanwhile, but if you change the text before the answer arrives, the answer is dropped and your edit stays.
    +</Step>
    +<Step title="Read the result">
    +The rewrite replaces the text in the field. Haruno writes it in the same language as your text.
    +</Step>
    +<Step title="Keep it or undo it">
    +**Undo** appears after a rewrite. It puts back your exact earlier text. It goes away once you use it or edit the new text.
    +</Step>
    +</Steps>
    +
    +The button is switched off when the field is empty, read-only, or while the editor is saving. Leaving the editor cancels a request that is still running.
    +
    +## What it protects
    +
    +Some text in these fields must survive the rewrite unchanged, or it would break what runs later.
    +
    +- **Placeholders** are names in curly braces, such as `{from}`. Every one in your text must still be there, unchanged. In a hook's **Message template** the rewrite may not add any new text in curly braces at all.
    +- **A Playbook's argument slots**, such as `$ARGUMENTS`, `$0` or the argument names the Playbook declares, must all be kept. The rewrite may not invent new ones.
    +- **Shell commands in a Playbook**, written as an exclamation mark before a command in backticks, must come back exactly as they were. Haruno is told never to write a new one.
    +
    +If the rewrite breaks one of these rules, Haruno does not use it and your text stays.
    +
    +## When it fails
    +
    +Your text is always kept, and a message appears under the label.
    +
    +| The message | Why |
    +|---|---|
    +| "Sign in to Haruno to use AI Optimize." | You are not signed in. |
    +| "The text is too long to optimize. Shorten it and try again." | The text is over 8,000 characters. |
    +| "The rewrite changed the placeholders, so your text was kept. Try again." | A placeholder or argument slot was lost or added. |
    +| "The rewrite changed the shell commands, so your text was kept. Try again." | A command in a Playbook was changed. |
    +| "Couldn't optimize the text. Your text was kept. Try again." | Anything else, including a request that took too long. |
    +
    +<Callout variant="info" title="The text is sent to Haruno's service">
    +To rewrite a prompt, Haruno sends the text in that field to its service. For a Playbook it also sends the names of the Playbook's arguments. Nothing else from the chat or the project is sent for this.
    +</Callout>