lynkr 4.1.0 โ†’ 4.2.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.
package/docs/index.md CHANGED
@@ -1,851 +1,139 @@
1
-
2
1
  <link rel="stylesheet" href="style.css">
3
2
 
4
- <script defer data-url="https://devhunt.org/tool/lynkr" src="https://cdn.jsdelivr.net/gh/sidiDev/devhunt-banner/indexV0.js"></script>
5
-
6
-
7
- # Lynkr - Production-Ready Claude Code Proxy with Multi-Provider Support, MCP Integration & Token Optimization
8
-
9
- #### Lynkr is an open-source, production-ready Claude Code proxy that enables the Claude Code CLI to work with any LLM provider (Databricks, AWS Bedrock (100+ models), OpenRouter, Ollama, Azure, OpenAI, llama.cpp) without losing Anthropic backend features. It features MCP server orchestration, Git workflows, repo intelligence, workspace tools, prompt caching, and 60-80% token optimization for cost-effective LLM-powered development.
10
- <!--
11
- SEO Keywords:
12
- Databricks, Claude Code, Anthropic, Azure Anthropic,
13
- LLM tools, LLM agents, Model Context Protocol, MCP,
14
- developer tools, proxy, git automation, AI developer tools,
15
- prompt caching, Node.js
16
- -->
17
-
18
- ## ๐Ÿ”– Keywords
19
-
20
- `claude-code` `claude-proxy` `anthropic-api` `databricks-llm` `aws-bedrock` `bedrock-models` `deepseek-r1` `qwen3` `openrouter-integration` `ollama-local` `llama-cpp` `azure-openai` `azure-anthropic` `mcp-server` `prompt-caching` `token-optimization` `ai-coding-assistant` `llm-proxy` `self-hosted-ai` `git-automation` `code-generation` `developer-tools` `ci-cd-automation` `llm-gateway` `cost-reduction` `multi-provider-llm`
21
-
22
- ---
3
+ # Lynkr
23
4
 
24
- # Lynkr
25
- **MCP โ€ข Git Tools โ€ข Repo Intelligence โ€ข Prompt Caching โ€ข Workspace Automation**
5
+ **Self-hosted Claude Code & Cursor proxy with multi-provider support and 60-80% cost reduction.**
26
6
 
27
- [โญ Star on GitHub](https://github.com/vishalveerareddy123/Lynkr) ยท
28
- [๐Ÿ“˜ Documentation](https://deepwiki.com/vishalveerareddy123/Lynkr) ยท
29
- [๐Ÿ™ Source Code](https://github.com/vishalveerareddy123/Lynkr)
7
+ [GitHub](https://github.com/vishalveerareddy123/Lynkr) | [Documentation](https://github.com/vishalveerareddy123/Lynkr/tree/main/documentation) | [NPM](https://www.npmjs.com/package/lynkr)
30
8
 
31
9
  ---
32
10
 
33
- # ๐Ÿš€ What is Lynkr?
34
-
35
- **Lynkr** is an open-source **Claude Code-compatible backend proxy** that lets you run the **Claude Code CLI** and Claude-style tools **directly against [Databricks, AWS Bedrock, Azure, OpenRouter, Ollama, and llama.cpp](#-configuration-guide-for-multi-provider-support-databricks-aws-bedrock-azure-openrouter-ollama-llamacpp)** instead of the default Anthropic cloud.
11
+ ## What is Lynkr?
36
12
 
37
- It enables full repo-aware LLM workflows:
13
+ Lynkr is a proxy server that enables **Claude Code CLI** and **Cursor IDE** to work with any LLM provider - not just Anthropic.
38
14
 
39
- - code navigation
40
- - diff review
41
- - [Git operations](#git-tools-and-workflow-automation)
42
- - test execution
43
- - workspace tools
44
- - [Model Context Protocol (MCP) servers](#full-model-context-protocol-mcp-integration)
45
- - [repo indexing and project intelligence](#-repo-intelligence--indexing)
46
- - [prompt caching](#prompt-caching-lru--ttl)
47
- - [conversational sessions with long-term memory](#-long-term-memory-system-titans-inspired)
48
-
49
- This makes Databricks and other providers a first-class environment for **AI-assisted software development**, **LLM agents**, **automated refactoring**, **debugging**, and **ML/ETL workflow exploration**.
15
+ **Key Benefits:**
16
+ - **9+ Providers** - Databricks, AWS Bedrock, OpenRouter, Ollama, llama.cpp, Azure OpenAI, Azure Anthropic, OpenAI, LM Studio
17
+ - **60-80% Cost Savings** - Token optimization through smart tool selection, prompt caching, and memory deduplication
18
+ - **100% Local Option** - Run completely offline with Ollama or llama.cpp (free)
19
+ - **Drop-in Replacement** - No code changes required to Claude Code CLI or Cursor
50
20
 
51
21
  ---
52
22
 
53
- # ๐ŸŒŸ Key Features (SEO Summary)
54
-
55
- ### โœ” Claude Code-compatible API (`/v1/messages`)
56
- Emulates Anthropicโ€™s backend so the **Claude Code CLI works without modification**.
57
-
58
- ### โœ” Works with Databricks LLM Serving
59
- Supports **Databricks-hosted Claude Sonnet / Haiku models**, or any LLM served from Databricks.
60
-
61
- ### โœ” Supports AWS Bedrock (100+ models) ๐Ÿ†•
62
- Access Claude 4.5, DeepSeek R1, Qwen3 (480B), OpenAI GPT-OSS, Google Gemma, Nova, Titan, Llama, Mistral, and more through AWS's unified Converse API.
63
-
64
- ### โœ” Supports Azure Anthropic models
65
- Route Claude Code requests into Azure's `/anthropic/v1/messages` endpoint.
66
-
67
- ### โœ” Supports Azure OpenAI models
68
- Connect to Azure OpenAI deployments (GPT-4o, etc.) with full tool calling support.
69
-
70
- ### โœ” Supports OpenRouter (100+ models)
71
- Access GPT-4o, Claude, Gemini, Llama, and more through a single unified API with full tool calling support.
72
-
73
- ### โœ” Supports llama.cpp (Local GGUF Models)
74
- Run any GGUF model locally with maximum performance using llama.cpp's optimized C++ inference engine.
75
-
76
- ### โœ” Full Model Context Protocol (MCP) integration
77
- Auto-discovers MCP manifests and exposes them as tools for smart workflows.
78
-
79
- ### โœ” Repo Intelligence: `CLAUDE.md`, Symbol Index, Cross-file analysis
80
- Lynkr builds a repo index using SQLite + Tree-sitter for rich context.
81
-
82
- ### โœ” Git Tools and Workflow Automation
83
- Commit, push, diff, stage, generate release notes, etc.
84
-
85
- ### โœ” Prompt Caching (LRU + TTL)
86
- Reuses identical prompts to reduce cost + latency.
87
-
88
- ### โœ” Workspace Tools
89
- Task tracker, file I/O, test runner, index rebuild, etc.
90
-
91
- ### โœ” Client-Side Tool Execution (Passthrough Mode)
92
- Tools can execute on the Claude Code CLI side instead of the server, enabling local file operations and commands.
93
-
94
- ### โœ” Titans-Inspired Long-Term Memory System
95
- Automatic extraction and retrieval of conversation memories using surprise-based filtering, FTS5 semantic search, and multi-signal ranking.
96
-
97
- ### โœ” Fully extensible Node.js architecture
98
- Add custom tools, policies, or backend adapters.
99
-
100
- ---
101
-
102
- # ๐Ÿ“š Table of Contents
103
-
104
- - [What Lynkr Solves](#-what-lynkr-solves)
105
- - [Architecture Overview](#-architecture-overview)
106
- - [Installation](#-installation)
107
- - [Configuring Providers (Databricks & Azure Anthropic)](#-configuring-providers)
108
- - [Using Lynkr With Claude Code CLI](#-using-lynkr-with-claude-code-cli)
109
- - [Repo Intelligence & Indexing](#-repo-intelligence--indexing)
110
- - [Long-Term Memory System (Titans-Inspired)](#-long-term-memory-system-titans-inspired)
111
- - [Prompt Caching](#-prompt-caching)
112
- - [MCP (Model Context Protocol) Integration](#-model-context-protocol-mcp)
113
- - [Git Tools](#-git-tools)
114
- - [Client-Side Tool Execution (Passthrough Mode)](#-client-side-tool-execution-passthrough-mode)
115
- - [API Examples](#-api-examples)
116
- - [ACE Framework Working Nature](#-ace-framework-working-nature)
117
- - [Roadmap](#-roadmap)
118
- - [Links](#-links)
119
-
120
- ---
121
-
122
- # ๐Ÿงฉ What Lynkr Solves
123
-
124
- ### **The Problem**
125
- Claude Code is exceptionally usefulโ€”but it only communicates with Anthropicโ€™s hosted backend.
126
-
127
- This means:
128
-
129
- โŒ You canโ€™t point Claude Code at **Databricks LLMs**
130
- โŒ You canโ€™t run Claude workflows **locally**, offline, or in secure contexts
131
- โŒ MCP tools must be managed manually
132
- โŒ You donโ€™t control caching, policies, logs, or backend behavior
133
-
134
- ### **The Solution: Lynkr**
135
- Lynkr is a **Claude Code-compatible backend** that sits between the CLI and your actual model provider.
136
-
137
- ```
138
-
139
- Claude Code CLI
140
- โ†“
141
- Lynkr Proxy
142
- โ†“
143
- Databricks / AWS Bedrock / Azure Anthropic / OpenRouter / Ollama / llama.cpp / MCP / Tools
144
-
145
- ```
146
-
147
- This enables:
148
-
149
- - **Databricks-native LLM development**
150
- - **Enterprise-private model usage**
151
- - **LLM agents with Git + file system access**
152
- - **Smart workflows via MCP**
153
- - **Transparent caching + logging**
154
-
155
- ---
156
-
157
- # ๐Ÿ— Architecture Overview
158
-
159
- ```
160
-
161
- Claude Code CLI
162
- โ†“ (HTTP POST /v1/messages)
163
- Lynkr Proxy (Node.js + Express)
164
- โ†“
165
- โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
166
- โ”‚ Orchestrator (Agent Loop) โ”‚
167
- โ”‚ โ”œโ”€ Tool Execution Pipeline โ”‚
168
- โ”‚ โ”œโ”€ Long-Term Memory System โ”‚
169
- โ”‚ โ”œโ”€ MCP Registry + Sandbox โ”‚
170
- โ”‚ โ”œโ”€ Prompt Cache (LRU + TTL) โ”‚
171
- โ”‚ โ”œโ”€ Session Store (SQLite) โ”‚
172
- โ”‚ โ”œโ”€ Repo Indexer (Tree-sitter) โ”‚
173
- โ”‚ โ”œโ”€ Policy Engine โ”‚
174
- โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
175
- โ†“
176
- Databricks / Azure Anthropic / OpenRouter / Ollama / llama.cpp
177
-
178
- ````
179
-
180
- ## Request Flow Visualization
181
-
182
- ```mermaid
183
- graph TB
184
- A[Claude Code CLI] -->|HTTP POST /v1/messages| B[Lynkr Proxy Server]
185
- B --> C{Middleware Stack}
186
- C -->|Load Shedding| D{Load OK?}
187
- D -->|Yes| E[Request Logging]
188
- D -->|No| Z1[503 Service Unavailable]
189
- E --> F[Metrics Collection]
190
- F --> G[Input Validation]
191
- G --> H[Orchestrator]
192
-
193
- H --> I{Check Prompt Cache}
194
- I -->|Cache Hit| J[Return Cached Response]
195
- I -->|Cache Miss| K{Determine Provider}
196
-
197
- K -->|Simple 0-2 tools| L[Ollama Local]
198
- K -->|Moderate 3-14 tools| M[OpenRouter / Azure]
199
- K -->|Complex 15+ tools| N[Databricks]
200
-
201
- L --> O[Circuit Breaker Check]
202
- M --> O
203
- N --> O
204
-
205
- O -->|Closed| P{Provider API}
206
- O -->|Open| Z2[Fallback Provider]
207
-
208
- P -->|Databricks| Q1[Databricks API]
209
- P -->|OpenRouter| Q2[OpenRouter API]
210
- P -->|Ollama| Q3[Ollama Local]
211
- P -->|Azure| Q4[Azure Anthropic API]
212
- P -->|llama.cpp| Q5[llama.cpp Server]
213
-
214
- Q1 --> R[Response Processing]
215
- Q2 --> R
216
- Q3 --> R
217
- Q4 --> R
218
- Q5 --> R
219
- Z2 --> R
220
-
221
- R --> S[Format Conversion]
222
- S --> T[Cache Response]
223
- T --> U[Update Metrics]
224
- U --> V[Return to Client]
225
- J --> V
226
-
227
- style B fill:#4a90e2,stroke:#333,stroke-width:2px,color:#fff
228
- style H fill:#7b68ee,stroke:#333,stroke-width:2px,color:#fff
229
- style K fill:#f39c12,stroke:#333,stroke-width:2px
230
- style P fill:#2ecc71,stroke:#333,stroke-width:2px,color:#fff
231
- ```
232
-
233
- **Key directories:**
234
-
235
- - `src/api` โ†’ Claude-compatible API proxy
236
- - `src/orchestrator` โ†’ LLM agent runtime loop
237
- - `src/memory` โ†’ Long-term memory system (Titans-inspired)
238
- - `src/mcp` โ†’ Model Context Protocol tooling
239
- - `src/tools` โ†’ Git, diff, test, tasks, fs tools
240
- - `src/cache` โ†’ prompt caching backend
241
- - `src/indexer` โ†’ repo intelligence
242
-
243
- ---
23
+ ## Quick Start
244
24
 
245
- # โš™ Getting Started: Installation & Setup Guide
25
+ ### Install
246
26
 
247
- ## Global install (recommended)
248
27
  ```bash
249
28
  npm install -g lynkr
250
- lynkr start
251
- ````
252
-
253
- ## Homebrew
254
-
255
- ```bash
256
- brew tap vishalveerareddy123/lynkr
257
- brew install vishalveerareddy123/lynkr/lynkr
29
+ # or
30
+ brew tap vishalveerareddy123/lynkr && brew install lynkr
258
31
  ```
259
32
 
260
- ## From source
33
+ ### Configure (Example: Ollama)
261
34
 
262
35
  ```bash
263
- git clone https://github.com/vishalveerareddy123/Lynkr.git
264
- cd Lynkr
265
- npm install
266
- npm start
267
- ```
268
-
269
- ---
270
-
271
- # ๐Ÿ”ง Configuration Guide for Multi-Provider Support (Databricks, AWS Bedrock, Azure, OpenRouter, Ollama, llama.cpp)
272
-
273
- ## Databricks Setup
274
-
275
- ```env
276
- MODEL_PROVIDER=databricks
277
- DATABRICKS_API_BASE=https://<workspace>.cloud.databricks.com
278
- DATABRICKS_API_KEY=<personal-access-token>
279
- DATABRICKS_ENDPOINT_PATH=/serving-endpoints/databricks-claude-sonnet-4-5/invocations
280
- WORKSPACE_ROOT=/path/to/your/repo
281
- PORT=8080
282
- ```
283
-
284
- ## Azure Anthropic Setup
285
-
286
- ```env
287
- MODEL_PROVIDER=azure-anthropic
288
- AZURE_ANTHROPIC_ENDPOINT=https://<resource>.services.ai.azure.com/anthropic/v1/messages
289
- AZURE_ANTHROPIC_API_KEY=<api-key>
290
- AZURE_ANTHROPIC_VERSION=2023-06-01
291
- WORKSPACE_ROOT=/path/to/repo
292
- PORT=8080
293
- ```
294
-
295
- ## Azure OpenAI Setup
296
-
297
- ```env
298
- MODEL_PROVIDER=azure-openai
299
- AZURE_OPENAI_ENDPOINT=https://<resource>.openai.azure.com
300
- AZURE_OPENAI_API_KEY=<api-key>
301
- AZURE_OPENAI_DEPLOYMENT=gpt-4o
302
- PORT=8080
303
- ```
304
-
305
- ## AWS Bedrock Setup (๐Ÿ†• NEW - 100+ Models)
306
-
307
- **What is AWS Bedrock?**
308
-
309
- AWS Bedrock provides serverless access to **nearly 100 foundation models** from leading AI companies through a unified Converse API. Benefits:
310
- - โœ… **Massive model variety** โ€“ Claude, DeepSeek R1, Qwen3, OpenAI GPT-OSS, Google Gemma, Nova, Titan, Llama, Mistral, Cohere, and more
311
- - โœ… **Enterprise-grade** โ€“ AWS infrastructure, security, and compliance
312
- - โœ… **Pay-per-use** โ€“ No monthly fees, pay only for tokens used
313
- - โœ… **Claude tool calling** โ€“ Full Read/Write/Bash tool support with Claude models
314
- - โœ… **Multi-cloud flexibility** โ€“ Not locked into single provider
315
-
316
- **Configuration:**
317
-
318
- ```env
319
- MODEL_PROVIDER=bedrock
320
- AWS_BEDROCK_API_KEY=your-bearer-token # Get from AWS Console โ†’ Bedrock โ†’ API Keys
321
- AWS_BEDROCK_REGION=us-east-2 # us-east-1, us-west-2, us-east-2, etc.
322
- AWS_BEDROCK_MODEL_ID=us.anthropic.claude-sonnet-4-5-20250929-v1:0
323
- PORT=8080
324
- WORKSPACE_ROOT=/path/to/your/repo
325
- ```
326
-
327
- **Popular Models:**
328
- - `us.anthropic.claude-sonnet-4-5-20250929-v1:0` โ€“ Best for coding with tool calling
329
- - `us.deepseek.r1-v1:0` โ€“ Reasoning model (o1-style)
330
- - `qwen.qwen3-coder-480b-a35b-v1:0` โ€“ 480B parameter coding specialist
331
- - `openai.gpt-oss-120b-1:0` โ€“ Open-weight GPT model
332
- - `us.amazon.nova-pro-v1:0` โ€“ Multimodal, 300K context
333
- - `meta.llama3-1-70b-instruct-v1:0` โ€“ Open-source Llama 3.1
334
- - `mistral.mistral-large-2407-v1:0` โ€“ Multilingual, coding
335
-
336
- ๐Ÿ“– See [BEDROCK_MODELS.md](https://github.com/vishalveerareddy123/Lynkr/blob/main/BEDROCK_MODELS.md) for complete model catalog (100+ models), pricing, capabilities, and use cases.
337
-
338
- **Getting Started:**
339
- 1. Visit [AWS Bedrock Console](https://console.aws.amazon.com/bedrock/)
340
- 2. Navigate to API Keys section
341
- 3. Generate a new API key (Bearer token)
342
- 4. Configure Lynkr as shown above
343
- 5. Start using any of the 100+ available models!
344
-
345
- โš ๏ธ **Tool Calling Note**: Only Claude models support tool calling (Read, Write, Bash) on Bedrock. Other models work via Converse API but won't execute tools.
346
-
347
- ## OpenRouter Setup
348
-
349
- **What is OpenRouter?**
350
-
351
- OpenRouter provides unified access to 100+ AI models (GPT-4o, Claude, Gemini, Llama, etc.) through a single API. Benefits:
352
- - โœ… No vendor lock-in - switch models without code changes
353
- - โœ… Competitive pricing ($0.15/$0.60 per 1M for GPT-4o-mini)
354
- - โœ… Automatic fallbacks if primary model unavailable
355
- - โœ… Pay-as-you-go, no monthly fees
356
- - โœ… Full tool calling support
357
-
358
- **Configuration:**
359
-
360
- ```env
361
- MODEL_PROVIDER=openrouter
362
- OPENROUTER_API_KEY=sk-or-v1-... # Get from https://openrouter.ai/keys
363
- OPENROUTER_MODEL=openai/gpt-4o-mini # See https://openrouter.ai/models
364
- OPENROUTER_ENDPOINT=https://openrouter.ai/api/v1/chat/completions
365
- PORT=8080
366
- WORKSPACE_ROOT=/path/to/your/repo
367
- ```
368
-
369
- **Popular Models:**
370
- - `openai/gpt-4o-mini` โ€“ Fast, affordable ($0.15/$0.60 per 1M)
371
- - `anthropic/claude-3.5-sonnet` โ€“ Claude's best reasoning
372
- - `google/gemini-pro-1.5` โ€“ Large context window
373
- - `meta-llama/llama-3.1-70b-instruct` โ€“ Open-source Llama
374
-
375
- See [https://openrouter.ai/models](https://openrouter.ai/models) for complete list.
376
-
377
- **Getting Started:**
378
- 1. Visit [https://openrouter.ai](https://openrouter.ai)
379
- 2. Sign in with GitHub/Google/email
380
- 3. Create API key at [https://openrouter.ai/keys](https://openrouter.ai/keys)
381
- 4. Add credits (minimum $5)
382
- 5. Configure Lynkr as shown above
383
-
384
- ## llama.cpp Setup
385
-
386
- **What is llama.cpp?**
387
-
388
- llama.cpp is a high-performance C++ inference engine for running GGUF models locally. Benefits:
389
- - โœ… **Maximum performance** โ€“ Optimized C++ inference
390
- - โœ… **Any GGUF model** โ€“ Run any model from HuggingFace
391
- - โœ… **Lower memory usage** โ€“ Advanced quantization options (Q2_K to Q8_0)
392
- - โœ… **Multi-GPU support** โ€“ CUDA, Metal, ROCm, Vulkan
393
- - โœ… **OpenAI-compatible API** โ€“ Seamless integration
394
- - โœ… **Full tool calling** โ€“ Grammar-based, reliable
395
-
396
- **Configuration:**
397
-
398
- ```env
399
- MODEL_PROVIDER=llamacpp
400
- LLAMACPP_ENDPOINT=http://localhost:8080 # llama-server default port
401
- LLAMACPP_MODEL=qwen2.5-coder-7b # Model name (for logging)
402
- LLAMACPP_TIMEOUT_MS=120000 # Request timeout
403
- PORT=8080
404
- WORKSPACE_ROOT=/path/to/your/repo
36
+ export MODEL_PROVIDER=ollama
37
+ export OLLAMA_MODEL=qwen2.5-coder:latest
405
38
  ```
406
39
 
407
- **Setup Steps:**
40
+ ### Run
408
41
 
409
42
  ```bash
410
- # 1. Build llama.cpp (or download pre-built binary)
411
- git clone https://github.com/ggerganov/llama.cpp
412
- cd llama.cpp && make
413
-
414
- # 2. Download a GGUF model (example: Qwen2.5-Coder)
415
- wget https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF/resolve/main/qwen2.5-coder-7b-instruct-q4_k_m.gguf
416
-
417
- # 3. Start llama-server
418
- ./llama-server -m qwen2.5-coder-7b-instruct-q4_k_m.gguf --port 8080
419
-
420
- # 4. Verify server is running
421
- curl http://localhost:8080/health
43
+ npm start
44
+ # Server: http://localhost:8081
422
45
  ```
423
46
 
424
- **llama.cpp vs Ollama:**
425
-
426
- | Feature | Ollama | llama.cpp |
427
- |---------|--------|-----------|
428
- | Setup | Easy (app) | Manual (compile/download) |
429
- | Model Format | Ollama-specific | Any GGUF model |
430
- | Performance | Good | Excellent |
431
- | Memory Usage | Higher | Lower (quantization) |
432
- | API | Custom | OpenAI-compatible |
433
- | Flexibility | Limited models | Any GGUF from HuggingFace |
434
-
435
- Choose llama.cpp when you need maximum performance, specific quantization options, or GGUF models not available in Ollama.
436
-
437
- ---
438
-
439
- # ๐Ÿ’ฌ Using Lynkr With Claude Code CLI
47
+ ### Connect Claude Code CLI
440
48
 
441
49
  ```bash
442
- export ANTHROPIC_BASE_URL=http://localhost:8080
50
+ export ANTHROPIC_BASE_URL=http://localhost:8081
443
51
  export ANTHROPIC_API_KEY=dummy
52
+ claude
444
53
  ```
445
54
 
446
- Then:
447
-
448
- ```bash
449
- claude chat
450
- claude diff
451
- claude review
452
- claude apply
453
- ```
454
-
455
- Everything routes through your configured model provider (Databricks, Azure, OpenRouter, Ollama, or llama.cpp).
456
-
457
- ---
458
-
459
- # ๐Ÿง  Repo Intelligence & Indexing
460
-
461
- Lynkr uses Tree-sitter and SQLite to analyze your workspace:
462
-
463
- * **Symbol definitions**
464
- * **Cross-file references**
465
- * **Language mix**
466
- * **Framework hints**
467
- * **Dependency patterns**
468
- * **Testing metadata**
469
-
470
- It generates a structured `CLAUDE.md` so the model always has context.
471
-
472
- ---
473
-
474
- # ๐Ÿง  Long-Term Memory System (Titans-Inspired)
475
-
476
- Lynkr includes a sophisticated long-term memory system inspired by Google's Titans architecture, enabling persistent learning across conversations without model retraining.
477
-
478
- ## How It Works
479
-
480
- The memory system automatically:
481
-
482
- 1. **Extracts** important information from conversations (preferences, decisions, facts, entities, relationships)
483
- 2. **Filters** using surprise-based scoring to store only novel/important information
484
- 3. **Retrieves** relevant memories using multi-signal ranking (recency + importance + relevance)
485
- 4. **Injects** top memories into each request for contextual continuity
486
-
487
- ## Key Features
488
-
489
- ### ๐ŸŽฏ Surprise-Based Memory Updates (Titans Core Innovation)
490
-
491
- Memories are scored 0.0-1.0 based on five factors:
492
- - **Novelty** (30%): New entities/concepts not seen before
493
- - **Contradiction** (40%): Conflicts with existing memories
494
- - **Specificity** (15%): Level of detail and technical depth
495
- - **User Emphasis** (10%): Explicit emphasis markers (IMPORTANT, CRITICAL, etc.)
496
- - **Context Switch** (5%): Topic changes
497
-
498
- Only memories exceeding the surprise threshold (default 0.3) are stored, preventing redundancy.
499
-
500
- ### ๐Ÿ” FTS5 Semantic Search
501
-
502
- Uses SQLite's full-text search with Porter stemming for keyword-based semantic search:
503
- - No external dependencies or embedding models
504
- - Sub-millisecond search performance
505
- - Supports Boolean operators (AND, OR, phrase search)
506
-
507
- ### ๐Ÿ“Š Multi-Signal Retrieval
508
-
509
- Ranks memories using weighted combination:
510
- - **Recency** (30%): Recent memories weighted higher with 7-day exponential decay
511
- - **Importance** (40%): Stored importance score (preference=0.7, decision=0.8, fact=0.6)
512
- - **Relevance** (30%): Keyword overlap with current query
513
-
514
- ### ๐Ÿ—‚๏ธ Memory Types
515
-
516
- - **Preferences**: User coding styles, tool choices, frameworks
517
- - **Decisions**: Architectural choices, agreed approaches
518
- - **Facts**: Project details, tech stack, configurations
519
- - **Entities**: Classes, functions, files, libraries mentioned
520
- - **Relationships**: Dependencies, imports, extends patterns
521
-
522
- ## Configuration
523
-
524
- All features are enabled by default with sensible defaults:
525
-
526
- ```env
527
- # Core Settings
528
- MEMORY_ENABLED=true # Master switch
529
- MEMORY_RETRIEVAL_LIMIT=5 # Memories per request
530
- MEMORY_SURPRISE_THRESHOLD=0.3 # Novelty filter (0.0-1.0)
531
-
532
- # Lifecycle Management
533
- MEMORY_MAX_AGE_DAYS=90 # Auto-delete old memories
534
- MEMORY_MAX_COUNT=10000 # Maximum total memories
535
- MEMORY_DECAY_ENABLED=true # Enable importance decay
536
- MEMORY_DECAY_HALF_LIFE=30 # Days for 50% importance decay
537
-
538
- # Retrieval Behavior
539
- MEMORY_INCLUDE_GLOBAL=true # Include cross-session memories
540
- MEMORY_INJECTION_FORMAT=system # Where to inject (system/assistant_preamble)
541
- MEMORY_EXTRACTION_ENABLED=true # Auto-extract from responses
542
- ```
543
-
544
- ## Performance
545
-
546
- Exceeds all targets:
547
- - **Retrieval**: <2ms average (50x faster than 50ms target)
548
- - **Extraction**: <3ms average (40x faster than 100ms target)
549
- - **Storage**: ~150 bytes per memory
550
- - **Search**: Sub-millisecond FTS5 queries
551
- - **Surprise Calculation**: <1ms average
552
-
553
- ## Example Usage
554
-
555
- The system works automatically - no manual intervention needed:
556
-
557
- ```bash
558
- # First conversation
559
- User: "I prefer Python for data processing"
560
- Assistant: "I'll remember that you prefer Python..."
561
- # System extracts: [preference] "prefer Python for data processing" (surprise: 0.85)
562
-
563
- # Later conversation (same or different session)
564
- User: "Write a script to process this CSV"
565
- # System retrieves: [preference] "prefer Python for data processing"
566
- Assistant: "I'll write a Python script using pandas..."
567
- ```
568
-
569
- ## Database Tables
570
-
571
- - **`memories`**: Core memory storage (content, type, importance, surprise_score)
572
- - **`memories_fts`**: FTS5 full-text search index (auto-synced via triggers)
573
- - **`memory_entities`**: Entity tracking for novelty detection
574
- - **`memory_embeddings`**: Optional vector storage (Phase 3, not yet used)
575
- - **`memory_associations`**: Memory graph relationships (Phase 5, not yet used)
576
-
577
- ## Memory Tools (Optional)
578
-
579
- Explicit memory management tools available:
580
- - `memory_search` - Search long-term memories by query
581
- - `memory_add` - Manually add important facts
582
- - `memory_forget` - Remove memories matching query
583
- - `memory_stats` - View memory statistics
584
-
585
- Enable by exposing tools to the model (configurable in orchestrator).
586
-
587
55
  ---
588
56
 
589
- # โšก Prompt Caching
590
-
591
- Lynkr includes an LRU+TTL prompt cache.
592
-
593
- ### Benefits:
594
-
595
- * Reduced Databricks compute consumption
596
- * Faster response times
597
- * Deterministic repeated responses
598
-
599
- Configure:
600
-
601
- ```env
602
- PROMPT_CACHE_ENABLED=true
603
- PROMPT_CACHE_TTL_MS=300000
604
- PROMPT_CACHE_MAX_ENTRIES=64
605
- ```
606
-
607
- ---
608
-
609
- # ๐Ÿงฉ Model Context Protocol (MCP)
610
-
611
- Lynkr automatically discovers MCP manifests from:
612
-
613
- ```
614
- ~/.claude/mcp
615
- ```
616
-
617
- or directories defined via:
618
-
619
- ```
620
- MCP_MANIFEST_DIRS
621
- ```
622
-
623
- MCP tools become available inside the Claude Code environment, including:
57
+ ## Supported Providers
624
58
 
625
- * GitHub integrations
626
- * Jira automations
627
- * custom internal tools
628
- * filesystem operations
629
- * build systems
630
- * CI/CD triggers
631
-
632
- Optional sandboxing uses Docker or OCI runtimes.
59
+ | Provider | Type | Cost |
60
+ |----------|------|------|
61
+ | Ollama | Local | FREE |
62
+ | llama.cpp | Local | FREE |
63
+ | LM Studio | Local | FREE |
64
+ | AWS Bedrock | Cloud | $$ |
65
+ | OpenRouter | Cloud | $ |
66
+ | Databricks | Cloud | $$$ |
67
+ | Azure OpenAI | Cloud | $$$ |
68
+ | OpenAI | Cloud | $$$ |
633
69
 
634
70
  ---
635
71
 
636
- # ๐Ÿ”ง Git Tools
637
-
638
- Lynkr includes a full suite of Git operations:
639
-
640
- * `workspace_git_status`
641
- * `workspace_git_diff`
642
- * `workspace_git_stage`
643
- * `workspace_git_commit`
644
- * `workspace_git_push`
645
- * `workspace_git_pull`
646
- * Release-note generation
647
- * Diff summarization & analysis
72
+ ## Documentation
648
73
 
649
- Policies:
74
+ Full documentation: [documentation/](https://github.com/vishalveerareddy123/Lynkr/tree/main/documentation)
650
75
 
651
- * `POLICY_GIT_ALLOW_PUSH`
652
- * `POLICY_GIT_REQUIRE_TESTS`
653
- * `POLICY_GIT_TEST_COMMAND`
654
-
655
- Example:
656
-
657
- > Disallow push unless tests pass?
658
- > Set `POLICY_GIT_REQUIRE_TESTS=true`.
76
+ - [Installation](https://github.com/vishalveerareddy123/Lynkr/blob/main/documentation/installation.md)
77
+ - [Provider Configuration](https://github.com/vishalveerareddy123/Lynkr/blob/main/documentation/providers.md)
78
+ - [Claude Code CLI Setup](https://github.com/vishalveerareddy123/Lynkr/blob/main/documentation/claude-code-cli.md)
79
+ - [Cursor IDE Integration](https://github.com/vishalveerareddy123/Lynkr/blob/main/documentation/cursor-integration.md)
80
+ - [Token Optimization](https://github.com/vishalveerareddy123/Lynkr/blob/main/documentation/token-optimization.md)
81
+ - [Memory System](https://github.com/vishalveerareddy123/Lynkr/blob/main/documentation/memory-system.md)
82
+ - [Embeddings](https://github.com/vishalveerareddy123/Lynkr/blob/main/documentation/embeddings.md)
83
+ - [API Reference](https://github.com/vishalveerareddy123/Lynkr/blob/main/documentation/api.md)
84
+ - [Troubleshooting](https://github.com/vishalveerareddy123/Lynkr/blob/main/documentation/troubleshooting.md)
659
85
 
660
86
  ---
661
87
 
662
- # ๐Ÿ”„ Client-Side Tool Execution (Passthrough Mode)
663
-
664
- Lynkr supports **client-side tool execution**, enabling tools to execute on the Claude Code CLI machine instead of the proxy server.
88
+ ## Architecture
665
89
 
666
- **Enable passthrough mode:**
667
-
668
- ```bash
669
- export TOOL_EXECUTION_MODE=client
670
- npm start
671
90
  ```
672
-
673
- **How it works:**
674
-
675
- 1. Model generates tool calls (from Databricks/OpenRouter/Ollama/llama.cpp)
676
- 2. Proxy converts to Anthropic format with `tool_use` blocks
677
- 3. Claude Code CLI receives `tool_use` blocks and executes locally
678
- 4. CLI sends `tool_result` blocks back in the next request
679
- 5. Proxy forwards complete conversation back to the model
680
-
681
- **Benefits:**
682
-
683
- * โœ… Local filesystem access on CLI user's machine
684
- * โœ… Local credentials, SSH keys, environment variables
685
- * โœ… Integration with local dev tools (git, npm, docker)
686
- * โœ… Reduced network latency for file operations
687
- * โœ… Server doesn't need filesystem permissions
688
-
689
- **Use cases:**
690
-
691
- * Remote proxy server with local CLI execution
692
- * Multi-user environments where each needs their own workspace
693
- * Security-sensitive setups where server shouldn't access user files
694
-
695
- **Configuration:**
696
-
697
- * `TOOL_EXECUTION_MODE=server` โ€“ Tools run on proxy (default)
698
- * `TOOL_EXECUTION_MODE=client` โ€“ Tools run on CLI side
699
- * `TOOL_EXECUTION_MODE=passthrough` โ€“ Alias for client mode
700
-
701
- ---
702
-
703
- # ๐Ÿงช API Example (Index Rebuild)
704
-
705
- ```bash
706
- curl http://localhost:8080/v1/messages \
707
- -H 'Content-Type: application/json' \
708
- -d '{
709
- "model": "claude-proxy",
710
- "messages": [{ "role": "user", "content": "Rebuild the index." }],
711
- "tool_choice": {
712
- "type": "function",
713
- "function": { "name": "workspace_index_rebuild" }
714
- }
715
- }'
91
+ Claude Code CLI / Cursor IDE
92
+ โ”‚
93
+ โ–ผ
94
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
95
+ โ”‚ Lynkr Proxy โ”‚ Format conversion, caching,
96
+ โ”‚ :8081 โ”‚ token optimization, tools
97
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
98
+ โ”‚
99
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
100
+ โ–ผ โ–ผ
101
+ Local Cloud
102
+ Ollama Databricks
103
+ llama.cpp AWS Bedrock
104
+ LM Studio OpenRouter
105
+ Azure/OpenAI
716
106
  ```
717
107
 
718
108
  ---
719
109
 
110
+ ## Features
720
111
 
721
- # ๐Ÿค– ACE Framework Working Nature
722
-
723
- Lynkr's agentic architecture is inspired by the **Autonomous Cognitive Entity (ACE) Framework**, specifically implementing the **Reflector** pattern to enable self-improving capabilities.
724
-
725
- ### The Agentic Loop
726
-
727
- 1. **Input Processing**: The **Orchestrator** receives natural language intent from the user.
728
- 2. **Execution (Agent Model)**: The system executes tools (Git, Search, File Ops) to achieve the goal.
729
- 3. **Reflection (Reflector Role)**: After execution types, the `Reflector` agent analyzes the transcript to extract "skills" and optimize future performance.
730
-
731
- ### The Reflector
732
- The Reflector (`src/agents/reflector.js`) is an introspective component that analyzes:
733
- * **Tool Usage Patterns**: Identifying effective tool combinations (e.g., "Search -> Read -> Fix").
734
- * **Efficiency**: Calculating step-count and token efficiency.
735
- * **Error Handling**: Learning from recovered errors to suggest robust fallback strategies.
736
- * **Task Patterns**: Recognizing recurring task types (Refactoring, Testing, Documentation) and their optimal workflows.
737
-
738
- This "working nature" allows Lynkr to not just execute commands, but to **learn from interaction**, continuously refining its internal heuristics for tool selection and planning.
739
-
740
- ---
741
-
742
- # ๐Ÿ›ฃ Roadmap
743
-
744
- ## โœ… Recently Completed (December 2025)
745
-
746
- * **llama.cpp Provider Support** โ€“ Run any GGUF model locally with maximum performance using llama.cpp's optimized C++ inference engine with full tool calling support
747
- * **Titans-Inspired Long-Term Memory System** โ€“ Automatic extraction and retrieval of conversation memories using surprise-based filtering, FTS5 semantic search, and multi-signal ranking for persistent learning across sessions
748
- * **Client-side tool execution** (`TOOL_EXECUTION_MODE=client/passthrough`) โ€“ Tools can execute on the Claude Code CLI side, enabling local file operations, commands, and access to local credentials
749
- * **OpenRouter error resilience** โ€“ Graceful handling of malformed OpenRouter responses, preventing crashes during rate limits or service errors
750
- * **Enhanced format conversion** โ€“ Improved Anthropic โ†” OpenRouter format conversion for tool calls with proper `tool_use` block generation
751
-
752
- ## ๐Ÿ”ฎ Future Features
753
-
754
- * **Memory System Enhancements**:
755
- * Local embeddings with ONNX runtime for true semantic search (Phase 3)
756
- * Memory association graphs for relationship-based retrieval (Phase 5)
757
- * Memory decay scheduler with background optimization
758
- * LSP integration (TypeScript, Python, more languages)
759
- * Per-file diff comments
760
- * Risk scoring for Git diffs
761
- * Expand MCP support
762
- * Skill-like declarative automation layer
763
- * Historical test dashboards
764
- * Databricks-specific tools
765
-
766
- ---
767
-
768
- # ๐Ÿ“š References & Further Reading
769
-
770
- ## Academic & Technical Resources
771
-
772
- **Agentic AI Systems:**
773
- - **Zhang et al. (2024)**. *Agentic Context Engineering*. arXiv:2510.04618. [arXiv](https://arxiv.org/abs/2510.04618)
774
-
775
- **Long-Term Memory & RAG:**
776
- - **Mohtashami & Jaggi (2023)**. *Landmark Attention: Random-Access Infinite Context Length for Transformers*. [arXiv](https://arxiv.org/abs/2305.16300)
777
- - **Google DeepMind (2024)**. *Titans: Learning to Memorize at Test Time*. [arXiv](https://arxiv.org/abs/2411.07043)
778
-
779
- ## Official Documentation
780
-
781
- - [Claude Code CLI Documentation](https://docs.anthropic.com/en/docs/build-with-claude/claude-for-sheets) - Official Claude Code reference
782
- - [Model Context Protocol (MCP) Specification](https://spec.modelcontextprotocol.io/) - MCP protocol documentation
783
- - [Databricks Foundation Models](https://docs.databricks.com/en/machine-learning/foundation-models/index.html) - Databricks LLM documentation
784
- - [Anthropic API Documentation](https://docs.anthropic.com/en/api/getting-started) - Claude API reference
785
-
786
- ## Related Projects & Tools
787
-
788
- - [Ollama](https://ollama.ai/) - Local LLM runtime for running open-source models
789
- - [OpenRouter](https://openrouter.ai/) - Multi-provider LLM API gateway (100+ models)
790
- - [llama.cpp](https://github.com/ggerganov/llama.cpp) - High-performance C++ LLM inference engine
791
- - [LiteLLM](https://github.com/BerriAI/litellm) - Multi-provider LLM proxy (alternative approach)
792
- - [Awesome MCP Servers](https://github.com/punkpeye/awesome-mcp-servers) - Curated list of MCP server implementations
793
-
794
- ---
795
-
796
- # ๐ŸŒŸ Community & Adoption
797
-
798
- ## Get Involved
799
-
800
- **โญ Star this repository** to show your support and help others discover Lynkr!
801
-
802
- [![GitHub stars](https://img.shields.io/github/stars/vishalveerareddy123/Lynkr?style=social)](https://github.com/vishalveerareddy123/Lynkr)
803
-
804
- ## Support & Resources
805
-
806
- - ๐Ÿ› **Report Issues:** [GitHub Issues](https://github.com/vishalveerareddy123/Lynkr/issues) - Bug reports and feature requests
807
- - ๐Ÿ’ฌ **Discussions:** [GitHub Discussions](https://github.com/vishalveerareddy123/Lynkr/discussions) - Questions, ideas, and community help
808
- - ๐Ÿ“š **Documentation:** [DeepWiki](https://deepwiki.com/vishalveerareddy123/Lynkr) - Comprehensive guides and examples
809
- - ๐Ÿ”ง **Contributing:** [CONTRIBUTING.md](https://github.com/vishalveerareddy123/Lynkr/blob/main/CONTRIBUTING.md) - How to contribute to Lynkr
810
-
811
- ## Share Lynkr
812
-
813
- Help spread the word about Lynkr:
814
-
815
- - ๐Ÿฆ [Share on Twitter](https://twitter.com/intent/tweet?text=Check%20out%20Lynkr%20-%20a%20production-ready%20Claude%20Code%20proxy%20with%20multi-provider%20support%20and%2060-80%25%20token%20savings!&url=https://github.com/vishalveerareddy123/Lynkr&hashtags=AI,ClaudeCode,LLM,OpenSource)
816
- - ๐Ÿ’ผ [Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https://github.com/vishalveerareddy123/Lynkr)
817
- - ๐Ÿ“ฐ [Share on Hacker News](https://news.ycombinator.com/submitlink?u=https://github.com/vishalveerareddy123/Lynkr&t=Lynkr%20-%20Production-Ready%20Claude%20Code%20Proxy)
818
- - ๐Ÿ“ฑ [Share on Reddit](https://www.reddit.com/submit?url=https://github.com/vishalveerareddy123/Lynkr&title=Lynkr%20-%20Production-Ready%20Claude%20Code%20Proxy%20with%20Multi-Provider%20Support)
819
-
820
- ## Why Developers Choose Lynkr
821
-
822
- - ๐Ÿ’ฐ **Massive cost savings** - Save 60-80% on token costs with built-in optimization
823
- - ๐Ÿ”“ **Provider freedom** - Choose from 7+ LLM providers (Databricks, OpenRouter, Ollama, Azure, llama.cpp)
824
- - ๐Ÿ  **Privacy & control** - Self-hosted, open-source, no vendor lock-in
825
- - ๐Ÿš€ **Production-ready** - Enterprise features: circuit breakers, metrics, health checks
826
- - ๐Ÿ› ๏ธ **Active development** - Regular updates, responsive maintainers, growing community
112
+ - **Multi-Provider Support** - Switch providers without code changes
113
+ - **Token Optimization** - 60-80% cost reduction
114
+ - **Prompt Caching** - LRU cache with TTL
115
+ - **Long-Term Memory** - Titans-inspired memory system
116
+ - **Tool Calling** - Full MCP integration
117
+ - **Embeddings** - @Codebase semantic search
118
+ - **Enterprise Ready** - Circuit breakers, metrics, health checks
827
119
 
828
120
  ---
829
121
 
830
- # ๐Ÿ”— Links
122
+ ## Links
831
123
 
832
- * **GitHub**: [https://github.com/vishalveerareddy123/Lynkr](https://github.com/vishalveerareddy123/Lynkr)
833
- * **Docs**: [https://deepwiki.com/vishalveerareddy123/Lynkr](https://deepwiki.com/vishalveerareddy123/Lynkr)
834
- * **Issues**: [https://github.com/vishalveerareddy123/Lynkr/issues](https://github.com/vishalveerareddy123/Lynkr/issues)
124
+ - [GitHub Repository](https://github.com/vishalveerareddy123/Lynkr)
125
+ - [NPM Package](https://www.npmjs.com/package/lynkr)
126
+ - [Issues](https://github.com/vishalveerareddy123/Lynkr/issues)
127
+ - [Discussions](https://github.com/vishalveerareddy123/Lynkr/discussions)
835
128
 
836
129
  ---
837
130
 
838
- ## ๐Ÿš€ Ready to Get Started?
839
-
840
- **Reduce your Claude Code costs by 60-80% today:**
131
+ ## License
841
132
 
842
- 1. โญ **[Star this repo](https://github.com/vishalveerareddy123/Lynkr)** to show support and stay updated
843
- 2. ๐Ÿ“– **[Install Lynkr](#-getting-started-installation--setup-guide)** and configure your preferred provider
844
- 3. ๐Ÿ’ฌ **[Join the Discussion](https://github.com/vishalveerareddy123/Lynkr/discussions)** for community support
845
- 4. ๐Ÿ› **[Report Issues](https://github.com/vishalveerareddy123/Lynkr/issues)** to help improve Lynkr
133
+ Apache 2.0
846
134
 
847
135
  ---
848
136
 
849
- If you use Databricks, Azure Anthropic, OpenRouter, Ollama, or llama.cpp and want rich Claude Code workflows with massive cost savings, Lynkr gives you the control, flexibility, and extensibility you need.
137
+ ## Keywords
850
138
 
851
- Feel free to open issues, contribute tools, integrate with MCP servers, or help us improve the documentation!
139
+ `claude-code` `claude-proxy` `anthropic-api` `databricks-llm` `aws-bedrock` `openrouter` `ollama` `llama-cpp` `azure-openai` `mcp-server` `prompt-caching` `token-optimization` `ai-coding-assistant` `llm-proxy` `self-hosted-ai`