Skip to main content

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 body.

Official page for the open .klickd format → klickd.app/klickdskill

PyPI version Python License: CC0-1.0 DOI


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 preview fields (additive, non-GA)

This library currently targets the v3 envelope and is stable at v3.5.1. The v4 preview track (v4.0.0-preview.1, NOT GA) introduces additive payload fields such as profile_kind, media_profile, verification_gates, claim_sources, verification_artifacts, migration, and context_cost.

These fields are preserved verbatim on round-trip — load_klickd returns the raw decrypted JSON object and save_klickd re-encrypts it without filtering unknown keys. Strict v4 validation, migrations, and business-logic helpers are intentionally not implemented yet.

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


License

CC0 1.0 Universal — Public Domain Dedication.
Author: Vince C. (Luxlearn, Luxembourg)

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

klickd-4.0.0a1.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

klickd-4.0.0a1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file klickd-4.0.0a1.tar.gz.

File metadata

  • Download URL: klickd-4.0.0a1.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for klickd-4.0.0a1.tar.gz
Algorithm Hash digest
SHA256 7c586f9483970fa1841de1a46782402bb19444c97e056ff1ead2c9378a9d4d1d
MD5 cc77bb22a793a1d80f9be6177a42fddf
BLAKE2b-256 cfa2136a3070bbaa9282685dfdced87cb8c80621987a7a049ae96593fbb41ebc

See more details on using hashes here.

Provenance

The following attestation bundles were made for klickd-4.0.0a1.tar.gz:

Publisher: publish-pypi.yml on Davincc77/klickdskill

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file klickd-4.0.0a1-py3-none-any.whl.

File metadata

  • Download URL: klickd-4.0.0a1-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for klickd-4.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 75056c8a402591fdc307c401686f45904bcc7509e10f2f77c00d5e5f24ec41a9
MD5 1453bb168c201dfdad782433b1a7e919
BLAKE2b-256 7077f79ab40311db23bddb9ed099f1dfecfd860bb68390de165d0fb82938fc82

See more details on using hashes here.

Provenance

The following attestation bundles were made for klickd-4.0.0a1-py3-none-any.whl:

Publisher: publish-pypi.yml on Davincc77/klickdskill

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page