Skip to content

Instantly share code, notes, and snippets.

View karthiks's full-sized avatar
🎯
Focusing

Karthik Sirasanagandla karthiks

🎯
Focusing
View GitHub Profile
@karthiks
karthiks / statusline.sh
Created April 16, 2026 06:56
This is my ClaudeCode's StatusLine bashscript for showing the current directory, model name, and git status if applicable.
#!/bin/bash
# This is my ClaudeCode's StatusLine bashscript for showing the current directory, model name, and git status if applicable.
# ref.: https://code.claude.com/docs/en/statusline
# Read JSON data that Claude Code sends to stdin
input=$(cat)
# Extract information from JSON using jq
CC_VER=$(echo "$input" | jq -r '.version')
@karthiks
karthiks / .gitattributes
Created April 9, 2026 11:44
Sample .gitattributes file to manage Line Endings for files in project developed in Windows and Linux based OSes
# 1. Handle line endings automatically for text files
# This ensures LF in the repo, but OS-native endings in the working directory
* text=auto
# 2. Explicitly declare text files (especially your programming language file endings) to be normalized to LF in the repo
*.c text
*.h text
*.cpp text
*.py text
*.java text
@karthiks
karthiks / builtin-slash-commands.md
Created March 22, 2026 14:40
List of Built-in Slash Commands in Claude Code
/help #shows complete command list
/help compact #shows detailed syntax for the compact command

/init #scans package.json, tsconfig.json, etc., and creates a 15-30 line CLAUDE.md file with detected conventions
/doctor #runs 5-8 checks in under 15 seconds and reports any issues with green (OK) or red (failure) status

/compact #compresses current session
/clear #use when switching topics or after 20+ exchanges; keyboard shortcut Ctrl+L
/rewind #runs once to undo one turn; can be run multiple times to go back further
@karthiks
karthiks / ClaudeCode-Memory.md
Created March 21, 2026 09:54
The Two Pillars of Memory in Claude Code

The Two Pillars of Memory

Claude Code uses a dual-memory system to balance your explicit instructions with its own learned observations.

Feature CLAUDE.md (Static Memory) MEMORY.md (Auto Memory)
Who Writes It? You (Manual) Claude (Automated)
Content "Project rules, architecture, tech stack." "Patterns, ""gotchas,"" and user preferences."
Location Your Project Root (git-tracked). ~/.claude/projects/ (system-local).
Persistence Permanent and shared with your team. Local to your machine; session-dependent.
@karthiks
karthiks / claude-session-context-window.md
Created March 21, 2026 07:56
Session Context Window (200k total)
Session Context Window (200k total)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ System Prompt + Tools: 15.9k (8%)          β”‚ ← Fixed allocation
β”‚ CLAUDE.md + Memory: 2.8k (1.4%)            β”‚ ← Fixed allocation
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Messages (grows over time): 89.5k (44.7%)  β”‚ ← This grows
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Free Space: 59k (29.5%)                    β”‚ ← This shrinks
β”‚ Autocompact Buffer: 33k (16.5%) β”‚ ← Reserved
@karthiks
karthiks / ClaudeCode-Context-ReferenceTable.md
Created March 20, 2026 18:11
Practical Reference Table for what healthy, warning, and critical levels look like for each category of consumers of memory context in Claude Code

Here's a practical reference table for what healthy, warning, and critical levels look like for each category:

Category Healthy Warning Critical Breach Consequences
System Prompt <5k tokens 5-8k tokens >8k tokens Reduced context for actual work; slower responses
System Tools <10k tokens 10-20k tokens >20k tokens Context starvation; frequent compacting; tool failures
Memory Files <1k tokens 1-2k tokens >2k tokens Important instructions being truncated; Claude "forgetting" conventions
Messages <40% of total 40-60% of total >60% of total Rapidly approaching limit; autocompact ineffective
Free Space >30% 15-30% <15% Autocompact may fail; Claude may refuse new tasks
Autocompact Buffer >20% 15-20% <15% Summaries become poor; important context lost
Total Usage <70% 70-85% >85% Performance degradation; risk of hitting limit mid-task
@karthiks
karthiks / claudecode-cache.md
Last active March 21, 2026 05:32
Flowchart - Clearer Visual of the Cache Flow
flowchart TB
    subgraph Request1[Request 1: Cache Write]
        A1[System prompt<br/>CLAUDE.md + Tools] 
        A2[User message 1]
        A3[Cache Storage]
        
        A1 --> A3
        A2 --> B[Process full request]
 A3 --&gt; B
@karthiks
karthiks / wsl2winhost.sh
Created February 28, 2026 15:17
Accessing Windows Host from WSL2 Linux using Hostname
### Check out detailed blog post at https://blog.codonomics.com/2026/01/accessing-windows-host-from-wsl2-linux.html
### Start: Adding Windows Host IP to WSL2 Hosts File
# Add to the end of ~/.bashrc or ~/.zshrc
echo "Updating Windows host IP in /etc/hosts..."
# Get Windows IP from default route
WIN_HOST_IP=$(ip route show | grep -i default | awk '{print $3}')
# Check if we got a valid IP
if [ -n "$WIN_HOST_IP" ]; then
@karthiks
karthiks / miniconda_cheatsheet.sh
Created August 13, 2025 06:13
miniconda cheatsheet
# =============================================
# MINICONDA CHEATSHEET (Python Environment & Package Management)
# =============================================
# Lightweight version of Anaconda for Python environments.
# Install: https://docs.conda.io/projects/miniconda/en/latest/
# Docs: https://conda.io/projects/conda/en/latest/commands.html
# ---------------------------------------------------------------------
# 1. INSTALLATION & SETUP
# ---------------------------------------------------------------------
@karthiks
karthiks / uv_cheatsheet.sh
Created August 13, 2025 06:03
uv cheatsheet
# =============================================
# UV CHEATSHEET (Python Package & Env Management)
# =============================================
# Astral's ultra-fast alternative to pip/venv.
# Install: curl -LsSf https://astral.sh/uv/install.sh | sh
# Docs: https://github.com/astral-sh/uv
# ---------------------------------------------------------------------
# 1. VIRTUAL ENVIRONMENTS
# ---------------------------------------------------------------------