tree-sitter-al: Instructions file for Claude Code

CLAUDE.md

tree-sitter-al CLAUDE.md is an instructions file for Claude Code from SShadowS/tree-sitter-al. It costs 5,291 tokens per session, scanned A, original, MIT.

Project instructions for maintaining a tree-sitter parser for AL, the programming language used by Microsoft Dynamics 365 Business Central.

In plain words
What is it for?
They are for guiding AL grammar changes, running parser validation, checking production files, and committing generated parser files together.
Why use it?
They define parser correctness rules, required validation, and commit practices so grammar changes can be checked for regressions.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions subagents; mentions Claude Code.

This is SShadowS/tree-sitter-al's own configuration. It tells Claude Code how to work on tree-sitter-al itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything tree-sitter-al configures →

Reuse

Borrowing it

Nothing to install: this file belongs to SShadowS/tree-sitter-al. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/SShadowS/tree-sitter-al/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/SShadowS/tree-sitter-al

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tree-sitter-al CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/sshadows/tree-sitter-al/claude-md/github.svg)](https://agentmods.dev/instructions/sshadows/tree-sitter-al/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/sshadows/tree-sitter-al/claude-md"><img src="https://agentmods.dev/badge/instructions/sshadows/tree-sitter-al/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for tree-sitter-al CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/sshadows/tree-sitter-al/claude-md"><img src="https://agentmods.dev/badge/instructions/sshadows/tree-sitter-al/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 5,291 This file is loaded in full into every session.
When invoked 5,291 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.05291 $0.05291
Opus 5.5 $0.02116 $0.02116
Sonnet 5.5 $0.01058 $0.01058
Haiku 4.5 $0.00529 $0.00529

Measured 4d ago against content hash 20d89a1f785e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

tree-sitter-al CLAUDE.md 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 4d 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.md · 298 lines

How it starts

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

CLAUDE.md

GOAL: A parser which parses AL code CORRECT, not just without errors. That is the first and foremost goal.

Guidance for Claude Code when working on this tree-sitter parser for AL (Microsoft Dynamics 365 Business Central). The .claude/rules/*.md files are loaded with this one; they own scanner, keyword, attribute, debugging and test-failure detail and are not repeated here. One home per fact: a rule lives here or in a rules file with its one-line why; its history and measurements live in docs/ or in the comment at the rule in grammar.js / src/scanner.c.

Current numbers (tests, states, parser.c size, success rate) are NOT in this file. They drift every branch. Measure them: ./tools/metrics.sh and ./parse-al-parallel.sh ./BC.History/ .. Three different test counts circulated during 4.0.0 and two were arithmetic from a stale copy.

Git Commit Guidelines

Always include the error count in commit messages so a regression is visible in the log:

Fix XYZ pattern

[BC.History: 7 errors, 99.95% success]

Run the full parse before committing: ./parse-al-parallel.sh ./BC.History/ .

Commit all generated files together: tree-sitter generate writes src/parser.c, src/grammar.json and src/node-types.json, all tracked. Stage them as a set or grammar.json silently drifts.

Subagent briefs link docs/agent-brief-rules.md (blocked commands, process, environment, editing rules).

Quick Reference

# Validation (run before completing any task)
./validate-grammar.sh        # generation, tests, orphan/duplicate detection, field invariants, oracle quick tier, censuses
./validate-grammar.sh --full # plus production AL parsing and the has_error sweep over it

# Zero-behavior-change gate for refactors (byte-identical parse trees). Take a FRESH baseline,
# named for the change: a stale snapshot reports a huge delta that has nothing to do with your edit.
./tools/tree-harness.sh snapshot ./BC.History .snapshots/baseline-<change>  # ~16s
./tools/tree-harness.sh verify   ./BC.History .snapshots/baseline-<change>  # ~11s

# Query-coverage harness: the CST is lossless and values are queryable
python -m tools.query_coverage.qc run          # regression gate, exits 1 on a new cluster
python -m tools.query_coverage.qc run --all    # full picture
python -m tools.query_coverage.qc accept       # freeze the current state as the baseline

# has_error gate: the ONLY thing that sees a MISSING node for a HIDDEN token (see below)
python tools/has_error_sweep.py --root ./BC.History/   # exit 0 clean, 1 errors, 2 cannot run
python tools/has_error_sweep.py --corpus-fixtures      # every corpus case

# Config oracle (validate-grammar.sh Step 5e, CI job `config-oracle`): exit 0 clean, 1 finding, 2 cannot run
python -m tools.config_oracle run --tier quick  # ~2-3 s
./tools/ts-lock.sh python -m tools.config_oracle run --tier full|resolve --root ./BC.History --root ./DC ...  # full ~22 min
python -m tools.config_oracle replay            # historical-defect replays
# Exit-code gates, root labelling, the two classification tsvs, lowering modules: tools/config_oracle/README.md

# Traversal helper (roadmap F0, docs/traversal.md); Step 5f is the census
python tools/traversal_census.py
./tools/ts-lock.sh python -m pytest tests/traversal -q
python tests/traversal/regen_expected.py      # a -u: review every hunk of the diff

# Separator/continuation audit (B7a, docs/b7-separator-continuation-matrix.md); Step 5g is the census
python -m tools.b7_audit census --check
./tools/ts-lock.sh python -m tools.b7_audit run [--only X] [--check]   # full ~3 h cold; NOT in validate
python -m tools.b7_audit report                 # must be byte-identical to the committed matrix
./tools/ts-lock.sh python -m tools.b7_audit assert --refresh
./tools/ts-lock.sh python -m pytest tools/b7_audit/tests -q   # Step 5h
# After ANY change to src/parser.c, src/scanner.c or tools/config_oracle: `assert --refresh` per fix; a full `run`,
# then `report`, once per batch before merging (docs/agent-brief-rules.md, "Gate tiers").

# Perf (docs/performance-baselines.md). Speed DECISIONS come from `ab`, same session, ABBA; baselines are context.
python -m tools.perf ab --lib-a OLD --lib-b NEW --corpus dc
python -m tools.perf delta                      # structural production delta (B7b-3), tools/perf/delta-reviewed.tsv

# Workflow tools: use these, not ad-hoc versions
python tools/snip.py 'x := a + 1;'                 # cursor tree with fields, has_error, ERROR/MISSING/hidden; --sexp
python tools/snip.py --census --root ./BC.History   # two-shape detector for node types; exit 1 if any flagged
./tools/metrics.sh [--vs REV] [--tests]            # STATE/LARGE_STATE/SYMBOL_COUNT, parser.c size, grammar.js lines, tests
python tools/nodetypes.py show|who-has TYPE        # node-types.json questions; `diff REV`
./tools/corpus-grep.sh [-E|-P] [-i] [-l|-c] PAT    # sites over the four corpora (*.al only)
./tools/session-cleanup.sh --procs [--yes]         # leftover processes older than 30 min

# Development cycle. Always through the lock: `./tools/ts-lock.sh tree-sitter ...`
tree-sitter generate
tree-sitter generate --report-states-for-rule -  # rank rules by parser-state cost
tree-sitter test [-i PAT] [-e PAT] [--file-name F] [-d]
tree-sitter test -u                              # see the traps below
tree-sitter parse file.al -d > debug.log 2>&1    # .claude/rules/debugging.md

Read the full file on GitHub · 298 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. 4d ago Changed · +1 lines · +23 tokens per session 20d89a1f785e
  2. 7d ago Changed · -268 lines · -8,274 tokens per session 0f8aa822393e
  3. 9d ago Changed · +3 lines · +922 tokens per session 24e91329bfb5
  4. 22d ago Changed · +20 lines · +1,243 tokens per session 55581b24dad9
  5. 23d ago Changed · +2 lines · +648 tokens per session 35e897d36e8f
  6. 24d ago Changed · +4 lines · +510 tokens per session 4991fdccdeb4
  7. 25d ago Changed · +105 lines · +2,633 tokens per session c8278f674c0f
  8. 1mo ago Changed · +3 lines · +251 tokens per session 3064d33ea641
  9. 1mo ago Changed · +18 lines · +534 tokens per session bb66bfdeb653
  10. 2mo ago First seen · 410 lines · 6,801 tokens per session scan A 91f39753e323

Subscribe to this mod's changes

tree-sitter-al CLAUDE.md is an instructions file published in the GitHub repository SShadowS/tree-sitter-al (24 stars, last pushed 4d ago), licensed MIT. It adds 5,291 tokens to every session, about $0.0212 per session on Opus 5.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-30.

Related

Other instructions, from other repositories

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 9,715 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,461 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).

microsoft/vscode · 5,262 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,680 tokens

vscode copilot-instructions.md

Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).

microsoft/vscode · 2,750 tokens

deno copilot-instructions.md

Copilot instructions for denoland/deno, covering deno development guide for github copilot, network access, high level overview, key directories and key files to understand first.

denoland/deno · 3,077 tokens