Skip to content

feat(foraging): add examples_list, examples_query, examples_integrate_plan MCP tools#44

Merged
NagyVikt merged 1 commit intomainfrom
agent/claude/add-foraging-mcp-tools-examples-list-exa-2026-04-24-12-04
Apr 24, 2026
Merged

feat(foraging): add examples_list, examples_query, examples_integrate_plan MCP tools#44
NagyVikt merged 1 commit intomainfrom
agent/claude/add-foraging-mcp-tools-examples-list-exa-2026-04-24-12-04

Conversation

@NagyVikt
Copy link
Copy Markdown
Collaborator

Automated by gx branch finish (PR flow).

…_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 NagyVikt merged commit af5d371 into main Apr 24, 2026
@NagyVikt NagyVikt deleted the agent/claude/add-foraging-mcp-tools-examples-list-exa-2026-04-24-12-04 branch April 24, 2026 10:18
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>
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