Files
cleveragents-core/features/semantic_context_search.feature
HAL9000 c9e20c6b82
CI / load-versions (pull_request) Successful in 18s
CI / push-validation (pull_request) Successful in 28s
CI / lint (pull_request) Successful in 1m10s
CI / quality (pull_request) Successful in 1m9s
CI / typecheck (pull_request) Successful in 1m15s
CI / build (pull_request) Successful in 47s
CI / security (pull_request) Successful in 1m13s
CI / helm (pull_request) Successful in 40s
CI / unit_tests (pull_request) Successful in 6m0s
CI / integration_tests (pull_request) Successful in 8m31s
CI / docker (pull_request) Successful in 2m21s
CI / coverage (pull_request) Successful in 12m57s
CI / status-check (pull_request) Successful in 3s
feat(context): implement semantic context search strategy using embeddings
Fix missing plugin import in cli/main.py that caused lint/typecheck/test
cascade failures. Add plugin to _register_subcommands() import list so
plugin.app reference at line 233 resolves correctly.

Also fix AmbiguousStep collision: semantic_context_search_steps.py
defined @when("I assemble context with query {query}") duplicating the
same step in advanced_context_strategies_steps.py, crashing all 836
Behave features at load time. Rename to @when("I assemble semantic
context with query {query}") and update the feature file to match.

ISSUES CLOSED: #5254
2026-06-18 01:17:23 -04:00

58 lines
2.4 KiB
Gherkin

Feature: Semantic context search using embeddings
As a context assembly system
I want to use semantic embeddings to find relevant files
So that I can select the most semantically relevant context fragments
Background:
Given I have a semantic context strategy with embeddings
And I have a mock embedding provider
Scenario: Embed text fragments
When I embed the text "Python function definition"
Then the embedding should have 10 dimensions
And the embedding should be a valid vector
Scenario: Compute cosine similarity between embeddings
Given I have two text embeddings
When I compute their cosine similarity
Then the similarity should be between -1 and 1
Scenario: Rank fragments by semantic similarity
Given I have context fragments with content:
| content |
| Python function definition |
| JavaScript class syntax |
| Python class implementation|
And I have a query "Python code structure"
When I rank fragments by semantic similarity to the query
Then the Python fragments should rank higher than JavaScript
Scenario: Filter fragments by minimum similarity threshold
Given I have context fragments with content:
| content |
| Python function definition |
| Unrelated database schema |
| Python class implementation|
And I have a query "Python code"
And I have a minimum similarity threshold of 0.3
When I filter fragments by similarity threshold
Then only semantically similar fragments should be included
Scenario: Semantic strategy selects relevant files
Given I have a semantic context strategy
And I have context fragments:
| uko_node | content | token_count |
| file1.py | Python function definition | 10 |
| file2.js | JavaScript class syntax | 10 |
| file3.py | Python class implementation| 10 |
And I have a context budget of 30 tokens
When I assemble semantic context with query "Python code structure"
Then the selected fragments should include Python files
And the selected fragments should be ranked by relevance
Scenario: Embedding provider configuration
Given I have an embedding provider configuration
When I create a semantic strategy with the configuration
Then the strategy should use the configured embedding provider
And the strategy should report semantic search capability