---
name: myatoms
description: Search, read, synthesize, and save the user's personal notes, book highlights, and web article excerpts stored in MyAtoms. Use whenever the user asks about their past reading notes, highlights, book takeaways, personal knowledge base, or wants to save new insights/notes back to MyAtoms.
---

# MyAtoms Personal Knowledge Base

Connect directly to the user's MyAtoms Personal Context Layer via REST API.

## Setup & Authentication

Requests require a Personal API Key passed via `Authorization: Bearer $MYATOMS_API_KEY`.

- Default API base URL: `https://beta.myatoms.io/api/v1` (override with `MYATOMS_BASE_URL` if configured)
- Never print, echo, or hardcode `$MYATOMS_API_KEY` in outputs or files.
- If `MYATOMS_API_KEY` is not set in the shell environment, tell the user to generate one at `https://beta.myatoms.io/settings/api` and set `export MYATOMS_API_KEY="ma_..."`.

```bash
BASE_URL="${MYATOMS_BASE_URL:-https://beta.myatoms.io/api/v1}"
```

## Retrieval & Synthesis Workflow

Follow this workflow when answering questions grounded in the user's knowledge base:

1. **Discover scope first (when broad)**:
   If the user asks an open question ("what have I been reading?", "overview of my notes", "most annotated books"), call `GET /stats` or `GET /sources` before searching.
2. **Keyword search with fallback**:
   Call `GET /atoms?q=<keywords>` with short, focused terms. If a query returns `0` results:
   - Retry with shorter single keywords or synonyms;
   - Try bilingual equivalents (Chinese <-> English) because highlights/notes may be in either language;
   - Or list sources via `GET /sources?q=...` and inspect a matching source via `GET /sources/{id}/atoms`.
3. **Read full untruncated content when needed**:
   If you need complete text or metadata for a specific Atom, fetch `GET /atoms/{id}`.
4. **Always cite sources**:
   Whenever referencing an Atom, cite the source title (and author when available) plus date or link returned by the API. Never fabricate notes that were not returned.
5. **Confirm before writing**:
   Ask for confirmation (or follow explicit user instruction like "save this note to MyAtoms") before calling `POST /atoms`. When saving an AI synthesis or insight, set `"app": "agent-skill"` (or your client name) and keep the text concise and atomic.

## API Commands

All `GET` parameters should be URL-encoded with `curl -G --data-urlencode`.

### 1. Knowledge Base Overview

```bash
curl -sS -H "Authorization: Bearer $MYATOMS_API_KEY" \
  "${MYATOMS_BASE_URL:-https://beta.myatoms.io/api/v1}/stats"
```

### 2. Search Atoms (or fetch recent Atoms)

Query params: `q`, `type` (`note` | `highlight` | `note_highlight`), `sourceType` (`web` | `book`), `sourceId`, `dateFrom`, `dateTo`, `limit` (1–50, default 15), `offset`. Omit `q` to list recent Atoms.

```bash
curl -sS -G -H "Authorization: Bearer $MYATOMS_API_KEY" \
  --data-urlencode "q=productivity focus" \
  --data-urlencode "limit=15" \
  "${MYATOMS_BASE_URL:-https://beta.myatoms.io/api/v1}/atoms"
```

### 3. Get Single Atom by ID

```bash
curl -sS -H "Authorization: Bearer $MYATOMS_API_KEY" \
  "${MYATOMS_BASE_URL:-https://beta.myatoms.io/api/v1}/atoms/<ATOM_ID>"
```

### 4. List Books & Web Articles (Sources)

Query params: `q`, `type` (`web` | `book`), `limit` (1–50, default 20), `offset`.

```bash
curl -sS -G -H "Authorization: Bearer $MYATOMS_API_KEY" \
  --data-urlencode "q=Rich Dad" \
  "${MYATOMS_BASE_URL:-https://beta.myatoms.io/api/v1}/sources"
```

### 5. Get All Atoms from a Specific Source

```bash
curl -sS -G -H "Authorization: Bearer $MYATOMS_API_KEY" \
  --data-urlencode "limit=20" \
  --data-urlencode "offset=0" \
  "${MYATOMS_BASE_URL:-https://beta.myatoms.io/api/v1}/sources/<SOURCE_ID>/atoms"
```

### 6. Save a New Atom

JSON body fields:
- `type`: `"note"` (default), `"highlight"`, or `"note_highlight"`
- `note`, `highlight`, `content`: at least one non-empty string
- `sourceId` OR inline `source`: `{ "type": "web" | "book", "title": "...", "author": "...", "url": "..." }` (optional)
- `app`: optional origin label (defaults to `"api"`)
- `createdAt`: optional ISO 8601 timestamp (e.g. `"2025-03-15T10:30:00Z"`). **Leave omitted/empty for normal note creation** so MyAtoms uses the current time. **Only set `createdAt` when asynchronously syncing/migrating historical notes originally created earlier on another platform** so the original creation date is preserved.

```bash
curl -sS -X POST \
  -H "Authorization: Bearer $MYATOMS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "note",
    "note": "Synthesized takeaway from recent reading...",
    "app": "agent-skill"
  }' \
  "${MYATOMS_BASE_URL:-https://beta.myatoms.io/api/v1}/atoms"
```

## Machine-Readable OpenAPI Schema

- `https://beta.myatoms.io/api/v1/openapi.json`
