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 tacit-citadel policy.yaml input.json output.json

For local development from this checkout:

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

The PyPI package and installed console command are both tacit-citadel.

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.1.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.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tacit_citadel-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 5217f265eaf1a725035d3f399b66a0f14fd268d97a2afc620579f93a95cccf19
MD5 8afdf373c7da8756f7bf2158afb58418
BLAKE2b-256 04131573d2bddedade03fc684a48bf38a0192f52d1698e957fa64855e40d6d9c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tacit_citadel-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 943881314a31cf7a4c673b477e65de0aa291014ed77fab3825d749df42920a08
MD5 52357a031c30dc1889790912ef804fa0
BLAKE2b-256 e715d079916fd6a0d7f0efa0b12e4a10642f73b9e80edaf928e065e5e06f0753

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