You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ShellSyntaxTree 0.2 exposes a flat ParsedCommand.Clauses projection. It
cannot faithfully represent loop headers, nested bodies, mutually exclusive
branches, repeated execution, bounded loop variables, or divergent shell
state. Unsupported forms fail closed, which is safe but creates material
approval fatigue for real agent-authored commands.
The Netclaw 0.25.3 redirect incident also demonstrated a boundary problem:
static descriptor operations and genuinely dynamic values can both appear as DynamicSkip, forcing consumers to reconstruct shell grammar from raw text.
v0.3 outcome
Add an evolutionary, security-oriented model with:
a strongly typed syntax tree above existing Clause leaves;
a library-owned Commands projection containing every command that may
execute, including conditions, iterators, substitutions, branches, and loop
bodies;
exact, finite, bounded-pattern, and unknown shell value domains;
conservative cwd and variable-state joins;
explicit redirect operations and target facts;
a conservative ParsedCommand.Clauses compatibility projection;
separate Bash and PowerShell grammar front ends feeding shared analysis only
where both implementations prove the same abstraction.
The security invariant is:
Identify every command that may execute and derive no narrower authorization
scope than shell semantics can prove.
Boundaries
Do not execute commands, enumerate globs, inspect runtime variables, or use a
live shell to derive authorization facts.
Do not build a shared lexer or shared parser base class.
Do not embed Git, rm, Docker, cmdlet, or other executable-specific option and
operand grammars in ShellSyntaxTree.
Do not classify URLs or environment assignments as harmless globally;
executable-aware consumers own those decisions.
Do not treat heredoc bodies as commands merely because a receiving executable
might interpret the data as code.
Unknown or incomplete executable regions remain fail closed.
Delivery order
Lock the public API, compatibility projection, completeness rules, fixed
analysis bounds, and Bash/PowerShell supported-construct matrix.
Produce Syntax, Commands, and unchanged compatibility Clauses for the
existing grammar.
Add explicit redirect semantics and migrate the Netclaw consumer path.
Add Bash for ... in as the first end-to-end control-flow slice.
Add PowerShell foreach as the second slice before expanding all Bash
constructs.
Extract shared occurrence, value-domain, and state-join machinery proven by
those two working implementations.
Add condition loops and branches in separate shell-specific slices.
Preserve Bash heredocs with explicit delimiter, body, expansion, and completeness facts; add Bash <<< here strings; and gate process substitution, background lists, C-style loops, and arithmetic on their own executable-region and value-semantics designs.
Acceptance gates
Every supported executable region appears exactly once in Commands.
Conditions and iterators are never omitted from authorization traversal.
Existing Clause, Arg, Redirect, ClauseElement, and VerbChain facts
remain available.
Old consumers receive a conservative flattened view and do not silently miss
nested commands.
Exact, finite, pattern, and unknown facts are never conflated.
Static and computed redirect targets are distinguishable without parsing raw
prefixes.
Unsupported execution-bearing regions set IsUnparseable=true; partial
results are diagnostic only.
Both shell corpora, public API snapshots, PII audit, Linux/Windows CI, and
Netclaw integration matrices pass.
The OpenSpec contains the proposal, architectural decisions, five capability
specifications, and the ordered implementation checklist. Public type names
and analysis caps remain explicit contract-lock tasks; production code should
not begin until those are reviewed.
Problem
ShellSyntaxTree 0.2 exposes a flat
ParsedCommand.Clausesprojection. Itcannot faithfully represent loop headers, nested bodies, mutually exclusive
branches, repeated execution, bounded loop variables, or divergent shell
state. Unsupported forms fail closed, which is safe but creates material
approval fatigue for real agent-authored commands.
The Netclaw 0.25.3 redirect incident also demonstrated a boundary problem:
static descriptor operations and genuinely dynamic values can both appear as
DynamicSkip, forcing consumers to reconstruct shell grammar from raw text.v0.3 outcome
Add an evolutionary, security-oriented model with:
Clauseleaves;Commandsprojection containing every command that mayexecute, including conditions, iterators, substitutions, branches, and loop
bodies;
ParsedCommand.Clausescompatibility projection;where both implementations prove the same abstraction.
The security invariant is:
Boundaries
live shell to derive authorization facts.
operand grammars in ShellSyntaxTree.
executable-aware consumers own those decisions.
might interpret the data as code.
Delivery order
analysis bounds, and Bash/PowerShell supported-construct matrix.
Syntax,Commands, and unchanged compatibilityClausesfor theexisting grammar.
for ... inas the first end-to-end control-flow slice.foreachas the second slice before expanding all Bashconstructs.
those two working implementations.
<<<here strings; and gate process substitution, background lists, C-style loops, and arithmetic on their own executable-region and value-semantics designs.Acceptance gates
Commands.Clause,Arg,Redirect,ClauseElement, andVerbChainfactsremain available.
nested commands.
prefixes.
IsUnparseable=true; partialresults are diagnostic only.
Netclaw integration matrices pass.
Related work
openspec/changes/v0-3-structured-shell-analysis/The OpenSpec contains the proposal, architectural decisions, five capability
specifications, and the ordered implementation checklist. Public type names
and analysis caps remain explicit contract-lock tasks; production code should
not begin until those are reviewed.