Mailmind Source over MCP with an evidence token, Interactions and deterministic enrichment #6

Closed
opened 2026-11-01 01:59:23 +00:00 by svc-agent-writer · 3 comments

Parent: #1. Records: ADR 0001 §5, ADR 0003, ADR 0004 §5; mailmind ADR 0008.

What to build

The join no other store makes: mail evidence attached to Persons, under least privilege.

  • A Source that calls mailmind over MCP at an in-cluster URL with an evidence token (mailmind ADR 0008). It calls mail_changes envelope=true for addresses only and mail_evidence(address) for the closed field list: domain, received, first, last, roles, sent, signature, subjects. It never calls a body or search tool.
  • Interactions: one row per address per message, channel mail, direction in or out, stored by reference (message id), never the text.
  • Deterministic enrichment (ADR 0003, 0.1.0 list): Organisation from a non-public domain; phones and URLs from signature lines; one title-line pattern. Each derived field carries the fixed confidence for its derivation kind and an evidence reference. Nothing a Source asserted is overwritten.
  • Evidence is held by reference. people_card shows evidence only on request, through the evidence id.

Acceptance criteria

  • Over compose with mailmind #78 shipped: peoplemind holds an evidence token; evidence, sent and envelope=true are consumed; a body read with that token is refused and the refusal is logged as a code.
  • Interactions appear in people_recent in both directions.
  • Enrichment tests: a public-domain address yields no Organisation; a signature with a phone and a URL yields two derived fields with the fixed confidence; a derived field never replaces an asserted one.
  • A derived field below the configured threshold is stored and hidden from the default row.
  • The log-scan test covers a sync pass.

Blocked by

Filed under: operator word "go. compelling public-facing README.md as A0" sha256:3f9e946994fa

Parent: #1. Records: ADR 0001 §5, ADR 0003, ADR 0004 §5; mailmind ADR 0008. ## What to build The join no other store makes: mail evidence attached to Persons, under least privilege. - A Source that calls mailmind over MCP at an in-cluster URL with an evidence token (mailmind ADR 0008). It calls `mail_changes envelope=true` for addresses only and `mail_evidence(address)` for the closed field list: domain, received, first, last, roles, sent, signature, subjects. It never calls a body or search tool. - Interactions: one row per address per message, channel `mail`, direction `in` or `out`, stored by reference (message id), never the text. - Deterministic enrichment (ADR 0003, 0.1.0 list): Organisation from a non-public domain; phones and URLs from signature lines; one title-line pattern. Each derived field carries the fixed confidence for its derivation kind and an evidence reference. Nothing a Source asserted is overwritten. - Evidence is held by reference. `people_card` shows evidence only on request, through the evidence id. ## Acceptance criteria - Over compose with mailmind #78 shipped: peoplemind holds an evidence token; evidence, `sent` and `envelope=true` are consumed; a body read with that token is refused and the refusal is logged as a code. - Interactions appear in `people_recent` in both directions. - Enrichment tests: a public-domain address yields no Organisation; a signature with a phone and a URL yields two derived fields with the fixed confidence; a derived field never replaces an asserted one. - A derived field below the configured threshold is stored and hidden from the default row. - The log-scan test covers a sync pass. ## Blocked by - #3 - dev/imap-mailmind-mcp#78 (mail_evidence, mail_changes envelope and the evidence scope) Filed under: operator word "go. compelling public-facing README.md as A0" sha256:3f9e946994fa
Collaborator

⏸ SVD architect gate: dev/peoplemind-mcp#6 mailmind-source-over-mcp-with-an-evidence-token-interactions

Status: CLEAN after 1 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity substrate · dispatch effort high

Run: 20261101T102110Z-9054c4fc

Held because: CLEAN but 6 open risk(s) (1 sequencing · 2 verification · 3 decision) — HOLD-ALL parks everything. The risks, verbatim:

Open risks:

  1. S1: mailmind #78 must be merged to mailmind main before dispatch. Its merge state could not be read: the checkout gives Operation not permitted and gh is denied. Sibling specs at mailmind 3af5d34/96efa14 cite mail_evidence at server.py:467-551, but that is second-hand. If #78 is unmerged at dispatch, halt with mailmind-contract-unavailable and write no code. Clearing S1 does NOT clear V2. [sequencing — blocked by dev/imap-mailmind-mcp#78]
  2. V2: the #78 wire shape is assumed, not read. Check before the first edit, at a recorded mailmind main SHA, against server.py mail_changes/mail_evidence, tests/test_evidence.py FIELDS and docs/adr/0008-evidence-scope.md:
  • A1: mail_evidence returns exactly domain, received, first, last, roles, sent, signature, subjects.
  • A2: sent is a non-negative integer count of Owner-sent messages.
  • A3: each signature carries its lines plus its message id.
  • A4: mail_changes(envelope=True, cursor) rows carry message id, date, From, To and Cc.
  • A5: the footer carries the next cursor and a more/done signal.
  • A6: an evidence-scope token reaches mail_changes and mail_evidence and is refused by mail_read and mail_search.
    The PR body must carry the SHA and an A1–A6 table with file:line for each row. Any failing row halts with mailmind-contract-divergent and goes back for re-spec. A merge of #78 alone never discharges this risk. [verification]
  1. V1: the compose-level AC1 is provable only live. Bring up compose with mailmind #78 and peoplemind holding an evidence token, then run peoplemind sync --once. Check that people_sources shows the mailmind Source with an empty last_error and that people_recent shows in and out rows. Then call mail_read with the same token and check it is refused and mailmind logs a code with no address or subject. [verification]
  2. D1: should a mail-only address become a Person? Lean: an address with sent == 0 only attaches to an existing Person by exact Handle; otherwise it is skipped and counted as skipped_unknown. An address the Owner has written to creates an (unnamed) Person. This depends on A2. Alternatives: create a Person for every address, or never create one from mail. [decision]
  3. D2: #4 gate ruling R7 assigned evidence text to #6, but the issue body asks only for evidence by id, which people_card evidence=true already provides. Lean: references only, plus a follow-up issue. Fetching text would make the api a second mailmind client, against ADR 0001 §3 and ADR 0004 §1. Accept the deferral? [decision]
  4. D3: allow plain http to any host for a kind=mailmind url, given the in-cluster service URL? The CardDAV rule refuses that. Lean: allow it for mailmind only. Alternative: https-or-loopback plus an explicit opt-in key. [decision]

Change: Pre-edit contract gate: read mailmind's merged main read-only at a recorded SHA. Check A1–A6 against server.py mail_changes/mail_evidence, tests/test_evidence.py FIELDS and docs/adr/0008-evidence-scope.md. Halt with mailmind-contract-divergent or mailmind-contract-unavailable on any failure, with no code written. Then do the following:

  • Add MailmindSourceConfig, mirroring CardDAVSourceConfig (config.py:112-131).
  • Give SourceRecord optional signatures, interactions and attach_only fields (sources/init.py:10-18).
  • Add an explicit mailmind branch in build_sources.
  • Add sources/mailmind.py, mirroring CardDAVSource: a _transport seam (carddav.py:28-29), value-free error codes (:109-117), and network before the transaction. Its closed tool list is {mail_changes, mail_evidence}.
  • Add a pure enrich.py with signature phone and URL at 0.8 and title at 0.5 + 0.1(n-1), capped at 0.9, as fields, never Handles. It appends next to _derived_orgs (graph.py:192-210, 285).
  • In ingest_record: keep the record hash byte-identical for old records, add an attach-only skip, and INSERT OR IGNORE interactions.
  • Add migration 4: interactions.source_record plus a partial unique index.
  • Generalise the run_forever and cli interval gates to mailmind.
  • Update the README mailmind block.

Files: src/peoplemind_mcp/config.py · src/peoplemind_mcp/sources/__init__.py · src/peoplemind_mcp/sources/mailmind.py · src/peoplemind_mcp/enrich.py · src/peoplemind_mcp/graph.py · src/peoplemind_mcp/store.py · src/peoplemind_mcp/sync.py · src/peoplemind_mcp/cli.py · tests/test_mailmind.py · tests/test_enrich.py · tests/test_identity.py · tests/test_config_cli.py · README.md

Decision: accept the 6 open risk(s) above and dispatch this spec (svd:go), or park (svd:skip) / re-spec (svd:respec)?

Your call (when this issue is held at the gate via svd:hold):

  • add label svd:go — approve; Half-B dispatch accepts exactly this spec (open risks accepted)
  • add label svd:fire beside svd:go — approve AND authorise the Half-B fire from the phone; never on its own
  • add label svd:skip — park it; dispatch refuses it and the issue stays for a human
  • add label svd:respec — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context

Spec: /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-mailmind-source-over-mcp-with-an-evidence-token-interactions.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-mailmind-source-over-mcp-with-an-evidence-token-interactions.md

### ⏸ SVD architect gate: dev/peoplemind-mcp#6 mailmind-source-over-mcp-with-an-evidence-token-interactions **Status:** CLEAN after 1 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity `substrate` · dispatch effort `high` **Run:** `20261101T102110Z-9054c4fc` **Held because:** CLEAN but 6 open risk(s) (1 sequencing · 2 verification · 3 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. S1: mailmind #78 must be merged to mailmind main before dispatch. Its merge state could not be read: the checkout gives Operation not permitted and gh is denied. Sibling specs at mailmind 3af5d34/96efa14 cite mail_evidence at server.py:467-551, but that is second-hand. If #78 is unmerged at dispatch, halt with mailmind-contract-unavailable and write no code. Clearing S1 does NOT clear V2. [sequencing — blocked by dev/imap-mailmind-mcp#78] 2. V2: the #78 wire shape is assumed, not read. Check before the first edit, at a recorded mailmind main SHA, against server.py mail_changes/mail_evidence, tests/test_evidence.py FIELDS and docs/adr/0008-evidence-scope.md: - A1: mail_evidence returns exactly domain, received, first, last, roles, sent, signature, subjects. - A2: sent is a non-negative integer count of Owner-sent messages. - A3: each signature carries its lines plus its message id. - A4: mail_changes(envelope=True, cursor) rows carry message id, date, From, To and Cc. - A5: the footer carries the next cursor and a more/done signal. - A6: an evidence-scope token reaches mail_changes and mail_evidence and is refused by mail_read and mail_search. The PR body must carry the SHA and an A1–A6 table with file:line for each row. Any failing row halts with mailmind-contract-divergent and goes back for re-spec. A merge of #78 alone never discharges this risk. [verification] 3. V1: the compose-level AC1 is provable only live. Bring up compose with mailmind #78 and peoplemind holding an evidence token, then run peoplemind sync --once. Check that people_sources shows the mailmind Source with an empty last_error and that people_recent shows in and out rows. Then call mail_read with the same token and check it is refused and mailmind logs a code with no address or subject. [verification] 4. D1: should a mail-only address become a Person? Lean: an address with sent == 0 only attaches to an existing Person by exact Handle; otherwise it is skipped and counted as skipped_unknown. An address the Owner has written to creates an (unnamed) Person. This depends on A2. Alternatives: create a Person for every address, or never create one from mail. [decision] 5. D2: #4 gate ruling R7 assigned evidence text to #6, but the issue body asks only for evidence by id, which people_card evidence=true already provides. Lean: references only, plus a follow-up issue. Fetching text would make the api a second mailmind client, against ADR 0001 §3 and ADR 0004 §1. Accept the deferral? [decision] 6. D3: allow plain http to any host for a kind=mailmind url, given the in-cluster service URL? The CardDAV rule refuses that. Lean: allow it for mailmind only. Alternative: https-or-loopback plus an explicit opt-in key. [decision] **Change:** Pre-edit contract gate: read mailmind's merged main read-only at a recorded SHA. Check A1–A6 against server.py mail_changes/mail_evidence, tests/test_evidence.py FIELDS and docs/adr/0008-evidence-scope.md. Halt with mailmind-contract-divergent or mailmind-contract-unavailable on any failure, with no code written. Then do the following: - Add MailmindSourceConfig, mirroring CardDAVSourceConfig (config.py:112-131). - Give SourceRecord optional signatures, interactions and attach_only fields (sources/__init__.py:10-18). - Add an explicit mailmind branch in build_sources. - Add sources/mailmind.py, mirroring CardDAVSource: a _transport seam (carddav.py:28-29), value-free error codes (:109-117), and network before the transaction. Its closed tool list is {mail_changes, mail_evidence}. - Add a pure enrich.py with signature phone and URL at 0.8 and title at 0.5 + 0.1(n-1), capped at 0.9, as fields, never Handles. It appends next to _derived_orgs (graph.py:192-210, 285). - In ingest_record: keep the record hash byte-identical for old records, add an attach-only skip, and INSERT OR IGNORE interactions. - Add migration 4: interactions.source_record plus a partial unique index. - Generalise the run_forever and cli interval gates to mailmind. - Update the README mailmind block. **Files:** `src/peoplemind_mcp/config.py` · `src/peoplemind_mcp/sources/__init__.py` · `src/peoplemind_mcp/sources/mailmind.py` · `src/peoplemind_mcp/enrich.py` · `src/peoplemind_mcp/graph.py` · `src/peoplemind_mcp/store.py` · `src/peoplemind_mcp/sync.py` · `src/peoplemind_mcp/cli.py` · `tests/test_mailmind.py` · `tests/test_enrich.py` · `tests/test_identity.py` · `tests/test_config_cli.py` · `README.md` **Decision:** accept the 6 open risk(s) above and dispatch this spec (`svd:go`), or park (`svd:skip`) / re-spec (`svd:respec`)? **Your call** (when this issue is held at the gate via `svd:hold`): - add label `svd:go` — approve; Half-B dispatch accepts exactly this spec (open risks accepted) - add label `svd:fire` **beside** `svd:go` — approve AND authorise the Half-B fire from the phone; never on its own - add label `svd:skip` — park it; dispatch refuses it and the issue stays for a human - add label `svd:respec` — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context <sub>Spec: `/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-mailmind-source-over-mcp-with-an-evidence-token-interactions.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-mailmind-source-over-mcp-with-an-evidence-token-interactions.md`</sub>
Owner

Architect gate: CLEAN, rulings recorded, released for dispatch

Spec 2026-11-01-mailmind-source-over-mcp-with-an-evidence-token-interactions.md (Half-A run 20261101T102110Z-9054c4fc, 13 files, substrate/high). The rulings are appended to the spec under ## Agent Adjustments.

  1. S1 closed. mailmind #78 is merged (98b8b5f, ancestor of mailmind main 96efa14).
  2. V2 resolved on the architect host. The A1–A6 contract table was read at mailmind 96efa14 and written into the spec. Two rows diverged from the spec's assumptions and are ruled: mail_evidence has six fields with first..last embedded in the received and sent lines (A1), and the signature block carries no per-block message id, so signature-derived fields reference <source>:evidence:<address> (A3). Footer more is 0|1. Dispatch builds to the shipped shapes and does not halt on A1 or A3.
  3. Initial cursor is 0: the first pass backfills mailmind's changes log at 100 rows per page.
  4. D1: an address the Owner never wrote to attaches only by exact Handle; one the Owner wrote to creates a Person whose display name is the address.
  5. D2: evidence references only in #6; the fetch-path decision is #21 (ready-for-human, an ADR amendment).
  6. D3: plain http to a non-loopback host needs allow_http = true on the mailmind source; the README shows it for the in-cluster URL with a one-sentence warning.
  7. V1: the compose-level check waits for #9 and runs at the #10 gate; the fake-server tests prove the refusal path here.
  8. Excluded tests swept: every outside-write-set read of cfg.sources[...] narrows with isinstance or reads .name/.kind; no file joins the write set.

Riders: pytest only as uv run python3 -m pytest … --basetemp "$(mktemp -d "${TMPDIR:-/var/tmp}/svd.XXXXXX")/x"; no nested .git; baseline on pristine 254fe67 first (173 passed, 3 skipped expected); pyproject.toml and docs/adr/ untouched.

Operator: paste svd:go to release Half-B. Dispatch runs as codex-svd dispatch with CODEX_SVD_STAGE_TIMEOUT_SECONDS=9000.

## Architect gate: CLEAN, rulings recorded, released for dispatch Spec `2026-11-01-mailmind-source-over-mcp-with-an-evidence-token-interactions.md` (Half-A run `20261101T102110Z-9054c4fc`, 13 files, substrate/high). The rulings are appended to the spec under `## Agent Adjustments`. 1. **S1 closed.** mailmind #78 is merged (`98b8b5f`, ancestor of mailmind main `96efa14`). 2. **V2 resolved on the architect host.** The A1–A6 contract table was read at mailmind `96efa14` and written into the spec. Two rows diverged from the spec's assumptions and are ruled: `mail_evidence` has six fields with `first..last` embedded in the `received` and `sent` lines (A1), and the `signature` block carries no per-block message id, so signature-derived fields reference `<source>:evidence:<address>` (A3). Footer `more` is `0|1`. Dispatch builds to the shipped shapes and does not halt on A1 or A3. 3. **Initial cursor is `0`:** the first pass backfills mailmind's changes log at 100 rows per page. 4. **D1:** an address the Owner never wrote to attaches only by exact Handle; one the Owner wrote to creates a Person whose display name is the address. 5. **D2:** evidence references only in #6; the fetch-path decision is #21 (ready-for-human, an ADR amendment). 6. **D3:** plain `http` to a non-loopback host needs `allow_http = true` on the mailmind source; the README shows it for the in-cluster URL with a one-sentence warning. 7. **V1:** the compose-level check waits for #9 and runs at the #10 gate; the fake-server tests prove the refusal path here. 8. **Excluded tests swept:** every outside-write-set read of `cfg.sources[...]` narrows with `isinstance` or reads `.name`/`.kind`; no file joins the write set. Riders: pytest only as `uv run python3 -m pytest … --basetemp "$(mktemp -d "${TMPDIR:-/var/tmp}/svd.XXXXXX")/x"`; no nested `.git`; baseline on pristine `254fe67` first (173 passed, 3 skipped expected); `pyproject.toml` and `docs/adr/` untouched. Operator: paste `svd:go` to release Half-B. Dispatch runs as `codex-svd dispatch` with `CODEX_SVD_STAGE_TIMEOUT_SECONDS=9000`.
Collaborator

spec-verify-dispatch Half B for dev/peoplemind-mcp#6 mailmind-source-over-mcp-with-an-evidence-token-interactions completed integration verify.

  • PR: dev/peoplemind-mcp#22
  • Branch: feat/svd-dev-peoplemind-mcp-6-mailmind-source-over-mcp-with-a-8f761078
  • Commit: 63d8961eba
  • Build: none
  • Test: green
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: True
  • Check forgejo-commit-statuses: absent
  • Checks: PR #22 head 63d8961: no Forgejo commit statuses (absent, non-blocking). Local: 50 new tests and 182 regression tests pass; mypy, ruff check and ruff format are clean.
  • Warning: No remote CI statuses on PR head 63d8961 (Forgejo statuses list is empty); remote CI is unobserved.
  • Warning: Live compose verification against a real mailmind is deferred to the #10 gate, as approved (spec Open Risk V1).
  • Warning: no CI for forgejo-commit-statuses: No commit statuses exist on PR head 63d8961 and no required checks are readable; no run in history. No tracking pointer found. — reported as absent, not blocking (gh#633)
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261101T110821Z-8f761078 --confirm-merge)
spec-verify-dispatch Half B for dev/peoplemind-mcp#6 mailmind-source-over-mcp-with-an-evidence-token-interactions completed integration verify. - PR: https://git.groupthink.asia/dev/peoplemind-mcp/pulls/22 - Branch: feat/svd-dev-peoplemind-mcp-6-mailmind-source-over-mcp-with-a-8f761078 - Commit: 63d8961eba7f67f8968df00e40950f4064d73c7c - Build: none - Test: green - Reader audit clean: True - Spec fidelity: True - Ready for merge: True - Check forgejo-commit-statuses: absent - Checks: PR #22 head 63d8961: no Forgejo commit statuses (absent, non-blocking). Local: 50 new tests and 182 regression tests pass; mypy, ruff check and ruff format are clean. - Warning: No remote CI statuses on PR head 63d8961 (Forgejo statuses list is empty); remote CI is unobserved. - Warning: Live compose verification against a real mailmind is deferred to the #10 gate, as approved (spec Open Risk V1). - Warning: no CI for forgejo-commit-statuses: No commit statuses exist on PR head 63d8961 and no required checks are readable; no run in history. No tracking pointer found. — reported as absent, not blocking (gh#633) - Decision: review the PR and merge? (`codex-svd ship --run-id 20261101T110821Z-8f761078 --confirm-merge`)
piers closed this issue 2026-11-01 11:24:09 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
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/people-mind-mcp#6
No description provided.