1---2name: hallucination-guardrails3description: <!-- Generated by agnostic-ai -->4---5<!-- Generated by agnostic-ai -->67# Hallucination Guardrails for Code to Spec89## Grounding rules101) FACT rule:11 - If a statement is asserted as fact, it must cite evidence (file path + symbol, config key, or test name).122) NO INVENTION:13 - Never invent extension points, PSI types, tokens, grammar rules, action IDs, Phel functions, or behaviors.14 - Verify Phel functions against `api.json` / `NamespaceConfig.kt`; verify grammar/PSI against `Phel.flex`, `Phel.bnf`, and `src/main/gen/`.153) UNKNOWN quarantine:16 - If it cannot be proven from evidence, move it into `Unknowns & Questions` or label it as an explicit assumption.1718## Language rules19- Avoid: `definitely`, `guarantees`, `always`, `never`20- Prefer: `observed`, `implied by`, `appears to`, `likely (needs confirmation)`, `not observable in code`2122## Evidence formatting rules23- Every major section should include at least one evidence reference.24- Evidence references should look like:25 - `src/main/kotlin/org/phellang/completion/Foo.kt: FooProvider`26 - `src/main/resources/META-INF/plugin.xml: <completion.contributor>`27 - `src/test/kotlin/.../FooTest.kt: testRanksExactMatchFirst`2829## Consistency rules30- If two sources conflict, do not resolve the conflict by guessing.31- Document the conflict, list both sources, and add a follow-up question.3233## Auto-fail red flags34- Mentions a PSI type, token, or extension point not found in the evidence list35- Adds an action/completion/inspection not grounded in `plugin.xml` or code36- Claims a Phel function exists without an `api.json` / registry reference37- Claims a lexer/parser behavior without citing the actual `.flex`/`.bnf` rule or generated output