Files
loki/scripts
g-but 14e4a08f7a fix(daemon): inject MANDATORY HANDOFF template once per agent session
execute_inject glued the 20-line handoff block onto every dispatched
prompt. Each Claude turn then tried to write the handoff file, hit the
existing-file guard, and prompted the user "Do you want to overwrite
revamp-it.md?" — surfaced live during cloud-dispatch verification.

Also wasted ~500 input tokens per inject across every project running a
Claude/Cursor/Codex agent.

Gate the append on /tmp/agent-handoff-sent-<tab>. After a successful
inject, touch the sentinel. Clear it everywhere the agent process is
considered fresh:
- close_tab (tab destroyed)
- hard_stop / close_session (lifecycle dispatch)
- launch_agent (explicit launch)
- switch_agent (different agent process)
- auto-launch branch in execute_inject (daemon spun the agent itself)

Net result: first dispatch of each session carries the template; every
subsequent dispatch in the same session is just the user's prompt.
2026-05-31 00:17:33 +02:00
..