Skip to content

Stop enumerating search_datasets' filters in the prompt - #425

Merged
neuromechanist merged 1 commit into
developfrom
fix/370-search-filters-not-enumerated
Sep 21, 2026
Merged

neuromechanist merged 1 commit into
developfrom
fix/370-search-filters-not-enumerated

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

Forced by the nemarOrg/nemar-cli dev -> main promotion happening now. Partial towards #370, not the full rewrite it asks for.

What goes false when nemar-cli promotes

src/assistants/nemar/config.yaml currently tells the model:

Its filters are exactly query, modality, task, has_hed, has_zarr, and limit. There is NO participant-count filter [...] Pass only the six names above.

nemarOrg/nemar-cli#1429 (expose the whole catalog filter surface over MCP) takes search_datasets from 6 advertised parameters to 33, and it is in the release being promoted to production. So all three statements become false on promotion.

The third is the one that does damage. It does not merely under-describe the tool, it instructs the model not to use filters that work. A question about channel counts, participant numbers, sampling rate or session counts then takes a more expensive route or gets declined, and nothing appears broken. #370 predicted exactly this: "the prompt will describe six filters while the tool accepts thirty-three".

Why not just write the longer list

Because it goes stale the same way, on the next facet added. #370 makes the same point: the tool descriptions now carry generated per-parameter documentation, and duplicating them in the prompt recreates the two-copies problem. The server generates its filters from shared/facets.ts; the prompt has no such source, which is the argument for keeping it thin.

So the prompt now points at the schema and keeps the one warning that is not a function of how many filters exist: an argument the server does not declare is accepted and silently ignored, so an invented name returns unfiltered results that look filtered.

Order independence

Deliberate. The new wording is true whether the server advertises 6 filters or 33, so this can ship before or after the nemar-cli promotion without opening a window in either drift direction. Enumerating 33 filters here would have had to land after the promotion, or the model would invent parameters the production server drops.

Scope

Only the nemar_search_datasets entry. #370's other items stand: range syntax and include_unknown, the cost ladder, suggested_questions, the guard that can actually go red, and the open question of how much belongs in the prompt at all. I checked the rest of the config for the same staleness and found none: the other filter mentions are open-world ("modality, task, HED annotations, etc."), the worked example at line 151 uses query and modality which remain valid, and the suggested questions are all still answerable.

uv run pytest tests/test_assistants/: 227 passed, 3 skipped.

The prompt said the filters are exactly query, modality, task, has_hed,
has_zarr and limit, that there is NO participant-count filter, and to
pass only those six names. nemarOrg/nemar-cli#1429 takes the surface to
33 parameters and is in the release now being promoted to production, so
all three statements become false the moment it ships.

The third is the damaging one: it tells the model not to use filters that
work, so a question about channel counts or participant numbers takes a
worse route or gets refused, and nothing looks broken.

Rather than swapping one list for a longer list that goes stale the same
way, the prompt now points at the tool schema, which the server generates
from its facet definitions. The warning that matters is kept and is not a
function of how many filters exist: an undeclared argument is accepted and
silently ignored, so an invented name returns unfiltered results that look
filtered.

Partial: #370 asks for a whole-config rewrite and raises open questions
about how much belongs in the prompt at all. This is the correctness fix
the nemar-cli promotion forces, not that rewrite.
@neuromechanist
neuromechanist merged commit 12ad88c into develop Sep 21, 2026
9 checks passed
@neuromechanist
neuromechanist deleted the fix/370-search-filters-not-enumerated branch September 21, 2026 20:44
This was referenced Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant