c4 — The CLI

c4 is the primary command-line tool for working with C4 content identity. It creates c4m files, diffs them, and produces patches that track changes over time.

GitHub: Avalanche-io/c4

Install

go install github.com/Avalanche-io/c4/cmd/c4@latest

Key commands

Identify a directory

$ c4 id ./project/
-rw-r--r-- 2026-03-20T12:00:00Z   8192 README.md  c45xZeXwKj...
-rw-r--r-- 2026-03-20T12:00:00Z  41023 model.bin  c43zYcLnRt...
drwxr-xr-x 2026-03-20T12:00:00Z    ... src/       c47mNqPvWx...

Save a manifest

c4 id ./project/ > project.c4m

Diff two manifests

c4 diff produces output in c4m patch format — the old manifest’s C4 ID, the changed entries, and the new manifest’s C4 ID:

$ c4 diff v1.c4m v2.c4m
c41oRmNxBzJ4kLpQvW8sYdHf3gTe6UaCb5jX7nZwPq9iMrDuEvFy2hGtSxAl0KcOmBJN
-rw-r--r-- 2026-03-20T14:00:00Z   9201 src/main.go   c43nYtRmPvW7...
-rw-r--r-- 2026-03-20T14:00:00Z   1502 src/utils.go  c48kPqLsNwR2...
c45xZeXwKjQ2nMrBz7L1pYvWqRtN8sHfJd3g6CmAeU9kXoP4bG5hT0iVlDaSwFuO7yE

The patch contains only entries that differ between the two manifests. Unchanged entries are omitted. This output can be appended to a c4m file to build a version history.

Diff a manifest against a directory

You can also diff a c4m file directly against a directory to see what changed on disk:

$ c4 diff project.c4m ./project/

This is the primary way to check whether a directory still matches a previously saved manifest.

Philosophy

c4 is intentionally minimal. It does a few things well:

Everything else — shell integration, copying, git tracking — is handled by other tools in the ecosystem that all share the same c4m format.