people_find adds a related=<n> footer hint on one-row answers #85

Closed
opened 2026-11-04 13:35:13 +00:00 by svc-svd-writer · 2 comments
Collaborator

Problem

On rc.8, Grok answered "who is " with three calls: people_find, people_card and people_related. The people_related call returned 0 rows (#10 Q1 record). The people_find answer gave Grok no way to know that.

The default row's relation cell does not help. It holds only the Owner's own Relation to the Person (OWNER_RELATION, views.py:24-28, rendered at views.py:94-97). people_related also returns direct Relations in either direction, implied colleagues through a shared Organisation, and Persons who share a Tag (views.related, views.py:214-239). An empty relation cell therefore says nothing about whether people_related has rows.

Change

  1. When a people_find answer has exactly one row, add related=<n> to its footer. This covers an exact Handle and a ranked answer with total=1. <n> is the number of rows people_related returns for that Person with no limit.
  2. Compute <n> from the same item list that views.related builds: extract the list builder and use it from both. Do not copy the queries, so the two counts cannot drift.
  3. Answers with zero rows or more than one row keep today's footer unchanged. views.related scans every membership, so a per-row count on a page would cost too much.
  4. The default row stays unchanged. ADR 0003 §3 makes it a closed seven-field list, so the hint goes in the footer, not in a column.
  5. Add one sentence to the people_find docstring (the tool description clients read): related=<n> on a one-row answer counts the people_related rows, and 0 means no people_related call is needed.
  6. Document the footer key in the README people_find row.

Acceptance criteria

  • An exact-Handle people_find for a Person with no Relations, no Organisation peers and no shared Tags ends with a footer containing related=0.
  • For a Person with Relations, colleagues and shared Tags, related=<n> equals the row count of people_related for that Person.
  • A people_find with two or more rows, or with none, has the same footer as before.
  • The people_find tool description contains related=.
  • A one-row answer, row plus footer, stays under 150 o200k tokens.
  • make check passes.

Out of scope

  • A count on multi-row pages.
  • Hints for people_card. The rc.8 record shows Grok also called people_card to cross-check, and no footer key prevents that.
  • Any change to the default row or to ADR 0003.
  • The 0.1.0 gate. Under the #10 ruling (b), this is an optimisation, not a gate item.

Context

The #10 Grok record is comment 32564. Ruling (b) amends #10's call criterion to "the first call's rows hold the answer".

Filed under: operator word "File it as an enhancement after 0.1.0, and take ruling (b) for #10. Under (b), the hint is an optimisation, not a gate item." sha256:1d2e5f187c58

## Problem On rc.8, Grok answered "who is <name>" with three calls: `people_find`, `people_card` and `people_related`. The `people_related` call returned 0 rows (#10 Q1 record). The `people_find` answer gave Grok no way to know that. The default row's `relation` cell does not help. It holds only the Owner's own Relation to the Person (`OWNER_RELATION`, `views.py:24-28`, rendered at `views.py:94-97`). `people_related` also returns direct Relations in either direction, implied colleagues through a shared Organisation, and Persons who share a Tag (`views.related`, `views.py:214-239`). An empty `relation` cell therefore says nothing about whether `people_related` has rows. ## Change 1. When a `people_find` answer has exactly one row, add `related=<n>` to its footer. This covers an exact Handle and a ranked answer with `total=1`. `<n>` is the number of rows `people_related` returns for that Person with no limit. 2. Compute `<n>` from the same item list that `views.related` builds: extract the list builder and use it from both. Do not copy the queries, so the two counts cannot drift. 3. Answers with zero rows or more than one row keep today's footer unchanged. `views.related` scans every membership, so a per-row count on a page would cost too much. 4. The default row stays unchanged. ADR 0003 §3 makes it a closed seven-field list, so the hint goes in the footer, not in a column. 5. Add one sentence to the `people_find` docstring (the tool description clients read): `related=<n>` on a one-row answer counts the `people_related` rows, and 0 means no `people_related` call is needed. 6. Document the footer key in the README `people_find` row. ## Acceptance criteria - [ ] An exact-Handle `people_find` for a Person with no Relations, no Organisation peers and no shared Tags ends with a footer containing `related=0`. - [ ] For a Person with Relations, colleagues and shared Tags, `related=<n>` equals the row count of `people_related` for that Person. - [ ] A `people_find` with two or more rows, or with none, has the same footer as before. - [ ] The `people_find` tool description contains `related=`. - [ ] A one-row answer, row plus footer, stays under 150 o200k tokens. - [ ] `make check` passes. ## Out of scope - A count on multi-row pages. - Hints for `people_card`. The rc.8 record shows Grok also called `people_card` to cross-check, and no footer key prevents that. - Any change to the default row or to ADR 0003. - The 0.1.0 gate. Under the #10 ruling (b), this is an optimisation, not a gate item. ## Context The #10 Grok record is comment 32564. Ruling (b) amends #10's call criterion to "the first call's rows hold the answer". Filed under: operator word "File it as an enhancement after 0.1.0, and take ruling (b) for #10. Under (b), the hint is an optimisation, not a gate item." sha256:1d2e5f187c58
Author
Collaborator

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

Run: 20261104T224040Z-8222127d

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

Open risks:

  1. ADR 0001 (docs/adr/0001-service-beside-mailmind.md:28) says that a list ends with a footer of next_cursor, more and total. Does adding related= need an ADR 0001 amendment, or is the operator's filing of #85 enough? The lean is that no amendment is needed: the key is additive and appears on one-row answers only, and the issue excludes only ADR 0003 changes. If an amendment is wanted, it goes in a separate docs issue. [decision]
  2. make check and the 150-token whole-answer budget were not measured at spec time, because the sandbox denies the target .venv. Dispatch must run make check on the pristine base before the first edit, run it again after the change, and confirm the failure set is unchanged apart from the tests this spec adds or updates. test_find_one_row_answer_under_150_tokens must pass. [verification]
  3. The ranked one-row check assumes people_find query='Contact 0' returns total=1 in seeded_store. This was established by inspection and not executed. Dispatch confirms it on the pristine base (its footer ends with total=1). If it does not, dispatch substitutes a name query that yields exactly one row. [verification]

Change: Move views.related's item builder (views.py:218-245, from the items list through the dedupe and the sort) unchanged into a private _related_items(conn, cfg, ref) -> list[list[object]]. Write it in the private-helper style of _organisation_candidates (views.py:113-130). related() then becomes return _paged(_related_items(...), cursor, limit, max_chars). In views.find, after selected, tail = page(matches, cursor, limit) (views.py:182), add: if len(matches) == 1 and selected: tail += f" related={len(_related_items(conn, cfg, selected[0][0]))}". Leave rows.footer and rows.page unchanged. Add one Footer: sentence containing related= to the people_find docstring (server.py:108-116), mirroring the people_changes Footer: line at server.py:193. Append one sentence to the README.md:55 people_find row. Update the exact one-row footer assertion at tests/test_server.py:155 and add tests for: related=0, parity with the people_related total=, unchanged zero-row and multi-row footers, the description, and the 150-token budget on the whole answer.

Files: src/people_mind_mcp/views.py · src/people_mind_mcp/server.py · README.md · tests/test_server.py

Decision: accept the 3 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-04-people-find-adds-a-related-n-footer-hint-on-one-row-answers.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-people-find-adds-a-related-n-footer-hint-on-one-row-answers.md

### ⏸ SVD architect gate: dev/people-mind-mcp#85 people-find-adds-a-related-n-footer-hint-on-one-row-answers **Status:** CLEAN after 0 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity `standard` · dispatch effort `medium` **Run:** `20261104T224040Z-8222127d` **Held because:** CLEAN but 3 open risk(s) (2 verification · 1 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. ADR 0001 (docs/adr/0001-service-beside-mailmind.md:28) says that a list ends with a footer of next_cursor, more and total. Does adding related= need an ADR 0001 amendment, or is the operator's filing of #85 enough? The lean is that no amendment is needed: the key is additive and appears on one-row answers only, and the issue excludes only ADR 0003 changes. If an amendment is wanted, it goes in a separate docs issue. [decision] 2. make check and the 150-token whole-answer budget were not measured at spec time, because the sandbox denies the target .venv. Dispatch must run `make check` on the pristine base before the first edit, run it again after the change, and confirm the failure set is unchanged apart from the tests this spec adds or updates. test_find_one_row_answer_under_150_tokens must pass. [verification] 3. The ranked one-row check assumes people_find query='Contact 0' returns total=1 in seeded_store. This was established by inspection and not executed. Dispatch confirms it on the pristine base (its footer ends with total=1). If it does not, dispatch substitutes a name query that yields exactly one row. [verification] **Change:** Move views.related's item builder (views.py:218-245, from the items list through the dedupe and the sort) unchanged into a private _related_items(conn, cfg, ref) -> list[list[object]]. Write it in the private-helper style of _organisation_candidates (views.py:113-130). related() then becomes `return _paged(_related_items(...), cursor, limit, max_chars)`. In views.find, after `selected, tail = page(matches, cursor, limit)` (views.py:182), add: `if len(matches) == 1 and selected: tail += f" related={len(_related_items(conn, cfg, selected[0][0]))}"`. Leave rows.footer and rows.page unchanged. Add one `Footer:` sentence containing `related=` to the people_find docstring (server.py:108-116), mirroring the people_changes `Footer:` line at server.py:193. Append one sentence to the README.md:55 people_find row. Update the exact one-row footer assertion at tests/test_server.py:155 and add tests for: related=0, parity with the people_related total=, unchanged zero-row and multi-row footers, the description, and the 150-token budget on the whole answer. **Files:** `src/people_mind_mcp/views.py` · `src/people_mind_mcp/server.py` · `README.md` · `tests/test_server.py` **Decision:** accept the 3 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-04-people-find-adds-a-related-n-footer-hint-on-one-row-answers.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-people-find-adds-a-related-n-footer-hint-on-one-row-answers.md`</sub>

This was generated by AI during triage.

Triage: wontfix

The operator closed this as wontfix on 2026-11-05. The one-row hint would have saved no people_related call in the live records on #10:

Run people_find rows people_related called
rc.8 Q1 10 yes, 0 rows
rc.8 Q2 1 no
rc.10 Q1 8 yes
rc.10 Q2 1 no
rc.10 Q3 15 yes, 0 rows

Every people_related call followed a multi-row answer, and a count on multi-row pages is out of scope here on cost. The SVD spec held at the gate (run 20261104T224040Z-8222127d) is dropped.

The reason is recorded in .out-of-scope/people-find-related-hint.md (PR #94). Reopen if a live record shows a one-row answer followed by an empty people_related call.

Filed under: operator word "wontfix, close" sha256:269b28c3a6f8

> *This was generated by AI during triage.* ## Triage: wontfix The operator closed this as wontfix on 2026-11-05. The one-row hint would have saved no people_related call in the live records on #10: | Run | people_find rows | people_related called | |---|---|---| | rc.8 Q1 | 10 | yes, 0 rows | | rc.8 Q2 | 1 | no | | rc.10 Q1 | 8 | yes | | rc.10 Q2 | 1 | no | | rc.10 Q3 | 15 | yes, 0 rows | Every people_related call followed a multi-row answer, and a count on multi-row pages is out of scope here on cost. The SVD spec held at the gate (run 20261104T224040Z-8222127d) is dropped. The reason is recorded in `.out-of-scope/people-find-related-hint.md` (PR #94). Reopen if a live record shows a one-row answer followed by an empty people_related call. Filed under: operator word "wontfix, close" sha256:269b28c3a6f8
svc-agent-writer 2026-11-05 03:59:03 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 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#85
No description provided.