Address the review bot's five genuinely-new findings on the current code: - disposal now discards any still-pending inbox items before the loop exits, so every enqueued id gets a terminal lifecycle event. - injection (next-step/no-wakeup) validates its payload up front, before opening the idle one-shot turn, honoring 'invalid input throws before any append'; and rejects attached contexts (which belong only to inbox messages) rather than silently dropping them. - agentMessage() freezes the agent/inbox/* payload so a listener cannot mutate the shared correlation object mid-dispatch. - refresh the package READMEs (compact, goal, guard, hook-protocol, plan-mode, time-context, workspace-context) that still referenced the removed context/message event, with the source-based user/message distinction. The up-front injection validation makes two finally branches unreachable (v8-ignored as the turn-enclosure backstop). Adds regression tests for disposal discard, context rejection, up-front validation, and the frozen payload; per-file coverage stays 100%.
guard/ — loop-hygiene guard family
Behavioral guard plugins that watch the agent loop for unproductive patterns and nudge the model back on course. A single product package — there is no interface/implementation seam here, because a guard is a self-contained consumer of existing core seams (tools/post-execute, agent/prompt-submit, agent/status), not a swappable capability.
| Package | Role | ctx key |
|---|---|---|
repeat-tool-guard/ |
Advisory reminders when an agent loops on identical tool calls | (listens on ctx.tools' waterfalls) |
Reminders travel as additionalContexts on the tools/post-execute decision; the agent loop appends them as logged context/message events after the step's tool results (see the tools package), so everything a guard says to the model is reconstructable from the session log.