# Equipo housekeeping: a tidying loop that stays under control

Status: design for Paul's review, 2026-11-08, revision 3 after Astra's
rounds 1 and 2 (NOT READY at cc6ca41; READY AFTER FIXES at f94fad0). Drafted by Claude (Fable 5.1) on
`design-housekeeping` from `thin-v1-conn1` (7946111). Builds on thin v1
(`2026-11-06-equipo-thin-v1.md`), Connections rev 3
(`2026-11-08-equipo-connections.md`, §§3, 4, 6) and the progress logs
for slices 2b, 3, 4, 4c, CONN1 and UX1. Paul's rulings of 2026-11-08
are folded in (§9). Not implemented.

## 0. Why, and the shape of the answer

Paul, on the duplicate tasks the coordinator kept filing: "Can Equipo
itself tidy up the duplicates? This is where I guess we need to start
thinking about loops where it pro-actively tries to keep everything tidy
and to spot things to improve (whilst not going out of control)." And
later: the loop is the basis of continual improvement that Equipo should
suggest and manage "across the whole business / organisation / family".

Equipo already has the pieces of a loop without the loop. Move-in and
explore turns run with no person message and only read and note tools.
The notebook holds what the coordinator has learned. The runner checks
reach every minute and watches merged branches. The merge policy is
deterministic and runs in `advance`. Duplicate detection is being built
on `thin-v1-ux1`: same-creator, high-similarity pairs are combined with
an Undo receipt (`Task.folded`, `CardCombined`,
`POST /tasks/{id}/uncombine`); weaker matches get a "Possible duplicate
of" link. The mutation ledger makes writes idempotent across attempts.
Usage records every attempt.

Housekeeping is the rule that joins them: **deterministic detectors
notice things; a policy table says what each class of thing may become;
a reserved budget, a ledger with a state machine and one Pause switch
keep it bounded; everything it does leaves a receipt with Undo; and
anything that depends on a model's judgement becomes a suggestion, never
an action, until a person taps.** No setup: the loop is on from the
first message, with defaults, and the only control a person needs is
Pause.

Two invariants hold everywhere below and are tested as such. **No
forbidden effect is reachable**: every write the loop makes goes through
the shared store functions under a server-derived housekeeping principal
that checks current membership and the owner of every affected resource
inside the transaction. **Model judgement is never an action**: a model
may shape the words of a suggestion and nothing else.

## 1. Scope: teams, subjects, who sees what

Everything in this spec belongs to a **team**: the roster that shares a
conversation server today, which in time may be a business, an
organisation or a family. Within a team, every finding, action and
suggestion has a **subject**: `{kind, id}` where kind is `task`,
`project`, `connection`, `notebook_entry`, `person` (a person's own area)
or `team`. The subject decides authority and visibility by one rule:
**a subject owned by one person is that person's business; a subject
owned by the team is everyone's to see and the owner's to act on.**

A task's subject owner is its creator ("only a task's creator acts on
it" stands, and it applies to the *destination* of a fold as well as the
source). A connection's owner is its person. A notebook entry's owner is
the coordinator's person. A project and the team itself are team
subjects. The loop runs **per person**: each person's coordinator keeps
that person's own subjects tidy, draws on that person's connections and
budget, and posts receipts into that person's conversation. Team
subjects produce suggestions visible to the whole roster and nothing
more until slice 4, which adds acting on team subjects by the owner. A
person sees a suggestion if its audience is them or the team; a person
may accept a suggestion if they could create the task it describes (any
member for team subjects, the owner for personal ones); dismissing is
per person for team suggestions and final for personal ones.

**The housekeeping principal.** Every loop write runs as
`housekeeping{team, person, detector, finding_id}`, built by the
instance from the ledger row, never from a frame or a tool argument. It
is passed into the same store functions a person's request uses
(`foldTask`, `retryStep`, `recordSuggestion`), and those functions
check, inside the write transaction: the person is a current member; for
every task touched, including a fold's destination and any task a
suggestion is linked to, the creator is the principal's person; for a
notebook entry, its person; for a team subject, that the class permits
it (propose only before slice 4). A principal that fails any check gets
`housekeeping_forbidden`, the ledger row becomes `refused`, and nothing
else in the transaction survives. Handlers are not the only gate: the
detectors run inside `advance`, so the gate is in the store.

## 2. Detectors: a registry of small declared units

A **detector** is a declared, data-driven unit in a registry
(`internal/equipo/housekeeping`), never free code in a handler. Each
declares: `id`; subject kind; `class` (§3); `triggers` (event types from
the stream, plus `sweep`); `judgement` (`none` or `model`); `rate` (at
most N findings per subject and per team per period); and `Detect`, a
pure function from a read-only view of the store to zero or more
**findings** `{detector, subject, subject_revision, key, evidence,
proposal}`. The key is the finding's identity (`duplicate:tkA:tkB`,
`retry:tkA:chain2`); the ledger (§4) decides whether it may act.
Evidence is structured fields the receipt and the page render, never
model prose. A detector with `judgement: model` may only have class
Propose: the registry refuses any other combination at start-up
(`TestRegistryModelMeansPropose`). Adding a detector is a registry entry
and a fixture; nothing else changes, which is what lets the non-code
detectors of §8 arrive later.

| Detector | Fires on | Class | Judgement |
|---|---|---|---|
| `duplicate_same_creator` | `record_task` (or the sweep) where two of one creator's open tasks in the same project overlap at or above 0.75 with three shared title words, or 0.7 with five across title and brief (UX1's thresholds as shipped; kept by the controller 2026-11-08), both tasks owned by that creator and checked again in the transaction. The one furthest along is kept (stage, then not stopped, then the older); the other closes. Only a pending decision on the task that closes (an open card other than its task card) or a step at work on it blocks the combine; an open card on the task kept, a merge card included, does not, and stays open on it (coordinator's ruling 2026-11-11, on Paul's "combine automatically with Undo": staging's Woodstar pair keeps `tkf6dufnbzcg` at Ready to merge and closes the stopped `tks6kwzzdngr`) | Act and tell: combine, receipt with Undo (built on `thin-v1-ux1`) | none |
| `duplicate_possible` | overlap at or above 0.6 with two shared title words, or 0.5 with three across title and brief, or any such overlap across creators | Link only: "Possible duplicate of" on the new task, `Task.duplicate_of` as UX1 | none |
| `retry_transient` | a step that **never pushed a candidate** stopped with `runner_restarted`, `interrupted`, `provider_failed`, `clone_failed`, `candidate_unavailable`, `checks_timeout` or `no_runner`, termination proven, no earlier automatic retry in this failure chain | Act and tell: one retry per chain, Undo until the retried step starts (slice 2) | none |
| `ready_waiting` | a task at Ready to merge with an open card or no card for over 24 h | Digest mention only, never a new card | none |
| `branch_gone` | the merge watch finds the task branch deleted on the forge without a merge | Needs you `branch_moved`, as today; digest line | none |
| `stale_project` | no task, message or push in 60 days | Propose: "Archive <project>?" (team subject, slice 4) | none |
| `flaky_check` | the same gate fails then passes on the same SHA (a Retry of checks), twice in 30 days | Propose, with both tails as evidence | model, slice 3, to name the test |
| `findings_unaddressed` | Review findings on a merged task naming files the fix rounds never touched | Propose | model |
| `notebook_stale` | an entry whose `repo` source file changed since it was written, or an `own` entry older than 90 days | Propose: "This note may be out of date" with a one-tap Mark stale | model for "contradicted", words only |
| `repo_reach` | hello catalog gains or loses a repository | Digest line; a lost repository with open tasks: the existing access card | none |
| `connection_health` | `limited` with a reset over 48 h away, `sign_in_again`, a key expiring within 7 days | The existing Needs you once; digest line otherwise | none |
| `improvement_noticed` | a specialist calls `note_improvement{text, repo, path}` during a step | Propose: one suggestion per note | model, to merge near-identical notes |

`notebook_stale` never hides an entry on its own; the tap does, as a
person's action with the ordinary Undo. Cross-creator duplicates are
links in every slice of this spec. Thresholds are constants beside the
detector and appear in its fixture; the similarity function is
`record_task`'s.

## 3. Action classes and the policy table

Four classes, named in the registry, enforced in the store under the
principal of §1, never by detector code or a model.

**Act and tell.** Deterministic only, within the person's own subjects,
no model spend, undoable for seven days or until a later change makes
the undo impossible (409 with the reason, as the home card's Undo). The
action, its receipt card and its `housekeeping` event are written in one
transaction with the ledger transition (§4); the card appears on the
Housekeeping view at once and in the conversation at its `visible_at`
(§4, quiet hours). Undo restores the prior state through the same store
functions a person's Undo uses (`uncombine`, which restores the folded
task and its thread exactly and removes the fold from the destination)
and moves the ledger row to `undone`, a retained veto.

**Automatic retry, its Undo and its fencing** (slice 2). The action is
the ordinary `RetryTask` path under the principal, so it does what a
person's Retry does: the step goes `queued`, `attempt` becomes n+1, and
`reason`, `pushed`, `terminated`, `summary`, `headline`, `log_tail`,
`activity`, `started_at`, `finished_at` are cleared; for Engineering
without a republish `candidate_sha` and `from_attempt` are cleared too;
the task's `stage` returns to `in_progress` and its `needs_you` is
recomputed. The ledger row's `result` therefore stores the **complete
snapshot** of every one of those fields, on the step and on the task,
plus both revisions, before the call. Undo is offered only while the
retried step is still `queued` on the instance and no `step{running,
attempt: n+1}` report has been accepted. Undo writes, in one
transaction: a durable `cancel_step` for attempt n+1; the snapshot's
fields back onto the step and task; and `undone_attempt = n+1` on the
step. **Attempts never go backwards**: the step keeps `attempt` n+1 and
the snapshot's `state`, `reason` and Needs you, so a later report for
attempt n+1 is accepted only if it is the termination (the instance
already drops reports for attempts below the current one; this adds
dropping non-terminal reports for an `undone_attempt`). A person's Retry
after an Undo gives attempt n+2 as usual. If a `running` report for n+1
commits first, the Undo gets 409 with the current action and the person
is pointed at the ordinary Cancel. Nothing about merge eligibility is
special here: the retried task earns `merge_eligible`, `ready_sha` and
its cards through the slice 4c policy as any task does; what housekeeping
may never do is write those fields or a merge card directly, and the
principal's store functions refuse those writes.

**Propose.** Creates a **suggestion** (§5), never a task, and writes to
no other resource. De-duplication against tasks records
`Suggestion.related_task` on the suggestion; it never appends to the
task. Costs nothing unless `judgement: model`, in which case one
reserved housekeeping turn.

**Ask once.** Shared, irreversible or costly; a Needs you card asked
once per key, answered by the subject's owner only. In this spec it is
used only by `stale_project` in slice 4. Automatic retries of pushed
work are not asked: the existing Needs you `retry` card already covers
them and is unchanged.

**Never.** Delete tasks, projects, branches, notes or usage rows; merge,
or alter `merge_eligible`, `merge_asked`, an open merge card or the
checks-exception decision (combining another task into one with an open
merge card is allowed and leaves that card, its SHA and its answer
exactly as they were; closing a task that has a decision still open is
not); touch another person's task or notebook,
including as a fold's destination; create or start a task from a
suggestion without a tap; dispatch past the reservation or on a
connection that is `limited` or of unknown tier; post more than receipts
and one digest line a day; change a setting. Refused in the store, a
`refused` ledger row, shown on the view.

| Class | Needs | Costs | Reversal | Tells the person |
|---|---|---|---|---|
| Act and tell | own subject, deterministic, reversible | 0, or one reserved step (retry) | Undo, 7 days (retry: until the step starts) | receipt card, digest |
| Propose | any subject | 0 or one reserved turn | dismiss | Suggestions lane, digest |
| Ask once | shared or irreversible, owner answers | 0 | the answer | one Needs you card |
| Never | | | | refused, on the view |

## 4. Control

**Budget by reservation.** Per person per day (Paul's ruling): 4
judgement turns, 150,000 tokens and 3 automatic retries. A ledger row
that will spend holds a **reservation** written in its `claimed`
transaction: the claim sums today's reserved and charged figures for the
person and refuses the claim (`held`, §4 ledger) if the new reservation
would exceed any limit, so two concurrent claims cannot both pass. A
judgement turn reserves one turn and its share of the day's tokens,
150,000 / 4 = 37,500, so all four turns fit (Paul, 2026-11-08; the
token budget stays the binding total). A retry reserves one
retry and 100,000 tokens, covering the retried Engineering step and the
review and checks that follow it, and an execution cap: the retried step
runs under the ordinary `step_timeout`, at most the ordinary two fix
rounds, and every step it causes carries `caused_by: <action_id>` on
dispatch and on its usage rows. If today's remaining tokens are below a
reservation, the claim is `held`.

**One cap across attempts.** Every frame the reservation pays for
carries `max_tokens` = reserved minus charged so far, so a failover or
a second attempt inherits the remainder, never a fresh cap; below a
floor of 5,000 the turn or step ends `failed` with reason `budget`, and
the harness's own limit enforces the figure. Usage rows are charged to
the action as each attempt's row arrives; when a step overruns its
share, the overrun is charged and the day's remaining tokens shrink by
it (person turns are never budgeted, so nothing of theirs is taken).

**Release only after reconciling.** A reservation is released only when
the attempt's termination proof has arrived **and** its usage has been
charged: the row's figure when `complete: true`, the harness's partial
figures when `complete: false`, and the **whole reservation** when no
figure came at all (unknown is charged in full, never zero). Until then
the row is `releasing` and still counts against the day. Yield, Pause
and cancel all go through this path.

**Stand-down.** Housekeeping dispatches nothing that spends when any
limit is reached, and the headroom test applies to the **connection the
choice function actually selected**, never to the fleet: the selected
pair's headroom must be reported, checked within the last fifteen
minutes (`checked_at`, re-probed if older by the §2.7 probe of
Connections), and below 0.8 utilization; otherwise the claim is `held`
and no other connection is tried in its place. Unknown headroom means
stand down, not proceed. Deterministic actions that spend nothing
(combine, digest lines) carry on. The digest says "Housekeeping stood
down: today's budget is used" or "... Claude is near its limit".

**Tier at selection.** A housekeeping turn asks the choice function for
role `housekeeping` with a **tier ceiling** of `cheap`: pairs above the
ceiling are filtered out before stickiness or preference apply, and if
none remains the turn is `held`. Tiers come from Connections slice 3;
until that lands, no pair has a tier, so judgement turns do not run and
slice 3 of this spec waits on it.

**Person turns pre-empt**, in three places. In the queue: `dispatchNext`
takes person turns first, then move-in and explore, then housekeeping.
On yield: a person's message cancels a running housekeeping turn as it
does a move-in (`yielded`), its reservation goes to `releasing` until
termination and the charge are in, and the finding returns to `held`.
On steps: a retry dispatched by housekeeping is
deferred behind any step a person started and never runs beside one; a
person's own Retry on the same task supersedes it, and the housekeeping
attempt is dropped as `superseded`.

**Cadence.** Event-driven first: each detector lists its event types
and `advance` runs the registry for the affected subject inside the
transaction that wrote the event. Plus one **daily sweep** per person at
03:00 in the person's zone (UTC until known) for the time-based
detectors; one pass, never a loop.

**Rate limits** are in the registry: `retry_transient` one per failure
chain; `duplicate_same_creator` unbounded; `flaky_check` once per gate
per week; `improvement_noticed` five per task; and a ceiling of ten
actions and five new suggestions per person per day, after which
findings are held.

**The ledger state machine.** `chat_housekeeping` (§6) is the loop's
memory, unique on `(team, detector, key)` for team subjects and
`(team, person, detector, key)` for personal ones, and every row moves
only forward:

- `claimed`: inserted with `claimed_at`, the reservation and the
  subject's `subject_revision`. A key that already exists is a no-op
  unless it is `held`, `failed` with no recovery yet, or `vetoed` past
  its window with a recurrence left (below).
- A deterministic action that spends nothing claims and acts in **one
  transaction** (`claimed → done` never commits separately). A spending
  action commits `claimed` first, dispatches, and moves to `done` on the
  report.
- `claimed → done`: the action, its receipt and its event, in one
  transaction. `claimed → refused`: the principal check failed.
  `claimed → failed`: the action errored; the sweep may re-claim a
  `failed` row once, then it stays.
- **Recovery.** A row found in `claimed` at start-up, or older than ten
  minutes at any sweep, is revalidated: the subject is read and its
  revision compared with `subject_revision`. Unchanged and nothing
  dispatched (no attempt recorded): the claim is **released** to `held`
  and re-run as a fresh finding. Unchanged and dispatched: the row waits
  for the runner's `sync` to settle the attempt, as steps do, then
  advances to `done` or `failed`. Changed: `expired` with reason
  `subject_moved`, the reservation reconciled as in §4 and released.
  A row never silently stays `claimed`.
- `done → undone`: a retained veto; the key never acts again.
- `held`: capacity or budget was lacking, or the turn yielded; a held
  row is claimed when the next sweep or event finds room. At most 20
  held rows per person; beyond that the oldest is dropped as `expired`.
- `vetoed`: a dismissed suggestion's key. Within 30 days the key is a
  no-op. After 30 days, while `recurrences` is 0, the next finding
  re-claims the row and sets `recurrences` to 1; once it is 1 the key is
  a no-op for ever, whatever the window.

**Verdicts through the mutation ledger.** `housekeeping_verdict` is a
designated mutation (`MutationKinds` gains `verdict`), target the
finding id, idempotent per finding across the turn's attempts like any
kind. The instance accepts a verdict only if its `finding_id`, `subject`
and `subject_revision` match a finding it issued in that turn's frame
and the subject has not moved; anything else is refused, recorded as an
error for the detector, and the finding stays `held` for one more turn.
A yielded or failed turn leaves its findings `held`; a replayed verdict
after failover is answered from the ledger with `replayed: true`.

**Quiet hours.** 22:00 to 08:00 in the person's zone: the loop may act
and claim, but every receipt and digest line gets `visible_at` 08:00 or
the person's first message, whichever is first. The Housekeeping view
shows them at once.

**Pause.** One switch, `PUT /api/v1/housekeeping {paused}`. Paused: no
detector runs, no sweep, nothing posted; running housekeeping turns and
retries are cancelled and their reservations reconciled and released
through the path above; existing Undo stays.

**The digest.** Once a day when something happened, one instance-written
line: "Tidied 2 things, suggested 1. [Housekeeping]".

**The Housekeeping view** (`/housekeeping`, beside Notebook in the
header): Pause; today's three budgets as quiet meters, reserved and
charged; actions newest first with evidence and Undo while possible;
suggestions; refusals and errors; detectors with state, reason and the
re-enable switch.

**Failure containment.** Failures are counted in
`chat_housekeeping_failures` written in its **own transaction after the
action's rollback**, so an error cannot erase its own record. A detector
is auto-disabled for a person when, within seven days, it accumulates
two of: an action undone, an action `failed`, a judgement turn `failed`
or refused for a forged verdict, or a retried step that failed again. It
says so once in the digest and the view offers the switch
(`PUT /housekeeping/detectors/{id} {enabled}`); re-enabling clears the
count. Nothing re-enables on its own.

## 5. Suggestions

A suggestion is a row (§6) with a title, a short text, structured
evidence, a subject, an optional `related_task` and an audience. Paul's
ruling: it shows as a **folded "Suggestions (3)" group at the bottom of
the Tasks page**, collapsed by default, rows muted with no track, and in
full on the Housekeeping view. No sidebar count.

Two quiet actions per row. **Make it a task** calls `record_task` as
the tapper, with the suggestion as brief and its project, through the
ordinary path including the duplicate check; the suggestion becomes
`accepted` with the task id. **Dismiss** marks it `dismissed` and vetoes
its key for 30 days.

Suggestions **decay**: 14 days open becomes `expired`; expired and
dismissed rows are kept 30 days for the view, then deleted by the
retention sweep that trims usage rows.

**De-duplication**, in order: by key against open and recent
suggestions (no-op); against open tasks in the same project by
`record_task`'s similarity, in which case the suggestion is still
created but `related_task` is set and the row reads "Related to [task]"
(the task is not written to); within a judgement turn, where the model
may merge near-identical `improvement_noticed` findings into one
verdict, binding every merged finding id. **At most five open per
person** (ten team-wide); a sixth is `held`.

## 6. Data model, API v1, wire, tests

**Tables** (migration 0050):

- `chat_housekeeping`: `id`, `team`, `person` (null for team subjects),
  `detector`, `subject_kind`, `subject_id`, `subject_revision`, `key`,
  `class`, `state` (`claimed`, `held`, `done`, `undone`, `refused`,
  `failed`, `vetoed`, `expired`), `claimed_at`, `attempt` (the dispatch
  it made, null before), `reserved {turns, tokens, retries}`, `charged
  {turns, tokens, retries, complete}`, `releasing` (bool), `evidence`,
  `result` (the full undo snapshot of §3), `visible_at`, `undo_until`,
  `recurrences`, `expired_reason`, `at`, `undone_at`, `revision`; unique
  indexes as in §4.
- `chat_housekeeping_failures`: `person`, `detector`, `kind`, `at`.
- `chat_suggestions`: `id`, `team`, `audience_person`, `detector`,
  `subject_kind`, `subject_id`, `project`, `key`, `title`, `text`,
  `evidence`, `related_task`, `state` (`open`, `held`, `accepted`,
  `dismissed`, `expired`), `task_id`, `created_at`, `expires_at`,
  `revision`; `chat_suggestion_dismissals (suggestion, person)`.
- `chat_housekeeping_settings`: `person`, `paused`, `disabled` (JSON:
  detector to reason and time), `last_digest_at`, `revision`.
- `chat_turns.kind` gains `housekeeping`; `chat_usage` gains `role`
  value `housekeeping` and `caused_by`; `chat_steps` gains `caused_by`
  and `undone_attempt`.

**Resources.** `GET /api/v1/housekeeping` returns `Housekeeping {paused,
budget {turns {reserved, charged, limit}, tokens {...}, retries {...}},
detectors[{id, class, enabled, disabled_reason}], actions[], refusals[],
revision}`; `PUT /api/v1/housekeeping {paused, revision}`;
`PUT /api/v1/housekeeping/detectors/{id} {enabled, revision}`;
`GET /api/v1/housekeeping/actions?before=&limit=`;
`POST /api/v1/housekeeping/actions/{id}/undo` (409 with the current
action when no longer undoable); `GET /api/v1/suggestions`;
`POST /api/v1/suggestions/{id}/accept` returns `TaskAccepted`;
`POST /api/v1/suggestions/{id}/dismiss`. Events `housekeeping` and
`suggestion`. `Snapshot` gains `suggestions` and `housekeeping_summary
{open_suggestions, paused, disabled}`. `Card` gains kind `housekeeping`
with `action_id`, `visible_at` and `ChoiceUndo`; the combined card is
its first instance. `Step` and `Task` gain `caused_by`.

**Wire.** Instance to runner: `message{kind: housekeeping, max_tokens,
findings[{id, subject, subject_revision, evidence}]}`; the proxy mounts
**only** `status`, `read_task`, `find`, `search_code`, `read_file`,
`read_notes` and `housekeeping_verdict` for this kind, and the runner's
launcher policy (`policy.go`, `TestConversePolicyCoversEveryTool`)
carries the same allowlist, so a frame or a model asking for anything
else is refused at both ends; 24 calls as explore. `dispatch` gains
`caused_by`, `not_before_person_steps: true`. Runner to instance: `step`
reports gain `noticed[{text, repo, path}]` from the pinned
`note_improvement` tool (five per step, 280 bytes each); the merge watch
reports `branch_gone{task, branch}`. Fixtures under
`internal/wire/wiretest/testdata`: `api/housekeeping.json`,
`api/housekeeping-paused.json`, `api/action-combined.json`,
`api/action-retry.json`, `api/action-undone.json`,
`api/action-refused.json`, `api/suggestions.json`,
`api/suggestion-related.json`, `api/event-housekeeping.json`,
`api/event-suggestion.json`, `api/card-housekeeping.json`,
`frames/message-housekeeping.json`, `frames/step-noticed.json`,
`frames/branch-gone.json`, `frames/dispatch-caused-by.json`. The
secret-shape guard covers the new types.

**Tests.** Unit: a deterministic fixture per detector (store snapshot
in, exact findings out, threshold edges included), the rate table, and
`TestRegistryModelMeansPropose`. Contract, each with a mutation observed
failing: `TestHousekeepingPrincipal` (a fold whose destination belongs to
another creator, a suggestion related to another's task, a retry on
another's step, and a detector running inside `advance` for a person
removed from the roster mid-turn: every one `refused`, nothing changed);
`TestHousekeepingReservation` (two claims racing the last turn: one
`claimed`, one `held`; a retry reserves 100,000 and its fix round is
charged to it; a failover attempt's `max_tokens` is the remainder, and
the floor ends it `budget`; an attempt with no usage figure charges the
whole reservation; a yield, a Pause and a cancel each keep the row
`releasing` until termination and the charge, then release);
`TestHousekeepingStandsDown` (the selected pair's headroom unknown, at
0.8, or checked over fifteen minutes ago: `held`, no other connection
tried; combine still acts); `TestHousekeepingTier` (a `standard` pair
alone: `held`; no tiers at all: no turn); `TestHousekeepingPreempts` (a
person's message yields the turn; a person's Retry supersedes the
automatic one; a person step dispatched first);
`TestHousekeepingUndoRoundTrips` (combine then Undo: both tasks and
threads equal their prior fixture byte for byte, destination included,
key `undone`, a second finding a no-op; retry then Undo: every field
`RetryTask` cleared equals the snapshot on step and task, `attempt` stays
n+1, `undone_attempt` set, a late `running` report for n+1 dropped and
its termination accepted, a person's Retry then gives n+2; Undo racing
the `running` report: exactly one commits, the other 409);
`TestHousekeepingRetryChain` (one automatic retry per chain, termination
proof required, a pushed step never retried, the second failure is
Needs you `retry`; the retried task later earns `merge_eligible`,
`ready_sha` and its merge card through the ordinary policy, while a
housekeeping principal writing any of them directly is refused);
`TestHousekeepingNever` (the principal attempting delete, merge, a
`limited` connection, the eleventh action: refused at the store, a
`refused` row); `TestHousekeepingLedger` (replayed event; a crash after
`claimed` with nothing dispatched: released to `held` at restart; a
crash after dispatch: settled by `sync`; the subject moved meanwhile:
`expired` with `subject_moved` and the reservation released; a
deterministic action's claim and effect in one transaction; held then
claimed; veto then one recurrence then none; team-scoped key raised by
two people once);
`TestHousekeepingVerdicts` (a verdict with a forged finding id, a stale
`subject_revision`, a subject that moved: refused and counted; a replay
after failover `replayed: true`; a yielded turn leaves findings held);
`TestHousekeepingHostile` (a repository file and a notebook entry
containing instructions to combine, cancel, merge or call other tools:
the turn's only effect is verdicts, and only on issued findings);
`TestHousekeepingAutoDisable` (two failures of mixed kinds within seven
days: disabled, one digest line, failure rows survive the action's
rollback, re-enable clears); `TestSuggestionsLane` (five open, sixth
held, accept through `record_task`, dismiss vetoes, related task
untouched, decay); `TestHousekeepingQuietHours` (an action at 02:00
shows on the view at once and in the conversation at 08:00). Headless:
`H1` two similar tasks in one message, combined, Undo from the receipt
restores both; `H2` (slice 2) the runner killed before any push,
restarted, one automatic retry with a receipt, a second kill is Needs
you; `H3` (slice 3) a judgement turn with the fake CLI produces one
suggestion and charges one turn. Browser: the view and the lane at 1280
and 390.

## 7. Slices

| Slice | Content | Gate | Size |
|---|---|---|---|
| 1 The smallest useful loop | Registry; `chat_housekeeping` with the state machine and reservations; the housekeeping principal in the store functions; `duplicate_same_creator` as the first detector, its action the reversible combine from `thin-v1-ux1` (same creator, both tasks checked in the transaction, Undo restores both); `duplicate_possible` as links; Pause; quiet hours; the digest line; the Housekeeping view with Undo and refusals; `chat_housekeeping_failures` and auto-disable. No spend, no model turns, no suggestions | `thin-v1-ux1`'s combine merged first; `TestHousekeepingPrincipal`, `Ledger` (including claim recovery at restart and `subject_moved`), `UndoRoundTrips` (combine), `Never`, `AutoDisable`, `QuietHours`; H1 | 3 days |
| 2 Retries and suggestions | `retry_transient` (pre-push only, one per chain, Undo until the step starts, `caused_by` charging); `chat_suggestions`, the lane, accept and dismiss, decay, de-duplication by `related_task`, the cap; `ready_waiting`, `branch_gone`, `repo_reach`, `connection_health` digest lines; `flaky_check` without the model | Automatic retries ship only after `Reservation` (caps, remainder, unknown charged in full, releasing), `StandsDown` (selected pair), `Preempts`, `RetryChain`, `UndoRoundTrips` (snapshot, fencing and the race), `Principal` (foreign owner), the dispatched-claim recovery in `Ledger` and `AutoDisable` are green; H2 | 2.5 days |
| 3 Judgement | turn kind `housekeeping`, tier ceiling, `max_tokens`, the two-ended allowlist, `housekeeping_verdict` as a mutation kind, the sweep; `note_improvement` and `improvement_noticed`; `findings_unaddressed`; `notebook_stale` as a proposal; model naming for `flaky_check` | **Depends on Connections slice 3 (tiers)**; `Tier`, `Verdicts`, `Hostile`, `StandsDown`; H3 | 2 days |
| 4 Team scope | team suggestions with per-person dismissal, `stale_project` with its ask-once, the owner's team budget and team Pause, acting on team subjects by the owner | team-keyed `Ledger` cases | 1.5 days |

Each slice lands headless first, then staging with the real CLI, then
UI, as thin v1 §8. Slice 1 is on by default with Pause as the exit; it
spends nothing and can only combine and undo.

## 8. Beyond code

The same loop serves a business or a family when three things change
and nothing in §§3 to 5 does. **Subjects** widen: a person's area, a
shared responsibility, a recurring obligation, a decision. **Detectors**
are added to the registry over new facts: a recurring chore with no
completion since its period (`chore_overdue`, propose a reminder), a
notebook decision whose review date has passed (`decision_stale`,
propose revisiting it), a question with no owner after N days
(`unowned_followup`, ask once who takes it), spend drifting from its
usual level on a connected ledger (`spending_drift`, propose a look).
**Data sources** become connections of new kinds (a calendar, a shared
list, an accounts export, a mailbox) with the same consent model as
model connections: added by the person who owns them, readable by that
person's housekeeping, shared with the team only by an explicit grant,
never a secret on the instance. For a family the owner role matters
more than for a one-person team: the owner sets the team Pause and the
team budget, and personal subjects stay personal even from the owner.
Before any of it is built: a typed fact store the detectors read instead
of the chat tables, a consent record per source and per audience, and
copy a non-developer reads without flinching. None of that is designed
here.

## 9. Rulings and decisions

Paul, 2026-11-08: **budget defaults** 4 judgement turns, 150,000 tokens
and 3 automatic retries per person per day, standing down at 80%;
**suggestions** as a folded group at the bottom of Tasks plus the
Housekeeping view, five open per person. Both are folded in above.

Taken here, for review rather than decision: automatic retry acts only
on steps that never pushed and is otherwise the existing Needs you card;
cross-creator duplicates are links only in every slice; model judgement
produces suggestions only. No decision is open for Paul in this
revision.

## 10. Risks

Headroom is best effort, so the stand-down rule is conservative by
design (unknown means stop), and on a week when Claude reports no figure
judgement turns simply do not run. A deterministic detector that is
wrong on real data acts before it is undone twice; the seven-day Undo,
the retained veto and auto-disable bound that. Slice 1 depends on the
combine landing on `thin-v1-ux1` first. Slice 3 depends on Connections
slice 3 for tiers and until then has nothing cheap to run on. The
judgement turn reads code and notes that may be hostile; its only effect
is a verdict bound to a server-issued finding, enforced at the proxy and
the launcher, and `TestHousekeepingHostile` is the regression guard.
