Source: ViewEdit

2026-10-05 - text-encoding-and-ai-agents

Summary

AI agents running commands in Windows PowerShell 5.1 corrupted text in InstaLay twice: a garbled release.yml that GitHub rejected (introduced in 8b35a27, fixed in b7dd746) and changelog dashes garbled since f45ceda (2026-09-10). This release documents the mechanism, the restriction on agents, and the layered guard: a machine-wide pre-commit hook as the primary layer, CI as the backstop.

Changes

  • Text encoding and AI agents — what mojibake is, PowerShell 5.1 Get-Content / Set-Content / Out-File / console code page defaults, why agents and shared git identity make it worse, hooks are local (core.hooksPath vs init.templateDir)

  • Prevent text encoding corruption — tested ASCII-only pre-commit script (chains repository hooks, rejects mojibake and UTF-16, warns on BOM), install and verify steps, reusable CI workflow; rollout across an organisation (ruleset with required workflow) and a personal account (thin caller workflow, template repository); per-repository Actions logs for shared workflow code; fork-sweep rules (fix forward only your own lines, never push to branches backing open upstream PRs, keep your CI out of upstream trees); .encoding-allow allowlist (.txt not exempt), agent rule text, .editorconfig, safe edits in Nushell / pwsh 7 / PowerShell 5.1 via .NET, repairing history

  • Mojibake signatures — before/after table with bytes, guard signatures, BOM / UTF-16 / invalid-UTF-8 table

  • App essentials checklist — UTF-8 without BOM and encoding-guard items

  • Prevent text encoding corruption — names the house tool, agent-rules tools/encoding-guard/ (check-mojibake.mjs, install-global-hooks.mjs, reusable encoding-guard.yml), its mojibake-guard: allow line marker and .encoding-allow globs, and --fix for repairs

  • Prevent text encoding corruption — records that all 15 organisations (and the personal account) are on GitHub Free, so each repository carries a per-repository caller workflow; organisation rulesets need GitHub Team

  • Cross-links: Nushell vs PowerShell (encoding row), Nushell and AI agents, Polyglot CI, Git release workflow, Concurrent agent workspaces, Writing clear docs with AI

Garbled examples in these pages are written as character references so the source files stay free of the byte signatures the guard rejects.