feat(context): add hybrid retrieval and typed agent decisions - #3
Closed
keepmeside wants to merge 1 commit into
Closed
keepmeside wants to merge 1 commit into
keepmeside wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved security, MCP compatibility, and retrieval correctness issues block approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (7)
Debug formatting exposes the API key · New UI edits overwrite and disable the default ask-context tool · New HTTP router does not expose the ask-context tool · New Structured tool results omit human-readable content · New Symbol queries ignore chunk symbol_ref values · New Limiting candidates before ranking can omit best matches · New Ask queries perform unbounded full chunk-table scans · New
What changed in this PR
This pull request adds hybrid lexical/vector retrieval, typed agent decisions, the ask-context MCP tool, optional TypeSafe enrichment, and stdio transport support.
Changes:
- Fuses lexical and vector retrieval with evidence-based decisions.
- Adds structured MCP responses and TypeSafe integration.
- Updates configuration, indexing, documentation, plans, and dependencies.
| File | Summary |
|---|---|
src/typesafe.rs |
TypeSafe client and decision state |
src/runtime/stdio.rs |
Stdio MCP runtime |
src/runtime/mod.rs |
Registers stdio runtime |
src/query/mod.rs |
Registers query modules |
src/query/hybrid.rs |
Lexical retrieval and scoring |
src/query/engine.rs |
Retrieval fusion and decisions |
src/query/decision.rs |
Evidence classification and routing |
src/prompts/mcp_ask_context.txt |
Ask-context guidance |
src/mcp/tests.rs |
MCP schema and structured-result tests |
src/mcp.rs |
Ask-context handlers and response workflow |
src/main.rs |
Stdio CLI mode |
src/lib.rs |
Exposes TypeSafe module |
src/indexing/pipeline.rs |
Incremental graph marker |
src/config.rs |
Configuration migration and defaults |
README.md |
English documentation |
README-zh.md |
Chinese documentation |
README-vi.md |
Vietnamese documentation |
plans/reports/turso-260922-2052-assessment.md |
Turso assessment |
plans/reports/2026-09-22-ctxe-system-one-research.md |
Research findings |
plans/260922-2052-typesafe-api/plan.md |
TypeSafe implementation plan |
plans/260922-2052-turso-prototype/plan.md |
Turso prototype plan |
plans/2026-09-22-ctxe-system-one.md |
Overall integration plan |
Cargo.toml |
Enables stdio transport |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const DEFAULT_TIMEOUT_MS: u64 = 5_000; | ||
| const MAX_TIMEOUT_MS: u64 = 30_000; | ||
|
|
||
| #[derive(Debug, Clone)] |
Comment on lines
+463
to
+465
| // `file-retrieval` remains advanced and opt-in. The structured Ask tool is | ||
| // read-only and is the default machine-readable entry point for new installs. | ||
| vec!["codebase-retrieval".to_string(), "ask-context".to_string()] |
| enabled_tools: &[String], | ||
| ) -> Self { | ||
| let all_tools: &[&str] = &["codebase-retrieval", "file-retrieval"]; | ||
| let all_tools: &[&str] = &["codebase-retrieval", "file-retrieval", "ask-context"]; |
Comment on lines
+822
to
+823
| Ok(value) if value.get("error").is_some() => CallToolResult::structured_error(value), | ||
| Ok(value) => CallToolResult::structured(value), |
Comment on lines
+116
to
+118
| "(string::lowercase(content) CONTAINS $term{index} OR \ | ||
| string::lowercase(file) CONTAINS $term{index})" | ||
| ) |
Comment on lines
+121
to
+124
| let statement = format!( | ||
| "SELECT file, line_start, line_end, content, symbol_ref FROM chunk WHERE {} LIMIT $limit", | ||
| predicates.join(" OR ") | ||
| ); |
Comment on lines
+121
to
+124
| let statement = format!( | ||
| "SELECT file, line_start, line_end, content, symbol_ref FROM chunk WHERE {} LIMIT $limit", | ||
| predicates.join(" OR ") | ||
| ); |
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.


No description provided.