# Web Agent Persona Memory Guide

Use this guide to install the `web-agent-persona-memory` skill.

Recommended human message: Install this skill and follow its setup instructions: https://web-agent-nu.vercel.app/guide.md

## What the agent should do

1. Create a skill directory named `web-agent-persona-memory`.
2. Save the following `SKILL.md` and `agents/openai.yaml` files into that directory.
3. Replace `WEB_AGENT_API_KEY` with the real API key from the browser extension settings page.
4. Use the installed skill whenever the task needs the user's latest professional persona memory.

## SKILL.md

```md
---
name: web-agent-persona-memory
description: Use when you need this user's latest professional persona or profile memory. Fetch it once from the Web Agent backend, prefer grouped `entries`, and reuse it for the current task.
---

# Web Agent Persona Memory

Use this skill when the task needs the human's latest professional profile memory across LinkedIn, X, or other connected profile sources.

## Required setup

- The human must finish at least one supported profile capture in the browser extension.
- The human must generate an API key in the extension settings page.
- Replace `WEB_AGENT_API_KEY` below with the real key during installation.

## Workflow

1. Call `GET https://web-agent-nu.vercel.app/api/memory/latest`.
2. Send header `Authorization: Bearer WEB_AGENT_API_KEY`.
3. Prefer `data.entries` from the JSON response.
4. Treat each entry as one platform or profile memory block; do not collapse them unless the task explicitly needs a merge.
5. Use `data.memory` as the prebuilt merged text fallback, and treat the top-level `persona` / `profile` fields as backward-compatibility helpers.
6. Reuse the fetched result within the same task instead of calling again.

## Error handling

- `401 UNAUTHORIZED`: ask the human for a valid API key from the browser extension settings page.
- `404 PERSONA_MEMORY_NOT_FOUND`: tell the human to finish a browser-extension profile capture and wait for persona generation to succeed.

## Constraints

- Read-only skill. Do not call write endpoints.
- Do not invent profile details when the API has no memory yet.
- Prefer `data.entries` over the top-level `persona` field when multiple profiles are present.
- Do not refetch repeatedly within the same task unless the human explicitly asks for a refresh.
```

## agents/openai.yaml

```yaml
interface:
  display_name: "Web Agent Persona Memory"
  short_description: "Fetch the user's latest grouped persona memory"
  default_prompt: "Use $web-agent-persona-memory to load the user's latest grouped persona memory before handling this task. Prefer the response entries over the legacy top-level persona field."

policy:
  allow_implicit_invocation: true
```

## Runtime notes

- Read-only skill.
- Call `GET /api/memory/latest` once per task, then reuse the returned memory.
- Prefer `data.entries` when multiple profile sources are present; use `data.memory` as the merged fallback.
- `401 UNAUTHORIZED` means the API key is missing, invalid, or revoked.
- `404 PERSONA_MEMORY_NOT_FOUND` means extension capture or persona generation has not completed yet.

Guide URL: https://web-agent-nu.vercel.app/guide.md