Repository navigation
The Snap Assistant
The assistant of Snap answers
what a person types, says or attaches on /assistant, and it answers with your cards. Much of it needs no model. It
understands "What can I do?", the name of a card or of a shortcut, and "delete it" on what is on screen. With an
Anthropic API key, Claude understands anything else, looks things up with the read-only capabilities the person may
call, and answers with cards. The assistant never changes data, because a change always comes back as its Confirm. It
exists since 2.23.0.
/caligrafy-quill:assistant
Claude sets up Snap, writes about in application/config/snap.php, and asks you for an Anthropic API key if you want
the assistant to understand free text.
Check
-
php caligrafer.php snapshows the model on theAssistant modelline, or[--]without a key. - On
/assistant, "What can I do?" lists every card you may use.
-
Without a key, the assistant works at once. Add
Route::snap();inweb.phpand runphp caligrafer.php snap install. -
With Claude, add the key to
.env.You get a key from console.anthropic.com, under API keys. The model isANTHROPIC_API_KEY=
claude-opus-5-5atloweffort, andSNAP_MODELandSNAP_EFFORTin.envchange them. Theanthropic-ai/sdkpackage must be installed. It is in Caligrafy'scomposer.jsonsince 2.23.0, so after anupdateruncomposer installor rebuild the Docker image. -
Say what the app is in
application/config/snap.php.'about' => 'a library app: the books of a catalog, their authors, and the books lent to people',
aboutandAPP_NAMEin.envtell the assistant what it is the assistant of.
The assistant uses the first answer that fits.
-
At once, without a model (
Caligrafy\Snap\Shell, API).- "What can I do?" (also
what else can i do,what can you do,help,menu,?,options) shows the menu, every card this person may start, by family. - The title of one of their shortcuts runs that shortcut.
- The title or the name of a card ("the catalog", "lend a book", "list_loans") opens that card.
- A follow-up on the record on screen is a verb with "it", "this", "that", "this one", "that one" or "this book".
The verbs
delete/remove,change/edit/update/fix,lend/loan,returnandopen/show/seeopendelete_<thing>,update_<thing>,lend_<thing>,return_<thing>orget_<thing>for that record. Anything longer ("lend it to Sam") goes to the model, with the conversation's memory.
- "What can I do?" (also
-
Claude (
Caligrafy\Snap\Planner, API), when it is on. It reads the request with the conversation so far, what is on screen and what the person chose. It may look things up with the read-only capabilities the person may call, as tools run with their permissions, in 6 steps at most. It answers withshow_cards, which names the capability, its values and one sentence of caption.
What the model may never do is enforced in code, not in the prompt. Every card it names goes through Snap\Flow
like any other. A read runs, and a change comes back as an Ask Confirm card whose token only the person's click sends.
The model never sees a token and never runs a change. Tool results and attached files are the app's data, never
instructions.
Attachments. The + button attaches up to 3 files, 5 MB in all. The accepted types are PNG, JPEG, GIF, WebP, PDF, plain text, CSV and Markdown. Without the model, attached files get a message instead of an answer.
The keyboard. Press ⌥K / Alt+K to type and ⌥M / Alt+M to talk.
Fake the model with Caligrafy\Snap\Planner::$transport, and set it back to null in tearDown. Call snap_ask with
$this->action(), because it is a web-only capability. The Snap tables must be in the test database, so run
platform install with the test settings.
Caligrafy\Snap\Planner::$transport = function (array $request) {
return (object) array('stopReason' => 'tool_use', 'content' => array((object) array('type' => 'tool_use', 'id' => 't1',
'name' => 'show_cards', 'input' => array('caption' => 'Here it is.', 'cards' => array(array('capability' => 'list_books'))))));
};
$answer = $this->action('snap_ask', array('text' => 'show me the catalog'), $this->user(1))->describe()['data'];The designed cards have their own fake, Caligrafy\Snap\Designer::$transport. You can also keep them to the rules with
Caligrafy\Snap\Designer::$model = false (since 2.24.1).
-
The assistant only answers the names of cards (G156).
ANTHROPIC_API_KEYis missing, or theanthropic-ai/sdkpackage is not installed. -
Forcing a tool in your own calls to Claude (
toolChoiceof typetoolorany) answers400on the current Claude models. Snap uses a structured output instead (G161). - A test that fakes the planner on 2.24.0 also received the designer's requests. Since 2.24.1 the designer has its own fake (G162).
-
/assistantthrowsLogicExceptionbecauseRoute::snap()needsAuth::authentication(...)above it (G154).
- Snap Cards and the assistant
- Snap: Ask cards explains consent.
- Testing your app
- API: Snap · Snap\Conversation
Caligrafy. Describe it. Approve it. Ship it. An open-source framework that bridges the server and the client. Every feature is built once in PHP, for web pages, Vue apps, phone apps, a REST API and AI agents.
Why Caligrafy, with the benefits, the measurements and what it is not yet
-
Quickstart with Claude to describe it, approve it and ship it
or the Quickstart, the same three steps by hand in 5 minutes
- How Caligrafy works, the ideas in 5 minutes
- Your first capability, a feature with its page
-
Capabilities in depth
-
Every option of
#[Capability] - Scheduled jobs, capabilities on a timer
- Notifications by web push and email
- Background jobs, capabilities run later
- Migrations, database changes in order
- The cache
-
Testing your app
- Dependency injection
- Validation rules
-
Web pages
- Views and page components
- Design styles, another look in one setting
- Declarative routes, every request in one line
-
Route::page·Route::form·Route::auth·Route::webhook·Route::download·Route::redirect·Route::action·Route::snap· capability routes - How to export a list as CSV
- Moving a controller to a declared route · how to, step by step
- Forms and helpers
-
Vue apps
-
Mobile and tablet
-
REST API
-
AI agents
-
Snap Cards and the assistant
- Payments with Stripe and crypto
- Face detection and face login
- OpenAI chat and images · Assistants
- Open models such as Llama and Mistral
- Chatbots with Watson
- Machine learning in the browser
- Phone and tablet apps for iOS and Android
- Languages, translations and right to left
- Metadata and social cards · search and analytics
-
Putting it online, the production image and the database at every start
-
API reference of every class and method
-
Routing ·
Route·AuthRoutes· pages ·Controller· capabilities -
Data ·
Model·Query· sign-in · jobs ·Notify· payments · AI -
Interfaces · Snap ·
Snap\Cards·Snap\Conversation· testing · tooling · helper functions
-
Routing ·
-
Caligrafer, every command
- Project · build · data · agents · jobs and tests · maintenance · deploy
- Installation, configuration and Caligrafer
- Routing · Request · Controllers · Views
- Vue flow of information · routes · validations
- Security and upgrading
- Release notes for 2.34 · 2.33 · 2.32 · 2.31 · 2.30 · 2.29 · 2.28 · 2.27 · 2.26 · 2.25 · 2.24 · 2.23 · 2.22 · 2.21 · 2.20 · 2.19 · 2.18 · 2.17 · 2.16 · 2.15 · 2.14 · 2.13 · 2.12 · 2.11 · 2.10 · 2.9 · 2.8 · 2.7 · 2.6 · 2.5 · 2.4 · 2.3 · 2.1 · October 2026 · changelog
- Testing Caligrafy (contributors)