sioul_core/lib.rs
1// SPDX-License-Identifier: GPL-3.0-or-later
2// Copyright © 2026 Aurélien Pierre
3
4//! Sioul's core: what Sioul knows and decides, the same for every interface.
5//!
6//! Everything the interface shows is decided here, so that the command line,
7//! the Qt interface and AI agents all see the same Porch. The interface holds
8//! no logic of its own (docs/architecture.md). The core reads and writes plain
9//! files (Maildir, vdir, TOML, Markdown) and never uses the network: talking
10//! to servers is the work of `sioul-sync`.
11//!
12//! Sioul has five crates, all in the repository's `crates/` folder:
13//!
14//! - **sioul-core**, this one: the library at the centre.
15//! - **[sioul-sync](../sioul_sync/index.html)**: what talks to the world: mail
16//! servers, calendars and contacts, the keyring, sharing between devices.
17//! - **[sioul](../sioul/index.html)** (`crates/sioul-cli`): the command line,
18//! and `sioul mcp`, the server for AI agents.
19//! - **[sioul-app](../sioul_app/index.html)**: the window's Rust side, under
20//! its QML pages.
21//! - **[sioul-learn](../sioul_learn/index.html)**: the spam filter's training,
22//! on computers only (docs/spam-filter.md).
23//!
24//! # Where to start reading
25//!
26//! - **How new mail is judged**: [`porch::triage`] takes a [`card::Card`],
27//! what is known of one message before it is opened, and gives it a lane and
28//! the reasons for it ([`porch::Triaged`]).
29//! - **What the window shows**: [`view`] and [`taskview`]. Their functions
30//! return plain data, every sentence already in your language; the window
31//! receives it as JSON and only lays it out. [`view::porch`] makes the Porch.
32//! - **Tasks and the plan**: [`tasks`] reads and writes the task files;
33//! [`plan::plan`] works out the plan from them each time it is asked.
34//! - **Words**: every sentence goes through [`i18n::Translator`], from the
35//! Fluent files in `crates/sioul-core/locales/` (docs/i18n.md).
36//! - **Settings**: [`config::Config`], the configuration file.
37//!
38//! Names such as docs/porch.md are the design notes in the repository's
39//! `docs/` folder. The website shows them too, under the same name:
40//! <https://aurelienpierre.github.io/sioul/dev/porch.html>.
41//!
42//! # Modules, by theme
43//!
44//! Each module is one file of `crates/sioul-core/src/`: [`porch`] is
45//! `porch.rs`.
46//!
47//! ## What the window shows
48//!
49//! - [`view`]: the Porch, mail, budgets, accounts, the agenda and contacts, as plain data.
50//! - [`taskview`]: the task pages in words: the next step and why, the board, the list, the timeline.
51//! - [`dayview`]: the day, seen: today's events and the plan's steps laid into your hours.
52//!
53//! ## The Porch: new mail, checked and sorted
54//!
55//! - [`porch`]: where new mail waits, checked and sorted into lanes, until you look.
56//! - [`card`]: what the Porch knows about one message before you open it.
57//! - [`state`]: what the Porch remembers between windows: where you closed it.
58//! - [`trust`]: who really sent a message, from what the servers recorded.
59//! - [`lookalike`]: senders who borrow a name.
60//! - [`codes`]: one-time codes, password resets, sign-in links and addresses to confirm.
61//! - [`payments`]: mail about money: a payment made or received, a bill, an order, a refund.
62//! - [`shield`]: the shield of a public address: its mail read first, its tone and topic.
63//! - [`rules`]: the vocabulary of sorting: what a rule may propose.
64//! - [`text`]: text helpers shared by the detectors.
65//! - [`words`]: the words the detectors look for: shipped packs by language and country, and your changes.
66//! - [`reach`]: who reaches you, on which channel, and the clock that says what time it is, ahead.
67//! - [`attention`]: what reaches you, and when: one matrix of who and what by time, its pipeline, its words.
68//! - [`mailnote`]: new mail as a notification, at the times it may come.
69//! - [`letters`]: paper letters: a scan read by OCR, understood, and shown as a card.
70//! - [`voicemail`]: voicemail that the phone operator sends by mail.
71//! - [`spam`]: Sioul's own spam filter, as every device runs it (docs/spam-filter.md); its training
72//! is in [sioul-learn](../sioul_learn/index.html).
73//!
74//! ## Mail: on disk, read and written
75//!
76//! - [`maildir`]: messages on disk: a Maildir, or a plain folder of `.eml` files.
77//! - [`headers`]: the raw header block, unfolded.
78//! - [`mailindex`]: messages by their Message-ID, to follow `mid:` links.
79//! - [`mailsearch`]: searching the mail by conditions, here and on the servers.
80//! - [`folders`]: mail folders: what each is for, its name as you read it, where it is kept.
81//! - [`threads`]: conversations, tied by Message-ID, never by subject alone.
82//! - [`reading`]: a message laid out for reading: its text, what it quotes, what it forwards.
83//! - [`compose`]: writing: Markdown in, mail out.
84//! - [`mailto`]: `mailto:` addresses: the message a link asks to write.
85//! - [`handed`]: files, text and `mailto:` links other applications hand Sioul: each a draft.
86//! - [`pgp`]: OpenPGP for mail, with Sequoia.
87//! - [`securitykey`]: your OpenPGP keys on a security key (a YubiKey): signing and opening there, its certificate checked.
88//! - [`unsubscribe`]: leaving a mailing list in one click: when it may be done.
89//!
90//! ## Tasks, projects, notes and links
91//!
92//! - [`tasks`]: to-dos (VTODO) in CalDAV task lists, one per file, and what ties them to the rest.
93//! - [`plan`]: the plan: what can start, the one next step, when each task could happen.
94//! - [`capture`]: quick capture: one line typed, a task made.
95//! - [`blocks`]: time blocks: a task pinned to a time, as an event in a calendar.
96//! - [`demands`]: what a task or an event asks of you, and what it gives back.
97//! - [`capacity`]: what a day can hold, learned from your own days.
98//! - [`routines`]: routines: timed steps played one at a time.
99//! - [`stopped`]: where you stopped: one line kept when something interrupts you.
100//! - [`today`]: today's own choices: how the day is, the steps put off for today.
101//! - [`projects`]: projects, every matter you follow, and the file in your notes folder that names them.
102//! - [`projectview`]: a project on one page: everything dated in it.
103//! - [`github`]: GitHub's issues and pull requests that are yours, as tasks.
104//! - [`notes`]: a folder of Markdown files, read the way Obsidian reads a vault.
105//! - [`links`]: links between everything: mail, tasks, events, contacts, notes, budget lines.
106//!
107//! ## Time and money
108//!
109//! - [`timelog`]: time spent on tasks, and the focus session running now.
110//! - [`ids`]: the ids given to money lines, splits, presets and sessions when they are made, by which your devices merge them.
111//! - [`timereport`]: time spent, as the Time page and a project's page show it.
112//! - [`invoice`]: invoices for work done for someone, from a project's billable time.
113//! - [`budget`]: budgets, reserves, and the lines between them.
114//! - [`accounts`]: bank accounts, and the budgets each movement goes to.
115//! - [`bank`]: the money watch: the bank's exports held against the recurring payments.
116//! - [`money`]: exact amounts, and the amounts written in mail.
117//! - [`contracts`]: contracts and subscriptions: when each renews, how to stop it.
118//! - [`papers`]: the papers wallet: the papers asked again and again, and when each ends.
119//!
120//! ## Hours, pauses and reminders
121//!
122//! - [`areas`]: what things are for (work, your admin, leisure), and which time is for what.
123//! - [`window`]: working hours: the days and hours work can reach you.
124//! - [`quiet`]: the time now (work, admin, a meal, sleep, leisure), and what comes then.
125//! - [`needs`]: the day's needs, set first: meals, naps and night sleep.
126//! - [`pause`]: the two pauses: Free time, and Paused.
127//! - [`everywhere`]: do-not-disturb on every device.
128//! - [`reminders`]: reminders before dates: one quiet notification for each.
129//! - [`reviews`]: how each day went, as you said it.
130//! - [`sounds`]: sounds to rest by or to focus with, all made here.
131//!
132//! ## Health
133//!
134//! - [`health`]: prescriptions, medicines and when to take them, pauses to move, a limit on chats.
135//! - [`doses`]: each dose that fell due, as a record your devices share.
136//!
137//! ## Contacts and calendars
138//!
139//! - [`contacts`]: contacts, one vCard per person.
140//! - [`agenda`]: calendars: events from iCalendar files, repeating ones expanded.
141//! - [`vdir`]: address books and calendars on disk: one folder per collection, one file per item.
142//! - [`lines`]: content lines, the text format that vCard and iCalendar share.
143//! - [`phones`]: phone numbers, compared rather than rewritten.
144//! - [`places`]: where postal addresses are, to show contacts on a map.
145//! - [`duplicates`]: duplicates in the address books, found and cleaned when you ask.
146//! - [`overlaps`]: two events at once.
147//! - [`capabilities`]: what each kind of server keeps of a task or a contact.
148//!
149//! ## On a phone
150//!
151//! - [`calls`]: calls screened on a phone.
152//! - [`appnotes`]: other apps' notifications on a phone: shown now, or held until their time.
153//!
154//! ## Settings, words and files
155//!
156//! - [`config`]: the configuration file: accounts, working hours, the notes folder.
157//! - [`settings`]: settings, shown where they apply, and written into the configuration.
158//! - [`i18n`]: every sentence Sioul shows, in your language.
159//! - [`sites`]: sites kept open in Sioul (a bank's secure mailbox, a chat), and what they notified.
160//! - [`presets`]: sites people commonly keep, offered when adding one.
161//! - [`weather`]: the weather at a place you chose, for the status line.
162//! - [`filelock`]: one writer at a time on a file that two parts of Sioul change.
163
164pub mod accounts;
165pub mod agenda;
166pub mod appnotes;
167pub mod areas;
168pub mod attention;
169pub mod bank;
170pub mod blocks;
171pub mod budget;
172pub mod build;
173pub mod calls;
174pub mod capabilities;
175pub mod capacity;
176pub mod capture;
177pub mod card;
178pub mod consent;
179pub mod codes;
180pub mod compose;
181pub mod config;
182pub mod contracts;
183pub mod dayview;
184pub mod demands;
185pub mod doses;
186pub mod filelock;
187pub mod contacts;
188pub mod duplicates;
189pub mod everywhere;
190pub mod folders;
191pub mod github;
192pub mod handed;
193pub mod headers;
194pub mod health;
195pub mod i18n;
196pub mod ids;
197pub mod invoice;
198pub mod lines;
199pub mod letters;
200pub mod links;
201pub mod lookalike;
202pub mod mailindex;
203pub mod mailsearch;
204pub mod maildir;
205pub mod mailnote;
206pub mod mailto;
207pub mod money;
208pub mod needs;
209pub mod overlaps;
210pub mod notes;
211pub mod payments;
212pub mod pgp;
213pub mod phonemsgs;
214pub mod phones;
215pub mod plan;
216pub mod places;
217pub mod porch;
218pub mod presets;
219pub mod papers;
220pub mod pause;
221pub mod quiet;
222pub mod reach;
223pub mod reviews;
224pub mod routines;
225pub mod reminders;
226pub mod projects;
227pub mod projectview;
228pub mod reading;
229pub mod rules;
230pub mod securitykey;
231pub mod settings;
232pub mod shield;
233pub mod sounds;
234pub mod spam;
235pub mod sites;
236pub mod state;
237pub mod stopped;
238pub mod taskview;
239// texts: SMS phase (b), read and sent through the phone (docs/texts.md).
240pub mod texts;
241pub mod tasks;
242pub mod text;
243pub mod textdraft;
244pub mod threads;
245pub mod timelog;
246pub mod timereport;
247pub mod today;
248pub mod trust;
249pub mod unsubscribe;
250pub mod vdir;
251pub mod view;
252pub mod voicemail;
253pub mod weather;
254pub mod window;
255pub mod words;