Skip to content

Complete correspondent search and add an evidence-backed history command #108

Description

@jmcte

Objective

Make the first promised operator job genuinely useful: “What is my history with this person?”

Current search filters sender only and omits participants, labels, flags, and attachment summaries from results. Messages where the correspondent is only a recipient are therefore missed.

Relevant code

  • src/mailplus_intelligence/index_writer.py:236-318
  • src/mailplus_intelligence/cli.py:54-110
  • docs/index-query-contract.md
  • README.md:141-148

Scope

  • Search a correspondent across from, to, cc, and optionally bcc roles.
  • Add recipient/domain, label, flag, mailbox/folder, date, attachment, and thread filters with composable semantics.
  • Hydrate result rows with participants, labels, flags, attachment metadata summary, thread confidence, and locator status.
  • Add stable pagination/cursor behavior rather than a bare unvalidated limit.
  • Add mpi history <address-or-domain> that presents a chronological/thread-grouped metadata timeline.
  • Show source locators and explicit missing/ambiguous locator states.
  • Keep raw bodies out of search results.

Non-goals

  • No semantic relationship graph or inferred person merging.
  • No raw full-text body search.
  • No automatic contact identity merge across aliases.
  • No remote UI.

Acceptance criteria

  • Correspondent search finds messages in every participant role.
  • Domain and exact-address matching semantics are documented.
  • Filters compose predictably and validate bad input.
  • Results include the fields promised by the index query contract.
  • Pagination is stable under repeated reads.
  • mpi history groups/orders messages deterministically and prints locators.
  • Missing/ambiguous locators remain visible for review.
  • Query plans/indexes are inspected against a representative synthetic corpus.
  • Tests cover participant roles, compound filters, pagination, empty results, and privacy boundaries.

Validation

PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=src python3.12 -m unittest tests.test_index_writer tests.test_cli -v
bash scripts/ci/run-fast-checks.sh

Dependency notes

Depends on the unified ingest/thread/reconciliation model. API design can begin in parallel, but implementation should not duplicate temporary thread or participant rules.

Exact dependencies

Implementation depends on #107. Query and CLI API design may begin earlier, but must not duplicate temporary participant or thread semantics.

Parent

Part of #98.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:dataData, schema, storage, privacy, or migration surface.featureNew feature or requestpriority:P2Codex Connector P2; blocks execution until Athena validates.ready-for-agentIssue is approved for worker-lane execution.risk:mediumMedium-risk change; normal care required.status:ready-for-agentIssue is approved for worker-lane execution.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions