Skip to content

feat(retrieval): default to agent explore and retire map-nav - #395

Merged
EricNGOntos merged 6 commits into
mainfrom
feat/wuchengke/2026-09-08
Sep 8, 2026
Merged

EricNGOntos merged 6 commits into
mainfrom
feat/wuchengke/2026-09-08

Conversation

@EricNGOntos

Copy link
Copy Markdown
Contributor

Summary

  • make agent-explore the default retrieval route with Cursor SDK and OpenAI harness support
  • add corpus tools, budget tracking, path/ref resolution, and dynamic MCP exposure
  • retire the legacy map-nav implementation into deprecated inventory
  • update retrieval contracts, configuration, migrations, and operational docs

Verification

  • make check
  • uv run pytest packages/shared-python/shared/tests/test_agent_explore_harness.py packages/shared-python/shared/tests/test_section_path_lookup.py packages/shared-python/shared/tests/test_asset_inline.py packages/shared-python/shared/tests/test_knowhere_hybrid_tokenize.py apps/api/tests/contract/test_retrieval_classic_map_unit_contract.py apps/api/tests/contract/test_retrieval_contract.py (57 passed)

EricNGOntos and others added 6 commits September 8, 2026 21:20
Added constants for body chunk types that can own Root-parked assets in the serving manifest and navigation modules. Updated relevant logic to utilize these constants for improved clarity and maintainability. Enhanced documentation in the CORPUS_SCHEMA to reflect the ownership rules of body chunks.
Updated the README to reflect the new Knowhere 2.0 branding. Enhanced the retrieval server by integrating corpus tools for improved functionality and backward compatibility. Introduced a character budget for evidence text across various tools, ensuring consistent output limits. Refactored agent tools to utilize shared snippet building logic, improving code maintainability and reducing duplication. Added support for a new agentic routing mechanism to facilitate exploration through the agent_explore path.
Enhanced the agent exploration logic by implementing a two-phase fix for stale tool-message collapsing, ensuring efficient message management across turns. Introduced a fallback mechanism for trajectory references, allowing the system to utilize previously read content when no current references are available. Updated documentation to clarify the requirements for `refs` when calling `{FINISH_TOOL_NAME}` and refined the handling of tool messages to prevent unnecessary resends, optimizing performance and clarity in the exploration process.
Added support for the Cursor SDK as an alternative harness for agent exploration. Introduced a new optional dependency, `cursor-sdk`, and updated the agent exploration logic to allow switching between OpenAI-compatible and Cursor SDK providers. Enhanced the `debug_agent_explore_episode` script to accept a `--harness` argument for selecting the desired harness. Updated relevant documentation and configuration to reflect these changes, ensuring clarity on the new harness integration.
…ath resolution

Updated the agent exploration logic to include a budget status line in tool observations, allowing the model to self-regulate based on remaining budget. Improved section path resolution by integrating a new method for handling ambiguous paths and ensuring accurate references during retrieval. Enhanced documentation to clarify the behavior of the `read` tool regarding section paths and added notes for better guidance on recall tool usage.
Archive map-nav out of the live path, keep shared scoring for classic
BM25 and corpus.recall, drop the FTS fallback and unused chunk
tsvector columns, and use cursor_sdk unless use_agentic is false.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment on lines +209 to +210
"- ``kw hit`` = expected keywords found in ``evidence_text`` "
"(proxy for recall quality, not a full answer judge).\n",
Comment on lines +211 to +212
"- Phase 0 ad-hoc queries are separate; this set is the 8 questions "
"from ``zh_档案知识库测试样例.docx``.\n",
]

steps: list[AgentStep] = []
stop_reason = "finished"
from sqlalchemy.ext.asyncio import AsyncSession

from shared.services.retrieval.agent_tools import REGISTRY, ToolContext, ToolSpec
from shared.services.retrieval.agent_tools import tools as _agent_tools_registered # noqa: F401
so concurrent tool calls (a real Cursor SDK behavior, not just a
theoretical one — see ``harness/cursor_harness.py``) are always safe.
"""
...
ToolResult,
load_corpus_schema_text,
)
from shared.services.retrieval.agent_tools import tools as _agent_tools_registered # noqa: F401
)
from shared.services.retrieval.agent_explore.types import AgentStep, EpisodeResult
from shared.services.retrieval.agent_tools import REGISTRY, ToolBudget, load_corpus_schema_text
from shared.services.retrieval.agent_tools import tools as _agent_tools_registered # noqa: F401
@EricNGOntos
EricNGOntos merged commit 1bad89d into main Sep 8, 2026
6 checks passed
@EricNGOntos
EricNGOntos deleted the feat/wuchengke/2026-09-08 branch September 8, 2026 13:28
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.

2 participants