Repository navigation
v1.91.149.0 feat(task-memory): add optional HydraDB task capture and recall - #3298
Open
SohamRatnaparkhi wants to merge 19 commits into
Open
SohamRatnaparkhi wants to merge 19 commits into
SohamRatnaparkhi wants to merge 19 commits into
Conversation
…dence lib/task-memory/procedure.ts reads the main-thread tool calls of one Claude Code session through the shared owned-journal reader and reduces them to episodes. An episode is verified only when its last change in the repository is followed by a recognized test command whose result carries a complete runner summary with passing tests and no failure. A missing exit status, is_error false alone, masked shell status and the Stop event prove nothing. A later edit, shell write or unknown tool invalidates earlier checks. The rendered Markdown holds a redacted goal line, repository-relative edit targets and literal checks with counts, never tool output or file bodies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m per prompt gstack-task-memory enable turns HydraDB task memory on for one repository. It asks for capture and recall consent separately, takes the API key from HYDRA_DB_API_KEY, a 0600 key file, --key-stdin or a hidden prompt, provisions the database, registers the task-memory-stop-hook and task-memory-prompt-hook at the stable install, and writes the repository grant last with a fresh generation. After Stop, a detached worker re-derives the session's episodes and reconciles them with per-procedure delivery records. Verified procedures go up as type=memory, infer=false Markdown items in a collection derived from the canonical origin; a procedure that a later change invalidates is deleted and excluded from recall locally. On each prompt, the hook queries that collection, admits only chunks whose metadata names this repository, renders them with the SDK buildString and wraps them as untrusted reference. Every request re-checks the grant and writes an egress receipt first; no receipt, no send. disable revokes the repository first and removes the hooks only when no other repository holds a grant. setup's --no-team sweep keeps the hooks, uninstall removes hooks and grants, and gstack-egress grants lists the grant. The native tests drive the real CLI and registered hooks against owned settings, real fixture edits and test runs, and a loopback fake reached through a test-only preload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/task-memory.md covers turning task memory on and off, what each part sends and where receipts are, what counts as a verified task, and status, mode and flush. README gains a bin row and a docs row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Release metadata for HydraDB task memory: VERSION and package.json through gstack-version-bump at the slot gstack-next-version picked, and the CHANGELOG entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…proof A masked, prefixed or subdirectory test run that fails now invalidates an earlier pass, and a later run whose result is missing, interrupted or unreadable leaves the episode unverified. Masked runs still never prove a pass themselves. The shell classifier parses quotes and operators instead of matching prefixes. Background jobs, substitution, subshells, redirection into a file, git --output, snapshot updates and git verbs that change refs or run hooks (commit, remote set-url, branch -D, fetch) count as changes. The task-list tools from the pinned agent SDK count as read-only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ions with HydraDB Capture now only records what each episode admits, under its session lock. A single per-repository owner delivers those admissions and re-reads them after every pass and after releasing its lock, so a Stop that arrives while an upload is in flight is still delivered and an invalidated procedure is still withdrawn. Delivery records keep HydraDB's view of each id: processing, searchable (graph_creation) and settled (completed) are distinct, and an update or a deletion waits until the id is settled, as HydraDB requires. A deletion HydraDB refuses while indexing stays pending and lands on a later pass. Failed indexing, refused keys, a missing database and outages are retried after a back-off on a later Stop from any session, or at once by flush. Only a payload HydraDB rejects as malformed stays rejected, and only for those bytes. Uploads still come only from the current grant; a withdrawal removes an earlier grant's copy when the destination is the same. The memory listing fallback reads user_memories[].memory_id. Consent is read again after the receipt is written, immediately before the request starts. The fake server now answers with the v2 shapes and stages seen on the hosted API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
enable records an operation token under the management lock before it provisions the database, sends only while that token is current, and publishes the grant only if the token is still current under the lock again. disable removes the token with the grant, so an enable that was waiting for the database stops sending and enables nothing. The lock is held only for the two short transitions, never across provisioning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KNOWN_HOOKS rows can now be marked userOptIn, and prune-stale keeps those rows when GSTACK_SWEEP_KEEP_USER_OPT_INS=1. setup --no-team sets the flag on the line before its existing sweep command, which is unchanged. The uninstall sweep does not set it, so uninstall still removes the task-memory hooks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…behave The guide now says which later runs cancel an earlier pass, which shell commands count as changes, what each procedure state in status means, that undelivered work is retried by a later Stop from any session or by flush, and that a withdrawn procedure is hidden locally at once but stays recallable elsewhere until HydraDB accepts its deletion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, as typed Steps now follow native completion order. A check counts only when it started after every earlier change returned; a check that overlapped a change in time is unconfirmed. The shell keeps its directory between Bash calls, so a check that ran after a cd away from the root gets its own identity and no literal, and cannot replace a failure from the root. The stored check is the original source span of the command, and a check that expands a shell variable keeps its outcome but records no literal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sumed absent An upload is recorded as unsure before it is sent, so a lost response or a crash leaves evidence that HydraDB may hold the id. A withdrawn procedure whose upload is unsure is checked by status and deleted when present; it stays retracting until HydraDB reports the id gone or confirms a deletion. An answered refusal restores the earlier known content, and presence alone names content only when one upload could have produced it. Only HydraDB's still-processing refusal is busy. Any other per-item deletion error, including "not found or deletion failed", and a missing status row back off as unavailable instead of being counted as removed or polled ahead of other work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A cd now moves the shell's directory when its result arrives, not when it is invoked. A cd that never returned leaves the directory unknown, and so does one that failed or was interrupted, unless the shell was already at the root and the cd could land nowhere else. A check that overlaps any directory change runs in an unknown directory and records no literal. A check that cds to the root itself keeps its root identity. `builtin cd` and `command cd` move the directory like a bare cd. The docs say retries happen on a later eligible Stop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
This was referenced Oct 19, 2026
Open
This branch has not been deployed
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.
Why
A new coding session often rediscovers a fix that worked before. Give Claude Code repository task history automatically: after a verified edit-and-test turn, store the procedure in HydraDB and recall it when a related prompt arrives.
For example, a recurring parsing bug brings back the files changed and checks that passed in an earlier session, including from another clone of the same repository. The agent can resume with evidence instead of reconstructing the workflow.
What changed
buildStringhelper. Fast is the default; thinking is configurable.Scope
Optional task memory for Claude Code, usable alongside normal GBrain. No extraction-model key is needed. Disable restores the usual prompt flow.
GBrain #6695 adds HydraDB retrieval with graph context over GBrain content. This PR adds the procedural history of earlier work. For a migration, an agent can retrieve dated decisions and their connections from GBrain, then recall the migration files and successful checks from task memory. This supports explaining a change from its source evidence. A complete temporal graph also needs versioned knowledge in GBrain; this PR stores task procedures.
Related gstack setup work: #3192. This PR works independently of both changes.
Blast Radius
The feature registers two owned hooks after explicit opt-in. Setup and teardown preserve other hooks and repositories' grants. Retrieved history is marked as untrusted reference context.
Verification