Packages and rules in full
AGENTS.md at the root holds what an agent or a contributor needs on every task. This page is its long form: where each part of the code lives, and the full text of the six non-negotiables. A check (scripts/repo-checks.test.mjs) keeps the package list complete. The walk through one edit is the Architecture tour; the reference is Architecture.
On this page
The six non-negotiables#
- Specs before behavior. Behavior changes start as an OpenSpec change (
openspec/changes/<name>/). Use/opsx:propose,/opsx:apply,/opsx:archive. Live specs are inopenspec/specs/. Validate withmake openspec-validate(the OpenSpec CLI at the exact version pinned in theMakefile). The docs build turnsROADMAP.md's milestone tables and the change folders intodocs/roadmap.md: after ticking tasks, archiving a change or editingROADMAP.md, runmake docs(the docs check fails on a stale page). - All data writes go through ops. Membership is never an op; REST writes use
ApplyStrictand wake devices withNotifyApplied. Never write task/project rows directly (internal/writepaths, a test-only package, fails onApplyor SQL writes to the synced tables outsideinternal/syncunless allow-listed with a reason). Server:internal/sync. Client:web/src/lib/ops.ts→mutate(). - Op schema is additive. A field is declared once, in
internal/sync/ops.goSchema: its kind, its row default (JSON) andContent: truefor user-written text, with a comment that becomes its documentation.UPDATE_OP_SCHEMA=1 go test ./internal/sync -run TestGeneratedOpSchemathen writesweb/src/generated/opSchema.ts(the field types every entity type inweb/src/lib/types.tsextends, the row defaultsops.tsuses, checked against those types, andCONTENT_FIELDS),internal/e2ee/contentfields.goand the contract fixture;go testfails while they are stale. Narrow a field's type intypes.tsonly when the kind is wider than the client needs. Never rename or remove a field without a design doc. Server features that show content usee2ee.Display/IsCiphertextand degrade explicitly. - Auth required by default. Every route is registered through the policy wrapper
routes.handle(pattern, policy, handler)ininternal/httpapi/policy.gowith one declared policy (signedIn,ownerOnly,adminsOnly, orpublic("reason")only when a spec says so; modifiers.credential(),.recent(),.sensitive(),.sessionOnly(),.fullTokens(),.demoDenied()); never callServeMux.Handledirectly,policy_test.gofails on it. A route package underinternal/httpapi/(speech,maproutes,davroutes) gets anhttpx.Routerand registers with the same policies frominternal/httpapi/httpx(the policy type, the JSON envelope and body helpers, the caller of a request). Routes that could be abused on a public demo instance (outbound requests, credentials, settings, members, bulk writes) get.demoDenied()and a matching entry in the deny list ininternal/httpapi/demo.go(the test checks both agree). API tokens have a scopefull|read|agent|admin|app(side tablesapi_token_scopes,api_token_agent,api_token_admin,api_token_app):readtokens are refused on writes and/api/v1/sync;agenttokens write only through the agent content routes and MCP write tools;admintokens can do whatfullcan plus the credential and administration routes (second factor, passkeys, tokens, app passwords, user administration, SSO and secret-holding settings, encryption key record), which refusefulltokens. Admin tokens are created only from a recently confirmed session.apptokens are the OpenTodo app's access tokens, minted only by the app sign-in exchange (internal/mcpoauth/app.go,internal/httpapi/app_sign_in.go), and act asfull. - No telemetry, no third-party network calls by default except maps, no new mandatory env vars. Outbound requests go only to targets the operator or a user configured (webhooks, backup destinations, push services, the OIDC issuer, the SMTP server, the IMAP mailbox, assistant model providers, the speech-to-text service, calendar subscriptions, issue connection hosts), and, while maps are on, to the map provider: OpenStreetMap-based by default (OpenFreeMap tiles, Photon search), changeable or turned off by the owner, always through the server's map proxy (
internal/maps) with no account data. Addresses a person typed go throughinternal/outbound. - Keep it small, use what helps. A dependency is welcome when it makes our code simpler or smaller; no approval is needed first. Hard limits: an AGPL-3.0-compatible licence, no network calls of its own (rule 5), and the web app's first-load gzip budget (
web/bundle-budget.json, checked bymake bundle-budgetand the Web build job): load new code lazily, or raise the budget on purpose and say why. The pull request names the dependency, what it replaces and the bundle / binary size impact; one used in auth, encryption or sync code gets a security read.
Where things are#
- Server core:
cmd/opentodoentry point (cmd/otis the CLI,internal/cli: profiles, REST calls, table and--jsonoutput);internal/configenv (OPENTODO_*, nothing mandatory);internal/storeSQLite + embedded migrations (internal/store/migrations/NNNN_*.sql, applied byPRAGMA user_version), one writer connection plus a query-only reader pool (store.OpenReader, installed withsync.Service.SetReader): pure reads may use the reader, anything that reads then writes in one transaction stays on the writer; tests get a migrated database frominternal/store/storetest(OpenDir, a copy of one template migrated per test process) instead of migrating a new one, unless they test the migrations;internal/tenantbuilds one server around one data directory (database and lock, services, notifier, HTTP handler, background jobs);internal/tenant/servicesis the composition root:services.Buildconstructs, seeds and wires every service into aservices.Set, andhttpapi.New(set, web)only registers routes over it (no service is built or seeded while routes register; httpapi tests build their servers through it too);internal/hostoptionally serves many tenants from one process (registry, host-name routing, lazy open and idle close, one scheduler, per-tenant limits, the operator interface; only built withOPENTODO_HOST_URL);internal/jobsthe one model of background work (OpenSpecone-job-model): a job isJob{Name, Next, Run}(when it is next due, what to run),tenant.Jobsbuilds a tenant's list once and both a self-hosted server (jobs.Runner, only in the process holding the jobs lock) and the host scheduler run it; services report new work through the tenant'sjobs.Signal(Wakea job,Changedafter every commit),Upkeepis maintenance due only after a change; a new kind of background work is a new entry ininternal/tenant/jobs.go, never a goroutine of its own;internal/ratelimitkeeps the rate limits and agent limits across restarts (checks in memory; aStoreper tenant writes the changed windows tolimit_windowsthrough thelimitsjob and on close, keys hashed with a per-database salt; a new limiter ininternal/httpapiiss.limit(name, n, window));internal/syncop log + LWW + materialized reads, sharing scopes (scope.go) and membership (members.go);internal/httpapirouter/handlers/middleware (route policies inpolicy.go, demo deny list indemo.go);internal/webembedsinternal/web/dist;internal/idsUUIDs, name-based ids and random secrets;internal/dayparta task's part of the day (day-parts: Evening is the evening flag, Morning and Afternoonday_part; the one reading and the write pairing of REST, CalDAV, the agent tools, the CLI and the vault, likeweb/src/lib/dayParts.ts);internal/textutilsmall string helpers (Truncate: a byte limit cut on a character boundary, for every stored name or message);internal/themesthe theme document validator (Validate,Migrate; the same accepted and refused documents and codes asweb/src/lib/theme/format.ts, shared examples ininternal/themes/testdata/; the derivation and applying are client-only inweb/src/lib/theme/);internal/iconsetthe server's copy of the icon catalogue (names.jsongenerated byscripts/icons-sync.mjsfromweb/src/ui/icons/catalogue.json, checked by a test;Validis the one icon check of REST and MCP writes, sync accepts unknown names). - Accounts and security:
internal/authusers/sessions/tokens and their scopes, invitations, TOTP and recovery codes, passkey storage, provider identities, CalDAV app passwords (internal/auth/apppasswords.go);internal/webauthnpasskey verification (clientDataJSON, authenticator data, COSE keys;internal/webauthn/testauthis a synthetic authenticator for tests);internal/oidcsingle sign-on (discovery, PKCE, ID-token verification,OPENTODO_OIDC_*overrides;internal/oidc/oidctestis an in-process provider for tests);internal/auditthe closed catalogue of security events (typed constructors, an allow-list for details so task content never reaches the log, NDJSON export, retention);internal/e2eeend-to-end encryption helpers (content field list, ciphertext detection, key-record store; no crypto on the server; client inweb/src/lib/crypto.ts,e2ee.ts,e2eeSync.ts;internal/e2ee/cryptis the same format for theotCLI only, forot encryptionandot mcp --decrypt, pinned by the shared vectors and never linked into the server);internal/websignthe signed web app's file list (app-manifest.json: envelope, ECDSA P-256 verify, fingerprints, version order, the file check; the official keys and the report-only switch ininternal/websign/release-keys.json; the worker's side inweb/src/lib/appCode.ts, pinned by shared vectors; signing isinternal/websign/sign, linked only bycmd/websign(keygen,sign,verify), never by the server; OpenSpecsigned-web-app);internal/outboundthe policy for every request to an address a user or the owner typed (http(s) only, no private network targets unless the owner allows them, the connection pinned to the checked address; used by webhooks, and through their client by push and the assistant, and by calendar subscriptions and issue connections);internal/demothe public demo instance (OPENTODO_DEMO=true: a hidden owner, a private short-lived sandbox per visitor seeded through the op log, the nightly reset; HTTP side ininternal/httpapi/demo.go). - Features:
internal/settingsowner settings, the owner on/off switches (settings.Switch: cached, a default, an optional environment override; every switch's GET/PUT routes and 404 gate come frominternal/httpapi/switch.go) and secrets files;internal/backupsnapshots, archives, destinations, scheduler, restore;internal/pushVAPID keys, RFC 8291 encryption, subscriptions and the reminder scheduler (service worker side inweb/public/push-sw.js);internal/notifynotification sinks (in-app inbox; new event kinds go through optional sink interfaces such asnotify.MentionSink);internal/channelsa person's delivery channels (ntfy, Pushover, Gotify, a signed webhook: a notify sink plus a reminder-scheduler hook queue one message per channel and firing, one worker throughinternal/outboundwith the webhooks' retries, owner switchnotifications.channels, secrets in<data>/secrets/notification-channels.json; routes ininternal/httpapi/channels.go);internal/activityderives activity events from ops and must matchweb/src/lib/activity.ts(shared fixtureinternal/activity/testdata/activity_fixture.json);internal/webhooksigned outbound notifications for task and project events (derived from committed batches, durable queue in SQLite, one worker with retries, SSRF-safe client);internal/deliveryqthe queue machinery webhooks and notification channels share (parallel pass, log pruning, next-due times; each queue keeps its send and its outcome recording, the retry schedule iswebhook.Backoff);internal/pollthe bounded pass shared by the calendar feed and issue connection pollers;internal/compactionthe notes compaction job (supersedednotes_docand thinneddescriptionops older than 30 days viasync.CompactNotes, whose field tablesync.CompactFieldsa new document field joins; incremental vacuum, the one-time conversion of an older database, the report behindGET /api/v1/settings/storage);internal/caldaviCalendar/VTODO mapping and WebDAV XML (the/dav/endpoint ininternal/httpapi/davroutes, app passwords and the switch ininternal/httpapi/caldav.go, writes viaApplyStrictwith devicecaldav:<app-password-id>;internal/caldav/captureis a command that turns a client's request log into sanitised fixtures fordocs/caldav-verification.mdand is never linked into the server);internal/davpushpush to calendar apps (WebDAV-Push subscriptions of CalDAV clients indav_push_subscriptions, never an op; the job that pushes a subscribed calendar's change throughpush.Service.SendMessage, at most once per subscription every 30 seconds, behind the owner switchcaldav.push; the draft's XML ininternal/caldav/push.go, registration and the changes it reads ininternal/httpapi/davroutes/push.go);internal/calfeedcalendar feeds (other people's calendars read into read-only events, the user's tasks written as a calendar);internal/issuesissue import (per-user GitHub and GitLab connections behind the owner switchintegrations.issues, tokens in<data>/secrets/issues.json, REST clients oninternal/outboundwithout redirects, a poller on the jobs leader that turns open assigned issues into tasks and makes them follow the issue viaApplyStrictwith deviceissues:<connection-id>, never writing back; routes ininternal/httpapi/issues*.go);internal/calsynccalendar sync (a user's own CalDAV, Google or Microsoft calendar as the target of their dated tasks as events and the source of changes back: per-user connections behind the owner switchcalendar_sync.enabled, passwords, refresh tokens and the Google and Microsoft client secrets in<data>/secrets/calendar-sync.json, one transport interface under the cycle: a WebDAV client oninternal/outboundwith discovery,sync-collectionand conditional writes, and a Microsoft Graph client (calendarView/deltacursors incalsync_cursors, an extended property marking OpenTodo's events,If-Match), a cycle on the jobs leader that pulls before it pushes and writes viaApplyStrictwith devicecalsync:<connection-id>, the connected calendars' events stored as managed calendar subscriptions;internal/calsync/calsynctestis an in-process CalDAV server andinternal/calsync/graphtestan in-process Microsoft sign-in and Graph for tests; routes ininternal/httpapi/calsync*.go);internal/syncscopethe part of an account a calendar sync connection or a CalDAV app password covers (all, only or except chosen workspaces, projects and Inboxes; stored in a side table of the connection or the password, never an op; CalDAV hides calendars outside it and calendar sync gets its feed from the same view,davroutes.FeedTasksIn);internal/emailemail to task (optional IMAP polling of one operator mailbox viaOPENTODO_EMAIL_*, stdlib MIME and IMAP, per-user secret sub-addresses, Message-ID receipts; tasks viaApplyStrictwith deviceserver);internal/sttspeech to text (the owner's OpenAI-compatible transcription service,OPENTODO_STT_*, key in<data>/secrets/stt.json, requests throughinternal/outbound, audio and text in memory only; routes in the route packageinternal/httpapi/speech);internal/mailoptional outgoing email (owner SMTP configuration withOPENTODO_SMTP_*overrides, stdlib transport with an explicit TLS policy, plain-text templates in eight languages, sending limits; every message goes throughService.Send;internal/mail/smtptestis an in-process SMTP server for tests);internal/digestthe opt-in weekly email digest (per-user settings, scheduler on the jobs leader, content from materialized rows);internal/rulevalautomation rule values and the condition matcher (a leaf package internal/sync uses; shared vectorsweb/src/lib/rules/match.vectors.json);internal/rulesthe automation rules engine (planner sharingweb/src/lib/rules/plan.fixture.json, observer, durable queue, worker with limits and loop depth, minute scheduler for time triggers, run log, theautomations.enabledswitch withOPENTODO_AUTOMATIONS; writes viaApplyStrictwith devicerule:<rule-id>; routes ininternal/httpapi/rules.go);internal/importerown export, CSV and other apps' exports into ops (profiles to rows, planner, background jobs with undo, deviceimport;internal/importer/sanitizeis a command that turns a real export into a test fixture and is never linked into the server);internal/blobsattachment bytes as immutable files under<data>/attachments/(size and SHA-256 checked, streamed, never read whole);internal/locationa task's location and a saved location's coordinates (validation for every write path);internal/templatelibthe template library on the server (library.json, the same compiled file asweb/src/generated/templates.json, both written bymake templates; read by a routine's Create a project from a template step);internal/imgfitscaling of the images the server stores (a provider's profile picture, the owner's logo: centre crop, box-filter downscale, padding for maskable icons; standard library only);internal/mapsthe map proxy (owner switch andOPENTODO_MAPS*overrides, the provider's style rewritten to the server's own routes, tiles, fonts and sprites cached under<data>/cache/maps, Photon search; routes ininternal/httpapi/maproutes; client inweb/src/lib/locations.tsandweb/src/app/locations/, MapLibre GL loaded lazily). - AI agents:
internal/agenttoolsthe one registry of tools an AI agent can call (definitions, argument validation, planning into change sets, untrusted-text marking, write limits, the write permission gate,agent.writeaudit, the per-user "Allow AI assistants to make changes" switch inuser_agent_access);internal/mcpthe MCP server over that registry: read tools and read-onlyopentodo://resources behind the owner togglemcp.enabled, and write tools only when the owner'smcp.writesswitch and the user's switch are on and the caller uses anagenttoken (writes viaApplyStrictwith deviceagent:<token-id>; transport ininternal/httpapi/mcp.go);internal/mcpoauththe OAuth 2.1 authorization server that lets an app like Gemini reach that endpoint (registered clients, single-use authorization codes, grants whose refresh token never rotates, the PKCE check, scopesreadandagent; endpoints ininternal/httpapi/mcp_oauth.go, the access token minted throughinternal/auth);internal/relaythe device relay for encrypted accounts (opt-in devices bound to their session inrelay_devices, an in-memory hub that sends sealed decrypt and encrypt requests over each device's own stream and enforces the relay limits; never stores or logs a relayed value; routes ininternal/httpapi/relay.go, the agenttools hook inagenttools/relay.go, the device side inweb/src/lib/relay.ts);internal/assistantthe in-app assistant (owner configuration and provider keys, per-user consent and token usage, the Anthropic SDK and one stdlib Chat Completions adapter, an agent loop that runs read tools and plans write tools but never writes: the browser shows the proposed change set and applies the confirmed part throughmutateManywith deviceassistant:<device-id>). - Go ports of web logic, each pinned by shared vectors (all of them, with their fixtures and tests:
docs/contracts.md):internal/recurrence(web/src/lib/recurrence.ts;Compatible, likecompatibleRule, is the form every writer stores: the one 1.0 reads when it means the same thing;internal/recurrence/recurrence10is the frozen 1.0.0 rule grammar andCheck, test-only likeweb/src/lib/testdata/check10.ts, which the writers' tests run their rules through),internal/zonedtime-zone-fixed due values (web/src/lib/dates.ts) and the one Windows→IANA zone table (windowszones.go, generated from CLDR byscripts/windows-zones.mjs; used by the importers and calendar feeds),internal/inboxInbox membership: no project and not scheduled (web/src/lib/inbox.ts; used by the agent tools, the MCP views and the CLI),internal/sectortime sectors: a task's week, month or quarter, its relative name, carry-over and planning group (web/src/lib/sectors.ts; validates every write path and is used by the agent tools and the CLI),internal/notesearchnote search: matching, ranking and snippets over a note's Markdown (web/src/lib/noteSearch.ts; used by the note agent tools andot notes search),internal/notelinksthe internal link grammar of a note's Markdown:[title](?note=<id>),?task=,?project=, outside code (web/src/lib/noteLinkGrammar.ts; used by MCPget_note/get_tasklinksandlinked_fromon plaintext accounts,ot notes linksand the perf fixture),internal/reusereusable lists: title normalization, the matched item and the duplicate losers (web/src/lib/reusable.ts; used byPOST /api/v1/taskswithreuseandcreate_tasks),internal/flowproject flows and the one "available task" rule (web/src/lib/flow.ts; used by the method views, Today, theavailablefilter, the agent tools, the digest and the CLI),internal/framescalendar frame occurrences (web/src/lib/frames.ts; used by the frames routes andlist_frames),internal/freetimefree time: the working day minus calendar events, frames, slots and timed tasks (web/src/lib/freeTime.ts; used byfind_free_time, its device twin and the free time block),internal/closedlistToday's closed list: the slot fill of the Today limit (web/src/lib/closedList.ts; used bytoday_summaryandot today),internal/habitshabit numbers: scheduled dates, day states, kept, strength, streaks, at risk and back on track, the views oflist_habits,get_habitand the habits route, and the log planner oflog_habit(web/src/lib/habits.ts,habitLog.ts; used by the habit tools, the habits route,ot habitsand the routine steps),internal/urgencythe urgency score of the urgency order (web/src/lib/urgency.ts; used bylist_taskswithsort: urgencyandot list --sort urgency),internal/defaultreminderthe default reminder a task gets with its first due date (web/src/lib/defaultReminder.ts, applied bymutateMany; on the server by the REST task routes with?default_reminder=trueand the agent write tools, never by CalDAV, imports, sync connectors, rules or email),internal/filterthe filter query parser and evaluator (validates saved views; evaluates a routine's Find tasks,web/src/lib/filter/evaluate.ts, vectorsevaluate.vectors.json),internal/quickaddthe quick-add parser (web/src/lib/nlp; used by the CLI; the importer keeps its own Todoist date reader, whose rules differ),internal/origina task's origin: validation oftask.originand recognition of issue links (web/src/lib/taskOrigin.ts; used by sync, the CLI, the agent tools, the importers and email),internal/timetracktracked time: the one-running-entry rule and its repair, minutes, the day an entry belongs to, typed durations and the CSV export (web/src/lib/time.ts, fixtures ininternal/timetrack/testdata; used by the time entry routes, the agent tools, the filter parser and the CLI). web/Vite + React 19 + Tailwind 4 + Dexie.src/libdata layer (db, ops, sync, hlc, api, dates; a module the native app shares (the import graph of sync and ops,scripts/shared-graph.mjs, listed inmobile/app/shared-modules.json) reaches the host only through the platform portsrc/lib/platform.ts, never a browser global, checked byscripts/shared-boundary.mjs),src/appUI,src/uishared building blocks (Icon, Button, Field, Switch, Menu items, Combobox, Card, Badge, Avatar, Tabs, patterns; each with stories). Tests:*.test.tswith vitest + fake-indexeddb; interaction tests opt into// @vitest-environment happy-domand wait for conditions withwaitForfromsrc/ui/test-utils, never a fixed time (eslinttest-hygiene/no-fixed-wait).internal/perfseedthe 10,000-task account of the performance budgets (performance-budgets,docs/performance.md):cmd/perfseedbuilds it from a fixed seed through the op log (deviceperfseed), plain or encrypted, with a summary of counts and ids; a test keeps it out of the server, and its tests are the server's count checks at 10,000 tasks.internal/perfis the server half of the nightly time benchmark (-tags perf;make perf,scripts/perf/run.sh, the browser half inscripts/perf/run.mjs, the limits inscripts/perf/budgets.json, kept equal todocs/performance.mdby a repo check). The web app marksot:list-ready,ot:search-results,ot:sync-idleandot:remote-appliedin the browser's performance timeline only (web/src/lib/perfMarks.ts).internal/vaultthe Markdown vault behindot vault(CLI only, likeinternal/e2ee/crypt; a test keeps it out of the server): the Obsidian Tasks line grammar, the document parser and printer, the state file<dir>/.opentodo/state.json, the three-way merge per field and the sync loop overPOST /api/v1/syncwith devicevault:<id>; fixture vault ininternal/vault/testdata/vault/, pinned bydocs/vault.md.extension/browser capture extension (MV3, plain JS: a popup with Capture screen and Quick save modes;api.jsis its only network code;make extensionbuilds the Chrome and Firefox packages frommanifest.src.json).obsidian/the Obsidian community plugin (obsidian-plugin: TypeScript, desktop and mobile, no runtime dependency): send a line or a selection as tasks through the push-only sync exchange (deviceobsidian:<install id>, the per-device outbox, the token in Obsidian's per-device storage), bundling the quick-add parser,web/src/lib/e2eeEnvelope.ts/crypto.tsandhlc.tswith web's i18n replaced byobsidian/src/shims/i18n.ts;src/vault/line.tsis the TypeScript twin of the vault's line grammar (internal/vault/testdata/lines.vectors.json); strings inobsidian/locales/(checked bymake i18n-check);make obsidian(type-check, tests with web's vitest, build with a 250 KB budget),make obsidian-e2e; each release is pushed toOpenTodoApp/obsidian-opentodo(obsidian/scripts/mirror.mjs).mobile/native shells (native-shells):mobile/androidthe Android app (Kotlin, one Gradle module, AndroidX only, loads the web app from the configured server and talks to it through the bridge inweb/src/lib/shell.ts;make androidruns its tests, lint and checks and builds a debug APK; needs a JDK and the Android SDK;mobile/README.md); its store listing isfastlane/metadata/android/at the root, where F-Droid reads it (fastlane/README.md).internal/codesizea test-only package that keeps functions under 150 lines and files under 1,100 (see Conventions).docs/architecture, sync protocol, API, self-hosting.ROADMAP.mdmaps features to change names.
Conventions#
The working habits AGENTS.md points to, in full.
Commands. make dev runs the API on :8080 and Vite on :5173; make check is what CI runs; go test ./...; cd web && npm test && npm run build. Build the web app before go build or tests that import internal/web (make web); internal/web/dist/.gitkeep keeps the embed compiling on a fresh clone. A manual smoke test: ./bin/opentodo, then open http://localhost:8080; the first visit creates the owner account. The in-app help web/src/generated/help.json is generated and ignored by git: npm run help builds it from docs/ and runs first in npm run build, dev, test, typecheck and the Storybook scripts. Never commit it; after editing docs run make docs (the roadmap and keyboard guides, which stay committed) and make docs-check. The changelog takes one fragment per change, changelog.d/<Section>/<name>.md (Section: Added, Changed, Fixed, Security or Removed; name: the OpenSpec change name or a short slug; content: the entry's bullet in the CHANGELOG style), never an edit of CHANGELOG.md under ## [Unreleased]; make release-prepare assembles and deletes them, and make repo-check refuses a misplaced fragment or an entry under Unreleased (changelog.d/README.md).
Go. Time in internal/httpapi request logic is s.now() and in internal/auth s.clock(), never time.Now(); tests pin or step it with httpapi.WithClock, which also sets the auth and sync clocks (the httpapi test env exposes it as e.now). The stdlib net/http mux with method patterns, the JSON error envelope {error:{code,message}}, slog logging, errors wrapped with context. Functions stay under 150 lines and files under 1,100 (internal/codesize). HTTP handlers live by area in internal/httpapi: router.go registers every route, then middleware.go, auth_handlers.go, collections.go, sync_handlers.go, and so on.
TypeScript. Strict, function components, Tailwind classes, data access only through src/lib. Custom CSS classes live in @layer components so utilities can override them.
Design. Colours, type, radius, elevation and motion come from the tokens in web/src/index.css: no raw palette classes or hex in web/src/ui. Shared UI is built and checked in the Storybook workbench (make storybook, make ui-check). Screens use primitives from web/src/ui, never emoji or glyphs as icons (<Icon>, enforced by make ui-lint), and choose entities (people, labels, projects, tasks) with the Combobox. See the design system.
Docs. Front matter in docs/ is YAML parsed by both GitHub and web/scripts/docs/lib.mjs: double-quote scalar values (such as summary) that contain : or end in : (make docs-check enforces this).
Data. due is a floating {date: "YYYY-MM-DD", time?: "HH:MM"}; timestamps are Unix milliseconds. Priority 1 is the highest and 4 the default and lowest. Deletion is a tombstone (deleted_at): lists filter it out, the export includes it.