Documentation
¶
Overview ¶
Package anthropicmemory exposes Traceary's local backend for Anthropic's native beta memory tool.
Index ¶
- Variables
- func DecodeInput(data json.RawMessage) (anthropic.BetaMemoryTool20250818CommandUnion, error)
- func Tool() anthropic.BetaToolUnionParam
- type Handler
- func (h *Handler) Handle(ctx context.Context, input anthropic.BetaMemoryTool20250818CommandUnion) (anthropic.BetaToolResultBlockParamContentUnion, error)
- func (h *Handler) HandleText(ctx context.Context, input anthropic.BetaMemoryTool20250818CommandUnion) (string, error)
- func (h *Handler) HandleToolUse(ctx context.Context, toolUseID string, ...) (anthropic.BetaToolResultBlockParam, error)
Constants ¶
This section is empty.
Variables ¶
var ToolName = string(anthropic.BetaMemoryTool20250818Param{}.Name.Default())
ToolName is the Anthropic built-in memory tool name.
var ToolVersion = string(anthropic.BetaMemoryTool20250818Param{}.Type.Default())
ToolVersion is the Anthropic memory-tool version Traceary implements.
Do not auto-bump this value when Anthropic ships a newer beta version. Review the command schema, return strings, and storage semantics manually before adding another handler version. The value is read from the SDK's generated constant type default so compile-time drift is visible when the SDK changes.
Functions ¶
func DecodeInput ¶
func DecodeInput(data json.RawMessage) (anthropic.BetaMemoryTool20250818CommandUnion, error)
DecodeInput decodes a raw tool_use input payload into the pinned SDK command union. It is useful because response tool_use blocks expose Input as raw JSON.
func Tool ¶
func Tool() anthropic.BetaToolUnionParam
Tool returns the pinned Anthropic beta memory-tool definition.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler executes Anthropic memory-tool commands against Traceary storage.
func NewHandler ¶
func NewHandler(memoryTool usecase.MemoryToolUsecase) (*Handler, error)
NewHandler wraps an existing MemoryToolUsecase.
func NewHandlerWithRepository ¶
func NewHandlerWithRepository(repository model.MemoryToolFileRepository, clock types.Clock) (*Handler, error)
NewHandlerWithRepository creates a Handler from a memory-tool repository.
func NewSQLiteHandler ¶
NewSQLiteHandler creates a Handler backed by Traceary's SQLite store.
The caller owns Database construction, including the migration filesystem and DB path policy. This constructor initializes the store before wrapping the memory-tool datasource so fresh database files have the memory_tool_files table before the first command executes.
func (*Handler) Handle ¶
func (h *Handler) Handle( ctx context.Context, input anthropic.BetaMemoryTool20250818CommandUnion, ) (anthropic.BetaToolResultBlockParamContentUnion, error)
Handle executes a BetaMemoryTool20250818 command and returns tool_result content suitable for anthropic.NewBetaToolResultTextBlockParam or BetaToolResultBlockParam.Content.
func (*Handler) HandleText ¶
func (h *Handler) HandleText(ctx context.Context, input anthropic.BetaMemoryTool20250818CommandUnion) (string, error)
HandleText executes a BetaMemoryTool20250818 command and returns the raw text that should be sent back in a tool_result block.
func (*Handler) HandleToolUse ¶
func (h *Handler) HandleToolUse( ctx context.Context, toolUseID string, input anthropic.BetaMemoryTool20250818CommandUnion, ) (anthropic.BetaToolResultBlockParam, error)
HandleToolUse executes a command and wraps its output as a complete tool_result block for the supplied tool_use ID.