Draft
Conversation
Implements a capability that injects periodic system messages into model conversations to counteract instruction fade-out in long-running agent sessions. Supports static interval-based reminders and dynamic callables, with per-run state isolation via for_run(). Closes #83 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Implements the three audit findings from PR review: - `trigger: Callable[[RunContext], bool] | None` -- when set, the reminder only fires when the predicate returns True (in addition to the interval check) - `max_fires: int | None` -- caps how many times a reminder fires per run, tracked via per-reminder counters reset in `for_run()` - `tag: str | None` -- wraps content in XML tags (e.g. `<system-reminder>content</system-reminder>`) Also adds `render_content()` helper on Reminder and comprehensive tests for each feature individually and in combination. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
Author
Audit vs prior art: SystemRemindersWorth adding now:
Follow-up opportunities:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SystemReminderscapability that injects periodic system messages into model conversations to counteract instruction fade-out in long-running agent sessionsReminder(content, interval)for fixed-interval injection and dynamic callables(RunContext) -> str | Nonefor conditional injectionfor_run()ensures concurrent runs don't interfereCloses #83
Implementation
SystemReminderssubclassesAbstractCapabilityand uses thebefore_model_requesthookinterval)strto inject orNoneto skipSystemPromptPartentries appended to the lastModelRequestin message historyfor_run()returns a fresh instance with reset request counter for per-run isolationTest plan
Remindervalidation (interval >= 1)SystemRemindersrequires at least one reminderfor_run()returns fresh instance with reset counterRunContextModelRequest, preserves existing parts, skipsModelResponsemessagesModelRequestwhen none exists🤖 Generated with Claude Code