Skip to content

feat: make CSM a native Claude Code feature — full subsystem surface#57

Open
NovasPlace wants to merge 11 commits into
masterfrom
feat/csm-native-claude
Open

feat: make CSM a native Claude Code feature — full subsystem surface#57
NovasPlace wants to merge 11 commits into
masterfrom
feat/csm-native-claude

Conversation

@NovasPlace

@NovasPlace NovasPlace commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Introduces a HostProfile seam (src/native-host-profile.ts) that parameterizes the shared relay, runtime, hooks, MCP server, and hook client so Codex and Claude reuse one implementation — no if (host) branches, no code duplication
  • Extracts runNativeMcpServer(profile) and runNativeHookClient(profile) as shared runners; Codex and Claude entrypoints are thin wrappers
  • Ships a complete Claude Code plugin at plugins/cross-session-memory/ — manifest, .mcp.json, 10 lifecycle hooks, 12 slash commands, 3 subagents, 3 skills, validated against one authoritative surface-catalog.json
  • Transport isolation via csm-<host>-<sha256(pluginRoot)[:16]> — Codex/Claude and multi-workspace Claude never collide
  • Packaging: plugin:build:claude, plugin:release:claude:windows, and a clean-room release gate that extracts the ZIP and boots only the bundle (82 tools, SQLite connected, native write/read)
  • Codex behavioral parity locked by golden regression tests captured before the seam

Test plan

  • test/codex-native-golden.test.ts — pipe name, wire format, tool catalog frozen before seam, green after
  • test/claude-native-plugin.test.ts — profile values, distinct pipe, manifest wiring, MCP config, lifecycle events
  • test/claude-transport-isolation.test.ts — Codex/Claude distinct pipes, multi-workspace, deterministic, case-insensitive
  • test/claude-surface-catalog.test.ts — positive (shipped bundle passes) + negative (missing/undocumented detected)
  • test/claude-hook-safety.test.ts — malformed JSON, empty input, oversized payload, relay unreachable → safe JSON, exit 0
  • typecheck, build, lint:src (0 errors, 7-warning baseline unchanged)
  • 29/29 key suites green; full suite 1787/1846 (16 failures are pre-existing parallel DB races, not regressions)

52 files changed, +2,462 / −153

🤖 Generated with Claude Code

NovasPlace and others added 8 commits July 22, 2026 20:34
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>
@NovasPlace NovasPlace changed the title Feat/csm native claude feat: make CSM a native Claude Code feature — full subsystem surface Jul 23, 2026
NovasPlace and others added 3 commits July 22, 2026 22:30
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>
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