Compare implementation against canonical open-source references. Clone exemplars into /tmp, diff edge cases, error paths, and protocol invariants. Use when building a new subsystem, after a refactor, or when reviewing code that implements a known standard (POSIX, FUSE, WAL, S3, NFS, etc.).
Find what the best implementations do that we don't, then close the gaps. This is the "measure twice" pass: compare our code against battle-tested references before declaring it done.
/exemplar-audit or /refine --pass 6Check these sources in order:
storage.md, architecture.md, or equivalent design docs. These often name reference implementations.Examples of good exemplars by domain:
| Domain | Internal exemplar | External exemplar |
|---|---|---|
| GitHub Actions | host-agent-rust.yml, host-agent-kvm.yml | -- |
| Terraform | apps/cloud/apps/dcs/tf/main.tf | checkov rules |
| Rust CI crate | host-agent (same workspace) | -- |
| FUSE filesystem | -- | fuser SimpleFS, FUSE memfs |
| SQLite metadata | -- | JuiceFS pkg/meta/sql.go |
| WAL replication | -- | Litestream, libSQL bottomless |
| S3 chunk store | -- | JuiceFS pkg/object/s3.go |
| VFS layer | -- | Linux fs/fuse/dir.c |
| Content-addressed storage | -- | git sha1-file.c, Perkeep |
Clone into /tmp to avoid polluting the workspace:
git clone --depth 1 https://github.com/cberner/fuser /tmp/fuser
git clone --depth 1 https://github.com/juicedata/juicefs /tmp/juicefsFor smaller references, read online (GitHub raw, crates.io source).
For each exemplar, check:
ENOTEMPTY, ENOSPC, EINVAL, rename, unlink, etc.For each gap found:
Do not cargo-cult patterns we don't need. If the exemplar handles NFS-specific locking and we don't serve NFS, skip it. Every adopted pattern must have a real consumer in our system.
Return a table:
| Gap | Exemplar | Our status | Fix |
|---|---|---|---|
| rename over non-empty dir | fuser SimpleFS L412 | missing | added test + check |
| WAL checkpoint past replicated | Litestream wal.go L890 | missing | added watermark guard |
| (none found) | JuiceFS chunk GC | clean | -- |