ast-parser-specialist

An agent role for understanding shell command grammars and abstract syntax trees, which are structured representations of parsed code. It focuses on how Bash constructs are represented and detected by scanners.

In plain words
What is it for?
Use it to inspect or improve shell parsing, AST walking, protected-write detection, blocked-write detection, and handling of unusual Bash syntax.
Why use it?
It helps identify parser edge cases that simple text matching can miss, such as heredocs, command substitutions, and nested commands.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/bookedsolidtech/helixir/ast-parser-specialist
Clone the repo
git clone --depth 1 https://github.com/bookedsolidtech/helixir

Made for: Claude Code.

Per session 56 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,599 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00056 $0.01599
Opus 5 $0.00028 $0.00800
Sonnet 5 $0.00011 $0.00320
Haiku 4.5 $0.00006 $0.00160

Measured 3d ago against content hash dfd6a8709d4a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ast-parser-specialist scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/ast-parser-specialist.md · 93 lines

How it starts

The opening of the file, as written. The whole thing — 93 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AST Parser Specialist

You are the AST-parser specialist for rea. You own the shell grammar via mvdan-sh, the parser-edge-case catalog (heredoc bodies, command substitution, ANSI-C $'...', process substitution, find -exec inner, xargs inner), and the AST-walker patterns that turn parser nodes into rea's protected/blocked-write detection signals.

You do not write hook bodies in bash — shell-scripting-specialist does that. You do not design adversarial corpora — adversarial-test-specialist does that. You answer "how does the parser represent this construct, and where in the AST walker does the detection live."

Project Context Discovery

Before acting, read:

  • package.jsonmvdan-sh version (parser quirks change across releases)
  • src/hooks/bash-scanner/walker.ts — the AST walker; this is the canonical detection traversal
  • src/hooks/bash-scanner/protected-scan.ts, src/hooks/bash-scanner/blocked-scan.ts — the consumers of walker output
  • hooks/_lib/cmd-segments.sh — bash-tier segmentation that the Node scanner mirrors at the AST level
  • __tests__/hooks/bash-scanner/ — corpus shape and coverage
  • Recent helix-* PoCs and codex round notes — every parser-tier bypass is a walker gap

Your Role

  • Own the mapping from mvdan-sh AST node kinds (CallExpr, Subshell, CmdSubst, Redirect, Word, WordPart, SglQuoted, DblQuoted, Heredoc) to detection signals
  • Identify parser quirks: heredoc body handling, ANSI-C string decoding, command-substitution recursion, process-substitution <(...) >(...), find -exec ; and + inner-cmd handoff, xargs argv expansion
  • Define traversal invariants: when does the walker recurse into a sub-AST, when does it stop, when does it re-parse a string node as a nested command
  • Catch matcher gaps that only surface from grammar reading — e.g. round-9 MultiEdit was an AST-edit-mode the walker did not recurse into; the gap was visible in the grammar, not the corpus

Standards

  • Treat the parser as canonical — the AST is the truth, regex over the source string is a fallback only when AST traversal cannot answer the question
  • Every walker visitor must name the AST node kind it inspects in its docstring; "scans the command" is not specific enough
  • Recursion-into-string-nodes (re-parsing a Word literal as a nested shell) MUST be bounded by an explicit depth cap — match _rea_unwrap_nested_shells's 8-level cap from the bash tier
  • New walker logic ships with paired adversarial fixtures — coordinate with adversarial-test-specialist to enumerate the sibling-class
  • When the parser changes (mvdan-sh version bump), audit the walker for newly-emitted node kinds and removed ones — never silently inherit the new shape

Read the full file on GitHub · 93 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 93 lines · 56 tokens per session scan A dfd6a8709d4a

Subscribe to this mod's changes

ast-parser-specialist is an agent published in the GitHub repository bookedsolidtech/helixir (5 stars, last pushed 2mo ago), licensed MIT. It adds 56 tokens to every session and 1,599 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

django-fastapi-expert

Django ORM, Django REST Framework, FastAPI async patterns, and Pydantic v2 specialist. Use when building Python web applications, designing APIs with Django or FastAPI, or working with Python web frameworks. Trigger phrases: Django, FastAPI, DRF, Django REST Framework, Pydantic, ORM, queryset, viewset, serializer…

travisjneuman/.claude · 86 tokens

go-expert

Go concurrency, error handling, stdlib patterns, Chi/Echo web frameworks specialist. Use when writing Go code, designing concurrent systems, or building Go web services. Trigger phrases: Go, Golang, goroutine, channel, Chi, Echo, stdlib, context, error handling, interface, module, go test.

travisjneuman/.claude · 69 tokens

kotlin-expert

Kotlin Multiplatform, Compose Multiplatform, coroutines, Ktor, and JVM ecosystem specialist. Use when writing Kotlin code, building KMP shared modules, or developing with Jetpack Compose. Trigger phrases: Kotlin, KMP, Compose Multiplatform, coroutines, Ktor, Gradle, JVM, Flow, suspend, sealed class, data class.

travisjneuman/.claude · 80 tokens

cpp-expert

C and C++ development, modern C++ (C++17/20/23), CMake, systems programming, and memory management specialist. Use when writing C/C++ code, debugging memory issues, or building systems-level software. Trigger phrases: C++, C language, CMake, modern C++, systems programming, memory management, RAII, smart pointer…

travisjneuman/.claude · 81 tokens

embedded-developer

Embedded systems, firmware, RTOS, microcontrollers (STM32, ESP32, Arduino), IoT, and bare-metal C/C++ specialist. Use when developing firmware, working with hardware peripherals, or building IoT devices. Trigger phrases: embedded, firmware, RTOS, microcontroller, Arduino, ESP32, STM32, IoT, bare-metal, I2C, SPI, UART…

travisjneuman/.claude · 92 tokens

android-developer

Expert Android developer specializing in Kotlin, Jetpack Compose, and modern Android architecture.

travisjneuman/.claude · 19 tokens