-
Notifications
You must be signed in to change notification settings - Fork 0
Add checkpoint capture: whole-session segmented memories #9
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
Open
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
a855a42
feat: add nextChunk checkpoint decision function
jamby77 325bed1
feat: add checkpoint file read/write with atomic rename
jamby77 9a34e64
feat: add shared transcript line parser and byte-offset reader
jamby77 7e02543
test: cover final-line endByte with no trailing newline
jamby77 2fe703a
feat: add Stop checkpoint hook that queues without summarizing
jamby77 f565b71
fix: flush only the post-checkpoint tail at session end
jamby77 378389c
feat: register the Stop checkpoint hook in all install paths
jamby77 1032670
test: assert checkpoint loop queues distinct segments
jamby77 b732a78
test: exercise the tail-flush path in checkpoint capture
jamby77 1d80bc3
refactor: derive hook registration from a single typed spec
jamby77 1d1068e
fix: chunk the session-end tail instead of capping it once
jamby77 d0310ba
fix: spawn the drain when only Stop queued segments
jamby77 cce235b
fix: identify our hook entries by HOOK_SPECS, not a path substring
jamby77 ef0e300
refactor: derive install-hooks.sh registration from HOOK_SPECS
jamby77 d045272
fix: stop install-hooks.sh clobbering third-party hooks
jamby77 a1be843
Add build:hooks script derived from HOOK_SPECS
jamby77 5181364
fix: resolve the drain next to the running hook binary
jamby77 99342fb
fix: re-queue the whole unprocessed batch when the drain fails
jamby77 c73af27
fix: stream Ollama summaries so idle timeouts cannot kill them
jamby77 1867efa
fix: retry a timed-out summarize once and keep the model warm
jamby77 861e47e
fix: fail fast when Valkey cannot be reached
jamby77 7608ebc
feat: register hooks with explicit timeouts
jamby77 b22d3e5
feat: make Ollama keep_alive configurable, default 5m
jamby77 7bbe861
feat: add macOS compose file without Ollama
jamby77 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,5 +4,6 @@ dist/ | |
| .betterdb_context.md | ||
| .mcp.json | ||
| *.log | ||
| *.bun-build | ||
| bun.lockb | ||
| .idea/ | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| services: | ||
| valkey: | ||
| image: valkey/valkey-bundle:9.1-alpine | ||
| command: | ||
| - valkey-server | ||
| - --dir | ||
| - /data | ||
| - --appendonly | ||
| - "yes" | ||
| - --save | ||
| - "60 1" | ||
| container_name: betterdb-valkey | ||
| ports: | ||
| - "6390:6379" | ||
| volumes: | ||
| - valkey-data:/data | ||
| restart: unless-stopped | ||
|
|
||
| volumes: | ||
| valkey-data: | ||
| name: betterdb-valkey-data | ||
| external: true | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| #!/usr/bin/env bun | ||
|
|
||
| /** | ||
| * Compile each hook entry point in HOOK_SPECS, plus the companion binaries | ||
| * hooks spawn at runtime, to standalone binaries. | ||
| * | ||
| * Usage: | ||
| * bun run scripts/build-hooks.ts | ||
| * | ||
| * Sources live in src/hooks/<spec.source>; binaries are written to | ||
| * dist/hooks/<spec.binary>, the paths install-hooks.sh registers. | ||
| */ | ||
|
|
||
| import { mkdirSync, readdirSync, rmSync } from "node:fs"; | ||
| import { dirname, join, resolve } from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
| import { COMPANION_BINARIES, HOOK_SPECS } from "../src/hook-spec.js"; | ||
|
|
||
| const projectRoot = resolve(dirname(fileURLToPath(import.meta.url)), ".."); | ||
| const hooksDir = join(projectRoot, "src", "hooks"); | ||
| const outDir = join(projectRoot, "dist", "hooks"); | ||
|
|
||
| const OPTIONAL_PROVIDERS = ["openai"]; | ||
|
|
||
| mkdirSync(outDir, { recursive: true }); | ||
|
|
||
| const specs = [...HOOK_SPECS, ...COMPANION_BINARIES]; | ||
|
|
||
| for (const spec of specs) { | ||
| const source = join(hooksDir, spec.source); | ||
| const outfile = join(outDir, spec.binary); | ||
| console.log(`Compiling ${spec.source} → dist/hooks/${spec.binary}`); | ||
| const result = Bun.spawnSync( | ||
| [ | ||
| "bun", | ||
| "build", | ||
| "--compile", | ||
| ...OPTIONAL_PROVIDERS.flatMap((pkg) => ["--external", pkg]), | ||
| source, | ||
| "--outfile", | ||
| outfile, | ||
| ], | ||
| { stdout: "inherit", stderr: "inherit" }, | ||
| ); | ||
| if (!result.success) { | ||
| console.error(`ERROR: failed to compile ${spec.source}`); | ||
| process.exit(1); | ||
| } | ||
| } | ||
|
|
||
| for (const name of readdirSync(projectRoot)) { | ||
| if (name.endsWith(".bun-build")) { | ||
| rmSync(join(projectRoot, name), { force: true }); | ||
| } | ||
| } | ||
|
|
||
| console.log(`Compiled ${specs.length} binaries to dist/hooks/`); |
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
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
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
Oops, something went wrong.
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.
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.
Mac compose volume never created
Medium Severity
valkey-datais markedexternal: true, so Compose will not createbetterdb-valkey-data. The new Mac setup path runsdocker compose -f docker-compose.mac.yml up -dwith no priordocker volume create, so first-time setup fails immediately.Additional Locations (1)
CLAUDE.md#L57-L59Reviewed by Cursor Bugbot for commit 7bbe861. Configure here.