Add gstack adapter: one command to make gstack memory native to Dhee#26
Merged
Ashish-dwi99 merged 3 commits intomainfrom Apr 21, 2026
Merged
Add gstack adapter: one command to make gstack memory native to Dhee#26Ashish-dwi99 merged 3 commits intomainfrom
Ashish-dwi99 merged 3 commits intomainfrom
Conversation
Pure parsers for gstack's four memory surfaces (learnings.jsonl, timeline.jsonl, <branch>-reviews.jsonl, checkpoints/*.md) plus a sealed fixture that seeds a realistic projects/<slug>/ tree and 7 deterministic tests exercising backfill, tail-ingest, idempotency, checkpoint sectioning, uninstall, graceful skip when gstack is absent, and injection-safe refusal. Parsers reuse gstack's own prompt-injection denylist so we never ingest what gstack itself would reject, and preserve unknown fields on a `raw` passthrough so future schema drift doesn't silently discard data. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
dhee/adapters/gstack.py is the read-only ingestor that turns gstack's siloed ~/.gstack/projects/<slug>/ memory into atoms on Dhee's `remember` pipeline. Per-project cursor manifest at $DHEE_DATA_DIR/gstack_manifest.json (byte offsets for JSONL, mtime+size for markdown) makes backfill and tail-ingest idempotent, handles truncation/partial-write cases, and never mutates gstack files. dhee/harness/install.py grows `_install_gstack` / `_disable_gstack` / `_status_gstack` mirroring the existing Claude Code + Codex pattern. Feature-detected: a missing ~/.claude/skills/gstack/VERSION yields a clean "skipped" result and leaves the config flag off. dhee/hooks/claude_code/__main__.py calls tail_ingest() on SessionStart and Stop — no-op unless the user has explicitly run `dhee install gstack`. Errors are swallowed end-to-end; session hooks never block. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
CLI surface: - `dhee install gstack` (positional shortcut) and `dhee install --harness gstack` both reach `_install_gstack`. - `dhee harness [status|enable|disable] --harness gstack` accepts the new target alongside claude_code and codex. - `dhee adapters gstack [status|reingest|clear]` exposes ad-hoc inspection and refresh without re-running the full install command. Docs: docs/adapters/gstack.md maps the six gstack memory failure modes (substring-only search, no consolidation, no correction, ls -t checkpoint rehydration, no code world-model, honor-system project scoping) onto the existing Dhee components that fix each one. README: one short section under the harness install block pointing at the new command and the adapter doc. CHANGELOG: v5.1.0 entry. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
dhee install gstackingests gstack's siloed~/.gstack/projects/<slug>/memory into Dhee's existingrememberpipeline — mirrors the Claude Code + Codex harness install pattern.$GSTACK_HOME. Injection-safe (runs gstack's own denylist before writing).SessionStart+Stop) calltail_ingest()automatically, but only when the user has explicitly rundhee install gstack.Why
gstack is a 79k-star Claude Code skill pack. Its memory layer works fine at a 3-month horizon but breaks on six axes over years:
dhee/memory/search_pipeline.py+dhee/memory/reranker.pydhee/core/engram.py+ write pipelinedhee/core/conflict.py+dhee/core/forgetting.pyls -t | head -3dhee/memory/episodic.py+ retrieval helpersdhee/hooks/claude_code/ingest.pydhee/memory/projects.pyDhee already has every fix. The adapter just wires gstack's on-disk files into the pipeline — no reimplementation of BM25, consolidation, or correction.
What's in the three commits
7d1d9e3—dhee/adapters/gstack_parser.py(pure parsers) + 7-test suite + seeded fixture.443f396—dhee/adapters/gstack.py(adapter core),dhee/harness/install.py(install/disable/status),dhee/hooks/claude_code/__main__.py(session-hook tail_ingest).a86e59a—dhee install gstackCLI,dhee adapters gstack [status|reingest|clear],--harness gstackon install/harness commands, docs, CHANGELOG v5.1.0.Behavioral contract
$DHEE_DATA_DIR/gstack_manifest.jsontracks per-project JSONL byte offsets + markdown mtime/size.~/.claude/skills/gstack/VERSION→ clean "skipped" result, config flag stays off.~/.gstack/intact.$GSTACK_HOME.remember.Test plan
pytest tests/test_gstack_adapter.py— 7 passed (backfill, tail, idempotent, checkpoint sections, uninstall, no-install-graceful, injection-safe).pytest tests/— 1177 passed, 6 skipped. Two failures intest_mcp_artifact_tools.pyare pre-existing onmainand unrelated.dhee install gstackon a host with no gstack → "skipped". Seeded fixture →dhee adapters gstack reingest --reset --jsonreports 11 atoms (2 learnings, 3 timeline, 2 reviews, 4 checkpoint sections).🤖 Generated with Claude Code