claude

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package claude is the Claude Code adapter for agent-memory: it bundles a worked SKILL.md (the file teaches Claude Code when and how to call memory.fetch_context / memory.propose_update) and an Install function that materialises that asset under .claude/skills/agent-memory/ either in the current repo or in the user's global Claude Code config.

Future adapters live as sibling packages (internal/adapters/cursor, internal/adapters/codex, ...). Each owns its own embedded assets and exposes the same shape — see docs/patterns/adapter-installation.md.

Index

Constants

View Source
const AdapterName = "claude"

AdapterName is the stable identifier used by `agent-memory install <name>`.

Variables

This section is empty.

Functions

func SkillContent

func SkillContent() []byte

SkillContent returns the embedded SKILL.md bytes verbatim. Exposed for tests and for `agent-memory install claude --print` (future enhancement) so users can preview the asset before writing it.

Types

type Options

type Options struct {
	// Root is the repository root that hosts .claude/skills/. Required
	// when UserGlobal is false; ignored otherwise.
	Root string

	// UserGlobal redirects the install to ~/.claude/skills/ (or the
	// HomeDir override below). The skill is then visible to Claude Code
	// across every project on this machine.
	UserGlobal bool

	// Force overwrites an existing SKILL.md. Without it, Install returns
	// AlreadyInstalled in Result.Skipped and writes nothing.
	Force bool

	// HomeDir overrides os.UserHomeDir() — tests set it so the install
	// lands in t.TempDir() instead of the real home directory.
	HomeDir string
}

Options configures Install.

type Result

type Result struct {
	// Adapter is always AdapterName ("claude"). Included so the CLI layer
	// can render uniform results across multiple adapters one day.
	Adapter string `json:"adapter"`

	// Files lists absolute paths Install wrote. Empty when nothing was
	// written (refused overwrite without Force).
	Files []string `json:"files,omitempty"`

	// Skipped lists absolute paths Install would have written but didn't
	// because the destination already existed and Force was false.
	Skipped []string `json:"skipped,omitempty"`
}

Result reports what Install did.

func Install

func Install(opts Options) (*Result, error)

Install writes the embedded SKILL.md to the chosen skill directory, creating intermediate directories as needed. Existing files are preserved unless Force is set.

Returns a Go error only for filesystem / configuration failures. The "skipped because already present" case is reported through Result, not through error — symmetric with the staging Apply contract so the CLI can render it the same way.

Jump to

Keyboard shortcuts

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