Source Intelligence

DisclaimerUnofficial, and not affiliated with Anthropic. Nearly all of this is read straight out of what ships: npm bundles, captured prompts, published docs. Anthropic's own notes go in verbatim, marked as theirs. The rest is my reading, and every entry carries the strings behind it. If one looks wrong, vote it down and say why.

All of v2.1.213 Home All releases olderv2.1.212 v2.1.214newer
Claude Code v2.1.213

Shell Safety: Test Command Gap Analysis

What

The Bash safety parser now checks test commands ([[ ... ]]) for unparsed bytes between children or after the last child, which would indicate the parser missed content the shell will actually see.

Details
  • A new recursive function dnu() walks test_command AST nodes and their four nested compound-expression node types: unary_expression, binary_expression, negated_expression, and parenthesized_expression
  • For each node the function tracks a byte-position cursor from startIndex to endIndex and measures the gap before each child and after the last child; gaps that contain only whitespace (spaces, tabs), backslash-newline continuations, or (in bash mode) comment characters are allowed
  • Between-children gap: if the bytes between two adjacent parsed children are non-trivial, the function returns { kind: "too-complex", reason: "Test command has unparsed bytes between children — parser dropped content that shell will see" }
  • After-last-child gap: if bytes remain between the last child's endIndex and the node's own endIndex, the function returns { kind: "too-complex", reason: "Test command has unparsed bytes after its last child — parser dropped content that shell will see" }
  • Child out-of-bounds: if a child's span extends outside the parent's span, the function returns { kind: "too-complex", reason: "Test command child extends past the node span — gap byte accounting is untrustworthy" }
  • All three cases produce a "too-complex" result; the safety classifier treats "too-complex" as inability to determine read-only status, so the command is not automatically approved — the user sees the standard "approve this command?" prompt rather than a silent pass-through
  • This closes a semantic gap where a tree-sitter parse failure inside [[ ]] could have caused the classifier to analyse a truncated/simplified version of the condition and incorrectly allow a command that the shell would evaluate differently
Evidence

Test command validation (search for "Test command has unparsed bytes between children", "Test command has unparsed bytes after its last child"); gap-check implementation (search for dnu, Zru, unu)

Strings lifted out of the shipped bundle, so the claim above can be checked against them.

See this entry in the whole of v2.1.213 →