Skip to content
MyDSHMy DSH Field Notes
中文
Independently maintained; not affiliated with DeepSeek. No association with mydsh.dev or other MyDSH sites.

Home/Workspace & files/Outputs & file changes

Generate a monthly report without touching the ledger: prove it with hashes

Handing an important spreadsheet over for processing, the real worry is that it edits the original along the way.

VerifiedVersion and environmentChecked 2026-11-14
Tool
sha256sum or shasum plus any session
Requires
workspace-write sandbox mode
Checked
2026-11-14

Copyable command

sha256sum ledger.xlsx > before.sha && sha256sum -c before.sha

'It looked unchanged' is not evidence; a hash is. Three steps: fingerprint before, run, fingerprint after and compare.

The recipe

Read ledger.xlsx, total the amount per item, and generate monthly.md.

Requirements:
1. Do not modify, rename, or move ledger.xlsx. Read only.
2. Every subtotal must reconcile to source rows; cite the row numbers.
3. Before generating, tell me which sheets you will read and which columns you will total, and wait for my confirmation.
4. Report at the end: rows read, items totalled, whether the original was modified.

Item 1 is for the model, item 4 gives you a checkpoint. But the reliable check is not its self-report — it is your own hash.

Hash check

sha256sum ledger.xlsx > before.sha      # macOS: shasum -a 256
# ... let it run ...
sha256sum -c before.sha                  # 'OK' is the only pass

On macOS use shasum -a 256 ledger.xlsx, note the value, recompute and compare by hand. Git Bash on Windows ships sha256sum.

Timestamps are not enough

Restoring content to its original changes mtime, and some tools can write while preserving mtime. A timestamp is a hint; the hash is the test.

Also: if it reports 'original unmodified' while the hash disagrees, that is worse than an error — it means it fabricated. Restore the file first, then rethink the recipe.

Make it a habit

  • Any file that must not break gets a hash before the run.
  • Keep artifacts and sources in separate directories to reduce the chance of a casual edit.
  • Beyond 'read only', add 'state which sheets you will read first' — one extra confirmation, one fewer incident.

What counts as working

Check every line. All of them pass or the job is not done.

  • sha256sum -c prints OK
  • The report exists and every subtotal reconciles to source rows
  • The confirmation round actually happened

Where it fails

Symptom, cause, what to do — written in the order it actually happens.

SymptomCauseWhat to do
The hash does not matchIt really did modify the file, even just formatting or a cacheRestore from backup; add read-only wording and consider giving it a copy
It claims unmodified while the hash changedSelf-reports are not evidenceRestore the file; trust only the hash
No sha256sum on macOSThe system ships shasumUse shasum -a 256, or install coreutils

Sources

Verified means measured here. Compiled means every line carries a source.