feat: native compaction, auto candidate generation, lesson auto-promotion + Hermes integration - #57
Merged
Merged
Conversation
Captures transport pipe name, hook wire-format mappings for all 10 lifecycle events, and the native tool catalog surface. This is the behavioral invariant the HostProfile seam must preserve. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Introduce src/native-host-profile.ts and thread an optional HostProfile (default CODEX_HOST_PROFILE) through the hook relay, native runtime, and lifecycle hooks. All host-specific strings (pipe prefix, default session id, agent/message ids, host label, restart message) now flow through the profile with no `if (host)` branches in the internals. Codex behavior is unchanged: the default profile carries the exact prior strings; golden + parity suites stay green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extract runNativeMcpServer(profile) and runNativeHookClient(profile) as the single implementation of the stdio MCP server and lifecycle hook client. Codex and Claude entrypoints are thin wrappers passing their HostProfile. Add claude-hook-relay convenience wrappers. Codex stdio behavior is byte-identical (stdio + golden suites green); the Claude server boots with a distinct named pipe and Claude-labeled initialize instructions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
plugins/cross-session-memory/ ships the Claude-native runtime bundle: .claude-plugin/plugin.json manifest, .mcp.json (full CSM tool surface via launch-mcp -> claude-mcp-server), hooks.json wiring all 10 lifecycle events to run-hook -> claude-hook-client, and dev/packaged resolution in both launch scripts. Verified end-to-end: SessionStart through the bundle reaches the live Claude-profile relay and injects real CSM continuity as Claude-format additionalContext, on a pipe distinct from the Codex bundle. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
surface-catalog.json is the single source of truth for the Claude plugin surface; every command/agent/skill orchestrates the authoritative MCP catalog (MCP stays the sole tool authority). scripts/validate-claude-surface.mjs enforces agreement between the catalog, on-disk bundle files, and the live MCP tool set (missing/undocumented/duplicate/tool-drift/unavailable-tool/ missing-bundle-file detection). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add staging build (build-claude-plugin.mjs), Windows release builder, and a clean-room verifier that extracts the ZIP and boots ONLY the packaged bundle — no repo sources, no host binary — asserting 82 served tools, a live SQLite connection, and a native write/read round-trip. Register the cross-session-memory plugin in the local marketplace and add plugin:*:claude npm scripts. Claude Code installs natively via /plugin, so no install.ps1 is shipped. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add plugin parity, transport isolation, surface-catalog (positive + negative drift detection via --plugin-root), and hook-client safety (malformed/empty/oversized input, relay unreachable) suites. All green; Codex parity suites unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add CLAUDE_INSTALLATION.md and CLAUDE_PLUGIN_PORTABLE_RELEASE.md; link them from the README nav and quick-start, update the host row, and record the milestone in AGENTS.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
codex-hook-output.ts, codex-native-tool-catalog.ts, and codex-transcript-client.ts were untracked; config.ts was modified but unstaged. All four are imported by the committed native-mcp-server.ts, codex-native-runtime.ts, and native-hook-client.ts — their absence broke typecheck in CI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… from branch The branch's committed code (native-mcp-server, codex-native-runtime, package.json files array, release-boundary test) references source modules, skills, hooks, scripts, docs, and test updates from the Codex native plugin and Phase 9C compaction work that existed locally but were never staged. Adds: skills/, hooks/, scripts/run-hook.mjs, build/release/verify scripts, release-assets/, Codex bridge plugin wiring, compaction attribution migration, and all modified source/test/doc files that CI depends on. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
README.md links to docs/CLAUDE_INSTALLATION.md and docs/CLAUDE_PLUGIN_PORTABLE_RELEASE.md but they were missing from the package files list, failing the release-boundary test. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…on, and Hermes host integration
Four pipeline fixes that unblock the CSM compounding loop:
1. Native runtime compaction (Claude/Codex/Hermes):
- Extract shared compaction pipeline into messages-transform-pipeline.ts
- Add native-compaction.ts entry point (runtimeKind: 'native_hook')
- Buffer tool calls per-session in CodexNativeRuntime, flush+compact at Stop
- Wire postTool→buffer, Stop→drain+runNativeCompaction in codex-native-hooks
2. Auto-scheduled memory candidate generation:
- Add MemoryMaintenanceConfig + 4th LifecycleOrchestrator job
- CandidateGenerator.generate() now runs every 5 min (configurable via env)
3. Lesson auto-promotion with strict gates:
- New lesson-auto-promotion.ts: promote_to_lesson candidates with
≥10 recalls + ≥2 sessions + content quality + dedup → lesson memories
- Wired into memory-maintenance lifecycle job
- Noise filter rejects file-change, loop-detection, and tool-usage patterns
4. Hermes Agent host integration:
- hermes-hook-mapping.ts: event mapping, payload translation, response shaping
- hermes-hook-client.ts: stdin/stdout I/O shell for Hermes shell hooks
- hermes-mcp-server.ts: MCP server entry point for Hermes profile
- HostProfile seam: HERMES_HOST_PROFILE for shared relay/runtime
Also fixes: recall-quality SQL bug (0AND concatenation), exports
CompactableMessage from context-compactor.ts for pipeline reuse.
Verification: typecheck 0 errors, lint 7 warnings (baseline), 55/55
relevant tests pass (1 pre-existing failure in compaction-safety unchanged).
…xpansion vuln - Remove 6 stale .tmp/ report files accidentally committed - Add .hermes/ to .gitignore (Hermes session artifacts) - npm audit fix: brace-expansion DoS (high → 0 vulnerabilities) - Delete 5 stale local branches (backups, snapshots, merged work)
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
Four pipeline fixes that unblock the CSM compounding loop for all agents (Hermes, Codex, Claude Code).
1. Native Runtime Compaction
messages-transform-pipeline.tsnative-compaction.tsentry point (runtimeKind: native_hook)Stopevent2. Auto-Scheduled Memory Candidate Generation
MemoryMaintenanceConfig+ 4thLifecycleOrchestratorjobCSM_MEMORY_MAINTENANCE_*env vars)3. Lesson Auto-Promotion (strict gates)
lesson-auto-promotion.ts: promotes candidates into lesson memories4. Hermes Agent Host Integration
hermes-hook-mapping.ts,hermes-hook-client.ts,hermes-mcp-server.tsHERMES_HOST_PROFILEadded to theHostProfileseamAlso Fixed
0ANDconcatenation)brace-expansionDoS vulnerability.tmp/artifacts, gitignored.hermes/Verification