plans/13-grammar-parser-fidelity.md
The structural-parsing layer (tree-sitter, powering smart_outline / smart_unfold and observation parsing) has two correctness gaps that share a root: the grammar/query contract is not validated against the languages it claims to support. Plain .js / .mjs / .cjs became unparseable when a shared JS/TS query started referencing TS-only node types that the tree-sitter version rejects (a realized regression of #1654), and smart_outline / smart_unfold never load the custom grammars declared in .claude-mem.json. The fix is a grammar contract: queries must parse against every declared language version, and custom-grammar configuration must actually be honored, both enforced in CI.
.js/.mjs/.cjs unparseable — realized regression of #1654 (tree-sitter rejects TS-only node types in the shared jsts query).claude-mem.json.claude-mem.json custom-grammar declarations into the smart_outline / smart_unfold load path.| Language | Source | Required behavior |
|---|---|---|
| JS | .js / .mjs / .cjs | parses without TS-only node-type errors |
| TS/TSX | .ts / .tsx | parses (no regression) |
| custom | .claude-mem.json grammar | loaded and used by smart_outline/unfold |
Observer output fidelity (plan-11); data persistence (plan-09).