Long-term persistence: a 20-line hook for memory-brain integrations#1126
Open
Ashish-dwi99 wants to merge 1 commit intogarrytan:mainfrom
Open
Long-term persistence: a 20-line hook for memory-brain integrations#1126Ashish-dwi99 wants to merge 1 commit intogarrytan:mainfrom
Ashish-dwi99 wants to merge 1 commit intogarrytan:mainfrom
Conversation
Adds three optional, non-blocking, non-fatal filesystem hooks that fire after gstack writes a learning, timeline event, or checkpoint: ~/.gstack/hooks/on-learning-written ~/.gstack/hooks/on-timeline-written ~/.gstack/hooks/on-checkpoint-written If the hook file is missing or not executable, gstack behaves byte-identically to today. Hooks are backgrounded so a slow hook never slows a skill. Exit codes are ignored so a broken hook never breaks a skill. See docs/LONG_TERM_PERSISTENCE.md for the motivation (six concrete substrate leaks at the 1-year and 5-year horizon) and docs/adapters/README.md for the payload spec.
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
Adds an optional, filesystem-based extension point at
~/.gstack/hooks/that lets any memory brain observe gstack's writes (learnings, timeline, checkpoints). Zero dependency on any specific brain. When no hook is installed, gstack behaves byte-identically to today.The contract
Three hooks, all optional:
~/.gstack/hooks/on-learning-written— receives the validated JSON line on stdin afterbin/gstack-learnings-logappends.~/.gstack/hooks/on-timeline-written— same shape forbin/gstack-timeline-log.~/.gstack/hooks/on-checkpoint-written— receives the checkpoint file path on stdin aftercontext-savewrites.Properties:
Why
docs/LONG_TERM_PERSISTENCE.mdnames six concrete spots where gstack's memory substrate leaks at the 1-year and 5-year horizon, each with a file:line citation — substring-only learnings search, no consolidation of near-dup keys, no correction loop,ls -t | head -3checkpoint rehydration, no code world-model, honor-system cross-project trust. They're all fine at month three; they all bite at year five. The hook contract is the smallest change that lets anyone fix retrieval on top of gstack without gstack taking a dependency on any brain.Disclosure
I'm the author of Dhee, which is one reference implementation of this hook contract. The contract itself is provider-neutral and MIT-licensed like the rest of gstack. I wrote the hook because I wanted Dhee to work cleanly with gstack, but the value is in the hook, not in Dhee — a different brain gets the same one-command install.
Files changed
bin/gstack-learnings-log— 5 lines at end of happy pathbin/gstack-timeline-log— 5 lines at end of happy pathcontext-save/SKILL.md.tmpl— bash block + prose foron-checkpoint-writtencontext-save/SKILL.md— regenerated viabun run gen:skill-docs --host alldocs/adapters/README.md— hook payload specdocs/LONG_TERM_PERSISTENCE.md— the motivation essayHappy for this to sit as an artifact
Merge would be great. Not merging is fine too. The hook contract works locally either way because
~/.gstack/hooks/is filesystem-only. The goal is to name the place where gstack memory stops scaling and propose a contract small enough that it costs almost nothing to adopt.