AI agent docs
Ce contenu n’est pas encore disponible dans votre langue.
Every Kiavi package ships with an init CLI that drops the same authoritative integration guide you’re reading here into your repo, where coding agents (Cursor, Claude Code, Aider, Continue, GitHub Copilot Chat with custom instructions, etc.) will pick it up.
The docs that get installed are the same llm-docs.md files that ship with the installed package version. They are version-pinned, so they describe the API of the version you actually have installed, not whatever’s current on npm.
Run it
Section titled “Run it”After installing one or more Kiavi packages:
npx kiavi-browser initnpx kiavi-js initnpx kiavi-react-native init(Substitute pnpm dlx, bunx, or yarn dlx for npx if you prefer. Pass --yes to skip the confirmation prompt, useful in CI.)
Each command:
- Writes the package’s integration guide to
.kiavi/<package-name>.mdin your repo root. - Adds (or updates) a fenced reference block in
AGENTS.md, or creates one ifAGENTS.mddoesn’t exist. Falls back toCLAUDE.mdif that’s what your repo uses instead.
Re-running is safe and idempotent. Running multiple Kiavi inits accumulates, the fenced block always lists every Kiavi doc currently installed.
What the AGENTS.md block looks like
Section titled “What the AGENTS.md block looks like”<!-- kiavi:start -->
## Kiavi auth
Integration docs for the Kiavi packages installed in this repo. When adding,modifying, or removing authentication code, read the relevant file(s) belowbefore making changes.
- [@kiavi/kiavi-browser](./.kiavi/kiavi-browser.md)- [@kiavi/kiavi-js](./.kiavi/kiavi-js.md)<!-- kiavi:end -->The fence markers (<!-- kiavi:start --> / <!-- kiavi:end -->) are how the init script finds the block on re-runs. Don’t edit them. Anything outside the fence is left alone, you can keep your own AGENTS.md content above and below it.
When to re-run
Section titled “When to re-run”After upgrading any Kiavi package. The package’s postinstall hook prints a one-line hint pointing you at the right command. It stays silent when the docs are already at the installed version, so unchanged upgrades produce no noise:
→ @kiavi/kiavi-browser updated to 0.4.0, run `npx kiavi-browser init` to refresh integration docs.Each installed .kiavi/<package>.md carries a version marker on its first line so the postinstall hook can compare:
<!-- @kiavi/kiavi-browser@0.3.1 -->
# @kiavi/kiavi-browser
...Should I commit .kiavi/ and AGENTS.md?
Section titled “Should I commit .kiavi/ and AGENTS.md?”Yes. Both should be checked in. They’re part of the agent context for your repo, the same way a README is. Reviewers benefit from seeing the integration guide your agent saw when it wrote the auth code.
The .kiavi/ files are short (around 250 lines per SDK) and they don’t change between unrelated commits, only when you upgrade a Kiavi package, so the diff noise stays minimal.
Why a separate .kiavi/ directory and not vendoring inline?
Section titled “Why a separate .kiavi/ directory and not vendoring inline?”- It survives package upgrades cleanly (one file replaced, no diff to chase through your own code).
- Agents read it once and have the full surface area, no guessing about where the API reference lives.
- It makes the source of truth explicit: if your code disagrees with
.kiavi/kiavi-browser.md, the doc wins, because it ships with the version you have installed.