When hooks are installed via uncompact install, two hooks are registered:
- Stop →
uncompact run (outputs context bomb to stdout)
- UserPromptSubmit →
uncompact show-cache (reads ${TMPDIR}/uncompact-display-{uid}.txt)
However, cmd/run.go only writes to stdout — it never writes to the display cache temp file. That file is exclusively populated by scripts/uncompact-hook.sh (the Claude plugin approach).
The result: every user of uncompact install has a permanently no-op UserPromptSubmit hook. The temp file never exists, so show-cache exits silently on every prompt. The hook wastes the slot and makes debugging confusing.
Root Cause
scripts/uncompact-hook.sh captures uncompact run output and writes it to the display cache atomically (mktemp + mv). The Go run command was never updated to do the same.
Fix
At the end of runHandler in cmd/run.go, after fmt.Print(output) (line 181), write output to the display cache file using the same UID-based path and a secure atomic write (CreateTemp + Rename):
func writeDisplayCache(content string) error {
uid := os.Getuid()
var id string
if uid == -1 {
if u, err := user.Current(); err == nil {
id = u.Username
} else {
id = "windows"
}
} else {
id = fmt.Sprintf("%d", uid)
}
cachePath := filepath.Join(os.TempDir(), fmt.Sprintf("uncompact-display-%s.txt", id))
tmp, err := os.CreateTemp(filepath.Dir(cachePath), "uncompact-display-*.tmp")
if err != nil {
return err
}
if _, err := tmp.WriteString(content); err != nil {
tmp.Close()
os.Remove(tmp.Name())
return err
}
tmp.Close()
return os.Rename(tmp.Name(), cachePath)
}
The UID/path logic is already present in cmd/showcache.go and should be extracted into a shared helper to avoid drift.
Files
cmd/run.go line 181 — add display cache write after stdout emit
cmd/showcache.go — extract cache path helper shared with run.go
@claude please implement this