Skip to main content

Citadel

Citadel applies a YAML de-identification policy to JSON or JSONL records and writes the transformed data to an explicit output path.

uvx --from tacit-citadel citadel policy.yaml input.json output.json

For local development from this checkout:

uv run citadel policy.yaml sample.jsonl sample.citadel.jsonl

The PyPI package is tacit-citadel; the installed console command is citadel. A bare uvx citadel resolves the unrelated citadel package name on PyPI.

Project-specific policies can live with the dataset they are used for. The checked-in policy.yaml and sample.jsonl are generic support-ticket examples for local smoke tests.

Policy Shape

Policies have deterministic path-based rules and an optional whole-record rewrite step.

version: 1
name: support-ticket-sanitizer
description: De-identification policy for customer support tickets.

rewrite:
  backend: codex exec
  sandbox: read-only
  system_prompt: You are a conservative de-identification rewriter.
  user_prompt: |
    Rewrite the INPUT JSON object.

    INPUT JSON
    {{content}}

rules:
  - path: .account.id
    action: drop

rewrite.backend must be codex exec or claude -p. Rewrites always receive the whole record after deterministic rules have run and must return a complete JSON object. If a rewrite fails or returns invalid JSON after three attempts, Citadel logs an error, aborts the run, and does not write the output file.

Rules

path is a small jq-like selector. It supports dotted object fields, list wildcards, numeric list indexes, quoted bracket fields, and simple | select(.field == "value") / | select(.field != "value") filters.

required defaults to true. Use required: false for sparse paths.

drop

Deletes matched object fields.

- path: .account.id
  action: drop

fuzz_number

Perturbs numeric values with either percentage or range mode.

- path: .customer.contract_value_usd
  action: fuzz_number
  params:
    mode: percent
    max_percent: 3
    precision: 0
- path: .risk_score
  action: fuzz_number
  params:
    mode: range
    min_delta: -1
    max_delta: 1
    step: 1

date_offset

Replaces date or datetime strings with a day offset from an anchor date.

- path: .events[].timestamp
  action: date_offset
  required: false
  params:
    anchor_path: .reported_at
    output: human_relative

Outputs are same day, N day later, N days later, N day ago, or N days ago.

Inputs

Citadel accepts:

  • a JSON object
  • a JSON array of objects
  • JSONL with one object per non-empty line

The output format matches the input shape.

Development

The implementation is intentionally contained in run.py.

uv run pytest
uv run ruff check .
uv run ty check

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tacit_citadel-0.2.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

tacit_citadel-0.2.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file tacit_citadel-0.2.0.tar.gz.

File metadata

  • Download URL: tacit_citadel-0.2.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tacit_citadel-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5db9dab80365827d3361d6faf9d248e6c1352ac58092b1410cfb880681fc331b
MD5 72a10322f28b3c7389d737c84362d1d2
BLAKE2b-256 65f8ee28e0fcfca430eb370919c2df8a9cf5cd39425f2812a3e21af3ef2962b9

See more details on using hashes here.

File details

Details for the file tacit_citadel-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tacit_citadel-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tacit_citadel-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d6d59906ffd375160d368dedfdae2a32f3ce97450d907eaef33585d86537d1bd
MD5 9ed151ff3f84240b8ddfe316c6d2a4b2
BLAKE2b-256 20442364ce20e14f2f78c0f2e9d83a2579a5996ca538f9784e61c8101152e61f

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