len(content) counts Unicode code points, not UTF-8 bytes. For non-ASCII content such as Chinese or emoji, the reported count would be lower than the actual bytes written to disk, which is misleading to the agent.