All pages

Lesson 4.1 · Automate · 8 min

Saved prompts

Reusable prompts with variables, sent to the agent, the queue or a pane.

Listen

After this lesson you can save the prompts and commands you type over and over, fill them in with variables, and fire them from a click, a keystroke or a typed keyword.

Time: 8 minutes · Works on: macOS app. The cloud workspace stores prompts too, through the list_prompts and save_prompt tools.

Save your first prompt

  1. Show the right sidebar with ⌘⇧\ and click Prompts.
  2. Click +.
  3. Fill in the sheet:
    • Prompt name: "Show recent commits".
    • Trigger: glog. A trigger is a keyword that expands when you type it in a terminal followed by a space.
    • Text: git log --oneline -15.
    • Tags: git. Tags become filter chips at the top of the list.
    • Scope: leave it on Global (all projects), or pick a project so the prompt only shows there.
  4. Click Add.

Run it four ways

  1. Click the row. The text is pasted into the focused pane without pressing Return, so you can edit it first.
  2. Click the play button. The text is pasted and Return is pressed.
  3. Press ⌘P in a terminal. Your saved prompts pop up as a menu at the cursor. Pick one to paste and run it. Hold ⌥ while picking to paste without running.
  4. Type the trigger. In any pane, type glog and a space. The keyword is replaced by the prompt's text, and a short message shows what was inserted.

Right-click a row for the rest: Run in Terminal (Return), Queue for Terminal, Paste into Terminal, Send to Agent, Run with Variables…, Assign Shortcut… and Rename….

Send to Agent is how a saved prompt becomes an agent request. Save "Review the uncommitted diff and list anything risky" and send it to the agent whenever you finish a change.

Add variables

A prompt's text can include {{variables}} that are filled in when you run it.

Built-in variables come from the focused pane:

Variable Becomes
{{cwd}} or {{pwd}} The pane's working directory
{{branch}} The current git branch
{{selection}} The text selected in the terminal
{{visible}} What's visible in the terminal
{{title}} The tab's title
{{clipboard}} The clipboard's text
{{date}}, {{time}}, {{datetime}} Now
{{home}}, {{user}} Your home folder and user name

Any other name in braces is a custom variable. Try it:

  1. Make a new prompt named "Open a PR" with the text gh pr create --base {{base}} --title "{{title_text}}".
  2. Click it. Because it has custom variables, a run sheet opens first.
  3. The sheet shows a field for each variable and a Preview of the finished text. Fill in main and a title.
  4. Pick how to run it. The sheet offers every option, with the one you started from as the default for Return.

Values you've used before appear as chips under each field. Auto-fill asks your current agent model to suggest values from what's in the terminal. It only fills fields you left empty.

If a built-in variable has no value, such as {{selection}} with nothing selected, it stays as literal text so you notice. The sheet tells you which one and why.

Keep prompts in files

You can keep prompts in a folder, under version control, and share them with your team.

  1. Click the gear in the Prompts header.
  2. Under Watched folder, click Choose folder… and pick a folder.
  3. Every .md, .txt or .prompt file in it appears as a read-only prompt. The file name becomes the prompt's name. A first line of #trigger: foo sets its trigger.

TRMNLY reloads the folder when its files change.

The same gear menu has Import pack… and Export pack… for .trmnlypack files, to back up your prompts or move them to another Mac. Browse packs… opens a library of bundled prompt packs. Subscribe to one and its prompts appear read-only under their own heading. The TRMNLY pack holds prompts that put TRMNLY's own tools to work. It needs a hosted model, because a local model gets only a small set of tools.

Check yourself

  • Typing glog and a space in a pane expands to the full command.
  • ⌘P shows your prompts at the cursor.
  • A prompt with a custom variable opens the run sheet and shows the preview.
  • Your most-run prompts start to appear in the Most used section.

Go further