Skip to content

feat(zcode): add Hindsight long-term memory integration for ZCode#2549

Open
benfrank241 wants to merge 3 commits into
mainfrom
feat/zcode-integration
Open

feat(zcode): add Hindsight long-term memory integration for ZCode#2549
benfrank241 wants to merge 3 commits into
mainfrom
feat/zcode-integration

Conversation

@benfrank241

Copy link
Copy Markdown
Member

What

Adds a hooks-based, no-MCP integration for ZCode — Z.ai's GLM desktop coding agent.

ZCode embeds the Claude Code agent runtime and reads the standard Claude Code hook schema from its own config namespace (~/.zcode/cli/config.json). So hindsight-zcode install wires three process hooks — SessionStart, UserPromptSubmit (recall), and Stop (retain) — with hooks.enabled: true, without touching the user's ~/.claude config and without running an MCP server.

  • Recall injects relevant memories as additionalContext before each prompt.
  • Retain assembles each turn from the prompt (captured at UserPromptSubmit) and the response (Stop payload) and stores it to Hindsight. ZCode has no SessionEnd event, so retention rides Stop.

Why the turn is assembled from payloads

ZCode's Stop transcript_path is an ephemeral, assistant-only temp file in a ZCode-specific format. Rather than depend on it, recall stashes the prompt and retain pairs it with the Stop payload's responseText — reliable across ZCode versions.

Verified end-to-end in ZCode 3.2.2

  • Hooks fire in a real ZCode session.
  • Retain persists turns to the cloud bank.
  • Recall injects memory into the agent — confirmed with an isolated test: an unguessable fact seeded only to the Hindsight bank (never in ZCode's native memory) was recalled in a fresh session, with the agent's own reasoning citing "the hindsight memories provided."

Integration checklist

  • ✅ Package + installer (hindsight-zcode install / uninstall)
  • ✅ Tests (95 passing) exercising installer + hook I/O + content parsing
  • ✅ CI job test-zcode-integration + detect-changes filter
  • release-integration.sh VALID_INTEGRATIONS + generate_changelog.py INTEGRATIONS
  • ✅ Docs page (docs-integrations/zcode.md) + gallery entry + icon

🤖 Generated with Claude Code

Adds a hooks-based, no-MCP integration for ZCode (Z.ai's GLM desktop
coding agent). ZCode embeds the Claude Code agent runtime and reads the
standard Claude Code hook schema from its own config namespace
(~/.zcode/cli/config.json), so `hindsight-zcode install` wires three
process hooks — SessionStart, UserPromptSubmit (recall), and Stop
(retain) — without touching the user's ~/.claude config and without an
MCP server.

Recall injects relevant memories as additionalContext before each
prompt; retain assembles each turn from the prompt (captured at
UserPromptSubmit) and the response (Stop payload) and stores it to
Hindsight. Verified end-to-end in ZCode 3.2.2: hooks fire, retain
persists to the cloud bank, and recall injects memory into the agent.

Includes the pip package + installer, hook scripts, tests, CI job,
release-integration wiring, changelog registration, docs page, and
gallery entry.
Publishes the ZCode integration as a hooks-only Claude Code plugin
(hindsight-zcode) in the repo's plugin marketplace, so ZCode users can
install it via 'zcode plugins add-marketplace vectorize-io/hindsight'
without pip and without depending on Z.ai's marketplace.

The plugin reuses the pip package's hook scripts via CLAUDE_PLUGIN_ROOT
(no duplication) — settings.json resolves as a sibling of scripts/ in
both the pip and plugin layouts. Adds a plugin manifest, plugin-format
hooks.json (SessionStart/UserPromptSubmit/Stop — no SessionEnd),
marketplace entry, validation tests, and docs.
…r release)

The /changelog/integrations/zcode page is generated at release time, so
linking to it broke the Docusaurus build (build-docs + verify-generated-files).
Most unreleased integration pages omit this link; follow that convention.
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