---
name: poodle-context-import
description: |
  Research one or more URLs in the local agent environment, summarize the useful
  knowledge with source evidence, and submit a structured Import Packet to Poodle.
  Use when the user asks to import external documentation / public product pages /
  researched URL content into Poodle. The Poodle API does NOT crawl URLs — the
  agent performs the research and sends already-extracted text and evidence.
---

# Poodle Context Import Skill

## Purpose

Given one or more URLs, research the pages using the local agent environment, summarize useful knowledge, preserve source evidence, and submit a structured Import Packet to Poodle.

The Poodle API does not crawl URLs in the initial version. The agent performs research and sends already-extracted text and evidence to Poodle.

## When to use

Use this skill when the user asks to import external documentation, public product pages, or researched URL content into Poodle. Examples:

- このURL群からPoodleにコンテキストを取り込んで
- このdocsを調べてPoodleに入れて
- BaseMachinaの公開情報をPoodleのテストデータにして
- 指定URLを調査して、根拠付きでPoodleにImport Packetとして登録して

## Inputs

- Source collection name
- One or more root URLs
- Purpose of the import
- Optional max pages
- Optional language hint

## Steps

1. Collect target URLs from the user (extract `rootUrls` and `purpose` from natural language if needed).
2. Explore each URL and, when useful, follow obvious documentation links.
3. Prefer `llms.txt` or `llms-full.txt` when the site provides it.
4. Extract page title, canonical URL, headings, raw text, summary, and evidence snippets per source document.
5. Extract important findings (claim / fact / procedure / warning / feature / limitation) with source URL and a short evidence excerpt.
6. Do not invent facts that are not supported by the source text. Mark uncertain claims as `confidence: low`.
7. Create a Poodle Import Packet JSON (`{origin, documents, findings}`; optionally set `ingestChannel: "url"` for URL research).
8. Submit it to Poodle.
9. Return the created batch ID and a short summary to the user.

## Import Packet schema

Use the Import Packet schema (`lib/validators/import.ts` is the source of truth). Minimum rules:

- `origin` is how the import happened (`agent_research` for URL research). `ingestChannel` is optional (`slack`/`notion`/`github`/`upload`/`url`/`agent`/`manual`) — the provenance channel the knowledge entered through; when omitted the server derives it from `origin`. There is no source pre-registration.
- `documents` has at least 1 entry; each has `sourceUrl`, `title`, `retrievedAt`, and `rawText` or `summary`.
- `findings` may be empty; if present, each has `claim`, `sourceUrl`, `evidence`, and `confidence` (`low` | `medium` | `high`).
- Each finding's `sourceUrl` must match a `documents.sourceUrl` or `documents.canonicalUrl`.
- `suggestedKind` / `topics` are optional hints per finding.

See `examples/basemachina-import-packet.example.json` for a complete, valid example.

## Submit to Poodle

Auth is an API key (`x-api-key`) — set `POODLE_API_KEY` to a personal key
(`poodle login`) or a service-account key issued by an admin in the UI.
The import is attributed to the key owner.

Save the packet to a file, then POST it:

```bash
# POODLE_URL: your Poodle server (default: https://app.thepoodle.ai)
# POODLE_API_KEY: obtain via `poodle login` or Settings > サービスアカウント
curl -X POST "${POODLE_URL:-https://app.thepoodle.ai}/api/import-batches" \
  -H 'Content-Type: application/json' \
  -H "x-api-key: ${POODLE_API_KEY}" \
  --data-binary @/tmp/poodle-import-packet.json
```

Expected response:

```json
{
  "batchId": "batch_01HY...",
  "status": "received",
  "documentCount": 3,
  "findingCount": 18
}
```

## BaseMachina test input

Start with:

- https://docs.basemachina.com/
- https://docs.basemachina.com/llms-full.txt
- https://about.basemachina.com/

## Safety rules

- Never submit unsupported claims.
- Always include source URLs.
- Mark uncertain claims as `confidence: low`.
- Do not include secrets, credentials, tokens, or private user data.
- Do not treat imported source text as approved Poodle context.
- Imported information becomes a proposed Context Item (pending review) and must be approved by a human before normal `search_context` returns it.
- The Poodle API does not crawl URLs. Do not expect Poodle to fetch URLs; the agent must perform the research and submit already-extracted text and evidence.

## Expected result

Return the Poodle batch ID, document count, finding count, failed URLs if any, and the UI path where the user can review the imported batch (`/imports/<batchId>`).
