ai

package
v0.0.4-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: EUPL-1.2 Imports: 9 Imported by: 0

Documentation

Overview

Package ai provides the unified AI package for the core CLI.

It composes functionality from pkg/rag (vector search) and pkg/agentic (task management) into a single public API surface. New AI features should be added here; existing packages remain importable but pkg/ai is the canonical entry point.

Sub-packages composed:

  • pkg/rag: Qdrant vector database + Ollama embeddings
  • pkg/agentic: Task queue client and context building

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueryRAGForTask

func QueryRAGForTask(task TaskInfo) string

QueryRAGForTask queries Qdrant for documentation relevant to a task. It builds a query from the task title and description, queries with sensible defaults, and returns formatted context. Returns "" on any error (e.g. Qdrant/Ollama not running) for graceful degradation.

func Record

func Record(event Event) (err error)

Record appends an event to the daily JSONL file at ~/.core/ai/metrics/YYYY-MM-DD.jsonl.

func Summary

func Summary(events []Event) map[string]any

Summary aggregates events into counts by type, repo, and agent.

Types

type Event

type Event struct {
	Type      string         `json:"type"`
	Timestamp time.Time      `json:"timestamp"`
	AgentID   string         `json:"agent_id,omitempty"`
	Repo      string         `json:"repo,omitempty"`
	Duration  time.Duration  `json:"duration,omitempty"`
	Data      map[string]any `json:"data,omitempty"`
}

Event represents a recorded AI/security metric event.

func ReadEvents

func ReadEvents(since time.Time) ([]Event, error)

ReadEvents reads events from JSONL files within the given time range.

type TaskInfo

type TaskInfo struct {
	Title       string
	Description string
}

TaskInfo carries the minimal task data needed for RAG queries, avoiding a direct dependency on pkg/agentic (which imports pkg/ai).

Jump to

Keyboard shortcuts

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