# useDocyrusAgentMemoryCandidates URL: /docs/native/hooks/use-docyrus-agent-memory-candidates Backend glue for the DocyrusAgent memory-extraction dialog — extract candidates from a thread, then save or skip them. ## Installation ```bash pnpm dlx @docyrus/cli add @docyrus/rn-hooks-use-docyrus-agent-memory-candidates ``` A verbatim port of the web hook. `extract()` calls `GET /v1/ai/memory-candidates` for the thread; `save` / `saveAll` write through `POST /v1/ai/memories`; skipping and level changes are local. Drive [`DocyrusAgentMemoryExtractionDialog`](/docs/native/docyrus/docyrus-agent#memories) with it. ## Usage ```tsx const candidates = useDocyrusAgentMemoryCandidates({ client, threadId: activeThreadId, agentId: AGENT_ID }); ``` ## API Reference ### UseDocyrusAgentMemoryCandidatesArgs | Option | Type | Default | Description | |--------|------|---------|-------------| | `client` | `DocyrusAgentMemoryCandidatesClient \| null \| undefined` | - | Client with `get` / `post` | | `threadId` | `string \| null` | - | Thread to extract from (required to extract / save) | | `agentId` | `string` | - | Agent the memories belong to (required to save) | | `projectId` | `string \| null` | `null` | Project scope of saved memories | | `userId` | `string \| null` | `null` | User scope of saved memories | | `defaultImportance` | `number` | `3` | Importance when a candidate has none | | `defaultLevel` | `string` | `'user_agent'` | Level when a candidate has none | ### UseDocyrusAgentMemoryCandidatesResult | Field | Type | Description | |-------|------|-------------| | `candidates` | `ReadonlyArray` | Current candidates | | `isLoading` / `isSaving` | `boolean` | Extract / save state | | `error` | `string \| null` | Last error | | `extract` | `() => Promise` | Fetch candidates for `threadId` | | `save` | `(candidate) => Promise` | Save one | | `skip` | `(candidate) => void` | Skip one (local) | | `saveAll` | `() => Promise` | Save every candidate | | `skipAll` | `() => void` | Clear the list (local) | | `setLevel` | `(candidate, level: string) => void` | Change a candidate's level (local) | | `setCandidates` | `(candidates) => void` | Replace the list | | `reset` | `() => void` | Reset all state |