Skip to content

feat: durable repo-local checkpoint memory (.hacb) - #11

Open
Shifat7 wants to merge 1 commit into
clutchpbcfo:mainfrom
Shifat7:pr-04-checkpoint-memory
Open

Shifat7 wants to merge 1 commit into
clutchpbcfo:mainfrom
Shifat7:pr-04-checkpoint-memory

Conversation

@Shifat7

@Shifat7 Shifat7 commented Aug 22, 2026

Copy link
Copy Markdown

What changed

Approximates "compact chat" without spending Hyperagent credits on summaries: the bridge injects a bounded checkpoint from repo-local .hacb/ files into the relay payload (before conversation), so long sessions can drop old turns instead of re-sending them.

  • src/checkpoint.mjsloadCheckpoint(config, reader?): reads only exact configured filenames inside checkpointDir, skips missing files, rejects path traversal, caps combined content at maxCheckpointChars with an explicit truncation marker. Reader injectable for tests.
  • protocol.mjsbuildRelayPrompt(...) gains an optional 5th checkpoint param emitted as a project_checkpoint payload key placed before conversation.
  • bridge.mjs — loads the checkpoint per request via an injectable loader; disabled entirely when enableCheckpointMemory: false (zero filesystem access).
  • .hacb/ added to .gitignore.

Config defaults: enableCheckpointMemory: true, checkpointDir: '.hacb', four standard files, maxCheckpointChars: 4000. No Hyperagent calls are ever spent generating checkpoints — Codex maintains them through its normal local file tools.

Why it saves credits

Durable local memory replaces long chat history: old turns can be dropped while task state survives.

Testing

npm test: 81 pass, 0 fail. New tests cover labelled multi-file loading, capping, traversal rejection, disabled-means-no-I/O, payload ordering before conversation, and old-turn dropping with the checkpoint retained.

Load bounded .hacb/CODEX_STATE-style checkpoints and inject them into
the relay payload ahead of the conversation so long sessions can rely
on cheap repo-local state instead of huge chat history. Only exact
configured filenames inside checkpointDir are read; traversal entries
are ignored; missing files are skipped; content is capped at
maxCheckpointChars with an explicit truncation marker.

Defaults: on, .hacb directory, four standard checkpoint files, 4,000
chars. enableCheckpointMemory false disables all filesystem access.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant