You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With debug: true, nudge injections are echoed to the TUI via ctx.ui.notify() → pi's showStatus() → a transient dim Text child appended to chatContainer. These echoes are never written to the session log, so:
Every process restart (pi --session <id> resume, agent process restart) runs chatContainer.clear() + rebuildChatFromMessages() (pi interactive-mode.js), wiping the entire injection history from view.
~/.pi/acp.log keeps only the first physical line of each nudge: log.ts:50 formats entries as a single line (`${ts()} [${level}] [${scope}] ${body}\n`), and the multi-line nudge body spills onto subsequent untagged physical lines — so grep nudge-injected shows only the headline ("⚠️ Context limit reached — compress now..."), not the tier/breakdown/ranges that make the entry useful.
Observed impact: in a long-running session with 5 process starts (sid 01a07b3c-ab19-7b19-8290-f7967a8221a6, see #325), the user could not reconstruct which nudges had fired and when — on-screen evidence was gone after each restart, and the log was not grep-able for full nudge content.
Request
Make nudge injections durable and auditable:
Primary: persist a compact nudge record as a session entry on injection (the if (turn.nudge?.shouldInject) block in src/index.ts), surviving restarts and visible in TUI scrollback + session file. Precedent: /acp and /acp-status are already shown as persistent custom messages (commit 0ff701e, issue #255).
Constraints:
Keep the persisted record short (e.g. [ACP nudge] EMERGENCY 95% · T1 · top range m00120–m00168) — the full multi-line nudge text must NOT be added to model context (it would pollute context every turn).
If pi's session-entry mechanism always feeds entries back into model context, prefer a display-only entry type; otherwise gate persistence behind the existing debug flag.
Secondary (small): escape newlines when writing debug events to acp.log (one physical line per entry) so nudge-injected / nudge-suppressed entries are self-contained and grep-able.
Repro / evidence
Any session with debug: true in ~/.pi/acp.json: trigger a nudge (usage above band), observe the on-screen block, restart pi → block gone; grep nudge-injected ~/.pi/acp.log → headline only.
Session sid 01a07b3c-ab19-7b19-8290-f7967a8221a6: 4 emergency injections (acp.log lines 13504-05, 13848-49, 13922-23, 14122) across 5 process starts; none recoverable from TUI or log after restart.
Summary
With
debug: true, nudge injections are echoed to the TUI viactx.ui.notify()→ pi'sshowStatus()→ a transient dimTextchild appended tochatContainer. These echoes are never written to the session log, so:pi --session <id>resume, agent process restart) runschatContainer.clear()+rebuildChatFromMessages()(pi interactive-mode.js), wiping the entire injection history from view.~/.pi/acp.logkeeps only the first physical line of each nudge:log.ts:50formats entries as a single line (`${ts()} [${level}] [${scope}] ${body}\n`), and the multi-line nudge body spills onto subsequent untagged physical lines — sogrep nudge-injectedshows only the headline ("Observed impact: in a long-running session with 5 process starts (sid
01a07b3c-ab19-7b19-8290-f7967a8221a6, see #325), the user could not reconstruct which nudges had fired and when — on-screen evidence was gone after each restart, and the log was not grep-able for full nudge content.Request
Make nudge injections durable and auditable:
Primary: persist a compact nudge record as a session entry on injection (the
if (turn.nudge?.shouldInject)block in src/index.ts), surviving restarts and visible in TUI scrollback + session file. Precedent:/acpand/acp-statusare already shown as persistent custom messages (commit0ff701e, issue #255).Constraints:
[ACP nudge] EMERGENCY 95% · T1 · top range m00120–m00168) — the full multi-line nudge text must NOT be added to model context (it would pollute context every turn).debugflag.Secondary (small): escape newlines when writing debug events to acp.log (one physical line per entry) so
nudge-injected/nudge-suppressedentries are self-contained and grep-able.Repro / evidence
debug: truein~/.pi/acp.json: trigger a nudge (usage above band), observe the on-screen block, restart pi → block gone;grep nudge-injected ~/.pi/acp.log→ headline only.01a07b3c-ab19-7b19-8290-f7967a8221a6: 4 emergency injections (acp.log lines 13504-05, 13848-49, 13922-23, 14122) across 5 process starts; none recoverable from TUI or log after restart.