Documentation
¶
Index ¶
- Constants
- func CanonicalJoinKey(id, kind string, src *Source) string
- func PreferEdgeEvidence(candidate, current Edge) bool
- type BuildRequest
- type BuildStage
- type CanonicalKey
- type Confidence
- type Config
- type DaemonConfig
- type DaemonSourceStatus
- type DaemonStatus
- type Edge
- type EdgeType
- type EmbeddingConfig
- type Evidence
- type ExtractionConfig
- type ExtractionProgress
- type ExtractionResult
- type ExtractorConfig
- type Fact
- type FactKind
- type Graph
- type GraphConfig
- type LLMConfig
- type LLMProvider
- type Layer
- type Manifest
- type ManifestFile
- type Node
- type NodeType
- type ObsReference
- type ObservationNode
- type ObsidianConfig
- type ProgressUpdate
- type Provenance
- type QueryKind
- type QueryRequest
- type ReconcilerConfig
- type RoutingMetadata
- type Source
- type SourceType
- type UIConfig
- type VerificationState
- type WatchConfig
- type WatchSourceConfig
Constants ¶
const DefaultQueryLimit = 20
Variables ¶
This section is empty.
Functions ¶
func CanonicalJoinKey ¶ added in v1.4.0
CanonicalJoinKey returns the stable key callers should use when merging or comparing cross-layer entities. It prefers canonical identity and only falls back to the trimmed raw ID when the value cannot be canonicalized.
func PreferEdgeEvidence ¶ added in v1.4.0
PreferEdgeEvidence reports whether candidate carries stronger typed evidence than current for the same logical relationship.
Types ¶
type BuildRequest ¶ added in v1.7.1
type BuildRequest struct {
RepoRoot string `json:"repo_root"`
Languages []string `json:"languages,omitempty"`
Drivers []string `json:"drivers,omitempty"`
Patchers []string `json:"patchers,omitempty"`
Stages []BuildStage `json:"stages,omitempty"`
}
BuildRequest defines the pipeline plan for producing a canonical graph-truth build. It intentionally models only code-oriented pipeline hooks.
func (BuildRequest) Normalize ¶ added in v1.7.1
func (r BuildRequest) Normalize() BuildRequest
Normalize fills stable defaults and deduplicates pipeline hooks.
type BuildStage ¶ added in v1.7.1
type BuildStage string
BuildStage identifies a step in the replacement extraction pipeline.
const ( BuildStageDetect BuildStage = "detect" BuildStageScan BuildStage = "scan" BuildStageDrivers BuildStage = "drivers" BuildStagePatch BuildStage = "patch" BuildStageMerge BuildStage = "merge" BuildStagePersist BuildStage = "persist" )
type CanonicalKey ¶ added in v1.4.0
type CanonicalKey struct {
Layer Layer `json:"layer"`
Kind string `json:"kind"`
Key string `json:"key"`
}
CanonicalKey is the layer-aware identity used for cross-graph joins. It is produced by the identity resolver so that no individual layer invents its own identity scheme.
The canonical string form is "<layer>:<kind>:<key>", e.g. "repo:function:internal/query/search.go#Run" or "memory:observation:ancora:obs:42".
func CanonicalKeyForID ¶ added in v1.4.0
func CanonicalKeyForID(id, kind string, src *Source) CanonicalKey
CanonicalKeyForID resolves an ID produced by any layer into the stable canonical key used for joins.
func CanonicalKeyForNode ¶ added in v1.4.0
func CanonicalKeyForNode(n Node) CanonicalKey
CanonicalKeyForNode resolves a graph node into the stable cross-layer key used for joins. It first honors explicit metadata, then falls back to the shared layer naming conventions.
func ParseCanonicalKey ¶ added in v1.4.0
func ParseCanonicalKey(raw string) (CanonicalKey, bool)
ParseCanonicalKey parses the canonical "<layer>:<kind>:<key>" wire form.
func (CanonicalKey) IsZero ¶ added in v1.4.0
func (c CanonicalKey) IsZero() bool
IsZero reports whether the key is unset.
func (CanonicalKey) String ¶ added in v1.4.0
func (c CanonicalKey) String() string
String renders a CanonicalKey in its canonical "<layer>:<kind>:<key>" form.
type Confidence ¶ added in v1.4.0
type Confidence string
Confidence classifies how strongly a piece of evidence should be trusted. Higher values beat lower values when two signals disagree during fusion.
const ( // ConfidenceDeclared is evidence pulled directly from a declared artifact // (OpenAPI, proto, manifest). This is the strongest signal. ConfidenceDeclared Confidence = "declared" // ConfidenceExtracted is evidence pulled from structured parsing of code // (AST, import graph). Strong but weaker than declared contracts. ConfidenceExtracted Confidence = "extracted" // ConfidenceInferred is evidence derived from heuristics, embeddings, or // cross-reference resolution. ConfidenceInferred Confidence = "inferred" // ConfidenceAmbiguous marks evidence whose target could not be uniquely // resolved. Consumers should surface this rather than silently picking one. ConfidenceAmbiguous Confidence = "ambiguous" )
type Config ¶
type Config struct {
LLM LLMConfig `yaml:"-"`
Embedding EmbeddingConfig `yaml:"-"`
Extraction ExtractionConfig `yaml:"extraction"`
UI UIConfig `yaml:"ui"`
Watch WatchConfig `yaml:"-"`
Daemon DaemonConfig `yaml:"-"`
Obsidian ObsidianConfig `yaml:"obsidian"`
Graph GraphConfig `yaml:"graph"`
}
Config is the global configuration for Vela
type DaemonConfig ¶
type DaemonConfig struct {
PIDFile string `yaml:"pid_file"`
LogFile string `yaml:"log_file"`
LogLevel string `yaml:"log_level"`
StatusFile string `yaml:"status_file"`
}
DaemonConfig configures the background daemon process.
type DaemonSourceStatus ¶
type DaemonSourceStatus struct {
Connected bool `json:"connected"`
EventCount int64 `json:"event_count"`
}
DaemonSourceStatus holds per-source connectivity info written to the status file.
type DaemonStatus ¶
type DaemonStatus struct {
PID int `json:"pid"`
Sources map[string]DaemonSourceStatus `json:"sources"` // name -> status
UpdatedAt string `json:"updated_at"`
LastGraphFlush string `json:"last_graph_flush,omitempty"` // RFC3339 timestamp of last graph.json write
}
DaemonStatus is written by the daemon to StatusFile so the CLI can read source connectivity without cross-process registry access.
type Edge ¶
type Edge struct {
Source string `json:"source"`
Target string `json:"target"`
Relation string `json:"relation"` // calls, imports, uses, describes, etc.
Confidence string `json:"confidence"` // EXTRACTED, INFERRED, AMBIGUOUS
Score float64 `json:"score,omitempty"` // 0.0-1.0
SourceFile string `json:"source_file,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Edge represents a relationship between two nodes
type EdgeType ¶
type EdgeType string
EdgeType is a discriminated string for graph relationships.
const ( // Code-derived edge types (existing conventions) EdgeTypeCalls EdgeType = "calls" EdgeTypeImports EdgeType = "imports" EdgeTypeImplements EdgeType = "implements" // Knowledge edge types (Ancora integration) EdgeTypeReferences EdgeType = "references" // obs -> file/function (generic fallback) EdgeTypeRelatedTo EdgeType = "related_to" // obs -> obs EdgeTypeDefines EdgeType = "defines" // obs -> concept EdgeTypeBelongsTo EdgeType = "belongs_to" // obs -> workspace/visibility // Typed cross-source relations (derived from observation ObsType) EdgeTypeDocuments EdgeType = "documents" // architecture/discovery obs -> code EdgeTypeDecidesOn EdgeType = "decides_on" // decision obs -> code EdgeTypeConstrains EdgeType = "constrains" // bugfix obs -> code EdgeTypeExemplifies EdgeType = "exemplifies" // pattern obs -> code EdgeTypeDeprecates EdgeType = "deprecates" // deprecation obs -> code )
type EmbeddingConfig ¶ added in v1.4.0
type EmbeddingConfig struct {
Provider string `yaml:"provider"` // ollama
Model string `yaml:"model"`
Endpoint string `yaml:"endpoint"`
Timeout time.Duration `yaml:"timeout"`
VectorBackend string `yaml:"vector_backend"` // sqlite-cosine, sqlite-vec
SQLiteVecPath string `yaml:"sqlite_vec_path"` // optional extension path
}
EmbeddingConfig holds configuration for local embedding generation.
type Evidence ¶ added in v1.4.0
type Evidence struct {
// Layer is the architectural layer the evidence came from.
Layer Layer `json:"layer"`
// Type is the evidence category, e.g. "openapi", "proto", "import",
// "call", "observation", "embedding".
Type string `json:"type"`
// SourceArtifact identifies the file, observation ID, or declared artifact
// that produced the evidence.
SourceArtifact string `json:"source_artifact,omitempty"`
// Confidence ranks this evidence against competing signals.
Confidence Confidence `json:"confidence"`
// Verification tracks binding health for memory references; empty for
// non-memory evidence.
Verification VerificationState `json:"verification,omitempty"`
// Score is an optional numeric weight in [0, 1] used by rankers. Absence
// means "no numeric preference".
Score float64 `json:"score,omitempty"`
}
Evidence describes a typed piece of provenance attached to a node or edge. Evidence is what makes retrieval explainable and ranking non-arbitrary: every relationship should be able to answer "why do you believe this?".
func EdgeEvidence ¶ added in v1.4.0
EdgeEvidence resolves the typed evidence attached to an edge from the shared metadata keys plus the legacy wire-level fields that older code still uses.
type ExtractionConfig ¶
type ExtractionConfig struct {
CodeLanguages []string `yaml:"code_languages"`
IncludeDocs bool `yaml:"include_docs"`
IncludeImages bool `yaml:"include_images"`
ChunkSize int `yaml:"chunk_size"` // tokens
CacheDir string `yaml:"cache_dir"`
}
ExtractionConfig holds configuration for extraction behavior
type ExtractionProgress ¶
type ExtractionProgress struct {
TotalFiles int
ProcessedFiles int
TotalChunks int
ProcessedChunks int
CurrentFile string
CurrentChunk int
StartTime time.Time
LastUpdateTime time.Time
}
ExtractionProgress tracks the progress of document extraction
func (*ExtractionProgress) ElapsedSeconds ¶
func (p *ExtractionProgress) ElapsedSeconds() int
ElapsedSeconds returns seconds since extraction started
func (*ExtractionProgress) EstimatedRemainingSeconds ¶
func (p *ExtractionProgress) EstimatedRemainingSeconds() int
EstimatedRemainingSeconds returns estimated remaining time in seconds
func (*ExtractionProgress) EstimatedTotalSeconds ¶
func (p *ExtractionProgress) EstimatedTotalSeconds() int
EstimatedTotalSeconds returns the estimated total time in seconds
func (*ExtractionProgress) Percentage ¶
func (p *ExtractionProgress) Percentage() int
Percentage returns the extraction progress as a percentage (0-100)
type ExtractionResult ¶
ExtractionResult is returned by extractors (code, doc, pdf)
type ExtractorConfig ¶
type ExtractorConfig struct {
Enabled bool `yaml:"enabled"`
Workers int `yaml:"workers"`
WriteBack bool `yaml:"write_back"`
Provider string `yaml:"provider"`
Model string `yaml:"model"`
}
ExtractorConfig controls LLM-based reference extraction.
type Fact ¶ added in v1.7.1
type Fact struct {
Repo string `json:"repo,omitempty"`
Language string `json:"language,omitempty"`
Kind FactKind `json:"kind"`
From string `json:"from"`
To string `json:"to,omitempty"`
Attributes map[string]interface{} `json:"attributes,omitempty"`
Provenance []Provenance `json:"provenance,omitempty"`
}
Fact is the canonical unit merged into the code-truth graph.
type FactKind ¶ added in v1.7.1
type FactKind string
FactKind classifies the canonical graph-truth relationship carried through the scanner -> semantic -> patch -> merge pipeline.
type Graph ¶
type Graph struct {
Nodes []Node `json:"nodes"`
Edges []Edge `json:"edges"`
Communities map[int][]string `json:"communities"`
Metadata map[string]interface{} `json:"metadata"`
ExtractedAt time.Time `json:"extracted_at"`
}
Graph represents the complete knowledge graph
type GraphConfig ¶ added in v1.3.0
type GraphConfig struct {
AutoPersist bool `yaml:"auto_persist"`
FlushInterval time.Duration `yaml:"flush_interval"`
}
GraphConfig controls how the daemon persists graph.json to disk. When AutoPersist is true the daemon flushes its in-memory graph back to graph.json after every reconcile cycle (debounced by FlushInterval). This keeps graph.json — the canonical source of truth — up-to-date with memory events received via the Ancora socket.
type LLMConfig ¶
type LLMConfig struct {
Provider string `yaml:"provider"` // local, anthropic, openai
Model string `yaml:"model"`
Endpoint string `yaml:"endpoint"` // for local providers
APIKey string `yaml:"api_key"` // for remote providers
Timeout time.Duration `yaml:"timeout"`
MaxChunkTokens int `yaml:"max_chunk_tokens"`
}
LLMConfig holds configuration for LLM providers
type LLMProvider ¶
type LLMProvider interface {
// ExtractGraph sends text to the LLM and requests structured graph extraction
ExtractGraph(ctx context.Context, text string, schema string) (*ExtractionResult, error)
// Health checks if the LLM provider is accessible
Health(ctx context.Context) error
// Name returns the provider name for logging
Name() string
}
LLMProvider defines the interface for pluggable LLM backends
type Layer ¶ added in v1.4.0
type Layer string
Layer discriminates the four architectural layers in Vela's retrieval stack.
const ( // LayerRepo is repo-local code, files, symbols, and chunks — the correctness // path for deep code retrieval. Repo-local SQLite, FTS, and vector indexes // live in this layer. LayerRepo Layer = "repo" // LayerContract is declared service and interface truth derived from // artifacts such as OpenAPI specs, proto files, manifests, and schema files. // Contract evidence outranks derived signals during fusion. LayerContract Layer = "contract" // LayerWorkspace is the lightweight routing graph over repos, services, // domains, packages, and dependencies. It answers "which repos should we // search" — it is not a deep code graph. LayerWorkspace Layer = "workspace" // LayerMemory is the structured layer over Ancora-backed observations, // decisions, bugfixes, and preferences. It links to repo entities by // reference rather than duplicating code structure. LayerMemory Layer = "memory" )
func LayerOf ¶ added in v1.4.0
func LayerOf(s SourceType) Layer
LayerOf reports the architectural layer a SourceType belongs to. Codebase sources belong to the repo layer; memory sources belong to the memory layer; webhook sources currently feed the memory layer as timestamped observations. Contract and workspace layers are derived rather than sourced directly, so they have no default SourceType mapping.
type Manifest ¶ added in v1.7.1
type Manifest struct {
Version int `json:"version"`
RepoRoot string `json:"repo_root,omitempty"`
GeneratedAt time.Time `json:"generated_at"`
ExtractorFingerprint string `json:"extractor_fingerprint"`
BuildMode string `json:"build_mode,omitempty"`
Files []ManifestFile `json:"files,omitempty"`
}
Manifest tracks file-level freshness for persisted graph outputs.
type ManifestFile ¶ added in v1.7.1
type ManifestFile struct {
Path string `json:"path"`
SHA256 string `json:"sha256"`
Size int64 `json:"size,omitempty"`
ModTimeUTC time.Time `json:"mod_time_utc,omitempty"`
Language string `json:"language,omitempty"`
Status string `json:"status,omitempty"`
}
ManifestFile describes one detected source file included in the build.
type Node ¶
type Node struct {
ID string `json:"id"`
Label string `json:"label"`
NodeType string `json:"type"` // function, class, concept, file, etc.
SourceFile string `json:"source_file,omitempty"`
SourceLocation string `json:"source_location,omitempty"` // L42:C5
Community int `json:"community,omitempty"`
Degree int `json:"degree,omitempty"`
Description string `json:"description,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
// Source identifies where this node came from (codebase, memory, webhook).
// Nodes from the same extraction share the same Source.
Source *Source `json:"source,omitempty"`
}
Node represents a concept, class, function, or entity in the knowledge graph
type NodeType ¶
type NodeType string
NodeType is a discriminated string for all node varieties in the graph.
const ( NodeTypeRepo NodeType = "repo" NodeTypeSubsystem NodeType = "subsystem" NodeTypeChunk NodeType = "chunk" // NodeTypeService and NodeTypeContract live in the contract layer. NodeTypeService NodeType = "service" NodeTypeContract NodeType = "contract" // NodeTypeDomain is a workspace-layer tag node (e.g. "billing", "auth") // used for coarse routing. It is not a code entity. NodeTypeDomain NodeType = "domain" )
Topology node types for the organization -> workspace -> repo -> subsystem hierarchy. Chunk is the smallest retrievable unit under a file/symbol.
const ( // Code-derived node types (existing conventions) NodeTypeFunction NodeType = "function" NodeTypeStruct NodeType = "struct" NodeTypeInterface NodeType = "interface" NodeTypeFile NodeType = "file" NodeTypePackage NodeType = "package" // Knowledge node types (Ancora integration) NodeTypeObservation NodeType = "observation" NodeTypeConcept NodeType = "concept" NodeTypeWorkspace NodeType = "workspace" NodeTypeVisibility NodeType = "visibility" NodeTypeOrganization NodeType = "organization" )
const NodeTypeMemorySource NodeType = "memory_source"
NodeTypeMemorySource is the root node for all ancora memory.
const NodeTypeProject NodeType = "project"
NodeTypeProject is the root node for a codebase extraction.
type ObsReference ¶
type ObsReference struct {
// Type is one of: "file", "observation", "concept", "function"
Type string `json:"type"`
// Target is the referenced artifact (path, ID, name, etc.)
Target string `json:"target"`
}
ObsReference describes a relationship from an observation to another artifact. It mirrors the wire format used by Ancora but lives in the Vela type system.
type ObservationNode ¶
type ObservationNode struct {
// ID is the Vela node ID — "ancora:obs:<ancoraID>"
ID string
NodeType NodeType
// AncoraID is the original Ancora observation primary key.
AncoraID int64
Title string
Content string
// ObsType is the Ancora observation category: "decision", "bugfix", etc.
ObsType string
Workspace string
Visibility string
Organization string
TopicKey string
References []ObsReference
CreatedAt time.Time
UpdatedAt time.Time
// Source identifies this node as memory-derived (set by the patcher/extractor).
Source *Source
}
ObservationNode represents an Ancora memory observation as a graph node.
func (*ObservationNode) ToNode ¶
func (o *ObservationNode) ToNode() Node
ToNode converts an ObservationNode to a generic types.Node for graph storage.
type ObsidianConfig ¶
type ObsidianConfig struct {
AutoSync bool `yaml:"auto_sync"`
VaultDir string `yaml:"vault_dir"` // e.g. "~/Documents/vela"
}
ObsidianConfig controls automatic Obsidian vault sync. When AutoSync is true the daemon writes the vault after every successful reconcile. VaultDir is the vault root and Vela writes into <VaultDir>/obsidian/ mirroring the manual `vela extract` layout.
type ProgressUpdate ¶
type ProgressUpdate struct {
Progress ExtractionProgress
Error error
IsComplete bool
EstimatedSeconds int
}
ProgressUpdate is sent on a channel to update UI with extraction progress
type Provenance ¶ added in v1.7.1
type Provenance struct {
Stage string `json:"stage,omitempty"`
Driver string `json:"driver,omitempty"`
Source string `json:"source,omitempty"`
Confidence Confidence `json:"confidence,omitempty"`
Artifact string `json:"artifact,omitempty"`
Explanation string `json:"explanation,omitempty"`
}
Provenance records where a canonical fact came from and how trustworthy it is. Unlike the legacy memory-oriented contracts, this is strictly code-truth oriented: scanner, semantic drivers, patchers, and merge artifacts.
type QueryKind ¶ added in v1.7.1
type QueryKind string
QueryKind identifies the supported graph-truth query families.
type QueryRequest ¶ added in v1.7.1
type QueryRequest struct {
Kind QueryKind `json:"kind"`
Subject string `json:"subject,omitempty"`
Target string `json:"target,omitempty"`
Limit int `json:"limit,omitempty"`
IncludeProvenance bool `json:"include_provenance,omitempty"`
}
QueryRequest is the canonical input contract for graph-truth queries.
func (QueryRequest) Normalize ¶ added in v1.7.1
func (r QueryRequest) Normalize() QueryRequest
Normalize fills defaults that should be consistent across CLI, MCP, and TUI callers once the product is cut over to graph-truth-only queries.
func (QueryRequest) Validate ¶ added in v1.7.1
func (r QueryRequest) Validate() error
Validate enforces the minimal shape for each query family.
type ReconcilerConfig ¶
type ReconcilerConfig struct {
DebounceMs int `yaml:"debounce_ms"`
MaxBatchSize int `yaml:"max_batch_size"`
}
ReconcilerConfig controls event batching behaviour.
type RoutingMetadata ¶ added in v1.4.0
type RoutingMetadata struct {
// Repos are the repo canonical keys this routing entry suggests.
Repos []string `json:"repos,omitempty"`
// Services names declared services involved in the route (contract layer
// entities, referenced by canonical key).
Services []string `json:"services,omitempty"`
// Domains are coarse subject tags such as "billing" or "auth".
Domains []string `json:"domains,omitempty"`
// Packages are language-level package names (Go modules, npm packages).
Packages []string `json:"packages,omitempty"`
// Dependencies expresses declared dependencies between repos/services.
Dependencies []string `json:"dependencies,omitempty"`
}
RoutingMetadata is carried on workspace-layer nodes and edges so that the retrieval orchestrator can pick repos before running deep retrieval. It is intentionally small — workspace routing must stay lightweight.
type Source ¶
type Source struct {
// Type discriminates the source category.
Type SourceType `json:"type"`
// ID is the stable repo/source identity used for node namespacing.
ID string `json:"id,omitempty"`
// Name is the project/repo name (e.g., "vela", "glim", "ancora").
Name string `json:"name"`
// Organization is the git remote owner/org when available.
Organization string `json:"organization,omitempty"`
// Path is the local filesystem path (codebase only).
Path string `json:"path,omitempty"`
// Remote is the git remote URL if detected (codebase only).
Remote string `json:"remote,omitempty"`
}
Source describes where a node or extraction result originated. For codebases: detected from git remote or folder name. For memory: always "ancora" with workspace/visibility metadata on nodes.
type SourceType ¶
type SourceType string
SourceType discriminates knowledge sources.
const ( // SourceTypeCodebase is a local or git-tracked codebase (files, functions, deps). SourceTypeCodebase SourceType = "codebase" // SourceTypeMemory is Ancora persistent memory (observations, decisions). SourceTypeMemory SourceType = "memory" // SourceTypeWebhook is external event sources (future: Jira, GitHub, etc.). SourceTypeWebhook SourceType = "webhook" )
type UIConfig ¶
type UIConfig struct {
Theme string `yaml:"theme"`
ShowProgress bool `yaml:"show_progress"`
EnableColors bool `yaml:"enable_colors"`
}
UIConfig holds configuration for TUI behavior
type VerificationState ¶ added in v1.4.0
type VerificationState string
VerificationState tracks whether a memory reference still binds to a live code entity. The binder transitions references between these states as code moves or gets deleted.
const ( // VerificationCurrent means the reference resolves to the same entity it // originally pointed at. VerificationCurrent VerificationState = "current" // VerificationRedirected means the entity was renamed or moved and the // binder has a high-confidence new target. VerificationRedirected VerificationState = "redirected" // VerificationStale means the entity no longer exists and no replacement // was found. VerificationStale VerificationState = "stale" // VerificationAmbiguous means multiple plausible targets exist and the // binder refused to silently pick one. VerificationAmbiguous VerificationState = "ambiguous" )
type WatchConfig ¶
type WatchConfig struct {
Enabled bool `yaml:"enabled"`
Sources []WatchSourceConfig `yaml:"sources"`
Reconciler ReconcilerConfig `yaml:"reconciler"`
Extractor ExtractorConfig `yaml:"extractor"`
}
WatchConfig is the top-level daemon watch configuration.
type WatchSourceConfig ¶
type WatchSourceConfig struct {
Name string `yaml:"name"`
Type string `yaml:"type"` // "syfra" | "webhook"
Socket string `yaml:"socket"` // path for syfra sources
}
WatchSourceConfig configures a single event source for the daemon.