lynkr 7.2.5 → 8.0.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.
Files changed (124) hide show
  1. package/README.md +3 -3
  2. package/config/model-tiers.json +89 -0
  3. package/install.sh +6 -1
  4. package/package.json +4 -2
  5. package/scripts/setup.js +0 -1
  6. package/src/agents/executor.js +14 -6
  7. package/src/api/middleware/session.js +15 -2
  8. package/src/api/openai-router.js +162 -37
  9. package/src/api/providers-handler.js +15 -1
  10. package/src/api/router.js +107 -2
  11. package/src/budget/index.js +4 -3
  12. package/src/clients/databricks.js +431 -234
  13. package/src/clients/gpt-utils.js +181 -0
  14. package/src/clients/ollama-utils.js +66 -140
  15. package/src/clients/routing.js +0 -1
  16. package/src/clients/standard-tools.js +99 -3
  17. package/src/config/index.js +133 -35
  18. package/src/context/toon.js +173 -0
  19. package/src/logger/index.js +23 -0
  20. package/src/orchestrator/index.js +688 -213
  21. package/src/routing/agentic-detector.js +320 -0
  22. package/src/routing/complexity-analyzer.js +202 -2
  23. package/src/routing/cost-optimizer.js +305 -0
  24. package/src/routing/index.js +168 -159
  25. package/src/routing/model-tiers.js +365 -0
  26. package/src/server.js +4 -14
  27. package/src/sessions/cleanup.js +3 -3
  28. package/src/sessions/record.js +10 -1
  29. package/src/sessions/store.js +7 -2
  30. package/src/tools/agent-task.js +48 -1
  31. package/src/tools/index.js +19 -2
  32. package/src/tools/lazy-loader.js +7 -0
  33. package/src/tools/tinyfish.js +358 -0
  34. package/src/tools/truncate.js +1 -0
  35. package/.github/FUNDING.yml +0 -15
  36. package/.github/workflows/README.md +0 -215
  37. package/.github/workflows/ci.yml +0 -69
  38. package/.github/workflows/index.yml +0 -62
  39. package/.github/workflows/web-tools-tests.yml +0 -56
  40. package/CITATIONS.bib +0 -6
  41. package/CLAWROUTER_ROUTING_PLAN.md +0 -910
  42. package/DEPLOYMENT.md +0 -1001
  43. package/LYNKR-TUI-PLAN.md +0 -984
  44. package/PERFORMANCE-REPORT.md +0 -866
  45. package/PLAN-per-client-model-routing.md +0 -252
  46. package/ROUTER_COMPARISON.md +0 -173
  47. package/TIER_ROUTING_PLAN.md +0 -771
  48. package/docs/42642f749da6234f41b6b425c3bb07c9.txt +0 -1
  49. package/docs/BingSiteAuth.xml +0 -4
  50. package/docs/docs-style.css +0 -478
  51. package/docs/docs.html +0 -197
  52. package/docs/google5be250e608e6da39.html +0 -1
  53. package/docs/index.html +0 -577
  54. package/docs/index.md +0 -577
  55. package/docs/robots.txt +0 -4
  56. package/docs/sitemap.xml +0 -44
  57. package/docs/style.css +0 -1223
  58. package/documentation/README.md +0 -100
  59. package/documentation/api.md +0 -806
  60. package/documentation/claude-code-cli.md +0 -672
  61. package/documentation/codex-cli.md +0 -397
  62. package/documentation/contributing.md +0 -571
  63. package/documentation/cursor-integration.md +0 -731
  64. package/documentation/docker.md +0 -867
  65. package/documentation/embeddings.md +0 -760
  66. package/documentation/faq.md +0 -659
  67. package/documentation/features.md +0 -396
  68. package/documentation/headroom.md +0 -519
  69. package/documentation/installation.md +0 -706
  70. package/documentation/memory-system.md +0 -476
  71. package/documentation/production.md +0 -601
  72. package/documentation/providers.md +0 -906
  73. package/documentation/testing.md +0 -629
  74. package/documentation/token-optimization.md +0 -323
  75. package/documentation/tools.md +0 -697
  76. package/documentation/troubleshooting.md +0 -893
  77. package/final-test.js +0 -33
  78. package/headroom-sidecar/config.py +0 -93
  79. package/headroom-sidecar/requirements.txt +0 -14
  80. package/headroom-sidecar/server.py +0 -451
  81. package/monitor-agents.sh +0 -31
  82. package/scripts/audit-log-reader.js +0 -399
  83. package/scripts/compact-dictionary.js +0 -204
  84. package/scripts/test-deduplication.js +0 -448
  85. package/src/db/database.sqlite +0 -0
  86. package/test/README.md +0 -212
  87. package/test/azure-openai-config.test.js +0 -204
  88. package/test/azure-openai-error-resilience.test.js +0 -238
  89. package/test/azure-openai-format-conversion.test.js +0 -354
  90. package/test/azure-openai-integration.test.js +0 -281
  91. package/test/azure-openai-routing.test.js +0 -177
  92. package/test/azure-openai-streaming.test.js +0 -171
  93. package/test/bedrock-integration.test.js +0 -471
  94. package/test/comprehensive-test-suite.js +0 -928
  95. package/test/config-validation.test.js +0 -207
  96. package/test/cursor-integration.test.js +0 -484
  97. package/test/format-conversion.test.js +0 -578
  98. package/test/hybrid-routing-integration.test.js +0 -254
  99. package/test/hybrid-routing-performance.test.js +0 -418
  100. package/test/llamacpp-integration.test.js +0 -863
  101. package/test/lmstudio-integration.test.js +0 -335
  102. package/test/memory/extractor.test.js +0 -398
  103. package/test/memory/retriever.test.js +0 -613
  104. package/test/memory/retriever.test.js.bak +0 -585
  105. package/test/memory/search.test.js +0 -537
  106. package/test/memory/search.test.js.bak +0 -389
  107. package/test/memory/store.test.js +0 -344
  108. package/test/memory/store.test.js.bak +0 -312
  109. package/test/memory/surprise.test.js +0 -300
  110. package/test/memory-performance.test.js +0 -472
  111. package/test/openai-integration.test.js +0 -686
  112. package/test/openrouter-error-resilience.test.js +0 -418
  113. package/test/passthrough-mode.test.js +0 -385
  114. package/test/performance-benchmark.js +0 -351
  115. package/test/performance-tests.js +0 -528
  116. package/test/routing.test.js +0 -219
  117. package/test/web-tools.test.js +0 -329
  118. package/test-agents-simple.js +0 -43
  119. package/test-cli-connection.sh +0 -33
  120. package/test-learning-unit.js +0 -126
  121. package/test-learning.js +0 -112
  122. package/test-parallel-agents.sh +0 -124
  123. package/test-parallel-direct.js +0 -155
  124. package/test-subagents.sh +0 -117
@@ -1,672 +0,0 @@
1
- # Claude Code CLI Setup Guide
2
-
3
- Complete guide to using Claude Code CLI with Lynkr for provider flexibility, cost savings, and local model support.
4
-
5
- ---
6
-
7
- ## Overview
8
-
9
- Lynkr acts as a drop-in replacement for Anthropic's backend, enabling Claude Code CLI to work with any LLM provider (Databricks, Bedrock, OpenRouter, Ollama, etc.) while maintaining full compatibility with all Claude Code features.
10
-
11
- ### Why Use Lynkr with Claude Code CLI?
12
-
13
- - 💰 **60-80% cost savings** through token optimization
14
- - 🔓 **Provider choice** - Use any of 9+ supported providers
15
- - 🏠 **Self-hosted** - Full control over your AI infrastructure
16
- - 🔒 **Local option** - Run 100% offline with Ollama or llama.cpp
17
- - ✅ **Zero code changes** - Drop-in replacement for Anthropic backend
18
- - 📊 **Full observability** - Logs, metrics, token tracking
19
-
20
- ---
21
-
22
- ## Quick Setup (3 Minutes)
23
-
24
- ### Step 1: Install Lynkr
25
-
26
- ```bash
27
- # Option A: NPM (Recommended)
28
- npm install -g lynkr
29
-
30
- # Option B: Homebrew (macOS)
31
- brew tap vishalveerareddy123/lynkr
32
- brew install lynkr
33
-
34
- # Option C: Git Clone
35
- git clone https://github.com/vishalveerareddy123/Lynkr.git
36
- cd Lynkr && npm install
37
- ```
38
-
39
- ---
40
-
41
- ### Step 2: Configure Provider
42
-
43
- Choose your provider and configure credentials:
44
-
45
- **Option A: AWS Bedrock (100+ models)**
46
- ```bash
47
- export MODEL_PROVIDER=bedrock
48
- export AWS_BEDROCK_API_KEY=your-bearer-token
49
- export AWS_BEDROCK_REGION=us-east-1
50
- export AWS_BEDROCK_MODEL_ID=anthropic.claude-3-5-sonnet-20241022-v2:0
51
- ```
52
-
53
- **Option B: Ollama (100% Local, FREE)**
54
- ```bash
55
- # Start Ollama first
56
- ollama serve
57
- ollama pull llama3.1:8b
58
-
59
- export MODEL_PROVIDER=ollama
60
- export OLLAMA_MODEL=llama3.1:8b
61
- ```
62
-
63
- **Option C: OpenRouter (Simplest Cloud)**
64
- ```bash
65
- export MODEL_PROVIDER=openrouter
66
- export OPENROUTER_API_KEY=sk-or-v1-your-key
67
- export OPENROUTER_MODEL=anthropic/claude-3.5-sonnet
68
- ```
69
-
70
- **Option D: Databricks (Enterprise)**
71
- ```bash
72
- export MODEL_PROVIDER=databricks
73
- export DATABRICKS_API_BASE=https://your-workspace.databricks.com
74
- export DATABRICKS_API_KEY=dapi1234567890abcdef
75
- ```
76
-
77
- See [Provider Configuration Guide](providers.md) for all 9+ providers.
78
-
79
- ---
80
-
81
- ### Step 3: Start Lynkr
82
-
83
- ```bash
84
- lynkr start
85
- # Or: npm start (if installed from source)
86
-
87
- # Wait for: "Server listening at http://0.0.0.0:8081"
88
- ```
89
-
90
- ---
91
-
92
- ### Step 4: Configure Claude Code CLI
93
-
94
- Point Claude Code CLI to Lynkr instead of Anthropic:
95
-
96
- ```bash
97
- # Set Lynkr as backend
98
- export ANTHROPIC_BASE_URL=http://localhost:8081
99
- export ANTHROPIC_API_KEY=dummy # Required by CLI, but ignored by Lynkr
100
-
101
- # Verify configuration
102
- echo $ANTHROPIC_BASE_URL
103
- # Should show: http://localhost:8081
104
- ```
105
-
106
- ---
107
-
108
- ### Step 5: Test It
109
-
110
- ```bash
111
- # Simple test
112
- claude "What is 2+2?"
113
-
114
- # Should return response from your configured provider ✅
115
-
116
- # File operation test
117
- claude "List files in current directory"
118
-
119
- # Should use Read/Bash tools ✅
120
- ```
121
-
122
- ---
123
-
124
- ## Configuration Options
125
-
126
- ### Environment Variables
127
-
128
- **Core Variables:**
129
- ```bash
130
- # Lynkr backend URL (required)
131
- export ANTHROPIC_BASE_URL=http://localhost:8081
132
-
133
- # API key (required by CLI, but ignored by Lynkr)
134
- export ANTHROPIC_API_KEY=dummy
135
-
136
- # Workspace directory (optional, defaults to current directory)
137
- export WORKSPACE_ROOT=/path/to/your/projects
138
- ```
139
-
140
- **Make Permanent (Optional):**
141
-
142
- Add to `~/.bashrc`, `~/.zshrc`, or `~/.profile`:
143
-
144
- ```bash
145
- # Add these lines to your shell config
146
- export ANTHROPIC_BASE_URL=http://localhost:8081
147
- export ANTHROPIC_API_KEY=dummy
148
- ```
149
-
150
- Then reload:
151
- ```bash
152
- source ~/.bashrc # or ~/.zshrc
153
- ```
154
-
155
- ---
156
-
157
- ## Feature Compatibility
158
-
159
- ### Fully Supported Features
160
-
161
- All Claude Code CLI features work through Lynkr:
162
-
163
- | Feature | Status | Notes |
164
- |---------|--------|-------|
165
- | **Chat conversations** | ✅ Works | Full streaming support |
166
- | **File operations** | ✅ Works | Read, Write, Edit tools |
167
- | **Bash commands** | ✅ Works | Execute shell commands |
168
- | **Git operations** | ✅ Works | Status, diff, commit, push |
169
- | **Tool calling** | ✅ Works | All standard Claude Code tools |
170
- | **Streaming responses** | ✅ Works | Real-time token streaming |
171
- | **Multi-turn conversations** | ✅ Works | Full context retention |
172
- | **Code generation** | ✅ Works | Works with all providers |
173
- | **Error handling** | ✅ Works | Automatic retries, fallbacks |
174
- | **Token counting** | ✅ Works | Accurate usage tracking |
175
-
176
- ### Tool Execution Modes
177
-
178
- Lynkr supports two tool execution modes:
179
-
180
- **Server Mode (Default)**
181
- ```bash
182
- # Tools execute on Lynkr server
183
- export TOOL_EXECUTION_MODE=server
184
- ```
185
- - Tools run on the machine running Lynkr
186
- - Good for: Standalone proxy, shared team server
187
- - File operations access server filesystem
188
-
189
- **Client Mode (Passthrough)**
190
- ```bash
191
- # Tools execute on Claude Code CLI side
192
- export TOOL_EXECUTION_MODE=client
193
- ```
194
- - Tools run on your local machine (where you run `claude`)
195
- - Good for: Local development, accessing local files
196
- - Full integration with local environment
197
-
198
- ---
199
-
200
- ## Usage Examples
201
-
202
- ### Basic Chat
203
-
204
- ```bash
205
- # Simple question
206
- claude "Explain async/await in JavaScript"
207
-
208
- # Code explanation
209
- claude "Explain this function" < app.js
210
-
211
- # Multi-line prompt
212
- claude "Write a function that:
213
- - Takes an array of numbers
214
- - Filters out even numbers
215
- - Returns the sum of odd numbers"
216
- ```
217
-
218
- ---
219
-
220
- ### File Operations
221
-
222
- ```bash
223
- # Read file
224
- claude "What does this file do?" < src/server.js
225
-
226
- # Create file
227
- claude "Create a new Express server in server.js"
228
-
229
- # Edit file
230
- claude "Add error handling to src/api/router.js"
231
-
232
- # Multiple files
233
- claude "Refactor authentication across src/auth/*.js files"
234
- ```
235
-
236
- ---
237
-
238
- ### Git Workflow
239
-
240
- ```bash
241
- # Status check
242
- claude "What files have changed?"
243
-
244
- # Review diff
245
- claude "Review my changes and suggest improvements"
246
-
247
- # Commit changes
248
- claude "Commit these changes with a descriptive message"
249
-
250
- # Create PR (if gh CLI installed)
251
- claude "Create a pull request for these changes"
252
- ```
253
-
254
- ---
255
-
256
- ### Code Generation
257
-
258
- ```bash
259
- # Generate function
260
- claude "Write a binary search function in Python"
261
-
262
- # Generate tests
263
- claude "Write unit tests for utils/validation.js"
264
-
265
- # Generate documentation
266
- claude "Add JSDoc comments to this file" < src/helpers.js
267
- ```
268
-
269
- ---
270
-
271
- ## Provider-Specific Considerations
272
-
273
- ### AWS Bedrock
274
-
275
- **Best for:** AWS ecosystem, 100+ models
276
-
277
- ```bash
278
- export MODEL_PROVIDER=bedrock
279
- export AWS_BEDROCK_MODEL_ID=anthropic.claude-3-5-sonnet-20241022-v2:0
280
- ```
281
-
282
- **Considerations:**
283
- - ✅ Tool calling works (Claude models only)
284
- - ✅ Streaming supported
285
- - ⚠️ Non-Claude models don't support tools
286
-
287
- ---
288
-
289
- ### Ollama (Local)
290
-
291
- **Best for:** Privacy, offline work, zero costs
292
-
293
- ```bash
294
- export MODEL_PROVIDER=ollama
295
- export OLLAMA_MODEL=llama3.1:8b
296
- ```
297
-
298
- **Considerations:**
299
- - ✅ 100% FREE, runs locally
300
- - ✅ Tool calling supported (llama3.1, llama3.2, qwen2.5, mistral)
301
- - ⚠️ Smaller models may struggle with complex tool usage
302
- - 💡 Use `qwen2.5:14b` for better tool calling
303
-
304
- **Recommended models:**
305
- - `llama3.1:8b` - Good balance
306
- - `qwen2.5:14b` - Better reasoning (7b struggles)
307
- - `mistral:7b-instruct` - Fast and capable
308
-
309
- ---
310
-
311
- ### OpenRouter
312
-
313
- **Best for:** Simplicity, flexibility, 100+ models
314
-
315
- ```bash
316
- export MODEL_PROVIDER=openrouter
317
- export OPENROUTER_MODEL=anthropic/claude-3.5-sonnet
318
- ```
319
-
320
- **Considerations:**
321
- - ✅ 100+ models available
322
- - ✅ Excellent tool calling support
323
- - ✅ Automatic fallbacks
324
- - 💰 Competitive pricing
325
-
326
- ---
327
-
328
- ### Databricks
329
-
330
- **Best for:** Enterprise production, Claude 4.5
331
-
332
- ```bash
333
- export MODEL_PROVIDER=databricks
334
- ```
335
-
336
- **Considerations:**
337
- - ✅ Claude Sonnet 4.5, Opus 4.5
338
- - ✅ Enterprise SLA
339
- - ✅ Excellent tool calling
340
- - 💰 Enterprise pricing
341
-
342
- ---
343
-
344
- ## Hybrid Routing (Cost Optimization)
345
-
346
- Use local Ollama for simple tasks, fallback to cloud for complex ones:
347
-
348
- ```bash
349
- # Configure hybrid routing
350
- export MODEL_PROVIDER=ollama
351
- export OLLAMA_MODEL=llama3.1:8b
352
- export PREFER_OLLAMA=true
353
- export FALLBACK_ENABLED=true
354
- export FALLBACK_PROVIDER=databricks
355
- export DATABRICKS_API_BASE=https://your-workspace.databricks.com
356
- export DATABRICKS_API_KEY=your-key
357
-
358
- # Start Lynkr
359
- lynkr start
360
- ```
361
-
362
- **How it works:**
363
- - **0-2 tools**: Ollama (free, local, fast)
364
- - **3-15 tools**: OpenRouter (if configured) or fallback
365
- - **16+ tools**: Databricks/Azure (most capable)
366
- - **Ollama failures**: Automatic transparent fallback to cloud
367
-
368
- **Cost savings:**
369
- - **65-100%** for requests that stay on Ollama
370
- - **40-87%** faster for simple requests
371
-
372
- ---
373
-
374
- ## Verification & Testing
375
-
376
- ### Check Lynkr Health
377
-
378
- ```bash
379
- curl http://localhost:8081/health/live
380
-
381
- # Expected response:
382
- {
383
- "status": "ok",
384
- "provider": "bedrock",
385
- "timestamp": "2026-01-12T00:00:00.000Z"
386
- }
387
- ```
388
-
389
- ### Test API Endpoint
390
-
391
- ```bash
392
- curl http://localhost:8081/v1/messages \
393
- -H "Content-Type: application/json" \
394
- -H "anthropic-version: 2023-06-01" \
395
- -d '{
396
- "model": "claude-3-5-sonnet-20241022",
397
- "max_tokens": 1024,
398
- "messages": [
399
- {"role": "user", "content": "Hello!"}
400
- ]
401
- }'
402
-
403
- # Should return Claude-compatible response from your provider
404
- ```
405
-
406
- ### Test Claude CLI
407
-
408
- ```bash
409
- # Simple test
410
- claude "Hello, can you see this?"
411
-
412
- # Tool calling test
413
- claude "What files are in the current directory?"
414
-
415
- # Should use Read/Bash tools and return results
416
- ```
417
-
418
- ---
419
-
420
- ## Troubleshooting
421
-
422
- ### Connection Refused
423
-
424
- **Symptoms:** `Connection refused` or `ECONNREFUSED`
425
-
426
- **Solutions:**
427
-
428
- 1. **Verify Lynkr is running:**
429
- ```bash
430
- lsof -i :8081
431
- # Should show node process
432
- ```
433
-
434
- 2. **Check URL configuration:**
435
- ```bash
436
- echo $ANTHROPIC_BASE_URL
437
- # Should be: http://localhost:8081
438
- ```
439
-
440
- 3. **Test health endpoint:**
441
- ```bash
442
- curl http://localhost:8081/health/live
443
- # Should return: {"status":"ok"}
444
- ```
445
-
446
- ---
447
-
448
- ### Provider Authentication Errors
449
-
450
- **Symptoms:** `401 Unauthorized` or `403 Forbidden`
451
-
452
- **Solutions:**
453
-
454
- 1. **Check provider credentials:**
455
- ```bash
456
- # For Bedrock
457
- echo $AWS_BEDROCK_API_KEY
458
-
459
- # For Databricks
460
- echo $DATABRICKS_API_KEY
461
-
462
- # For OpenRouter
463
- echo $OPENROUTER_API_KEY
464
- ```
465
-
466
- 2. **Verify credentials are valid:**
467
- - Bedrock: Check AWS Console → Bedrock → API Keys
468
- - Databricks: Check workspace → Settings → User Settings → Tokens
469
- - OpenRouter: Check openrouter.ai/keys
470
-
471
- 3. **Check Lynkr logs:**
472
- ```bash
473
- # In Lynkr terminal, look for authentication errors
474
- ```
475
-
476
- ---
477
-
478
- ### Tool Execution Errors
479
-
480
- **Symptoms:** Tools fail to execute or return errors
481
-
482
- **Solutions:**
483
-
484
- 1. **Check tool execution mode:**
485
- ```bash
486
- echo $TOOL_EXECUTION_MODE
487
- # Should be: server (default) or client
488
- ```
489
-
490
- 2. **Verify workspace root:**
491
- ```bash
492
- echo $WORKSPACE_ROOT
493
- # Should be valid directory path
494
- ```
495
-
496
- 3. **Check file permissions:**
497
- ```bash
498
- # For server mode, Lynkr needs read/write access
499
- ls -la $WORKSPACE_ROOT
500
- ```
501
-
502
- ---
503
-
504
- ### Model Not Found
505
-
506
- **Symptoms:** `Model not found` or `Invalid model`
507
-
508
- **Solutions:**
509
-
510
- 1. **Verify model is available:**
511
- ```bash
512
- # For Ollama
513
- ollama list
514
- # Should show your configured model
515
-
516
- # For Bedrock
517
- # Check AWS Console → Bedrock → Model access
518
- ```
519
-
520
- 2. **Check model name matches provider:**
521
- - Bedrock: Use full model ID (e.g., `anthropic.claude-3-5-sonnet-20241022-v2:0`)
522
- - Ollama: Use exact model name (e.g., `llama3.1:8b`)
523
- - OpenRouter: Use provider prefix (e.g., `anthropic/claude-3.5-sonnet`)
524
-
525
- ---
526
-
527
- ### Slow Responses
528
-
529
- **Symptoms:** Responses take 5+ seconds
530
-
531
- **Solutions:**
532
-
533
- 1. **Check provider latency:**
534
- - Local (Ollama): Should be 100-500ms
535
- - Cloud: Should be 500ms-2s
536
-
537
- 2. **Enable hybrid routing:**
538
- ```bash
539
- export PREFER_OLLAMA=true
540
- export FALLBACK_ENABLED=true
541
- ```
542
-
543
- 3. **Check Lynkr logs for actual response times**
544
-
545
- ---
546
-
547
- ### Enable Debug Logging
548
-
549
- For detailed troubleshooting:
550
-
551
- ```bash
552
- # In .env or export
553
- export LOG_LEVEL=debug
554
-
555
- # Restart Lynkr
556
- lynkr start
557
-
558
- # Check logs for detailed request/response info
559
- ```
560
-
561
- ---
562
-
563
- ## Advanced Configuration
564
-
565
- ### Custom Port
566
-
567
- ```bash
568
- # Change Lynkr port
569
- export PORT=8082
570
-
571
- # Update Claude CLI configuration
572
- export ANTHROPIC_BASE_URL=http://localhost:8082
573
- ```
574
-
575
- ---
576
-
577
- ### Custom Workspace Root
578
-
579
- ```bash
580
- # Set specific workspace directory
581
- export WORKSPACE_ROOT=/path/to/your/projects
582
-
583
- # Claude CLI will use this as base directory for file operations
584
- ```
585
-
586
- ---
587
-
588
- ### Tool Execution Policies
589
-
590
- ```bash
591
- # Allow git push (default: disabled)
592
- export POLICY_GIT_ALLOW_PUSH=true
593
-
594
- # Require tests before commit (default: disabled)
595
- export POLICY_GIT_REQUIRE_TESTS=true
596
-
597
- # Custom test command
598
- export POLICY_GIT_TEST_COMMAND="npm test"
599
- ```
600
-
601
- ---
602
-
603
- ### Memory System
604
-
605
- ```bash
606
- # Enable long-term memory (default: enabled)
607
- export MEMORY_ENABLED=true
608
-
609
- # Memories to inject per request
610
- export MEMORY_RETRIEVAL_LIMIT=5
611
-
612
- # Surprise threshold (0.0-1.0)
613
- export MEMORY_SURPRISE_THRESHOLD=0.3
614
- ```
615
-
616
- See [Memory System Guide](memory-system.md) for details.
617
-
618
- ---
619
-
620
- ## Cost Comparison
621
-
622
- **Scenario:** 100,000 requests/month, average 50k input tokens, 2k output tokens
623
-
624
- | Provider | Without Lynkr | With Lynkr (60% savings) | Monthly Savings |
625
- |----------|---------------|-------------------------|-----------------|
626
- | **Claude Sonnet 4.5** (via Databricks) | $16,000 | $6,400 | **$9,600** |
627
- | **GPT-4o** (via OpenRouter) | $12,000 | $4,800 | **$7,200** |
628
- | **Ollama (Local)** | API costs + compute | Local compute only | **$12,000+** |
629
-
630
- **Token optimization includes:**
631
- - Smart tool selection (50-70% reduction for simple queries)
632
- - Prompt caching (30-45% reduction for repeated prompts)
633
- - Memory deduplication (20-30% reduction for long conversations)
634
- - Tool truncation (15-25% reduction for tool responses)
635
-
636
- See [Token Optimization Guide](token-optimization.md) for details.
637
-
638
- ---
639
-
640
- ## Architecture
641
-
642
- ```
643
- Claude Code CLI
644
- ↓ Anthropic API format
645
- Lynkr Proxy (localhost:8081)
646
- ↓ Format conversion
647
- Your Provider (Databricks/Bedrock/OpenRouter/Ollama/etc.)
648
- ↓ Returns response
649
- Lynkr Proxy
650
- ↓ Format conversion back
651
- Claude Code CLI (displays result)
652
- ```
653
-
654
- ---
655
-
656
- ## Next Steps
657
-
658
- - **[Provider Configuration](providers.md)** - Configure all 9+ providers
659
- - **[Installation Guide](installation.md)** - Detailed installation
660
- - **[Features Guide](features.md)** - Learn about advanced features
661
- - **[Token Optimization](token-optimization.md)** - Maximize cost savings
662
- - **[Memory System](memory-system.md)** - Long-term memory
663
- - **[Production Deployment](production.md)** - Deploy to production
664
-
665
- ---
666
-
667
- ## Getting Help
668
-
669
- - **[Troubleshooting Guide](troubleshooting.md)** - Common issues and solutions
670
- - **[FAQ](faq.md)** - Frequently asked questions
671
- - **[GitHub Discussions](https://github.com/vishalveerareddy123/Lynkr/discussions)** - Community Q&A
672
- - **[GitHub Issues](https://github.com/vishalveerareddy123/Lynkr/issues)** - Report bugs