Build a custom source → raw-intake adapter for Athenaeum. Use when someone wants to feed an external source (an API, an export file, a message feed, a scraper, another tool's output) into an Athenaeum knowledge base, asks "how do I write an adapter / integration for athenaeum", or wants to turn some data source into wiki entities the librarian can compile.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Adapter Authoring?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/kromatic-innovation-adapter-authoring)
---
name: adapter-authoring
description: Build a custom source → raw-intake adapter for Athenaeum. Use when someone wants to feed an external source (an API, an export file, a message feed, a scraper, another tool's output) into an Athenaeum knowledge base, asks "how do I write an adapter / integration for athenaeum", or wants to turn some data source into wiki entities the librarian can compile.
---
# adapter-authoring
Teach the user (or yourself, as an agent) how to build a **source adapter** for
Athenaeum: a script or integration that turns an external source into
raw-intake files the librarian compiles into the wiki. This skill is
self-contained — it does not depend on any private Kromatic repo or context.
The authoritative contract this skill operationalises is
[`docs/extending/adapter-contract.md`](https://github.com/Kromatic-Innovation/athenaeum/blob/main/docs/extending/adapter-contract.md).
The runnable reference is
[`examples/adapters/minimal_adapter.py`](https://github.com/Kromatic-Innovation/athenaeum/blob/main/examples/adapters/minimal_adapter.py).
This skill file ships inside the published `athenaeum` package (under `skills/`);
the contract doc and example live in the repository and the source distribution
(links above), so it stays self-contained however it was installed.
**Not the same thing as a store backend.** This skill is about a **source**
adapter — turning external data into `raw/` intake files, per
`docs/extending/adapter-contract.md` above. If instead you are implementing a
**storage backend** (the bytes-level device athenaeum persists its knowledge
root on, such as an object store or a database), that is the `Backend` protocol,
and it has its own contract and its own runnable conformance suite:
- [`docs/extending/store-contract.md`](https://github.com/Kromatic-Innovation/athenaeum/blob/main/docs/extending/store-contract.md)
— the published storage interface: five required methods, the optional
capabilities the facade emulates, and a worked minimal backend.
- `athenaeum.BackendConformanceTests` — subclass it, implement `make_backend`
to return your backend, and run pytest; the contract page shows the exact shape.
The two adapters never collide (same non-overlap `docs/extending/storage-adapter-contract.md`
draws between the storage-adapter layer and this skill's intake adapters): an
intake adapter turns an external source into `raw/` files and stops at
"how data *enters* the pipeline"; a `Backend` implementation governs how the
already-compiled wiki is physically read and written. If you're feeding a new
external source in, keep reading this skill. If you want athenaeum's
knowledge root to live on a different physical backend, go to
`docs/extending/store-contract.md` instead.
## The one rule
A source **only appends raw files** to the intake tree. A separate compiler —
the librarian — is the **only** writer to the wiki. Your adapter's entire job is
to write well-shaped raw-intake files; everything downstream (clustering, merge,
contradiction detection, retirement) is the librarian's job, not yours. Safety
comes from this structure, not from trusting the source.
## Which lane?
- **Lane A (default)** — `raw/<source>/<timestamp>-<uuid8>.md`. Use for almost
every external source. This skill walks Lane A.
- **Lane B (auto-memory)** — `raw/auto-memory/<scope>/…`. Only for bridging an
agent runtime's own memory folder. If that's your case, follow
[`docs/guides/claude-code.md`](https://github.com/Kromatic-Innovation/athenaeum/blob/main/docs/guides/claude-code.md)
instead — it is a complete worked Lane-B adapter.
## Build it in six steps
1. **Name the adapter.** Pick a stable, human-readable `<source>` label
(alphanumerics + `-`/`_`), e.g. `press-releases`, `crm-export`, `notes`. It
becomes the `raw/<source>/` subdirectory and is how a compiled claim is
traced back to your adapter. Do not use the reserved `answers` or
`auto-memory` names.
2. **Extract facts from the source.** Pull each unit of knowledge you want in
the wiki. One raw file per coherent fact/entity is the natural grain — the
compiler will cluster and merge related ones, so err toward more small files
rather than one giant file.
3. **Shape each file.** The contract is the file shape, spelled out completely
in the contract document, so you can write it from any language with no
athenaeum code. A prose file is YAML frontmatter + markdown body:
- `source: <type>:<ref>` — the **ultimate** origin (e.g.
`external:<url>`, `api:<vendor>:<date>`, `document:<path>`). Never cite the
raw filename. This is the most important field.
- optional `name:` (a short slug) and `description:` (one line).
- quote every string value (`name: "acme-widget-launch"`), so a colon or `#`
in a value cannot change its meaning.
- the body: markdown; every claim in it should trace to `source`.
The frontmatter schema is open — extra keys round-trip untouched, so you can
carry adapter-specific metadata. See
[`docs/design/provenance-shape.md`](https://github.com/Kromatic-Innovation/athenaeum/blob/main/docs/design/provenance-shape.md) for the full
`source_type` vocabulary and per-field/per-value attribution.
A writer that already knows the exact entity, field and value it wants changed
writes a corrections batch (`.jsonl`) instead; the contract document gives its
header and record keys. The engine computes every `correction_id` itself and
ignores one you supply, so leave it out.
4. **Write it — pick a mechanism:**
- **Direct file drop** (the default; cron job, importer, any language): write
`raw/<source>/<timestamp>-<uuid8>.md` yourself. The filename matches the
literal regular expression `^(\d{8}T\d{6}Z?)-([0-9a-f]{8})\.(?:md|jsonl)$`
(case-insensitive): a UTC `YYYYMMDDTHHMMSSZ` timestamp and 8 random
lowercase hex characters. Do not import athenaeum to do this and do not pin
an athenaeum version. **Copy
[`examples/adapters/minimal_adapter.py`](https://github.com/Kromatic-Innovation/athenaeum/blob/main/examples/adapters/minimal_adapter.py)
as your starting point** — it uses only the Python standard library and
already does the atomic write, path-guard, and provenance correctly. A file
dropped into `raw/` is screened by the deployment's rules when the compile run
reads it, so no write helper is needed to be safe.
- **MCP `remember` tool** (if your integration speaks MCP): call
`remember(content=…, source="<adapter>", sources="<type>:<ref>")`. It
is a convenience that handles the filename, path-guarding,
sensitive-content screening at write time, and provenance injection for you.
5. **Respect idempotency:**
- Write-once: never overwrite a prior intake file; each filename is unique.
- Don't dedupe before writing — re-emitting a fact is safe; the compiler
collapses near-duplicates at compile time.
- Write atomically (same-dir temp + `os.replace`) so a crash never leaves a
half-written frontmatter block.
- Stay strictly inside `raw/`; never write under `wiki/`.
6. **Test with `athenaeum intake check`, then verify the round-trip:**
```bash
athenaeum init --path /tmp/kb # once, to scaffold raw/ + wiki/
python your_adapter.py /tmp/kb # your adapter writes raw/<source>/*.md
athenaeum intake check --path /tmp/kb /tmp/kb/raw/<source> # exit 0 = accepted
athenaeum run --path /tmp/kb # compile raw → wiki
athenaeum recall "<a phrase from your file>" --json --path /tmp/kb
```
`intake check` is read-only and checks against the real configuration of the
deployment you write to: it says whether each file will be read as prose or as a
corrections batch, and which of its page types and fields that deployment does
not know. Use its exit code in your adapter's tests. Re-run `athenaeum run`
— with no new intake it should be a no-op (the pipeline is idempotent).
**Read back through the CLI or MCP, never from the wiki directory.** To learn
whether a page already exists, use `athenaeum recall`, `athenaeum entity` and
`athenaeum enumerate` (or the matching MCP tools); the contract document's
"Reading back" section shows each one. Never open files under `wiki/`, and never
write there: the librarian is its only writer.
## Guardrails
- **No private specifics.** Keep adapters and any examples generic and synthetic
— no PII, no credentials, no machine-local paths, no private-repo details.
Real production adapters belong in their own host repositories; athenaeum's
contract stops at the on-disk raw-intake shape.
- **Fail loudly.** If your source yields nothing (auth failure, empty response),
exit non-zero / raise — do not silently write zero files and report success.
- **Cite the ultimate source, never the raw file.** A `source:` pointing at a
`raw/….md` path is always wrong.
## Reference
- [`docs/extending/adapter-contract.md`](https://github.com/Kromatic-Innovation/athenaeum/blob/main/docs/extending/adapter-contract.md) — the full contract this skill operationalises.
- [`examples/adapters/minimal_adapter.py`](https://github.com/Kromatic-Innovation/athenaeum/blob/main/examples/adapters/minimal_adapter.py) — synthetic, runnable Lane-A adapter.
- [`docs/design/provenance-shape.md`](https://github.com/Kromatic-Innovation/athenaeum/blob/main/docs/design/provenance-shape.md) — provenance grammar and the MCP `remember` API.
- [`docs/guides/claude-code.md`](https://github.com/Kromatic-Innovation/athenaeum/blob/main/docs/guides/claude-code.md) — a complete Lane-B (auto-memory) adapter.
- [`docs/extending/store-contract.md`](https://github.com/Kromatic-Innovation/athenaeum/blob/main/docs/extending/store-contract.md) — the storage interface (the `Backend` protocol) and its runnable conformance suite, `athenaeum.BackendConformanceTests` — for writing a storage backend instead of a source adapter.