DD-469: standalone Attention provider — implementation epic #1

Open
opened 2026-11-01 12:14:24 +00:00 by piers · 0 comments
Owner

Accepted product plan — 2026-11-15

This is the non-dispatchable epic for the standalone Attention provider. Product decisions are accepted and recorded in ADR 0002: Python, single-writer SQLite, Compose first, loopback behind existing ingress, encrypted S3-compatible backups, fail-closed recovery-sensitive writes and product-operated expiry/version cleanup. ADR 0001 preserves the portable capability and native Stallari boundary.

Implementation input is mind-spec 3da6a263e6aeb3f37d25590d6ab755045ff53786: attention/1.0, binding 1.1, schemas and common conformance. The earlier mind-spec-v0.1.0 is the Mail release and remains unchanged. The contract grill is complete; these product decisions do not reopen it.

Implementation slices

The accepted decomposition records bounded scope and acceptance. Live progress and dispatch belong on these issues:

Slice Issue Blocked by
Foundation and authenticated identity #3 Complete
Durable queue and commands #4 Complete
Bounded queries and ranking #5 None — durable commands complete
Forget, S3 custody and recovery #6 None — durable commands complete
Fake host and delivery #7 #6 for full acceptance
Packaged acceptance #8 #5, #6 and #7

Foundation → durable commands → queries/recovery/delivery → packaged acceptance. Foundation #3 and durable queue/commands #4 are complete: PR #10 landed as 9b5a7c0b6e4c, and PR #11 landed as 04b0704842de on 2026-11-15, completing 2 of 6 slices. The next unblocked implementation issues are #5 and #6; neither is dispatched by this merge. Delivery #7 still depends on #6 for complete acceptance. The implemented provider subset exposes info, admit, submit, replace, withdraw and dispose; clean local queues are ready, and unresolved prepared work remains quarantined. Reviewed completion evidence covers 295 passing tests, quality/build, integration and Linux CI. Public queries, Forget, delivery, backup/restore and deployment remain later scope.

Epic acceptance and boundaries

Close only when all six slices have linked implementation and evidence, including actual authenticated provider conformance, writer termination/retry, logical retained-data inspection, complete recovery evidence, isolated S3 object/version custody and expiry drills, fake-host effect counts, Compose recovery exercises and measured resource budgets. Reference-model traces do not certify those properties. No running provider, native integration, deployment or image has been certified by publishing this plan.

One queue has one authority; Stallari may implement the compatible contract natively without this service, with Signals owning interruption policy. First input is explicitly authorised submission. Automatic source ingestion, People enrichment, real notifications, a public feed, native Stallari implementation, Kubernetes/launchd packaging, Tailcat/Ratatoskr integration and shared runtime extraction remain separate work. No Nexus or broker is required. The historical brief below is preserved and superseded wherever it conflicts with the accepted decisions.

Historical brief — 2026-11-01 (preserved)

Original title: Spec: attention-mind-mcp 0.1.0 — wake fan-in mind with one ranked queue over MCP.

Spec synthesised 2026-11-01 from the mind theory session. Source notes (vault, private): the capture "Attention-mind design: service and MCP surface", the capture "Blade and mind portfolio theory", and the draft directive mind-mcp-class. Class rules follow that directive; vocabulary follows mailmind ADR 0001 to 0008 and peoplemind ADR 0001 to 0006 (Consumer, Source, evidence token, outbox, wake).

Problem Statement

A person who runs several minds (mail today, people now, calendar and messages next) has no single place that says what deserves their attention. Each mind raises its own wakes on its own feed. A hosted agent such as a Grok Bot Automation therefore needs one routine per mind, pays tokens on every run to re-rank and re-recognise items it saw before, reads the same person's mail, invite and message three times, and has no memory of what the owner already handled, snoozed or muted. Noise control is reinvented inside every mind or left to the model. Switching the agent host loses whatever attention policy the model had learned.

Solution

attention-mind-mcp is a mind whose Sources are other minds. A sync worker is the only client of the upstream wake and change feeds. It stores each wake as an attention item that holds references only, never content, joins the item to a Person through person-mind's evidence surface, coalesces signals about the same Person, and ranks items in code. An api process serves one merged, ranked queue over Streamable HTTP with bearer tokens and named Consumer cursors, so one routine on any MCP host calls attention_next, handles a few rows, and acks once. The owner's dispositions (handled, snooze, mute) are the only policy writes, reversible through an outbox with undo and audit. The mind never calls an upstream write tool and never dispatches anything.

User Stories

  1. As a mailbox owner using a Grok Bot Automation, I want one tool call that returns everything worth my attention across all my minds, so that I run one routine instead of one per mind.
  2. As an owner, I want each row to name the source mind and an opaque reference, so that the agent reads the body through that mind with its own token and attention-mind never holds content.
  3. As an owner, I want rows joined to a Person from person-mind, so that "three signals from Kim" is one row rather than three.
  4. As an owner, I want signals about the same Person inside a window coalesced into one item with a per-source count, so that the agent reads a thread once.
  5. As an owner, I want rows ranked in code by upstream score, relation weight, class weight, age and escalation, so that the model never pays to rank.
  6. As an owner, I want a quiet run to cost about a dozen tokens, so that a frequent Automation cadence is affordable.
  7. As an owner, I want a row to cost about twenty-five tokens, so that ten items fit in a small budget.
  8. As an owner, I want a named Consumer cursor kept server-side, so that an Automation with no memory between runs sees nothing twice and a failed run sees the same rows again.
  9. As an owner, I want attention_ack to never move backwards and to refuse a seq past the end, so that a confused client cannot lose or skip items.
  10. As an owner, I want to settle items as handled, so that they leave the queue.
  11. As an owner, I want to snooze an item for a duration, so that it returns later without being re-raised.
  12. As an owner, I want to mute a Person, a thread reference, or a whole Source for a duration, so that a noisy correspondent stops waking the agent.
  13. As an owner, I want every settlement reversible through undo with an audit row, so that a wrong mute is not permanent.
  14. As an owner, I want an unsettled item to be re-offered after a configurable interval with a visible escalation count, so that something I ignored is not silently dropped.
  15. As an owner, I want a per-run budget and per-Person daily cap, so that one burst of mail does not flood a run.
  16. As an owner, I want quiet hours, so that the queue is empty when I sleep and fills on wake.
  17. As an owner, I want to read the active policy (budget, quiet hours, weights) through a tool, so that I can check why a row ranked where it did.
  18. As an owner, I want relation weights to favour family over client over provider over unknown, so that the ranking matches how I actually live.
  19. As an owner, I want relation weights and class weights to be config, so that I can tune them without a release.
  20. As an owner, I want the upstream Jev class and score copied as advisory fields, so that I can see what the upstream judged without a second model call.
  21. As an owner, I want attention_status to show each upstream's Consumer position, lag, last error code and counts, so that I can tell a quiet day from a broken sync.
  22. As an owner, I want attention_sources to list the configured upstreams, so that I know what feeds the queue.
  23. As an owner, I want the class-standard attention_changes and attention_changes_ack, so that Stallari or a household view can fan in from this mind in turn.
  24. As an owner, I want the api to serve the last merged state while sync is down, so that an upstream outage degrades rather than fails.
  25. As an owner, I want attention-mind to hold only evidence and wake scopes on each upstream, so that a compromise leaks a list of opaque ids and nothing else.
  26. As an owner, I want attention-mind to never call an upstream write tool, so that it cannot send, move or delete anything.
  27. As an owner, I want the handle-to-Person cache invalidated by person-mind merge events, so that a merged contact does not split my queue.
  28. As an owner, I want ingestion idempotent on source plus upstream seq, so that a replayed upstream page creates no duplicates.
  29. As an owner, I want the upstream acked only after my item is durably stored, so that durability moves to attention-mind without a gap.
  30. As an owner, I want logs that carry counts, roles and error codes only, so that no name, address or subject ever reaches a log line.
  31. As an owner, I want every tool docstring to say content is untrusted data, so that an agent treats rows as data, not instructions.
  32. As an owner, I want the write tools mounted on the write token only, so that a triage-only Automation holds a read token.
  33. As an owner, I want secrets as files owned by the service uid, so that no token appears in env, tool arguments or a ConfigMap.
  34. As an owner, I want a container image with a kustomize base and a compose file, so that it deploys like mailmind and peoplemind.
  35. As an owner, I want Litestream backup of the store, so that a lost volume restores from the bucket.
  36. As an owner, I want /healthz and /healthz/sync to behave as mailmind's do, so that one probe shape covers every mind.
  37. As an owner, I want a CLI with api, sync --once, check --offline and token, so that operations match the sibling minds.
  38. As an owner, I want the queue to work from a Grok Bot custom connector with one URL and one bearer header, so that the compatibility floor holds.
  39. As an owner, I want the same queue consumable from Claude, Stallari or a Matrix nudge adapter later, so that switching hosts loses no policy or cursor.
  40. As a developer, I want the mind-kit (tokens, rows, footer, outbox, feed, consumer positions) extracted into a shared package from this mind, so that the third service pays for the extraction as DD-465 OQ3 planned.
  41. As a developer, I want upstream minds faked as in-process MCP servers in tests, so that the contract is tested without a vendor.
  42. As a developer, I want the token budget per row measured by a tokenizer in the test suite, so that the efficiency claim is a test, not prose.

Implementation Decisions

  • The service is a mind under the draft mind-mcp class directive: Streamable HTTP, bearer tokens, one instance per person, one volume and one host, sync as the only Source client and only writer of the item tables, api reading the store and writing only the outbox and Consumer positions. Python 3.12, uv, mypy strict, ruff with S, MIT, as the sibling minds.
  • A Source is an upstream mind reached over MCP at an in-cluster URL with a token file. Each Source block names the mind kind (mail, person, calendar, generic), the wake tool and the change tool to poll, the Consumer name attention-mind uses upstream, the poll interval and a source weight. The generic kind needs only the class-standard row shapes (seq | ref | class | score | at with ack_seq and more).
  • person-mind is a distinguished Source used for joins, not for wakes: people_find with an exact Handle resolves a sender handle to a person_id; people_related or the card supplies the relation type; people_changes merge events invalidate the join cache. The handle comes from mailmind's mail_evidence on the evidence token. A deployment without person-mind runs with who empty and relation weight at the unknown value.
  • Store schema: items (seq, source, upstream_seq, ref, who, klass, score, raised_at, state, escalation, offered_count, last_offered_at, snoozed_until), signals (item seq, source, ref, at) for coalesced members, join_cache (handle, person_id, relation, expires_at), consumers (name, position) for downstream clients, actions outbox and audit for settlements and undo, mutes (scope kind, scope value, until, action id), changes for the class-standard feed. One writer, WAL, Litestream.
  • Ingestion is idempotent on (source, upstream_seq). The upstream ack is sent after the local transaction commits, never before. A failed upstream ack is retried on the next pass; a duplicate page is a no-op.
  • Coalescing: a new wake whose resolved Person has an open item (state raised or offered) within the configured window joins it as a signal; the item's score becomes the maximum member score plus a logarithmic bump per signal; its at stays the earliest. Without a Person, coalescing falls back to the upstream thread reference when the Source exposes one, otherwise no coalescing.
  • Ranking is a deterministic function in a pure module: rank = upstream score × relation weight × class weight × decay(age, half-life) + escalation bump. Items are returned oldest-first within rank buckets. All weights, the half-life, the coalescing window, the re-offer interval, the per-run limit, the per-Person daily cap and quiet hours are config under [rank], [budget] and [quiet]. No model runs in the hot path. A later ADR may add an advisory Jev second opinion under the same data-boundary rule as mailmind ADR 0003; it is not in 1.0.
  • Lifecycle: raised → offered (returned by attention_next) → acked by cursor → settled (handled, snoozed, muted) or re-offered after the interval with escalation incremented. Snoozed items return at snoozed_until. Muted scopes filter at query time and apply to future items. Quiet hours suppress offering, not ingestion.
  • Read tools on the read token: attention_next(consumer, limit) rows seq | source | ref | who | class | score | signals | age with footer ack_seq and more, and the literal no new items line on an empty page; attention_ack(consumer, seq); attention_status one row per Source name | kind | position | lag | last_error | pending | snoozed | muted; attention_sources name | kind | url_host | last_sync | last_error; attention_policy the active config as rows; attention_changes(consumer, limit) and attention_changes_ack(consumer, seq) with kinds add, update, settle, del.
  • Write tools on the write token: attention_settle(seqs, disposition) with disposition one of handled, snooze:<duration>, mute:person:<id>:<duration>, mute:ref:<source>:<ref>:<duration>, mute:source:<name>:<duration>, returning an action id per item; attention_undo(action_id); attention_actions(limit) listing the audit. Settlements go through the outbox and are applied by sync, as mailmind ADR 0004 does, so api writes only the outbox and positions.
  • Scopes nest as in mailmind ADR 0008: read is in write. There is no evidence scope in 1.0 because every row is already reference-only; an evidence token is added when a downstream mind needs one.
  • Token budgets measured in the test suite: an attention_next row under 30 tokens, an empty page under 15, a attention_status row under 40.
  • Upstream credentials: attention-mind holds, per upstream, a token whose scope is the smallest that reaches the wake and change tools (mailmind: a read token until mailmind exposes wakes on the evidence scope, which this spec requests as a sibling amendment; peoplemind: the read token). Attention-mind never holds a write token for any upstream, and the config loader refuses a token file whose scope check reports write.
  • Health: /healthz from api, /healthz/sync from the sync worker, same semantics as mailmind.
  • Deployment: Containerfile, compose with sync, api and a backup profile, kustomize base with an example overlay, one PVC ReadWriteOnce, Recreate strategy. Secrets are files mounted per container.
  • Mind-kit extraction: tokens, pipe rows, footer, outbox, feed and Consumer positions are copied from peoplemind for 0.1.0 and extracted into a shared package as a tracked follow-up once the surface is green; this repo is the extraction site.

Testing Decisions

  • A good test drives the served app over real Streamable HTTP with the real MCP client and asserts on returned rows, footers, refusals and token counts. It never reaches into the store to assert implementation state, except to seed. Prior art: peoplemind test_feed and test_server (served fixture, call helper, exact tool-list count, token-budget tests, untrusted-data docstring check).
  • Upstream minds are faked as in-process FastMCP servers over HTTP that implement only the wake and change contract and refuse everything else, in the shape of peoplemind's FakeMail in test_mailmind. Tests assert that attention-mind calls only the wake, change, ack, evidence and find tools, and that a fake that offers a write tool is never called.
  • A lower seam unit-tests the pure ranking and coalescing module directly: ordering under each weight, decay, escalation bump, coalescing window edges, quiet hours, budgets and caps.
  • Feed and cursor semantics: a named Consumer sees each item once, a failed run (no ack) sees the same page again, an ack never moves backwards, a seq past the end is refused. Prior art: peoplemind test_feed.
  • Idempotency and durability: a replayed upstream page creates no duplicate; the upstream ack is observed only after commit (the fake records call order); a crash injected between commit and ack leaves one item and one later ack.
  • Settlement path: settle, snooze, mute and undo through the outbox; the audit lists them; muted items do not appear; snoozed items reappear at the deadline with a frozen clock.
  • Log scan: a fixture run's log output contains no handle, name or ref from the fixture, following peoplemind Phase A acceptance 6.
  • Token budgets measured with a tokenizer in the suite, following peoplemind's test_find_default_row_under_150_tokens.
  • Health endpoints tested as mailmind's are.
  • Live gate, recorded at the operator gate and not in CI: a Grok Bot custom connector on the read token runs the sample Automation instruction end to end against a staging mailmind.

Out of Scope

  • Any model call in the hot path, including a Jev second opinion over merged items.
  • Learning relation or class weights from dispositions.
  • Push or nudge adapters (Matrix post, email) and any webhook.
  • An MCP Apps panel.
  • A Stallari adapter or contract; Stallari consumes the class-standard feed later.
  • Multi-person or household instances; one instance per person holds.
  • Wake rules of upstream minds; calendar-mind's wake rule is its own spec and this mind lands usefully once a second wake-producing mind exists.
  • Holding or caching any content: subjects, bodies, names beyond the join cache's person id.

Further Notes

  • This mind is the first whose Sources are minds, so it exercises the client side of the mind contract and is the planned extraction site for the shared mind-kit (DD-465 OQ3).
  • Sibling amendment requested of mailmind: expose mail_wakes and mail_wakes_ack on the evidence scope, so attention-mind never needs a mailmind read token.
  • CONV-41 and DD-463 hold: attention-mind answers "what deserves attention now" and takes no action on the world; a person holds the irreversible acts through the agent host.
  • Naming follows the class: repo attention-mind-mcp, tools prefixed attention_, decisions as repo ADRs under CONV-34, with the vault holding the birth record only.
## Accepted product plan — 2026-11-15 This is the non-dispatchable **epic** for the standalone Attention provider. Product decisions are accepted and recorded in [ADR 0002](https://git.groupthink.asia/dev/attention-mind-mcp/src/branch/main/docs/adr/0002-standalone-product-and-managed-recovery.md): Python, single-writer SQLite, Compose first, loopback behind existing ingress, encrypted S3-compatible backups, fail-closed recovery-sensitive writes and product-operated expiry/version cleanup. [ADR 0001](https://git.groupthink.asia/dev/attention-mind-mcp/src/branch/main/docs/adr/0001-portable-attention-capability.md) preserves the portable capability and native Stallari boundary. Implementation input is [mind-spec `3da6a263e6aeb3f37d25590d6ab755045ff53786`](https://git.groupthink.asia/dev/mind-spec/src/commit/3da6a263e6aeb3f37d25590d6ab755045ff53786/contracts/attention-v1/README.md): attention/1.0, binding 1.1, schemas and common conformance. The earlier `mind-spec-v0.1.0` is the Mail release and remains unchanged. The contract grill is complete; these product decisions do not reopen it. ## Implementation slices The [accepted decomposition](https://git.groupthink.asia/dev/attention-mind-mcp/src/branch/main/docs/planning/implementation-slices.md) records bounded scope and acceptance. Live progress and dispatch belong on these issues: | Slice | Issue | Blocked by | | --- | --- | --- | | Foundation and authenticated identity | #3 | Complete | | Durable queue and commands | #4 | Complete | | Bounded queries and ranking | #5 | None — durable commands complete | | Forget, S3 custody and recovery | #6 | None — durable commands complete | | Fake host and delivery | #7 | #6 for full acceptance | | Packaged acceptance | #8 | #5, #6 and #7 | Foundation → durable commands → queries/recovery/delivery → packaged acceptance. Foundation #3 and durable queue/commands #4 are complete: [PR #10](https://git.groupthink.asia/dev/attention-mind-mcp/pulls/10) landed as `9b5a7c0b6e4c`, and [PR #11](https://git.groupthink.asia/dev/attention-mind-mcp/pulls/11) landed as `04b0704842de` on 2026-11-15, completing 2 of 6 slices. The next unblocked implementation issues are #5 and #6; neither is dispatched by this merge. Delivery #7 still depends on #6 for complete acceptance. The implemented provider subset exposes info, admit, submit, replace, withdraw and dispose; clean local queues are ready, and unresolved prepared work remains quarantined. [Reviewed completion evidence](https://git.groupthink.asia/dev/attention-mind-mcp/pulls/11#issuecomment-40112) covers 295 passing tests, quality/build, integration and Linux CI. Public queries, Forget, delivery, backup/restore and deployment remain later scope. ## Epic acceptance and boundaries Close only when all six slices have linked implementation and evidence, including actual authenticated provider conformance, writer termination/retry, logical retained-data inspection, complete recovery evidence, isolated S3 object/version custody and expiry drills, fake-host effect counts, Compose recovery exercises and measured resource budgets. Reference-model traces do not certify those properties. No running provider, native integration, deployment or image has been certified by publishing this plan. One queue has one authority; Stallari may implement the compatible contract natively without this service, with Signals owning interruption policy. First input is explicitly authorised submission. Automatic source ingestion, People enrichment, real notifications, a public feed, native Stallari implementation, Kubernetes/launchd packaging, Tailcat/Ratatoskr integration and shared runtime extraction remain separate work. No Nexus or broker is required. The historical brief below is preserved and superseded wherever it conflicts with the accepted decisions. ## Historical brief — 2026-11-01 (preserved) Original title: **Spec: attention-mind-mcp 0.1.0 — wake fan-in mind with one ranked queue over MCP**. Spec synthesised 2026-11-01 from the mind theory session. Source notes (vault, private): the capture "Attention-mind design: service and MCP surface", the capture "Blade and mind portfolio theory", and the draft directive `mind-mcp-class`. Class rules follow that directive; vocabulary follows mailmind ADR 0001 to 0008 and peoplemind ADR 0001 to 0006 (Consumer, Source, evidence token, outbox, wake). ## Problem Statement A person who runs several minds (mail today, people now, calendar and messages next) has no single place that says what deserves their attention. Each mind raises its own wakes on its own feed. A hosted agent such as a Grok Bot Automation therefore needs one routine per mind, pays tokens on every run to re-rank and re-recognise items it saw before, reads the same person's mail, invite and message three times, and has no memory of what the owner already handled, snoozed or muted. Noise control is reinvented inside every mind or left to the model. Switching the agent host loses whatever attention policy the model had learned. ## Solution attention-mind-mcp is a mind whose Sources are other minds. A `sync` worker is the only client of the upstream wake and change feeds. It stores each wake as an attention item that holds references only, never content, joins the item to a Person through person-mind's evidence surface, coalesces signals about the same Person, and ranks items in code. An `api` process serves one merged, ranked queue over Streamable HTTP with bearer tokens and named Consumer cursors, so one routine on any MCP host calls `attention_next`, handles a few rows, and acks once. The owner's dispositions (handled, snooze, mute) are the only policy writes, reversible through an outbox with undo and audit. The mind never calls an upstream write tool and never dispatches anything. ## User Stories 1. As a mailbox owner using a Grok Bot Automation, I want one tool call that returns everything worth my attention across all my minds, so that I run one routine instead of one per mind. 2. As an owner, I want each row to name the source mind and an opaque reference, so that the agent reads the body through that mind with its own token and attention-mind never holds content. 3. As an owner, I want rows joined to a Person from person-mind, so that "three signals from Kim" is one row rather than three. 4. As an owner, I want signals about the same Person inside a window coalesced into one item with a per-source count, so that the agent reads a thread once. 5. As an owner, I want rows ranked in code by upstream score, relation weight, class weight, age and escalation, so that the model never pays to rank. 6. As an owner, I want a quiet run to cost about a dozen tokens, so that a frequent Automation cadence is affordable. 7. As an owner, I want a row to cost about twenty-five tokens, so that ten items fit in a small budget. 8. As an owner, I want a named Consumer cursor kept server-side, so that an Automation with no memory between runs sees nothing twice and a failed run sees the same rows again. 9. As an owner, I want `attention_ack` to never move backwards and to refuse a seq past the end, so that a confused client cannot lose or skip items. 10. As an owner, I want to settle items as handled, so that they leave the queue. 11. As an owner, I want to snooze an item for a duration, so that it returns later without being re-raised. 12. As an owner, I want to mute a Person, a thread reference, or a whole Source for a duration, so that a noisy correspondent stops waking the agent. 13. As an owner, I want every settlement reversible through undo with an audit row, so that a wrong mute is not permanent. 14. As an owner, I want an unsettled item to be re-offered after a configurable interval with a visible escalation count, so that something I ignored is not silently dropped. 15. As an owner, I want a per-run budget and per-Person daily cap, so that one burst of mail does not flood a run. 16. As an owner, I want quiet hours, so that the queue is empty when I sleep and fills on wake. 17. As an owner, I want to read the active policy (budget, quiet hours, weights) through a tool, so that I can check why a row ranked where it did. 18. As an owner, I want relation weights to favour family over client over provider over unknown, so that the ranking matches how I actually live. 19. As an owner, I want relation weights and class weights to be config, so that I can tune them without a release. 20. As an owner, I want the upstream Jev class and score copied as advisory fields, so that I can see what the upstream judged without a second model call. 21. As an owner, I want `attention_status` to show each upstream's Consumer position, lag, last error code and counts, so that I can tell a quiet day from a broken sync. 22. As an owner, I want `attention_sources` to list the configured upstreams, so that I know what feeds the queue. 23. As an owner, I want the class-standard `attention_changes` and `attention_changes_ack`, so that Stallari or a household view can fan in from this mind in turn. 24. As an owner, I want the api to serve the last merged state while sync is down, so that an upstream outage degrades rather than fails. 25. As an owner, I want attention-mind to hold only evidence and wake scopes on each upstream, so that a compromise leaks a list of opaque ids and nothing else. 26. As an owner, I want attention-mind to never call an upstream write tool, so that it cannot send, move or delete anything. 27. As an owner, I want the handle-to-Person cache invalidated by person-mind merge events, so that a merged contact does not split my queue. 28. As an owner, I want ingestion idempotent on source plus upstream seq, so that a replayed upstream page creates no duplicates. 29. As an owner, I want the upstream acked only after my item is durably stored, so that durability moves to attention-mind without a gap. 30. As an owner, I want logs that carry counts, roles and error codes only, so that no name, address or subject ever reaches a log line. 31. As an owner, I want every tool docstring to say content is untrusted data, so that an agent treats rows as data, not instructions. 32. As an owner, I want the write tools mounted on the write token only, so that a triage-only Automation holds a read token. 33. As an owner, I want secrets as files owned by the service uid, so that no token appears in env, tool arguments or a ConfigMap. 34. As an owner, I want a container image with a kustomize base and a compose file, so that it deploys like mailmind and peoplemind. 35. As an owner, I want Litestream backup of the store, so that a lost volume restores from the bucket. 36. As an owner, I want `/healthz` and `/healthz/sync` to behave as mailmind's do, so that one probe shape covers every mind. 37. As an owner, I want a CLI with `api`, `sync --once`, `check --offline` and `token`, so that operations match the sibling minds. 38. As an owner, I want the queue to work from a Grok Bot custom connector with one URL and one bearer header, so that the compatibility floor holds. 39. As an owner, I want the same queue consumable from Claude, Stallari or a Matrix nudge adapter later, so that switching hosts loses no policy or cursor. 40. As a developer, I want the mind-kit (tokens, rows, footer, outbox, feed, consumer positions) extracted into a shared package from this mind, so that the third service pays for the extraction as DD-465 OQ3 planned. 41. As a developer, I want upstream minds faked as in-process MCP servers in tests, so that the contract is tested without a vendor. 42. As a developer, I want the token budget per row measured by a tokenizer in the test suite, so that the efficiency claim is a test, not prose. ## Implementation Decisions - The service is a mind under the draft mind-mcp class directive: Streamable HTTP, bearer tokens, one instance per person, one volume and one host, `sync` as the only Source client and only writer of the item tables, `api` reading the store and writing only the outbox and Consumer positions. Python 3.12, uv, mypy strict, ruff with S, MIT, as the sibling minds. - A Source is an upstream mind reached over MCP at an in-cluster URL with a token file. Each Source block names the mind kind (mail, person, calendar, generic), the wake tool and the change tool to poll, the Consumer name attention-mind uses upstream, the poll interval and a source weight. The generic kind needs only the class-standard row shapes (`seq | ref | class | score | at` with `ack_seq` and `more`). - person-mind is a distinguished Source used for joins, not for wakes: `people_find` with an exact Handle resolves a sender handle to a `person_id`; `people_related` or the card supplies the relation type; `people_changes` merge events invalidate the join cache. The handle comes from mailmind's `mail_evidence` on the evidence token. A deployment without person-mind runs with `who` empty and relation weight at the unknown value. - Store schema: `items` (seq, source, upstream_seq, ref, who, klass, score, raised_at, state, escalation, offered_count, last_offered_at, snoozed_until), `signals` (item seq, source, ref, at) for coalesced members, `join_cache` (handle, person_id, relation, expires_at), `consumers` (name, position) for downstream clients, `actions` outbox and audit for settlements and undo, `mutes` (scope kind, scope value, until, action id), `changes` for the class-standard feed. One writer, WAL, Litestream. - Ingestion is idempotent on (source, upstream_seq). The upstream ack is sent after the local transaction commits, never before. A failed upstream ack is retried on the next pass; a duplicate page is a no-op. - Coalescing: a new wake whose resolved Person has an open item (state raised or offered) within the configured window joins it as a signal; the item's score becomes the maximum member score plus a logarithmic bump per signal; its `at` stays the earliest. Without a Person, coalescing falls back to the upstream thread reference when the Source exposes one, otherwise no coalescing. - Ranking is a deterministic function in a pure module: rank = upstream score × relation weight × class weight × decay(age, half-life) + escalation bump. Items are returned oldest-first within rank buckets. All weights, the half-life, the coalescing window, the re-offer interval, the per-run limit, the per-Person daily cap and quiet hours are config under `[rank]`, `[budget]` and `[quiet]`. No model runs in the hot path. A later ADR may add an advisory Jev second opinion under the same data-boundary rule as mailmind ADR 0003; it is not in 1.0. - Lifecycle: raised → offered (returned by `attention_next`) → acked by cursor → settled (handled, snoozed, muted) or re-offered after the interval with escalation incremented. Snoozed items return at `snoozed_until`. Muted scopes filter at query time and apply to future items. Quiet hours suppress offering, not ingestion. - Read tools on the read token: `attention_next(consumer, limit)` rows `seq | source | ref | who | class | score | signals | age` with footer `ack_seq` and `more`, and the literal `no new items` line on an empty page; `attention_ack(consumer, seq)`; `attention_status` one row per Source `name | kind | position | lag | last_error | pending | snoozed | muted`; `attention_sources` `name | kind | url_host | last_sync | last_error`; `attention_policy` the active config as rows; `attention_changes(consumer, limit)` and `attention_changes_ack(consumer, seq)` with kinds `add`, `update`, `settle`, `del`. - Write tools on the write token: `attention_settle(seqs, disposition)` with disposition one of `handled`, `snooze:<duration>`, `mute:person:<id>:<duration>`, `mute:ref:<source>:<ref>:<duration>`, `mute:source:<name>:<duration>`, returning an action id per item; `attention_undo(action_id)`; `attention_actions(limit)` listing the audit. Settlements go through the outbox and are applied by `sync`, as mailmind ADR 0004 does, so `api` writes only the outbox and positions. - Scopes nest as in mailmind ADR 0008: read is in write. There is no evidence scope in 1.0 because every row is already reference-only; an evidence token is added when a downstream mind needs one. - Token budgets measured in the test suite: an `attention_next` row under 30 tokens, an empty page under 15, a `attention_status` row under 40. - Upstream credentials: attention-mind holds, per upstream, a token whose scope is the smallest that reaches the wake and change tools (mailmind: a read token until mailmind exposes wakes on the evidence scope, which this spec requests as a sibling amendment; peoplemind: the read token). Attention-mind never holds a write token for any upstream, and the config loader refuses a token file whose scope check reports write. - Health: `/healthz` from `api`, `/healthz/sync` from the sync worker, same semantics as mailmind. - Deployment: Containerfile, compose with `sync`, `api` and a `backup` profile, kustomize base with an example overlay, one PVC ReadWriteOnce, Recreate strategy. Secrets are files mounted per container. - Mind-kit extraction: tokens, pipe rows, footer, outbox, feed and Consumer positions are copied from peoplemind for 0.1.0 and extracted into a shared package as a tracked follow-up once the surface is green; this repo is the extraction site. ## Testing Decisions - A good test drives the served app over real Streamable HTTP with the real MCP client and asserts on returned rows, footers, refusals and token counts. It never reaches into the store to assert implementation state, except to seed. Prior art: peoplemind `test_feed` and `test_server` (served fixture, `call` helper, exact tool-list count, token-budget tests, untrusted-data docstring check). - Upstream minds are faked as in-process FastMCP servers over HTTP that implement only the wake and change contract and refuse everything else, in the shape of peoplemind's `FakeMail` in `test_mailmind`. Tests assert that attention-mind calls only the wake, change, ack, evidence and find tools, and that a fake that offers a write tool is never called. - A lower seam unit-tests the pure ranking and coalescing module directly: ordering under each weight, decay, escalation bump, coalescing window edges, quiet hours, budgets and caps. - Feed and cursor semantics: a named Consumer sees each item once, a failed run (no ack) sees the same page again, an ack never moves backwards, a seq past the end is refused. Prior art: peoplemind `test_feed`. - Idempotency and durability: a replayed upstream page creates no duplicate; the upstream ack is observed only after commit (the fake records call order); a crash injected between commit and ack leaves one item and one later ack. - Settlement path: settle, snooze, mute and undo through the outbox; the audit lists them; muted items do not appear; snoozed items reappear at the deadline with a frozen clock. - Log scan: a fixture run's log output contains no handle, name or ref from the fixture, following peoplemind Phase A acceptance 6. - Token budgets measured with a tokenizer in the suite, following peoplemind's `test_find_default_row_under_150_tokens`. - Health endpoints tested as mailmind's are. - Live gate, recorded at the operator gate and not in CI: a Grok Bot custom connector on the read token runs the sample Automation instruction end to end against a staging mailmind. ## Out of Scope - Any model call in the hot path, including a Jev second opinion over merged items. - Learning relation or class weights from dispositions. - Push or nudge adapters (Matrix post, email) and any webhook. - An MCP Apps panel. - A Stallari adapter or contract; Stallari consumes the class-standard feed later. - Multi-person or household instances; one instance per person holds. - Wake rules of upstream minds; calendar-mind's wake rule is its own spec and this mind lands usefully once a second wake-producing mind exists. - Holding or caching any content: subjects, bodies, names beyond the join cache's person id. ## Further Notes - This mind is the first whose Sources are minds, so it exercises the client side of the mind contract and is the planned extraction site for the shared mind-kit (DD-465 OQ3). - Sibling amendment requested of mailmind: expose `mail_wakes` and `mail_wakes_ack` on the evidence scope, so attention-mind never needs a mailmind read token. - CONV-41 and DD-463 hold: attention-mind answers "what deserves attention now" and takes no action on the world; a person holds the irreversible acts through the agent host. - Naming follows the class: repo `attention-mind-mcp`, tools prefixed `attention_`, decisions as repo ADRs under CONV-34, with the vault holding the birth record only.
svc-agent-writer changed title from Spec: attention-mind-mcp 0.1.0 — wake fan-in mind with one ranked queue over MCP to DD-469: reconcile standalone attention implementation with the portable contract 2026-11-15 04:45:09 +00:00
svc-agent-writer changed title from DD-469: reconcile standalone attention implementation with the portable contract to DD-469: standalone Attention provider — implementation epic 2026-11-15 06:41:38 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dev/attention-mind-mcp#1
No description provided.