z.py is a standalone source/context archive certifier. It creates a ZIP file
plus audit sidecars that describe what was included, what was excluded, and
which validation checks passed or failed.
It is a single Python file and uses only the standard library.
Run it from the directory that contains z.py:
python3 z.py --root /path/to/projectCreate a package with an explicit output path:
python3 z.py --root /path/to/project --output project-context.zipRun validation and write reports without creating the ZIP:
python3 z.py --root /path/to/project --dry-runShow the full CLI:
python3 z.py --helpBy default, a run writes:
<archive>.zip<archive>.manifest.json<archive>.report.md<archive>.excluded.json<archive>.findings.json
The Markdown report is the human review surface. The JSON files are for automation and audit trails.
Strict mode is enabled by default. If validation errors are found, z.py exits
with code 2 and does not write the ZIP. It still writes the sidecar reports so
the failure can be inspected.
Use --no-strict for a diagnostic package when you knowingly want output even
with validation errors:
python3 z.py --root /path/to/project --no-strictExit codes:
0: archive written or dry run completed2: validation failed in strict mode1: unexpected operational failure
--profile <name>: choose the project profile, or useauto--mode <name>: choose the archive policy mode--include-external-path-deps: include Cargo path dependencies outside root--no-include-external-path-deps: keep the package under--root--include-doc-binaries/--exclude-doc-binaries--include-images/--exclude-images--include-logs/--exclude-logs--follow-symlinks: follow symlinks whose targets stay inside root--max-file-size-mb <number>: cap included file size--compresslevel <0-9>: set ZIP compression level--preserve-mtime: preserve file mtimes instead of deterministic timestamps
When enabled, z.py checks for:
- missing expected project surfaces for the selected profile
- Rust
include_str!andinclude_bytes!references - Cargo path dependency self-containment
- conservative shell script references to
.shand.pyfiles - high-risk secret-like content in included text files
- stale active Codex-run artifacts when archive hygiene checks are requested
Use the matching --no-check-* flags only for diagnostic runs.
Before using an archive as a handoff artifact:
- Read
<archive>.report.md. - Confirm there are no unexpected validation findings.
- Review
<archive>.excluded.jsonfor unexpected omissions. - Confirm any external path dependencies are intentional.
- Keep the generated sidecars with the ZIP.