Skip to content

Latest commit

 

History

History
331 lines (279 loc) · 18.2 KB

vault.md

File metadata and controls

331 lines (279 loc) · 18.2 KB

The vault

The vault is the whole point: a directory of plain markdown files that holds the bot's durable knowledge. It is readable and useful without the bot — open it in Obsidian, grep it, keep it in git. Operational state, including pending outage retries and the consumed inbox snapshot, lives separately in state_dir.

The bot's operating rules for the vault live in assistant/src/assistant/prompts/wiki.md, which is loaded into its system prompt on every run. That file is the authority; this page explains the same design for humans. If you change one, check the other.

The model: raw journal + compiled wiki

Two layers, with different rules:

  1. raw/journal/ — the permanent record, append-only. A past day's file is never edited. Completing a task, reversing a decision or correcting a fact is an event today: it gets recorded in today's entry, and the wiki is updated. History is preserved here, not by strikethrough.
  2. wiki/ — current state, mutated freely. Pages are rewritten and pruned without ceremony, precisely because the journal already holds the history.

This is why asking "what's the status of X?" reads one paragraph instead of forty chronological entries — the wiki page has already been compiled from them.

Layout

vault/
  AGENTS.md                    ← who you are, what language to use, local conventions
  inbox.md                     ← offline capture: write here while the bot is down
  attachments/                 ← incoming photos and files, saved as-is
  raw/
    journal/YYYY-MM-DD.md      ← append-only event log, one file per day
  wiki/
    now.md                     ← dashboard: today, upcoming, waiting, every open task, last 7 days
    routines.md                ← recurring activities: frequency, last done, next due
    index.md                   ← one line per wiki page
    log.md                     ← operations log (nightly compile, weekly lint)
    projects/<slug>.md         ← goal-oriented, time-bounded work
    areas/<slug>.md            ← ongoing life areas (health, family, hobbies…)
    people/<slug>.md           ← one page per recurring person
    archive/projects/<slug>.md ← finished or abandoned projects, out of the way
  system/                      ← managed by the bot: schedule.md, skills/, usage.md

Conventions

  • Every date in a vault file is ISO — 2026-08-12, or 2026-08-12 18:00 with a time. Not 12 August, not 12/08, and never with a weekday name or a relative date (tomorrow, next Sunday) beside it. The reason is search: the wiki deliberately keeps the same fact on several pages, so when a date changes the bot has to be able to find every copy, and one written as 12 August will not match a search for 2026-08-12. A weekday label is also a second fact that can be wrong on its own. The bot says dates naturally in chat — that is where they are meant to read well. now.md's Upcoming section is the sole exception: the next 7 days are grouped under one weekday line per day (tomorrow's reads Tomorrow — Friday). Every entry for that day is a separate bullet and keeps its ISO date in parentheses at the end; complex entries may add nested bullets beneath that dated parent. This file is always read whole and rebuilt nightly.
  • Journal entries are - HH:MM prose in local time, under a # YYYY-MM-DD heading. Prose only — no checkboxes, no TODO: markers. The filename carries the date, so entries need no date in the text; being append-only, old entries keep whatever notation they were written with.
  • Every project and area page opens with **Status:** …, one always-current paragraph. That is what catch-up questions read first.
  • Tasks are owned by project/area pages under ## Tasks: - [ ] thing (due YYYY-MM-DD), - [x] thing (done YYYY-MM-DD), and (waiting: X) when blocked on someone else. Every open task is also mirrored into now.md's Tasks section; the page copy is the authority. A task that is wanted but not urgent carries (someday) instead of a date: it never reaches Today, is never escalated, and is listed in now.md's Someday section, which the weekly lint reads out so it is not forgotten.
  • Dated events (an appointment, a trip, a school calendar) live on the owning page as - YYYY-MM-DD — description bullets (YYYY-MM-DD HH:MM with a time, YYYY-MM-DD → YYYY-MM-DD for a range). Every one within the next 14 days is mirrored into now.md's Upcoming section, so the dashboard knows about a date the user told the bot weeks ago.
  • People pages are created on recurrence, not first mention, and hold stated facts only — never invented relationship detail.
  • now.md is a copy, deliberately. It duplicates state owned by other pages so that "what do I need to do?" is one read with no queries. The cost is that it goes stale the moment a source page changes, which is why keeping it patched is part of every ingest. Its Tasks section is the complete inventory — every open task on every page, grouped by owning page — so the dashboard is the only place you have to look; the noise of listing everything is accepted, a second place to look is not. Overdue tasks stay listed under Today, with their original due date, until done or rescheduled — a deadline must not fall off the dashboard by passing. A user-declared Focus block (current priority plus its next actions) may open Today; it survives the nightly rebuild and only the user creates or clears it. Simple entries stay on one line, but complex entries may put supporting context in nested bullets rather than one long line. The parent line still keeps the complete task checkbox and markers, or the event text and date, so mirror checks can identify it.

Everything user-visible can be localized — column headers, section titles, task markers. Declare the localized terms in AGENTS.md and the bot will match your files instead of reverting to the English defaults.

Operations

Ingest — the default when a message carries new information. Journal it, update the one page that owns the fact, close any open task the message implies is done (searching for it — the same task can be tracked on more than one page), reconcile the now-stale lines in now.md, and check whether a scheduled reminder about it has been made moot. An ingest is not finished when the fact is filed; it is finished when no page still shows the old state. The reply acknowledges the outcome — it never lists the files touched.

Query — "what do I need to do?" reads now.md and answers with today's scope only. "Catch me up on X" reads that page's **Status:** paragraph. Historical questions search the journal and cite dates.

Archive — when a project is finished or abandoned, its page moves to wiki/archive/projects/<slug>.md: final status written, remaining tasks closed or deliberately dropped, stale reminders cancelled, every wiki reference patched to the new path (the append-only journal keeps its old prose mentions as history), and its index.md line re-filed under an ## Archived section at the bottom. Out of the live wiki but still readable and searchable; reviving a project is the same move in reverse. The weekly lint proposes archiving for projects gone quiet, and only the user's yes triggers it.

Compile — nightly. Re-reads recent journal entries, applies anything ingest missed, recomputes every routine's next-due date, rebuilds now.md in full (its Upcoming section from every live page's dated events for the next two weeks), reconciles index.md against the pages on disk (archived pages under ## Archived), verifies the result with check_vault (see below), logs to log.md, and flags the tasks the checker's report marks as lapsed since the previous compile.

Lint — weekly. Starts from a check_vault report, escalates the tasks it lists as overdue a week or more with a reschedule-or-drop proposal, then reviews every live project and area page (one fan-out worker per page): status paragraphs against the page body and the last two weeks of journal, projects with no journal mention in 30+ days (proposing to archive them), tasks open 21+ days (someday ones excepted), scheduled jobs referencing missing files, and the same task tracked on more than one page. It also reads the Someday list out, asking whether any of it should get a date now.

Both jobs lean on check_vault, a deterministic consistency checker built into the bot: pure code, no model involved. It enumerates every open task on every live wiki page against the now.md mirror (in both directions), pairs every dated event within the next two weeks with a dashboard line carrying its date and text, verifies weekday names written beside ISO dates against the calendar, and each Upcoming day group against the dates of the items under it, checks each routine's next-due date against last-done + frequency, reconciles every page against the index (orphan pages, dead index links), cross-checks reminder markers with the pending schedule, flags schedule rows carrying hand-written run plumbing or numeric cron weekdays, and reports leaked [version: …] tokens. It also lists every open task whose due date has passed, with its age and whether it lapsed since the last compile (those need the user's decision, so the heading says escalate rather than fix); warns when the log's last compile entry is more than two days old or its last lint entry more than two weeks old, for the jobs enabled in config; and catches page hygiene — dead relative links, empty sections, duplicated bullets, more than fifteen done tasks outside an archive section, and empty or placeholder Status paragraphs. The model fixes what the checker finds instead of being trusted to re-discover it — an enumerated sweep can't skip a page, and code can't miscompute a date.

Compile and lint are built into the bot. They run on the crons under [maintenance] in the config (03:00 nightly and Sunday 04:00 by default, on your local clock — see configuration.md), remember their last successful run so a missed one fires once after downtime, and never appear in system/schedule.md; the job listing shows them as built-in. A vault upgraded from a version where they were ordinary rows should cancel those rows, or the job runs twice.

Backup — optional but recommended: with [backup] enabled the bot keeps a local git history of the vault, one commit per interaction that changed it, with the exchange in the commit message. History, undo, and disaster recovery in one mechanism — see deployment.md.

Offline capture — when the bot is down but the vault is reachable (on the host, or through your sync), write into inbox.md at the vault root: free-form entries, one per paragraph or bullet, an ISO date/time up front when the timing matters. At the next startup the bot processes new entries as if you had texted it — notes journaled and filed, reminders scheduled, questions answered — and messages you what it did. Startup ingestion never clears or rewrites inbox.md: it atomically records the exact consumed snapshot in state_dir/inbox.processed.md. An unchanged inbox is skipped; if you append to it, only the new suffix is processed. If you edit earlier content so the file no longer starts with the consumed snapshot, the whole file is reprocessed, preferring possible duplicates to lost captures.

Entries added or changed during ingestion remain for the next startup. Failed, cancelled, or iteration-capped runs leave the checkpoint unchanged; with backup enabled, a failed backup also withholds it. The checkpoint preserves the input snapshot even if external edits mean git sees different content. Keep state_dir with your backups: losing or restoring an older checkpoint can replay entries already processed. Asking to process the inbox in chat is a separate model-driven operation, not this automatic checkpointed startup path.

Starting a vault

vault.template/ in the repo is a seed, not a working vault: an empty AGENTS.md skeleton and an empty inbox. Copy it to wherever you mounted /data/vault:

cp -r vault.template/. ./vault

Then just talk to the bot — ask it to "set up my vault". Its built-in vault-setup skill interviews you for the few things the code cannot know (your name, timezone, and reply language), writes AGENTS.md itself, lays down the skeleton pages, and explains the built-in compile/lint housekeeping jobs. These are enabled by default and configured under [maintenance], not created as schedule-table rows. You never have to hand-edit commented-out placeholders.

Starting from a completely empty directory works too; the template just saves the bot a few guesses.

AGENTS.md

Loaded fresh on every run and appended after the built-in instructions, so it wins on conflict. Keep it to conventions — who you are, what language to reply in, how this vault differs. Facts about people and projects belong in the wiki, not here.

Scheduling

Ask in plain language: "schedule a daily morning brief at 8am". The bot manages system/schedule.md, a markdown table, and you can list, change or cancel jobs conversationally.

The nightly compile and weekly lint are built in and need no row here — their timing lives in the config.

when accepts:

  • ISO 8601 datetimes — 2024-06-15T09:00:00+00:00
  • Cron expressions, when recurring — 0 8 * * *
  • Relative expressions, one-off only — in 10 minutes, tomorrow at 9am

The file is the source of truth and is re-read every 60 seconds, so hand edits take effect within a minute. All six columns (id, when, recurring, prompt, created, next) are required — though older five-column rows still parse, and the bot fills next in on its own; a row that does not parse is skipped with a warning in the log, and written back untouched when something else edits the table — otherwise one bad row would be erased by the next write. next is bookkeeping the bot maintains: the next time a recurring job is expected to fire, updated after each run. Leave it alone. (Downgrading to a pre-next version stops six-column rows from parsing — the jobs sit inert, warned about in the log but never lost, until the column is removed by hand or the bot is upgraded again.)

Times run on the local clock: a cron expression fires on your wall clock, and a when you write by hand is read as local unless it carries an offset. The one UTC form is what the schedule tool stores for one-off jobs — an absolute instant with +00:00 — which is unambiguous precisely because the offset is there. Write cron weekdays as names (SUN); the numbering starts at Monday, so 0 means Monday.

Reminders that came due while the bot was down fire when it comes back up. A recurring job whose next time has passed gets one run at startup, however late — told how late it is, so it can adapt or stand down. One-off jobs overdue by less than 12 hours fire once on restart; older ones are dropped.

A reminder whose purpose is already met stays quiet: scheduled runs read the relevant wiki state first and stand down silently if the routine was already logged or the task already closed.

Skills

A skill is a markdown file holding a procedure for recurring work — your weekly review, how you like receipts filed. Only the name and the **Use when:** trigger line sit in the system prompt; the body is loaded on demand when the trigger matches. That keeps the prompt small and stable, so refining a skill's steps costs nothing.

Two ship with the image (skill-authoring, vault-setup). Yours go in system/skills/<slug>.md, and a vault file shadows a shipped one with the same name — that is how you customise a built-in. Slugs must be lowercase letters, digits and hyphens; a file without a valid **Use when:** line is excluded from the menu and logged.

Ask the bot to write one and it will. It also refines a skill in place when following it reveals a missing step, which is the intended way they improve.

One conversation, no rooms

There are no topics or channels to choose. You say what happened, as you would to a person, and the bot infers which project or area it concerns from the message, the recent conversation and the wiki index — asking one short question when a terse message could mean more than one open item. Standing directions for a subject (language, tone, what to record, whom to keep informed) live on that subject's page under ## Instructions, where the bot reads them whenever the conversation touches it. Earlier versions had separate rooms with their own prompt; that was removed on 2026-09-17, and old room conversations were merged into the one chat.

Scheduled jobs still run in parallel with the conversation, and messages within the conversation stay strictly ordered. Writes to the vault are guarded against collisions — a full-file rewrite is accepted only if the file still matches what that run last read, and refused otherwise so the bot re-reads and redoes the change instead of overwriting someone else's. The same guard protects your own hand edits made while the bot is mid-conversation.

Attachments

Photos and files are saved under attachments/ before the model sees anything.

  • Photos are shown to the vision model on the turn they arrive, alongside your caption, and not re-sent afterwards — follow-up messages don't re-pay the image tokens.
  • Documents and videos are stored and the model only ever gets the filename, MIME type and stored path. It reads the contents on demand via extract_attachment: digital PDFs parsed locally, scans and images transcribed by the vision model.

Your caption drives intent — "file this receipt under finance" files it, "what plant is this?" just answers and leaves the file unlinked.

Attachment content is treated as untrusted data, never instructions. See SECURITY.md for the limits of that.

Token usage

Every model call is recorded to state/usage/usage-YYYY-MM.jsonl, and a rolling 7-day summary is rendered to system/usage.md — per day, feature and model, including cached-token counts. Recording happens off the critical path, so it costs nothing per message.