Documentation
¶
Index ¶
- func ClaudeEject(configDir string) []error
- func ClaudeRegisterHooks(configDir string, sel HookSelection) (string, error)
- func ClaudeWriteHook(configDir, filename string, content []byte) (string, error)
- func ClaudeWriteSkill(configDir string) (string, error)
- func Confirm(prompt string, defaultYes bool) bool
- func DetectionLine(detected bool, display, version, path string)
- func EjectMemoryBlock(filePath string) (bool, error)
- func HomeDir() string
- func IsInteractive() bool
- func OpenClawEject(configDir string) []error
- func OpenClawRegisterPlugin(configDir string, sel HookSelection) (string, error)
- func OpenClawWriteHook(configDir string) (string, error)
- func OpenClawWritePlugin(configDir, ver string) (string, error)
- func OpenClawWriteSkill(configDir string) (string, error)
- func PrintPreview(text string)
- func ReadJSONFile(path string) (map[string]interface{}, error)
- func ReadLine(prompt string) string
- func ReadMultiLine(prompt string) string
- func RemoveClaudeHooks(data map[string]interface{})
- func SelectMulti(title string, options []string, defaults []bool) []bool
- func SelectOne(prompt string, options []string, defaultIdx int) int
- func StatusError(step, total int, label string, err error)
- func StatusOK(step, total int, label, detail string)
- func StatusSkipped(step, total int, label, detail string)
- func StatusUpdated(step, total int, label, detail string)
- func WriteJSONFile(path string, data map[string]interface{}) error
- func WriteOrRemoveJSONFile(path string, data map[string]interface{}) error
- func WritePromptFiles() (string, error)
- type Environment
- type HookSelection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClaudeEject ¶
ClaudeEject removes mnemon integration from the given Claude Code config dir.
func ClaudeRegisterHooks ¶
func ClaudeRegisterHooks(configDir string, sel HookSelection) (string, error)
ClaudeRegisterHooks registers selected hooks in settings.json. Prime (SessionStart) is always registered.
func ClaudeWriteHook ¶
ClaudeWriteHook writes a hook script to the hooks dir.
func ClaudeWriteSkill ¶
ClaudeWriteSkill writes the mnemon skill to the config dir.
func DetectionLine ¶
DetectionLine prints a detection result line.
func EjectMemoryBlock ¶
EjectMemoryBlock removes everything between <!-- mnemon:start --> and <!-- mnemon:end --> inclusive. Returns true if the file was modified.
func OpenClawEject ¶
OpenClawEject removes mnemon skill, hook, and plugin from the given OpenClaw config dir.
func OpenClawRegisterPlugin ¶ added in v0.1.1
func OpenClawRegisterPlugin(configDir string, sel HookSelection) (string, error)
OpenClawRegisterPlugin adds the mnemon plugin entry to openclaw.json, recording which optional hooks the user selected.
func OpenClawWriteHook ¶ added in v0.1.1
OpenClawWriteHook writes the mnemon-prime internal hook to the OpenClaw hooks directory.
func OpenClawWritePlugin ¶ added in v0.1.1
OpenClawWritePlugin writes the mnemon plugin to the OpenClaw extensions directory. ver is the mnemon version string (e.g. from ldflags); it replaces the embedded manifest's static version field so the installed plugin always reflects the running binary.
func OpenClawWriteSkill ¶
OpenClawWriteSkill writes the SKILL.md to the OpenClaw skills directory.
func PrintPreview ¶
func PrintPreview(text string)
PrintPreview prints text in dim color with indentation, suitable for showing defaults.
func ReadJSONFile ¶
ReadJSONFile reads a JSON file into a map. Returns empty map if file doesn't exist. Tolerates JSON5-style // line comments and trailing commas.
func ReadMultiLine ¶
ReadMultiLine reads multi-line text input until a blank line or EOF.
func RemoveClaudeHooks ¶
func RemoveClaudeHooks(data map[string]interface{})
RemoveClaudeHooks removes all mnemon-related entries from Claude Code hooks. Cleans up empty hook arrays and the hooks map itself when nothing remains.
func SelectMulti ¶
SelectMulti shows a multi-select prompt with arrow key navigation. Uses raw terminal mode for ↑↓ + space selection when possible, falls back to number-input toggle for non-TTY environments.
func SelectOne ¶
SelectOne shows a single-select prompt with arrow key navigation. Returns the index of the selected option.
func StatusError ¶
StatusError prints a red cross status line.
func StatusSkipped ¶
StatusSkipped prints a dimmed dot status line.
func StatusUpdated ¶
StatusUpdated prints a green checkmark with "updated" note.
func WriteJSONFile ¶
WriteJSONFile writes a map to a JSON file atomically via .tmp + rename.
func WriteOrRemoveJSONFile ¶
WriteOrRemoveJSONFile writes the settings, or removes the file if the map is empty.
func WritePromptFiles ¶
WritePromptFiles writes guide.md and skill.md to ~/.mnemon/prompt/.
Types ¶
type Environment ¶
type Environment struct {
Name string // "claude-code", "openclaw"
Display string // "Claude Code", "OpenClaw"
Detected bool // CLI binary or global config dir found
BinPath string // exec.LookPath result
Installed bool // mnemon integration present at ConfigDir
Version string // CLI version string
ConfigDir string // target config dir (local or global)
}
Environment describes a detected LLM CLI environment.
func DetectEnvironments ¶
func DetectEnvironments(global bool) []Environment
DetectEnvironments probes for all supported LLM CLI environments. When global is false, ConfigDir points to project-local config (.claude/); when true, it points to the user-global config (~/.claude/).
type HookSelection ¶
type HookSelection struct {
Remind bool // UserPromptSubmit — remind agent to evaluate recall/remember
Nudge bool // Stop — remind about memory on session end
Compact bool // PreCompact — save insights before context compaction
}
HookSelection describes which optional hooks to install. Prime is always installed (mandatory).