-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or requestimpact: contractChanges stdin/stdout contract with Claude Code. High risk.Changes stdin/stdout contract with Claude Code. High risk.phase: 5-output-pipelinePhase 5: Output format (must preserve hook contract)Phase 5: Output format (must preserve hook contract)risk: lowLow risk — additive, backward-compatibleLow risk — additive, backward-compatibletopic: outputOutput format, JSON, suggested fixesOutput format, JSON, suggested fixes
Description
Summary
When a hallucination pattern is flagged, generate a suggested rewrite that replaces the speculative/ungrounded language with evidence-based alternatives.
Current Behavior
The stop hook outputs a warning message with the flagged evidence but does not suggest what to say instead. The user/agent must figure out the rewrite themselves.
Proposed Behavior
Each trigger match includes a suggestedFix field with a rewritten version:
{
kind: 'speculation_language',
evidence: 'I think',
offset: 12,
original: 'I think the issue is in the config.',
suggestedFix: 'I have not verified the root cause. To investigate, I can check the config file.'
}Fix Templates (per category)
Speculation Language
- "I think X" → "I have not verified X. To check: [verification step]."
- "X is probably Y" → "X may be Y — I can verify by [method]."
- "It should be working" → "I have not confirmed whether it is working. Next step: [test]."
Causality Language
- "X because Y" → "X was observed. Y is a hypothesis — to verify: [method]."
- "caused by Z" → "Potential cause: Z. Evidence needed: [what to check]."
Completeness Claims
- "all files checked" → "I checked [list files]. Other files were not examined."
- "fully resolved" → "The specific issue in [file:line] is fixed. Other instances not checked."
Pseudo-Quantification
- "8.5/10" → Remove or replace with specific measurable criteria.
- "70% improvement" → "Measured: [before] → [after] by [method]."
Implementation
- Templates stored as data, not hardcoded strings
- Configurable via
.hallucination-detectorrc.cjs(see feat: config file handling — cascading settings from multiple sources #10) - Templates support
${evidence},${kind},${offset}interpolation - Optional: LLM-powered rewrite mode for more natural suggestions (requires API key)
Acceptance Criteria
- Every trigger match includes
suggestedFixtext - Templates exist for all four current categories
- Templates are overrideable via config (feat: config file handling — cascading settings from multiple sources #10)
- Tests validate fix generation for each category
- Stop hook output includes the suggestion in its response
Related Issues
- feat: config file handling — cascading settings from multiple sources #10 (config — custom response templates)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestimpact: contractChanges stdin/stdout contract with Claude Code. High risk.Changes stdin/stdout contract with Claude Code. High risk.phase: 5-output-pipelinePhase 5: Output format (must preserve hook contract)Phase 5: Output format (must preserve hook contract)risk: lowLow risk — additive, backward-compatibleLow risk — additive, backward-compatibletopic: outputOutput format, JSON, suggested fixesOutput format, JSON, suggested fixes