QUICK_START.md
1 # LocalCode Quick Start 2 3 ## 🚀 Simplest Way (Recommended) 4 5 ### 1. Load Helper Functions 6 7 ```bash 8 source ./scripts/llm/localcode_quick.sh 9 ``` 10 11 Output: 12 ``` 13 LocalCode helper functions loaded: 14 lc_start [path] - Start new session 15 lc_query "question" - Query current session 16 lc_interactive - Interactive mode 17 lc_end - End current session 18 lc_list - List all sessions 19 lc_show - Show current session 20 ``` 21 22 ### 2. Start Session 23 24 ```bash 25 lc_start 26 27 # Or specify directory: 28 lc_start /path/to/project 29 ``` 30 31 Output: 32 ``` 33 ✓ Session started: session_20251111_010500_68694 34 Use: lc_query "your question" 35 ``` 36 37 ### 3. Query the LLM 38 39 ```bash 40 lc_query "What is the ECHO project?" 41 ``` 42 43 Or interactive mode: 44 ```bash 45 lc_interactive 46 47 localcode> explain echo architecture 48 [LLM responds] 49 50 localcode> how do agents communicate? 51 [LLM responds] 52 53 localcode> exit 54 ``` 55 56 ### 4. End Session (Optional) 57 58 ```bash 59 lc_end 60 ``` 61 62 --- 63 64 ## ⚙️ Configuration 65 66 ### Timeout (For Slow Responses) 67 68 ```bash 69 # Default is already 180 seconds (3 minutes) 70 # Increase further if needed: 71 export LLM_TIMEOUT=300 # 5 minutes 72 73 lc_query "complex question" 74 ``` 75 76 ### Different Model 77 78 ```bash 79 export LLM_MODEL="llama3.1:8b" # Faster 80 # or 81 export LLM_MODEL="deepseek-coder:33b" # More powerful 82 # or 83 export LLM_MODEL="qwen2.5:14b" # Best reasoning 84 85 lc_query "your question" 86 ``` 87 88 --- 89 90 ## 📋 Complete Example Session 91 92 ```bash 93 cd /Users/pranav/Documents/echo 94 95 # Load helpers 96 source ./scripts/llm/localcode_quick.sh 97 98 # Start session 99 lc_start 100 101 # Quick query 102 lc_query "What is ECHO?" 103 104 # Interactive exploration 105 lc_interactive 106 > How do agents make decisions? 107 > What's in the CEO agent code? 108 > Show me the message bus implementation 109 > exit 110 111 # End session 112 lc_end 113 ``` 114 115 --- 116 117 ## 🐛 Troubleshooting 118 119 ### "Failed to get response" 120 121 **Problem:** Timeout or Ollama not responding 122 123 **Solution 1:** Increase timeout (default is already 3 minutes) 124 ```bash 125 export LLM_TIMEOUT=300 # 5 minutes for very complex queries 126 lc_query "your question" 127 ``` 128 129 **Solution 2:** Check Ollama 130 ```bash 131 curl http://localhost:11434/api/tags 132 # Should show list of models 133 134 ollama list 135 # Should show deepseek-coder:6.7b 136 ``` 137 138 **Solution 3:** Use smaller model 139 ```bash 140 export LLM_MODEL="deepseek-coder:1.3b" # Much faster 141 lc_query "your question" 142 ``` 143 144 ### "No active session" 145 146 ```bash 147 # Check if session exists 148 echo $LOCALCODE_SESSION 149 150 # Start new one 151 lc_start 152 ``` 153 154 ### Context too large 155 156 **Problem:** "Context size: 15000 bytes (~3750 tokens)" 157 158 **Solution:** Edit startup context to be shorter 159 ```bash 160 # Reduce CLAUDE.md lines loaded 161 vim ./scripts/llm/localcode_session.sh 162 # Change: head -200 CLAUDE.md → head -100 CLAUDE.md 163 ``` 164 165 --- 166 167 ## 💡 Tips 168 169 ### 1. Keep Session Open All Day 170 171 ```bash 172 # Morning 173 source ./scripts/llm/localcode_quick.sh 174 lc_start 175 176 # Query as needed throughout the day 177 lc_query "question 1" 178 lc_query "question 2" 179 ... 180 181 # Evening 182 lc_end 183 ``` 184 185 ### 2. Multiple Projects 186 187 ```bash 188 # Project A 189 lc_start /path/to/projectA 190 lc_query "what's the architecture?" 191 lc_end 192 193 # Project B 194 lc_start /path/to/projectB 195 lc_query "what's the architecture?" 196 lc_end 197 ``` 198 199 ### 3. Quick Commands in .bashrc / .zshrc 200 201 Add to `~/.bashrc` or `~/.zshrc`: 202 203 ```bash 204 alias lc='source ~/Documents/echo/scripts/llm/localcode_quick.sh' 205 alias lcq='lc_query' 206 alias lci='lc_interactive' 207 ``` 208 209 Then: 210 ```bash 211 lc # Load functions 212 lc_start # Start session 213 lcq "question" # Quick query 214 lci # Interactive mode 215 ``` 216 217 --- 218 219 ## 📊 Performance Tips 220 221 ### Fast Queries (<5s) 222 223 ```bash 224 export LLM_MODEL="deepseek-coder:1.3b" # Smallest, fastest 225 lc_query "simple question" 226 ``` 227 228 ### Balanced (5-10s) 229 230 ```bash 231 export LLM_MODEL="deepseek-coder:6.7b" # Default, good balance 232 lc_query "moderate question" 233 ``` 234 235 ### Best Quality (10-30s) 236 237 ```bash 238 export LLM_MODEL="qwen2.5:14b" # Larger, smarter 239 lc_query "complex architectural question" 240 ``` 241 242 --- 243 244 ## 🎯 Common Use Cases 245 246 ### Code Review 247 ```bash 248 lc_query "Review apps/echo_shared/lib/echo_shared/message_bus.ex for security issues" 249 ``` 250 251 ### Debugging 252 ```bash 253 lc_query "I'm getting 'connection refused' to Redis. What could be wrong?" 254 ``` 255 256 ### Learning Codebase 257 ```bash 258 lc_interactive 259 > What agents exist in ECHO? 260 > How does the CEO agent work? 261 > Explain the decision-making flow 262 > exit 263 ``` 264 265 ### Architecture Questions 266 ```bash 267 lc_query "What are the pros and cons of the dual-write pattern in MessageBus?" 268 ``` 269 270 --- 271 272 That's it! **Much simpler than the manual way.**