Official Python library for reading and writing .klickd portable AI context files
Project description
klickd
Official Python library for reading and writing .klickd portable AI context files.
One soul. Any model. Any agent. — open-source security and continuity layer for every actor in AI.
Official page for the open .klickd format → klickd.app/klickdskill
Install
pip install klickd
Quick start
Load (decrypt) a .klickd file
from klickd import load_klickd
with open("context.klickd", "rb") as f:
payload = load_klickd(f.read(), passphrase="my-passphrase")
print(payload["identity"]["name"])
print(payload["memory"])
Save (encrypt) a .klickd file
from klickd import save_klickd
payload = {
"payload_schema_version": "3.0.0",
"domain_schema_version": "1.0.0",
"identity": {"name": "Alice", "language": "en", "timezone": "Europe/Luxembourg"},
"agent_instructions": "Be concise.",
"memory": [],
}
klickd_bytes = save_klickd(payload, passphrase="my-passphrase", domain="education")
with open("context.klickd", "wb") as f:
f.write(klickd_bytes)
Legacy v2.x files (PBKDF2)
payload = load_klickd(file_bytes, passphrase="my-passphrase", legacy=True)
.klickd v4 — GA strict + preview fields
This library targets the v3 envelope on the wire (envelope crypto contract
is frozen at v3 per SPEC.md §33.10 #2) and ships the v4 GA strict candidate
payload schema for validation. The v4 preview track (v4.0.0-preview.1)
remains accepted in parallel.
The v4 additive payload fields — profile_kind, media_profile,
verification_gates, human_veto_policy, claim_sources,
verification_artifacts, migration, context_cost, deprecated_fields —
are preserved verbatim on round-trip (SPEC.md §33.7). load_klickd
returns the raw decrypted JSON object; save_klickd re-encrypts it without
filtering unknown keys.
Optional v4 schema validation
Install the optional validate extra to enable strict / preview schema
validation against the bundled v4 JSON schemas (RFC-001 v1, RFC-002 v1
core, RFC-004 v1):
pip install klickd[validate]
from klickd import validate, validate_iter_errors
payload = {
"payload_schema_version": "4.0",
"verification_gates": {
"version": 1,
"gates": [
{"action_class": "public_post", "level": "block"},
],
},
}
validate(payload, strict=True) # raises KlickdError(KLICKD_E_SCHEMA) on fail
# Non-raising variant that returns every (path, message):
errors = validate_iter_errors(payload, strict=True)
validate(..., strict=False) selects the permissive v4 preview schema.
validate(..., target="unified") selects the unified envelope+payload
schema. The strict schema accepts both "4.0" and "4.0.0-preview.1"
in payload_schema_version so preview files round-trip without rewriting.
v4_preview_payload = {
"payload_schema_version": "4.0.0-preview.1",
"domain_schema_version": "1.0.0",
"profile_kind": "learner",
"verification_gates": {"public_post": "confirm"},
# ... any additional v4 preview fields are preserved on save/load
}
recovered = load_klickd(save_klickd(v4_preview_payload, "passphrase"), passphrase="passphrase")
assert recovered == v4_preview_payload
See SPEC.md §33 and examples/v4-preview/ for the preview-track details.
Cryptographic specification (v3.0)
| Parameter | Value |
|---|---|
| KDF (default) | Argon2id — m=65536, t=3, p=1 |
| KDF (legacy) | PBKDF2-SHA256 / 600 000 iterations |
| Cipher | AES-256-GCM |
| AAD | RFC 8785 JCS over 6 canonical fields |
| Base64 | RFC 4648 §4 standard padded |
| Salt | 16 bytes (CSPRNG) |
| IV | 12 bytes (CSPRNG) |
Error codes
| Code | HTTP | Meaning |
|---|---|---|
KLICKD_E_AUTH |
401 | Wrong passphrase / GCM tag mismatch |
KLICKD_E_VERSION |
400 | Unsupported klickd_version major |
KLICKD_E_FORMAT |
400 | Malformed JSON envelope / missing fields |
KLICKD_E_KDF |
400 | Unknown or unavailable KDF |
KLICKD_E_WEAK_PASS |
422 | Passphrase shorter than 8 characters |
KLICKD_E_SCHEMA |
400 | Missing payload_schema_version |
from klickd import KlickdError, KlickdErrorCode
try:
payload = load_klickd(data, passphrase="wrong")
except KlickdError as e:
print(e.code) # KlickdErrorCode.AUTH
print(e.http_status) # 401
Links
- Format page: klickd.app/klickdskill
- Specification: SPEC.md
- Repository: github.com/Davincc77/klickdskill
- DOI: 10.5281/zenodo.20383133 (v4.0.0) · concept DOI (all versions): 10.5281/zenodo.20262530
- Homepage: klickd.app/klickdskill
License
CC0 1.0 Universal — Public Domain Dedication.
Author: Vincenzo Cirilli (.klickd / klickd.app, Luxembourg)
Project details
Release history Release notifications | RSS feed
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 klickd-4.0.0.tar.gz.
File metadata
- Download URL: klickd-4.0.0.tar.gz
- Upload date:
- Size: 28.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab95dfe083e2bd9e095a5e18282fdd5f0f91d28844260539981fc944c434c69b
|
|
| MD5 |
0cb287d29c454ce37e34072463a12fb0
|
|
| BLAKE2b-256 |
35a55228ae74a3c55d104a15706b78e80eb231049399cbb53d1e9603efe61d67
|
Provenance
The following attestation bundles were made for klickd-4.0.0.tar.gz:
Publisher:
publish-pypi.yml on Davincc77/klickdskill
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
klickd-4.0.0.tar.gz -
Subject digest:
ab95dfe083e2bd9e095a5e18282fdd5f0f91d28844260539981fc944c434c69b - Sigstore transparency entry: 1630385179
- Sigstore integration time:
-
Permalink:
Davincc77/klickdskill@9453b427e01dbcba5ce67feaf021f39cfc2f935d -
Branch / Tag:
refs/tags/v4.0.0 - Owner: https://github.com/Davincc77
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@9453b427e01dbcba5ce67feaf021f39cfc2f935d -
Trigger Event:
release
-
Statement type:
File details
Details for the file klickd-4.0.0-py3-none-any.whl.
File metadata
- Download URL: klickd-4.0.0-py3-none-any.whl
- Upload date:
- Size: 27.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dac651a8f749b56d956fa2d80f00d062ef45f9f0765a5c87bf862a7c265db8eb
|
|
| MD5 |
2f5e14c607c91b5e0a8e4c4bc14f328c
|
|
| BLAKE2b-256 |
34115d5240bcb4835c1bbe0b1b5a60a0f090a6a45b2871076d996e4ed820a7ea
|
Provenance
The following attestation bundles were made for klickd-4.0.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on Davincc77/klickdskill
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
klickd-4.0.0-py3-none-any.whl -
Subject digest:
dac651a8f749b56d956fa2d80f00d062ef45f9f0765a5c87bf862a7c265db8eb - Sigstore transparency entry: 1630385183
- Sigstore integration time:
-
Permalink:
Davincc77/klickdskill@9453b427e01dbcba5ce67feaf021f39cfc2f935d -
Branch / Tag:
refs/tags/v4.0.0 - Owner: https://github.com/Davincc77
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@9453b427e01dbcba5ce67feaf021f39cfc2f935d -
Trigger Event:
release
-
Statement type: