Repository navigation
docs(examples): add a runnable persistent memory example - #1938
Merged
Merged
Conversation
examples/memory scripts two sessions with the tokenless mock model - one writes a global fact with the Memory tool into a demo store (demo HOME plus INFER_MEMORY_DIR), the next has the MEMORY.md index injected into its prompt context and reads the fact back, then deletes it, and INFER_MEMORY_ENABLED=false shows the index and the memory-consult and memory-hygiene reminders gone. A demo reminders.yaml lowers the hygiene nudge to once_after 1 turn so a short session can show it firing. README.md shows the on-disk global and per-project layout plus the backend.type git snippet with the exact command. docs/examples.md lists the example and docs/memory.md links to it.
Contributor
|
🎉 This PR is included in version 0.266.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Resolves #1935
Summary
Adds
examples/memory/, a runnable example for persistent memory, and links it from the docs. Two scripted headless sessions with the tokenless mock model show theMemorytool writing a fact in one run and reading it back in the next, with the regeneratedMEMORY.mdindex injected into the session's prompt context (infer debug agent system_prompt), thememory-consultandmemory-hygienereminders firing (and pruned whenINFER_MEMORY_ENABLED=false), andoperation: deleteremoving both the fact-file and its index entry. A demoreminders.yamllowers the hygiene nudge toonce_after: 1so a short scripted session can show it firing. Everything runs offline with the demo HOME and the store pointed into the example directory, so no API key and no real memory are touched.Changes
examples/memory/Taskfile.yml-write,store,recall,reminders,delete,disabled,chat, an end-to-endall, plusbuild/home/clean, running every session against a demo HOME withINFER_MEMORY_DIR(memory.dir) pointed into the example andINFER_MEMORY_BACKEND_TYPE=localpinned inline so an exported CI-agent memory config cannot shadow the example's behaviorexamples/memory/scenarios.yaml- mock scenarios forMemorywrite,readanddeleteplus asay helloprompt for the reminder demosexamples/memory/reminders.yaml- demo entry (merge: true) that replaces thememory-hygienereminder withthreshold: 1, seeded into the demo HOME bytask homeexamples/memory/README.md- what to expect with real captured output, the on-disk layout for global vs per-project facts (type: userglobal, others under the detected project,project: globalororg/repooverrides), and abackend.type: gitsnippet with the exact command to run itdocs/examples.md- lists the new exampledocs/memory.md- links to the walkthrough and adds it under RelatedValidation
task -d examples/memory allruns the whole story end to end on the tokenless mock model -write,store,recall,reminders,delete,disabledeach verified on the CI runner with the demo HOME and store, including a hermeticity fix: the runner exportsINFER_MEMORY_BACKEND_TYPE=gitwith a repo, which silently git-initialized the demo store and left a sibling..memory.sync.lock; the example pins the local backend andtask cleanremoves the locktask precommit:runpasses (mod tidy, mocks, fmt, lint, markdownlint)