Contract-first policy decision CLI for deterministic decision + reason + trace.
Project description
Kernite
Kernite is an AI-operable policy decision gateway for write-path enforcement.
It is built for one job: return a deterministic, machine-operable decision contract before any mutation is executed.
Why Kernite
- Contract-first outputs:
decision,reason_codes,reasons,trace_hashare stable integration surfaces. - AI-operable feedback: deny reasons are structured for programmatic remediation, not only human logs.
- Deterministic evidence: same canonical input and policy context produce stable
trace_hashoutput. - Fail-closed for governed scopes: no matching policy on governed scope returns deny.
- Lightweight runtime:
dependencies = []inpyproject.toml.
Install and Run
uvx kernite serve
Server endpoints:
GET /healthPOST /executePOST /v1/executePOST /validate/executePOST /v1/validate/execute
Quick Start: Execute
Request (governed scope with one policy):
{
"workspace_id": "workspace-demo",
"principal": {
"type": "token",
"id": "api:ops-bot"
},
"object_type": "document",
"operation": "create",
"payload": {
"title": "Quarterly Plan"
},
"policy_context": {
"governed": true,
"selected_policies": [
{
"policy_key": "document_create_default",
"policy_version": 1,
"effect": "allow",
"rules": [
{
"rule_key": "require_title",
"rule_definition": {
"type": "required_fields",
"fields": ["title"]
},
"reason_code": "missing_required_fields",
"reason_message": "title is required."
}
]
}
]
}
}
Response shape:
{
"ctx_id": "ctx_...",
"message": "Approved by governance policy.",
"data": {
"decision": "approved",
"reason_codes": [],
"reasons": [],
"policy_selection_reason_code": "policy_selected_workspace_default",
"policy": {
"policy_key": "document_create_default",
"policy_version": 1
},
"trace_hash": "sha256:...",
"idempotency_key": "..."
}
}
Policy Context Model
policy_context is optional, but recommended for production integrations.
Main fields:
governed(bool): whether this request must be enforced as governed scope.selected_policies(array): policies selected by your resolver.governed_scopes(array): optional scope list (object_type+operation) to infer governed status.policy_selection_reason_code(string): explicit selection reason, if already known.
Default behavior:
- governed + no selected policy =>
deniedwithno_matching_policy - not governed + no selected policy =>
approvedwithout_of_scope_phase1
Use Cases (AI and Non-AI)
- AI-assisted actions: gate tool calls and use
reason_codesfor automatic retry/remediation. - Internal APIs: apply one deterministic write guard across UI/API/workers.
- SaaS multi-tenant systems: enforce tenant-scoped write decisions and persist evidence.
Compatibility and Conformance
- Contract policy:
docs/compatibility.md - Conformance vectors:
docs/conformance/v1/execute_vectors.json - Reason code semantics:
docs/conformance/v1/reason_codes_v1.json
Objective Performance Check (Python)
Kernite includes a dependency-free benchmark harness.
uv run python benchmarks/benchmark_execute.py --iterations 20000
This gives p50/p95 latency and throughput from your actual environment so language/runtime decisions are based on measured data, not assumptions.
Latest measured snapshot is tracked in docs/performance.md.
Design Philosophy
See docs/design-philosophy.md for rationale on deterministic behavior, minimal runtime surface, and measured optimization strategy.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kernite-0.1.1.tar.gz.
File metadata
- Download URL: kernite-0.1.1.tar.gz
- Upload date:
- Size: 34.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43c85495671ed9e7bd63d1c4971a439a78af3ce261695517cfa39f66da90a202
|
|
| MD5 |
8b736e8ee2b70616068a21de79291b87
|
|
| BLAKE2b-256 |
65c61872377078b2a1f9353b24cafdd3d19c90de6826929505719e7497fce0c8
|
Provenance
The following attestation bundles were made for kernite-0.1.1.tar.gz:
Publisher:
release.yml on sankaHQ/kernite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kernite-0.1.1.tar.gz -
Subject digest:
43c85495671ed9e7bd63d1c4971a439a78af3ce261695517cfa39f66da90a202 - Sigstore transparency entry: 969334525
- Sigstore integration time:
-
Permalink:
sankaHQ/kernite@d1eea0b41b6b7e087955b5f632c7a521d03811a4 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/sankaHQ
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d1eea0b41b6b7e087955b5f632c7a521d03811a4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kernite-0.1.1-py3-none-any.whl.
File metadata
- Download URL: kernite-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46912fb419069f6db323d2bb3c173029664550a3b426b2975167b5b7e12a5a4a
|
|
| MD5 |
a4eb0355cefef06fc07954b6f2893261
|
|
| BLAKE2b-256 |
661935728d3409844b984fda419a8d8fb2be82f290a2355cc551113cd96c2b2d
|
Provenance
The following attestation bundles were made for kernite-0.1.1-py3-none-any.whl:
Publisher:
release.yml on sankaHQ/kernite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kernite-0.1.1-py3-none-any.whl -
Subject digest:
46912fb419069f6db323d2bb3c173029664550a3b426b2975167b5b7e12a5a4a - Sigstore transparency entry: 969334528
- Sigstore integration time:
-
Permalink:
sankaHQ/kernite@d1eea0b41b6b7e087955b5f632c7a521d03811a4 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/sankaHQ
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d1eea0b41b6b7e087955b5f632c7a521d03811a4 -
Trigger Event:
push
-
Statement type: