plc_program_snapshot
Record an exported PLC program's structure as a change baseline, using content hashes and block fingerprints to detect undocumented modifications without storing source code.
Instructions
[READ][risk=low] Record an exported program's structure as a change baseline.
A control program is a controlled document, and the usual way an undocumented
change to one gets noticed is that somebody remembers. This gives the
comparison a number: the file's SHA-256, plus a per-block structural
fingerprint (name/kind/language, declared variables, calls, branch conditions,
timers) that deliberately excludes line numbers, comments and block order — so
adding a comment at the top of a file does not report the whole program as
changed. Stored locally under the iaiops home as block names, hashes and
counts — never a declaration, a source line or a comment — so the store is not
a second copy of the program. Reads the named EXPORTED file only; never a live
PLC upload.
Re-snapshotting a byte-identical file records nothing and says so — a history
padded with identical rows hides the rows that are not.
Args:
path: Exported program file (.st/.scl/.awl/.l5x/.txt; must exist, ≤5 MB).
name: Program identity across exports. Defaults to the file's stem, and
the result says which was used — the export path changes every time
somebody opens the engineering station, the program does not.
label: Short label, e.g. "approved v3.2 / MOC-118".
note: Free note recorded with the snapshot.
Returns dict: {status ('recorded'|'unchanged'), program, name_source,
snapshot:{snapshot_id, taken_at, source_file, content_sha256, label, note},
block_count, snapshot_count, previous_snapshot}.
Example: plc_program_snapshot(path="~/exports/Line3.scl", label="approved v3.2").
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | ||
| note | No | ||
| path | Yes | ||
| label | No |