An AI-native knowledge base where an agent actively maintains documents as a living source of truth.
The project ships as a single Apache 2.0 distribution: a Rust backend (Axum + Cargo workspace) and a Next.js 16 frontend, glued by a generated TypeScript OpenAPI client.
Highlights
- Three-agent pipeline. An orchestrator classifies each chat turn, a read-only researcher gathers evidence, and a write-only editor proposes edits. Read/write isolation is enforced at compile time via
trybuildtests. - Propose-then-approve edits. No agent can mutate storage directly. Edits become
ProposedEditevents streamed over SSE; only an explicit user approval mints anApprovalTokenthatcommit_editwill accept. - Pluggable storage. A single
StorageAdaptertrait drives three backends in-tree: SQLite (default), Postgres, and MySQL. - Pluggable LLM provider.
LlmProvider+ModelRouterabstract over OpenAI, Anthropic, Gemini, and aMockProviderfor tests. Routing is config-driven viakaya.yaml. - Notion-style block editor. Shipped as a workspace package (
@kaya/markdown-editor) built on a typed Markdown block model (@kaya/markdown-model).
Repository layout
apps/
web/ Next.js 16 frontend (pnpm)
backend/ Rust backend, Cargo workspace root
crates/
kaya-core/ Traits, agent pipeline, edit primitives
kaya-storage/ SQLite + Postgres + MySQL adapters
kaya-server/ Axum HTTP routes + SSE chat
kaya-auth/ AuthAdapter scaffolds (magic link, password)
kaya-metering/ Token + spend metering, rate limits
kaya-db/ Shared DB utilities
bin/
kaya-oss/ Self-hosted binary; can embed the frontend
packages/
api-client/ Generated TypeScript client (from OpenAPI schema)
markdown-editor/ Notion-like block editor (@kaya/markdown-editor)
markdown-model/ Markdown block model + parser (@kaya/markdown-model)
ui/ Shared React primitives
scripts/
docs/ Apache 2.0 documentation
The Rust workspace root is apps/backend/Cargo.toml. There is no Cargo.toml at the repo root and apps/web/ is not part of the Cargo workspace.
Getting started
Prerequisites
- Rust (stable, edition 2024)
- Node.js ≥ 20 and pnpm ≥ 9
- A SQLite system library (default storage)
Run the backend
cd apps/backend
cargo build --workspace
cargo run --bin kaya-ossThe OSS binary serves the HTTP API on http://localhost:3001 by default.
Run the frontend
pnpm install # from repo root pnpm dev # runs all workspace dev scripts in parallel
Open http://localhost:3000. The web app proxies API calls to NEXT_PUBLIC_API_URL (default http://localhost:3001).
Default login
On first boot the backend seeds a superadmin account so you can sign in immediately:
| Field | Value |
|---|---|
admin@kaya.local (override with SUPERADMIN_EMAIL) |
|
| Username | KayaSuperAdmin |
| Password | KayaPassword |
Change the password from the account settings page after your first login — these credentials are intended for local development only.
Regenerate the API client
After changing a backend route or schema:
cd apps/backend cargo run --bin kaya-oss -- --schema > ../../packages/api-client/openapi.json cd ../../ pnpm generate
Both openapi.json and the updated packages/api-client/src/ should be committed together.
Configuration
| Variable | Default | Purpose |
|---|---|---|
NEXT_PUBLIC_API_URL |
http://localhost:3001 |
Backend base URL used by the frontend |
OPENAI_API_KEY |
— | Required by the OpenAI provider |
ANTHROPIC_API_KEY |
— | Required by the Anthropic provider |
GEMINI_API_KEY |
— | Required by the Gemini provider |
LLM routing is configured in apps/backend/kaya.yaml. See docs/llm-provider.md and CONFIG.md.
Documentation
| Document | Description |
|---|---|
| Architecture | System overview, crates, two-build-system layout |
| Agent architecture | Orchestrator / Researcher / Editor pipeline and SSE contract |
| Storage adapter | StorageAdapter trait, SQLite/Postgres/MySQL backends |
| Auth adapter | AuthAdapter trait and current scaffolds |
| LLM provider | LlmProvider, ModelRouter, routing config |
| API codegen | OpenAPI schema → TypeScript client pipeline |
| Packages | Frontend workspace packages |
| Building | Builds, test commands, OSS static binary |
| Configuration | Routing config, env vars, storage backend selection |
License
Apache 2.0 for everything in this repository. See LICENSE and CONTRIBUTING.md.