Capps
Every Diamond is drawn by a page of its own. A capp is that page written as an application: something you tap, which records what you tapped into a file beside it. Ask your daimon for a food log, a practice tally or a set of readings, and what comes back is a small app that lives inside the Diamond and keeps what you put in it.
The page is a real file, crystal.html, in the Diamond's own folder. Every Diamond has one from the day it is made: the standard page renders the crystal as a document. A capp is the same file doing more, and the same rules cover both.
What a capp can do
- Draw the crystal. Everything the Diamond knows is handed to the page when it loads, and again whenever you change how Daimond looks, so the page can dress itself to match.
- Read the files in its own Diamond. A table it draws a chart from, an index it maintains, its own log from yesterday.
- Write files there too. This is the part that makes it an application rather than a rendering. A tap can be recorded, and it is still there tomorrow.
- Ask Daimond to open a link, which goes through the same gate every other outward request does and may still be refused.
Writing is how a capp remembers, and it appends by default: a new line goes after what was there. Two taps in the same instant both survive, which a logger that loses one under a double tap would not.
One write is capped at half a megabyte, which is thousands of entries at once and far more than a tap ever records. The file itself has no such ceiling: a log grows past it a line at a time, for as long as you keep one.
What a capp cannot do
A capp runs in a sealed frame. None of the following is a setting to be turned on: they are the design, because the page was written by a model, it is not part of what the Diamond knows and so is never folded or reviewed the way a crystal is, and it syncs to every device you own.
No network
No fetch, no request of any kind, no image loaded from a server. A capp cannot call an API, and it cannot send anywhere what you have put in it. Everything it knows arrives from Daimond.
No libraries
Nothing is loaded from outside: no framework, no chart library, no web font. A capp is one self-contained file, so its pictures are drawn or inlined and its code is its own. Nor can it build fresh code out of text while it runs, so what the page does is what is written in it.
512 KB
The whole page, code and style together. Generous for a page written economically and tight for one used as a store, which is deliberate. Page size limit in Settings raises it if you need to.
No storage of its own
It cannot use the browser's storage, and it has no memory between loads except the files it asks Daimond to write. Those files are in the Diamond, where you can read them.
It cannot rewrite itself
A capp may not write over crystal.html or crystal.json (nor crystal.md, where an older Diamond still keeps one), the version history, or the Diamond's own records. A page that could change its own code between one look and the next would mean nothing you read stayed read.
It cannot leave its Diamond
Every path it asks for is resolved inside that one folder, and anything climbing out of it is refused. One capp cannot read another Diamond's files, and none of them can reach your workspace.
Where what you record goes
Into the Diamond, beside the page, on this device. A Diamond is kept in the browser's own storage: it is on your machine, but it is not a folder you can open in a file manager, and it is not in the folder you have open as your workspace, even though the Diamond's directory is listed there. Daimond keeps its own things apart from your work on purpose, so a page's log can never be written into somebody's project. The Workspace panel is where you read it. Nothing about it is sent to us, and what does leave the browser is set out in full on the Accounts page. Deleting the page does not delete what it recorded: the files stay where they are, and a new page can read them.
Because the files are in the Diamond, they travel with the Diamond. Cross-device sync carries the whole folder to your other devices, so a log kept on your phone is on your laptop, and the gateway holds a parcel it cannot open. Two things follow that are worth knowing before you fill one up:
- A Diamond travels whole, from whichever device touched it last. Log on your phone and on your laptop between two syncs and you do not get both sets of entries: the side that synced later is the one that survives. Logging in one place at a time is what a log is usually like, and this is the case where it matters.
- Bulk data competes with everything else. Diamonds share a few megabytes in a parcel, and one that grows past what is left is left out of the sync entirely rather than trimmed. A log of what you did stays small for years; a reference table of tens of megabytes is a different thing and belongs in the workspace.
Asking a daimon for one
Open the Diamond you want the app to live in and choose ✎ Page in the row above the crystal. That fills the message box with a note saying which of the Diamond's two files you mean, since ✎ Edit beside it changes what the crystal says and this changes how it looks. Finish the sentence with what you want and send it.
Say what you tap and what it should record. "A page with a tile for each of the foods I eat: tapping one records it with today's date, and the day's total is at the top." A daimon that knows the shape of the thing writes the file in one turn. What it cannot do is guess whether an entry is a count, a weight or a time, so say which.
You can ask for changes afterwards in the same way, and every version of the page is kept: ↺ History shows them, and any of them can be restored. A page that will not load is not a dead end either. Daimond puts its own rendering up in place of the capp, says which way it failed, and offers to put the standard page back.
Using one on a phone
At the right-hand end of the row across the top of the centre panel, on a Diamond's crystal, sits a button drawn as four corners. Its name, Full screen, is in the tooltip rather than beside it, because in the ordinary view there is no room for the word. Pressing it takes away the rail, the top bar, the dock, the bottom bar, the message box and the crystal's own row of buttons, and gives the whole screen to the page, which is what a capp is worth having on a phone.
The same button, now wearing the words Exit full screen, brings it all back. Esc does too, so long as Daimond has the keyboard: while you are typing inside the page itself the keystrokes belong to the page, which is why the way out is a button and not only a key. It is never entered on your behalf, and it is not remembered: reopening Daimond puts you back in the ordinary view.
A worked example: Log Life
A capp ships with Daimond as an example, and you can have it as a working Diamond rather than reading about it. The button below makes a Diamond called Log Life and puts the page inside it, furnished and ready to record. Daimond asks first, and if you already have one it offers to open that instead of making a second.
Nothing is sent anywhere. It makes one Diamond on this device and copies the page into it.
Once it is made, the page is a file in that Diamond like any other, and the Diamond's own daimon can read it. So the place to ask for a variation is inside Log Life itself: ✎ Page there, and "the same, but for practice sessions instead of meals", gives the daimon a worked example in front of it rather than a description of one. A daimon in some other Diamond cannot see this page, and will write you a new one from scratch.