Types, views and type actions
Types
A type says what fields a kind of document has: a contact has emails and phones, an invoice has an amount and a due date. A document declares its type in its front matter:
---
type: contact
title: Ana Reyes
emails: [ana@example.com]
company: Seafrigo
---
Types are written in Goethe's definition language, one file per type in the vault's types/ folder:
type contact
fields
title: Text
emails: List<Email>?
phones: List<Text>?
company: Text?
status: Enum(active,former)?
? makes a field optional. A type that does not compile is not saved, so a vault never holds a broken type.
Work with types in Knowledge
- Types in the sidebar lists every type with its documents. Select one to edit its definition, then Save type. Refine this type with Alma asks your accomplice to improve it.
- Give a document a type: open it, choose the type, and Convert. Every field is kept; Mandala suggests how to map old fields onto the type's (
email → emails), and you can skip any. - Type with Alma on a folder asks your accomplice to type every untyped document in it, creating a type if none fits.
- Diagnostics on a document lists fields that do not fit its type; Add these fields to the type fixes the type instead.
Views
A view is a saved query over your tasks or documents, one file per view in views/:
view OpenSupplierTasks
tasks
| where status != "Done"
| where document_id == "docs/suppliers/seafrigo.md"
| sort due
| select text, due, document_id
The source is tasks, agenda, documents, or documents <type> for one type. Stages, one per line: where (strings in double quotes; a task's status is Open or Done), sort, select.
In Knowledge, Views lists them; select one to run it into a table (documents link through). New view creates one; it is saved only if Goethe compiles and runs it. Your accomplice can list, run and save views too.
Type actions
A type can offer actions that appear on each of its documents. An action carried out by your accomplice has a prompt with the document's fields:
type supplier
fields
title: Text
emails: List<Email>?
actions
ask_for_price_list:
label = "Ask for the price list"
transport = "alma"
prompt = "Write to {title} at {emails} asking for their current price list."
confirm = true
Press the action on a supplier document and your accomplice does it, with its usual approvals. Actions that run commands (stdio, http) work only from the Goethe TUI, never on the server.
Coming soon — rules in vaults (Goethe's rule syntax is not defined yet).