people_find matches an organisation name and returns its members #82

Closed
opened 2026-11-04 12:09:46 +00:00 by svc-svd-writer · 2 comments
Collaborator

Problem

people_find "<organisation>" does not return the people at that organisation. In the #10 live Grok check on 2026-11-04, "who do I know at TasmaNet" returned 3 rows from people_find: the organisation's main line and two addresses. It missed the 16 Persons whose organisation is TasmaNet. Grok found them only through a second and third call, ending with people_related on the organisation id (16 rows). #10 requires one call for this question.

Cause

views.find (src/people_mind_mcp/views.py:113) ranks only identity.resolve results and semantic scores. identity.resolve (src/people_mind_mcp/identity.py:43) matches handles and name keys only. Organisation membership lives in fields (name = 'organisation', asserted values and derived organisations ids), which views.related already reads through MEMBERSHIPS (views.py:42). find never consults it.

Change

  1. In views.find, when the query is not handle-shaped, also match the query against organisation names: asserted organisation field values, and organisations.name for derived fields at or above default_row.confidence_threshold, as MEMBERSHIPS does. Use the same name_key normalisation as name matching: an exact key match first, then a token-prefix match.
  2. Return each member as a Candidate with a new reason, organisation, and a score below exact-name (0.8) and above name-prefix (0.6), so a person named like the query still ranks first.
  3. Keep identity.resolve unchanged. It is the merge-path matcher (ADR 0002) and must not learn organisations.
  4. Paging, limit, max_chars and the default row stay unchanged. Hybrid mode adds semantic scores to these candidates as it does to name candidates.
  5. Document the organisation match reason in the README people_find row and in GLOSSARY.md if the glossary lists match reasons.

Acceptance criteria

  • A test store with three Persons at "Acme Pty Ltd" (two asserted, one derived above the threshold) and one below the threshold: people_find "acme" returns the three in one call with reason organisation, and not the fourth.
  • A Person whose own name matches the query still ranks above organisation members.
  • Handle-shaped queries (email, phone, URL) behave exactly as today.
  • The default people_find row stays under 150 tokens (README test).
  • make check passes.

Context

The README names "who do I know at " as a Grok Bot query. The #10 Q3 record has the live call counts.

Filed under: operator word "accept" sha256:c125d0397b60 (#10 gate)

## Problem `people_find "<organisation>"` does not return the people at that organisation. In the #10 live Grok check on 2026-11-04, "who do I know at TasmaNet" returned 3 rows from `people_find`: the organisation's main line and two addresses. It missed the 16 Persons whose organisation is TasmaNet. Grok found them only through a second and third call, ending with `people_related` on the organisation id (16 rows). #10 requires one call for this question. ## Cause `views.find` (`src/people_mind_mcp/views.py:113`) ranks only `identity.resolve` results and semantic scores. `identity.resolve` (`src/people_mind_mcp/identity.py:43`) matches handles and name keys only. Organisation membership lives in `fields` (`name = 'organisation'`, asserted values and derived `organisations` ids), which `views.related` already reads through `MEMBERSHIPS` (`views.py:42`). `find` never consults it. ## Change 1. In `views.find`, when the query is not handle-shaped, also match the query against organisation names: asserted `organisation` field values, and `organisations.name` for derived fields at or above `default_row.confidence_threshold`, as `MEMBERSHIPS` does. Use the same `name_key` normalisation as name matching: an exact key match first, then a token-prefix match. 2. Return each member as a Candidate with a new reason, `organisation`, and a score below `exact-name` (0.8) and above `name-prefix` (0.6), so a person named like the query still ranks first. 3. Keep `identity.resolve` unchanged. It is the merge-path matcher (ADR 0002) and must not learn organisations. 4. Paging, `limit`, `max_chars` and the default row stay unchanged. Hybrid mode adds semantic scores to these candidates as it does to name candidates. 5. Document the `organisation` match reason in the README `people_find` row and in GLOSSARY.md if the glossary lists match reasons. ## Acceptance criteria - [ ] A test store with three Persons at "Acme Pty Ltd" (two asserted, one derived above the threshold) and one below the threshold: `people_find "acme"` returns the three in one call with reason `organisation`, and not the fourth. - [ ] A Person whose own name matches the query still ranks above organisation members. - [ ] Handle-shaped queries (email, phone, URL) behave exactly as today. - [ ] The default `people_find` row stays under 150 tokens (README test). - [ ] `make check` passes. ## Context The README names "who do I know at <org>" as a Grok Bot query. The #10 Q3 record has the live call counts. Filed under: operator word "accept" sha256:c125d0397b60 (#10 gate)
Author
Collaborator

✅ SVD architect gate: dev/people-mind-mcp#82 people-find-matches-an-organisation-name-and-returns-its-mem

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: 20261104T122137Z-2550f440

Change: Add a private helper _organisation_candidates(conn, cfg, query) in src/people_mind_mcp/views.py. It reuses MEMBERSHIPS (views.py:42-46) with cfg.default_row.confidence_threshold, as related() does at views.py:189. It copies identity.resolve's name loop (identity.py:69-88): name_key, then an exact key match → Candidate(pid, 0.75, "organisation"), then a token-prefix match → 0.7, keeping the highest score per person. It returns nothing when the key is empty. In views.find (views.py:124-152), keep the Exact short-circuit and the embed-off guard. Compute the existing handle-shaped predicate into a boolean. When the query is not handle-shaped, merge the resolve candidates with the organisation candidates (highest score per person, sorted by (-score, person_id) as at identity.py:89). The lexical and hybrid branches then iterate the merged list in place of resolved.items; semantic mode is unchanged. Add one sentence to the people_find docstring (server.py:108-115) and to the README people_find row (README.md:55). identity.py, MEMBERSHIPS and GLOSSARY.md are not touched; the glossary does not list match reasons.

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

Decision: dispatch this spec (svd:go)?

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-matches-an-organisation-name-and-returns-its-mem.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-people-find-matches-an-organisation-name-and-returns-its-mem.md

### ✅ SVD architect gate: dev/people-mind-mcp#82 people-find-matches-an-organisation-name-and-returns-its-mem **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:** `20261104T122137Z-2550f440` **Change:** Add a private helper _organisation_candidates(conn, cfg, query) in src/people_mind_mcp/views.py. It reuses MEMBERSHIPS (views.py:42-46) with cfg.default_row.confidence_threshold, as related() does at views.py:189. It copies identity.resolve's name loop (identity.py:69-88): name_key, then an exact key match → Candidate(pid, 0.75, "organisation"), then a token-prefix match → 0.7, keeping the highest score per person. It returns nothing when the key is empty. In views.find (views.py:124-152), keep the Exact short-circuit and the embed-off guard. Compute the existing handle-shaped predicate into a boolean. When the query is not handle-shaped, merge the resolve candidates with the organisation candidates (highest score per person, sorted by (-score, person_id) as at identity.py:89). The lexical and hybrid branches then iterate the merged list in place of resolved.items; semantic mode is unchanged. Add one sentence to the people_find docstring (server.py:108-115) and to the README people_find row (README.md:55). identity.py, MEMBERSHIPS and GLOSSARY.md are not touched; the glossary does not list match reasons. **Files:** `src/people_mind_mcp/views.py` · `src/people_mind_mcp/server.py` · `README.md` · `tests/test_embed.py` · `tests/test_server.py` **Decision:** dispatch this spec (`svd:go`)? **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-matches-an-organisation-name-and-returns-its-mem.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-people-find-matches-an-organisation-name-and-returns-its-mem.md`</sub>
Author
Collaborator

spec-verify-dispatch Half B for dev/people-mind-mcp#82 people-find-matches-an-organisation-name-and-returns-its-mem completed integration verify.

  • PR: #83
  • Branch: feat/svd-dev-people-mind-mcp-82-people-find-matches-an-organi-8fc892c8
  • Commit: 6fe5144ca3
  • Build: none
  • Test: green
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: True
  • Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/73/pipeline/47/1
  • Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll
  • Warning: Scenario table absent in the spec; the criteria-to-test mapping was traced instead. The spec's -k organisation filter collects test_find_matches_organisation_members, and -k "150 or organisation" collects test_find_default_row_under_150_tokens and test_find_organisation_rows_over_http.
  • Warning: The PR also added test_find_description_explains_organisation_members and test_blank_asserted_organisation_falls_back_to_derived. Both are in the named test files.
  • CI wait: ci/woodpecker/pr/validation -> pass
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261104T123646Z-8fc892c8 --confirm-merge)
spec-verify-dispatch Half B for dev/people-mind-mcp#82 people-find-matches-an-organisation-name-and-returns-its-mem completed integration verify. - PR: https://git.groupthink.asia/dev/people-mind-mcp/pulls/83 - Branch: feat/svd-dev-people-mind-mcp-82-people-find-matches-an-organi-8fc892c8 - Commit: 6fe5144ca3e92ed090633d1ce5ad03985ebf365d - Build: none - Test: green - Reader audit clean: True - Spec fidelity: True - Ready for merge: True - Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/73/pipeline/47/1 - Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll - Warning: Scenario table absent in the spec; the criteria-to-test mapping was traced instead. The spec's `-k organisation` filter collects test_find_matches_organisation_members, and `-k "150 or organisation"` collects test_find_default_row_under_150_tokens and test_find_organisation_rows_over_http. - Warning: The PR also added test_find_description_explains_organisation_members and test_blank_asserted_organisation_falls_back_to_derived. Both are in the named test files. - CI wait: ci/woodpecker/pr/validation -> pass - Decision: review the PR and merge? (`codex-svd ship --run-id 20261104T123646Z-8fc892c8 --confirm-merge`)
svc-svd-writer 2026-11-04 12:47:58 +00:00
  • closed this issue
  • removed the
    svd:go
    label
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/people-mind-mcp#82
No description provided.