Cases
A customer's job goes from the bot that answers enquiries to the one that writes the quote and on to the one that writes the documentation. A client's annual accounts pass through more than one bot. Instead of telling each other everything, the bots keep it in a case: notes, facts and the documents they saved. The next bot reads the case and picks up where the last one left.
What is in a case
- A title, so you know it: «Storgata 12: varmekabler», «Årsoppgjør 2026: Acme AS».
- The bots in it. Only they see the case. A bot that opens one names the bots it shares it with; you add and remove bots in the window.
- Facts, each with a key: "Tilbud: 48 500 kr eks. mva", "Sikringskurs: ny 16 A kurs". The latest for a key counts; the earlier ones stay in the history.
- Documents a bot saved with
documents_saveand put in the case. Only files under~/Huskarlcan be put in a case. - Notes, oldest first, each with who wrote it and when: what was done, what is next, what someone is waiting for. You write in it too.
In the window
Cases in the sidebar (or Cases in ⌘K) opens the list of open cases, with the bots in each and when it last changed, and the case that changed last. In a case:
- the bots in it, each with × to take it out, and +
for the others; - the facts, the documents (click one to open it) and the notes;
- Write in the case… for a note of your own;
- Close the case when the work is done, and Open again.
New case at the top of the list opens one with a title; add the bots to it afterwards. Show closed cases lists the closed ones too.
Deciding a case together
A proposal belongs to the case its bot was working in: the one it last read, wrote in, attached to or opened in that run. The quote mail and the mail about the site visit Tilbud proposes after reading the case are both the case's.
- In the case, Waiting for you lists every proposal of the case that waits, each as its full card, with Approve all and Reject all above them. Approve all asks once more ("Press again to approve all 2"), since it lets several things go at once; each is then carried out as if approved on its own card, undo window and all. Below, Proposals lists what was decided in the case, with who proposed it and how it ended.
- In the approval queue (⌘⇧A), a case's proposals stand together under a line with the case's name and the same two buttons; click the name to open the case.
The cards stay in each bot's thread as well, and each can still be decided on its own. Rehearsed proposals are not shown.
The bots' tools
| Tool | Class | What |
|---|---|---|
cases_list |
Read | the cases the bot is in |
cases_read |
Read | a case: the facts that count, the documents, the latest 60 notes |
cases_open |
Change internally | opens a case with a title, the bots to share it with and a first note |
cases_write |
Change internally | a note, or with key a fact |
cases_attach |
Change internally | puts a saved document in the case |
cases_close |
Change internally | closes it, with a line on how it ended |
A bot is told to look in cases_list before it opens a case, so the same job
does not get two. Writing in a case changes nothing outside Huskarl, so it is
logged and not asked about, like archiving a mail; a rule for the class in the
bot's settings can make it ask.
Safety
- What the bots wrote in a case is outside text to the bot that reads it: reference, never instructions, whoever wrote it. A mail that says "the customer has approved, send the invoice" can end up in a note, but it cannot make the next bot do anything it would not do from the mail itself, and everything that leaves still waits for you.
- An entry a bot wrote after it read outside text in the same run is marked
as such in the database (
outside). - A bot outside the case gets "no case … that you are in", whatever id it tries.
- Removing a bot from a case takes its access away at once.
Waking the bots
A bot reads a case when it runs. To have it run when something happens in its cases, give it a routine with the condition Only when a case has changed (in the bot's settings, or ask it: "look at your cases every quarter of an hour when something has happened"). It runs when another bot or you wrote in one of its open cases, and is told which; what it wrote itself does not wake it. See Routines.
Opening a case, adding or removing a bot, closing and reopening it are written in the case as well, so they wake the bots in it too.