nowledgemem

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 13 Imported by: 0

README

Nowledge Mem Go SDK

Go client library for the Nowledge Mem REST API. The complete generated client tracks the official OpenAPI document.

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
client.Data Data export/import, async transfer job status, checkpoints

Complete generated client

The openapi subpackage contains types and methods generated for every operation in the upstream API. The existing service client remains available as the concise, backward-compatible API for common workflows.

import api "github.com/lib-x/nowledgemem-go/openapi"

client, err := api.NewClientWithResponses("http://127.0.0.1:14242")
if err != nil {
    log.Fatal(err)
}

resp, err := client.HealthCheckHealthGetWithResponse(ctx)
if err != nil {
    log.Fatal(err)
}
fmt.Println(resp.Status())

To reproduce the generated client from the checked-in specification snapshot:

go generate ./openapi

To explicitly refresh the snapshot from the official API and regenerate:

go run ./internal/cmd/openapi-sync -update \
    -spec openapi/openapi.json \
    -output openapi/client.gen.go \
    -package openapi

The sync command rejects external $ref values and unreviewed path-parameter mismatches. It applies only the two documented corrections currently required by the upstream OpenAPI 3.1 document. The module and its pinned generator use Go 1.27 or newer.

Data Export Jobs

POST /data/export supports synchronous exports by default. Set Async to true to start a background export and poll its status:

start, err := client.Data.Export(ctx, &mem.DataExportRequest{
    ExportPath: "/tmp/nowledge-export.zip",
    Async:      true,
})
if err != nil {
    log.Fatal(err)
}

status, err := client.Data.ExportStatus(ctx, start.JobID)
if err != nil {
    log.Fatal(err)
}
fmt.Println("Export status:", status.Status)

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 returned by 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 AgentProfilePayload added in v0.5.0

type AgentProfilePayload struct {
	ID             *string   `json:"id,omitempty"`
	DisplayName    *string   `json:"displayName,omitempty"`
	Role           *string   `json:"role,omitempty"`
	Description    *string   `json:"description,omitempty"`
	Instructions   *string   `json:"instructions,omitempty"`
	DefaultSpaceID *string   `json:"defaultSpaceId,omitempty"`
	SourceApp      *string   `json:"sourceApp,omitempty"`
	HostAgentID    *string   `json:"hostAgentId,omitempty"`
	Tags           *[]string `json:"tags,omitempty"`
}

AgentProfilePayload is the request body for agent profile create and update operations.

type AgentProfileResponse added in v0.5.0

type AgentProfileResponse struct {
	ID             string   `json:"id"`
	DisplayName    string   `json:"displayName"`
	Role           string   `json:"role,omitempty"`
	Description    string   `json:"description,omitempty"`
	Instructions   string   `json:"instructions,omitempty"`
	DefaultSpaceID string   `json:"defaultSpaceId,omitempty"`
	SourceApp      string   `json:"sourceApp,omitempty"`
	HostAgentID    string   `json:"hostAgentId,omitempty"`
	Tags           []string `json:"tags,omitempty"`
}

AgentProfileResponse represents a named long-running agent identity.

type AgentProfilesResponse added in v0.5.0

type AgentProfilesResponse struct {
	AgentProfiles []AgentProfileResponse `json:"agentProfiles,omitempty"`
}

AgentProfilesResponse is the response for GET /settings/agent-profiles.

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) CancelKnowledgeProcessingTask added in v0.5.0

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

CancelKnowledgeProcessingTask cancels a queued or running processing task.

POST /agent/knowledge-processing/tasks/cancel

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) DryRunRuleReview added in v0.5.0

func (s *AgentService) DryRunRuleReview(ctx context.Context, params *RuleReviewDryRunParams) (map[string]any, error)

DryRunRuleReview previews a guidance rule review without applying changes.

GET /agent/trigger/rule-review/dry-run

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) GetTokenUsage added in v0.5.0

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

GetTokenUsage returns token usage summary for background agents.

GET /agent/token-usage

func (*AgentService) PlanCommunityDetection added in v0.5.0

func (s *AgentService) PlanCommunityDetection(ctx context.Context, params *CommunityDetectionPlanParams) (map[string]any, error)

PlanCommunityDetection returns a read-only community detection plan.

GET /agent/trigger/community-detection/plan

func (*AgentService) PlanKGExtraction added in v0.5.0

func (s *AgentService) PlanKGExtraction(ctx context.Context, params *KGExtractionPlanParams) (map[string]any, error)

PlanKGExtraction returns a read-only KG extraction backfill plan.

GET /agent/trigger/kg-extraction/plan

func (*AgentService) PlanMemoryCompaction added in v0.5.0

func (s *AgentService) PlanMemoryCompaction(ctx context.Context, params *MemoryCompactionPlanParams) (map[string]any, error)

PlanMemoryCompaction returns a read-only memory compaction plan.

GET /agent/trigger/memory-compaction/plan

func (*AgentService) PlanMemoryCreated added in v0.5.0

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

PlanMemoryCreated returns a read-only plan for memory-created events.

GET /agent/trigger/memory-created/plan

func (*AgentService) PlanScheduledContext added in v0.5.0

func (s *AgentService) PlanScheduledContext(ctx context.Context, taskType, spaceID string) (map[string]any, error)

PlanScheduledContext returns planned context for a scheduled task type.

GET /agent/trigger/{task_type}/context-plan

func (*AgentService) PlanThreadSynced added in v0.5.0

func (s *AgentService) PlanThreadSynced(ctx context.Context, maxTasks int) (map[string]any, error)

PlanThreadSynced returns a read-only plan for thread-synced events.

GET /agent/trigger/thread-synced/plan

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) SkillBuilderChat added in v0.5.0

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

SkillBuilderChat sends a skill builder chat turn.

POST /agent/skill-builder/chat

func (*AgentService) SkillBuilderDiscoverImportable added in v0.5.0

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

SkillBuilderDiscoverImportable returns importable skill folders.

GET /agent/skill-builder/discover-importable

func (*AgentService) SkillBuilderEditBody added in v0.5.0

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

SkillBuilderEditBody updates a skill body directly.

POST /agent/skill-builder/edit-body

func (*AgentService) SkillBuilderImport added in v0.5.0

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

SkillBuilderImport imports a skill into managed scope.

POST /agent/skill-builder/import

func (*AgentService) SkillBuilderPreviewImportable added in v0.5.0

func (s *AgentService) SkillBuilderPreviewImportable(ctx context.Context, path string) (map[string]any, error)

SkillBuilderPreviewImportable previews an importable skill path.

GET /agent/skill-builder/preview-importable

func (*AgentService) SkillBuilderPropose added in v0.5.0

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

SkillBuilderPropose asks the skill builder to propose a skill draft.

POST /agent/skill-builder/propose

func (*AgentService) SkillBuilderRefine added in v0.5.0

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

SkillBuilderRefine refines a compiled skill.

POST /agent/skill-builder/refine

func (*AgentService) SkillBuilderRefineStream added in v0.5.0

func (s *AgentService) SkillBuilderRefineStream(ctx context.Context, req *SkillRefineRequest) (*http.Response, error)

SkillBuilderRefineStream streams skill refinement output.

POST /agent/skill-builder/refine/stream

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) TriggerLabelConsolidation added in v0.5.0

func (s *AgentService) TriggerLabelConsolidation(ctx context.Context, dryRun *bool) (map[string]any, error)

TriggerLabelConsolidation starts label consolidation.

POST /agent/trigger/label-consolidation

func (*AgentService) TriggerMemoryCompaction

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

TriggerMemoryCompaction triggers a memory compaction review.

func (*AgentService) TriggerRuleReview added in v0.5.0

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

TriggerRuleReview starts guidance rule review.

POST /agent/trigger/rule-review

func (*AgentService) TriggerSkillCompile added in v0.5.0

func (s *AgentService) TriggerSkillCompile(ctx context.Context, skillID string) (map[string]any, error)

TriggerSkillCompile starts skill compile.

POST /agent/trigger/skill-compile

func (*AgentService) TriggerSkillReview added in v0.5.0

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

TriggerSkillReview starts skill review.

POST /agent/trigger/skill-review

func (*AgentService) TriggerUnitTypeReclassification added in v0.5.0

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

TriggerUnitTypeReclassification starts or previews unit type reclassification.

POST /agent/trigger/unit-type-reclassification

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 for the agent status endpoint.

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 holds the body for appending messages to a thread.

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 contains the result of appending messages to a thread.

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 a graph 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 from AugmentationState (GET /graph/augmentation/state).

type AuthorSkillRequest added in v0.5.0

type AuthorSkillRequest struct {
	Name      string   `json:"name"`
	Note      *string  `json:"note,omitempty"`
	MemoryIDs []string `json:"memory_ids,omitempty"`
	ThreadIDs []string `json:"thread_ids,omitempty"`
	SourceIDs []string `json:"source_ids,omitempty"`
}

AuthorSkillRequest is the request for POST /skills/author.

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 configuration.

type BatchIngestFile added in v0.4.0

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

BatchIngestFile represents a single file entry in a BatchIngestRequest.

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 BatchIngest (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 from BatchIngest (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 BulkDeleteThreadsParams added in v0.5.0

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

BulkDeleteThreadsParams are query parameters for DeleteBulk.

type BulkDeleteThreadsRequest added in v0.5.0

type BulkDeleteThreadsRequest struct {
	ThreadIDs []string `json:"thread_ids"`
}

BulkDeleteThreadsRequest is the request body for DeleteBulk.

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 is a descriptor for selecting memories in 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 describes a set of threads to operate on in bulk operations.

type CancelKnowledgeProcessingTaskRequest added in v0.5.0

type CancelKnowledgeProcessingTaskRequest struct {
	TaskID   *string `json:"task_id,omitempty"`
	TaskType *string `json:"task_type,omitempty"`
}

CancelKnowledgeProcessingTaskRequest is the request for POST /agent/knowledge-processing/tasks/cancel.

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 from CleanupOrphans (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
	Skills        *SkillsService
	Context       *ContextService
	// 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 detected in the graph.

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 CommunityDetectionPlanParams added in v0.5.0

type CommunityDetectionPlanParams struct {
	Resolution        float64 `json:"resolution,omitempty"`
	GenerateAISummary *bool   `json:"generate_ai_summary,omitempty"`
	ScanLimit         int     `json:"scan_limit,omitempty"`
}

CommunityDetectionPlanParams are query parameters for PlanCommunityDetection.

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 ContextBundleParams added in v0.5.0

type ContextBundleParams struct {
	AgentID              string `json:"agent_id,omitempty"`
	SourceApp            string `json:"source_app,omitempty"`
	HostAgentID          string `json:"host_agent_id,omitempty"`
	SpaceID              string `json:"space_id,omitempty"`
	IncludeWorkingMemory *bool  `json:"include_working_memory,omitempty"`
}

ContextBundleParams are query parameters for GetBundle.

type ContextService added in v0.5.0

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

ContextService handles context bundle operations.

func (*ContextService) GetBundle added in v0.5.0

func (s *ContextService) GetBundle(ctx context.Context, params *ContextBundleParams) (map[string]any, error)

GetBundle returns a merged context bundle for an agent or space.

GET /context/bundle

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 Create (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 creating a new memory.

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 after creating a memory, including extracted entities.

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 Create (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 creating a new thread.

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 after creating a thread.

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 DownloadExport (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"`
	Async                       bool   `json:"async,omitempty"`
	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 Export (POST /data/export).

type DataExportResponse added in v0.2.0

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

	Success      bool           `json:"success,omitempty"`
	ExportID     string         `json:"export_id,omitempty"`
	Format       string         `json:"format,omitempty"`
	Version      int64          `json:"version,omitempty"`
	CreatedAt    string         `json:"created_at,omitempty"`
	Counts       map[string]any `json:"counts,omitempty"`
	Warnings     []string       `json:"warnings,omitempty"`
	ExportDir    *string        `json:"export_dir,omitempty"`
	ExportPath   *string        `json:"export_path,omitempty"`
	ManifestPath *string        `json:"manifest_path,omitempty"`

	JobID   string `json:"job_id,omitempty"`
	Status  string `json:"status,omitempty"`
	Message string `json:"message,omitempty"`
}

DataExportResponse is the response from Export (POST /data/export).

The API returns sync export result fields when async is false and job start fields when async is true. Legacy path/size fields are kept for older servers.

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 Import (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"`
	Success bool   `json:"success,omitempty"`
}

DataImportResponse is the response from Import and UploadImport.

type DataImportStatus added in v0.2.0

type DataImportStatus = DataTransferStatus

DataImportStatus is kept as an alias for ImportStatus callers.

type DataService added in v0.2.0

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

DataService handles data export and import operations.

It provides methods for exporting data to archives, importing from previous exports, and forcing database checkpoints.

func (*DataService) Checkpoint added in v0.2.0

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

Checkpoint forces a database checkpoint.

POST /data/checkpoint

func (*DataService) CheckpointResult added in v0.5.1

func (s *DataService) CheckpointResult(ctx context.Context) (*DataTransferCheckpointResponse, error)

CheckpointResult forces a database checkpoint and returns the API response.

POST /data/checkpoint

func (*DataService) DownloadExport added in v0.2.0

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

DownloadExport exports data as a downloadable ZIP file.

POST /data/export/download

func (*DataService) Export added in v0.2.0

Export exports data to a portable archive at a server-side path.

POST /data/export

func (*DataService) ExportStatus added in v0.5.1

func (s *DataService) ExportStatus(ctx context.Context, jobID string) (*DataTransferStatus, error)

ExportStatus checks status of a background data export job.

GET /data/export/status/{id}

func (*DataService) Import added in v0.2.0

Import imports data from a previous export at a server-side path.

POST /data/import

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.

GET /data/import/status/{id}

func (*DataService) UploadImport added in v0.2.0

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

UploadImport imports data from an uploaded ZIP file.

POST /data/import/upload

type DataTransferCheckpointResponse added in v0.5.1

type DataTransferCheckpointResponse struct {
	Success      bool    `json:"success"`
	Checkpointed bool    `json:"checkpointed"`
	Detail       *string `json:"detail,omitempty"`
}

DataTransferCheckpointResponse is the response from CheckpointResult.

type DataTransferStatus added in v0.5.1

type DataTransferStatus struct {
	JobID       string         `json:"job_id"`
	Status      string         `json:"status"`
	Kind        *string        `json:"kind,omitempty"`
	Result      map[string]any `json:"result,omitempty"`
	StartedAt   *string        `json:"started_at,omitempty"`
	CompletedAt *string        `json:"completed_at,omitempty"`
	Error       *string        `json:"error,omitempty"`

	// Older servers returned progress counters at the top level.
	Progress float64 `json:"progress,omitempty"`
	Imported int     `json:"imported,omitempty"`
	Skipped  int     `json:"skipped,omitempty"`
	Failed   int     `json:"failed,omitempty"`
	Message  string  `json:"message,omitempty"`
}

DataTransferStatus is the response from import/export status endpoints.

type DeleteMemoryParams

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

DeleteMemoryParams holds query parameters for deleting a memory.

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 after deleting a memory.

type DeleteSpaceParams added in v0.4.0

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

DeleteSpaceParams are query parameters for Delete (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 holds query parameters for deleting a thread.

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 contains the result of deleting a thread.

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 contains discovered conversation sessions grouped by source.

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 conversation session discovered by the scanner.

type DismissSkillRequest added in v0.5.0

type DismissSkillRequest struct {
	RejectionReason *string `json:"rejection_reason,omitempty"`
	ResurfaceRule   *string `json:"resurface_rule,omitempty"`
}

DismissSkillRequest is the request for POST /skills/{skill_id}/dismiss.

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 provides methods for creating memories from conversation threads.

func (*DistillationService) BatchPlan added in v0.5.0

BatchPlan creates a read-only distillation plan for a bulk thread selection. (POST /memories/distill/batch-plan)

func (*DistillationService) Distill added in v0.2.0

Distill creates memories from a conversation thread. (POST /memories/distill)

func (*DistillationService) Plan added in v0.2.0

Plan creates a distillation plan for a thread. (POST /memories/distill/plan)

func (*DistillationService) Preview added in v0.2.0

Preview previews distillation results without creating memories. (POST /memories/distill/preview)

func (*DistillationService) Schedule added in v0.2.0

Schedule schedules a distillation job for a thread. (POST /memories/distill/schedule)

func (*DistillationService) Triage added in v0.2.0

Triage performs a lightweight check to determine if a conversation has save-worthy content. (POST /memories/distill/triage)

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 extracted from memories into 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 its mention count across memories.

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 query 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 holds the body for exporting a raw conversation file.

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 for reading a file's contents.

type FSDeleteRequest

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

FSDeleteRequest is the request body for deleting a file.

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 or 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 for grep search within files.

type FSListResponse

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

FSListResponse is the response for listing files and directories.

type FSSearchResponse

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

FSSearchResponse is the response for file search and recall operations.

type FSService

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

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

func (*FSService) Capabilities added in v0.5.0

func (s *FSService) Capabilities(ctx context.Context) (map[string]any, error)

Capabilities returns Nowledge FS capability metadata.

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 for getting file or directory metadata.

type FSWriteRequest

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

FSWriteRequest is the request body for writing a file.

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 single 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 query parameters for GetEvents (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 StreamInput (POST /agent/feed/input/stream).

type FeedService added in v0.2.0

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

FeedService handles feed event and agent input operations.

It provides methods for listing, resolving, retrying, and deleting feed events, as well as streaming agent input and persisting questions.

func (*FeedService) DeleteEvent added in v0.2.0

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

DeleteEvent soft-deletes a feed event.

DELETE /agent/feed/events/{id}

func (*FeedService) GetEvents added in v0.2.0

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

GetEvents returns feed events from time-partitioned JSONL files.

GET /agent/feed/events

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.

POST /agent/feed/input/persist-question

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 with optional graph mutations.

POST /agent/feed/events/{id}/resolve

func (*FeedService) RetryEvent added in v0.2.0

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

RetryEvent retries a failed background task.

POST /agent/feed/events/{id}/retry

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 via Wire Protocol.

POST /agent/feed/input/stream

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 from IngestFolderUpload and IngestFolderSummary.

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 represents a single file in a folder upload.

type GetSkillParams added in v0.5.0

type GetSkillParams struct {
	IncludeBody *bool `json:"include_body,omitempty"`
}

GetSkillParams are query parameters for Get.

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 holds query parameters for getting a single thread.

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 contains a thread with its messages and metadata.

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 for the graph analysis endpoint.

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 from Health (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.

It provides methods for graph analysis, health checks, augmentation jobs, and orphan management.

func (*GraphService) Analysis

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

Analysis returns comprehensive graph analysis including community and centrality metrics.

GET /graph/analysis

func (*GraphService) AugmentationState

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

AugmentationState returns current augmentation status and parameters.

GET /graph/augmentation/state

func (*GraphService) CleanupOrphans

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

CleanupOrphans removes orphaned entities from the graph.

DELETE /graph/orphans

func (*GraphService) FindOrphans

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

FindOrphans finds entities with no relationships.

GET /graph/orphans

func (*GraphService) Health

Health returns graph database health status.

GET /graph/health

func (*GraphService) JobStatus

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

JobStatus checks progress of a specific augmentation job.

GET /graph/augmentation/status/{id}

func (*GraphService) ListJobs

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

ListJobs lists recent augmentation jobs.

GET /graph/augmentation/jobs

func (*GraphService) PlanPagerankRefresh added in v0.5.0

func (s *GraphService) PlanPagerankRefresh(ctx context.Context, params *PagerankPlanParams) (map[string]any, error)

PlanPagerankRefresh returns a read-only PageRank refresh plan.

GET /graph/augmentation/pagerank/plan

func (*GraphService) StartAugmentation

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

StartAugmentation starts a graph augmentation job (community detection, PageRank).

POST /graph/augmentation/start

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 GuidanceRulePayload added in v0.5.0

type GuidanceRulePayload struct {
	ID                           *string   `json:"id,omitempty"`
	Title                        *string   `json:"title,omitempty"`
	Body                         *string   `json:"body,omitempty"`
	Scope                        *string   `json:"scope,omitempty"`
	Status                       *string   `json:"status,omitempty"`
	AgentProfileID               *string   `json:"agentProfileId,omitempty"`
	SpaceID                      *string   `json:"spaceId,omitempty"`
	Priority                     *int      `json:"priority,omitempty"`
	Source                       *string   `json:"source,omitempty"`
	Tags                         *[]string `json:"tags,omitempty"`
	EvidenceMemoryIDs            *[]string `json:"evidenceMemoryIds,omitempty"`
	SupportedEvidenceMemoryIDs   *[]string `json:"supportedEvidenceMemoryIds,omitempty"`
	UnsupportedEvidenceMemoryIDs *[]string `json:"unsupportedEvidenceMemoryIds,omitempty"`
	Confidence                   *float64  `json:"confidence,omitempty"`
	Rationale                    *string   `json:"rationale,omitempty"`
	SupportCount                 *int      `json:"supportCount,omitempty"`
	ArchivedAt                   *string   `json:"archivedAt,omitempty"`
	ArchivedReason               *string   `json:"archivedReason,omitempty"`
	ArchivedBy                   *string   `json:"archivedBy,omitempty"`
}

GuidanceRulePayload is the request body for guidance rule create and update operations.

type GuidanceRuleResponse added in v0.5.0

type GuidanceRuleResponse struct {
	ID                           string   `json:"id"`
	Title                        string   `json:"title"`
	Body                         string   `json:"body"`
	Scope                        string   `json:"scope,omitempty"`
	Status                       string   `json:"status,omitempty"`
	AgentProfileID               string   `json:"agentProfileId,omitempty"`
	SpaceID                      string   `json:"spaceId,omitempty"`
	Priority                     int      `json:"priority,omitempty"`
	Source                       string   `json:"source,omitempty"`
	Tags                         []string `json:"tags,omitempty"`
	EvidenceMemoryIDs            []string `json:"evidenceMemoryIds,omitempty"`
	SupportedEvidenceMemoryIDs   []string `json:"supportedEvidenceMemoryIds,omitempty"`
	UnsupportedEvidenceMemoryIDs []string `json:"unsupportedEvidenceMemoryIds,omitempty"`
	Confidence                   *float64 `json:"confidence,omitempty"`
	Rationale                    string   `json:"rationale,omitempty"`
	SupportCount                 int      `json:"supportCount,omitempty"`
	ArchivedAt                   string   `json:"archivedAt,omitempty"`
	ArchivedReason               string   `json:"archivedReason,omitempty"`
	ArchivedBy                   string   `json:"archivedBy,omitempty"`
	CreatedAt                    string   `json:"createdAt,omitempty"`
	UpdatedAt                    string   `json:"updatedAt,omitempty"`
}

GuidanceRuleResponse represents an owner-managed AI context rule.

type GuidanceRulesResponse added in v0.5.0

type GuidanceRulesResponse struct {
	Rules []GuidanceRuleResponse `json:"rules,omitempty"`
}

GuidanceRulesResponse is the response for GET /settings/rules.

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 the health check endpoint.

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 HostConfigDir added in v0.5.0

type HostConfigDir struct {
	ConfigDir *string `json:"config_dir,omitempty"`
}

HostConfigDir is the request for PUT /skills/registration/{host}/config-dir.

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 represents the import configuration settings.

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 holds the body for importing a conversation file.

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 contains the result of importing a conversation file.

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 a thread 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 represents the result of importing a single thread.

type ImportThreadsRequest added in v0.2.0

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

ImportThreadsRequest holds the body for importing threads.

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 contains the result of a thread import operation.

type IngestByPathRequest

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

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

type IngestContentRequest added in v0.5.0

type IngestContentRequest struct {
	Name        string   `json:"name"`
	Content     string   `json:"content"`
	UserComment *string  `json:"user_comment,omitempty"`
	Labels      []string `json:"labels,omitempty"`
	SpaceID     string   `json:"space_id,omitempty"`
}

IngestContentRequest is the request for IngestContent (POST /sources/ingest/content).

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 IngestFile (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 IngestFolderSummary (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 IngestFolderUpload (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 the result of a single source ingestion.

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 IngestURL (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 KGExtractionPlanParams added in v0.5.0

type KGExtractionPlanParams struct {
	ScanLimit int `json:"scan_limit,omitempty"`
	BatchSize int `json:"batch_size,omitempty"`
}

KGExtractionPlanParams are query parameters for PlanKGExtraction.

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 two entities in the knowledge graph.

type KGService added in v0.2.0

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

KGService provides methods for 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. (POST /memories/{id}/extract-kg/apply)

func (*KGService) PreviewExtraction added in v0.2.0

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

PreviewExtraction previews knowledge graph extraction for a memory before applying. (POST /memories/{id}/extract-kg/preview)

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 or tag that can be assigned to memories.

type LabelConsolidateParams added in v0.5.0

type LabelConsolidateParams struct {
	DryRun    *bool `json:"dry_run,omitempty"`
	MaxGroups int   `json:"max_groups,omitempty"`
}

LabelConsolidateParams are query parameters for Consolidate.

type LabelConsolidationPreviewParams added in v0.5.0

type LabelConsolidationPreviewParams struct {
	SimFloor float64 `json:"sim_floor,omitempty"`
	MaxPairs int     `json:"max_pairs,omitempty"`
}

LabelConsolidationPreviewParams are query parameters for ConsolidationPreview.

type LabelMergeCandidatesParams added in v0.5.0

type LabelMergeCandidatesParams struct {
	SimFloor  float64 `json:"sim_floor,omitempty"`
	MaxLabels int     `json:"max_labels,omitempty"`
	MaxPairs  int     `json:"max_pairs,omitempty"`
}

LabelMergeCandidatesParams are query parameters for MergeCandidates.

type LabelsService

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

LabelsService handles label operations.

It provides methods for creating, listing, updating, and deleting labels.

func (*LabelsService) Consolidate added in v0.5.0

func (s *LabelsService) Consolidate(ctx context.Context, params *LabelConsolidateParams) (map[string]any, error)

Consolidate runs label consolidation.

POST /labels/consolidate

func (*LabelsService) ConsolidationPreview added in v0.5.0

func (s *LabelsService) ConsolidationPreview(ctx context.Context, params *LabelConsolidationPreviewParams) (map[string]any, error)

ConsolidationPreview previews label consolidation candidates.

POST /labels/consolidation-preview

func (*LabelsService) Create

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

Create creates a new label.

POST /labels

func (*LabelsService) Delete

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

Delete deletes a label and all its relationships.

DELETE /labels/{id}

func (*LabelsService) Get

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

Get returns a specific label by ID.

GET /labels/{id}

func (*LabelsService) Health added in v0.5.0

func (s *LabelsService) Health(ctx context.Context) (map[string]any, error)

Health returns label system health and maintenance status.

GET /labels/health

func (*LabelsService) List

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

List returns all labels with usage counts.

GET /labels

func (*LabelsService) Merge added in v0.5.0

func (s *LabelsService) Merge(ctx context.Context, sourceID, targetID string) (map[string]any, error)

Merge merges one label into another.

POST /labels/merge

func (*LabelsService) MergeCandidates added in v0.5.0

func (s *LabelsService) MergeCandidates(ctx context.Context, params *LabelMergeCandidatesParams) (map[string]any, error)

MergeCandidates returns likely duplicate or overlapping labels.

GET /labels/merge-candidates

func (*LabelsService) Update

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

Update updates an existing label.

PUT /labels/{id}

type LibraryService added in v0.2.0

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

LibraryService handles library/wiki operations.

func (*LibraryService) ExportOKF added in v0.5.0

func (s *LibraryService) ExportOKF(ctx context.Context, params *OKFExportParams) (map[string]any, error)

ExportOKF exports the library as Open Knowledge Format JSON.

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 List (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 holds query parameters for listing memories with filtering and pagination.

type ListMemoriesResponse

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

ListMemoriesResponse is the paginated response for listing memories.

type ListMemoryRelationsParams added in v0.5.0

type ListMemoryRelationsParams struct {
	Direction string `json:"direction,omitempty"`
	Types     string `json:"types,omitempty"`
	Status    string `json:"status,omitempty"`
	Limit     int    `json:"limit,omitempty"`
	Offset    int    `json:"offset,omitempty"`
	SpaceID   string `json:"space_id,omitempty"`
}

ListMemoryRelationsParams are query parameters for ListRelations.

type ListSkillsParams added in v0.5.0

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

ListSkillsParams are query parameters for List.

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 holds query parameters for listing sources.

type ListSourcesResponse

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

ListSourcesResponse is the response for listing sources.

type ListSpacesResponse

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

ListSpacesResponse is the response for listing 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 holds query parameters for listing threads.

type ListThreadsResponse

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

ListThreadsResponse is the paginated response for listing 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 provides methods for memory CRUD, search, bulk operations, and lifecycle management.

func (*MemoriesService) AssignLabel

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

AssignLabel assigns a label to a memory. (POST /memories/{id}/labels/{label_id})

func (*MemoriesService) BulkDelete

BulkDelete deletes selected memories, or all memories in one space. (POST /memories/bulk/delete)

func (*MemoriesService) BulkMove

BulkMove moves selected memories, or all memories in one space, into another space. (POST /memories/bulk/move)

func (*MemoriesService) BulkMovePreview

BulkMovePreview previews a bulk move between spaces before changing records. (POST /memories/bulk/move/preview)

func (*MemoriesService) Create

Create creates a new memory with automatic entity extraction. (POST /memories)

func (*MemoriesService) CreateRelation added in v0.5.0

func (s *MemoriesService) CreateRelation(ctx context.Context, memoryID string, req *MemoryRelationCreateRequest) (*MemoryRelation, error)

CreateRelation creates an explicit relation from a memory to another memory.

POST /memories/{id}/relations

func (*MemoriesService) Delete

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

Delete deletes a memory and optionally its relationships. (DELETE /memories/{id})

func (*MemoriesService) DeleteRelation added in v0.5.0

func (s *MemoriesService) DeleteRelation(ctx context.Context, relationID string) (*MemoryRelation, error)

DeleteRelation deletes an explicit memory relation.

DELETE /memories/relations/{relation_id}

func (*MemoriesService) Deprecate added in v0.4.0

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

Deprecate retires an obsolete memory (no replacement); preserved for history, removed from default recall. (POST /memories/{id}/deprecate)

func (*MemoriesService) Export

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

Export exports a memory in various formats. (GET /memories/{id}/export)

func (*MemoriesService) Get

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

Get retrieves a specific memory by ID with associated labels. (GET /memories/{id})

func (*MemoriesService) GetLabels

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

GetLabels returns labels assigned to a memory. (GET /memories/{id}/labels)

func (*MemoriesService) GetReindexStatus added in v0.2.0

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

GetReindexStatus returns the count of memories that need reindexing. (GET /memories/reindex/status)

func (*MemoriesService) List

List returns memories with filtering and pagination. (GET /memories)

func (*MemoriesService) ListRelations added in v0.5.0

ListRelations returns explicit relations for a memory.

GET /memories/{id}/relations

func (*MemoriesService) Reindex added in v0.2.0

Reindex queues multiple memories, or all that need reindexing. (POST /memories/reindex)

func (*MemoriesService) RemoveLabel

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

RemoveLabel removes a label from a memory. (DELETE /memories/{id}/labels/{label_id})

func (*MemoriesService) Search

Search performs a hybrid search with filtering, metadata, and reasoning support. (POST /memories/search)

func (*MemoriesService) SuggestRelation added in v0.5.0

SuggestRelation asks the backend to suggest whether two memories should be linked.

POST /memories/{id}/relations/suggest

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 one; keeps it in history but drops it from everyday recall. (POST /memories/{id}/supersede)

func (*MemoriesService) ToggleFavorite

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

ToggleFavorite toggles favorite status for a memory. (POST /memories/{id}/favorite)

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. (PATCH /memories/{id})

func (*MemoriesService) UpdateRelation added in v0.5.0

func (s *MemoriesService) UpdateRelation(ctx context.Context, relationID string, req *MemoryRelationUpdateRequest) (*MemoryRelation, error)

UpdateRelation updates an explicit memory relation.

PATCH /memories/relations/{relation_id}

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 with content, metadata, and temporal information.

type MemoryCompactionPlanParams added in v0.5.0

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

MemoryCompactionPlanParams are query parameters for PlanMemoryCompaction.

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 of a memory returned by list and get 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 MemoryRelation added in v0.5.0

type MemoryRelation struct {
	ID             string         `json:"id"`
	SourceMemoryID string         `json:"source_memory_id"`
	SourceTitle    string         `json:"source_title,omitempty"`
	SourceSpaceID  string         `json:"source_space_id"`
	TargetMemoryID string         `json:"target_memory_id"`
	TargetTitle    string         `json:"target_title,omitempty"`
	TargetSpaceID  string         `json:"target_space_id"`
	RelationType   string         `json:"relation_type"`
	Strength       *float64       `json:"strength,omitempty"`
	Confidence     *float64       `json:"confidence,omitempty"`
	Bidirectional  bool           `json:"bidirectional,omitempty"`
	Status         string         `json:"status,omitempty"`
	Reviewed       bool           `json:"reviewed,omitempty"`
	Source         *string        `json:"source,omitempty"`
	AuthorID       *string        `json:"author_id,omitempty"`
	AgentID        *string        `json:"agent_id,omitempty"`
	SourceApp      *string        `json:"source_app,omitempty"`
	Reason         *string        `json:"reason,omitempty"`
	Properties     map[string]any `json:"properties,omitempty"`
	CreatedAt      any            `json:"created_at,omitempty"`
	UpdatedAt      any            `json:"updated_at,omitempty"`
	Direction      *string        `json:"direction,omitempty"`
}

MemoryRelation represents an explicit relation between two memories.

type MemoryRelationCreateRequest added in v0.5.0

type MemoryRelationCreateRequest struct {
	TargetMemoryID string         `json:"target_memory_id"`
	RelationType   string         `json:"relation_type"`
	Strength       *float64       `json:"strength,omitempty"`
	Confidence     *float64       `json:"confidence,omitempty"`
	Bidirectional  bool           `json:"bidirectional,omitempty"`
	Status         string         `json:"status,omitempty"`
	Reviewed       *bool          `json:"reviewed,omitempty"`
	Source         *string        `json:"source,omitempty"`
	AuthorID       *string        `json:"author_id,omitempty"`
	AgentID        *string        `json:"agent_id,omitempty"`
	SourceApp      *string        `json:"source_app,omitempty"`
	Reason         *string        `json:"reason,omitempty"`
	Properties     map[string]any `json:"properties,omitempty"`
	SpaceID        *string        `json:"space_id,omitempty"`
}

MemoryRelationCreateRequest is the request for CreateRelation.

type MemoryRelationListResponse added in v0.5.0

type MemoryRelationListResponse struct {
	MemoryID  string           `json:"memory_id"`
	Relations []MemoryRelation `json:"relations"`
	Total     int              `json:"total"`
}

MemoryRelationListResponse is the response for ListRelations.

type MemoryRelationSuggestRequest added in v0.5.0

type MemoryRelationSuggestRequest struct {
	TargetMemoryID     string   `json:"target_memory_id"`
	PreferredLanguage  *string  `json:"preferred_language,omitempty"`
	KnownRelationTypes []string `json:"known_relation_types,omitempty"`
}

MemoryRelationSuggestRequest is the request for SuggestRelation.

type MemoryRelationSuggestion added in v0.5.0

type MemoryRelationSuggestion struct {
	ShouldLink    bool    `json:"should_link"`
	RelationType  *string `json:"relation_type,omitempty"`
	DisplayLabel  string  `json:"display_label,omitempty"`
	Reason        string  `json:"reason,omitempty"`
	Confidence    float64 `json:"confidence,omitempty"`
	Bidirectional bool    `json:"bidirectional,omitempty"`
}

MemoryRelationSuggestion is the response for SuggestRelation.

type MemoryRelationUpdateRequest added in v0.5.0

type MemoryRelationUpdateRequest struct {
	RelationType  *string        `json:"relation_type,omitempty"`
	Strength      *float64       `json:"strength,omitempty"`
	Confidence    *float64       `json:"confidence,omitempty"`
	Bidirectional *bool          `json:"bidirectional,omitempty"`
	Status        *string        `json:"status,omitempty"`
	Reviewed      *bool          `json:"reviewed,omitempty"`
	Source        *string        `json:"source,omitempty"`
	AuthorID      *string        `json:"author_id,omitempty"`
	AgentID       *string        `json:"agent_id,omitempty"`
	SourceApp     *string        `json:"source_app,omitempty"`
	Reason        *string        `json:"reason,omitempty"`
	Properties    map[string]any `json:"properties,omitempty"`
}

MemoryRelationUpdateRequest is the request for UpdateRelation.

type MergeIntoRequest added in v0.5.0

type MergeIntoRequest struct {
	IntoSkillID string `json:"into_skill_id"`
}

MergeIntoRequest is the request for POST /skills/{skill_id}/merge-into.

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 OKFExportParams added in v0.5.0

type OKFExportParams struct {
	EntityLimit          int `json:"entity_limit,omitempty"`
	TopPerCommunity      int `json:"top_per_community,omitempty"`
	MaxMentionsPerEntity int `json:"max_mentions_per_entity,omitempty"`
}

OKFExportParams are query parameters for ExportOKF.

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 PagerankPlanParams added in v0.5.0

type PagerankPlanParams struct {
	Force    *bool `json:"force,omitempty"`
	MinNodes int   `json:"min_nodes,omitempty"`
	MinEdges int   `json:"min_edges,omitempty"`
}

PagerankPlanParams are query parameters for PlanPagerankRefresh.

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 for list endpoints.

type ParseContentRequest added in v0.2.0

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

ParseContentRequest holds the body for parsing thread content.

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 contains the result of parsing thread content.

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 PersistQuestion (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 holds the body for previewing a conversation.

type PreviewConversationResponse added in v0.2.0

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

PreviewConversationResponse contains the head-and-tail preview of a conversation.

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 response.

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 from GetReindexStatus (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 ResolveEvent (POST /agent/feed/events/{id}/resolve).

type RuleReviewDryRunParams added in v0.5.0

type RuleReviewDryRunParams struct {
	Queries            []string `json:"queries,omitempty"`
	MemoryID           string   `json:"memory_id,omitempty"`
	MemoryIDs          []string `json:"memory_ids,omitempty"`
	SpaceID            string   `json:"space_id,omitempty"`
	MaxEvidenceResults int      `json:"max_evidence_results,omitempty"`
}

RuleReviewDryRunParams are query parameters for DryRunRuleReview.

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 holds the body for saving coding sessions as threads.

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 contains the result of saving coding sessions.

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 represents the result of saving a single session.

type SearchIndexService added in v0.2.0

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

SearchIndexService handles search index operations.

It provides methods for checking index status and triggering reindexing.

func (*SearchIndexService) GetReindexStatus added in v0.2.0

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

GetReindexStatus returns status of memories needing reindex.

GET /search-index/reindex/status

func (*SearchIndexService) GetStatus added in v0.2.0

GetStatus returns status of LanceDB and hybrid search.

GET /search-index/status

func (*SearchIndexService) Reindex added in v0.2.0

Reindex rebuilds the search index from the database.

POST /search-index/reindex

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 from GetStatus (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 the memory search endpoint.

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 about a thread search result.

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 from Reindex (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 represents a single search result with the matched memory and relevance metadata.

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 holds query parameters for thread 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 contains the results of a thread search.

type SettingsService added in v0.2.0

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

SettingsService handles settings operations.

func (*SettingsService) CreateAgentProfile added in v0.5.0

func (s *SettingsService) CreateAgentProfile(ctx context.Context, req *AgentProfilePayload) (*AgentProfileResponse, error)

CreateAgentProfile creates an agent profile.

POST /settings/agent-profiles

func (*SettingsService) CreateGuidanceRule added in v0.5.0

func (s *SettingsService) CreateGuidanceRule(ctx context.Context, req *GuidanceRulePayload) (*GuidanceRuleResponse, error)

CreateGuidanceRule creates an AI context guidance rule.

POST /settings/rules

func (*SettingsService) DeleteAgentProfile added in v0.5.0

func (s *SettingsService) DeleteAgentProfile(ctx context.Context, agentID string) (*AgentProfilesResponse, error)

DeleteAgentProfile deletes an agent profile.

DELETE /settings/agent-profiles/{agent_id}

func (*SettingsService) DeleteGuidanceRule added in v0.5.0

func (s *SettingsService) DeleteGuidanceRule(ctx context.Context, ruleID string) (*GuidanceRulesResponse, error)

DeleteGuidanceRule deletes an AI context guidance rule.

DELETE /settings/rules/{rule_id}

func (*SettingsService) GetAgentProfiles added in v0.5.0

func (s *SettingsService) GetAgentProfiles(ctx context.Context) (*AgentProfilesResponse, error)

GetAgentProfiles returns named long-running agent identities.

GET /settings/agent-profiles

func (*SettingsService) GetGuidanceRules added in v0.5.0

func (s *SettingsService) GetGuidanceRules(ctx context.Context) (*GuidanceRulesResponse, error)

GetGuidanceRules returns owner-managed AI context rules.

GET /settings/rules

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.

func (*SettingsService) UpdateAgentProfile added in v0.5.0

func (s *SettingsService) UpdateAgentProfile(ctx context.Context, agentID string, req *AgentProfilePayload) (*AgentProfileResponse, error)

UpdateAgentProfile updates an agent profile.

PUT /settings/agent-profiles/{agent_id}

func (*SettingsService) UpdateGuidanceRule added in v0.5.0

func (s *SettingsService) UpdateGuidanceRule(ctx context.Context, ruleID string, req *GuidanceRulePayload) (*GuidanceRuleResponse, error)

UpdateGuidanceRule updates an AI context guidance rule.

PUT /settings/rules/{rule_id}

type SkillActivityParams added in v0.5.0

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

SkillActivityParams are query parameters for Activity.

type SkillBuilderChatRequest added in v0.5.0

type SkillBuilderChatRequest struct {
	Message string                `json:"message"`
	History []SkillBuilderMessage `json:"history,omitempty"`
	Context map[string]any        `json:"context,omitempty"`
	SpaceID *string               `json:"space_id,omitempty"`
}

SkillBuilderChatRequest is the request for POST /agent/skill-builder/chat.

type SkillBuilderMessage added in v0.5.0

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

SkillBuilderMessage is one prior skill-builder conversation turn.

type SkillBuilderProposeRequest added in v0.5.0

type SkillBuilderProposeRequest struct {
	Goal    string                `json:"goal"`
	History []SkillBuilderMessage `json:"history,omitempty"`
	SpaceID *string               `json:"space_id,omitempty"`
	Deep    bool                  `json:"deep,omitempty"`
}

SkillBuilderProposeRequest is the request for POST /agent/skill-builder/propose.

type SkillCuratorDryRunParams added in v0.5.0

type SkillCuratorDryRunParams struct {
	Budget        int   `json:"budget,omitempty"`
	IncludeMerges *bool `json:"include_merges,omitempty"`
}

SkillCuratorDryRunParams are query parameters for CuratorDryRun.

type SkillEditBodyRequest added in v0.5.0

type SkillEditBodyRequest struct {
	SkillID   string  `json:"skill_id"`
	Body      string  `json:"body"`
	Rationale *string `json:"rationale,omitempty"`
}

SkillEditBodyRequest is the request for POST /agent/skill-builder/edit-body.

type SkillEditFileRequest added in v0.5.0

type SkillEditFileRequest struct {
	Path    string `json:"path"`
	Content string `json:"content"`
}

SkillEditFileRequest is the request for POST /skills/{skill_id}/edit-file.

type SkillImportRequest added in v0.5.0

type SkillImportRequest struct {
	SkillMD       *string           `json:"skill_md,omitempty"`
	Path          *string           `json:"path,omitempty"`
	URL           *string           `json:"url,omitempty"`
	Files         map[string]string `json:"files,omitempty"`
	Force         bool              `json:"force,omitempty"`
	TakeOwnership bool              `json:"take_ownership,omitempty"`
}

SkillImportRequest is the request for POST /agent/skill-builder/import.

type SkillOutcomeRequest added in v0.5.0

type SkillOutcomeRequest struct {
	SkillVersion int     `json:"skill_version"`
	Outcome      string  `json:"outcome"`
	Deviations   *string `json:"deviations,omitempty"`
	Missing      *string `json:"missing,omitempty"`
	Failure      *string `json:"failure,omitempty"`
	Source       string  `json:"source,omitempty"`
}

SkillOutcomeRequest is the request for POST /skills/{skill_id}/outcome.

type SkillRefineRequest added in v0.5.0

type SkillRefineRequest struct {
	SkillID     string  `json:"skill_id"`
	Instruction *string `json:"instruction,omitempty"`
}

SkillRefineRequest is the request for POST /agent/skill-builder/refine.

type SkillsService added in v0.5.0

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

SkillsService handles skill discovery, authoring, lifecycle, and evaluation operations.

func (*SkillsService) Activate added in v0.5.0

func (s *SkillsService) Activate(ctx context.Context, skillID string) (map[string]any, error)

Activate activates a skill.

POST /skills/{skill_id}/activate

func (*SkillsService) Activity added in v0.5.0

func (s *SkillsService) Activity(ctx context.Context, params *SkillActivityParams) (map[string]any, error)

Activity returns recent skill activity.

GET /skills/activity

func (*SkillsService) AddEvalCase added in v0.5.0

func (s *SkillsService) AddEvalCase(ctx context.Context, skillID string, req map[string]any) (map[string]any, error)

AddEvalCase adds an evaluation case to a skill.

POST /skills/{skill_id}/eval/cases

func (*SkillsService) ApplyEnrichment added in v0.5.0

func (s *SkillsService) ApplyEnrichment(ctx context.Context, skillID string) (map[string]any, error)

ApplyEnrichment applies pending enrichment to a skill.

POST /skills/{skill_id}/apply-enrichment

func (*SkillsService) ApplyVersion added in v0.5.0

func (s *SkillsService) ApplyVersion(ctx context.Context, skillID string) (map[string]any, error)

ApplyVersion applies the current proposed version of a skill.

POST /skills/{skill_id}/apply-version

func (*SkillsService) Archive added in v0.5.0

func (s *SkillsService) Archive(ctx context.Context, skillID string) (map[string]any, error)

Archive archives a skill.

POST /skills/{skill_id}/archive

func (*SkillsService) Author added in v0.5.0

func (s *SkillsService) Author(ctx context.Context, req *AuthorSkillRequest) (map[string]any, error)

Author creates an authored skill proposal from named sources.

POST /skills/author

func (*SkillsService) CuratorDryRun added in v0.5.0

func (s *SkillsService) CuratorDryRun(ctx context.Context, params *SkillCuratorDryRunParams) (map[string]any, error)

CuratorDryRun previews a curator run.

GET /skills/curator/dry-run

func (*SkillsService) CuratorProposals added in v0.5.0

func (s *SkillsService) CuratorProposals(ctx context.Context) (map[string]any, error)

CuratorProposals returns pending curator proposals.

GET /skills/curator/proposals

func (*SkillsService) CuratorRun added in v0.5.0

func (s *SkillsService) CuratorRun(ctx context.Context, budget int) (map[string]any, error)

CuratorRun runs the skill curator.

POST /skills/curator/run

func (*SkillsService) Deactivate added in v0.5.0

func (s *SkillsService) Deactivate(ctx context.Context, skillID string) (map[string]any, error)

Deactivate deactivates a skill.

POST /skills/{skill_id}/deactivate

func (*SkillsService) DeleteEvalCase added in v0.5.0

func (s *SkillsService) DeleteEvalCase(ctx context.Context, skillID, taskID string) (map[string]any, error)

DeleteEvalCase deletes an evaluation case.

DELETE /skills/{skill_id}/eval/cases/{task_id}

func (*SkillsService) Dismiss added in v0.5.0

func (s *SkillsService) Dismiss(ctx context.Context, skillID string, req *DismissSkillRequest) (map[string]any, error)

Dismiss dismisses a skill suggestion.

POST /skills/{skill_id}/dismiss

func (*SkillsService) DismissEnrichment added in v0.5.0

func (s *SkillsService) DismissEnrichment(ctx context.Context, skillID string) (map[string]any, error)

DismissEnrichment dismisses pending enrichment for a skill.

POST /skills/{skill_id}/dismiss-enrichment

func (*SkillsService) DuplicateOf added in v0.5.0

func (s *SkillsService) DuplicateOf(ctx context.Context, skillID string) (map[string]any, error)

DuplicateOf returns duplicate information for a skill.

GET /skills/{skill_id}/duplicate-of

func (*SkillsService) EditFile added in v0.5.0

func (s *SkillsService) EditFile(ctx context.Context, skillID string, req *SkillEditFileRequest) (map[string]any, error)

EditFile updates a bundled skill file.

POST /skills/{skill_id}/edit-file

func (*SkillsService) Eval added in v0.5.0

func (s *SkillsService) Eval(ctx context.Context, skillID string) (map[string]any, error)

Eval returns evaluation summary for a skill.

GET /skills/{skill_id}/eval

func (*SkillsService) Get added in v0.5.0

func (s *SkillsService) Get(ctx context.Context, skillID string, params *GetSkillParams) (map[string]any, error)

Get returns a skill by ID.

GET /skills/{skill_id}

func (*SkillsService) Harden added in v0.5.0

func (s *SkillsService) Harden(ctx context.Context, skillID string, maxRounds int) (map[string]any, error)

Harden hardens a skill for up to maxRounds.

POST /skills/{skill_id}/harden

func (*SkillsService) List added in v0.5.0

func (s *SkillsService) List(ctx context.Context, params *ListSkillsParams) (map[string]any, error)

List returns skills with optional stage, space, and pagination filters.

GET /skills

func (*SkillsService) ListEvalCases added in v0.5.0

func (s *SkillsService) ListEvalCases(ctx context.Context, skillID string) (map[string]any, error)

ListEvalCases returns evaluation cases for a skill.

GET /skills/{skill_id}/eval/cases

func (*SkillsService) Match added in v0.5.0

func (s *SkillsService) Match(ctx context.Context, query string, limit int) (map[string]any, error)

Match returns skills matching the given query.

GET /skills/match

func (*SkillsService) MergeInto added in v0.5.0

func (s *SkillsService) MergeInto(ctx context.Context, skillID string, req *MergeIntoRequest) (map[string]any, error)

MergeInto merges a skill into another skill.

POST /skills/{skill_id}/merge-into

func (*SkillsService) Outcome added in v0.5.0

func (s *SkillsService) Outcome(ctx context.Context, skillID string, req *SkillOutcomeRequest) (map[string]any, error)

Outcome reports the result of using a skill version.

POST /skills/{skill_id}/outcome

func (*SkillsService) RegisterHost added in v0.5.0

func (s *SkillsService) RegisterHost(ctx context.Context, host string) (map[string]any, error)

RegisterHost registers a local skill host.

POST /skills/registration/{host}

func (*SkillsService) RegistrationStatus added in v0.5.0

func (s *SkillsService) RegistrationStatus(ctx context.Context) (map[string]any, error)

RegistrationStatus returns host registration state.

GET /skills/registration

func (*SkillsService) RunEval added in v0.5.0

func (s *SkillsService) RunEval(ctx context.Context, skillID string, strict *bool) (map[string]any, error)

RunEval runs evaluation for a skill.

POST /skills/{skill_id}/eval/run

func (*SkillsService) SetHostConfigDir added in v0.5.0

func (s *SkillsService) SetHostConfigDir(ctx context.Context, host string, req *HostConfigDir) (map[string]any, error)

SetHostConfigDir sets or clears the config directory for one host.

PUT /skills/registration/{host}/config-dir

func (*SkillsService) StreamEval added in v0.5.0

func (s *SkillsService) StreamEval(ctx context.Context, skillID string, strict *bool) (*http.Response, error)

StreamEval streams evaluation output for a skill.

GET /skills/{skill_id}/eval/stream

func (*SkillsService) StrengthenInstead added in v0.5.0

func (s *SkillsService) StrengthenInstead(ctx context.Context, skillID string, req *StrengthenInsteadRequest) (map[string]any, error)

StrengthenInstead records that another skill should absorb this suggestion.

POST /skills/{skill_id}/strengthen-instead

func (*SkillsService) UnregisterHost added in v0.5.0

func (s *SkillsService) UnregisterHost(ctx context.Context, host string) (map[string]any, error)

UnregisterHost removes a local skill host registration.

DELETE /skills/registration/{host}

func (*SkillsService) UpdateEvalCase added in v0.5.0

func (s *SkillsService) UpdateEvalCase(ctx context.Context, skillID, taskID string, req map[string]any) (map[string]any, error)

UpdateEvalCase updates an evaluation case.

PATCH /skills/{skill_id}/eval/cases/{task_id}

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 such as a file, URL, or ingested document.

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.

It provides methods for listing, creating, updating, and deleting sources, as well as ingesting files, URLs, and batches.

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.

POST /sources/{id}/labels/{label_id}

func (*SourcesService) BatchIngest

BatchIngest ingests a batch of files (folder import).

POST /sources/ingest/batch

func (*SourcesService) Delete

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

Delete deletes a source and its search index records.

DELETE /sources/{id}

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.

POST /sources/{id}/extract

func (*SourcesService) Get

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

Get returns source detail with related memories and revision chain.

GET /sources/{id}

func (*SourcesService) GetContent

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

GetContent reads the parsed markdown content of a source.

GET /sources/{id}/content

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.

GET /sources/{id}/images/{filename}

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.

GET /sources/{id}/labels

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.

GET /sources/{id}/raw

func (*SourcesService) IngestByPath

IngestByPath ingests a file from a server-side path.

POST /sources/ingest/file-path

func (*SourcesService) IngestContent added in v0.5.0

IngestContent ingests raw text content as a library source.

POST /sources/ingest/content

func (*SourcesService) IngestFile

IngestFile ingests a file as a new source via multipart upload.

POST /sources/ingest/file

func (*SourcesService) IngestFolderSummary added in v0.2.0

IngestFolderSummary returns a summary of a folder before ingestion.

POST /sources/ingest/folder-summary

func (*SourcesService) IngestFolderUpload added in v0.2.0

IngestFolderUpload uploads a folder preserving relative paths.

POST /sources/ingest/folder-upload

func (*SourcesService) IngestURL

IngestURL ingests content from a URL.

POST /sources/ingest/url

func (*SourcesService) List

List returns sources with optional filtering and pagination.

GET /sources

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-parses it.

POST /sources/{id}/refetch

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.

DELETE /sources/{id}/labels/{label_id}

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.

GET /sources/search

func (*SourcesService) Update

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

Update updates source processing state (reparse, ocr_reparse, or mark_stale).

PATCH /sources/{id}

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.

PUT /sources/{id}/content

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 an isolation space profile with configuration and usage stats.

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 UpdateConfig (POST /spaces/config).

type SpacesService

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

SpacesService handles space profile operations.

It provides methods for managing spaces, their retrieval defaults, and guidance.

func (*SpacesService) Create

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

Create creates a space profile with retrieval defaults and guidance.

POST /spaces

func (*SpacesService) Delete

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

Delete removes an empty space profile.

DELETE /spaces/{id}

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.

GET /spaces/{id}

func (*SpacesService) List

List returns the shared space roster, profile metadata, and usage.

GET /spaces

func (*SpacesService) Roster added in v0.3.0

Roster returns the shared space roster.

GET /spaces/roster

func (*SpacesService) Update

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

Update renames a space, changes retrieval defaults, or updates guidance.

PATCH /spaces/{id}

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.

POST /spaces/config

type StartAugmentationRequest

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

StartAugmentationRequest is the request body for StartAugmentation (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 StrengthenInsteadRequest added in v0.5.0

type StrengthenInsteadRequest struct {
	TargetSkillID string `json:"target_skill_id"`
}

StrengthenInsteadRequest is the request for POST /skills/{skill_id}/strengthen-instead.

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 with messages and metadata.

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 contains the result of a bulk thread deletion.

type ThreadBulkDeleteSelectionRequest added in v0.2.0

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

ThreadBulkDeleteSelectionRequest holds the body for bulk deleting threads by selection.

type ThreadBulkMovePreviewRequest added in v0.2.0

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

ThreadBulkMovePreviewRequest holds the body for previewing a bulk thread move.

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 contains the preview of a bulk thread move.

type ThreadBulkMoveRequest added in v0.2.0

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

ThreadBulkMoveRequest holds the body for moving threads between spaces.

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 contains the result of a bulk thread 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 represents the coverage ratio of memories to messages in a thread.

type ThreadDistillationBatchPlanRequest added in v0.5.0

type ThreadDistillationBatchPlanRequest struct {
	Selection               BulkThreadSelection `json:"selection"`
	MaxScan                 int                 `json:"max_scan,omitempty"`
	MaxThreadsPerRun        int                 `json:"max_threads_per_run,omitempty"`
	MaxMessagesPerRun       int                 `json:"max_messages_per_run,omitempty"`
	MinMessagesForCandidate int                 `json:"min_messages_for_candidate,omitempty"`
}

ThreadDistillationBatchPlanRequest is the request for POST /memories/distill/batch-plan.

type ThreadDistillationBatchPlanResponse added in v0.5.0

type ThreadDistillationBatchPlanResponse struct {
	Version        int            `json:"version,omitempty"`
	Source         string         `json:"source,omitempty"`
	SelectionMode  string         `json:"selection_mode"`
	SourceSpaceID  string         `json:"source_space_id"`
	SelectionCount int            `json:"selection_count"`
	ScannedThreads int            `json:"scanned_threads"`
	ScanLimited    bool           `json:"scan_limited"`
	Plan           map[string]any `json:"plan"`
	Message        string         `json:"message"`
}

ThreadDistillationBatchPlanResponse is the response for POST /memories/distill/batch-plan.

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 with its count.

type ThreadSummariesResponse added in v0.4.0

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

ThreadSummariesResponse contains the list of thread summaries.

type ThreadSummary

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

ThreadSummary represents a lightweight thread summary with title and summary text.

type ThreadsService

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

ThreadsService provides methods for 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.

POST /threads/{id}/append

func (*ThreadsService) BulkDelete

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

BulkDelete deletes multiple threads at once using POST.

POST /threads/bulk/delete

func (*ThreadsService) BulkDeleteSelection added in v0.2.0

BulkDeleteSelection deletes selected threads using a backend-resolved selector.

POST /threads/bulk/delete

func (*ThreadsService) BulkMove added in v0.2.0

BulkMove moves selected threads into another space.

POST /threads/bulk/move

func (*ThreadsService) BulkMovePreview added in v0.2.0

BulkMovePreview previews a bulk move between spaces and detects legacy conflicts.

POST /threads/bulk/move/preview

func (*ThreadsService) Create

Create creates a new thread with messages.

POST /threads

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.

DELETE /threads/{id}

func (*ThreadsService) DeleteBulk added in v0.5.0

DeleteBulk deletes multiple threads using the DELETE /threads/bulk endpoint.

DELETE /threads/bulk

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 Claude Code, Codex, Cursor, and OpenCode.

GET /threads/conversations/discover

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.

GET /threads/{id}/export

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.

POST /threads/conversations/export-raw

func (*ThreadsService) Get

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

Get retrieves a thread with messages, supports pagination.

GET /threads/{id}

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 a thread.

GET /threads/{id}/coverage

func (*ThreadsService) GetImportConfig added in v0.2.0

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

GetImportConfig returns the current import configuration.

GET /threads/import-config

func (*ThreadsService) GetSources added in v0.2.0

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

GetSources returns available thread sources.

GET /threads/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.

GET /threads/watcher/status

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.

POST /threads/import-config/hide-project

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.

POST /threads/import-config/hide-session

func (*ThreadsService) Import added in v0.2.0

Import imports threads from JSON messages or conversation markdown.

POST /threads/import

func (*ThreadsService) ImportConversation added in v0.2.0

ImportConversation imports an external conversation file into Nowledge Mem.

POST /threads/conversations/import

func (*ThreadsService) List

List returns threads with filtering and pagination.

GET /threads

func (*ThreadsService) Parse added in v0.2.0

Parse parses thread content from various formats.

POST /threads/parse

func (*ThreadsService) PreviewConversation added in v0.2.0

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

POST /threads/conversations/preview

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.

POST /threads/{id}/reconcile-tail

func (*ThreadsService) SaveSession added in v0.2.0

SaveSession saves coding sessions as conversation threads with deduplication.

POST /threads/sessions/save

func (*ThreadsService) Search

Search performs full thread search with message matching.

GET /threads/search

func (*ThreadsService) StartWatcher added in v0.2.0

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

StartWatcher starts the session watcher for auto-importing sessions.

POST /threads/watcher/start

func (*ThreadsService) StopWatcher added in v0.2.0

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

StopWatcher stops the session watcher.

POST /threads/watcher/stop

func (*ThreadsService) Summaries

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

Summaries returns all thread titles and summaries.

GET /threads/summaries

func (*ThreadsService) ToggleFavorite

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

ToggleFavorite toggles the favorite status for a thread.

POST /threads/{id}/favorite

func (*ThreadsService) UnhideProject added in v0.2.0

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

UnhideProject unhides a project.

POST /threads/import-config/unhide-project

func (*ThreadsService) UnhideSession added in v0.2.0

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

UnhideSession unhides a session.

POST /threads/import-config/unhide-session

func (*ThreadsService) UpdateImportConfig added in v0.2.0

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

UpdateImportConfig updates the import configuration.

PUT /threads/import-config

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 UnitTypeReclassificationRequest added in v0.5.0

type UnitTypeReclassificationRequest struct {
	Limit           int      `json:"limit,omitempty"`
	ScanLimit       int      `json:"scan_limit,omitempty"`
	MinConfidence   float64  `json:"min_confidence,omitempty"`
	DryRun          bool     `json:"dry_run,omitempty"`
	UnitTypes       []string `json:"unit_types,omitempty"`
	TargetUnitTypes []string `json:"target_unit_types,omitempty"`
	SpaceID         *string  `json:"space_id,omitempty"`
}

UnitTypeReclassificationRequest is the request for TriggerUnitTypeReclassification.

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 holds the body for updating import configuration.

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 Update (PUT /labels/{id}).

type UpdateSourceRequest

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

UpdateSourceRequest is the request body for Update (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 Update (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 Update (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 multipart request for UploadImport (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 represents the current status of the session watcher.

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 from Get (GET /agent/working-memory).

type WorkingMemoryService added in v0.2.0

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

WorkingMemoryService handles working memory operations.

It provides methods for reading, writing, and browsing the Working Memory file.

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).

GET /agent/working-memory

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.

GET /agent/working-memory/history

func (*WorkingMemoryService) Update added in v0.2.0

Update writes the Working Memory file from user edits.

PUT /agent/working-memory

Directories

Path Synopsis
internal
cmd/openapi-sync command
Command openapi-sync validates a Nowledge Mem OpenAPI snapshot and regenerates the complete Go client.
Command openapi-sync validates a Nowledge Mem OpenAPI snapshot and regenerates the complete Go client.
Package openapi provides primitives to interact with the openapi HTTP API.
Package openapi provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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