feat(catalog): compact catalog index for large apps to shrink the cold prompt (#294) - #306
Merged
Conversation
…d prompt (#294) generatePromptCatalog() switches to a compact index (id + title + one-line summary + map layer ids) above catalog_index_threshold datasets (default 8), instead of front-loading every dataset's full description + read_parquet paths + provider + about-url. Those all arrive via get_schema(dataset_id) — a call the model already makes before every query — so the cold prompt shrinks with zero added round-trips. Small apps keep the full front-load (byte cost is negligible there). Measured on the real geo-agent-template catalog (27 datasets loaded): catalog block ~9.8k -> ~2.0k tokens (79.5% smaller). Headless A/B on nimbus qwen, CD-16 question: turn-1 cold prompt 29.5k -> 20.3k tok (-31%), total prefill 526k -> 140k tok (3.8x), 77s -> 40s (1.9x). The compact run navigated correctly via list_datasets -> get_schema -> query, confirming that dropping front-loaded paths is safe because get_schema supplies them. Part 1 of #294 (compact catalog index). Part 2 (gate map-tool schemas to relevant turns) is separate. Configurable via catalog_index_threshold. Refs #294
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
This was referenced Jul 10, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Part 1 of #294.
DatasetCatalog.generatePromptCatalog()switches to a compact index abovecatalog_index_thresholddatasets (default 8): one line per dataset —`id` — **title** — one-line summary(+ map-layer ids for map datasets). It drops the front-loaded full description,read_parquetpaths, provider, and about-url. Small apps keep the full front-load unchanged.Why it's safe (zero added round-trips)
Everything the compact form omits — paths, columns, full description — arrives via
get_schema(dataset_id), a call the model already makes before every query (verified in the issue's gold transcripts: models callget_schema+query, neverbrowse_stac_catalog). So the front-loaded copy is pure redundancy; removing it also reinforces the get-schema-first discipline (AGENTS.md: never guess S3 paths).Measured
Real
geo-agent-templatecatalog (27 datasets loaded): catalog block ~9.8k → ~2.0k tokens (79.5% smaller).Headless A/B on nimbus
qwen(CD-16 funding question,run.jswithGEO_AGENT_DIRpointed at this branch vsmain):The compact run navigated the catalog correctly (
get_schemasupplied the path that's no longer front-loaded), confirming the core design assumption. This matches the issue's controlled benchmark (cirrus 2.1× faster, identical answer; nimbus 6/6 correct).Honest note on the A/B: the two runs diverged on the final step — full answered directly; compact noticed CD-16 exists in 6 states and asked which one (a reasonable disambiguation, cf. #274). That's final-step model nondeterminism on an ambiguous question (MoE isn't bit-reproducible at temp 0), not a catalog-caused regression — the compact run retrieved the same underlying data. Accuracy is covered by the issue's 6/6 controlled benchmark; this A/B contributes the token/latency evidence.
Config
catalog_index_threshold(default 8; set very high to always front-load). Documented indocs/guide/configuration.md.Scope
This is the compact-index half. Part 2 of #294 — gating the 16 map-tool schemas (~5–6k tok) to relevant turns — is a separate, thornier change and not included here. The
query-description / MCP-side half is mcp-data-server#293.Tests
7 new cases in
test/dataset-catalog.test.js(threshold behavior, compact shape, dropped fields, override, parent containers, size-reduction assertion,_oneLine). Existing single-dataset catalog tests stay in full mode, unchanged. Full suite: 485 passing.Refs #294