Skip to main content

dont-hallucinate

dont-hallucinate intercepts agent shell failures, classifies what went wrong, suggests fixes when it can, and mocks your coding agent. By giving a model immediate negative reinforcement helps them to stop foolishly repeating the same mistake.

What it does

  • Watches shell failures in real time with a live TUI dashboard
  • Classifies errors: hallucinated flags, phantom packages, ghost branches, dirty working trees, network failures, and more
  • Roasts the agent with context-aware snark injected directly into stderr
  • Suggests fixes: corrected commands and valid flag alternatives
  • Detects the agent (Claude, Cursor, Aider, Copilot, GPT, Windsurf) and personalizes the roast

Install

Recommended:

pip install dont-hallucinate

From source:

git clone https://github.com/alexgaoth/dont-hallucinate
cd dont-hallucinate
pip install -e .

Hook Setup

There are now three separate install commands because the integration points are different.

Claude Code

Global install (recommended):

dont-hallucinate install-hook-claude --global

Project-local install:

dont-hallucinate install-hook-claude

Codex CLI

Global install (recommended):

dont-hallucinate install-hook-codex

Project-local install:

dont-hallucinate install-hook-codex --project

This updates ~/.codex/config.toml by default and installs a shell_environment_policy block that sets:

  • BASH_ENV to the noninteractive dont-hallucinate bash hook
  • HALLUCINATE_ACTOR=agent
  • HALLUCINATE_STREAM_FILE=~/.dont-hallucinate/codex/stream.jsonl

Important scope note:

  • This currently covers Codex bash subprocess failures
  • It is not a PowerShell-native Codex hook
  • If you already use inline set = {...} inside [shell_environment_policy], migrate that to [shell_environment_policy.set] first

Cursor

Install the Cursor hook:

dont-hallucinate install-hook-cursor

This appends shell-profile snippets that activate only when Cursor sets CURSOR_AGENT.

Files updated:

  • PowerShell: ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1
  • Bash: ~/.bashrc
  • Zsh: ~/.zshrc

The Cursor stream file is written to:

~/.dont-hallucinate/cursor/stream.jsonl

Important scope note:

  • This is a shell-profile install, not a Cursor settings.json tool hook
  • It covers Cursor agent terminal sessions that inherit your normal shell startup files
  • Normal terminals are not affected because the snippet checks CURSOR_AGENT

Watch UI

By just running:

dont-hallucinate

It will shows a live dashboard with the failure type, failing command, suggested fix, and roast. This will work anywhere if global setup. If local setup this will only work in the project root.

Commands

dont-hallucinate 
dont-hallucinate exec [--shell] --actor agent -- <command>
dont-hallucinate install-hook-claude [--global]
dont-hallucinate install-hook-codex [--project]
dont-hallucinate install-hook-cursor

Error types caught

Type What it means
invalid_flag hallucinated CLI flag that does not exist
missing_package command not found / phantom package
git_branch_missing branch or ref that does not exist
git_dirty uncommitted changes blocking the operation
git_conflict merge conflict
npm_missing_script script not defined in package.json
file_not_found path does not exist
permission_denied insufficient permissions
port_in_use address already bound
network_error DNS failure, connection refused, SSL error
no_space disk full
syntax_error shell or language syntax error
generic_error everything else

What the agent sees

When active, the relevant shell command path is wrapped or instrumented so failures are decorated. On failure, stderr gets an extra line like:

[dont-hallucinate/agent] caught: npm run tset
[dont-hallucinate/agent] type: npm_missing_script
[dont-hallucinate/agent] roast: package.json had a menu. GPT ordered something imaginary.

Platform support

  • Linux/macOS: fully supported for bash/zsh-based flows
  • Windows: supported for PowerShell and bash-based flows
  • Codex install currently targets bash subprocess interception

Metadata

Release files for dont-hallucinate 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dont-hallucinate 0.1.3
File Size Uploaded
dont_hallucinate-0.1.3.tar.gz 31.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dont-hallucinate 0.1.3
File Interpreter ABI Platform
dont_hallucinate-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 61.9 kB

Release files / dont_hallucinate-0.1.3.tar.gz

Download URL dont_hallucinate-0.1.3.tar.gz
Size 31.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1fd43daa91e74d8a8a91cc1e9ad5caf447149aaad78552f9010655c8d148ff63
BLAKE2b-256 checksum
How to use checksums
9cee7fb76eeb05b5ff2e88e371c07abd016a64f420628a672cc9e7a1443a3724
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / dont_hallucinate-0.1.3-py3-none-any.whl

Download URL dont_hallucinate-0.1.3-py3-none-any.whl
Size 30.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1d44a2459fae4ad458bc4bce64343412d2c5f5316d0058cc99c94bd6a1be5e6
BLAKE2b-256 checksum
How to use checksums
2815eaab7c65ad6c82a84e88f1e57a143cac858982013e956c1d5cb371f752aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page