Sessions store + resume — disk-backed map and delta-prompt flow #6
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks#6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
User story
As an agent re-dispatched on the same issue or PR, I want to resume my previous Claude Agent SDK session so that I retain the context I built up before, and the dispatcher only needs to send a delta prompt instead of replaying the whole skill template.
Acceptance criteria
Sessions store (
src/sessions.ts)sessionKey(agent, repo, issue_or_pr_number): string— returns e.g."boss:charles/peon:4"(moved frommain.ts)getSession(key): Promise<string | null>— returns the persisted session id, if anysetSession(key, id): Promise<void>— writes through to diskdropSession(key): Promise<boolean>— replaces the main.ts stub; returnstruewhen an entry was removeddropAllForIssue(repo, issue_or_pr_number): Promise<void>— drops every agent's session for that issue~/.local/state/claude-hooks/sessions.json, atomic writes viatmp + renamerunAgentintegration (src/main.ts)sessionKeyat task start (swap the import from./mainto./sessions)getSession(key)returns an id, passresume: idtoquery(); otherwise fresh sessionsetSession(key, id)query()throws because the resumed session expired or is unknown, automatically retry once with a fresh session and log a warningcleanup.ts) calldropAllForIssue/resetendpoint inmain.tsswaps its stub call fordropSessionfrom./sessionsSkill prompt: delta vs. full
getSessionreturns null → use the full skill template as today"The reviewer requested changes: <body>. Address them."); do not re-send the full templateskills/directory as a separate file per event type (or as an explicit branch in the skill template); pick one and documentTests (
src/sessions.test.ts)set,get,drop/resettests inmain.test.tsare updated to assert against the realdropSession(drop the "always false" stub expectation)Out of scope
References
session_idmain.tsstubs added in PR #16 (commitc882b6a)Dependencies
main