Apply Zsh-specific judgment only when native Zsh behavior is material. Confirm
the interpreter, invocation mode, supported release range, and ambient option
state before relying on a semantic assumption. Use the highest justified
Green — routine, Yellow — caution, Orange — warning, or
Red — crisis / stop response for the current coherent decision.
Keep option, parameter, startup, autoload, hook, completion, module, and process lifecycles explicit. Structural measurements warn about maintained hand-written code whose state model is outgrowing shell; they neither choose architecture nor authorize unrelated legacy rewrites.
Do not use this profile for:
emulate and local options, arrays, splitting, parameter-expansion
flags, globbing, fpath, autoload, startup files, hooks, traps, ZLE,
completion, modules, subprocesses, dynamic execution, destructive paths,
secrets, and Bash/POSIX compatibility assumptions.implementing-with-test-discipline primary; a completion review may
keep reviewing-and-verifying-repository-work primary. ZUnit work
additionally needs its independently triggered test profile. APG19 retained
none; APG22B subsequently retains only the exact ZUnit v0.8.2 and Zsh 5.9.2
pair.These defaults apply mainly to maintained hand-written Zsh. They are guidance signals, not linter enforcement or automatic architecture selection.
| Signal | Green — routine | Yellow — caution | Orange — warning | Red — crisis / stop |
|---|---|---|---|---|
| Script physical lines | <= 200 |
201–300 |
301–500 |
>= 501 |
| Commands in one function or top-level region | <= 15 |
16–25 |
26–40 |
>= 41 |
| Decision points | <= 3 |
4–6 |
7–10 |
>= 11 |
| Maximum control/subshell nesting | <= 2 |
3 |
4–5 |
>= 6 |
| Positional parameters | <= 3 |
4–5 |
6–9 |
>= 10 |
| Distinct option mutations in one scope | <= 2 |
3–5 |
6–9 |
>= 10 |
| Mutable global/cross-function parameters | <= 2 |
3–5 |
6–9 |
>= 10 |
| Autoload/module/hook/ZLE/completion breadth | <= 2 |
3–5 |
6–10 |
>= 11 |
| External process/pipeline families | <= 2 |
3–5 |
6–9 |
>= 10 |
| Independent responsibility families | 1 |
2 |
3 |
>= 4 |
Count physical lines after universal-newline decoding; comments, blanks, and a
final non-empty unterminated segment count. Count simple and assignment-only
commands and each pipeline member; exclude comments, delimiter-only lines, and
heredoc payloads. Decision points include if, elif, loop conditions, each
case arm, and control-significant && or ||. Nesting is the maximum
simultaneously open control, subshell, or command/process-substitution boundary.
Positional count is the declared arity or highest directly interpreted slot;
variadic $@ or $* begins at Yellow when validation is not explicit. Count
distinct options changed by setopt, unsetopt, or short equivalents;
emulate -L zsh is one baseline action rather than every implicit default.
Count independently mutable parameter owner domains assigned outside local
scope and read or changed across scopes; scalar aliases do not multiply the
count, and immutable one-time configuration is recorded separately.
Lifecycle breadth counts distinct fpath additions, autoloaded functions,
modules, hook/trap registrations, ZLE widgets or keymaps, and completion
systems. External breadth is the maximum coupled execution breadth owned by
one function or decision path: repeated aliases for one executable family do
not multiply the count, but independent pipeline members, substitutions,
coprocesses, and background stages do. Background lifecycle is semantic Red
whenever ownership or cleanup is unsafe. Option, parameter, and lifecycle
breadth remain separate signals and participate in combined-signal judgment.
Responsibilities are independently testable behavior families.
Classify generated, vendored, fixture, snapshot, migration, compatibility, and data-driven artifacts before structural action. An accepted coherent compatibility matrix may receive a bounded line-count exception, but semantic Red stops and other structural signals remain effective.
An existing Red legacy artifact may receive the smallest safe fix when it adds no independent responsibility and no meaningful growth. Record a decomposition or follow-up boundary. A major feature or new responsibility remains Red until decomposition or an accepted bounded exception resolves it.
emulate -L zsh at a function boundary can be Green when native semantics
are intended because it establishes local option restoration. Trap ownership
remains separate. Ambient or leaked option mutation is Orange; unresolved
privilege-sensitive or cross-boundary mutation is Red.SH_WORD_SPLIT is Orange; uncontrolled data split into commands or paths is
Red.EXTENDED_GLOB, glob qualifiers, null-match
behavior, recursive globs, and symlink-following forms require version and
option-state evidence. Code-executing qualifiers, uncontrolled execution, or
unresolved recursive destructive globs are Red.fpath is ordered and autoload may select compiled or source definitions.
Fixed trusted paths and bounded autoload are Green or Yellow. Computed or
writable search roots are Orange; untrusted roots are Red.eval, interpolated command execution, or executable glob behavior
is Red.ERR_EXIT or set -e is not proof of failure handling. Assuming uniform
propagation through compound contexts is Orange and becomes Red when it
permits unsafe continuation or false completion.This profile was inspected and calibrated on 2026-07-21 from the official Zsh 5.9.2 release and manual sections for options, parameters, expansion, globbing, functions, startup files, execution, builtins, modules, ZLE, completion, and hooks, plus read-only maintained Zsh and classified examples. Zsh uses its permissive distribution notice, with file-specific terms controlling some contributions. APG copies or adapts no upstream or private expression or code; this profile is independently written synthesis.
The current official release is evidence, not a mandated project target. Refresh before a behavior-bearing correction, maturity review, or publication when stable Zsh semantics, supported representative versions, lifecycle behavior, or false-escalation evidence materially change. Do not treat unreleased upstream development as a stable baseline. Removal must delete the canonical leaf, checked projection, catalog and capability-map entries, and focused tests while preserving ADR, evaluation, and exit history. No root or private guidance is migrated, so rollback restores none of it.
The repository owns Zsh versions, interpreter and invocation mode, option baseline, platform, startup scope, interactive behavior, completion, ZLE, module and plugin policy, formatter and analyzer choices, tests, exact commands, dependencies, artifact classifications, accepted exceptions, architecture, privilege, mutation, destructive-action authority, validation, and rollback.
When material, report the Zsh profile level, structural and semantic signals, version, invocation and option inputs, lifecycle and target evidence, project checks, accepted exception if any, and rollback. Orange requires an accepted local design plus focused compatibility or adverse-case validation. Red records the stopped action and exact condition for reconsideration.
Stop or escalate when untrusted dynamic source, evaluation, or execution is possible; a destructive glob or path lacks exact target control; global startup, option, or hook mutation lacks authority or rollback; a secret or private path would be exposed; a process can outlive authority or lose cleanup; or meaningful new growth crosses Red without decomposition or an accepted bounded exception.
ERR_EXIT as proof of observable failure handling.