You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/posts/frontend-developer-agent-walkthrough.md
+21-5Lines changed: 21 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ The front-end developer agent combines three capabilities:
30
30
31
31
3.**Global Code Search (GrepApp)**: Searches millions of public GitHub repositories for TypeScript code patterns via the grep.app API, filtered to TypeScript for modern front-end relevance.
32
32
33
-
Results from both haystacks are merged and ranked using BM25Plus, giving you a single sorted list that blends your local context with community examples.
33
+
Results from both haystacks are merged and ranked using TerraphimGraph, a hybrid scoring algorithm that combines knowledge graph concept matching with TF-IDF rescoring. In testing, a query for "svelte component" returned 13 results with TerraphimGraph versus 1 result with the simpler BM25Plus scorer. The 18 concept files with 358 synonyms actively influence ranking, not just display.
34
34
35
35
## The Knowledge Graph
36
36
@@ -50,6 +50,19 @@ When you search for `$derived` or `+page.svelte`, the Aho-Corasick automaton mat
50
50
51
51
If no exact match exists, a TF-IDF fallback kicks in using `trigger::` directives for semantic similarity.
52
52
53
+
## Hybrid Scoring: Why TerraphimGraph
54
+
55
+
Terraphim offers multiple relevance functions. For a knowledge-graph-backed agent, `terraphim-graph` is strictly superior to the simpler `bm25plus`:
56
+
57
+
| Aspect | BM25Plus | TerraphimGraph |
58
+
|--------|----------|----------------|
59
+
| KG concepts affect ranking | No (display only) | Yes (graph + TF-IDF hybrid) |
60
+
| Term co-occurrence | Not used | Boosts related documents |
61
+
| KG link insertion | Disabled | Enabled in results |
TerraphimGraph uses a two-pass scoring system. Pass 1 builds a co-occurrence graph from Aho-Corasick matches and ranks documents by `total_rank = node_rank + edge_rank + document_rank`. Pass 2 applies TF-IDF rescoring at 30% weight. Documents containing co-occurring concepts (e.g., "svelte" + "component" + "state management") score higher than those matching only one term.
65
+
53
66
## Svelte and SvelteKit Focus
54
67
55
68
The knowledge graph is tuned for Svelte/SvelteKit development with TypeScript:
0 commit comments