# AI Capability Audit — KynetraDB

**Generated:** 2026-08-12
**Base commit:** `da0d0f32` (origin/main)
**Engine repo:** `/Users/kr/Developer/kynetra/data/db`
**Catalogue source:** `saas-web/kynetra-saas/apps/db/src/data/ai-features.ts`

## Summary

After verification and QC-corrected status assignments:

| Status | Count |
|--------|-------|
| available | 51 |
| beta | 9 |
| roadmap | 21 |
| research | 19 |
| **Total** | **100** |

## Catalogue corrections applied

Three statuses were changed in `ai-features.ts` to match verified evidence:

| ID | Category | Was | Now | Rationale |
|----|----------|-----|-----|-----------|
| `approval-gates` | agents | beta | **roadmap** | Approval records, UI, timeout, and routes exist, but agent action execution never calls the approval gate. |
| `knowledge-ingestion` | data | roadmap | **beta** | 14 connector inlets exist (postgres, mongo, firebase, supabase, sqlite, d1, algolia, meilisearch, pinecone, typesense, appwrite, convex, ndjson, pocketbase), but governed chunking, embeddings, lineage, and ingestion orchestration are missing. |
| `retrieval-slos` | operations | beta | **roadmap** | Generic per-route p50/p95/p99 tracking exists (`crates/observability/src/slo.rs`), but no retrieval-specific latency/recall/freshness dashboard. |

## Features that stayed as-declared

These were initially proposed for promotion by the first audit pass but remain at their declared status after QC:

| ID | Category | Declared | Why it stays |
|----|----------|----------|--------------|
| `edge-read-profile` | portability | beta | Demo endpoint returns 200 but is not production. No automated Worker tests. Vector scans capped at 5,000 candidates (D1 bridge README). |
| `recall-measurement` | evaluation | beta | Reproducible benchmark code, brute-force ground truth, evidence artifacts, and passing recall tests exist — but evidence is not publicly reachable without private-repository access. Internally available; publicly beta until evidence is published. |
| `event-driven-agents` | realtime | roadmap | The implementation is a minute-based cron scheduler (`crates/agents/src/scheduler.rs`), not durable data-event consumption. Lacks outbox, offsets, deduplication, replay, and DLQ behavior. |

## Baseline test results

Focused verification passed:
- Kynetra Agents: 40 tests
- Kynetra Estuary library: 6 tests
- NDJSON conformance test
- HNSW recall test: 50/50 queries

Full workspace: `cargo test --workspace` — 0 failures.

## Evidence by category

### Retrieval

| ID | Status | Evidence |
|----|--------|----------|
| `bm25-full-text` | available | `crates/core/src/personalities/search.rs` — BM25 inverted index, Unicode tokenisation, ASCII folding, Rayon-parallel scoring. API: `POST /v1/search`. SDKs: `search.ts`, `search.py`. |
| `cosine-vector` | available | `crates/core/src/personalities/vector.rs` + `vector_hnsw.rs` — brute-force cosine scan + HNSW graph. API: `POST /v1/vector`. Benchmark: `2026-07-12-vector-scale.json`. |
| `hybrid-product` | available | `crates/core/src/personalities/hybrid.rs` — BM25 first-pass + facet filtering + optional cosine rerank. API: `POST /v1/product-search`. |
| `kind-scoping` | available | Kind pre-filter on search and vector endpoints. |
| `unicode-tokenisation` | available | Unicode word segmentation + ASCII folding in `search.rs`. |
| `incremental-index` | beta | `crates/core/src/personalities/vector_spann.rs` — SPANN index structure. |
| `filtered-ann` | beta | `rabitq.rs`, `caustic.rs`, `vector_hnsw.rs` — filtered vector retrieval with recall@10 evidence. |
| `reranking-policies` | roadmap | No explicit ranking policy DSL. |
| `multimodal-retrieval` | research | No implementation. |
| `learned-fusion` | research | No implementation. |

### Models & embeddings

| ID | Status | Evidence |
|----|--------|----------|
| `provider-agnostic` | available | `crates/llm/src/lib.rs` — `LlmProvider` trait, `CompletionResponse` shape. |
| `anthropic-provider` | available | Anthropic Messages API provider. Default model `claude-sonnet-4-5`. |
| `openai-compatible` | available | OpenAI-compatible `/v1/chat/completions` provider. |
| `ollama-local` | available | Local Ollama provider, no API key required. |
| `provider-fallback` | available | `LlmRegistry::complete_with_fallback` — tries Ollama → Anthropic → OpenAI. |
| `embedding-contracts` | available | Explicit embedding dimensions at write and query boundaries. |
| `model-routing` | roadmap | `pricing.rs` exists but no policy-based routing. |
| `embedding-jobs` | roadmap | Implemented on branch `codex/t3-embedding-jobs` (not yet gate-promoted): `crates/embedding-jobs` — managed embedding workload reusing knowledge-ingestion's durable-job primitives (`JobState`, `RetryPolicy`/`backoff_delay`, `content_hash` idempotency, project scoping) and `kynetra_llm::EmbeddingProvider`. Provider/model/dimension pinned per job; batched embed; idempotent re-runs (no re-embed of committed records, proven by a restart/CountingEmbedder test); bounded retry + per-record dead-letter queue; embeddings/sec rate limit; cancellation + checkpoints; stale-refresh and model migration (dimension change handled); project quotas; honest cost accounting (tokens/cost N/A, never fabricated). Additive `/v1/embedding-jobs/*` routes + OpenAPI. |
| `model-observability` | roadmap | Pricing data exists, no per-model cost dashboard. |
| `fine-tuning-registry` | research | No implementation. |

### Agents & tools

| ID | Status | Evidence |
|----|--------|----------|
| `structured-tools` | available | `Action` trait with JSON Schema `input_schema()`. 14 built-in actions. |
| `tool-call-roundtrip` | available | Tool calls and results carried through message model. `MAX_TURNS = 8`. |
| `agent-memory-collections` | available | `crates/agents/src/memory/` — craft, recall, consolidate, lore modules. API: `POST /v1/memory/*`. |
| `scoped-tools` | available | `allowed_actions` whitelist on Agent entity. |
| `agent-audit-trails` | available | `AgentRun` entities persisted in Universal Log. Queryable via filter DSL. |
| `approval-gates` | roadmap | Approval records, UI, timeout, and routes exist (`crates/agents/src/approvals.rs`), but agent action execution never calls the approval gate. |
| `long-running-runs` | roadmap | Scheduler exists but no checkpoint/resume for long runs. |
| `agent-evals` | roadmap | No implementation. |
| `multi-agent-roles` | research | `orchestrate.rs` exists but not production-ready. |
| `self-improving-tools` | research | No implementation. |

### Data foundation

| ID | Status | Evidence |
|----|--------|----------|
| `document-entities` | available | `crates/core/src/entity_store.rs` — JSON entities as first-class log records. API: CRUD on `/v1/entities`. |
| `key-value-access` | available | `crates/core/src/personalities/kv.rs` — direct key reads. |
| `metadata-filters` | available | `crates/core/src/personalities/doc.rs` — JSON predicate filtering. API: `POST /v1/filter`. |
| `files-with-records` | available | `crates/files/` — file metadata and permissions as database records. |
| `events-in-data-plane` | available | `crates/realtime/` + `crates/estuary/` — events from mutation stream. |
| `schema-views` | beta | `crates/schema/` — typed views with policy enforcement. |
| `knowledge-ingestion` | beta | `crates/estuary/src/inlets/` — 14 source connectors. Missing: governed chunking, embeddings, lineage, orchestration. |
| `document-lineage` | roadmap | No implementation. |
| `semantic-deduplication` | research | No implementation. |
| `temporal-knowledge` | research | No implementation. |

### Governance

| ID | Status | Evidence |
|----|--------|----------|
| `auth-and-keys` | available | `crates/auth/` — bcrypt + JWT, magic link, TOTP 2FA. |
| `roles-and-scopes` | available | `crates/server/src/rbac.rs` — project RBAC overlay. |
| `audit-events` | available | `crates/server/src/audit.rs` — audit events in Universal Log. |
| `tenant-boundaries` | available | `crates/server/src/tenancy.rs` — project-level isolation. |
| `file-permissions` | available | File access metadata aligned with application permissions. |
| `retrieval-policies` | beta | `crates/schema/src/policy.rs` — basic policy DSL. |
| `pii-redaction` | roadmap | No implementation. |
| `data-residency` | roadmap | `crates/compliance/src/residency.rs` + `crates/server/src/residency.rs` — per-project, per-dimension placement policy: DENY-over-silent-placement decisions, provider validation, drift detection, and an HONEST per-dimension readiness (storage/compute/backup enforced; inference advisory; logs/metadata unenforced — never falsely green). Generalises the DPDP store in `dpdp.rs`. See `docs/capabilities/data-residency.md`. Not a legal certification. |
| `policy-simulation` | research | No implementation. |
| `provenance-scoring` | research | No implementation. |

### Realtime context

| ID | Status | Evidence |
|----|--------|----------|
| `change-feed` | available | `crates/realtime/src/lib.rs` — change feed from mutation stream. |
| `sse-subscriptions` | available | `GET /v1/realtime` — SSE event stream. |
| `realtime-events` | available | Realtime events from data-plane mutations. |
| `durable-context` | available | Agent memory persisted as Universal Log entities. |
| `local-first-context` | available | Single binary with local WAL. |
| `streaming-retrieval` | beta | `crates/agents/src/streaming.rs` — streaming agent runs. |
| `live-agent-handoff` | roadmap | No implementation. |
| `event-driven-agents` | roadmap | Cron scheduler exists (`crates/agents/src/scheduler.rs`) but is not durable data-event consumption. |
| `causal-context` | research | No implementation. |
| `collective-memory` | research | No implementation. |

### Portability

| ID | Status | Evidence |
|----|--------|----------|
| `open-data-plane` | available | Rust engine, no cloud provider dependency. |
| `single-binary` | available | `kynetra-server` standalone process. |
| `local-and-docker` | available | `Dockerfile` + `docker-compose.yml`. |
| `cloud-profiles` | available | `RuntimeProfile` enum: dev-single, tiny-vps, prod-single, pg-ha-read, edge-read, etc. |
| `provider-boundaries` | available | `crates/providers/` — provider-specific behavior outside storage kernel. |
| `edge-read-profile` | beta | D1 bridge deployed at `edge.db.kynetra.dev`. Not production: no automated Worker tests, vector scans capped at 5,000 candidates. |
| `portable-backups` | roadmap | No export/import bundles. |
| `cross-cloud-migrate` | roadmap | No implementation. |
| `air-gapped-ai` | research | No implementation. |
| `sovereign-control-plane` | research | No implementation. |

### Operations

| ID | Status | Evidence |
|----|--------|----------|
| `health-contracts` | available | `GET /healthz`, `GET /readyz` — unauthenticated liveness/readiness. |
| `metrics-and-logs` | available | `crates/server/src/db_metrics.rs` + `crates/observability/` — per-route SLO tracker, slow query detection. |
| `admin-operations` | available | `crates/server/src/db_admin.rs` + `infra_admin.rs` — collections, keys, users, backups. Admin V2 SPA. |
| `backup-concepts` | available | Checkpoint-based backup/restore architecture. |
| `benchmark-evidence` | available | `benchmarks/run.sh` + `benchmarks/evidence/` — documented benchmark context with methodology. |
| `retrieval-slos` | roadmap | Generic per-route p50/p95/p99 tracking exists. No retrieval-specific latency/recall/freshness dashboard. |
| `model-incident-response` | roadmap | Implemented on branch `codex/t4-model-incident-response` (not yet gate-promoted): pure domain in `crates/schema/src/model_incident.rs` (incident entity + enforced state machine `detected → acknowledged → mitigating → resolved \| closed`, a CLOSED set of three bounded reversible mitigations — force-open breaker / add to `blocked_models` / advisory `force_exclude` — a content-free append-only timeline, project-scoped durable store, and a pure error-class-spike detector reusing model-observability counts); orchestration + HTTP in `crates/server/src/model_incident_api.rs` (the `IncidentEngine` maps each mitigation onto the *already-tested* model-routing levers behind agent-evals' `ApprovalDecider` gate — an IMPACTFUL mitigation cannot execute without an approval, so no destructive autonomous action occurs by default; resolving LIFTS every override; ephemeral overrides are re-driven at boot; a pluggable notification adapter defaults to log-only with no external send). Detection inherits model-observability's HTTP-route-only coverage caveat. Additive `/v1/model-incident-response/*` routes + OpenAPI. |
| `capacity-planning` | roadmap | No implementation. |
| `autonomous-remediation` | research | No implementation. |
| `counterfactual-debugging` | research | No implementation. |

### Developer surface

| ID | Status | Evidence |
|----|--------|----------|
| `http-api` | available | `crates/server/src/main.rs` + `rest.rs` — full REST API. |
| `typescript-client` | available | `sdks/typescript/src/` — 10 modules (auth, collections, entities, files, http, products, realtime, search, types). |
| `mcp-surface` | available | `crates/mcp/` — read-only MCP JSON-RPC surface at `/mcp`. |
| `cli-lifecycle` | available | `crates/cli/` — init, start, status, install commands. |
| `rust-core` | available | `crates/core/` — native Rust engine. |
| `sdk-retrieval-helpers` | beta | `sdks/typescript/src/search.ts` + `sdks/python/kynetra/search.py` — basic helpers. |
| `prompt-versioning` | roadmap | No implementation. |
| `local-eval-harness` | roadmap | No implementation. |
| `semantic-debugger` | research | No implementation. |
| `intent-test-generator` | research | No implementation. |

### Evaluation & quality

| ID | Status | Evidence |
|----|--------|----------|
| `measured-benchmarks` | available | `benchmarks/evidence/*.json` — documented benchmark context with commit, hardware, methodology. |
| `retrieval-benchmarks` | available | `crates/core/benches/` + `crates/core/examples/` — BM25, vector, filtered vector workloads. |
| `honest-claims` | available | `ai-features.ts` enforces evidence links for `available` features. |
| `architecture-gates` | available | `docs/scale/architecture-quality-gates.md` — 64 quality gates. |
| `source-linked-claims` | available | Evidence links in `ai-features.ts` point to source documentation. |
| `recall-measurement` | beta | Reproducible benchmark code, brute-force ground truth, and evidence artifacts exist. Not publicly reachable without private-repository access. |
| `labelled-relevance` | roadmap | No implementation. |
| `prompt-regression` | roadmap | No implementation. |
| `human-preference-evals` | research | No implementation. |
| `continuous-trust-model` | research | No implementation. |

## Key findings

- **A lot has been built, but not all 100 capabilities are live.** 51 are available with evidence; 9 are beta with working core paths and documented limitations.
- **The approval subsystem is disconnected from action execution.** Approval records, UI, and timeout exist, but the agent action loop never calls the gate.
- **Connector registration is substantial.** 14 Estuary inlets cover postgres, mongo, firebase, supabase, sqlite, d1, algolia, meilisearch, pinecone, typesense, appwrite, convex, ndjson, and pocketbase. Orchestration layer is missing.
- **Recall measurement has credible internal evidence.** Benchmark code, brute-force ground truth, and recall@10 evidence files exist. Not yet publicly verifiable.
- **The scheduler is a cron runner, not an event bus.** It persists definitions and fires on minute boundaries, but lacks outbox, offsets, deduplication, replay, and DLQ.
- **No production sites exist.** The DigitalOcean workload and edge service are demos/previews only.

## Files

- **Ledger:** `docs/capabilities/ai-capability-ledger.json`
- **Report:** `docs/capabilities/AI_CAPABILITY_AUDIT.md` (this file)
