Catch AI-vibe shell hallucinations, suggest real flags, and roast with style.
Project description
hallucinate
hallucinate watches shell failures, suggests safer fixes for bad flags, and roasts the command that failed.
There are three modes:
watchObserves a workspace-local JSONL stream at.hallucinate/stream.jsonl.exec/bashWraps command execution, logs the failure, and appends mocking/helpful feedback to the stderr the agent actually sees.agent-bashviaBASH_ENVLets non-interactivebashprocesses inherit the hook. This can log failures and append hallucinate feedback when the agent process inherited the environment.
Install
Set-Location E:\hallucinate
C:\Users\HP1\AppData\Local\Programs\Python\Python312\python.exe -m pip install -e .
Fastest Human Workflow
Watcher terminal:
Set-Location E:\your-workspace
hallucinate
Hooked shell terminal:
Set-Location E:\your-workspace
hallucinate shell
That opens a PowerShell session already configured for the current workspace.
Reliable Agent Workflow
If you want the agent to see hallucinate's feedback in the actual command output, wrap the command:
Set-Location E:\your-workspace
hallucinate exec --actor agent bash -lc "fakecommand; ls /bad/path; git merge nonexistentbranch"
Or call the dedicated bash wrapper:
Set-Location E:\your-workspace
hallucinate bash --actor agent -lc "fakecommand; ls /bad/path"
This is the reliable path for agents because hallucinate owns execution and can decorate stderr directly.
Raw Agent Bash Workflow
If an agent launches plain bash processes and inherits your environment, use:
Set-Location E:\your-workspace
Invoke-Expression (& hallucinate activate --shell agent-bash --actor agent)
This exports BASH_ENV, PATH, workspace metadata, and a local bash shim.
What this can do:
- log non-interactive bash failures
- append hallucinate feedback to failing bash stderr
- intercept
bashif the agent resolves it fromPATH
What this cannot do:
- intercept a bash process launched by an agent that did not inherit these environment variables
- override an agent that uses an execution layer completely outside your current process tree
PATH Bash Shim
hallucinate shell and hallucinate activate ... now create a workspace-local shim at:
.hallucinate/bin/bash
and prepend that directory to PATH.
If an agent resolves bash from PATH, it will hit the shim, which forwards to:
hallucinate bash ...
Important limit:
- This only helps when the agent resolves
bashthroughPATH. - If the agent hardcodes an absolute bash binary such as
/usr/bin/bash, a PATH shim cannot intercept it. - Absolute-path bash can still be influenced by
BASH_ENV, but only if the agent inherited that variable from the activated environment.
Commands
hallucinate
hallucinate shell --actor human|agent
hallucinate exec --actor human|agent <command ...>
hallucinate bash --actor human|agent <bash args ...>
hallucinate activate --shell powershell|bash|agent-bash
What Gets Logged
Each event includes:
- timestamp
- actor (
humanoragent) - cwd
- workspace root
- exit code
- command
- stderr
Product Boundary
watch is observational.
exec and bash are intercepting wrappers.
If the goal is "show mocking/helpful feedback directly to the agent", use exec or bash when you can.
Use agent-bash only when the agent insists on launching raw bash but still inherits your environment.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dont_hallucinate-0.1.0.tar.gz.
File metadata
- Download URL: dont_hallucinate-0.1.0.tar.gz
- Upload date:
- Size: 27.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab4374171aa3509320e6efb1173be69f1c192bc15d18e4f334dc9f7161b83df0
|
|
| MD5 |
1b863c5e2fa17ad4ca66dfe3bb0f237e
|
|
| BLAKE2b-256 |
fe82f2323e5fc62970bcc1d4938a2c5e55f96643785d27a5f017fbc0a0e8bb53
|
File details
Details for the file dont_hallucinate-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dont_hallucinate-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d615b9825a0d0d0f651c483ce72b593962164c812807370284af0cdba5c6646
|
|
| MD5 |
e466f69313a2c08c04a566aec72e319e
|
|
| BLAKE2b-256 |
0365410e31a7b4ef11528393ec478b1fc6bb37ceb337ec465ecb4b3d4703aade
|