Skip to content

Conversation

@nvandessel
Copy link
Owner

Summary

  • Re-introduces pure Go foundations for local LLM support, redesigned for yzma (purego) instead of llama-go (CGo)
  • Adds new LocalLibPath config field + FLOOP_LOCAL_LIB_PATH env override for yzma shared library directory
  • LocalClient is a stub (always unavailable) — yzma backend wired in PR3

Changes

  • client.go: EmbeddingComparer and Closer optional interfaces
  • similarity.go: CosineSimilarity + normalize functions with tests
  • local.go: LocalClient stub with LocalConfig (includes LibPath)
  • local_test.go: Unit tests for stub behavior, interface compliance, config fields
  • config.go: LocalLibPath, LocalModelPath, LocalEmbeddingModelPath, LocalGPULayers, LocalContextSize + env overrides
  • config_test.go: Tests for new config fields
  • main.go: case "local": factory passes LibPath
  • store_dedup.go: Embedding comparison path restored
  • dedup.go: "embedding" in SimilarityMethod docs

Stacked on: #57 (revert)

Test plan

  • go build ./cmd/floop — builds cleanly
  • go vet ./... — no issues
  • go test ./... — all 25 packages pass

🤖 Generated with Claude Code

Re-introduce pure Go foundations for local LLM support, now designed
for hybridgroup/yzma (purego) instead of llama-go (CGo):

- EmbeddingComparer and Closer optional interfaces in client.go
- CosineSimilarity + normalize utility functions with tests
- LocalClient stub (always unavailable, yzma backend in next PR)
- LocalConfig with new LibPath field for yzma shared library dir
- Config: LocalLibPath + FLOOP_LOCAL_LIB_PATH env override
- Config: LocalModelPath, LocalEmbeddingModelPath, LocalGPULayers,
  LocalContextSize fields and env overrides restored
- "local" provider in config validation and CLI factory
- Embedding comparison path in store_dedup.go computeSimilarity
- "embedding" in SimilarityMethod docs

No external dependencies — builds and tests pass with standard Go.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@greptile-apps
Copy link

greptile-apps bot commented Feb 11, 2026

Greptile Overview

Greptile Summary

Reintroduces local LLM foundations by adding a new local provider, plumbing local model/library configuration through FloopConfig (with env overrides), and adding a stub LocalClient that satisfies the llm.Client interface plus new optional capability interfaces (EmbeddingComparer, Closer). Deduplication similarity logic is extended to prefer embedding-based similarity when supported, otherwise falls back to full LLM comparison and then Jaccard.

Confidence Score: 3/5

  • This PR is reasonably safe to merge, but the new embedding-similarity path is currently ineffective for the new local provider due to availability gating.
  • Most changes are additive (config plumbing, stub client, math utilities with tests) and should not destabilize existing providers. The main functional concern is that computeSimilarity only enters the embedding comparer branch when Client.Available() is true, while the new LocalClient always reports unavailable, making the restored embedding comparison path unreachable for local use and potentially masking integration issues until later.
  • internal/dedup/store_dedup.go

Important Files Changed

Filename Overview
cmd/floop/main.go Adds "local" provider case that constructs a LocalClient using new local config fields.
internal/config/config.go Adds local LLM config fields + env overrides and allows "local" as valid provider.
internal/config/config_test.go Adds tests for parsing and env overrides of new local LLM config fields.
internal/dedup/dedup.go Updates SimilarityMethod docs to include the new "embedding" method.
internal/dedup/store_dedup.go Restores embedding-based similarity path via optional EmbeddingComparer, but current gating on Client.Available() makes it unreachable for stub LocalClient.
internal/llm/client.go Introduces optional EmbeddingComparer and Closer interfaces for capability-based feature detection.
internal/llm/local.go Adds LocalClient stub implementing Client/EmbeddingComparer with config plumbed through; methods currently return 'not wired' errors except MergeBehaviors via fallback.
internal/llm/local_test.go Adds unit tests ensuring LocalClient stub behavior and interface compliance.
internal/llm/similarity.go Adds cosine similarity and in-place vector normalization utilities.
internal/llm/similarity_test.go Adds tests covering cosine similarity edge cases and normalization behavior.

Sequence Diagram

sequenceDiagram
    participant CLI as cmd/floop
    participant Config as internal/config
    participant Factory as llm factory
    participant Local as internal/llm/local
    participant Dedup as internal/dedup
    participant Store as store_dedup

    CLI->>Config: Load config (env overrides)
    CLI->>Factory: Select client type ("local")
    Factory->>Local: NewLocalClient(LocalConfig{LibPath,...})
    Local-->>Factory: LocalClient (stub unavailable)
    CLI->>Dedup: Run dedup
    Dedup->>Store: Compare embeddings
    Store->>Local: EmbeddingComparer? / Embedder?
    Local-->>Store: Error/unavailable
    Store-->>Dedup: Falls back / handles unavailable
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines 218 to +221
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

// Try LLM comparison
// Prefer embedding-based comparison if supported
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Embedding path is unreachable

computeSimilarity only attempts EmbeddingComparer when d.llmClient.Available() is true. In this PR, LocalClient.Available() is a stub that always returns false, so the new embedding-based comparison will never run for the new local provider (and SimilarityMethod = "embedding" will never be produced). If the intent is to allow embedding comparison even when the full LLM provider is “unavailable” (e.g., generation unavailable but embeddings work), the embedding branch needs to run based on EmbeddingComparer support rather than Client.Available().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant