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.

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)

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-3.0.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

klickd-3.0.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file klickd-3.0.0.tar.gz.

File metadata

  • Download URL: klickd-3.0.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for klickd-3.0.0.tar.gz
Algorithm Hash digest
SHA256 9d95783fb4589e07a7632ff6da4caddb7bd67a8f5e2bea474adc14bf6b35ae0a
MD5 94d34abdb8834fddb06490146594e9e7
BLAKE2b-256 e190c58b801390500c61ab69e3ce2cf062e151495f5a5c69c7c4219930114efe

See more details on using hashes here.

File details

Details for the file klickd-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: klickd-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for klickd-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f2c9540ebff517d8a55bc57d11ae1d5094ba62497c6a9f7fbe3c626d2636d92
MD5 1cac510fa689e01e1fed4e3c8765fa7f
BLAKE2b-256 ede2b57fceda5f3e8074b6710dcab26ab7253711f95bdcda729c79409cae8694

See more details on using hashes here.

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