Global Options
Option Description --versionPrint the decoct version and exit. --helpShow top-level help and exit.
decoct compress
decoct compress [FILES...] [OPTIONS]
Runs the compression pipeline on YAML, JSON, or INI files. Reads from stdin if no files given.
Arguments
Argument Description FILESOne or more input files or directories. Omit to read from stdin.
Files are auto-detected by extension: .yaml/.yml (YAML), .json (JSON), .ini/.conf/.cfg/.cnf/.properties (INI). Directories are expanded to all matching files.
Options
Option Description --schema TEXTSchema file path or bundled name. Auto-detected if omitted. --assertions PATHAssertions file defining design standards. --profile TEXTProfile file path or bundled name (docker-compose). --statsPrint token statistics to stderr. --stats-onlyPrint only token statistics (no YAML output). --show-removedPrint per-pass removal details to stderr. -o, --output PATHWrite output to file instead of stdout. -r, --recursiveRecurse into subdirectories when given a directory argument. --encoding TEXTTiktoken encoding. Default: cl100k_base.
When --schema is not provided, decoct examines document structure:
Platform Detection heuristic docker-composeHas services key with a mapping kubernetesHas apiVersion and kind keys terraform-stateHas terraform_version and resources keys cloud-init2+ keys from packages, runcmd, write_files, etc. ansible-playbookList where first item has hosts and tasks/roles github-actionsHas on and jobs keys traefikHas entryPoints or (providers and api/log) prometheusHas scrape_configs key
Examples
# Basic — auto-detects platform
decoct compress docker-compose.yaml
# Explicit bundled schema
decoct compress config.yaml --schema docker-compose
decoct compress deployment.yaml --schema kubernetes
decoct compress playbook.yaml --schema ansible-playbook
decoct compress cloud-init.yaml --schema cloud-init
decoct compress terraform.tfstate --schema terraform-state
decoct compress prometheus.yml --schema prometheus
decoct compress config.yaml --schema schemas/my-platform.yaml
# With schema + assertions
decoct compress config.yaml \
--schema docker-compose \
--assertions assertions/docker-services.yaml
# Bundled profile (schema + assertions + pass config)
decoct compress config.yaml --profile docker-compose
decoct compress config.yaml -o compressed.yaml --stats
decoct compress config.yaml --schema docker-compose --stats-only
kubectl get deployment myapp -o yaml | decoct compress --schema kubernetes
decoct compress my.cnf --schema mariadb-mysql --stats
decoct compress service-a.yaml service-b.yaml
# Directory, recursive, with stats
decoct compress ./config/ --recursive --stats
# Inspect what was removed
decoct compress deployment.yaml --stats-only --show-removed
decoct schema learn
decoct schema learn [OPTIONS]
Derives a schema from example configs and/or documentation using an LLM. Requires pip install decoct[llm] and ANTHROPIC_API_KEY.
Options
Option Description -e, --example PATHExample config file (repeatable). -d, --doc PATHDocumentation file (repeatable). -p, --platform NAMEPlatform name hint. -o, --output PATHOutput file (default: stdout). -m, --merge PATHMerge into existing schema file. --model MODEL_IDAnthropic model (default: claude-sonnet-4-20250514).
At least one --example or --doc is required.
Examples
decoct schema learn -e docker-compose.yml -p docker-compose -o schema.yaml
decoct schema learn -d haproxy-docs.txt -e haproxy.cfg -p haproxy -o schema.yaml
decoct schema learn -e new-config.yaml -m existing-schema.yaml -o merged.yaml
decoct assertion learn
decoct assertion learn [OPTIONS]
Derives assertions from standards documents, examples, or a corpus. Requires pip install decoct[llm] and ANTHROPIC_API_KEY.
Options
Option Description -s, --standard PATHStandards document (repeatable). -e, --example PATHExample config file (repeatable). Mutually exclusive with --corpus. -c, --corpus PATHConfig files for cross-file analysis (repeatable). Mutually exclusive with --example. -p, --platform NAMEPlatform name hint. -o, --output PATHOutput file (default: stdout). -m, --merge PATHMerge into existing assertions file. --model MODEL_IDAnthropic model (default: claude-sonnet-4-20250514).
At least one of --standard, --example, or --corpus is required.
Examples
decoct assertion learn -s team-standards.md -p docker-compose -o assertions.yaml
decoct assertion learn -c configs/service-a.yml -c configs/service-b.yml -o learned.yaml
decoct assertion learn -s updated-standards.md -m assertions.yaml -o assertions.yaml
Exit Codes
Code Meaning 0Success. 1Error (missing input, invalid schema, parse error, API error, etc.).
Environment Variables
Variable Description ANTHROPIC_API_KEYRequired for schema learn and assertion learn. Not used by compress.
stdin / stdout / stderr
Command stdin stdout stderr compressInput data (when no FILES) Compressed YAML Stats, removal details, errors schema learn— Generated schema YAML Progress, errors assertion learn— Generated assertions YAML Progress, errors