Conversation
…_plan MCP tools
Exposes the foraging pipeline to MCP clients with three new tools and
wires a kind/metadata filter into `MemoryStore.search` so scoped
queries stay out of the main search surface.
MCP tools (registered in `apps/mcp-server/src/tools/foraging.ts`):
- `examples_list({ repo_root })` — compact rows (example_name,
manifest_kind, observation_count, last_scanned_at).
- `examples_query({ query, example_name?, limit? })` — BM25 hits
scoped to `kind = 'foraged-pattern'`, optionally narrowed to one
example. Snippets only — full bodies via `get_observations`.
- `examples_integrate_plan({ repo_root, example_name, target_hint? })`
— deterministic plan: npm dependency delta, files_to_copy from
indexed entrypoints, npm script config_steps, and
uncertainty_notes for everything the planner couldn't resolve.
Core surface:
- `MemoryStore.search(query, limit?, embedder?, filter?)` now accepts
`{ kind?: string; metadata?: Record<string, string> }`. When a
filter is set we skip vector re-rank — the embedding index has no
kind column, so mixing vector hits would require a second pass to
drop the off-kind rows.
- `Storage.searchFts(query, limit, filter?)` applies the filter in
SQL via `json_extract` so the LIMIT still bounds the scan.
Foraging surface:
- `buildIntegrationPlan(storage, opts)` — pure function. Reads
manifests fresh from disk rather than from the compressed
observation content (JSON is not round-trip safe through the
compressor).
CLI commands and SessionStart hook wiring arrive in the next PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
NagyVikt
added a commit
that referenced
this pull request
Apr 24, 2026
…_plan (#46) Fills the contract gap between the merged foraging PRs (#41, #43, #44, #45) and CLAUDE.md's 'new MCP tool → update docs/mcp.md' rule. Each entry lists inputs, return shape, and the non-obvious semantics (vector re-rank skipped when filter is set; dependency_delta only computed for npm; target_hint path resolution). Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>
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.
Automated by gx branch finish (PR flow).