-
Notifications
You must be signed in to change notification settings - Fork 605
fix(hooks): correct save-nudge timezone parsing and first-observation gating #669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -478,11 +478,14 @@ export const Engram: Plugin = async (ctx) => { | |
| return | ||
| } | ||
|
|
||
| // No observations yet — nothing to nudge about | ||
| if (lastObsEpoch === 0) return | ||
|
|
||
| // Only nudge if last save was more than 15 minutes ago | ||
| if (nowSecs - lastObsEpoch < 900) return | ||
| // No observations exist yet for this project. This is the "never | ||
| // saved" case, not "session just started" (session age was already | ||
| // gated to >= 5 minutes above) — treat it as maximally stale so the | ||
| // nudge can fire and break the cycle where a project with zero | ||
| // observations can never reach its first one. | ||
| // | ||
| // Only nudge if last save was more than 15 minutes ago (or never). | ||
| if (lastObsEpoch !== 0 && nowSecs - lastObsEpoch < 900) return | ||
|
Comment on lines
+481
to
+488
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Distinguish an invalid observation timestamp from no observations.
🤖 Prompt for AI Agents |
||
|
|
||
| // Append the nudge to the last system message | ||
| const nudge = | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift
Move save-nudge eligibility into the core Go API/tool.
The adapters independently decide first-save staleness and reminder eligibility. Put this policy in the core so all integrations consume one result and cannot drift.
plugin/claude-code/scripts/user-prompt-submit.sh#L246-L262: replace the local sentinel/elapsed decision with a core eligibility call.plugin/codex/scripts/user-prompt-submit.sh#L177-L193: replace the duplicate local eligibility decision with the same core call.plugin/opencode/engram.ts#L481-L488: consume the core eligibility result instead of evaluating observation age locally.As per path instructions, adapters stay thin: parse input, call the core Go API/tool, return.
📍 Affects 3 files
plugin/claude-code/scripts/user-prompt-submit.sh#L246-L262(this comment)plugin/codex/scripts/user-prompt-submit.sh#L177-L193plugin/opencode/engram.ts#L481-L488🤖 Prompt for AI Agents
Source: Path instructions