@liendev/lien 0.14.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,564 +1,110 @@
1
1
  ---
2
+ description: MANDATORY code search rules - use Lien MCP tools instead of grep
3
+ globs: ["**/*"]
2
4
  alwaysApply: true
3
5
  ---
4
6
 
5
- # Lien MCP Integration Rules
7
+ # MANDATORY: Use Lien MCP for Code Search
6
8
 
7
- This project uses **Lien** - a local semantic code search MCP server. You MUST use Lien tools proactively to understand the codebase before making changes.
9
+ You have access to Lien semantic search tools. USE THEM INSTEAD OF grep/ripgrep/built-in search.
8
10
 
9
- ## Core Rules
11
+ ## Tool Selection (FOLLOW THIS)
10
12
 
11
- ### ALWAYS Use Lien When:
12
- 1. **Before reading any file** - Use `semantic_search` or `get_file_context` to understand what you're looking for
13
- 2. **User asks about code location** - Use `semantic_search` before grepping
14
- 3. **User asks "how does X work"** - Use `semantic_search` to find implementations
15
- 4. **Before making changes** - Use `get_file_context` to understand dependencies
16
- 5. **User asks for examples** - Use `find_similar` to locate patterns
17
- 6. **Exploring unfamiliar code** - Use `semantic_search` with broad queries first
13
+ | User wants... | Use this | NOT this |
14
+ |---------------|----------|----------|
15
+ | "Where is X implemented?" | `semantic_search` | grep |
16
+ | "How does X work?" | `semantic_search` | reading random files |
17
+ | "Find all Controllers" | `list_functions` | grep |
18
+ | Edit a file | `get_file_context` FIRST | direct edit |
19
+ | Find similar code | `find_similar` | manual search |
18
20
 
19
- ### NEVER:
20
- 1. Skip Lien and go straight to reading files when you don't know the codebase
21
- 2. Use grep when the user is asking about functionality (use semantic search instead)
22
- 3. Make assumptions about code location without searching first
23
- 4. Edit files without getting context via `get_file_context`
21
+ ## Before ANY Code Change
24
22
 
25
- ---
26
-
27
- ## MCP Tools Reference
28
-
29
- ### `semantic_search` - PRIMARY TOOL
30
- **Use this FIRST for almost all code understanding tasks.**
31
-
32
- ```typescript
33
- semantic_search({
34
- query: "natural language description of what you're looking for",
35
- limit: 5 // increase to 10-15 for broad exploration
36
- })
37
- ```
38
-
39
- **Use for:**
40
- - "Where is X implemented?" → `semantic_search({ query: "X implementation" })`
41
- - "How does Y work?" → `semantic_search({ query: "Y functionality" })`
42
- - Finding patterns, features, utilities, handlers, validators, etc.
43
- - Understanding architecture before making changes
44
-
45
- **Query tips:**
46
- - Use full sentences describing what the code does
47
- - Focus on behavior: "handles user authentication", "validates email input"
48
- - Not exact names: search semantically, not syntactically
49
-
50
- ### `get_file_context`
51
- **Use BEFORE editing any file you haven't read yet.**
52
-
53
- ```typescript
54
- get_file_context({
55
- filepath: "relative/path/to/file.ts",
56
- includeRelated: true // default, gets related chunks
57
- })
58
- ```
59
-
60
- **MANDATORY for:**
61
- - Before making any file edits
62
- - Understanding file dependencies and relationships
63
- - Getting full context of what a file does
64
-
65
- **Pro tip:** Use after `semantic_search` identifies the right file
66
-
67
- ### `find_similar`
68
- **Use for finding patterns and ensuring consistency.**
69
-
70
- ```typescript
71
- find_similar({
72
- code: "function example() { ... }",
73
- limit: 5
74
- })
75
- ```
76
-
77
- **Use for:**
78
- - Refactoring: find all similar implementations
79
- - Consistency: ensure new code matches existing patterns
80
- - Duplication detection
81
-
82
- ### `list_functions` ⚡
83
- **Fast symbol-based search for functions, classes, and interfaces by name.**
84
-
85
- ```typescript
86
- list_functions({
87
- pattern: ".*Controller.*", // regex to match symbol names
88
- language: "php" // optional language filter
89
- })
90
- ```
91
-
92
- **How it works:**
93
- - Extracts and indexes function/class/interface names during indexing
94
- - Direct symbol name matching (not semantic search)
95
- - **10x faster** than semantic search for finding specific symbols
96
- - Automatic fallback for old indices
97
-
98
- **Use for:**
99
- - Finding all classes matching a pattern (e.g., `.*Controller.*`, `.*Service$`)
100
- - Getting structural overview of functions/classes
101
- - Discovering API endpoints, handlers, or utilities by name pattern
102
- - Understanding code organization and naming conventions
103
-
104
- **Best practices:**
105
- - Use regex patterns that match naming conventions: `.*Controller.*`, `handle.*`, `get.*`
106
- - Combine with language filter for large codebases: `language: "typescript"`
107
-
108
- **When to use `list_functions` vs `semantic_search`:**
109
- - ✅ Use `list_functions` when you know the naming pattern (e.g., "all Controllers")
110
- - ✅ Use `semantic_search` when searching by functionality (e.g., "handles authentication")
111
-
112
- **Note:** Test files are indexed alongside source code and will naturally appear in semantic search results when relevant.
113
-
114
- ---
115
-
116
- ## Enhanced Metadata (AST-Based) ⚡ NEW in v0.13.0
117
-
118
- Lien now uses **Abstract Syntax Tree (AST) parsing** for TypeScript/JavaScript files to provide rich code metadata:
119
-
120
- ### Metadata Fields in Search Results
121
-
122
- All search results (`semantic_search`, `get_file_context`, `find_similar`, `list_functions`) now include enhanced metadata when available:
123
-
124
- ```typescript
125
- {
126
- content: "function validateEmail(email: string): boolean { ... }",
127
- metadata: {
128
- file: "src/validators.ts",
129
- startLine: 45,
130
- endLine: 60,
131
- type: "function", // 'function' | 'class' | 'block'
132
- language: "typescript",
133
-
134
- // AST-derived metadata (NEW in v0.13.0):
135
- symbolName: "validateEmail", // Function/class name
136
- symbolType: "function", // 'function' | 'method' | 'class' | 'interface'
137
- parentClass: undefined, // For methods: parent class name
138
- complexity: 3, // Cyclomatic complexity
139
- parameters: ["email: string"], // Function parameters
140
- signature: "function validateEmail(email: string): boolean", // Full signature
141
- imports: ["@/utils/regex"] // File imports (for context)
142
- },
143
- score: 0.85,
144
- relevance: "highly_relevant"
145
- }
146
- ```
147
-
148
- ### AST Metadata Benefits
149
-
150
- 1. **Never splits functions** - Chunks respect semantic boundaries (no mid-function splits)
151
- 2. **Function context** - Know exactly which function you're looking at
152
- 3. **Complexity metrics** - Identify complex functions that may need refactoring
153
- 4. **Signature awareness** - See parameters and return types at a glance
154
- 5. **Better AI context** - AI assistants get structured code information
155
-
156
- ### Using AST Metadata
157
-
158
- **Find complex functions:**
159
- ```typescript
160
- // Search for authentication logic
161
- const results = await semantic_search({ query: "authentication logic" });
162
-
163
- // Filter by complexity
164
- const complexFunctions = results.filter(r => (r.metadata.complexity || 0) > 5);
165
- ```
166
-
167
- **Identify methods in a class:**
168
- ```typescript
169
- // Get file context
170
- const context = await get_file_context({ filepath: "src/auth/AuthService.ts" });
171
-
172
- // Find all methods
173
- const methods = context.results.filter(r => r.metadata.symbolType === 'method');
174
- ```
175
-
176
- **List functions with specific parameters:**
177
- ```typescript
178
- const functions = await list_functions({ pattern: ".*validate.*", language: "typescript" });
179
-
180
- // Filter by parameter count
181
- const simpleValidators = functions.filter(r => (r.metadata.parameters?.length || 0) <= 2);
182
- ```
183
-
184
- ### AST Support
185
-
186
- **Currently supported:**
187
- - ✅ TypeScript (`.ts`, `.tsx`)
188
- - ✅ JavaScript (`.js`, `.jsx`, `.mjs`, `.cjs`)
189
- - ✅ Shopify Liquid (`.liquid`) - **Special regex-based chunking**
190
-
191
- **Coming soon:**
192
- - 🔜 Python, Go, Rust, Java, PHP, and more
23
+ REQUIRED sequence:
24
+ 1. `semantic_search` → find relevant files
25
+ 2. `get_file_context` understand the file + check `testAssociations`
26
+ 3. Make changes
27
+ 4. Remind user to run affected tests
193
28
 
194
- **Fallback behavior:**
195
- - For unsupported languages, Lien automatically falls back to line-based chunking
196
- - No disruption to existing workflows
29
+ ## Tool Reference
197
30
 
198
- ### Shopify Liquid Support NEW
31
+ **`semantic_search({ query: "what the code does", limit: 5 })`**
32
+ - Use natural language: "handles authentication", "validates email"
33
+ - NOT function names (use grep for exact names)
34
+ - Returns relevance category: `highly_relevant`, `relevant`, `loosely_related`, `not_relevant`
199
35
 
200
- Lien provides specialized chunking for Shopify themes with **complete dependency tracking**:
36
+ **`get_file_context({ filepath: "path/to/file.ts" })`**
37
+ - MANDATORY before editing any file
38
+ - Returns `testAssociations`: which tests cover this file
39
+ - Shows file dependencies and relationships
201
40
 
202
- **Liquid template handling:**
203
- - `{% schema %}` blocks - Kept as single chunks, section names extracted
204
- - `{% style %}` blocks - Preserved together for scoped CSS
205
- - `{% javascript %}` blocks - Kept intact
206
- - Oversized blocks (>225 lines) - Intelligently split to prevent token limits
41
+ **`list_functions({ pattern: ".*Controller.*" })`**
42
+ - Fast symbol lookup by naming pattern
43
+ - Use for structural queries: "show all services", "find handlers"
44
+ - 10x faster than semantic_search for name-based lookups
207
45
 
208
- **JSON template handling (Shopify 2.0+):**
209
- - `templates/**/*.json` - Template definition files
210
- - Section references extracted from JSON structure
211
- - Template names extracted from filepath
46
+ **`find_similar({ code: "snippet to match" })`**
47
+ - Find similar implementations for consistency
48
+ - Use when refactoring or detecting duplication
212
49
 
213
- **Complete dependency tracking (tracked in `metadata.imports`):**
214
- - `{% render 'snippet-name' %}` - Snippet dependencies
215
- - `{% include 'snippet-name' %}` - Legacy includes
216
- - `{% section 'section-name' %}` - Section usage in layouts
217
- - JSON template sections - Section type references
50
+ ## Test Associations
218
51
 
219
- **Example metadata:**
220
- ```typescript
221
- // JSON Template
222
- {
223
- content: "{\"sections\": {\"main\": {\"type\": \"main-product\"}}}",
224
- metadata: {
225
- file: "templates/product.json",
226
- type: "template",
227
- language: "json",
228
- symbolName: "product", // Template name
229
- symbolType: "template",
230
- imports: ["main-product"] // Sections used by this template
231
- }
232
- }
52
+ `get_file_context` returns `testAssociations` showing which tests cover the file.
53
+ ALWAYS check this before modifying source code.
54
+ After changes, remind the user: "This file is covered by [test files] - run these to verify."
233
55
 
234
- // Liquid Section Schema
235
- {
236
- content: "{% schema %}\n{\"name\": \"Hero Section\", ...}\n{% endschema %}",
237
- metadata: {
238
- file: "sections/hero.liquid",
239
- type: "block",
240
- language: "liquid",
241
- symbolName: "Hero Section", // Extracted from schema JSON
242
- symbolType: "schema",
243
- imports: undefined // No render/include/section tags found in this block
244
- }
245
- }
56
+ ## Workflow Patterns
246
57
 
247
- // Liquid Template Content
248
- {
249
- content: "<div>{% render 'logo' %}{% render 'nav' %}</div>",
250
- metadata: {
251
- file: "sections/header.liquid",
252
- type: "template",
253
- language: "liquid",
254
- imports: ["logo", "nav"] // Tracked dependencies
255
- }
256
- }
58
+ ### Pattern 1: "Where is X?" / "How does X work?"
257
59
  ```
258
-
259
- **Benefits:**
260
- - **Complete dependency graph** - JSON templates → sections → snippets
261
- - **Schema preservation** - Never splits section configuration across chunks
262
- - **Better context** - AI knows full theme structure and all dependencies
263
-
264
- ### Known Limitations
265
-
266
- **Very large files (1000+ lines):**
267
- - Tree-sitter may fail with "Invalid argument" error on extremely large files
268
- - When this occurs, Lien automatically falls back to line-based chunking
269
- - This is a known Tree-sitter limitation with very large syntax trees
270
- - Fallback behavior is configurable via `astFallback` setting
271
-
272
- **Resilient parsing:**
273
- - Tree-sitter is designed to produce best-effort ASTs even for invalid syntax
274
- - Parse errors are rare; most malformed code still produces usable chunks
275
- - The `astFallback: 'error'` option mainly catches edge cases like large file errors
276
-
277
- ### Configuration
278
-
279
- Control AST behavior in `.lien.config.json`:
280
-
281
- ```json
282
- {
283
- "chunking": {
284
- "useAST": true, // Enable AST-based chunking (default: true)
285
- "astFallback": "line-based" // Fallback strategy: 'line-based' | 'error'
286
- }
287
- }
288
- ```
289
-
290
- ---
291
-
292
- ## Input Validation & Error Handling
293
-
294
- Lien uses Zod schemas for runtime type-safe validation of all tool inputs. This provides:
295
- - **Automatic validation** of all parameters before tool execution
296
- - **Rich error messages** with field-level feedback
297
- - **Type safety** with full TypeScript inference
298
- - **Consistent error structure** across all tools
299
-
300
- ### Understanding Validation Errors
301
-
302
- When you provide invalid parameters, you'll receive a structured error response:
303
-
304
- ```json
305
- {
306
- "error": "Invalid parameters",
307
- "code": "INVALID_INPUT",
308
- "details": [
309
- {
310
- "field": "query",
311
- "message": "Query must be at least 3 characters"
312
- },
313
- {
314
- "field": "limit",
315
- "message": "Limit cannot exceed 50"
316
- }
317
- ]
318
- }
319
- ```
320
-
321
- ### Common Validation Rules
322
-
323
- **semantic_search:**
324
- - `query`: 3-500 characters (required)
325
- - `limit`: 1-50 (default: 5)
326
-
327
- **find_similar:**
328
- - `code`: minimum 10 characters (required)
329
- - `limit`: 1-20 (default: 5)
330
-
331
- **get_file_context:**
332
- - `filepath`: cannot be empty (required)
333
- - `includeRelated`: boolean (default: true)
334
-
335
- **list_functions:**
336
- - `pattern`: optional regex string
337
- - `language`: optional language filter
338
-
339
- ### Error Codes
340
-
341
- Lien uses structured error codes for programmatic error handling:
342
-
343
- - `INVALID_INPUT` - Parameter validation failed
344
- - `FILE_NOT_FOUND` - Requested file doesn't exist in index
345
- - `INDEX_NOT_FOUND` - No index found (run `lien index`)
346
- - `INDEX_CORRUPTED` - Index is corrupted (run `lien index` to rebuild)
347
- - `EMBEDDING_GENERATION_FAILED` - Embedding model failed (retryable)
348
- - `INTERNAL_ERROR` - Unexpected internal error
349
-
350
- ### Best Practices
351
-
352
- 1. **Always provide required fields**: Check tool schemas for required parameters
353
- 2. **Respect validation limits**: Don't exceed max values for `limit` parameters
354
- 3. **Use descriptive queries**: Avoid very short or vague queries
355
- 4. **Handle validation errors gracefully**: Parse error details to understand what went wrong
356
-
357
- ---
358
-
359
- ## Workflow Patterns (FOLLOW THESE)
360
-
361
- ### Pattern 1: User Asks "Where is X?"
362
- ```
363
- 1. semantic_search({ query: "X functionality" })
364
- 2. Review results, identify file(s)
60
+ 1. semantic_search({ query: "X implementation" })
61
+ 2. Review results (check relevance scores)
365
62
  3. get_file_context({ filepath: "identified/file.ts" })
366
- 4. Answer with specific information
63
+ 4. Answer with specific code locations
367
64
  ```
368
65
 
369
- ### Pattern 2: User Asks to Edit/Change Code
66
+ ### Pattern 2: Edit or Change Code
370
67
  ```
371
68
  1. semantic_search({ query: "area being modified" })
372
69
  2. get_file_context({ filepath: "target/file.ts" })
373
- 3. find_similar({ code: "existing pattern" }) // if ensuring consistency
374
- 4. Make changes with full context
375
- ```
376
-
377
- ### Pattern 3: User Asks "How Does X Work?"
378
- ```
379
- 1. semantic_search({ query: "X implementation", limit: 10 })
380
- 2. Review top results
381
- 3. get_file_context for key files
382
- 4. Explain with references to actual code locations
383
- ```
384
-
385
- ### Pattern 4: Debugging or Understanding Error
386
- ```
387
- 1. semantic_search({ query: "error handling for [area]" })
388
- 2. semantic_search({ query: "[specific error type] handling" })
389
- 3. get_file_context for relevant files
390
- 4. Provide analysis
391
- ```
392
-
393
- ### Pattern 5: Modifying Source Code (Test-Aware)
394
- ```
395
- 1. semantic_search({ query: "functionality being modified" })
396
- 2. get_file_context({ filepath: "target/file.ts" })
397
- 3. Check testAssociations in response to see which tests cover this code
70
+ 3. Check testAssociations in response
398
71
  4. Make changes
399
- 5. Remind user to run the associated tests
72
+ 5. Tell user which tests to run
400
73
  ```
401
74
 
402
- ### Pattern 6: Understanding Test Coverage
403
- ```
404
- 1. get_file_context({ filepath: "src/component.ts" })
405
- 2. Review testAssociations field in response
406
- 3. Use get_file_context for each test file to understand coverage
407
- 4. Analyze and suggest improvements
408
- ```
409
-
410
- ### Pattern 7: Finding All Classes/Functions by Name Pattern ⚡
411
- ```
412
- 1. list_functions({ pattern: ".*Controller.*", language: "php" })
413
- 2. Review the list of matching classes
414
- 3. Use get_file_context on specific files for deeper investigation
415
- 4. Answer user's structural/architectural questions
416
- ```
75
+ ## Query Construction
417
76
 
418
- **Example queries:**
419
- - "Show me all Controllers" → `list_functions({ pattern: ".*Controller.*" })`
420
- - "What Services exist?" → `list_functions({ pattern: ".*Service.*" })`
421
- - "Find all API handlers" → `list_functions({ pattern: "handle.*" })`
422
-
423
- ### Pattern 8: Working with Shopify Themes (Liquid + JSON) ⚡
424
- ```
425
- 1. semantic_search({ query: "product template configuration" })
426
- → Finds JSON template with section references
427
- 2. Check metadata.imports to see which sections are used
428
- 3. semantic_search({ query: "main-product section schema" })
429
- → Find section definition
430
- 4. Review section's metadata.imports to see which snippets it renders
431
- → Complete dependency chain visible!
432
- ```
433
-
434
- **Example queries:**
435
- - "Find the product template sections" → Returns `templates/product.json` with section imports
436
- - "Which sections are on the collection page?" → Check JSON template imports
437
- - "What sections use the product-card snippet?" → Reverse lookup via imports
438
- - "Show the hero section schema" → Returns complete `{% schema %}` block with name
439
- - "What snippets does the footer render?" → See `metadata.imports: ["logo", "nav", ...]`
440
-
441
- **Complete dependency graph:**
442
- ```
443
- templates/product.json
444
- → imports: ["main-product", "recommendations"]
445
- → sections/main-product.liquid
446
- → imports: ["product-card", "price-tag"]
447
- → snippets/product-card.liquid
448
- → snippets/price-tag.liquid
449
- ```
450
-
451
- **Dependency tracking:**
452
- - **JSON templates** - `metadata.imports` contains section type references
453
- - **Liquid templates** - `metadata.imports` contains `{% render %}`, `{% include %}`, `{% section %}` references
454
- - Full theme architecture visible through imports metadata
455
-
456
- ---
457
-
458
- ## Decision Tree: Lien vs Other Tools
459
-
460
- ### Use `semantic_search` when:
461
- ✅ User asks about functionality, features, or "how X works"
462
- ✅ You need to understand what code exists before editing
463
- ✅ Looking for patterns, implementations, handlers, validators, etc.
464
- ✅ Exploring unfamiliar parts of codebase
465
- ✅ Searching by what code **does** (behavior, functionality)
466
-
467
- ### Use `list_functions` when: ⚡
468
- ✅ User asks "show me all Controllers" or similar structural queries
469
- ✅ Looking for classes/functions matching a **naming pattern**
470
- ✅ Getting architectural overview (all Services, all Handlers, etc.)
471
- ✅ Searching by what code is **named** (symbol names, not behavior)
472
- ✅ Need fast results for known naming conventions
473
-
474
- ### Use `grep` when:
475
- ✅ User provides exact function/variable name to find
476
- ✅ Looking for specific string literals or imports
477
- ✅ Finding all occurrences of exact text
478
-
479
- ### Use `get_file_context` when:
480
- ✅ You identified a file via search and need to understand it
481
- ✅ About to edit a file (MANDATORY)
482
- ✅ Need to understand file relationships and dependencies
483
-
484
- ### Use `find_similar` when:
485
- ✅ Refactoring multiple similar pieces of code
486
- ✅ Ensuring new code matches existing patterns
487
- ✅ Finding duplicated logic
488
-
489
- ### Check test associations when:
490
- ✅ Before modifying any source file (use `get_file_context` to see testAssociations)
491
- ✅ User asks "what tests cover this?" (use `semantic_search` and check metadata)
492
- ✅ Understanding what a test file is testing (use `get_file_context` on the test file)
493
- ✅ Working on bug fixes (search results include test metadata)
494
-
495
- ---
496
-
497
- ## Query Construction Guide
498
-
499
- ### Good Semantic Queries (DO THIS):
77
+ ### Good Queries (DO THIS)
500
78
  - "handles user authentication"
501
- - "validates email addresses"
79
+ - "validates email addresses"
502
80
  - "processes payment transactions"
503
- - "parses JSON responses"
504
- - "middleware for authorization"
505
81
  - "React components with form state"
506
- - "database migration scripts"
507
82
  - "API endpoints for user data"
508
- - "Shopify section schema for hero banner" (Liquid)
509
- - "files that render product-card snippet" (Liquid)
510
- - "layout file with header and footer sections" (Liquid)
511
83
 
512
- ### Bad Queries (DON'T DO THIS):
84
+ ### Bad Queries (DON'T DO THIS)
513
85
  - "auth" (too vague)
514
86
  - "validateEmail" (use grep for exact names)
515
- - "line 234" (Lien doesn't work with line numbers)
516
87
  - "code" (way too generic)
517
88
 
518
- ### Query Formula:
519
- `[action verb] + [domain object] + [optional context]`
520
- - "handles authentication for API requests"
521
- - "validates user input in forms"
522
- - "caches API responses from external services"
89
+ **Formula:** `[action verb] + [domain object] + [optional context]`
523
90
 
524
- ---
91
+ ## AST Metadata
525
92
 
526
- ## Performance Notes
93
+ Results include rich metadata: `symbolName`, `symbolType`, `complexity`, `parameters`, `signature`.
527
94
 
528
- - First query loads embeddings (~1-2s), subsequent queries are fast (<500ms)
529
- - Increase `limit` to 10-15 for broad exploration
530
- - Results are ranked by semantic relevance (trust the ranking)
531
- - User can re-index with `lien index` if results seem stale
532
- - **Relevance categories**: All search results include a `relevance` field (`highly_relevant`, `relevant`, `loosely_related`, `not_relevant`) to help interpret search quality at a glance
533
- - **Test associations**: Lien automatically detects test-source relationships across 12 languages using convention-based patterns and import analysis
534
- - **Shopify Liquid themes**: Semantic chunking reduces chunk count by ~60% (schema/style/javascript blocks preserved), improving search quality and performance
95
+ Use for filtering:
96
+ - Complex functions: `results.filter(r => r.metadata.complexity > 5)`
97
+ - Methods only: `results.filter(r => r.metadata.symbolType === 'method')`
535
98
 
536
- ---
99
+ ## When to Use grep Instead
537
100
 
538
- ## Key Principles
101
+ ONLY use grep/ripgrep when:
102
+ - User provides an exact string/function name to find
103
+ - Looking for specific imports or string literals
104
+ - Semantic search returned no results
539
105
 
540
- 1. **Search First, Read Second**: Use Lien before reading files blindly
541
- 2. **Semantic Over Syntactic**: Think about what code *does*, not what it's *named*
542
- 3. **Context Before Changes**: Always get file context before editing
543
- 4. **Test-Aware Development**: Check testAssociations in results to understand test coverage
544
- 5. **Trust the Results**: Semantic search finds relevant code even with different naming. Use the `relevance` field (`highly_relevant`, `relevant`, `loosely_related`, `not_relevant`) to quickly assess result quality
545
- 6. **Chain Your Tools**: semantic_search → get_file_context (includes testAssociations) → make changes is a powerful pattern
106
+ For everything else: **Lien first.**
546
107
 
547
108
  ---
548
109
 
549
- ## Setup Instructions
550
-
551
- Create a `lien.mdc` file in your `.cursor/rules/` directory:
552
-
553
- ```bash
554
- # From your project directory
555
- mkdir -p .cursor/rules
556
- cp node_modules/@liendev/lien/CURSOR_RULES_TEMPLATE.md .cursor/rules/lien.mdc
557
- ```
558
-
559
- The `alwaysApply: true` frontmatter ensures Cursor uses Lien for all files in your project.
560
-
561
- This approach allows you to have multiple rule files in `.cursor/rules/` without conflicts.
562
-
563
- **Note:** The template is automatically copied during `lien init` to `.cursor/rules/lien.mdc`.
564
-
110
+ REMINDER: semantic_search and get_file_context FIRST. grep is the fallback, not the default.