-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Problem
UserPromptSubmit hooks execute successfully but their stdout is not injected into the LLM context, despite documentation stating it should be.
Expected: Hook stdout added to context before prompt processing
Actual: Hook runs, outputs to stdout, but LLM never receives it
Evidence
Debug logging proves hook execution:
[2025-11-15 16:16:05.140072] UserPromptSubmit hook executed
[2025-11-15 16:16:05.140387] Output: ⏰ 2025-11-15 16:16:05
[2025-11-15 16:21:56.081558] UserPromptSubmit hook executed
[2025-11-15 16:21:56.081900] Output: ⏰ 2025-11-15 16:21:56
- ✅ Hook executes on every prompt
- ✅ Generates correct stdout
- ✅ Exit code 0
- ❌ LLM context doesn't contain the output
Reproduction
1. Create hook script (~/.factory/hooks/timestamp.py):
#!/usr/bin/env python3
from datetime import datetime
from zoneinfo import ZoneInfo
tz = ZoneInfo('Europe/Bratislava')
timestamp = datetime.now(tz).strftime('%Y-%m-%d %H:%M:%S')
print(f"⏰ {timestamp}") # stdout per docs
exit(0)chmod +x ~/.factory/hooks/timestamp.py2. Configure hook (~/.factory/settings.json):
{
"enableHooks": true,
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "~/.factory/hooks/timestamp.py"
}
]
}
]
}
}3. Restart DROID, send any prompt
Result: LLM response contains no timestamp. Hook output invisible to LLM.
Tested Approaches (All Failed)
- Bash echo:
echo "⏰ $(date '+%Y-%m-%d %H:%M:%S')" - Python JSON:
{"hookSpecificOutput": {"additionalContext": "..."}} - Python plain stdout:
print(f"⏰ {timestamp}")(per docs example)
All execute successfully (verified via debug logging), but none inject stdout into context.
Environment
- DROID CLI: v0.26.1 (Nov 14, 2025)
- OS: Linux (Ubuntu 22.04, Kernel 6.8.0-85-generic)
- Server: Hetzner CX32 VPS (8GB RAM, 4 vCPU)
- Python: 3.12.3
- Settings:
~/.factory/settings.json(user settings)
Notes
- UserPromptSubmit feature added in v0.25.0 (Nov 13) - tested 1 day later
- Use case (timestamp context) is explicitly shown in official docs example
- Current workaround: prompt-based approach (less efficient but functional)
mikez93
Metadata
Metadata
Assignees
Labels
No labels