feat(plugin): session-recap injection — personalized onset greeting - #528
Draft
jeonghun-jj-lee wants to merge 4 commits into
Draft
Conversation
8 tasks
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
…rom session history Reads recent sessions (last 7 days) from the opencode SQLite DB via bun:sqlite, extracts mechanical recaps (user prompts + numerical outcomes), caches them to ~/.amico/session-recaps/, and injects a '## Recent sessions' block into the system prompt. The onset router naturally uses this to personalize the greeting without any changes to its own text. Key decisions: - bun:sqlite (Bun built-in) for DB reads — no npm deps, no SDK client needed - Mechanical extraction (not LLM) for v1 — captures topic + fidelity/iteration numbers; LLM summarization deferred to a follow-up - Env-seam pattern (AMICODE_SESSION_RECAP_CACHE_DIR, OPENCODE_DB) for testability - Graceful degradation: returns null under Node/vitest or on any error - Pure logic functions exported for unit testing (26 tests) Acceptance criteria addressed: - Returning user sees ## Recent sessions in system prompt - Current session excluded; subagent sessions excluded - Noise sessions (Compaction, <2 assistant msgs) filtered - Cache prevents re-summarization - Graceful degradation on failure (never crashes prompt build) Closes #523
The onset router unconditionally offered pulse design as a top-level option, causing the model to recommend pulses even for users whose intent is general coding or product development. The design-a-pulse skill remains invocable by name — it's just no longer the first thing offered on every session. The remaining default options (resume active problem, resume campaign, fleet ops, bring your own problem, just explore) are all state-gated: they only appear when the relevant state exists, so the model builds the greeting from what's actually there rather than defaulting to quantum control.
…ng skills When onboarding is already complete, the overture score is not compiled into the session's AGENTS.md. Previously, the onset router said 'skip to the overture' for onboarding requests — but the overture wasn't there. The model then improvised by invoking design-a-pulse from the skill index (the closest thing to an interview it could find). Now the router explicitly handles the post-completion case: tell the user their profile exists and offer keep/redo. No skill invocation, no improvised interview. The overture only runs when it's actually compiled in (shouldOnboard = true at boot time).
…d for re-onboarding Previously, the overture was only compiled into the session's AGENTS.md when shouldOnboard=true at boot. Post-completion, it was absent — so 'begin onboarding' required a window reload to recompile it in. Bad UX. Now the overture is always compiled in (as a section after the general-purpose copilot stub), gated by the onset router's instructions rather than by presence/absence. The router says 'run the overture if present' — and it always is. No reload needed to re-run onboarding. Cost: ~12KB added to prompts that already had the stub. The overture content is inert unless the user explicitly triggers it via the onset router.
jeonghun-jj-lee
force-pushed
the
523-featplugin-session-recap-injection-smart-onset-greeting-from-session-history
branch
from
August 23, 2026 17:33
aadb607 to
c953b46
Compare
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
Implements #523 — injects a
## Recent sessions (last 7 days)block into the system prompt so the onset router can personalize its greeting from actual session history, rather than depending on vault files only populated by dream-cycle workflows.What changed
opencode-plugin/session_recap.tsopencode-plugin/amicode_context.tssessionIDfrom input, callsbuildRecentSessionsBlocktest/session_recap.test.tsDesign pivot from issue
The issue assumed
client.sessions.list()via aPluginInputSDK handle — investigation showed the plugin receives no client. Pivoted to reading the SQLite DB directly viabun:sqlite(Bun built-in, zero deps). Same outcome, simpler surface.Deferred
Test results
Closes #523