---
name: linkgarden
description: Plant links into a Linkgarden and forage them later for inspiration. Use when the user shares a URL worth keeping, or asks what they've saved about a topic.
---

# Linkgarden

The user keeps a garden of links at https://linkgarden.ai. You can plant into it and, soon, forage from it.

Base URL: `https://jwyfrakwiquzqsxfffma.supabase.co/functions/v1`
Auth: `Authorization: Bearer $LINKGARDEN_TOKEN` (an API token from the app, or the user's session JWT).
If the token is missing, ask the user for it once and suggest storing it as `LINKGARDEN_TOKEN`.

## Plant a link

```
POST /capture
Content-Type: application/json

{ "url": "https://example.com/article", "note": "why it matters", "source": "agent" }
```

- `url` may be a page of prose; the first http(s) link in it is used.
- A tweet URL is resolved to the first link inside the tweet; the tweet becomes `sourceUrl`.
- Tracking parameters are stripped and the URL is deduplicated per user.
- `note` is optional and is kept on the seed.

Response:

```
{ "ok": true, "id": "…", "duplicate": false, "url": "…", "domain": "example.com",
  "sourceUrl": null, "title": null, "message": "Planted · example.com" }
```

`duplicate: true` means it was already in the garden; the capture count went up. Tell the user in one line using `message`. Add `?plain=1` to get `message` as text/plain instead of JSON.

Failures return `{ "ok": false, "message": "…" }` with a 4xx or 5xx status. Relay `message` verbatim.

## Forage (coming)

```
GET /forage?q=onboarding+ideas&garden=fiveable&limit=8
```

Hybrid keyword and semantic search over the user's seeds, scoped to one garden or all. Until it ships, the endpoint returns 404. Do not fall back to scraping; tell the user foraging isn't live yet.

## Vocabulary

Use the garden's words when talking to the user: a saved link is a **seed**, saving is **planting**, a category is a **garden**, searching is **foraging**, discarding is **composting**.
