claudecode

package
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package claudecode captures Claude Code activity through its command hooks.

Claude Code runs each configured hook command with a JSON description of the event on stdin (session_id, cwd, hook_event_name, plus event fields). `memspace hook claude` normalizes that into MemSpace events, spools them, and returns immediately; uploading happens in a detached sync process.

Index

Constants

View Source
const AgentType = "claude-code"

AgentType is the agent_type stored on sessions.

View Source
const ProjectDirEnv = "CLAUDE_PROJECT_DIR"

ProjectDirEnv is set by Claude Code for hook commands: the directory the session was started in. DSH's hook bridge sets it too.

Variables

This section is empty.

Functions

func ProjectDir

func ProjectDir(cwd string) string

ProjectDir is the directory that identifies the session's project: the one the session was started in, not the hook's cwd, which follows the agent's cd and can be a subagent's temporary directory.

Types

type Adapter

type Adapter struct {
	// ConfigDir overrides the Claude config dir (default $CLAUDE_CONFIG_DIR or ~/.claude).
	ConfigDir string
}

Adapter implements adapter.Adapter for Claude Code.

func (*Adapter) Capabilities

func (a *Adapter) Capabilities() []string

func (*Adapter) Detect

func (a *Adapter) Detect(ctx context.Context) adapter.Detection

func (*Adapter) Doctor

func (a *Adapter) Doctor(ctx context.Context, opts adapter.InstallOptions) []adapter.Check

func (*Adapter) Install

func (a *Adapter) Install(ctx context.Context, opts adapter.InstallOptions) error

func (*Adapter) MCPCheck

func (a *Adapter) MCPCheck(ctx context.Context) adapter.Check

MCPCheck asks Claude Code itself whether it can connect.

func (*Adapter) Name

func (a *Adapter) Name() string

func (*Adapter) Normalize

func (a *Adapter) Normalize(raw []byte, now time.Time) ([]spool.Record, error)

Normalize maps one hook invocation to MemSpace events. Unknown or uninteresting hook events yield no events.

func (*Adapter) RegisterMCP

func (a *Adapter) RegisterMCP(ctx context.Context, opts adapter.MCPOptions) error

RegisterMCP adds MemSpace as a user-scoped stdio MCP server running the bridge (`memspace mcp stdio`), which reads this device's credentials itself, so Claude Code's configuration never contains the token.

func (*Adapter) SettingsPath

func (a *Adapter) SettingsPath() string

SettingsPath is the user-level settings file hooks are installed into.

func (*Adapter) Uninstall

func (a *Adapter) Uninstall(ctx context.Context, out io.Writer) error

func (*Adapter) UnregisterMCP

func (a *Adapter) UnregisterMCP(ctx context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL