Retention schedule
How long the server keeps each kind of data (PLAN §17 Retention). These are the defaults; a school can shorten some of them for its own data, but nothing can lengthen them.
The same periods live in code in one place,
internal/privacy/retention.go,
and every retention sweep reads them from there. A test
(TestRetentionDocMatchesCode) fails if this table and the code disagree,
so change both in the same pull request. The Name column is the Go
variable; Period is written exactly as the code prints it (90 days,
13 months, 2 years, or - for no fixed period).
| Name | Data | Period | Notes |
|---|---|---|---|
| RawAnswers | Raw answers | 90 days | then only weekly rollups remain |
| Rollups | Rollups and word memory | - | while the learner exists |
| PlaySessions | Play sessions from linked games | 90 days | then deleted; daily totals of the child's own lists stay while the learner exists |
| LeftSchoolGrace | Learner who left a school | 30 days | grace period by default, then deleted |
| LeftSchoolGraceMax | Learner who left a school (longest grace) | 1 year | the most a school may set |
| InactiveFamilyWarning | Inactive family | 12 months | without sign-in, then warned |
| InactiveFamily | Inactive family | 13 months | without sign-in, then deleted |
| InactiveTeacherWarning | Inactive teacher workspace | 18 months | without sign-in, then warned |
| InactiveTeacher | Inactive teacher workspace | 19 months | without sign-in, then deleted |
| AIOutputs | AI outputs about a learner | 12 months | |
| ReportsAndModeration | Reports and moderation records | 2 years | child-safety evidence as the law requires |
| ChildSafetyEvidence | Evidence preserved for a child safety case | 1 year | after the case closes, then deleted; longer under a legal hold; kept when the account or organisation is deleted |
| ChildSafetyCases | Child safety cases and the reports made to authorities | 2 years | after the case closes, then deleted; longer under a legal hold |
| CopyrightNotices | Copyright notices and counter-notices | 3 years | after the notice is decided, then deleted; not while a counter-notice waits |
| ServerLogs | Server logs, with IP addresses | 14 days | |
| AuditLog | Audit log | 2 years | |
| BillingRecords | Billing records | 10 years | as tax law requires, at most; no learner data |
| Backups | Backups | 35 days | deletions reach backups within this |
| DeletionUndo | Undo window after a deletion | 7 days | then the deletion is final |
| DoneJobs | Finished background jobs | 14 days | |
| DeadJobs | Failed background jobs | 90 days | |
| DeadJobPayloads | Payloads of failed background jobs | 14 days | then cleared; done jobs' payloads are cleared at once |
| Sessions | Signed-in sessions | 30 days | at most; sooner when idle or signed out |
| AccountTokens | Email links (verification, password reset, sign-in, change of email) | 2 days | at most; deleted when used or expired |
| UnverifiedAccounts | Accounts whose email was never verified | 7 days | then deleted |
| KnownBrowsers | Browsers an account signed in from | 90 days | after the last sign-in from them, then forgotten |
| Invites | Invitations to join a family | 7 days | then deleted; at once when accepted or cancelled |
| PendingConsent | Learners waiting for a parent to confirm consent by email | 7 days | then deleted with their consent link |
| PendingParentLetter | Children in a teacher's own workspace waiting for a parent to connect and confirm consent | 30 days | then deleted, with their name, login card and any consent link |
| WithdrawLinks | Withdraw links in the email confirming a parent's consent for a child of a teacher's own workspace | 1 year | at most; deleted when used or when the consent is withdrawn by any route |
| RemovedLearners | Learners removed by their family | 7 days | the undo window, then deleted with their consents |
| PairingCodes | Pairing codes for linking a game | 1 day | a code works once, for 15 minutes, swept within a day |
| LinkRequests | Requests to link a game by QR code | 1 day | a request works once, for 15 minutes, swept within a day |
| DeviceTokens | Linked games' tokens | 90 days | unused, at most; deleted when the device is revoked |
| KidSessions | Children's sessions in the child view on the website | 1 day | at most; a session works for 2 hours, and ends when the child signs out |
| Devices | Linked games | - | while the learner exists; the name is cleared when unlinked |
| Exports | Downloads of a family's or learner's data | 7 days | then deleted; only the adult who asked can download one |
| DeletedFamilies | Families their guardian deleted | 7 days | the undo window, then deleted with everything in them |
| RoomResults | Boss Raid results of each raider | 90 days | then deleted; the raid's answers are kept as raw answers |
| ConnectCodes | Connect codes on letters for parents | 31 days | at most; a code works once, for 30 days |
| LearnerLinks | Families' connections to a school's learner | - | until the family or the school disconnects, or either goes |
| DataRequestDue | Parents' data requests to a school (time to answer) | 1 month | the school must answer within this |
| DataRequests | Parents' data requests to a school | 2 years | after the school answered, then deleted; open requests are kept until answered |
| ListPhotos | Pages photographed for a word list, and what the AI read from them | 1 day | at most; the picture is cleared as soon as it is read |
| ListAIRuns | List checks, Word Forge lists, sentences and core and stretch versions the AI made for an adult | 7 days | at most; what was applied or saved stays in the list |
| ClassAIRuns | Class insights and report comment drafts the AI made for a teacher | 30 days | at most; focus groups and lists the teacher made stay in the class |
| RosterConnections | A school's connections to its information system, with their credentials | - | while the school is connected; disconnecting deletes them |
| RosterImports | Log of a school's roster imports and syncs (counts only) | 1 year | then deleted; learner IDs from the school's system stay while the learner is at the school |
| SSOSignIns | Sign-ins with a school account waiting at Google, Microsoft or Clever, and games waiting for a pupil to sign in | 1 day | at most; each works once, for 10 minutes |
| SSOAddresses | Pupils' school addresses for signing in with a school account | - | while the learner is at the school; a teacher can clear one |
| WordCounts | Weekly counts of a learner's known and mastered words | 1 year | then deleted, but the newest; they go with the learner |
| BetaInvites | Beta invite codes and allowlisted addresses (hashed) for invite-only sign-up | 90 days | at most; an address is deleted when its adult signs up |
| FriendGroupInvites | Invite codes for a friend group | 8 days | at most; a code works once, for 7 days |
| FriendGroups | Friend groups and which children are in them | - | until a guardian takes the child out or the group ends, or the child or the family goes |
| RankSettings | Which ranking boards a learner is on, and an organisation's ranking settings | - | until an adult turns a board off, or the learner or the organisation goes |
| RankRuns | Finished Hardcore and Daily Dungeon runs sent for rankings | 400 days | then deleted, but each learner's best Hardcore run in each language; they go with the learner |
| RankEntries | Ranking boards as last computed | - | this season's and last; computed again every few minutes, so a learner taken off a board goes at once |
| StripeCustomers | An organisation's Stripe customer and subscriptions (IDs, plan, status, dates) | - | while the organisation exists; its Stripe customer is closed within a day after it goes |
| StripeEvents | Stripe's payment events (IDs and type only) | 30 days | then deleted |
| SchoolBilling | A school's quotes, orders and tax exemption certificates | - | while the school exists; Stripe keeps its invoices as the tax records |
| Groups | A group's policy and join code, and the lists its schools share with it | - | while the group exists; a shared list leaves it when made private or deleted, or its school leaves |
| Pronunciations | Spoken words and sound-outs (words only, shared by everyone) | 1 year | unused for this long, then deleted |
How it is enforced
Pages photographed for photo to list (
list_photos, W4.3) expire 23 hours after upload; an hourly sweep deletes them, and the AI output read from each, so nothing is kept for more than a day. The picture itself is cleared as soon as the AI has read it.Requests to the list helpers (
list_ai_runs, W4.4: list check, Word Forge, sentences for a list) expire 7 days less an hour after they are made; an hourly sweep deletes them and the AI outputs made for them. Their input (the list's words, or the topic) is cleared as soon as the AI has answered.Class insights (
class_ai_runsandclass_ai_learners, W4.5) expire 30 days less an hour after they are asked for; an hourly sweep deletes them, who was in which group and the AI outputs made for them. The focus groups and lists a teacher makes from them are the class's own and stay until the teacher deletes them. Report comments (W4.6) are runs of the same kind: the sweep deletes them, the teacher's edited drafts and the AI's drafts, which are also deleted with their learner.Riddles added to a list with its sentences (
list_riddles, W4.8) are kept with the list, like its sentences, and deleted with it. What Halpwords AI makes for a linked game (W4.8) is an AI output about words only, kept like other AI outputs (AIOutputs).Friend groups (
friend_groups,friend_group_members, W7.1) are kept while they are used: a guardian takes their child out, or the family that made a group ends it, and both go with the child and with either family. When the child's own family takes them out of their last group (or ends it), theirfriend_groupsconsent is withdrawn; when another family's maker takes them out or ends the group, only the membership ends and the consent stays (only the child's family, or the teen for their own agreement, withdraws a consent). Invite codes (friend_group_invites) work once and for 7 days; a new code replaces the old one, and the daily friend group sweep deletes expired ones.Ranking settings (
rank_settings,rank_org_settings,rank_classes, W7.2) are kept until an adult turns a board off, and go with the learner, the class or the organisation. Turning a family child's last board off withdraws the guardian'srankingsconsent.Runs sent for the rankings (
rank_runs, W7.3) are kept only for learners on a board when they arrive, for 400 days; the daily rankings sweep deletes older ones, but each learner's best Hardcore run in each language, which is their all-time place. A removed run stays marked for 90 days so that repeated removals take the learner off every board. The boards (rank_entries) are computed again every few minutes from the runs of learners on a board now, and keep this season's and last season's places only. Both go with the learner.Sign-ins with a school account (
sso_logins, W5.4) and games waiting for a pupil to sign in (sso_device_codes) work for 10 minutes and once; they are deleted when used, and the daily single sign-on sweep deletes expired ones. Pupils' school addresses (sso_pupils) go with the learner, and when the learner moves to another school.A nightly retention job runs the sweeps and logs how many rows each deleted (counts only, never what was in them). The sweeps are added by the tasks that add the data; the audit log's sweep is
audit.Sweep(W0.8); accounts, sessions, email links and known browsers are swept by the dailyaccounts.sweepjob (W1.1), which also deletes unfinished sign-in steps (auth_challenges, which stop working after 10 minutes, W1.2). Passkeys, authenticator apps and recovery codes are kept until the adult removes them, and go with the account. Expired invitations and families nobody belongs to any more are swept byorgs.sweep, and removed learners and learners whose consent was never confirmed bylearners.sweep(W1.3). Expired pairing codes and device tokens are swept bylink.sweep(W1.7), and expired connect codes for parents by the connections sweep (W2.8). Boss Raid results (room_results) are swept bybossraid.sweep(W7.5). device tokens are swept bylink.sweep(W1.7), which also deletes expired child-view sessions (W2.11), and expired connect codes for parents by the connections sweep (W2.8).The nightly retention job (W1.12,
rights.Retentionininternal/privacy/rights) deletes families past their undo window after their guardian deleted them, warns inactive families by email at 12 months and deletes them at 13 (a sign-in in between cancels the warning), deletes expired data exports and every other table the data inventory says is kept "until expired", and runs the audit log's sweep. What a deletion removes is not listed in code: it reads the live schema and the data inventory, so a table added later with alearner_idororg_idcolumn is covered at once.A school can shorten two periods for its own data on its privacy page (W5.9): raw answers (14 to 90 days) and AI outputs about its learners (1 to 12 months). The fold job (
gamesync.Fold) and the AI sweep (ai.Gateway.Sweep) use the shorter period for that school's rows. Answered data requests are deleted by the nightly retention job once expired, like data exports.Deletions reach backups when the backups that still hold the data expire, within the Backups period.
Server logs are rotated by the host (journald and Caddy) to the Server logs period (W0.10) on a server of its own. On the Docker host the app's log is its docker log, which goes with the container: hwctl recreates the container after 7 days, so it is kept at most 8 days.
On the Docker host (deploy/docker), which runs test, staging and, since ADR 0002, prod with real children's data, every env's copies stay inside these periods: nightly encrypted backups 14 days on the host and 35 days in B2 (old versions deleted too), plain snapshots before deploys at most 34 days, copies set aside by a restore or rollback 14 days, backups brought in for a restore 14 days, dev mail (sign-in links) 1 day, and the container's docker log at most 8 days (
hwctl backupprunes all of them nightly, each env at its own time). Each env's B2 copies are under its own prefix:test/,staging/,prod/. The test server's copies from before its move, underhalpwords/, are pruned by the same rule until none is left. Before prod goes live, each env's B2 application key must be its own, limited to that env's prefix, so a key from test or staging can neither read nor delete prod's copies. Staging and test hold test data only, never copies of prod: no operation copies a database between envs.The env folders also keep
state/config-prev/, the configuration from before the last config apply (settings and keys, no personal data), until the next apply replaces it.🧑 Traefik's access log on the shared host is not ours to configure from this repository. [DECIDE: the owner confirms whether the host's Traefik keeps an access log (it would hold every visitor's IP address, prod's children included) and that it is kept no longer than the Server logs period.]
The ops console (docs/admin/ops-console.md) keeps only the owner's data and counts, never families' or children's:
- its audit log keeps the owner's IP address for 14 days; an hourly
sweep then removes it (and its nonce) from each entry, leaving a
hash so the chain still checks. The log has its own rotation: at
10 MB
audit.logis renamedaudit-<time>-<seq>.logand a new one starts. [DECIDE: the rotated files, which hold no IP addresses after 14 days, have no deletion period yet]; - the host's job logs (
state/jobs/, each operation's events, never what it was sent) are deleted after 30 days, andlogs/dispatch.log(one line per call: time, operation, env, job, result, duration; no addresses and nothing sent to it) is renameddispatch.log.1at 4 MiB, replacing the one before; - the console's stats history keeps one row of counts per env per
week (small counts suppressed before they are stored, and the counts
of learners kept rounded down to a multiple of 5), at most 104
weeks, in
stats-<env>.json. Nothing about a person is in it; - the vault holds every env's configuration and keys, not personal
data. The console keeps the current file and the last 20
generations; a rekey re-seals those to the new key. Downloads of the vault are the
owner's own copies, outside these periods: delete old ones after a
rekey.
vault-seenholds only the newest generation number seen; - the passkeys (
auth.json) stay until the owner removes them. The file also holds a random key that signs the console's "signed in here before" cookie (__Host-hwops-trust, a strictly necessary security cookie that lasts 180 days in the owner's browser).hw ops-reset-authsets the old file aside asauth.json.reset-<time>, which stays until deleted by hand (this ends every such cookie), and the setup code works for 30 minutes.
- its audit log keeps the owner's IP address for 14 days; an hourly
sweep then removes it (and its nonce) from each entry, leaving a
hash so the chain still checks. The log has its own rotation: at
10 MB
Each table's retention is also listed per column in the data inventory.