nowledgemem

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 13 Imported by: 0

README

Nowledge Mem Go SDK

Go client library for the Nowledge Mem REST API.

Installation

go get github.com/lib-x/nowledgemem-go

Quick Start

package main

import (
    "context"
    "fmt"
    "log"

    mem "github.com/lib-x/nowledgemem-go"
)

func main() {
    // Create client (defaults to http://127.0.0.1:14242)
    client := mem.NewClient()

    // Or with custom base URL
    // client := mem.NewClient(mem.WithBaseURL("http://my-host:14242"))

    ctx := context.Background()

    // Health check
    health, err := client.Health.Check(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Status:", health.Status)

    // List memories
    resp, err := client.Memories.List(ctx, &mem.ListMemoriesParams{
        Limit: 10,
    })
    if err != nil {
        log.Fatal(err)
    }
    for _, m := range resp.Memories {
        fmt.Printf("- %s: %s\n", m.ID, m.Title)
    }

    // Create a memory
    created, err := client.Memories.Create(ctx, &mem.CreateMemoryRequest{
        Content: "This is a test memory",
        Title:   strPtr("Test"),
    })
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Created:", created.Memory.ID)

    // Search memories
    results, err := client.Memories.Search(ctx, &mem.SearchMemoriesRequest{
        Query: "test",
        Limit: 5,
    })
    if err != nil {
        log.Fatal(err)
    }
    for _, r := range results {
        fmt.Printf("- %s (score: %.2f)\n", r.Memory.Title, r.SimilarityScore)
    }

    // List threads
    threads, err := client.Threads.List(ctx, &mem.ListThreadsParams{Limit: 10})
    if err != nil {
        log.Fatal(err)
    }
    for _, t := range threads.Threads {
        fmt.Printf("- %s: %s\n", t.ID, t.Title)
    }

    // Browse Nowledge FS
    entries, err := client.FS.List(ctx, "/", 0, "")
    if err != nil {
        log.Fatal(err)
    }
    for _, e := range entries.Entries {
        fmt.Printf("  %s %s\n", e.Type, e.Name)
    }
}

func strPtr(s string) *string { return &s }

Services

Service Description
client.Memories CRUD, search, bulk operations, favorites, labels
client.Threads Thread management, search, session import
client.Spaces Space profiles and configuration
client.Labels Label CRUD
client.Entities Knowledge graph entities
client.Sources Library sources, ingestion, multipart file/folder upload
client.Health Health check, checkpoint
client.FS Path-based tree browsing (ls, cat, stat, find, grep, recall, write, delete)
client.Agent Background Intelligence triggers
client.Events Server-sent events stream
client.Graph Graph analysis, augmentation, orphans

Configuration

// Custom base URL
client := mem.NewClient(mem.WithBaseURL("http://192.168.1.100:14242"))

// Remote or LAN deployment with nmem API key
client := mem.NewRemoteClient("https://mem.example.com", os.Getenv("NMEM_API_KEY"))

// Equivalent explicit options:
// client := mem.NewClient(
//     mem.WithBaseURL("https://mem.example.com"),
//     mem.WithAPIKey(os.Getenv("NMEM_API_KEY")),
// )

// Read NMEM_API_URL and NMEM_API_KEY
client := mem.NewClientFromEnv()

// Or read ~/.nowledge-mem/config.json, with env vars overriding the file
client, err := mem.NewClientFromConfig()
if err != nil {
    log.Fatal(err)
}

// Custom HTTP client
client := mem.NewClient(mem.WithHTTPClient(&http.Client{Timeout: 60 * time.Second}))

// Custom timeout
client := mem.NewClient(mem.WithTimeout(60 * time.Second))

// Always close when done to release idle connections
defer client.Close()

NewClient() targets http://127.0.0.1:14242. Same-machine localhost API requests do not need an API key by default:

curl "http://127.0.0.1:14242/health"
curl "http://127.0.0.1:14242/spaces/roster"

The only localhost exception is when you explicitly enable "Require API key on localhost" in Nowledge Mem settings. In that case, use WithAPIKey even for the local client:

client := mem.NewClient(mem.WithAPIKey(os.Getenv("NMEM_API_KEY")))

LAN and remote deployments require an API key unless the server was explicitly started with auth disabled.

Use the backend API URL directly, for example https://mem.example.com. Do not append the web app's frontend-only /remote-api route. API paths stay the same for local and remote access, such as /health, /spaces/roster, and /memories.

NewRemoteClient and WithAPIKey send the key as both supported header forms: Authorization: Bearer nmem_xxxx and X-NMEM-API-Key: nmem_xxxx. If a proxy strips headers, use WithAPIKeyQuery explicitly to send nmem_api_key=nmem_xxxx in the query string.

Error Handling

The SDK returns *mem.APIError for API errors:

resp, err := client.Memories.Get(ctx, "nonexistent", "")
if err != nil {
    if apiErr, ok := err.(*mem.APIError); ok {
        fmt.Println("API error:", apiErr.Detail[0].Msg)
    }
}

License

MIT

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AINowAutoApprove added in v0.2.0

type AINowAutoApprove struct {
	Enabled bool `json:"enabled"`
}

AINowAutoApprove is the response for GET /agent/ai-now/sessions/{id}/auto-approve.

type AINowAutoApproveRequest added in v0.2.0

type AINowAutoApproveRequest struct {
	Enabled bool `json:"enabled"`
}

AINowAutoApproveRequest is the request for POST /agent/ai-now/sessions/{id}/auto-approve.

type AINowEvent added in v0.2.0

type AINowEvent struct {
	ID        string `json:"id"`
	EventType string `json:"event_type"`
	Content   string `json:"content,omitempty"`
	CreatedAt string `json:"created_at,omitempty"`
}

AINowEvent represents an AI Now session event.

type AINowFileReadRequest added in v0.2.0

type AINowFileReadRequest struct {
	Path string `json:"path"`
}

AINowFileReadRequest is the request for POST /agent/ai-now/sessions/{id}/files/read.

type AINowFileReadResponse added in v0.2.0

type AINowFileReadResponse struct {
	Content string `json:"content"`
}

AINowFileReadResponse is the response for POST /agent/ai-now/sessions/{id}/files/read.

type AINowMessage added in v0.2.0

type AINowMessage struct {
	ID        string `json:"id"`
	Role      string `json:"role"`
	Content   string `json:"content"`
	CreatedAt string `json:"created_at,omitempty"`
}

AINowMessage represents an AI Now session message.

type AINowMessageRequest added in v0.2.0

type AINowMessageRequest struct {
	Content string `json:"content"`
}

AINowMessageRequest is the request for POST /agent/ai-now/sessions/{id}/messages.

type AINowPermissionRequest added in v0.2.0

type AINowPermissionRequest struct {
	Approved bool   `json:"approved"`
	Reason   string `json:"reason,omitempty"`
}

AINowPermissionRequest is the request for POST /agent/ai-now/sessions/{id}/permissions/{request_id}.

type AINowPromptRequest added in v0.2.0

type AINowPromptRequest struct {
	Prompt string `json:"prompt"`
}

AINowPromptRequest is the request for POST /agent/ai-now/sessions/{id}/prompt.

type AINowPromptResponse added in v0.2.0

type AINowPromptResponse struct {
	Response string `json:"response"`
}

AINowPromptResponse is the response for POST /agent/ai-now/sessions/{id}/prompt.

type AINowSession added in v0.2.0

type AINowSession struct {
	ID        string `json:"id"`
	Status    string `json:"status"`
	CreatedAt string `json:"created_at,omitempty"`
}

AINowSession represents an AI Now session.

type AINowSkillPromptRequest added in v0.2.0

type AINowSkillPromptRequest struct {
	SkillID string `json:"skill_id"`
	Prompt  string `json:"prompt,omitempty"`
}

AINowSkillPromptRequest is the request for POST /agent/ai-now/skill-prompts.

type AINowSkillPromptResponse added in v0.2.0

type AINowSkillPromptResponse struct {
	Response string `json:"response"`
}

AINowSkillPromptResponse is the response for POST /agent/ai-now/skill-prompts.

type APIError

type APIError struct {
	StatusCode int           `json:"-"`
	Status     string        `json:"-"`
	Body       string        `json:"-"`
	Detail     []ErrorDetail `json:"detail"`
}

APIError represents an error response from the API.

func (*APIError) Error

func (e *APIError) Error() string

type AdminService added in v0.2.0

type AdminService struct {
	// contains filtered or unexported fields
}

AdminService handles admin operations.

func (*AdminService) CheckUpgrade added in v0.2.0

func (s *AdminService) CheckUpgrade(ctx context.Context) (*UpgradeInfo, error)

CheckUpgrade checks for available upgrades.

func (*AdminService) DownloadUpgrade added in v0.2.0

func (s *AdminService) DownloadUpgrade(ctx context.Context) error

DownloadUpgrade downloads an available upgrade.

func (*AdminService) InstallUpgrade added in v0.2.0

func (s *AdminService) InstallUpgrade(ctx context.Context) error

InstallUpgrade installs a downloaded upgrade.

type AgentService

type AgentService struct {
	// contains filtered or unexported fields
}

AgentService handles Background Intelligence operations.

func (*AgentService) CancelAINowSession added in v0.2.0

func (s *AgentService) CancelAINowSession(ctx context.Context, sessionID string) error

CancelAINowSession cancels an AI Now session.

func (*AgentService) CloseAINowSession added in v0.2.0

func (s *AgentService) CloseAINowSession(ctx context.Context, sessionID string) error

CloseAINowSession closes an AI Now session.

func (*AgentService) CreateAINowSession added in v0.2.0

func (s *AgentService) CreateAINowSession(ctx context.Context, req *CreateAINowSessionRequest) (*AINowSession, error)

CreateAINowSession creates a new AI Now session.

func (*AgentService) CreateGraphIntelligenceSession added in v0.2.0

func (s *AgentService) CreateGraphIntelligenceSession(ctx context.Context) (*GraphIntelligenceSession, error)

CreateGraphIntelligenceSession creates a new graph intelligence session.

func (*AgentService) DeleteAINowSession added in v0.2.0

func (s *AgentService) DeleteAINowSession(ctx context.Context, sessionID string) error

DeleteAINowSession deletes an AI Now session.

func (*AgentService) GetAINowAutoApprove added in v0.2.0

func (s *AgentService) GetAINowAutoApprove(ctx context.Context, sessionID string) (*AINowAutoApprove, error)

GetAINowAutoApprove returns auto-approve status for an AI Now session.

func (*AgentService) GetAINowSession added in v0.2.0

func (s *AgentService) GetAINowSession(ctx context.Context, sessionID string) (*AINowSession, error)

GetAINowSession returns a specific AI Now session.

func (*AgentService) GetAINowSessionEvents added in v0.2.0

func (s *AgentService) GetAINowSessionEvents(ctx context.Context, sessionID string) ([]AINowEvent, error)

GetAINowSessionEvents returns events for an AI Now session.

func (*AgentService) GetAINowSessionMessages added in v0.2.0

func (s *AgentService) GetAINowSessionMessages(ctx context.Context, sessionID string) ([]AINowMessage, error)

GetAINowSessionMessages returns messages for an AI Now session.

func (*AgentService) GetAINowSessions added in v0.2.0

func (s *AgentService) GetAINowSessions(ctx context.Context, limit int) ([]AINowSession, error)

GetAINowSessions returns AI Now sessions.

func (*AgentService) GetEvolves added in v0.2.0

func (s *AgentService) GetEvolves(ctx context.Context) ([]EvolutionEdge, error)

GetEvolves returns EVOLVES relationships between memories.

func (*AgentService) GetGraphIntelligenceSession added in v0.2.0

func (s *AgentService) GetGraphIntelligenceSession(ctx context.Context, sessionID string) (*GraphIntelligenceSession, error)

GetGraphIntelligenceSession returns a graph intelligence session.

func (*AgentService) GetGraphIntelligenceStatus added in v0.2.0

func (s *AgentService) GetGraphIntelligenceStatus(ctx context.Context) (*GraphIntelligenceStatus, error)

GetGraphIntelligenceStatus returns graph intelligence status.

func (*AgentService) GetKnowledgeProcessingStatus added in v0.2.0

func (s *AgentService) GetKnowledgeProcessingStatus(ctx context.Context) (*KnowledgeProcessingStatus, error)

GetKnowledgeProcessingStatus returns knowledge processing settings and status.

func (*AgentService) PromptAINowSession added in v0.2.0

func (s *AgentService) PromptAINowSession(ctx context.Context, sessionID string, req *AINowPromptRequest) (*AINowPromptResponse, error)

PromptAINowSession sends a prompt to an AI Now session.

func (*AgentService) ReadAINowSessionFile added in v0.2.0

func (s *AgentService) ReadAINowSessionFile(ctx context.Context, sessionID string, req *AINowFileReadRequest) (*AINowFileReadResponse, error)

ReadAINowSessionFile reads a file from an AI Now session.

func (*AgentService) RequestAINowPermission added in v0.2.0

func (s *AgentService) RequestAINowPermission(ctx context.Context, sessionID, requestID string, req *AINowPermissionRequest) error

RequestAINowPermission requests permission in an AI Now session.

func (*AgentService) SendAINowSessionMessage added in v0.2.0

func (s *AgentService) SendAINowSessionMessage(ctx context.Context, sessionID string, req *AINowMessageRequest) (*AINowMessage, error)

SendAINowSessionMessage sends a message to an AI Now session.

func (*AgentService) SendAINowSkillPrompt added in v0.2.0

func (s *AgentService) SendAINowSkillPrompt(ctx context.Context, req *AINowSkillPromptRequest) (*AINowSkillPromptResponse, error)

SendAINowSkillPrompt sends a skill prompt to AI Now.

func (*AgentService) SendGraphIntelligenceMessage added in v0.2.0

SendGraphIntelligenceMessage sends a message to graph intelligence.

func (*AgentService) SetAINowAutoApprove added in v0.2.0

func (s *AgentService) SetAINowAutoApprove(ctx context.Context, sessionID string, req *AINowAutoApproveRequest) error

SetAINowAutoApprove sets auto-approve for an AI Now session.

func (*AgentService) Status

func (s *AgentService) Status(ctx context.Context) (*AgentStatus, error)

Status returns the agent's current status.

func (*AgentService) TriggerCommunityDetection

func (s *AgentService) TriggerCommunityDetection(ctx context.Context) error

TriggerCommunityDetection triggers community detection on the knowledge graph.

func (*AgentService) TriggerCrystallization

func (s *AgentService) TriggerCrystallization(ctx context.Context) error

TriggerCrystallization triggers a crystallization review.

func (*AgentService) TriggerDailyBriefing

func (s *AgentService) TriggerDailyBriefing(ctx context.Context) error

TriggerDailyBriefing triggers a daily briefing.

func (*AgentService) TriggerDecayRefresh

func (s *AgentService) TriggerDecayRefresh(ctx context.Context) error

TriggerDecayRefresh triggers a decay score refresh.

func (*AgentService) TriggerInsightDetection

func (s *AgentService) TriggerInsightDetection(ctx context.Context) error

TriggerInsightDetection triggers proactive insight detection.

func (*AgentService) TriggerKGExtraction

func (s *AgentService) TriggerKGExtraction(ctx context.Context, req *KGExtractionRequest) error

TriggerKGExtraction triggers knowledge graph extraction.

func (*AgentService) TriggerMemoryCompaction

func (s *AgentService) TriggerMemoryCompaction(ctx context.Context) error

TriggerMemoryCompaction triggers a memory compaction review.

func (*AgentService) UpdateAINowSession added in v0.2.0

func (s *AgentService) UpdateAINowSession(ctx context.Context, sessionID string, req map[string]any) error

UpdateAINowSession updates an AI Now session.

type AgentStatus

type AgentStatus struct {
	Running         bool   `json:"running"`
	CurrentTask     string `json:"current_task,omitempty"`
	LastRunAt       string `json:"last_run_at,omitempty"`
	NextScheduledAt string `json:"next_scheduled_at,omitempty"`
}

AgentStatus is the response body for GET /agent/status.

type AppendMessagesRequest added in v0.4.0

type AppendMessagesRequest struct {
	Messages       []MessageCreateRequest `json:"messages,omitempty"`
	FilePath       string                 `json:"file_path,omitempty"`
	Format         string                 `json:"format,omitempty"`
	Deduplicate    bool                   `json:"deduplicate,omitempty"`
	IdempotencyKey string                 `json:"idempotency_key,omitempty"`
	SpaceID        string                 `json:"space_id,omitempty"`
}

AppendMessagesRequest is the request for POST /threads/{id}/append.

type AppendMessagesResponse

type AppendMessagesResponse struct {
	Success       bool   `json:"success"`
	ThreadID      string `json:"thread_id"`
	MessagesAdded int    `json:"messages_added"`
	TotalMessages int    `json:"total_messages"`
}

AppendMessagesResponse is the response for POST /threads/{id}/append.

type AugmentationJob

type AugmentationJob struct {
	ID        string         `json:"id"`
	JobType   string         `json:"job_type"`
	Status    string         `json:"status"`
	Progress  float64        `json:"progress"`
	StartedAt string         `json:"started_at,omitempty"`
	EndedAt   string         `json:"ended_at,omitempty"`
	Error     string         `json:"error,omitempty"`
	Params    map[string]any `json:"params,omitempty"`
}

AugmentationJob represents an augmentation job.

type AugmentationState

type AugmentationState struct {
	Running    bool             `json:"running"`
	CurrentJob *AugmentationJob `json:"current_job,omitempty"`
	LastRun    string           `json:"last_run,omitempty"`
}

AugmentationState is the response body for GET /graph/augmentation/state.

type AutoImportRule added in v0.4.0

type AutoImportRule struct {
	ID        string `json:"id"`
	Type      string `json:"type"`
	Value     string `json:"value"`
	Enabled   bool   `json:"enabled"`
	CreatedAt int64  `json:"created_at,omitempty"`
}

AutoImportRule represents a single auto-import rule.

type BatchIngestFile added in v0.4.0

type BatchIngestFile struct {
	FilePath string `json:"file_path"`
}

BatchIngestFile is a single file entry in a batch ingest request.

type BatchIngestRequest

type BatchIngestRequest struct {
	Files             []BatchIngestFile `json:"files"`
	FolderName        string            `json:"folder_name,omitempty"`
	UserComment       string            `json:"user_comment,omitempty"`
	Labels            []string          `json:"labels,omitempty"`
	SpaceID           string            `json:"space_id,omitempty"`
	EmitFeedEvent     *bool             `json:"emit_feed_event,omitempty"`
	AccumulatedTotals map[string]any    `json:"accumulated_totals,omitempty"`
}

BatchIngestRequest is the request body for POST /sources/ingest/batch.

type BatchIngestResponse

type BatchIngestResponse struct {
	FolderName      string                 `json:"folder_name,omitempty"`
	TotalIngested   int                    `json:"total_ingested"`
	TotalDuplicates int                    `json:"total_duplicates"`
	TotalErrors     int                    `json:"total_errors"`
	Results         []IngestSourceResponse `json:"results,omitempty"`
	Message         string                 `json:"message,omitempty"`
}

BatchIngestResponse is the response body for POST /sources/ingest/batch.

type BulkDeleteRequest

type BulkDeleteRequest struct {
	Selection     BulkMemorySelection `json:"selection"`
	CascadeDelete bool                `json:"cascade_delete,omitempty"`
}

BulkDeleteRequest is the request for POST /memories/bulk/delete.

type BulkDeleteResponse

type BulkDeleteResponse struct {
	DeletedCount  int              `json:"deleted_count"`
	FailedCount   int              `json:"failed_count"`
	SourceSpaceID string           `json:"source_space_id,omitempty"`
	CascadeDelete bool             `json:"cascade_delete,omitempty"`
	Results       []map[string]any `json:"results,omitempty"`
	Message       string           `json:"message,omitempty"`
}

BulkDeleteResponse is the response for POST /memories/bulk/delete.

type BulkMemorySelection added in v0.4.0

type BulkMemorySelection struct {
	MemoryIDs []string `json:"memory_ids,omitempty"`
	SpaceID   string   `json:"space_id,omitempty"`
	SelectAll bool     `json:"select_all,omitempty"`
}

BulkMemorySelection describes a selection of memories for bulk operations.

type BulkMovePreviewRequest

type BulkMovePreviewRequest struct {
	Selection     BulkMemorySelection `json:"selection"`
	TargetSpaceID string              `json:"target_space_id"`
}

BulkMovePreviewRequest is the request for POST /memories/bulk/move/preview.

type BulkMovePreviewResponse

type BulkMovePreviewResponse struct {
	Count         int    `json:"count"`
	MaxAllowed    int    `json:"max_allowed,omitempty"`
	LimitExceeded bool   `json:"limit_exceeded,omitempty"`
	SourceSpaceID string `json:"source_space_id,omitempty"`
	TargetSpaceID string `json:"target_space_id,omitempty"`
	SelectionMode string `json:"selection_mode,omitempty"`
	ExcludedCount int    `json:"excluded_count,omitempty"`
	Message       string `json:"message,omitempty"`
}

BulkMovePreviewResponse is the response for POST /memories/bulk/move/preview.

type BulkMoveRequest

type BulkMoveRequest struct {
	Selection     BulkMemorySelection `json:"selection"`
	TargetSpaceID string              `json:"target_space_id"`
}

BulkMoveRequest is the request for POST /memories/bulk/move.

type BulkMoveResponse

type BulkMoveResponse struct {
	MovedCount        int    `json:"moved_count"`
	FailedCount       int    `json:"failed_count"`
	SourceSpaceID     string `json:"source_space_id,omitempty"`
	TargetSpaceID     string `json:"target_space_id,omitempty"`
	IndexUpdatedCount int    `json:"index_updated_count,omitempty"`
	IndexRepairNeeded bool   `json:"index_repair_needed,omitempty"`
	Message           string `json:"message,omitempty"`
}

BulkMoveResponse is the response for POST /memories/bulk/move.

type BulkThreadSelection added in v0.4.0

type BulkThreadSelection struct {
	ThreadIDs []string `json:"thread_ids,omitempty"`
	SpaceID   string   `json:"space_id,omitempty"`
	SelectAll bool     `json:"select_all,omitempty"`
}

BulkThreadSelection is a selection descriptor for bulk thread operations.

type Capabilities added in v0.2.0

type Capabilities struct {
	Version       string          `json:"version"`
	Features      map[string]bool `json:"features,omitempty"`
	SpacesEnabled bool            `json:"spaces_enabled,omitempty"`
}

Capabilities is the response for GET /capabilities.

type CapabilitiesService added in v0.2.0

type CapabilitiesService struct {
	// contains filtered or unexported fields
}

CapabilitiesService handles server capabilities.

func (*CapabilitiesService) Get added in v0.2.0

Get returns server capabilities — unauthenticated, used by clients to adapt UI.

type CleanupOrphansResponse

type CleanupOrphansResponse struct {
	Removed int `json:"removed"`
}

CleanupOrphansResponse is the response body for DELETE /graph/orphans.

type Client

type Client struct {

	// Services provides access to API resource operations.
	Memories      *MemoriesService
	Threads       *ThreadsService
	Spaces        *SpacesService
	Labels        *LabelsService
	Entities      *EntitiesService
	Sources       *SourcesService
	Health        *HealthService
	FS            *FSService
	Agent         *AgentService
	Graph         *GraphService
	GraphVis      *GraphVisService
	Distillation  *DistillationService
	KG            *KGService
	Communities   *CommunitiesService
	Events        *EventsService
	Data          *DataService
	Storage       *StorageService
	Settings      *SettingsService
	Models        *ModelsService
	SearchIndex   *SearchIndexService
	Embeddings    *EmbeddingsService
	Feed          *FeedService
	WorkingMemory *WorkingMemoryService
	Library       *LibraryService
	Capabilities  *CapabilitiesService
	Admin         *AdminService
	Favorites     *FavoritesService
	ContentStore  *ContentStoreService
	// contains filtered or unexported fields
}

Client is the Nowledge Mem API client.

Create a client with NewClient:

client := nowledgemem.NewClient()
client := nowledgemem.NewClient(nowledgemem.WithBaseURL("http://host:14242"))

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new Nowledge Mem API client.

Example
package main

import (
	"context"
	"fmt"
	"log"

	mem "github.com/lib-x/nowledgemem-go"
)

func main() {
	// Create a client with default settings (http://127.0.0.1:14242)
	client := mem.NewClient()
	defer client.Close()

	ctx := context.Background()

	// Health check
	health, err := client.Health.Check(ctx)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("Status:", health.Status)

	// List memories
	resp, err := client.Memories.List(ctx, &mem.ListMemoriesParams{
		Limit: 5,
	})
	if err != nil {
		log.Fatal(err)
	}
	for _, m := range resp.Memories {
		fmt.Printf("- %s: %s\n", m.ID, m.Title)
	}
}
Example (WithOptions)
package main

import (
	"context"
	"fmt"
	"log"
	"time"

	mem "github.com/lib-x/nowledgemem-go"
)

func main() {
	// Create a client with custom base URL and timeout
	client := mem.NewClient(
		mem.WithBaseURL("http://192.168.1.100:14242"),
		mem.WithTimeout(60*time.Second),
	)
	defer client.Close()

	ctx := context.Background()

	// Create a memory
	created, err := client.Memories.Create(ctx, &mem.CreateMemoryRequest{
		Content: "Remember to review the API design",
		Title:   strPtr("API Review"),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("Created memory:", created.Memory.ID)

	// Search memories
	results, err := client.Memories.Search(ctx, &mem.SearchMemoriesRequest{
		Query: "API design",
		Limit: 5,
	})
	if err != nil {
		log.Fatal(err)
	}
	for _, r := range results {
		fmt.Printf("- %s (score: %.2f)\n", r.Memory.Title, r.SimilarityScore)
	}
}

func strPtr(s string) *string { return &s }

func NewClientFromConfig added in v0.3.2

func NewClientFromConfig(opts ...Option) (*Client, error)

NewClientFromConfig creates a client from ~/.nowledge-mem/config.json, with NMEM_API_URL and NMEM_API_KEY overriding file values when present.

Explicit options are applied last.

func NewClientFromEnv added in v0.3.2

func NewClientFromEnv(opts ...Option) *Client

NewClientFromEnv creates a client from NMEM_API_URL and NMEM_API_KEY.

Explicit options are applied after environment-derived options.

func NewRemoteClient added in v0.3.1

func NewRemoteClient(rawURL, apiKey string, opts ...Option) *Client

NewRemoteClient creates a client for a remote Nowledge Mem deployment.

Remote deployments use the backend API URL, such as "https://mem.example.com", and an nmem API key. Do not append the web app's frontend-only /remote-api route. The key is sent as both Authorization: Bearer nmem_xxxx and X-NMEM-API-Key: nmem_xxxx.

func (*Client) BaseURL

func (c *Client) BaseURL() *url.URL

BaseURL returns the client's base URL.

func (*Client) Close

func (c *Client) Close()

Close closes idle HTTP connections. Call this when done with the client.

type ClientConfig added in v0.3.2

type ClientConfig struct {
	APIURL string `json:"apiUrl"`
	APIKey string `json:"apiKey"`
}

ClientConfig is the shared local client configuration written by nmem.

type CommunitiesService added in v0.2.0

type CommunitiesService struct {
	// contains filtered or unexported fields
}

CommunitiesService handles community operations.

func (*CommunitiesService) Get added in v0.2.0

func (s *CommunitiesService) Get(ctx context.Context, communityID string) (*CommunityDetail, error)

Get returns community details including entities and sample memories.

func (*CommunitiesService) GetRecentMemories added in v0.2.0

func (s *CommunitiesService) GetRecentMemories(ctx context.Context, communityID string, limit int) ([]MemoryListItem, error)

GetRecentMemories returns recent memories in a community.

func (*CommunitiesService) GetRelated added in v0.2.0

func (s *CommunitiesService) GetRelated(ctx context.Context, communityID string, limit int) ([]Community, error)

GetRelated returns related communities.

func (*CommunitiesService) GetSubgraph added in v0.2.0

func (s *CommunitiesService) GetSubgraph(ctx context.Context, communityID string) (*GraphData, error)

GetSubgraph returns the subgraph for a community.

func (*CommunitiesService) List added in v0.2.0

func (s *CommunitiesService) List(ctx context.Context, limit int) ([]Community, error)

List returns knowledge communities with AI summaries.

type Community

type Community struct {
	ID           string   `json:"id"`
	Name         string   `json:"name"`
	Description  string   `json:"description,omitempty"`
	Size         int      `json:"size"`
	SampleMemIDs []string `json:"sample_mem_ids,omitempty"`
}

Community represents a knowledge community.

type CommunityDetail added in v0.2.0

type CommunityDetail struct {
	ID             string           `json:"id"`
	Name           string           `json:"name"`
	Description    string           `json:"description,omitempty"`
	Size           int              `json:"size"`
	SampleMemIDs   []string         `json:"sample_mem_ids,omitempty"`
	Entities       []Entity         `json:"entities,omitempty"`
	SampleMemories []MemoryListItem `json:"sample_memories,omitempty"`
}

CommunityDetail holds detailed community info.

type ContentStoreInfo

type ContentStoreInfo struct {
	State                       string `json:"state"`
	DBPath                      string `json:"db_path"`
	SQLiteReady                 bool   `json:"sqlite_ready"`
	SchemaVersion               int    `json:"schema_version"`
	SchemaMinSupportedVersion   int    `json:"schema_min_supported_version"`
	SchemaMigrationCount        int    `json:"schema_migration_count"`
	ThreadMessageOwner          string `json:"thread_message_owner"`
	CutoverReady                bool   `json:"cutover_ready"`
	CutoverCompleted            bool   `json:"cutover_completed"`
	LegacyGraphCleanupCompleted bool   `json:"legacy_graph_cleanup_completed"`
	SQLiteMessageCount          int    `json:"sqlite_message_count"`
	SQLiteThreadCount           int    `json:"sqlite_thread_count"`
	SQLiteAnchorCount           int    `json:"sqlite_anchor_count"`
	LegacyKuzuMessageCount      int    `json:"legacy_kuzu_message_count"`
	LastError                   string `json:"last_error"`
	UpdatedAt                   string `json:"updated_at"`
}

ContentStoreInfo holds content store status.

type ContentStoreMigrationStatus added in v0.2.0

type ContentStoreMigrationStatus struct {
	State                       string `json:"state"`
	DBPath                      string `json:"db_path"`
	SQLiteReady                 bool   `json:"sqlite_ready"`
	SchemaVersion               int    `json:"schema_version"`
	SchemaMinSupportedVersion   int    `json:"schema_min_supported_version"`
	SchemaMigrationCount        int    `json:"schema_migration_count"`
	ThreadMessageOwner          string `json:"thread_message_owner"`
	CutoverReady                bool   `json:"cutover_ready"`
	CutoverCompleted            bool   `json:"cutover_completed"`
	LegacyGraphCleanupCompleted bool   `json:"legacy_graph_cleanup_completed"`
	SQLiteMessageCount          int    `json:"sqlite_message_count"`
	SQLiteThreadCount           int    `json:"sqlite_thread_count"`
	SQLiteAnchorCount           int    `json:"sqlite_anchor_count"`
	LegacyKuzuMessageCount      int    `json:"legacy_kuzu_message_count"`
	LastError                   string `json:"last_error"`
	UpdatedAt                   string `json:"updated_at"`
}

ContentStoreMigrationStatus is the response for GET /content-store/migration/status.

type ContentStoreService added in v0.2.0

type ContentStoreService struct {
	// contains filtered or unexported fields
}

ContentStoreService handles content store migration operations.

func (*ContentStoreService) CleanupLegacyGraph added in v0.2.0

func (s *ContentStoreService) CleanupLegacyGraph(ctx context.Context) error

CleanupLegacyGraph cleans up the legacy thread message graph.

func (*ContentStoreService) CopyAll added in v0.2.0

func (s *ContentStoreService) CopyAll(ctx context.Context) error

CopyAll copies all legacy thread messages into SQLite.

func (*ContentStoreService) CopyBatch added in v0.2.0

func (s *ContentStoreService) CopyBatch(ctx context.Context, batchSize int) error

CopyBatch copies one bounded legacy Kuzu Message page into SQLite.

func (*ContentStoreService) Cutover added in v0.2.0

func (s *ContentStoreService) Cutover(ctx context.Context) error

Cutover performs the content store cutover.

func (*ContentStoreService) GetMigrationStatus added in v0.2.0

func (s *ContentStoreService) GetMigrationStatus(ctx context.Context) (*ContentStoreMigrationStatus, error)

GetMigrationStatus returns the current migration status.

func (*ContentStoreService) MigrateAnchors added in v0.2.0

func (s *ContentStoreService) MigrateAnchors(ctx context.Context) error

MigrateAnchors migrates thread message anchors.

func (*ContentStoreService) MigrateThroughCutover added in v0.2.0

func (s *ContentStoreService) MigrateThroughCutover(ctx context.Context) error

MigrateThroughCutover migrates thread messages through cutover.

func (*ContentStoreService) Verify added in v0.2.0

func (s *ContentStoreService) Verify(ctx context.Context) error

Verify verifies the content store migration.

type CreateAINowSessionRequest added in v0.2.0

type CreateAINowSessionRequest struct {
	Prompt  string `json:"prompt,omitempty"`
	Context string `json:"context,omitempty"`
}

CreateAINowSessionRequest is the request for POST /agent/ai-now/sessions.

type CreateEmbeddingsRequest added in v0.2.0

type CreateEmbeddingsRequest struct {
	Model          string `json:"model,omitempty"`
	Input          any    `json:"input"`
	EncodingFormat string `json:"encoding_format,omitempty"`
	Dimensions     *int   `json:"dimensions,omitempty"`
	User           string `json:"user,omitempty"`
	InputType      string `json:"input_type,omitempty"`
}

CreateEmbeddingsRequest is the request for POST /v1/embeddings.

type CreateEmbeddingsResponse added in v0.2.0

type CreateEmbeddingsResponse struct {
	Object string          `json:"object"`
	Data   []EmbeddingData `json:"data"`
	Model  string          `json:"model"`
	Usage  EmbeddingUsage  `json:"usage"`
}

CreateEmbeddingsResponse is the response for POST /v1/embeddings.

type CreateLabelRequest

type CreateLabelRequest struct {
	Name        string `json:"name"`
	Color       string `json:"color,omitempty"`
	Description string `json:"description,omitempty"`
}

CreateLabelRequest is the request body for POST /labels.

type CreateMemoryRequest

type CreateMemoryRequest struct {
	ID              *string        `json:"id,omitempty"`
	Content         string         `json:"content"`
	Title           *string        `json:"title,omitempty"`
	SourceThreadID  *string        `json:"source_thread_id,omitempty"`
	SourceMsgRange  map[string]int `json:"source_message_range,omitempty"`
	Source          *string        `json:"source,omitempty"`
	SourceMessageID *string        `json:"source_message_id,omitempty"`
	Importance      *float64       `json:"importance,omitempty"`
	Confidence      *float64       `json:"confidence,omitempty"`
	Labels          []string       `json:"labels,omitempty"`
	SpaceID         *string        `json:"space_id,omitempty"`
	Metadata        map[string]any `json:"metadata,omitempty"`
	EventStart      *string        `json:"event_start,omitempty"`
	EventEnd        *string        `json:"event_end,omitempty"`
	TemporalContext *string        `json:"temporal_context,omitempty"`
	UnitType        *string        `json:"unit_type,omitempty"`
}

CreateMemoryRequest is the request body for POST /memories.

type CreateMemoryResponse

type CreateMemoryResponse struct {
	Memory               Memory   `json:"memory"`
	ExtractedEntities    []Entity `json:"extracted_entities,omitempty"`
	AssignedLabels       []string `json:"assigned_labels,omitempty"`
	CreatedRelationships int      `json:"created_relationships,omitempty"`
	Action               string   `json:"action,omitempty"`
	Warnings             []string `json:"warnings,omitempty"`
}

CreateMemoryResponse is the response body for POST /memories.

type CreateSpaceRequest

type CreateSpaceRequest struct {
	Name                 string   `json:"name"`
	Description          string   `json:"description,omitempty"`
	Icon                 string   `json:"icon,omitempty"`
	Instructions         string   `json:"instructions,omitempty"`
	SharedSpaceIds       []string `json:"sharedSpaceIds,omitempty"`
	DefaultRetrievalMode string   `json:"defaultRetrievalMode,omitempty"`
}

CreateSpaceRequest is the request body for POST /spaces.

type CreateThreadRequest

type CreateThreadRequest struct {
	ThreadID     string                 `json:"thread_id"`
	Title        *string                `json:"title,omitempty"`
	Messages     []MessageCreateRequest `json:"messages"`
	Participants []string               `json:"participants,omitempty"`
	Source       *string                `json:"source,omitempty"`
	SpaceID      string                 `json:"space_id,omitempty"`
	Project      *string                `json:"project,omitempty"`
	Workspace    *string                `json:"workspace,omitempty"`
	ToolVersion  *string                `json:"tool_version,omitempty"`
	ImportDate   *string                `json:"import_date,omitempty"`
	Metadata     map[string]any         `json:"metadata,omitempty"`
}

CreateThreadRequest is the request body for POST /threads.

type CreateThreadResponse

type CreateThreadResponse struct {
	Thread                  Thread          `json:"thread"`
	Messages                []ThreadMessage `json:"messages,omitempty"`
	CreatedRelationships    int             `json:"created_relationships,omitempty"`
	AutoGeneratedSummary    string          `json:"auto_generated_summary,omitempty"`
	ExtractedMemories       []Memory        `json:"extracted_memories,omitempty"`
	AutoExtractionPerformed bool            `json:"auto_extraction_performed,omitempty"`
}

CreateThreadResponse is the response body for POST /threads.

type DataExportDownloadRequest added in v0.4.0

type DataExportDownloadRequest struct {
	IncludeMemories             *bool `json:"include_memories,omitempty"`
	IncludeThreads              *bool `json:"include_threads,omitempty"`
	IncludeMessages             *bool `json:"include_messages,omitempty"`
	IncludeEntities             *bool `json:"include_entities,omitempty"`
	IncludeLabels               *bool `json:"include_labels,omitempty"`
	IncludeSources              *bool `json:"include_sources,omitempty"`
	IncludeCommunities          *bool `json:"include_communities,omitempty"`
	IncludeSkills               *bool `json:"include_skills,omitempty"`
	IncludeEdges                *bool `json:"include_edges,omitempty"`
	IncludeWorkingMemory        *bool `json:"include_working_memory,omitempty"`
	IncludeWorkingMemoryArchive *bool `json:"include_working_memory_archive,omitempty"`
	IncludeSourceFiles          *bool `json:"include_source_files,omitempty"`
}

DataExportDownloadRequest is the request for POST /data/export/download. This endpoint streams a ZIP directly to the client and does not require a server-side path.

type DataExportRequest added in v0.2.0

type DataExportRequest struct {
	ExportPath                  string `json:"export_path"`
	Compress                    bool   `json:"compress,omitempty"`
	Overwrite                   bool   `json:"overwrite,omitempty"`
	IncludeMemories             *bool  `json:"include_memories,omitempty"`
	IncludeThreads              *bool  `json:"include_threads,omitempty"`
	IncludeMessages             *bool  `json:"include_messages,omitempty"`
	IncludeEntities             *bool  `json:"include_entities,omitempty"`
	IncludeLabels               *bool  `json:"include_labels,omitempty"`
	IncludeSources              *bool  `json:"include_sources,omitempty"`
	IncludeCommunities          *bool  `json:"include_communities,omitempty"`
	IncludeSkills               *bool  `json:"include_skills,omitempty"`
	IncludeEdges                *bool  `json:"include_edges,omitempty"`
	IncludeWorkingMemory        *bool  `json:"include_working_memory,omitempty"`
	IncludeWorkingMemoryArchive *bool  `json:"include_working_memory_archive,omitempty"`
	IncludeSourceFiles          *bool  `json:"include_source_files,omitempty"`
}

DataExportRequest is the request for POST /data/export.

type DataExportResponse added in v0.2.0

type DataExportResponse struct {
	Path      string `json:"path"`
	SizeBytes int64  `json:"size_bytes"`
	ItemCount int    `json:"item_count"`
}

DataExportResponse is the response for POST /data/export.

type DataImportRequest added in v0.2.0

type DataImportRequest struct {
	ImportPath                  string `json:"import_path"`
	Mode                        string `json:"mode,omitempty"`
	IncludeMemories             *bool  `json:"include_memories,omitempty"`
	IncludeThreads              *bool  `json:"include_threads,omitempty"`
	IncludeMessages             *bool  `json:"include_messages,omitempty"`
	IncludeEntities             *bool  `json:"include_entities,omitempty"`
	IncludeLabels               *bool  `json:"include_labels,omitempty"`
	IncludeSources              *bool  `json:"include_sources,omitempty"`
	IncludeCommunities          *bool  `json:"include_communities,omitempty"`
	IncludeSkills               *bool  `json:"include_skills,omitempty"`
	IncludeEdges                *bool  `json:"include_edges,omitempty"`
	IncludeWorkingMemory        *bool  `json:"include_working_memory,omitempty"`
	IncludeWorkingMemoryArchive *bool  `json:"include_working_memory_archive,omitempty"`
	IncludeSourceFiles          *bool  `json:"include_source_files,omitempty"`
}

DataImportRequest is the request for POST /data/import.

type DataImportResponse added in v0.2.0

type DataImportResponse struct {
	JobID   string `json:"job_id"`
	Status  string `json:"status"`
	Message string `json:"message,omitempty"`
}

DataImportResponse is the response for POST /data/import.

type DataImportStatus added in v0.2.0

type DataImportStatus struct {
	JobID    string  `json:"job_id"`
	Status   string  `json:"status"`
	Progress float64 `json:"progress"`
	Imported int     `json:"imported"`
	Skipped  int     `json:"skipped"`
	Failed   int     `json:"failed"`
	Message  string  `json:"message,omitempty"`
}

DataImportStatus is the response for GET /data/import/status/{job_id}.

type DataService added in v0.2.0

type DataService struct {
	// contains filtered or unexported fields
}

DataService handles data export/import operations.

func (*DataService) Checkpoint added in v0.2.0

func (s *DataService) Checkpoint(ctx context.Context) error

Checkpoint forces a database checkpoint.

func (*DataService) DownloadExport added in v0.2.0

func (s *DataService) DownloadExport(ctx context.Context, req *DataExportDownloadRequest) ([]byte, error)

DownloadExport creates and downloads a ZIP export.

func (*DataService) Export added in v0.2.0

Export exports a portable data bundle to a server-side path.

func (*DataService) Import added in v0.2.0

Import imports data from a server-side export path.

func (*DataService) ImportStatus added in v0.2.0

func (s *DataService) ImportStatus(ctx context.Context, jobID string) (*DataImportStatus, error)

ImportStatus checks status of a data import job.

func (*DataService) UploadImport added in v0.2.0

func (s *DataService) UploadImport(ctx context.Context, req *UploadImportRequest) (*DataImportResponse, error)

UploadImport uploads a ZIP export from web and remote clients. file is the ZIP file content, filename is the name of the file.

type DeleteMemoryParams

type DeleteMemoryParams struct {
	CascadeDelete bool   `json:"cascade_delete,omitempty"`
	SpaceID       string `json:"space_id,omitempty"`
}

DeleteMemoryParams are query parameters for DELETE /memories/{id}.

type DeleteMemoryResponse

type DeleteMemoryResponse struct {
	Message              string `json:"message"`
	DeletedRelationships int    `json:"deleted_relationships,omitempty"`
	DeletedEntities      int    `json:"deleted_entities,omitempty"`
}

DeleteMemoryResponse is the response body for DELETE /memories/{id}.

type DeleteSpaceParams added in v0.4.0

type DeleteSpaceParams struct {
	PurgeWorkingMemory bool `json:"purge_working_memory,omitempty"`
}

DeleteSpaceParams are query parameters for DELETE /spaces/{id}.

type DeleteThreadParams added in v0.4.0

type DeleteThreadParams struct {
	CascadeDeleteMemories bool   `json:"cascade_delete_memories,omitempty"`
	SpaceID               string `json:"space_id,omitempty"`
}

DeleteThreadParams are query parameters for DELETE /threads/{id}.

type DeleteThreadResponse added in v0.4.0

type DeleteThreadResponse struct {
	Message         string `json:"message"`
	DeletedMessages int    `json:"deleted_messages,omitempty"`
	DeletedMemories int    `json:"deleted_memories,omitempty"`
	CascadeDeletion bool   `json:"cascade_deletion,omitempty"`
}

DeleteThreadResponse is the response for DELETE /threads/{id}.

type DeprecateMemoryRequest added in v0.4.0

type DeprecateMemoryRequest struct {
	Reason              string `json:"reason,omitempty"`
	ReplacementMemoryID string `json:"replacement_memory_id,omitempty"`
	SpaceID             string `json:"space_id,omitempty"`
}

DeprecateMemoryRequest is the request for POST /memories/{id}/deprecate.

type DiscoverSessionsResponse added in v0.4.0

type DiscoverSessionsResponse struct {
	Conversations map[string][]DiscoveredSession `json:"conversations"`
}

DiscoverSessionsResponse is the response for GET /threads/conversations/discover.

type DiscoveredSession added in v0.2.0

type DiscoveredSession struct {
	Path      string `json:"path"`
	Source    string `json:"source"`
	Project   string `json:"project,omitempty"`
	SessionID string `json:"session_id,omitempty"`
	Title     string `json:"title,omitempty"`
	Messages  int    `json:"messages"`
	Date      string `json:"date,omitempty"`
}

DiscoveredSession represents a discovered conversation session.

type DistillPlanRequest added in v0.2.0

type DistillPlanRequest struct {
	ThreadID string  `json:"thread_id"`
	SpaceID  *string `json:"space_id,omitempty"`
}

DistillPlanRequest is the request for POST /memories/distill/plan.

type DistillPlanResponse added in v0.2.0

type DistillPlanResponse struct {
	Plan string `json:"plan"`
}

DistillPlanResponse is the response for POST /memories/distill/plan.

type DistillPreviewRequest added in v0.2.0

type DistillPreviewRequest struct {
	ThreadID               string  `json:"thread_id"`
	ThreadTitle            *string `json:"thread_title,omitempty"`
	ThreadContent          *string `json:"thread_content,omitempty"`
	DistillationType       *string `json:"distillation_type,omitempty"`
	ExtractionLevel        *string `json:"extraction_level,omitempty"`
	CacheKey               *string `json:"cache_key,omitempty"`
	SelectedMessageIndices []int   `json:"selected_message_indices,omitempty"`
	PreferredLanguage      *string `json:"preferred_language,omitempty"`
	ForceDistill           *bool   `json:"force_distill,omitempty"`
	SpaceID                *string `json:"space_id,omitempty"`
}

DistillPreviewRequest is the request for POST /memories/distill/preview.

type DistillPreviewResponse added in v0.2.0

type DistillPreviewResponse struct {
	Success                  bool             `json:"success"`
	CacheKey                 string           `json:"cache_key,omitempty"`
	DistillationType         string           `json:"distillation_type,omitempty"`
	ProcessingTime           float64          `json:"processing_time,omitempty"`
	Memories                 []Memory         `json:"memories,omitempty"`
	Entities                 []Entity         `json:"entities,omitempty"`
	Relationships            []KGRelation     `json:"relationships,omitempty"`
	Insights                 []map[string]any `json:"insights,omitempty"`
	Summary                  string           `json:"summary,omitempty"`
	Error                    string           `json:"error,omitempty"`
	DirectAllowed            bool             `json:"direct_allowed,omitempty"`
	RecommendedExecutionMode string           `json:"recommended_execution_mode,omitempty"`
	MessageCount             int              `json:"message_count,omitempty"`
	CharCount                int              `json:"char_count,omitempty"`
	BackgroundDelaySeconds   float64          `json:"background_delay_seconds,omitempty"`
}

DistillPreviewResponse is the response for POST /memories/distill/preview.

type DistillRequest added in v0.2.0

type DistillRequest struct {
	ThreadID               string  `json:"thread_id"`
	ThreadTitle            *string `json:"thread_title,omitempty"`
	ThreadContent          *string `json:"thread_content,omitempty"`
	DistillationType       *string `json:"distillation_type,omitempty"`
	ExtractionLevel        *string `json:"extraction_level,omitempty"`
	CacheKey               *string `json:"cache_key,omitempty"`
	SelectedMessageIndices []int   `json:"selected_message_indices,omitempty"`
	PreferredLanguage      *string `json:"preferred_language,omitempty"`
	ForceDistill           bool    `json:"force_distill,omitempty"`
	SpaceID                *string `json:"space_id,omitempty"`
}

DistillRequest is the request for POST /memories/distill.

type DistillResponse added in v0.2.0

type DistillResponse struct {
	Memory               Memory   `json:"memory"`
	ExtractedEntities    []Entity `json:"extracted_entities,omitempty"`
	AssignedLabels       []string `json:"assigned_labels,omitempty"`
	CreatedRelationships int      `json:"created_relationships,omitempty"`
	Action               string   `json:"action,omitempty"`
	Warnings             []string `json:"warnings,omitempty"`
}

DistillResponse is the response for POST /memories/distill.

type DistillScheduleRequest added in v0.2.0

type DistillScheduleRequest struct {
	ThreadID string  `json:"thread_id"`
	SpaceID  *string `json:"space_id,omitempty"`
}

DistillScheduleRequest is the request for POST /memories/distill/schedule.

type DistillScheduleResponse added in v0.2.0

type DistillScheduleResponse struct {
	Scheduled bool   `json:"scheduled"`
	JobID     string `json:"job_id,omitempty"`
}

DistillScheduleResponse is the response for POST /memories/distill/schedule.

type DistillationService added in v0.2.0

type DistillationService struct {
	// contains filtered or unexported fields
}

DistillationService handles memory distillation from threads.

func (*DistillationService) Distill added in v0.2.0

Distill creates memories from thread content after distillation.

func (*DistillationService) Plan added in v0.2.0

Plan creates a distillation plan.

func (*DistillationService) Preview added in v0.2.0

Preview previews distillation results without creating memories.

func (*DistillationService) Schedule added in v0.2.0

Schedule schedules a distillation job.

func (*DistillationService) Triage added in v0.2.0

Triage performs a lightweight check: does this conversation have save-worthy content?

type EmbeddingData added in v0.2.0

type EmbeddingData struct {
	Object    string    `json:"object"`
	Embedding []float64 `json:"embedding"`
	Index     int       `json:"index"`
}

EmbeddingData is a single embedding result.

type EmbeddingModel added in v0.2.0

type EmbeddingModel struct {
	ID      string `json:"id"`
	Object  string `json:"object"`
	OwnedBy string `json:"owned_by"`
}

EmbeddingModel represents an available embedding model.

type EmbeddingModelStatus added in v0.2.0

type EmbeddingModelStatus struct {
	Installed bool   `json:"installed"`
	Ready     bool   `json:"ready"`
	ModelPath string `json:"model_path,omitempty"`
	Version   string `json:"version,omitempty"`
}

EmbeddingModelStatus is the response for GET /models/bge-m3/status.

type EmbeddingUsage added in v0.2.0

type EmbeddingUsage struct {
	PromptTokens int `json:"prompt_tokens"`
	TotalTokens  int `json:"total_tokens"`
}

EmbeddingUsage tracks token usage.

type EmbeddingsService added in v0.2.0

type EmbeddingsService struct {
	// contains filtered or unexported fields
}

EmbeddingsService handles OpenAI-compatible embedding operations.

func (*EmbeddingsService) CreateEmbeddings added in v0.2.0

CreateEmbeddings generates embeddings using the local model.

func (*EmbeddingsService) ListModels added in v0.2.0

func (s *EmbeddingsService) ListModels(ctx context.Context) ([]EmbeddingModel, error)

ListModels lists available models.

type EntitiesService

type EntitiesService struct {
	// contains filtered or unexported fields
}

EntitiesService handles entity operations.

func (*EntitiesService) GetRelationships

func (s *EntitiesService) GetRelationships(ctx context.Context, entityID string) (*EntityRelationships, error)

GetRelationships returns all connected entities and memories for an entity.

func (*EntitiesService) List

func (s *EntitiesService) List(ctx context.Context, params *ListEntitiesParams) ([]Entity, error)

List returns entities with optional filtering.

func (*EntitiesService) ListWithStats

func (s *EntitiesService) ListWithStats(ctx context.Context, params *ListEntitiesParams) ([]EntityWithStats, error)

ListWithStats returns entities sorted by mention count with stats.

type Entity

type Entity struct {
	ID                 string         `json:"id"`
	NodeType           string         `json:"node_type,omitempty"`
	CreatedAt          *time.Time     `json:"created_at,omitempty"`
	UpdatedAt          *time.Time     `json:"updated_at,omitempty"`
	Metadata           map[string]any `json:"metadata,omitempty"`
	Name               string         `json:"name"`
	EntityType         string         `json:"entity_type,omitempty"`
	Description        string         `json:"description,omitempty"`
	Aliases            []string       `json:"aliases,omitempty"`
	Confidence         float64        `json:"confidence,omitempty"`
	EntityCreated      string         `json:"entity_created,omitempty"`
	EntityEnded        string         `json:"entity_ended,omitempty"`
	TemporalPrecision  string         `json:"temporal_precision,omitempty"`
	TemporalConfidence float64        `json:"temporal_confidence,omitempty"`
	TemporalContext    string         `json:"temporal_context,omitempty"`
}

Entity represents an entity node in the knowledge graph.

type EntityRelationships

type EntityRelationships struct {
	Entity          Entity           `json:"entity"`
	RelatedEntities []Entity         `json:"related_entities,omitempty"`
	RelatedMemories []MemoryListItem `json:"related_memories,omitempty"`
}

EntityRelationships holds an entity's connected nodes.

type EntityWithStats

type EntityWithStats struct {
	Entity       Entity `json:"entity"`
	MentionCount int    `json:"mention_count"`
}

EntityWithStats wraps an Entity with mention count.

type ErrorDetail

type ErrorDetail struct {
	Loc   []string       `json:"loc"`
	Msg   string         `json:"msg"`
	Type  string         `json:"type"`
	Input any            `json:"input,omitempty"`
	Ctx   map[string]any `json:"ctx,omitempty"`
}

ErrorDetail is a single validation error.

type EventsService added in v0.3.0

type EventsService struct {
	// contains filtered or unexported fields
}

EventsService handles server-sent event streams.

func (*EventsService) Stream added in v0.3.0

func (s *EventsService) Stream(ctx context.Context) (*http.Response, error)

Stream opens the real-time server-sent events stream.

The caller owns the returned response body and must close it.

type EvolutionEdge added in v0.2.0

type EvolutionEdge struct {
	SourceID string `json:"source_id"`
	TargetID string `json:"target_id"`
	EdgeType string `json:"edge_type"`
}

EvolutionEdge represents an EVOLVES relationship.

type ExportOptions added in v0.4.0

type ExportOptions struct {
	Format          string `json:"format,omitempty"`
	IncludeMetadata *bool  `json:"include_metadata,omitempty"`
}

ExportOptions holds optional parameters for the Export method.

type ExportRawRequest added in v0.2.0

type ExportRawRequest struct {
	Path   string `json:"path"`
	Source string `json:"source"` // required
	Format string `json:"format,omitempty"`
}

ExportRawRequest is the request for POST /threads/conversations/export-raw.

type FSCatResponse

type FSCatResponse struct {
	Path        string         `json:"path"`
	Body        string         `json:"body"`
	Frontmatter map[string]any `json:"frontmatter,omitempty"`
	TotalLines  int            `json:"total_lines,omitempty"`
}

FSCatResponse is the response body for GET /fs/cat.

type FSDeleteRequest

type FSDeleteRequest struct {
	Path string `json:"path"`
}

FSDeleteRequest is the request body for POST /fs/delete.

type FSEntry

type FSEntry struct {
	Path  string `json:"path"`
	Name  string `json:"name"`
	Type  string `json:"type"`
	Size  int64  `json:"size,omitempty"`
	IsDir bool   `json:"is_dir,omitempty"`
}

FSEntry represents a file/directory in the Nowledge FS tree.

type FSGrepMatch

type FSGrepMatch struct {
	Path string `json:"path"`
	Line int    `json:"line"`
	Text string `json:"text"`
}

FSGrepMatch represents a single grep match.

type FSGrepResponse

type FSGrepResponse struct {
	Matches []FSGrepMatch `json:"matches"`
}

FSGrepResponse is the response body for GET /fs/grep.

type FSListResponse

type FSListResponse struct {
	Entries []FSEntry `json:"entries"`
	Cursor  string    `json:"cursor,omitempty"`
	HasMore bool      `json:"has_more,omitempty"`
}

FSListResponse is the response body for GET /fs/ls.

type FSSearchResponse

type FSSearchResponse struct {
	Paths []string `json:"paths"`
}

FSSearchResponse is the response body for GET /fs/find, /fs/recall.

type FSService

type FSService struct {
	// contains filtered or unexported fields
}

FSService handles Nowledge FS operations (path-based tree browsing).

func (*FSService) Cat

func (s *FSService) Cat(ctx context.Context, path string, line, lines int) (*FSCatResponse, error)

Cat reads a rendered file body and frontmatter.

func (*FSService) CatString

func (s *FSService) CatString(ctx context.Context, path string) (string, error)

CatString is a convenience method that returns just the body text.

func (*FSService) Delete

func (s *FSService) Delete(ctx context.Context, path string) error

Delete deletes a file at the given path.

func (*FSService) Find

func (s *FSService) Find(ctx context.Context, path, fileType, label string) (*FSSearchResponse, error)

Find performs structural search (type, label, date, mention constraints).

func (*FSService) Grep

func (s *FSService) Grep(ctx context.Context, path, query string) (*FSGrepResponse, error)

Grep performs literal exact-string search.

func (*FSService) List

func (s *FSService) List(ctx context.Context, path string, limit int, cursor string) (*FSListResponse, error)

List lists a directory in the FS tree.

func (*FSService) LsPaths

func (s *FSService) LsPaths(ctx context.Context, path string) ([]string, error)

LsPaths is a convenience method that returns just the entry paths.

func (*FSService) Recall

func (s *FSService) Recall(ctx context.Context, path, query string, k int) (*FSSearchResponse, error)

Recall performs semantic search that returns paths.

func (*FSService) Stat

func (s *FSService) Stat(ctx context.Context, path string) (*FSStatResponse, error)

Stat reads metadata without loading the body.

func (*FSService) Write

func (s *FSService) Write(ctx context.Context, path, body string) error

Write updates a file at the given path.

type FSStatResponse

type FSStatResponse struct {
	Path      string         `json:"path"`
	Type      string         `json:"type"`
	Size      int64          `json:"size"`
	CreatedAt string         `json:"created_at,omitempty"`
	UpdatedAt string         `json:"updated_at,omitempty"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

FSStatResponse is the response body for GET /fs/stat.

type FSWriteRequest

type FSWriteRequest struct {
	Path string `json:"path"`
	Body string `json:"body"`
}

FSWriteRequest is the request body for POST /fs/write.

type FavoritesService added in v0.2.0

type FavoritesService struct {
	// contains filtered or unexported fields
}

FavoritesService handles favorites operations.

func (*FavoritesService) GetFavoriteMemories added in v0.2.0

func (s *FavoritesService) GetFavoriteMemories(ctx context.Context) ([]MemoryListItem, error)

GetFavoriteMemories returns all favorite memories.

func (*FavoritesService) GetFavoriteThreads added in v0.2.0

func (s *FavoritesService) GetFavoriteThreads(ctx context.Context) ([]ThreadListItem, error)

GetFavoriteThreads returns all favorite threads.

type FeedEvent added in v0.2.0

type FeedEvent struct {
	ID        string         `json:"id"`
	EventType string         `json:"event_type"`
	Severity  string         `json:"severity"`
	Title     string         `json:"title"`
	Body      string         `json:"body,omitempty"`
	Resolved  bool           `json:"resolved"`
	CreatedAt string         `json:"created_at,omitempty"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

FeedEvent represents a feed event.

type FeedEventsParams added in v0.2.0

type FeedEventsParams struct {
	Limit          int    `json:"limit,omitempty"`
	Offset         int    `json:"offset,omitempty"`
	Severity       string `json:"severity,omitempty"`
	EventType      string `json:"event_type,omitempty"`
	UnresolvedOnly bool   `json:"unresolved_only,omitempty"`
	LastNDays      int    `json:"last_n_days,omitempty"`
	DateFrom       string `json:"date_from,omitempty"`
	DateTo         string `json:"date_to,omitempty"`
	Source         string `json:"source,omitempty"`
	SpaceID        string `json:"space_id,omitempty"`
	IncludeTotal   *bool  `json:"include_total,omitempty"`
}

FeedEventsParams are parameters for GET /agent/feed/events.

type FeedInputStreamRequest added in v0.3.0

type FeedInputStreamRequest struct {
	Content  string `json:"content"`
	Source   string `json:"source,omitempty"`
	Persist  *bool  `json:"persist,omitempty"`
	ThreadID string `json:"thread_id,omitempty"`
	SpaceID  string `json:"space_id,omitempty"`
}

FeedInputStreamRequest is the request for POST /agent/feed/input/stream.

type FeedService added in v0.2.0

type FeedService struct {
	// contains filtered or unexported fields
}

FeedService handles feed event operations.

func (*FeedService) DeleteEvent added in v0.2.0

func (s *FeedService) DeleteEvent(ctx context.Context, eventID string) error

DeleteEvent soft-deletes a feed event.

func (*FeedService) GetEvents added in v0.2.0

func (s *FeedService) GetEvents(ctx context.Context, params *FeedEventsParams) ([]FeedEvent, error)

GetEvents returns feed events with filtering.

func (*FeedService) PersistQuestion added in v0.2.0

func (s *FeedService) PersistQuestion(ctx context.Context, req *PersistQuestionRequest) error

PersistQuestion persists a question and agent response as a feed event.

func (*FeedService) ResolveEvent added in v0.2.0

func (s *FeedService) ResolveEvent(ctx context.Context, eventID string, req *ResolveEventRequest) error

ResolveEvent resolves an action-required event.

func (*FeedService) RetryEvent added in v0.2.0

func (s *FeedService) RetryEvent(ctx context.Context, eventID string) error

RetryEvent retries a failed background task.

func (*FeedService) StreamInput added in v0.3.0

func (s *FeedService) StreamInput(ctx context.Context, req *FeedInputStreamRequest) (*http.Response, error)

StreamInput streams agent processing of feed input.

The caller owns the returned response body and must close it.

type FolderIngestResponse added in v0.3.0

type FolderIngestResponse struct {
	FolderName      string                 `json:"folder_name"`
	TotalIngested   int                    `json:"total_ingested"`
	TotalDuplicates int                    `json:"total_duplicates"`
	TotalErrors     int                    `json:"total_errors"`
	Results         []IngestSourceResponse `json:"results,omitempty"`
	Message         string                 `json:"message,omitempty"`
}

FolderIngestResponse is the response for folder upload and summary endpoints.

type FolderUploadFile added in v0.3.0

type FolderUploadFile struct {
	File         io.Reader `json:"-"`
	Filename     string    `json:"filename,omitempty"`
	RelativePath string    `json:"relative_path,omitempty"`
}

FolderUploadFile is one file in a multipart folder upload.

type GetThreadParams added in v0.4.0

type GetThreadParams struct {
	Limit   int    `json:"limit,omitempty"`
	Offset  int    `json:"offset,omitempty"`
	SpaceID string `json:"space_id,omitempty"`
}

GetThreadParams are query parameters for GET /threads/{id}.

type GetThreadResponse added in v0.4.0

type GetThreadResponse struct {
	Thread            Thread          `json:"thread"`
	Messages          []ThreadMessage `json:"messages,omitempty"`
	RelatedMemories   []Memory        `json:"related_memories,omitempty"`
	Entities          []string        `json:"entities,omitempty"`
	TotalMessages     int             `json:"total_messages,omitempty"`
	TotalTokens       int             `json:"total_tokens,omitempty"`
	CoveredMessageIDs []string        `json:"covered_message_ids,omitempty"`
}

GetThreadResponse is the response for GET /threads/{id}.

type GraphAnalysis

type GraphAnalysis struct {
	NodeCount        int                `json:"node_count"`
	EdgeCount        int                `json:"edge_count"`
	CommunityCount   int                `json:"community_count"`
	Communities      []Community        `json:"communities,omitempty"`
	CentralityScores map[string]float64 `json:"centrality_scores,omitempty"`
}

GraphAnalysis is the response body for GET /graph/analysis.

type GraphCapabilities added in v0.4.0

type GraphCapabilities struct {
	CommunityDetection   bool `json:"community_detection"`
	PagerankCalculation  bool `json:"pagerank_calculation"`
	UnifiedGraphAnalysis bool `json:"unified_graph_analysis"`
	LLMSummarization     bool `json:"llm_summarization"`
}

GraphCapabilities holds graph analysis feature flags.

type GraphData added in v0.2.0

type GraphData struct {
	Nodes               []GraphNode      `json:"nodes"`
	Edges               []GraphEdge      `json:"edges"`
	Communities         []map[string]any `json:"communities,omitempty"`
	CommunityHulls      []map[string]any `json:"community_hulls,omitempty"`
	VisualizationConfig map[string]any   `json:"visualization_config,omitempty"`
	Metadata            map[string]any   `json:"metadata,omitempty"`
}

GraphData is the visualization-ready graph response.

type GraphEdge added in v0.2.0

type GraphEdge struct {
	ID             string         `json:"id"`
	Source         string         `json:"source"`
	Target         string         `json:"target"`
	EdgeType       string         `json:"edge_type"`
	Weight         float64        `json:"weight,omitempty"`
	Label          string         `json:"label,omitempty"`
	RelevanceScore float64        `json:"relevance_score,omitempty"`
	Metadata       map[string]any `json:"metadata,omitempty"`
}

GraphEdge represents an edge in the graph visualization.

type GraphExpandParams added in v0.2.0

type GraphExpandParams struct {
	Depth   int    `json:"depth,omitempty"`
	Limit   int    `json:"limit,omitempty"`
	SpaceID string `json:"space_id,omitempty"`
}

GraphExpandParams are parameters for graph expand.

type GraphExploreParams added in v0.2.0

type GraphExploreParams struct {
	MemoryIDs string `json:"memory_ids"`
	Depth     int    `json:"depth,omitempty"`
	Limit     int    `json:"limit,omitempty"`
	SpaceID   string `json:"space_id,omitempty"`
}

GraphExploreParams are parameters for graph explore.

type GraphHealthResponse

type GraphHealthResponse struct {
	Status              string            `json:"status"`
	Error               string            `json:"error,omitempty"`
	AlgoExtensionLoaded bool              `json:"algo_extension_loaded"`
	DbConnection        string            `json:"db_connection,omitempty"`
	Capabilities        GraphCapabilities `json:"capabilities"`
	CheckedAt           string            `json:"checked_at,omitempty"`
}

GraphHealthResponse is the response body for GET /graph/health.

type GraphIntelligenceMessageRequest added in v0.2.0

type GraphIntelligenceMessageRequest struct {
	SessionID string `json:"session_id"`
	Message   string `json:"message"`
}

GraphIntelligenceMessageRequest is the request for POST /agent/graph-intelligence/message.

type GraphIntelligenceMessageResponse added in v0.2.0

type GraphIntelligenceMessageResponse struct {
	Response  string `json:"response"`
	SessionID string `json:"session_id"`
}

GraphIntelligenceMessageResponse is the response for POST /agent/graph-intelligence/message.

type GraphIntelligenceSession added in v0.2.0

type GraphIntelligenceSession struct {
	SessionID string `json:"session_id"`
	Status    string `json:"status"`
}

GraphIntelligenceSession is a graph intelligence session.

type GraphIntelligenceStatus added in v0.2.0

type GraphIntelligenceStatus struct {
	Running   bool   `json:"running"`
	SessionID string `json:"session_id,omitempty"`
}

GraphIntelligenceStatus is the response for GET /agent/graph-intelligence/status.

type GraphLivePreview added in v0.2.0

type GraphLivePreview struct {
	Node  GraphNode   `json:"node"`
	Edges []GraphEdge `json:"edges"`
}

GraphLivePreview is a live preview for a node.

type GraphLivePreviewGraphParams added in v0.3.0

type GraphLivePreviewGraphParams struct {
	NodeIDs      []string `json:"node_ids"`
	LimitPerSeed int      `json:"limit_per_seed,omitempty"`
	SpaceID      string   `json:"space_id,omitempty"`
}

GraphLivePreviewGraphParams are parameters for GET /graph/live-preview.

type GraphNode added in v0.2.0

type GraphNode struct {
	ID            string         `json:"id"`
	Label         string         `json:"label"`
	NodeType      string         `json:"node_type"`
	NodeSubtype   string         `json:"node_subtype,omitempty"`
	Size          float64        `json:"size,omitempty"`
	Color         string         `json:"color,omitempty"`
	Community     string         `json:"community,omitempty"`
	Importance    float64        `json:"importance,omitempty"`
	HopCount      int            `json:"hop_count,omitempty"`
	PagerankScore float64        `json:"pagerank_score,omitempty"`
	ThreadID      string         `json:"thread_id,omitempty"`
	Metadata      map[string]any `json:"metadata,omitempty"`
}

GraphNode represents a node in the graph visualization.

type GraphOverview added in v0.2.0

type GraphOverview struct {
	NodeCount      int     `json:"node_count"`
	EdgeCount      int     `json:"edge_count"`
	CommunityCount int     `json:"community_count"`
	MemoryCount    int     `json:"memory_count"`
	EntityCount    int     `json:"entity_count"`
	ThreadCount    int     `json:"thread_count"`
	AvgDegree      float64 `json:"avg_degree"`
}

GraphOverview is the response for GET /graph/overview.

type GraphSampleParams added in v0.2.0

type GraphSampleParams struct {
	Limit   int    `json:"limit,omitempty"`
	SpaceID string `json:"space_id,omitempty"`
}

GraphSampleParams are parameters for graph sample.

type GraphSearchParams added in v0.2.0

type GraphSearchParams struct {
	Query           string   `json:"query"`
	Limit           int      `json:"limit,omitempty"`
	Depth           int      `json:"depth,omitempty"`
	NodeTypes       []string `json:"node_types,omitempty"`
	EdgeTypes       []string `json:"edge_types,omitempty"`
	IncludeMetadata *bool    `json:"include_metadata,omitempty"`
	SpaceID         string   `json:"space_id,omitempty"`
}

GraphSearchParams are parameters for graph search.

type GraphService

type GraphService struct {
	// contains filtered or unexported fields
}

GraphService handles knowledge graph operations.

func (*GraphService) Analysis

func (s *GraphService) Analysis(ctx context.Context) (*GraphAnalysis, error)

Analysis returns comprehensive graph analysis including community and centrality metrics.

func (*GraphService) AugmentationState

func (s *GraphService) AugmentationState(ctx context.Context) (*AugmentationState, error)

AugmentationState returns current augmentation status and parameters.

func (*GraphService) CleanupOrphans

func (s *GraphService) CleanupOrphans(ctx context.Context) (*CleanupOrphansResponse, error)

CleanupOrphans removes orphaned entities from the graph.

func (*GraphService) FindOrphans

func (s *GraphService) FindOrphans(ctx context.Context) ([]Entity, error)

FindOrphans finds entities with no relationships.

func (*GraphService) Health

Health checks graph analysis service and algo extensions.

func (*GraphService) JobStatus

func (s *GraphService) JobStatus(ctx context.Context, jobID string) (*AugmentationJob, error)

JobStatus checks progress of a specific augmentation job.

func (*GraphService) ListJobs

func (s *GraphService) ListJobs(ctx context.Context, limit int) ([]AugmentationJob, error)

ListJobs lists recent augmentation jobs.

func (*GraphService) StartAugmentation

func (s *GraphService) StartAugmentation(ctx context.Context, req *StartAugmentationRequest) (*AugmentationJob, error)

StartAugmentation starts a background job (community detection, PageRank).

type GraphVisService added in v0.2.0

type GraphVisService struct {
	// contains filtered or unexported fields
}

GraphVisService handles graph visualization operations.

func (*GraphVisService) ExpandNode added in v0.2.0

func (s *GraphVisService) ExpandNode(ctx context.Context, nodeID string, params *GraphExpandParams) (*GraphData, error)

ExpandNode expands neighbors of a specific node.

func (*GraphVisService) ExploreGraph added in v0.2.0

func (s *GraphVisService) ExploreGraph(ctx context.Context, params *GraphExploreParams) (*GraphData, error)

ExploreGraph builds a neighborhood around one or more memory IDs with depth traversal.

func (*GraphVisService) Explorer added in v0.3.0

func (s *GraphVisService) Explorer(ctx context.Context) ([]byte, error)

Explorer returns the interactive graph explorer HTML.

func (*GraphVisService) GetCommunityMembers added in v0.2.0

func (s *GraphVisService) GetCommunityMembers(ctx context.Context, communityID string, limit int) (*GraphData, error)

GetCommunityMembers returns members of a specific community.

func (*GraphVisService) GetLivePreview added in v0.2.0

func (s *GraphVisService) GetLivePreview(ctx context.Context, nodeID string) (*GraphLivePreview, error)

GetLivePreview returns a live preview for a node.

func (*GraphVisService) GetLivePreviewGraph added in v0.3.0

func (s *GraphVisService) GetLivePreviewGraph(ctx context.Context, params *GraphLivePreviewGraphParams) (*GraphData, error)

GetLivePreviewGraph gets a compact merged graph for one or more seed nodes.

func (*GraphVisService) GetNodeDetails added in v0.2.0

func (s *GraphVisService) GetNodeDetails(ctx context.Context, nodeID string) (*GraphNode, error)

GetNodeDetails returns detailed information about a specific node.

func (*GraphVisService) GetOverview added in v0.2.0

func (s *GraphVisService) GetOverview(ctx context.Context) (*GraphOverview, error)

GetOverview returns a high-level graph overview.

func (*GraphVisService) SampleGraph added in v0.2.0

func (s *GraphVisService) SampleGraph(ctx context.Context, params *GraphSampleParams) (*GraphData, error)

SampleGraph gets a representative sample of graph data for visualization.

func (*GraphVisService) SearchGraph added in v0.2.0

func (s *GraphVisService) SearchGraph(ctx context.Context, params *GraphSearchParams) (*GraphData, error)

SearchGraph finds relevant content and builds visualization-ready graph data.

func (*GraphVisService) ShortestPath added in v0.2.0

func (s *GraphVisService) ShortestPath(ctx context.Context, sourceID, targetID string) (*GraphData, error)

ShortestPath finds the shortest path between two nodes.

type HealthCheck

type HealthCheck struct {
	Status                    string            `json:"status"`
	Version                   string            `json:"version"`
	Timestamp                 *time.Time        `json:"timestamp,omitempty"`
	DatabaseConnected         bool              `json:"database_connected"`
	ServicesReady             bool              `json:"services_ready"`
	BufferPoolExhausted       bool              `json:"buffer_pool_exhausted"`
	BufferPoolAutoEscalatedMB int               `json:"buffer_pool_auto_escalated_mb"`
	BufferPoolCurrentMB       int               `json:"buffer_pool_current_mb"`
	BufferPoolNextStartMB     int               `json:"buffer_pool_next_start_mb"`
	BufferPoolRestartRequired bool              `json:"buffer_pool_restart_required"`
	BufferPoolRestartReason   string            `json:"buffer_pool_restart_reason"`
	BufferPoolAutoMode        bool              `json:"buffer_pool_auto_mode"`
	BufferPoolSource          string            `json:"buffer_pool_source"`
	BufferPoolAutoFloorMB     int               `json:"buffer_pool_auto_floor_mb"`
	BufferPoolAutoCapMB       int               `json:"buffer_pool_auto_cap_mb"`
	PluginUpdates             []PluginUpdate    `json:"plugin_updates,omitempty"`
	ContentStore              *ContentStoreInfo `json:"content_store,omitempty"`
}

HealthCheck is the response body for GET /health.

type HealthService

type HealthService struct {
	// contains filtered or unexported fields
}

HealthService handles health check operations.

func (*HealthService) Check

func (s *HealthService) Check(ctx context.Context) (*HealthCheck, error)

Check performs a health check.

func (*HealthService) ForceCheckpoint

func (s *HealthService) ForceCheckpoint(ctx context.Context) error

ForceCheckpoint forces a database checkpoint to flush WAL to disk.

type ImportConfig added in v0.2.0

type ImportConfig struct {
	HiddenProjects      []string         `json:"hidden_projects,omitempty"`
	HiddenSessions      []string         `json:"hidden_sessions,omitempty"`
	AutoImportRules     []AutoImportRule `json:"auto_import_rules,omitempty"`
	WatcherEnabled      bool             `json:"watcher_enabled"`
	ShowHiddenByDefault bool             `json:"show_hidden_by_default"`
	DedupWindowSeconds  int              `json:"dedup_window_seconds,omitempty"`
	WatchedPlatforms    []string         `json:"watched_platforms,omitempty"`
	WatchedProjects     []string         `json:"watched_projects,omitempty"`
	CursorPollInterval  int              `json:"cursor_poll_interval,omitempty"`
}

ImportConfig is the response for GET /threads/import-config.

type ImportConversationRequest added in v0.2.0

type ImportConversationRequest struct {
	Path               string         `json:"path"`
	Source             string         `json:"source"` // "claude", "codex", "cursor", "opencode"
	SessionID          string         `json:"session_id,omitempty"`
	ThreadIDOverride   string         `json:"thread_id_override,omitempty"`
	Summary            string         `json:"summary,omitempty"`
	AutoCompact        bool           `json:"auto_compact,omitempty"`
	PreserveTimestamps *bool          `json:"preserve_timestamps,omitempty"`
	Workspace          string         `json:"workspace,omitempty"`
	Project            string         `json:"project,omitempty"`
	Metadata           map[string]any `json:"metadata,omitempty"`
}

ImportConversationRequest is the request for POST /threads/conversations/import.

type ImportConversationResponse added in v0.2.0

type ImportConversationResponse struct {
	Thread          Thread          `json:"thread"`
	Messages        []ThreadMessage `json:"messages,omitempty"`
	ImportSummary   string          `json:"import_summary,omitempty"`
	Warnings        []string        `json:"warnings,omitempty"`
	CreatedMemories []Memory        `json:"created_memories,omitempty"`
	SkippedMessages int             `json:"skipped_messages,omitempty"`
}

ImportConversationResponse is the response for POST /threads/conversations/import.

type ImportThreadItem added in v0.4.0

type ImportThreadItem struct {
	ThreadID        string                 `json:"thread_id,omitempty"`
	Title           string                 `json:"title,omitempty"`
	Messages        []MessageCreateRequest `json:"messages,omitempty"`
	MarkdownContent string                 `json:"markdown_content,omitempty"`
	Source          string                 `json:"source,omitempty"`
	Participants    []string               `json:"participants,omitempty"`
	Project         string                 `json:"project,omitempty"`
	Workspace       string                 `json:"workspace,omitempty"`
	ToolVersion     string                 `json:"tool_version,omitempty"`
	Metadata        map[string]any         `json:"metadata,omitempty"`
}

ImportThreadItem represents a single thread in an import request.

type ImportThreadResult added in v0.4.0

type ImportThreadResult struct {
	Success      bool   `json:"success"`
	ThreadID     string `json:"thread_id,omitempty"`
	Title        string `json:"title,omitempty"`
	MessageCount int    `json:"message_count,omitempty"`
	Error        string `json:"error,omitempty"`
}

ImportThreadResult is a single result in an import response.

type ImportThreadsRequest added in v0.2.0

type ImportThreadsRequest struct {
	ImportThreadItem
	Threads []ImportThreadItem `json:"threads,omitempty"` // batch mode
}

ImportThreadsRequest is the request for POST /threads/import.

type ImportThreadsResponse added in v0.2.0

type ImportThreadsResponse struct {
	Success       bool                 `json:"success"`
	ImportedCount int                  `json:"imported_count"`
	FailedCount   int                  `json:"failed_count"`
	Results       []ImportThreadResult `json:"results,omitempty"`
}

ImportThreadsResponse is the response for POST /threads/import.

type IngestByPathRequest

type IngestByPathRequest struct {
	FilePath string `json:"file_path"`
	SpaceID  string `json:"space_id,omitempty"`
}

IngestByPathRequest is the request body for POST /sources/ingest/file-path.

type IngestFileRequest

type IngestFileRequest struct {
	File        io.Reader `json:"-"`
	Filename    string    `json:"-"`
	UserComment string    `json:"user_comment,omitempty"`
	Labels      string    `json:"labels,omitempty"`
	Metadata    string    `json:"metadata,omitempty"`
	SpaceID     string    `json:"space_id,omitempty"`
}

IngestFileRequest is the multipart request body for POST /sources/ingest/file.

type IngestFolderSummaryRequest added in v0.2.0

type IngestFolderSummaryRequest struct {
	FolderName        string         `json:"folder_name"`
	AccumulatedTotals map[string]any `json:"accumulated_totals"`
	SpaceID           string         `json:"space_id,omitempty"`
}

IngestFolderSummaryRequest is the request for POST /sources/ingest/folder-summary.

type IngestFolderUploadRequest added in v0.2.0

type IngestFolderUploadRequest struct {
	Files             []FolderUploadFile `json:"-"`
	FolderName        string             `json:"folder_name"`
	FileManifest      string             `json:"file_manifest,omitempty"`
	UserComment       string             `json:"user_comment,omitempty"`
	Labels            string             `json:"labels,omitempty"`
	SpaceID           string             `json:"space_id,omitempty"`
	EmitFeedEvent     *bool              `json:"emit_feed_event,omitempty"`
	AccumulatedTotals string             `json:"accumulated_totals,omitempty"`
}

IngestFolderUploadRequest is the multipart request for POST /sources/ingest/folder-upload.

type IngestSourceResponse added in v0.3.0

type IngestSourceResponse struct {
	SourceID       string `json:"source_id"`
	OriginalName   string `json:"original_name"`
	LifecycleState string `json:"lifecycle_state"`
	IsDuplicate    bool   `json:"is_duplicate"`
	Message        string `json:"message,omitempty"`
}

IngestSourceResponse is one source ingestion result.

type IngestURLRequest

type IngestURLRequest struct {
	URL         string   `json:"url"`
	UserComment string   `json:"user_comment,omitempty"`
	Labels      []string `json:"labels,omitempty"`
	SpaceID     string   `json:"space_id,omitempty"`
}

IngestURLRequest is the request body for POST /sources/ingest/url.

type KGApplyRequest added in v0.2.0

type KGApplyRequest struct {
	Entities             []Entity     `json:"entities,omitempty"`
	Relationships        []KGRelation `json:"relationships,omitempty"`
	ExtractionConfidence *float64     `json:"extraction_confidence,omitempty"`
}

KGApplyRequest is the request for POST /memories/{id}/extract-kg/apply.

type KGApplyResponse added in v0.2.0

type KGApplyResponse struct {
	Success              bool   `json:"success"`
	MemoryID             string `json:"memory_id,omitempty"`
	EntitiesCreated      int    `json:"entities_created"`
	RelationshipsCreated int    `json:"relationships_created"`
	MetadataUpdated      bool   `json:"metadata_updated,omitempty"`
	Error                string `json:"error,omitempty"`
}

KGApplyResponse is the response for POST /memories/{id}/extract-kg/apply.

type KGExtractionRequest

type KGExtractionRequest struct {
	MemoryIDs []string `json:"memory_ids,omitempty"`
	Scope     string   `json:"scope,omitempty"`
}

KGExtractionRequest is the request body for POST /agent/trigger/kg-extraction.

type KGPreviewRequest added in v0.4.0

type KGPreviewRequest struct {
	ForceReextraction bool   `json:"force_reextraction,omitempty"`
	ExtractionLevel   string `json:"extraction_level,omitempty"`
	UseRemoteLLM      bool   `json:"use_remote_llm,omitempty"`
	PreferredLanguage string `json:"preferred_language,omitempty"`
}

KGPreviewRequest is the request for POST /memories/{id}/extract-kg/preview.

type KGPreviewResponse added in v0.2.0

type KGPreviewResponse struct {
	MemoryID             string       `json:"memory_id"`
	MemoryTitle          string       `json:"memory_title"`
	MemoryContent        string       `json:"memory_content"`
	Entities             []Entity     `json:"entities"`
	Relationships        []KGRelation `json:"relationships"`
	ExtractionConfidence float64      `json:"extraction_confidence"`
	EntitiesCount        int          `json:"entities_count"`
	RelationshipsCount   int          `json:"relationships_count"`
	KGAlreadyExtracted   bool         `json:"kg_already_extracted"`
	CanExtract           bool         `json:"can_extract"`
}

KGPreviewResponse is the response for POST /memories/{id}/extract-kg/preview.

type KGRelation added in v0.2.0

type KGRelation struct {
	SourceID   string  `json:"source_id"`
	TargetID   string  `json:"target_id"`
	RelType    string  `json:"rel_type"`
	Confidence float64 `json:"confidence,omitempty"`
}

KGRelation represents a relationship between entities.

type KGService added in v0.2.0

type KGService struct {
	// contains filtered or unexported fields
}

KGService handles knowledge graph extraction from memories.

func (*KGService) ApplyExtraction added in v0.2.0

func (s *KGService) ApplyExtraction(ctx context.Context, memoryID string, req *KGApplyRequest) (*KGApplyResponse, error)

ApplyExtraction saves extracted entities and relationships to the graph database.

func (*KGService) PreviewExtraction added in v0.2.0

func (s *KGService) PreviewExtraction(ctx context.Context, memoryID string, req *KGPreviewRequest) (*KGPreviewResponse, error)

PreviewExtraction previews KG extraction for a memory before applying.

type KnowledgeProcessingStatus added in v0.2.0

type KnowledgeProcessingStatus struct {
	Enabled bool   `json:"enabled"`
	Status  string `json:"status"`
	LastRun string `json:"last_run,omitempty"`
	NextRun string `json:"next_run,omitempty"`
}

KnowledgeProcessingStatus is the response for GET /agent/knowledge-processing/status.

type Label

type Label struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Color       string `json:"color,omitempty"`
	Description string `json:"description,omitempty"`
	CreatedAt   string `json:"created_at,omitempty"`
	UpdatedAt   string `json:"updated_at,omitempty"`
	UsageCount  int    `json:"usage_count,omitempty"`
}

Label represents a label/tag.

type LabelsService

type LabelsService struct {
	// contains filtered or unexported fields
}

LabelsService handles label operations.

func (*LabelsService) Create

func (s *LabelsService) Create(ctx context.Context, req *CreateLabelRequest) (*Label, error)

Create creates a new label.

func (*LabelsService) Delete

func (s *LabelsService) Delete(ctx context.Context, labelID string) error

Delete deletes a label and all its relationships.

func (*LabelsService) Get

func (s *LabelsService) Get(ctx context.Context, labelID string) (*Label, error)

Get returns a specific label by ID.

func (*LabelsService) List

func (s *LabelsService) List(ctx context.Context, params *ListLabelsParams) ([]Label, error)

List returns all labels with usage counts.

func (*LabelsService) Update

func (s *LabelsService) Update(ctx context.Context, labelID string, req *UpdateLabelRequest) (*Label, error)

Update updates an existing label.

type LibraryService added in v0.2.0

type LibraryService struct {
	// contains filtered or unexported fields
}

LibraryService handles library/wiki operations.

func (*LibraryService) ExportWiki added in v0.2.0

func (s *LibraryService) ExportWiki(ctx context.Context, format string) ([]byte, error)

ExportWiki exports wiki pages in the specified format.

func (*LibraryService) ExportWikiSummary added in v0.2.0

func (s *LibraryService) ExportWikiSummary(ctx context.Context) ([]byte, error)

ExportWikiSummary exports wiki summary.

func (*LibraryService) GetCrystalSourceMemories added in v0.2.0

func (s *LibraryService) GetCrystalSourceMemories(ctx context.Context, crystalID string, limit int) ([]MemoryListItem, error)

GetCrystalSourceMemories returns source memories for a crystal.

func (*LibraryService) GetWikiIndex added in v0.2.0

func (s *LibraryService) GetWikiIndex(ctx context.Context) (*WikiIndex, error)

GetWikiIndex returns the wiki index.

func (*LibraryService) GetWikiPageByCrystal added in v0.2.0

func (s *LibraryService) GetWikiPageByCrystal(ctx context.Context, crystalID string) (*WikiPage, error)

GetWikiPageByCrystal returns a wiki page for a crystal.

func (*LibraryService) GetWikiPageByEntity added in v0.2.0

func (s *LibraryService) GetWikiPageByEntity(ctx context.Context, idOrName string) (*WikiPage, error)

GetWikiPageByEntity returns a wiki page for an entity.

func (*LibraryService) GetWikiPageByTopic added in v0.2.0

func (s *LibraryService) GetWikiPageByTopic(ctx context.Context, communityID string) (*WikiPage, error)

GetWikiPageByTopic returns a wiki page for a topic/community.

type ListEntitiesParams

type ListEntitiesParams struct {
	Limit        int    `json:"limit,omitempty"`
	EntityType   string `json:"entity_type,omitempty"`
	IncludeStats bool   `json:"include_stats,omitempty"`
}

ListEntitiesParams are query parameters for GET /entities.

type ListLabelsParams

type ListLabelsParams struct {
	Limit     int    `json:"limit,omitempty"`
	OrderBy   string `json:"order_by,omitempty"`
	OrderDesc bool   `json:"order_desc,omitempty"`
}

ListLabelsParams are query parameters for GET /labels.

type ListMemoriesParams

type ListMemoriesParams struct {
	Limit         int     `json:"limit,omitempty"`
	Offset        int     `json:"offset,omitempty"`
	State         string  `json:"state,omitempty"`
	ImportanceMin float64 `json:"importance_min,omitempty"`
	SpaceID       string  `json:"space_id,omitempty"`
	IsCrystal     *bool   `json:"is_crystal,omitempty"`
}

ListMemoriesParams are query parameters for GET /memories.

type ListMemoriesResponse

type ListMemoriesResponse struct {
	Memories   []MemoryListItem `json:"memories"`
	Pagination Pagination       `json:"pagination"`
}

ListMemoriesResponse is the response body for GET /memories.

type ListSourcesParams

type ListSourcesParams struct {
	Limit          int    `json:"limit,omitempty"`
	Offset         int    `json:"offset,omitempty"`
	SourceType     string `json:"source_type,omitempty"`
	LifecycleState string `json:"lifecycle_state,omitempty"`
	SpaceID        string `json:"space_id,omitempty"`
}

ListSourcesParams are query parameters for GET /sources.

type ListSourcesResponse

type ListSourcesResponse struct {
	Sources []Source `json:"sources"`
	Total   int      `json:"total"`
}

ListSourcesResponse is the response body for GET /sources.

type ListSpacesResponse

type ListSpacesResponse struct {
	Enabled bool    `json:"enabled"`
	Spaces  []Space `json:"spaces"`
}

ListSpacesResponse is the response body for GET /spaces.

type ListThreadsParams

type ListThreadsParams struct {
	Limit   int    `json:"limit,omitempty"`
	Offset  int    `json:"offset,omitempty"`
	Source  string `json:"source,omitempty"`
	SpaceID string `json:"space_id,omitempty"`
}

ListThreadsParams are query parameters for GET /threads.

type ListThreadsResponse

type ListThreadsResponse struct {
	Threads    []ThreadListItem `json:"threads"`
	Pagination Pagination       `json:"pagination"`
}

ListThreadsResponse is the response body for GET /threads.

type LoadedModel added in v0.2.0

type LoadedModel struct {
	ModelType string `json:"model_type"`
	Device    string `json:"device"`
	MemoryMB  int    `json:"memory_mb"`
}

LoadedModel represents a model loaded in memory.

type MemoriesService

type MemoriesService struct {
	// contains filtered or unexported fields
}

MemoriesService handles memory CRUD operations.

func (*MemoriesService) AssignLabel

func (s *MemoriesService) AssignLabel(ctx context.Context, memoryID, labelID string) error

AssignLabel assigns a label to a memory.

func (*MemoriesService) BulkDelete

BulkDelete deletes selected memories.

func (*MemoriesService) BulkMove

BulkMove moves selected memories into another space.

func (*MemoriesService) BulkMovePreview

BulkMovePreview previews a bulk move between spaces.

func (*MemoriesService) Create

Create creates a new memory with automatic entity extraction.

func (*MemoriesService) Delete

func (s *MemoriesService) Delete(ctx context.Context, memoryID string, params *DeleteMemoryParams) (*DeleteMemoryResponse, error)

Delete deletes a memory and optionally its relationships.

func (*MemoriesService) Deprecate added in v0.4.0

func (s *MemoriesService) Deprecate(ctx context.Context, memoryID string, req *DeprecateMemoryRequest) error

Deprecate marks a memory as deprecated while preserving it for graph history.

func (*MemoriesService) Export

func (s *MemoriesService) Export(ctx context.Context, memoryID string, opts *ExportOptions) ([]byte, error)

Export exports a memory in the specified format (markdown, json, etc).

func (*MemoriesService) Get

func (s *MemoriesService) Get(ctx context.Context, memoryID string, spaceID string) (*MemoryListItem, error)

Get retrieves a specific memory by ID.

func (*MemoriesService) GetLabels

func (s *MemoriesService) GetLabels(ctx context.Context, memoryID string) ([]Label, error)

GetLabels returns labels assigned to a memory.

func (*MemoriesService) GetReindexStatus added in v0.2.0

func (s *MemoriesService) GetReindexStatus(ctx context.Context) (*MemoryReindexStatus, error)

GetReindexStatus returns status of memories needing reindex.

func (*MemoriesService) List

List returns memories with filtering and pagination.

func (*MemoriesService) Reindex added in v0.2.0

Reindex reindexes multiple memories or all needing reindex.

func (*MemoriesService) RemoveLabel

func (s *MemoriesService) RemoveLabel(ctx context.Context, memoryID, labelID string) error

RemoveLabel removes a label from a memory.

func (*MemoriesService) Search

Search performs a hybrid search across memories.

func (*MemoriesService) Supersede added in v0.4.0

func (s *MemoriesService) Supersede(ctx context.Context, memoryID string, req *SupersedeMemoryRequest) error

Supersede marks a memory as replaced by a newer memory.

func (*MemoriesService) ToggleFavorite

func (s *MemoriesService) ToggleFavorite(ctx context.Context, memoryID string) (*ToggleFavoriteResponse, error)

ToggleFavorite toggles favorite status for a memory.

func (*MemoriesService) Update

func (s *MemoriesService) Update(ctx context.Context, memoryID string, updates map[string]any) (*MemoryListItem, error)

Update updates memory properties like importance, title, and content.

type Memory

type Memory struct {
	ID                 string         `json:"id"`
	NodeType           string         `json:"node_type,omitempty"`
	CreatedAt          *time.Time     `json:"created_at,omitempty"`
	UpdatedAt          *time.Time     `json:"updated_at,omitempty"`
	Metadata           map[string]any `json:"metadata,omitempty"`
	Content            string         `json:"content"`
	Title              string         `json:"title,omitempty"`
	Importance         float64        `json:"importance,omitempty"`
	Confidence         float64        `json:"confidence,omitempty"`
	PagerankScore      float64        `json:"pagerank_score,omitempty"`
	Embedding          []float64      `json:"embedding,omitempty"`
	SourceRange        map[string]int `json:"source_range,omitempty"`
	Source             string         `json:"source,omitempty"`
	SpaceID            string         `json:"space_id,omitempty"`
	SemanticField      string         `json:"semantic_field,omitempty"`
	ReindexNeeded      bool           `json:"reindex_needed,omitempty"`
	LastReindexedAt    *time.Time     `json:"last_reindexed_at,omitempty"`
	LastAccessedAt     *time.Time     `json:"last_accessed_at,omitempty"`
	AccessCount        int            `json:"access_count,omitempty"`
	Appearances        int            `json:"appearances,omitempty"`
	Clicks             int            `json:"clicks,omitempty"`
	TotalDwellTimeMs   int            `json:"total_dwell_time_ms,omitempty"`
	LastClickedAt      *time.Time     `json:"last_clicked_at,omitempty"`
	DecayScoreCached   float64        `json:"decay_score_cached,omitempty"`
	TemporalContext    string         `json:"temporal_context,omitempty"`
	TemporalType       string         `json:"temporal_type,omitempty"`
	EventStart         string         `json:"event_start,omitempty"`
	EventEnd           string         `json:"event_end,omitempty"`
	TemporalPrecision  string         `json:"temporal_precision,omitempty"`
	TemporalConfidence float64        `json:"temporal_confidence,omitempty"`
	UnitType           string         `json:"unit_type,omitempty"`
	IsLatest           bool           `json:"is_latest,omitempty"`
	Version            int            `json:"version,omitempty"`
	IsCrystal          bool           `json:"is_crystal,omitempty"`
	CrystalTitle       string         `json:"crystal_title,omitempty"`
	SourceUnitCount    int            `json:"source_unit_count,omitempty"`
	ExtractionMethod   string         `json:"extraction_method,omitempty"`
	LastEvaluatedAt    *time.Time     `json:"last_evaluated_at,omitempty"`
	ReviewStatus       string         `json:"review_status,omitempty"`
}

Memory represents a memory node in the knowledge base.

type MemoryListItem

type MemoryListItem struct {
	ID           string         `json:"id"`
	Title        string         `json:"title,omitempty"`
	Content      string         `json:"content,omitempty"`
	Source       string         `json:"source,omitempty"`
	Time         string         `json:"time,omitempty"`
	Rating       float64        `json:"rating,omitempty"`
	LabelIDs     []string       `json:"label_ids,omitempty"`
	IsFavorite   bool           `json:"is_favorite,omitempty"`
	SourceThread *SourceThread  `json:"source_thread,omitempty"`
	Confidence   float64        `json:"confidence,omitempty"`
	SpaceID      string         `json:"space_id,omitempty"`
	Metadata     map[string]any `json:"metadata,omitempty"`
	UnitType     string         `json:"unit_type,omitempty"`
}

MemoryListItem is the summary view returned by list endpoints.

type MemoryReindexStatus added in v0.2.0

type MemoryReindexStatus struct {
	Total        int `json:"total"`
	NeedsReindex int `json:"needs_reindex"`
}

MemoryReindexStatus is the response for GET /memories/reindex/status.

type MessageCreateRequest

type MessageCreateRequest struct {
	Content string `json:"content"`
	Role    string `json:"role"`
}

MessageCreateRequest is a message in a create-thread request.

type ModelMemoryStatus added in v0.2.0

type ModelMemoryStatus struct {
	Loaded []LoadedModel `json:"loaded"`
}

ModelMemoryStatus is the response for GET /models/memory-status.

type ModelsService added in v0.2.0

type ModelsService struct {
	// contains filtered or unexported fields
}

ModelsService handles embedding model operations.

func (*ModelsService) GetEmbeddingModelStatus added in v0.2.0

func (s *ModelsService) GetEmbeddingModelStatus(ctx context.Context) (*EmbeddingModelStatus, error)

GetEmbeddingModelStatus checks the search embedding model status.

func (*ModelsService) GetMemoryStatus added in v0.2.0

func (s *ModelsService) GetMemoryStatus(ctx context.Context) (*ModelMemoryStatus, error)

GetMemoryStatus returns which models are currently loaded in memory.

func (*ModelsService) InstallEmbeddingModel added in v0.2.0

func (s *ModelsService) InstallEmbeddingModel(ctx context.Context) error

InstallEmbeddingModel downloads and installs the search embedding model.

func (*ModelsService) UnloadModel added in v0.2.0

func (s *ModelsService) UnloadModel(ctx context.Context, modelType string) error

UnloadModel manually unloads a model from memory.

type Option

type Option func(*Client)

Option configures the client.

func WithAPIKey added in v0.3.1

func WithAPIKey(apiKey string) Option

WithAPIKey sets the Nowledge Mem remote API key for every request.

This sends both supported header forms: Authorization: Bearer nmem_xxxx and X-NMEM-API-Key: nmem_xxxx.

func WithAPIKeyQuery added in v0.3.2

func WithAPIKeyQuery(apiKey string) Option

WithAPIKeyQuery sends nmem_api_key=nmem_xxxx on every request.

Prefer header authentication when possible. Use this for proxies or clients that strip custom headers.

func WithBaseURL

func WithBaseURL(rawURL string) Option

WithBaseURL overrides the default base URL.

func WithBearerToken added in v0.3.1

func WithBearerToken(token string) Option

WithBearerToken sets an Authorization: Bearer token header for every request.

Pass the raw token value, for example "nmem_xxxx". If the value already starts with "Bearer ", the prefix is stripped and normalized.

func WithHTTPClient

func WithHTTPClient(hc *http.Client) Option

WithHTTPClient overrides the default HTTP client.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout overrides the default HTTP timeout.

type Pagination

type Pagination struct {
	Limit   int  `json:"limit"`
	Offset  int  `json:"offset"`
	Total   int  `json:"total"`
	HasMore bool `json:"has_more"`
}

Pagination holds pagination metadata.

type ParseContentRequest added in v0.2.0

type ParseContentRequest struct {
	FileContent string `json:"file_content"`
	FileName    string `json:"file_name"`
}

ParseContentRequest is the request for POST /threads/parse.

type ParseContentResponse added in v0.2.0

type ParseContentResponse struct {
	Success        bool           `json:"success"`
	ParsedThread   map[string]any `json:"parsed_thread,omitempty"`
	FormatDetected string         `json:"format_detected,omitempty"`
	Error          string         `json:"error,omitempty"`
}

ParseContentResponse is the response for POST /threads/parse.

type PersistQuestionRequest added in v0.2.0

type PersistQuestionRequest struct {
	Question string `json:"question"`
	Response string `json:"response"`
	Source   string `json:"source,omitempty"`
}

PersistQuestionRequest is the request for POST /agent/feed/input/persist-question.

type PluginUpdate

type PluginUpdate struct {
	ID               string `json:"id"`
	Name             string `json:"name"`
	InstalledVersion string `json:"installed_version"`
	AvailableVersion string `json:"available_version"`
}

PluginUpdate represents an available plugin update.

type PreviewConversationRequest added in v0.2.0

type PreviewConversationRequest struct {
	Path      string `json:"path"`
	Source    string `json:"source"` // "claude", "codex", "cursor", "opencode"
	SessionID string `json:"session_id,omitempty"`
}

PreviewConversationRequest is the request for POST /threads/conversations/preview.

type PreviewConversationResponse added in v0.2.0

type PreviewConversationResponse struct {
	MessageCount    int              `json:"message_count"`
	PreviewMessages []PreviewMessage `json:"preview_messages,omitempty"`
}

PreviewConversationResponse is the response for POST /threads/conversations/preview.

type PreviewMessage added in v0.4.0

type PreviewMessage struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

PreviewMessage represents a single message in a conversation preview.

type ReindexRequest added in v0.2.0

type ReindexRequest struct {
	MemoryIDs []string `json:"memory_ids,omitempty"`
	All       bool     `json:"all,omitempty"`
}

ReindexRequest is the request for POST /memories/reindex.

type ReindexResponse added in v0.2.0

type ReindexResponse struct {
	Queued  int `json:"queued"`
	Skipped int `json:"skipped"`
}

ReindexResponse is the response for POST /memories/reindex.

type ReindexStatus added in v0.2.0

type ReindexStatus struct {
	Total      int `json:"total"`
	NeedsIndex int `json:"needs_index"`
}

ReindexStatus is the response for GET /search-index/reindex/status.

type ResolveEventRequest added in v0.2.0

type ResolveEventRequest struct {
	Resolution     string `json:"resolution"`           // "accepted", "dismissed", "merged"
	Action         string `json:"action,omitempty"`     // "delete_memory", "keep_newer", "keep_both"
	MemoryIDs      string `json:"memory_ids,omitempty"` // comma-separated
	ResolutionNote string `json:"resolution_note,omitempty"`
}

ResolveEventRequest is the request for POST /agent/feed/events/{id}/resolve.

type SaveSessionRequest added in v0.2.0

type SaveSessionRequest struct {
	Client               string `json:"client"` // "claude-code", "codex", "gemini-cli"
	ProjectPath          string `json:"project_path"`
	PersistMode          string `json:"persist_mode,omitempty"` // "current" or "all"
	SessionID            string `json:"session_id,omitempty"`
	Summary              string `json:"summary,omitempty"`
	TruncateLargeContent bool   `json:"truncate_large_content,omitempty"`
}

SaveSessionRequest is the request for POST /threads/sessions/save.

type SaveSessionResponse added in v0.2.0

type SaveSessionResponse struct {
	Status      string              `json:"status"`
	Client      string              `json:"client,omitempty"`
	ProjectPath string              `json:"project_path,omitempty"`
	PersistMode string              `json:"persist_mode,omitempty"`
	Results     []SaveSessionResult `json:"results,omitempty"`
	Error       string              `json:"error,omitempty"`
	Hint        string              `json:"hint,omitempty"`
}

SaveSessionResponse is the response for POST /threads/sessions/save.

type SaveSessionResult added in v0.4.0

type SaveSessionResult struct {
	Action        string `json:"action"`
	SessionID     string `json:"session_id,omitempty"`
	ThreadID      string `json:"thread_id,omitempty"`
	MessageCount  int    `json:"message_count,omitempty"`
	MessagesAdded int    `json:"messages_added,omitempty"`
	File          string `json:"file,omitempty"`
}

SaveSessionResult is a single result in a save-session response.

type SearchIndexService added in v0.2.0

type SearchIndexService struct {
	// contains filtered or unexported fields
}

SearchIndexService handles search index operations.

func (*SearchIndexService) GetReindexStatus added in v0.2.0

func (s *SearchIndexService) GetReindexStatus(ctx context.Context) (*ReindexStatus, error)

GetReindexStatus returns status of memories needing reindex.

func (*SearchIndexService) GetStatus added in v0.2.0

GetStatus returns status of LanceDB and hybrid search.

func (*SearchIndexService) Reindex added in v0.2.0

Reindex rebuilds the search index from the database.

type SearchIndexStatus added in v0.2.0

type SearchIndexStatus struct {
	Ready       bool   `json:"ready"`
	IndexType   string `json:"index_type"`
	VectorCount int    `json:"vector_count"`
	IndexPath   string `json:"index_path,omitempty"`
}

SearchIndexStatus is the response for GET /search-index/status.

type SearchMemoriesRequest

type SearchMemoriesRequest struct {
	Query            string   `json:"query"`
	Mode             string   `json:"mode,omitempty"`
	Limit            int      `json:"limit,omitempty"`
	SpaceID          string   `json:"space_id,omitempty"`
	FilterLabels     []string `json:"filter_labels,omitempty"`
	UnitType         string   `json:"unit_type,omitempty"`
	IncludeEntities  *bool    `json:"include_entities,omitempty"`
	EventDateFrom    string   `json:"event_date_from,omitempty"`
	EventDateTo      string   `json:"event_date_to,omitempty"`
	TemporalContext  string   `json:"temporal_context,omitempty"`
	RecordedDateFrom string   `json:"recorded_date_from,omitempty"`
	RecordedDateTo   string   `json:"recorded_date_to,omitempty"`
}

SearchMemoriesRequest is the request body for POST /memories/search.

type SearchMetadata added in v0.4.0

type SearchMetadata struct {
	Query                string `json:"query,omitempty"`
	Mode                 string `json:"mode,omitempty"`
	MatchedMessagesCount int    `json:"matched_messages_count,omitempty"`
	Error                string `json:"error,omitempty"`
}

SearchMetadata holds metadata returned by thread search.

type SearchReindexResponse added in v0.4.0

type SearchReindexResponse struct {
	Success            bool     `json:"success"`
	Memories           int      `json:"memories,omitempty"`
	Messages           int      `json:"messages,omitempty"`
	Sources            int      `json:"sources,omitempty"`
	SourceChunks       int      `json:"source_chunks,omitempty"`
	Communities        int      `json:"communities,omitempty"`
	Entities           int      `json:"entities,omitempty"`
	Errors             []string `json:"errors,omitempty"`
	Message            string   `json:"message,omitempty"`
	RestartRecommended bool     `json:"restart_recommended,omitempty"`
}

SearchReindexResponse is the response for POST /search-index/reindex.

type SearchResult

type SearchResult struct {
	Memory             Memory           `json:"memory"`
	SimilarityScore    float64          `json:"similarity_score"`
	RelevanceReason    string           `json:"relevance_reason,omitempty"`
	RelatedEntities    []Entity         `json:"related_entities,omitempty"`
	EvolvesContext     map[string]any   `json:"evolves_context,omitempty"`
	RelatedMemoryLinks []map[string]any `json:"related_memory_links,omitempty"`
}

SearchResult is a single search result.

type SearchThreadsParams added in v0.4.0

type SearchThreadsParams struct {
	Query   string `json:"query"`
	Mode    string `json:"mode,omitempty"` // "suggestions" or "full"
	Limit   int    `json:"limit,omitempty"`
	Source  string `json:"source,omitempty"`
	SpaceID string `json:"space_id,omitempty"`
}

SearchThreadsParams are query parameters for GET /threads/search.

type SearchThreadsResponse added in v0.4.0

type SearchThreadsResponse struct {
	Threads        []ThreadListItem `json:"threads"`
	TotalFound     int              `json:"total_found"`
	SearchMetadata SearchMetadata   `json:"search_metadata,omitempty"`
}

SearchThreadsResponse is the response for GET /threads/search.

type SettingsService added in v0.2.0

type SettingsService struct {
	// contains filtered or unexported fields
}

SettingsService handles settings operations.

func (*SettingsService) GetProfile added in v0.2.0

func (s *SettingsService) GetProfile(ctx context.Context) (*UserProfile, error)

GetProfile returns user profile, aliases, context, and preferred language.

type Source

type Source struct {
	ID             string         `json:"id"`
	SourceType     string         `json:"source_type,omitempty"`
	OriginalName   string         `json:"original_name,omitempty"`
	MimeType       string         `json:"mime_type,omitempty"`
	FilePath       string         `json:"file_path,omitempty"`
	ParsedPath     string         `json:"parsed_path,omitempty"`
	SourceURL      string         `json:"source_url,omitempty"`
	SHA256         string         `json:"sha256,omitempty"`
	SizeBytes      int64          `json:"size_bytes,omitempty"`
	Version        int            `json:"version,omitempty"`
	SpaceID        string         `json:"space_id,omitempty"`
	LifecycleState string         `json:"lifecycle_state,omitempty"`
	ChunkCount     int            `json:"chunk_count,omitempty"`
	MemoryCount    int            `json:"memory_count,omitempty"`
	SectionTree    string         `json:"section_tree,omitempty"`
	Summary        string         `json:"summary,omitempty"`
	ErrorMessage   string         `json:"error_message,omitempty"`
	CreatedAt      string         `json:"created_at,omitempty"`
	UpdatedAt      string         `json:"updated_at,omitempty"`
	Metadata       map[string]any `json:"metadata,omitempty"`
	LabelIDs       []string       `json:"label_ids,omitempty"`
}

Source represents a library source (file, URL, etc.).

type SourceThread

type SourceThread struct {
	ID      string `json:"id"`
	Title   string `json:"title,omitempty"`
	SpaceID string `json:"space_id,omitempty"`
}

SourceThread is a lightweight thread reference attached to a memory.

type SourcesService

type SourcesService struct {
	// contains filtered or unexported fields
}

SourcesService handles source/library operations.

func (*SourcesService) AssignLabel added in v0.2.0

func (s *SourcesService) AssignLabel(ctx context.Context, sourceID, labelID string) error

AssignLabel assigns a label to a source.

func (*SourcesService) BatchIngest

BatchIngest ingests a batch of files.

func (*SourcesService) Delete

func (s *SourcesService) Delete(ctx context.Context, sourceID string, spaceID string) error

Delete deletes a source and its search index records.

func (*SourcesService) Extract added in v0.2.0

func (s *SourcesService) Extract(ctx context.Context, sourceID string) error

Extract triggers knowledge extraction from a source.

func (*SourcesService) Get

func (s *SourcesService) Get(ctx context.Context, sourceID string) (*Source, error)

Get returns source detail with related memories and revision chain.

func (*SourcesService) GetContent

func (s *SourcesService) GetContent(ctx context.Context, sourceID string) (string, error)

GetContent reads the parsed markdown content of a source.

func (*SourcesService) GetImage added in v0.2.0

func (s *SourcesService) GetImage(ctx context.Context, sourceID, filename string) ([]byte, error)

GetImage serves an extracted image from a source.

func (*SourcesService) GetLabels added in v0.2.0

func (s *SourcesService) GetLabels(ctx context.Context, sourceID string) ([]Label, error)

GetLabels returns labels assigned to a source.

func (*SourcesService) GetRawFile added in v0.2.0

func (s *SourcesService) GetRawFile(ctx context.Context, sourceID string) ([]byte, error)

GetRawFile serves the raw source file for native preview.

func (*SourcesService) IngestByPath

IngestByPath ingests a file by local filesystem path.

func (*SourcesService) IngestFile

IngestFile ingests a file through the full source pipeline.

func (*SourcesService) IngestFolderSummary added in v0.2.0

IngestFolderSummary returns a summary of a folder before ingestion.

func (*SourcesService) IngestFolderUpload added in v0.2.0

IngestFolderUpload uploads a folder preserving relative paths.

func (*SourcesService) IngestURL

IngestURL fetches a URL and ingests through the source pipeline.

func (*SourcesService) List

List returns sources with optional filtering and pagination.

func (*SourcesService) Refetch added in v0.2.0

func (s *SourcesService) Refetch(ctx context.Context, sourceID string) (*Source, error)

Refetch re-fetches a URL source's content and re-parse.

func (*SourcesService) RemoveLabel added in v0.2.0

func (s *SourcesService) RemoveLabel(ctx context.Context, sourceID, labelID string) error

RemoveLabel removes a label from a source.

func (*SourcesService) Search

func (s *SourcesService) Search(ctx context.Context, query string, limit int) ([]Source, error)

Search performs full-text search across source names and content.

func (*SourcesService) Update

func (s *SourcesService) Update(ctx context.Context, sourceID string, req *UpdateSourceRequest, spaceID string) (*Source, error)

Update updates source processing state.

func (*SourcesService) UpdateContent added in v0.2.0

func (s *SourcesService) UpdateContent(ctx context.Context, sourceID, content string) error

UpdateContent updates the parsed markdown content of a source.

type Space

type Space struct {
	ID                   string      `json:"id"`
	Key                  string      `json:"key,omitempty"`
	Name                 string      `json:"name,omitempty"`
	Aliases              []string    `json:"aliases,omitempty"`
	Description          string      `json:"description,omitempty"`
	Icon                 string      `json:"icon,omitempty"`
	Instructions         string      `json:"instructions,omitempty"`
	SharedSpaceIDs       []string    `json:"sharedSpaceIds,omitempty"`
	DefaultRetrievalMode string      `json:"defaultRetrievalMode,omitempty"`
	Usage                *SpaceUsage `json:"usage,omitempty"`
	Observed             bool        `json:"observed,omitempty"`
	HasProfile           bool        `json:"hasProfile,omitempty"`
}

Space represents a space profile.

type SpaceUsage

type SpaceUsage struct {
	Memories         int  `json:"memories"`
	Threads          int  `json:"threads"`
	Sources          int  `json:"sources"`
	HasWorkingMemory bool `json:"hasWorkingMemory"`
}

SpaceUsage holds usage statistics for a space.

type SpacesConfigRequest added in v0.2.0

type SpacesConfigRequest struct {
	Enabled bool `json:"enabled"`
}

SpacesConfigRequest is the request for POST /spaces/config.

type SpacesService

type SpacesService struct {
	// contains filtered or unexported fields
}

SpacesService handles space operations.

func (*SpacesService) Create

func (s *SpacesService) Create(ctx context.Context, req *CreateSpaceRequest) (*Space, error)

Create creates a space profile.

func (*SpacesService) Delete

func (s *SpacesService) Delete(ctx context.Context, spaceID string, params *DeleteSpaceParams) (*ListSpacesResponse, error)

Delete removes an empty space profile.

func (*SpacesService) Get

func (s *SpacesService) Get(ctx context.Context, spaceID string) (*Space, error)

Get reads one space profile by name, alias, or hidden key.

func (*SpacesService) List

List returns the shared space roster.

func (*SpacesService) Roster added in v0.3.0

Roster returns the shared space roster.

func (*SpacesService) Update

func (s *SpacesService) Update(ctx context.Context, spaceID string, req *UpdateSpaceRequest) (*Space, error)

Update updates a space profile.

func (*SpacesService) UpdateConfig added in v0.2.0

func (s *SpacesService) UpdateConfig(ctx context.Context, req *SpacesConfigRequest) error

UpdateConfig enables or disables spaces at the product level.

type StartAugmentationRequest

type StartAugmentationRequest struct {
	JobType    string         `json:"job_type"`
	Parameters map[string]any `json:"parameters,omitempty"`
}

StartAugmentationRequest is the request body for POST /graph/augmentation/start.

type StorageInfo added in v0.2.0

type StorageInfo struct {
	GraphDBBytes     int64 `json:"graph_db_bytes"`
	SearchIndexBytes int64 `json:"search_index_bytes"`
	TotalBytes       int64 `json:"total_bytes"`
}

StorageInfo is the response for GET /storage/info.

type StorageService added in v0.2.0

type StorageService struct {
	// contains filtered or unexported fields
}

StorageService handles storage operations.

func (*StorageService) Info added in v0.2.0

func (s *StorageService) Info(ctx context.Context) (*StorageInfo, error)

Info returns on-disk sizes for the database and search index.

func (*StorageService) Optimize added in v0.2.0

func (s *StorageService) Optimize(ctx context.Context) error

Optimize compacts search index and flushes database changes.

type SupersedeMemoryRequest added in v0.4.0

type SupersedeMemoryRequest struct {
	NewerMemoryID string `json:"newer_memory_id"`
	Reason        string `json:"reason,omitempty"`
	SpaceID       string `json:"space_id,omitempty"`
}

SupersedeMemoryRequest is the request for POST /memories/{id}/supersede.

type Thread

type Thread struct {
	ID           string         `json:"id"`
	NodeType     string         `json:"node_type,omitempty"`
	CreatedAt    *time.Time     `json:"created_at,omitempty"`
	UpdatedAt    *time.Time     `json:"updated_at,omitempty"`
	Metadata     map[string]any `json:"metadata,omitempty"`
	ThreadID     string         `json:"thread_id"`
	Title        string         `json:"title,omitempty"`
	Summary      string         `json:"summary,omitempty"`
	MessageCount int            `json:"message_count,omitempty"`
	Participants []string       `json:"participants,omitempty"`
	Source       string         `json:"source,omitempty"`
	SpaceID      string         `json:"space_id,omitempty"`
	Project      string         `json:"project,omitempty"`
	Workspace    string         `json:"workspace,omitempty"`
	ToolVersion  string         `json:"tool_version,omitempty"`
	ImportDate   *time.Time     `json:"import_date,omitempty"`
}

Thread represents a conversation thread.

type ThreadBulkDeleteResponse added in v0.4.0

type ThreadBulkDeleteResponse struct {
	Message              string           `json:"message"`
	DeletedCount         int              `json:"deleted_count"`
	FailedCount          int              `json:"failed_count"`
	TotalDeletedMessages int              `json:"total_deleted_messages,omitempty"`
	TotalDeletedMemories int              `json:"total_deleted_memories,omitempty"`
	CascadeDeletion      bool             `json:"cascade_deletion,omitempty"`
	Results              []map[string]any `json:"results,omitempty"`
}

ThreadBulkDeleteResponse is the response for POST /threads/bulk/delete.

type ThreadBulkDeleteSelectionRequest added in v0.2.0

type ThreadBulkDeleteSelectionRequest struct {
	Selection             BulkThreadSelection `json:"selection"`
	CascadeDeleteMemories bool                `json:"cascade_delete_memories,omitempty"`
}

ThreadBulkDeleteSelectionRequest is the request for POST /threads/bulk/delete.

type ThreadBulkMovePreviewRequest added in v0.2.0

type ThreadBulkMovePreviewRequest struct {
	Selection     BulkThreadSelection `json:"selection"`
	TargetSpaceID string              `json:"target_space_id"`
}

ThreadBulkMovePreviewRequest is the request for POST /threads/bulk/move/preview.

type ThreadBulkMovePreviewResponse added in v0.2.0

type ThreadBulkMovePreviewResponse struct {
	Count         int              `json:"count"`
	MaxAllowed    int              `json:"max_allowed,omitempty"`
	LimitExceeded bool             `json:"limit_exceeded,omitempty"`
	SourceSpaceID string           `json:"source_space_id,omitempty"`
	TargetSpaceID string           `json:"target_space_id,omitempty"`
	SelectionMode string           `json:"selection_mode,omitempty"`
	ExcludedCount int              `json:"excluded_count,omitempty"`
	Conflicts     []map[string]any `json:"conflicts,omitempty"`
	Message       string           `json:"message,omitempty"`
}

ThreadBulkMovePreviewResponse is the response for POST /threads/bulk/move/preview.

type ThreadBulkMoveRequest added in v0.2.0

type ThreadBulkMoveRequest struct {
	Selection     BulkThreadSelection `json:"selection"`
	TargetSpaceID string              `json:"target_space_id"`
}

ThreadBulkMoveRequest is the request for POST /threads/bulk/move.

type ThreadBulkMoveResponse added in v0.2.0

type ThreadBulkMoveResponse struct {
	MovedCount    int              `json:"moved_count"`
	FailedCount   int              `json:"failed_count"`
	SourceSpaceID string           `json:"source_space_id,omitempty"`
	TargetSpaceID string           `json:"target_space_id,omitempty"`
	Conflicts     []map[string]any `json:"conflicts,omitempty"`
	Message       string           `json:"message,omitempty"`
}

ThreadBulkMoveResponse is the response for POST /threads/bulk/move.

type ThreadCoverage added in v0.2.0

type ThreadCoverage struct {
	ThreadID      string  `json:"thread_id"`
	MessageCount  int     `json:"message_count"`
	MemoryCount   int     `json:"memory_count"`
	CoverageRatio float64 `json:"coverage_ratio"`
	UncoveredMsgs int     `json:"uncovered_msgs"`
}

ThreadCoverage is the response for GET /threads/{id}/coverage.

type ThreadListItem

type ThreadListItem struct {
	ID         string `json:"id"`
	Title      string `json:"title,omitempty"`
	Summary    string `json:"summary,omitempty"`
	Source     string `json:"source,omitempty"`
	Messages   int    `json:"messages,omitempty"`
	Date       string `json:"date,omitempty"`
	IsFavorite bool   `json:"is_favorite,omitempty"`
	SpaceID    string `json:"space_id,omitempty"`
}

ThreadListItem is the summary view returned by list endpoints.

type ThreadMessage

type ThreadMessage struct {
	ID         string         `json:"id"`
	NodeType   string         `json:"node_type,omitempty"`
	CreatedAt  *time.Time     `json:"created_at,omitempty"`
	UpdatedAt  *time.Time     `json:"updated_at,omitempty"`
	Metadata   map[string]any `json:"metadata,omitempty"`
	Content    string         `json:"content"`
	Role       string         `json:"role"`
	OrderIndex int            `json:"order_index,omitempty"`
	Timestamp  *time.Time     `json:"timestamp,omitempty"`
	TokenCount int            `json:"token_count,omitempty"`
}

ThreadMessage represents a single message in a thread.

type ThreadSource added in v0.2.0

type ThreadSource struct {
	Source string `json:"source"`
	Count  int    `json:"count"`
}

ThreadSource represents a thread source.

type ThreadSummariesResponse added in v0.4.0

type ThreadSummariesResponse struct {
	Summaries []ThreadSummary `json:"summaries"`
}

ThreadSummariesResponse is the response for GET /threads/summaries.

type ThreadSummary

type ThreadSummary struct {
	ID      string `json:"id"`
	Title   string `json:"title"`
	Summary string `json:"summary"`
}

ThreadSummary is a lightweight thread summary.

type ThreadsService

type ThreadsService struct {
	// contains filtered or unexported fields
}

ThreadsService handles thread operations.

func (*ThreadsService) AppendMessages

func (s *ThreadsService) AppendMessages(ctx context.Context, threadID string, req *AppendMessagesRequest) (*AppendMessagesResponse, error)

AppendMessages appends messages to an existing thread.

func (*ThreadsService) BulkDelete

func (s *ThreadsService) BulkDelete(ctx context.Context, threadIDs []string) (*ThreadBulkDeleteResponse, error)

BulkDelete deletes multiple threads at once using POST (preferred over DELETE with body).

func (*ThreadsService) BulkDeleteSelection added in v0.2.0

BulkDeleteSelection deletes selected threads using a selector.

func (*ThreadsService) BulkMove added in v0.2.0

BulkMove moves selected threads into another space.

func (*ThreadsService) BulkMovePreview added in v0.2.0

BulkMovePreview previews a bulk move between spaces.

func (*ThreadsService) Create

Create creates a new thread with messages.

func (*ThreadsService) Delete

func (s *ThreadsService) Delete(ctx context.Context, threadID string, params *DeleteThreadParams) (*DeleteThreadResponse, error)

Delete deletes a thread and optionally its extracted memories.

func (*ThreadsService) DiscoverSessions added in v0.2.0

func (s *ThreadsService) DiscoverSessions(ctx context.Context, source string) (*DiscoverSessionsResponse, error)

DiscoverSessions scans for conversation files from AI assistants.

func (*ThreadsService) Export added in v0.2.0

func (s *ThreadsService) Export(ctx context.Context, threadID, format string) ([]byte, error)

Export exports a thread in various formats.

func (*ThreadsService) ExportRaw added in v0.2.0

func (s *ThreadsService) ExportRaw(ctx context.Context, req *ExportRawRequest) ([]byte, error)

ExportRaw exports a raw conversation file as markdown or JSON without importing.

func (*ThreadsService) Get

func (s *ThreadsService) Get(ctx context.Context, threadID string, params *GetThreadParams) (*GetThreadResponse, error)

Get retrieves a thread with messages and pagination.

func (*ThreadsService) GetCoverage added in v0.2.0

func (s *ThreadsService) GetCoverage(ctx context.Context, threadID string) (*ThreadCoverage, error)

GetCoverage returns a coverage report for debugging.

func (*ThreadsService) GetImportConfig added in v0.2.0

func (s *ThreadsService) GetImportConfig(ctx context.Context) (*ImportConfig, error)

GetImportConfig returns the current import configuration.

func (*ThreadsService) GetSources added in v0.2.0

func (s *ThreadsService) GetSources(ctx context.Context) ([]ThreadSource, error)

GetSources returns thread sources.

func (*ThreadsService) GetWatcherStatus added in v0.2.0

func (s *ThreadsService) GetWatcherStatus(ctx context.Context) (*WatcherStatus, error)

GetWatcherStatus returns the status of the session watcher.

func (*ThreadsService) HideProject added in v0.2.0

func (s *ThreadsService) HideProject(ctx context.Context, project string) error

HideProject hides a project from the browse view.

func (*ThreadsService) HideSession added in v0.2.0

func (s *ThreadsService) HideSession(ctx context.Context, sessionID string) error

HideSession hides a session from the browse view.

func (*ThreadsService) Import added in v0.2.0

Import imports threads from JSON messages or conversation markdown.

func (*ThreadsService) ImportConversation added in v0.2.0

ImportConversation imports an external conversation file.

func (*ThreadsService) List

List returns threads with filtering and pagination.

func (*ThreadsService) Parse added in v0.2.0

Parse parses thread content from various formats.

func (*ThreadsService) PreviewConversation added in v0.2.0

PreviewConversation loads a richer head-and-tail preview for one discovered conversation before import.

func (*ThreadsService) ReconcileTail added in v0.2.0

func (s *ThreadsService) ReconcileTail(ctx context.Context, threadID string) error

ReconcileTail reconciles the tail of a thread.

func (*ThreadsService) SaveSession added in v0.2.0

SaveSession saves coding sessions as conversation threads.

func (*ThreadsService) Search

Search performs full thread search with message matching.

func (*ThreadsService) StartWatcher added in v0.2.0

func (s *ThreadsService) StartWatcher(ctx context.Context) error

StartWatcher starts auto-importing sessions.

func (*ThreadsService) StopWatcher added in v0.2.0

func (s *ThreadsService) StopWatcher(ctx context.Context) error

StopWatcher stops the session watcher.

func (*ThreadsService) Summaries

func (s *ThreadsService) Summaries(ctx context.Context, spaceID string) (*ThreadSummariesResponse, error)

Summaries returns all thread titles and summaries.

func (*ThreadsService) ToggleFavorite

func (s *ThreadsService) ToggleFavorite(ctx context.Context, threadID string) (*ToggleFavoriteResponse, error)

ToggleFavorite toggles favorite status for a thread.

func (*ThreadsService) UnhideProject added in v0.2.0

func (s *ThreadsService) UnhideProject(ctx context.Context, project string) error

UnhideProject unhides a project.

func (*ThreadsService) UnhideSession added in v0.2.0

func (s *ThreadsService) UnhideSession(ctx context.Context, sessionID string) error

UnhideSession unhides a session.

func (*ThreadsService) UpdateImportConfig added in v0.2.0

func (s *ThreadsService) UpdateImportConfig(ctx context.Context, req *UpdateImportConfigRequest) error

UpdateImportConfig updates import configuration.

type ToggleFavoriteResponse

type ToggleFavoriteResponse struct {
	IsFavorite bool `json:"is_favorite"`
}

ToggleFavoriteResponse is the response for POST /memories/{id}/favorite.

type TriageRequest added in v0.2.0

type TriageRequest struct {
	ThreadID          string  `json:"thread_id"`
	ThreadContent     *string `json:"thread_content,omitempty"`
	PreferredLanguage *string `json:"preferred_language,omitempty"`
}

TriageRequest is the request for POST /memories/distill/triage.

type TriageResponse added in v0.2.0

type TriageResponse struct {
	Worthy     bool    `json:"worthy"`
	Reason     string  `json:"reason,omitempty"`
	Confidence float64 `json:"confidence,omitempty"`
}

TriageResponse is the response for POST /memories/distill/triage.

type UpdateImportConfigRequest added in v0.2.0

type UpdateImportConfigRequest struct {
	HiddenProjects      *[]string         `json:"hidden_projects,omitempty"`
	HiddenSessions      *[]string         `json:"hidden_sessions,omitempty"`
	AutoImportRules     *[]AutoImportRule `json:"auto_import_rules,omitempty"`
	WatcherEnabled      *bool             `json:"watcher_enabled,omitempty"`
	ShowHiddenByDefault *bool             `json:"show_hidden_by_default,omitempty"`
	DedupWindowSeconds  *int              `json:"dedup_window_seconds,omitempty"`
	WatchedPlatforms    *[]string         `json:"watched_platforms,omitempty"`
	WatchedProjects     *[]string         `json:"watched_projects,omitempty"`
	CursorPollInterval  *float64          `json:"cursor_poll_interval,omitempty"`
}

UpdateImportConfigRequest is the request for PUT /threads/import-config.

type UpdateLabelRequest

type UpdateLabelRequest struct {
	Name        string `json:"name,omitempty"`
	Color       string `json:"color,omitempty"`
	Description string `json:"description,omitempty"`
}

UpdateLabelRequest is the request body for PUT /labels/{id}.

type UpdateSourceRequest

type UpdateSourceRequest struct {
	Action string `json:"action"` // "reparse", "ocr_reparse", "mark_stale"
}

UpdateSourceRequest is the request body for PATCH /sources/{id}.

type UpdateSpaceRequest

type UpdateSpaceRequest struct {
	Name                 *string  `json:"name,omitempty"`
	Description          *string  `json:"description,omitempty"`
	Icon                 *string  `json:"icon,omitempty"`
	Instructions         *string  `json:"instructions,omitempty"`
	SharedSpaceIds       []string `json:"sharedSpaceIds,omitempty"`
	DefaultRetrievalMode *string  `json:"defaultRetrievalMode,omitempty"`
}

UpdateSpaceRequest is the request body for PATCH /spaces/{id}.

type UpdateWorkingMemoryRequest added in v0.2.0

type UpdateWorkingMemoryRequest struct {
	Content string `json:"content"`
	SpaceID string `json:"space_id,omitempty"`
}

UpdateWorkingMemoryRequest is the request for PUT /agent/working-memory.

type UpgradeInfo added in v0.2.0

type UpgradeInfo struct {
	Available      bool   `json:"available"`
	CurrentVersion string `json:"current_version"`
	LatestVersion  string `json:"latest_version,omitempty"`
	DownloadURL    string `json:"download_url,omitempty"`
	ReleaseNotes   string `json:"release_notes,omitempty"`
}

UpgradeInfo is the response for GET /admin/upgrade/check.

type UploadImportRequest added in v0.3.0

type UploadImportRequest struct {
	File                        io.Reader `json:"-"`
	Filename                    string    `json:"-"`
	Mode                        string    `json:"mode,omitempty"`
	IncludeMemories             *bool     `json:"include_memories,omitempty"`
	IncludeThreads              *bool     `json:"include_threads,omitempty"`
	IncludeMessages             *bool     `json:"include_messages,omitempty"`
	IncludeEntities             *bool     `json:"include_entities,omitempty"`
	IncludeLabels               *bool     `json:"include_labels,omitempty"`
	IncludeSources              *bool     `json:"include_sources,omitempty"`
	IncludeCommunities          *bool     `json:"include_communities,omitempty"`
	IncludeSkills               *bool     `json:"include_skills,omitempty"`
	IncludeEdges                *bool     `json:"include_edges,omitempty"`
	IncludeWorkingMemory        *bool     `json:"include_working_memory,omitempty"`
	IncludeWorkingMemoryArchive *bool     `json:"include_working_memory_archive,omitempty"`
	IncludeSourceFiles          *bool     `json:"include_source_files,omitempty"`
}

UploadImportRequest is the request for POST /data/import/upload.

type UserProfile added in v0.2.0

type UserProfile struct {
	Name               string `json:"name"`
	Aliases            string `json:"aliases"`
	Context            string `json:"context"`
	PreferredLanguage  string `json:"preferred_language"`
	CustomInstructions string `json:"custom_instructions"`
}

UserProfile is the response for GET /settings/profile.

type WatcherStatus added in v0.2.0

type WatcherStatus struct {
	Running   bool   `json:"running"`
	LastScan  string `json:"last_scan,omitempty"`
	ScanCount int    `json:"scan_count"`
}

WatcherStatus is the response for GET /threads/watcher/status.

type WikiIndex added in v0.2.0

type WikiIndex struct {
	Pages []WikiIndexEntry `json:"pages"`
}

WikiIndex is the response for GET /library/wiki-index.

type WikiIndexEntry added in v0.2.0

type WikiIndexEntry struct {
	ID    string `json:"id"`
	Title string `json:"title"`
	Type  string `json:"type"`
}

WikiIndexEntry is a single entry in the wiki index.

type WikiPage added in v0.2.0

type WikiPage struct {
	ID       string         `json:"id"`
	Title    string         `json:"title"`
	Content  string         `json:"content"`
	Type     string         `json:"type"`
	Metadata map[string]any `json:"metadata,omitempty"`
}

WikiPage represents a wiki page.

type WorkingMemory added in v0.2.0

type WorkingMemory struct {
	Date    string `json:"date"`
	Content string `json:"content"`
}

WorkingMemory is the response for GET /agent/working-memory.

type WorkingMemoryService added in v0.2.0

type WorkingMemoryService struct {
	// contains filtered or unexported fields
}

WorkingMemoryService handles working memory operations.

func (*WorkingMemoryService) Get added in v0.2.0

func (s *WorkingMemoryService) Get(ctx context.Context, date string, spaceID string) (*WorkingMemory, error)

Get reads the Working Memory file (today's or an archived day).

func (*WorkingMemoryService) History added in v0.2.0

func (s *WorkingMemoryService) History(ctx context.Context, limit int, spaceID string) ([]string, error)

History lists dates with archived Working Memory files.

func (*WorkingMemoryService) Update added in v0.2.0

Update writes the Working Memory file from user edits.

Jump to

Keyboard shortcuts

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