How tricks work
Where a trick can show on your phone, what kinds of trick there are, and how to make, share and trust one.
What it is
What a trick is
A trick adds its own parts to ColliePWA on your phone: a count, a question, or a whole screen.
ColliePWA is a web app for your phone. It lets you watch and answer the AI coding agents that run in the terminals of your computer. A trick extends Collie.
A trick is a folder on your computer: a small program, or rules for an agent. What it shows on the phone is drawn by Collie, in Collie's own look.
Tricks need no cloud service. The phone talks only to the bridge, Collie's own program on your machine, over your private network. Every yes on this page is a tap of yours.
The places
Where a trick can show
A trick can show in seven places on the phone, and nowhere else.
On the Dashboard, a trick can put a tile at the top, an item in the bottom bar, and a row that opens a page of its own. In an agent session, it can put a chip in the status line, a mark at the end of the Belt, or rows in the session's settings, or it can draw a whole view of that session.
A trick can also post a question on the Hill, the page of questions that wait for your tap. The Hill comes with ColliePWA and is an experiment of its own.
Collie owns every place. A trick says where it wants to show, and Collie draws it there. A tap on a tile, an item or a chip opens the trick's page.
One trick, in four places
The kinds
Two kinds of trick
A trick is a program that prints parts, or rules for an agent that draws a screen.
A program trick is a small program on your machine. Collie runs it on a timer, or when you tap. It prints what to show, and Collie draws it.
An agent view is a set of rules for the agent of one session. The agent answers you by drawing one screen in that session.
Both draw with the same short list of parts: a row, a number, a chip, a button, and a few more. A trick sends data, never code. So every screen still looks and acts like Collie.
Example 1
Example: a simple trick
A trick prints data. The phone draws it with Collie's own parts.
Disk space is a whole trick in two short files. Every five minutes it checks how much room is left in your home folder. It shows the answer as a tile on the Dashboard and as a chip in each session.
One run is short. Collie starts the program, the program prints a few lines of data and stops, and Collie checks the data against its list of parts. Then the phone draws the tile and the chip. No code from the trick reaches the phone.
A trick runs on a timer only while a phone is looking. Bigger tricks work the same way: one lists your open pull requests, another the builds that run in your sessions now.
Example 2
Example: a trick that asks
A trick can ask you a question, and your answer goes back to its program.
Release Gates watches the checks before a release. When one check is red, it asks you on the Hill: "Tag the release with the e2e gate red?" It recommends an answer and says why. Nothing is chosen for you.
You tap "Rerun e2e first". Collie closes the question and runs the trick once more, with your answer. The trick starts the rerun, and the card shows that it took your answer.
A trick asks. It never answers for you, and it cannot press a key or type into a session in your name.
Example 3
Example: Morph, your agent draws the screen
Morph lets the session's own agent answer you with one screen instead of a wall of text.
Morph is an agent view: a trick with rules and no program. You switch it on for one session. Then you ask in plain words, for example "Which tests broke after the rename?"
The agent of that session answers by drawing one screen: the two failing tests, the line that changed, and two buttons. Collie checks the screen and draws it under its own band, which names the trick and who drew it.
You tap "Fix both". The agent gets one short line with the words of that button, and nothing else. The view shows you the exact line it sent.
Trust
Who is trusted with what
A trick runs as you. Your tap is the only yes.
A trick's program runs on your machine, as you, with your files. Collie cannot fence it in. So Collie checks everything the trick hands back, keeps every yes for you, and tells you what it found in the code. A trick is off until you switch it on, and each new version asks you again. An agent cannot switch a trick on.
Collie holds no model key and calls no model. The thinking comes from the agent you already run, on your own plan or your own key. A program trick often needs no model at all.
An agent learns the rules of a view from a plain text file in the trick's folder. You can read that file, whole, on the trick's details page before you switch the trick on. A new version with changed rules asks you again.
Make it
Make your own
Four commands, and your agent can write one with you.
collie trick init disk-space collie trick dev disk-space collie trick check ~/.config/collie/tricks/disk-space collie trick on disk-space
init makes the folder with a starter program. dev runs it once and prints what the phone would draw. check searches the code for six risky things. on is your yes, and it refuses to run for an agent, so only you can switch a trick on.
Or ask one of your agents for the trick you want. It writes the folder, tries it, and proposes it to you as a card in the app, with the whole code on it. Your yes is a hold of 1.5 seconds, and nothing runs before it.
To use a trick that someone else wrote, add it with collie trick add and its address. It arrives switched off. Read the code first.