# search

事前に関連する文言やレコードが分からない場合に、認可されたmemoryを検索します。

- Canonical: https://docs.xmemo.dev/ja/docs/tools/search
- Locale: ja-JP
- Content-Locale: ja-JP
- Canonical-Content-Digest: e4c087a8f0e12c7c67bbf556d6d2f73b0e61a736a9b8686e77e1b181a14238a7
- Edition-Digest: 1a70af2ce1175dc9430a3cf1e73c27f855a8a0a22be296ad65577b7a6e477e5d
- Source-Revision: sha256:0f9b76db3972abc862d49a83f61e83eed6529dc4507a3c290949f892dcaa48f9

## Tool Reference: `search_memory`

### Purpose

認可されたXMemo memoryをstrict targeted-match semanticsで検索し、弱いmatchを暗黙に回答として扱わないようにします。

### Parameters

- `query` (string, required): 一致させるexact topicまたはwordingです。
- `limit` (integer, optional, default: 5): 結果数です。
- `path_filter` (string, optional, default: %): Claude plugin profile専用のlogical-path ILIKE filterです。Generic public profileでは受け付けません。
- `memory_type` (string, optional, default: %): Claude plugin profile専用のmemory type filterです。Generic public profileでは受け付けません。
- `prefer_working` (boolean, optional, default: false): Claude plugin profile専用です。vector resultよりactive working stateを先に配置します。

### Returns

opaque reference、location、content、任意のexplanation/agent-boundary metadataを含むranked text responseです。Resultは認可されたmemoryだけに制限されます。

### Errors

- 401/403: requestにmemory:readがない、または選択したscope/teamにアクセスできません。
- Validation failure: query、limit、path pattern、またはmemory typeが無効です。
- No-match response: targetと認可されたfilterを同時に満たすstrong resultがありません。callerは暗黙にrecall semanticsへ置き換えないでください。

### Examples

#### Strictなproject-scoped lookup



```typescript
search_memory({
  query: "token identity fallback",
  limit: 5
})
```

### Related Tools

- [recall](/docs/tools/recall): strict matchingが不要な場合はforgiving best-effort retrievalを使います。
- [recall_context](/docs/tools/recall-context): prompt contextにはbounded multi-memory retrievalを使います。
- [forget](/docs/tools/forget): 返されたreferenceを確認してからexact recordを削除します。

## 多すぎる検索結果を絞り込む

limitを上げる前にscopeとpathのfilterを追加します。scopeを指定しないqueryでlimitを広げても、signalではなくnoiseが増えるだけです。

```ts
search_memory({
  query: "token identity fallback",
  limit: 5
})
```

