Reply gate: cadence + relationship signals into the decision#12
Open
sanctrl wants to merge 1 commit into
Open
Conversation
Wire two deterministic, derived-not-fetched signals into the gate input so
the decision sees the loop's tempo and the conversation's footing — not just
the recent transcript.
- ConversationSignals + compute_conversation_signals (reply_gate): pure and
defensive (malformed / naive / future timestamps handled), computed from the
messages already fetched for history — no extra round-trip.
* cadence — messages in the last 60s + gap to the previous message; the
loop is a tempo phenomenon and the gate was previously blind to it.
* relationship — first-contact vs established vs not-yet-replied, derived
from the recent window.
- build_decision_messages renders compact Relationship + Pace lines; the
system prompt ties rapid back-and-forth to the no_reply bias.
- agent_invoker: _build_conversation_history returns (history, raw_messages)
from one fetch; _decide_reply derives signals and passes them through.
- tests: signals computation (window, gap, trigger exclusion, defensive
parsing) + rendering; wiring tests updated for the new return shape.
All deterministic, edge-derived — nothing new asked of the server. No version
bump (still the unreleased 0.2.3 reply-gate change).
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.
Follow-up to #10 (the reply gate, now on
main). Wires two deterministic, derived-not-fetched signals into the gate's decision input so it sees the loop's tempo and the conversation's footing — not just the recent transcript.What
created_aton the messages already fetched for history (no extra round-trip).Both render as compact phrases in the decision prompt (
Relationship: …/Pace: …), never raw dumps. The system prompt now ties rapid back-and-forth to theno_replybias.How
ConversationSignals+compute_conversation_signals(reply_gate): pure and defensive (malformed / naive / future timestamps handled), no network call.agent_invoker._build_conversation_historyreturns(history, raw_messages)from one fetch;_decide_replyderives the signals and passes them through.Tested
ruff + mypy + pytest all green. New coverage: signals computation (cadence window, gap, trigger exclusion, defensive timestamp parsing) + prompt rendering; existing wiring tests updated for the
(history, raw_messages)shape. 368 passed, 10 skipped.No version bump — this folds into the unreleased 0.2.3 reply-gate line.