Skip to content

The meta-skill that builds and improves all your skills, including itself. Watches your work sessions (autonomous or human-led), captures patterns, corrections and judgement calls, and turns them into skill improvements and new skill candidates for your review. Practical application of the Augmented Expertise methodology. Open source: CC BY 4.0.

Windows: a quoted heredoc is exact only if the command arrives intact

Eoghan Henn407eae768d69
diff --git a/SKILL.md b/SKILL.md
index dc2e275..f329fce 100644
--- a/SKILL.md
+++ b/SKILL.md
@@ -423,8 +423,8 @@ The listing guard tells "the log says zero" from "I could not read
the log", the sweep's count does the same for the archival loop, the prefix
guard refuses a number already in use under any slug, and the `noclobber`
create refuses an existing path — write the body only after that create
-succeeds, with the editing tool or a QUOTED heredoc, never an unquoted
-one: `references/observation-log.md` ("Editing an existing observation").
+succeeds, with the editing tool, or a QUOTED heredoc (never unquoted) where
+commands arrive unaltered: `references/observation-log.md` ("Editing an existing observation").
Load `references/observation-log.md` ("The guard line, the sweep's count
and the noclobber create") when any of them fires.
diff --git a/references/environments.md b/references/environments.md
index 459c10e..d5e6869 100644
--- a/references/environments.md
+++ b/references/environments.md
@@ -19,6 +19,7 @@ in an environment without filesystem access.
- A third denial class: an automated content classifier
- A delegated setup step is not done until you have observed it
- Paths handed across a boundary are resolved from the far side
+ - Windows hosts: what reaches the shell and the file
- Environment mappings
- Git as an optional staging medium
- Claude Code Projects — disposable threads, no local skills, no pinned
@@ -925,6 +926,35 @@ policy does not govern, not as the `.ps1` shim it refuses. The app's own
terminal panel is a child of the packaged app and inherits its startup
environment, so it is not the user's side either.
+### Windows hosts: what reaches the shell and the file
+
+Two Windows transforms change content and report nothing.
+
+**Backslashes through an agent's Bash tool.** Where the agent's Bash tool
+runs Git for Windows' bash and hands it the whole command as one `-c`
+argument, runs of backslashes have been observed to arrive halved
+anywhere in the command — inside single quotes and quoted heredocs too —
+except directly before a double quote; a single backslash arrives intact,
+and the same command run from a file arrives exact. A body written through
+that shell loses one backslash of every `\\`, and an inline snippet that
+carries `\\` runs altered: the session-start scan's `suspect` program,
+halved, is rejected by gawk, mawk and BWK awk, so the count reads 0 with
+an error on stderr. Test a host once with `printf '%s\n' 'a\\b' | od -c`:
+two backslashes in the output mean the transport is exact. Where it is
+not, write observation bodies and any other content holding backslashes
+with the editing tool, and run a snippet that carries `\\` from a file
+written with the editing tool (`bash <file>`). Very long inline commands
+have also been reported cut on the same transport, so keep inline commands
+short and put long content in files.
+
+**A byte order mark from Windows PowerShell.** PowerShell 5.1 writes UTF-8
+with a BOM (`Set-Content -Encoding UTF8`, `Out-File -Encoding utf8`).
+Every header reader tests line 1 for `---`, so an entry written that way
+drops out of the session-start scan — `parsed` one below `files`, with no
+warning while other headers parse — and the archival sweep never moves
+it. Write entries with the editing tool or the helper script; in
+PowerShell 7, `-Encoding utf8NoBOM`.
+
## Environment mappings
The procedures in this skill are written as capabilities. This table is
diff --git a/references/observation-log.md b/references/observation-log.md
index 22b56d5..209e2bc 100644
--- a/references/observation-log.md
+++ b/references/observation-log.md
@@ -1340,7 +1340,10 @@ it: the file is created, it looks superficially right, and parts of its
content have been replaced by the output of commands. Quote the delimiter
(`<<'OBS'`) whenever a shell write is genuinely the only path — a
`set -C` noclobber create has no editing-tool equivalent — and prefer the
-editing tool everywhere else. Where the shell is that only path, write the
+editing tool everywhere else. A quoted heredoc is exact only where the
+shell receives the command as typed; on a host whose shell tool rewrites
+it in transit (`environments.md`, "Windows hosts: what reaches the shell
+and the file"), the body goes through the editing tool. Where the shell is that only path, write the
frontmatter with `printf` and the body with a QUOTED heredoc: quoting the
delimiter disables every substitution, so the body cannot carry
variables, and the id and the dates go in the `printf` above it —