Life
Keeping Telegram attachments ready for the next task
I wanted more than a reply saying an attachment was saved. With Codex I built a tool that preserves the file, avoids filename collisions and records its size and hash.
The problem
An attachment in a chat was not yet a dependable original for the next task.
My approach
I built a saver and assistant instructions covering preservation, filename collisions, size and hashes.
What changed
All five checked files matched the index, giving later work a way to identify its originals.
BUILD DETAILS
Build details & ideas to reuse
01Turn a chat attachment into a working file
I needed a dependable local copy of the audio and documents arriving in Telegram. I asked the OpenClaw secretary to preserve originals in dated folders without overwriting matching filenames. Transcription and editing would happen afterward.
02Make the save result explicit
I used Codex to build a Python saver and its operating instructions. It accepts local paths, download URLs or Telegram file identifiers, then records the destination, size, SHA-256 and input type in JSON and an index. The secretary reads that result before confirming completion.
03Separate account problems from path problems
An old account setting initially caused authentication failures. I changed the lookup order and added explicit account selection. I also fixed media URIs to resolve to received local files, handled Korean filename normalization, and made the supplied MediaPath the first choice.
04Find the saved files again
I revisited two media-URI saves and three local-path saves. All five files matched the sizes and SHA-256 values in the index, giving later tasks a way to identify their originals. I did not establish the same test coverage for every other input route.
05The saving contract I can reuse
A reusable saver needs an input source, collision policy, explicit success fields and a recheck method. If no real path or identifier is available, my secretary asks for the attachment again. Better path handling cannot recreate a missing original.
Scope and things to consider
This account covers the saving tool, its instructions and size/hash checks on five files. Preservation is separate from transcription or content review.