# Docs

Self-host for $0: a Cloudflare Worker + D1 analytics, a scoped CLI, and machine-readable twins.

## Start from your situation

Two tiers. A Cloudflare-proxied Worker gets edge AI verification, .md counting, and beacons. An external CMS using visit.js over CORS gets human engagement and goals only.

- **External CMS** (/docs/quickstart.md): Your site is not proxied by Cloudflare. You paste visit.js (CORS). Human engagement and goals only. No edge AI bot verification without the Cloudflare proxy.
- **Cloudflare Worker + D1** (/docs/self-hosting.md): Your site runs behind a Cloudflare-proxied Worker. Full IP-verified AI crawlers, .md twin counts, and beacons.
- **Privacy or legal audit** (/docs/data-and-privacy.md): You need to prove what is stored. RAW_IP_OPT_IN=false, the schema, and zero-cookie proof.
- **Terminal or agent setup** (/docs/cli.md): You drive Kokumi from a shell or an agent. 20 CLI commands, {"untrusted": "..."} envelopes, and the 403 handover gate.

## Onboarding track

01. [Quickstart](/docs/quickstart.md): Embed /visit.js to record views, dwell time, scroll depth, and optional page metadata. Done gate: `kokumi verify --path /`
02. [Self-hosting](/docs/self-hosting.md): Provision D1, set READ_TOKEN and VISITOR_SALT, and deploy the Cloudflare Worker. Done gate: `kokumi health`
03. [API reference](/docs/api.md): Read counts with a scoped Bearer token and submit idempotent writes. Done gate: `curl -sS -H "Authorization: Bearer $READ_TOKEN" https://example.com/api/v1/health`
04. [CLI and agent skills](/docs/cli.md): JSON envelopes, read and onboarding skills, and the 403 handover exit. Done gate: `./cli/target/release/kokumi health`

## Audit and source

- [Data and privacy](/docs/data-and-privacy.md): RAW_IP_OPT_IN=false by default; 24-hex visitor keys from a daily UTC SHA-256 salt; geo_hits rows are not linked to visitors
- [Repository README](https://github.com/mackenziebowes/kokumi#readme): Read the Worker, CLI, and site source; Open an issue or a pull request

## Reference jumps

- [Beacon & canary snapshot](/docs/cli#cmd-health)
- [health_alert: silent beacon](/docs/cli#exit-3)
- [auth: token / 403 scope](/docs/cli#exit-4)
- [GET /api/v1/counts rollups](/docs/api#api-counts)
- [Idempotency-Key conflict](/docs/api#status-409)

## Machine index

- /llms.txt
- /docs.md
- /docs/quickstart.md
- /docs/self-hosting.md
- /docs/api.md
- /docs/cli.md
- /docs/data-and-privacy.md

Agents: run `kokumi describe --format onboarding-skill` to load the onboarding skill.
