Versions in this module Expand all Collapse all v0 v0.1.0 Jul 18, 2026 Changes in this version + const DefaultBudgetTokens + const DefaultK + const DefaultSignatureContextLines + const DefaultThreshold + const MinBudgetTokens + var ErrBudgetExceeded = errors.New("query: budget exceeded") + var ErrChunkNotFound = errors.New("chunk not found") + var ErrCitationNotFound = errors.New("query: citation not found") + var ErrFreshnessStale = errors.New("query: index freshness stale") + var ErrIndexUnavailable = errors.New("query: index unavailable") + var ErrPolicyError = errors.New("query: policy error") + var ErrSanitizeFailed = errors.New("query: sanitize failed") + func CosineSimilarity(a, b []float32) float64 + func EnforceCitations(hits []types.Hit, srcRoot string) (keep []types.Hit, dropped int) + func EnforceCitationsAt(hits []types.Hit, srcRoot, currentHead string, docsRoots ...string) (keep []types.Hit, dropped int, stale int) + func ExpandQuery(intent string, aliases AliasMap) string + type AliasFile struct + Aliases AliasMap + type AliasMap map[string][]string + func LoadAliasMap(path string) (AliasMap, error) + type AlignmentReport struct + CKGPath string + CurrentCommit string + CurrentDigest string + Reason string + RecordedCommit string + RecordedDigest string + SchemaVersion string + Status AlignmentStatus + Warnings []string + func (r AlignmentReport) Serviceable() bool + type AlignmentStatus string + const AlignmentDegraded + const AlignmentMismatch + const AlignmentNotAligned + const AlignmentOK + type BoostOptions struct + DocMatch bool + DocMultiplier float64 + IndexedHead string + PackageKeyword string + PackageMultiplier float64 + PackageProximity bool + RecentModified bool + RecentMultiplier float64 + SignatureMatch bool + SignatureMultiplier float64 + func DefaultBoostOptions() BoostOptions + type BoostService struct + func (s *BoostService) Run(hits []types.Hit, intent string, opts BoostOptions) []types.Hit + func (s *BoostService) RunContext(sc *SearchContext, indexedHead string) + type BranchMatch struct + At string + Citation types.Citation + FlowID string + Score float64 + StepID string + Symbol string + Then string + When string + type CommitSummary struct + Author string + Date string + Hash string + Subject string + type ConventionHit struct + ChunkID string + File string + Package string + Stats map[string]any + Summary string + type DensityService struct + func (s *DensityService) Run(_ context.Context, hits []types.Hit, budget int, maxDensity DensityTier, ...) ([]Hit, int) + func (s *DensityService) RunContext(ctx context.Context, sc *SearchContext) error + type DensityTier string + const DensityFull + const DensitySignature5 + const DensitySignatureOnly + type EmbedService struct + func (s *EmbedService) Run(ctx context.Context, text string) ([]float32, error) + func (s *EmbedService) RunContext(ctx context.Context, sc *SearchContext) error + type EmbedderInfo struct + Dimension int + ModelDir string + Name string + Provider string + Status string + type Engine struct + func Open(outDir string, emb types.Embedder, opts ...OpenOption) (*Engine, error) + func (e *Engine) CheckAlignment() AlignmentReport + func (e *Engine) CheckFreshness() error + func (e *Engine) Close() error + func (e *Engine) Embed(ctx context.Context, text string) ([]float32, error) + func (e *Engine) Embedder() types.Embedder + func (e *Engine) EmbedderInfo() EmbedderInfo + func (e *Engine) ExpandFlow(ctx context.Context, stepID, direction string, hops int) (*ExpandResult, error) + func (e *Engine) ExpandInFile(ctx context.Context, chunkID string, before, after int) ([]Hit, error) + func (e *Engine) ExplainMatch(ctx context.Context, chunkID, intent string) (*Explanation, error) + func (e *Engine) FindBranches(ctx context.Context, symptom string, k int) ([]BranchMatch, error) + func (e *Engine) FindInvariants(ctx context.Context, file, category string, tierMin int) ([]InvariantHit, error) + func (e *Engine) FreshnessReport() (freshness.Report, error) + func (e *Engine) GetConventions(ctx context.Context, packagePrefix string) ([]ConventionHit, error) + func (e *Engine) GetFlow(ctx context.Context, sel FlowSelector) (*FlowView, error) + func (e *Engine) GetInvariantEnforcement(ctx context.Context, invID string) (*InvariantEnforcement, error) + func (e *Engine) KeywordSearch(ctx context.Context, query string, k int, filter types.Filter) ([]Hit, error) + func (e *Engine) LookupPRsByFile(ctx context.Context, file string) ([]types.PRRef, error) + func (e *Engine) Manifest() manifest.Manifest + func (e *Engine) NarrowCandidates(ctx context.Context, ids []string, filter types.Filter) ([]Hit, error) + func (e *Engine) OutDir() string + func (e *Engine) Rerank(ctx context.Context, candidates []types.Hit, intent string) ([]types.Hit, error) + func (e *Engine) ResolvedVersion() string + func (e *Engine) Search(ctx context.Context, intent string, opts Options) (*Response, error) + func (e *Engine) VectorSearch(ctx context.Context, queryVec []float32, k int, filter types.Filter) ([]types.Hit, error) + func (e *Engine) Warmup(ctx context.Context) error + type EnrichService struct + func (s *EnrichService) Run(ctx context.Context, hits []Hit, srcRoot string, maxCommits int) []Hit + func (s *EnrichService) RunContext(ctx context.Context, sc *SearchContext, srcRoot string) + type ExpandResult struct + Direction string + Neighbors []FlowNeighbor + Origin string + OriginBranches []types.Branch + type Explanation struct + Category string + ChunkID string + Citation types.Citation + Guidance *types.ModificationGuidance + Keyword ExplanationKeywordScore + Symbol string + Vector ExplanationVectorScore + type ExplanationKeywordScore struct + ChunkTokenSize int + MatchedTokens []string + QueryTokens []string + Score float64 + type ExplanationVectorScore struct + CosineDistance float64 + Normalized float64 + type FlowNeighbor struct + Citation types.Citation + Relation string + StepID string + Symbol string + type FlowSelector struct + EntryPoint string + FlowID string + InvariantID string + type FlowStepView struct + Branches []types.Branch + Calls []string + Citation types.Citation + Emits string + Invariants []string + Kind string + Reads string + StepID string + Symbol string + Writes string + type FlowView struct + CalledBy []string + EntryPoint string + FlowID string + Links []string + RootSymbol string + Steps []FlowStepView + Trigger string + type HallucinationResult struct + ExpectedFile string + Reason string + Verified bool + func VerifyHit(h Hit, srcRoot string) HallucinationResult + func VerifyResponse(resp *Response, srcRoot string) (verdicts []HallucinationResult, hallucinated int) + type Hit struct + CanonicalID string + Category string + ChunkID string + ChunkKind types.ChunkKind + Citation types.Citation + Density DensityTier + GitHistory []CommitSummary + Guidance *types.ModificationGuidance + IsTest bool + Language string + Score types.HitScore + Snippet string + StaleCitation bool + Symbol string + SymbolKind types.SymbolKind + func DensityAdjust(hits []types.Hit, budgetTokens int) (out []Hit, tokensUsed int) + func DensityAdjustWith(hits []types.Hit, budgetTokens int, cap DensityTier, ctxLines int) (out []Hit, tokensUsed int) + type InvariantEnforcement struct + EnforcedAt []types.EnforcePoint + InvID string + Statement string + type InvariantHit struct + Category string + ChunkID string + EndLine int + File string + Guidance *types.ModificationGuidance + Marker string + SourceChunk string + StartLine int + Text string + Tier types.InvariantTier + type KeywordIndex struct + type OpenOption func(*Engine) + func WithFootprint(fp *footprint.Logger) OpenOption + type Options struct + Aliases AliasMap + Boost BoostOptions + BudgetTokens int + DryRun bool + EnableBM25Rerank bool + EnableMetadataEnrichment bool + EnableScoreBoost bool + ExamplesK int + Filter types.Filter + K int + MaxDensity DensityTier + MaxHistoryCommits int + SignatureContextLines int + SrcRoot string + Threshold float64 + TraceID string + type RerankService struct + func (s *RerankService) Run(_ context.Context, candidates []types.Hit, intent string) ([]types.Hit, bm25.Stats) + func (s *RerankService) RunContext(ctx context.Context, sc *SearchContext) error + type Response struct + Examples []Hit + Hits []Hit + Metadata ResponseMetadata + Warnings []string + type ResponseMetadata struct + DryRun bool + Fresh bool + IndexedHeadCKV string + TokensUsed int + TraceID string + type SearchContext struct + DroppedCitations int + EmbedIntent string + ExampleHits []types.Hit + FilteredHits []types.Hit + FinalExamples []Hit + FinalHits []Hit + Intent string + Options Options + PrimaryHits []types.Hit + QueryVec []float32 + RawHits []types.Hit + StaleCitations int + TokensUsed int + TraceID string + Warnings []string + type StoreSearchService struct + func (s *StoreSearchService) Run(ctx context.Context, queryVec []float32, k int, filter types.Filter) ([]types.Hit, error) + func (s *StoreSearchService) RunContext(ctx context.Context, sc *SearchContext) error + type ThresholdService struct + func (s *ThresholdService) Run(_ context.Context, hits []types.Hit, threshold float64) []types.Hit + func (s *ThresholdService) RunContext(ctx context.Context, sc *SearchContext) error