# I've Used Claude Code for 2,000+ Hours - Here's How I Build Anything With It

**URL:** https://youtu.be/nxHKBq5ZU9U  
**Durată:** 22:48  
**Data salvare:** 2026-03-16  
**Tags:** @work @project #claude-code #context-management #whisk-framework #ai-coding

---

## 📊 TL;DR

Framework WHISK pentru management optim al contextului în Claude Code (și orice AI coding assistant), bazat pe 2000+ ore de experiență practică. Problema centrală: **context rot** - LLM-urile se supraaglomerează cu informație, iar performanța scade dramatic când context window-ul se umple (problema "needle in the haystack"). Soluția: 4 strategi coordonate pentru a menține contextul lean dar complet: **W**rite (externalizează memoria), **I**solate (sub-agenți pentru research), **S**elect (context just-in-time, nu just-in-case), **C**ompress (evită compresie când poți). Impact: 80% din erorile coding agents = context management prost.

**Proiect demonstrativ:** Archon - AI command center pentru workflow-uri AI coding (codebase complex, mii de linii).

---

## 🎯 Puncte Cheie

### Problema: Context Rot

**De ce 1M token limit NU rezolvă problema:**
- LLM-uri se supraaglomerează exact ca oamenii
- **Needle in the haystack:** Informație specifică se pierde în haystack-ul de context
- **Distractors:** Info similară dar greșită → agent foarte confident dar greșit
- **Trigger:** Performance scade dramatic după câteva sute mii tokens (200k-400k)
- **80% din erori** = context management prost, NU limitări ale modelului

**Research key:** Chroma technical report - "just because you CAN fit tokens ≠ you SHOULD"

---

## 🌪️ WHISK Framework

### W - Write (Externalizează Memoria Agentului)

**1. Git Log = Long-term Memory**

✅ **Avantaje:**
- Tool deja folosit (version control)
- Gratuit, standard, universal
- Persist across sessions

**Implementare:**
- Commit messages standardizate (format fix)
- Foarte detaliate
- Command custom `/commit`:
  - Parte 1: Ce am construit (feature/fix + detalii)
  - Parte 2: Cum am îmbunătățit AI layer (rules/commands)
  
**Exemplu format:**
```
feat: Test improvements to CLI

- Added edge case testing for workflow validation
- Improved error messages for missing parameters

AI: Updated plan command to include validation step
```

**Rezultat:** Oneliner pentru commit history → agent înțelege rapid ce s-a făcut recent

**2. Separate Planning from Implementation**

🔄 **Workflow obligatoriu:**
1. **Session 1 (Planning):**
   - Run `/prime` (load initial context)
   - Create structured plan cu `/plan` command
   - Output: single markdown document cu tot ce trebuie

2. **Session 2 (Implementation):**
   - NEW context window (clean slate)
   - Run `/execute path/to/plan.md`
   - DOAR planul = context (nimic altceva)

✅ **De ce funcționează:**
- Agent extrem de focusat pe task
- Fără research/discussions mudding context
- Plan = single source of truth

**3. Progress Files & Decision Logs**

📋 **Use cases:**
- Handoff între sub-agenți
- Agent teams coordination
- Session switch când context se umflă

**Files comune:**
- `handoff.md` - summary pentru next agent
- `todo.md` - tracking work items
- `decisions.log` - key architectural decisions

**Command:** `/handoff`
- Creează summary pentru următorul agent
- Transfer clean context fără tool calls istorice
- Exemplu: 200k tokens → 500 tokens summary

---

### I - Isolate (Sub-Agenți pentru Research)

**Principiu:** Keep main context clean, delegate research

**Research Pattern (Standard)**

✅ **Când:** Planning phase, înainte de structured plan

**Impact:**
- Tens/hundreds of thousands tokens research
- → 500 tokens summary în main context
- **90%+ improvement** (research Anthropic)

**Exemplu real:**
> "I want to build a workflow builder into Archon. Spin up two sub agents: one to do extensive research in the codebase to see how we would build it, and another to do web research on best practices for the tech stack."

**Rezultat:**
- 2 sub-agenți în paralel
- Research combinat: sute de mii tokens
- Main context: 44,000 tokens (4% din limit)
- Summary: synthesis of findings

⚠️ **NU pentru implementation** - vrei tot context-ul acolo

**Scout Pattern (Advanced)**

🔍 **Când:** Ai documentație/fișiere potențial relevante, dar nesigur

**Flow:**
1. Sub-agent explorează docs folder
2. Decide ce e relevant pentru main task
3. Raportează înapoi: "load X, skip Y"
4. Main agent confirmă și încarcă doar ce contează

**Exemplu:**
```
Spin up a sub agent to research everything in my .cloud/docs.
Are there any pieces of documentation here that we would care about
loading into our main context for planning?
```

**Rezultat:**
- Agent găsește 5 docs
- Recomandă 1 relevant
- Tu confirmi → load doar ăla
- Evită loading 4 irelevante

---

### S - Select (Context Just-in-Time)

**Principiu:** "Load context just-in-time, not just-in-case"

**Dacă nu ești 100% sigur că e important ACUM → NU încărca**

**4 Layers of Context (Layered Approach)**

**Layer 1: Global Rules** (Always loaded)
- 500-700 lines (unii recomandă mai puțin)
- Architecture overview
- Testing/logging strategy  
- Commands to run
- Constraints & conventions

**Layer 2: On-Demand Context** (Task-specific)
- Rules pentru părți specifice codebase
- Exemplu: frontend rules DOAR când lucrezi la frontend
- API endpoint rules DOAR când build-uiești API
- Workflow YAML reference DOAR când lucrezi la workflows

**Layer 3: Skills** (Capability-specific)
- **Description:** loaded up-front (minimal tokens)
- **skill.md:** loaded când agent decide să folosească skill
- **Scripts/reference docs:** loaded când deep dive în skill

**Exemplu:** Agent Browser skill
- Description: "Browser automation for E2E testing"
- Full skill.md: loaded când faci testing
- Scripts: loaded când rulezi teste specific

**Layer 4: Prime Commands** (Live codebase exploration)
- Toate celelalte = static docs
- Prime = explorare live codebase cu sub-agenți
- Run la START of planning
- Multiple prime commands pentru diferite părți codebase

**Exemplu prime commands:**
- `/prime` - generic high-level understanding
- `/prime-workflows` - specialized pentru workflow engine
- `/prime-frontend` - specialized pentru UI components

**Structure tipic prime command:**
```
1. Read project structure
2. Scan git log (long-term memory)
3. Review key architecture docs
4. Check recent changes
5. Summarize current state
```

---

### C - Compress (Evită Compresie Când Poți)

**Principiu:** "Best compression strategy = not needing compression"

⚠️ **Dacă faci W, I, S corect → C aproape niciodată**

**Compress doar când MUSAI**

**Strategy 1: /handoff** (recomandat)

✅ **Când:**
- Context bloat după multe iterații
- Trebuie fresh session
- Agent teams coordination

**Flow:**
1. Run `/handoff`
2. Agent creează structured summary
3. New session cu summary-ul
4. Continue work clean

**Strategy 2: /compact** (built-in Claude Code)

⚠️ **Cum funcționează:**
- Summarize conversation
- Wipe conversation history
- Put summary at top of context

✅ **Trick:** Summarization instructions
```
/compact focus on the edge cases that we just tested
```
→ Agent va acorda mai multă atenție acelei părți când creează summary

**Best Practice:**
- `/handoff` după 2+ compactions (conversation prea bloated)
- `/compact` OK pentru 1x compression
- După compact → întreabă agent "What do you remember?" (verificare)

---

## 💡 Quote-uri Cheie

> "Over 2,000 hours of using cloud code, this is what you want to focus on. About 80% of the time when your coding agent messes up in your codebase, it's because you aren't managing your context well enough."

> "Just because you can fit a certain amount of tokens into an LLM's context window doesn't mean that you should. Large language models get overwhelmed with information just like people do."

> "Load your context just-in-time, not just-in-case. If you're not 100% confident that a piece of information is important to your coding agent right now, then you shouldn't bother loading it."

> "The best compression strategy is not needing compression."

> "We want to capture key decisions and what the agent has been working on so that in future sessions we can catch our agent up to speed a lot faster and have to spend less tokens upfront."

> "Instead of loading in tens of thousands of tokens of research into our main context window, it is now only something like 500 tokens. We still get the core information that we need, but we have a 92% improvement."

> "I don't recommend [sub-agents] for implementation because usually you want all the context of what you did, but for research it is very powerful."

---

## 🛠️ Commands & Resources

**Autor oferă folder complet cu:**
- Toate commands exemplu (.cloud folder)
- Git commit command standardizat
- Plan command structure
- Execute command template
- Handoff command workflow
- Prime commands (generic + specialized)

**Link:** În descrierea video (free, no email)

---

## 📦 Proiect Demonstrativ: Archon

**Ce e:** AI command center pentru AI coding workflows

**Features:**
- Create/manage/execute longer-running workflows
- Workflow builder (like N8N for AI coding)
- Mission Control pentru monitoring logs
- Past runs review
- Pull request validation workflows

**De ce e bun exemplu:**
- Codebase foarte complex
- Multiple moving parts
- Demonstrează toate strategiile WHISK la scară

---

## ⚡ Aplicare Practică (Pentru Marius)

### 1. Implementare WHISK în Workflow-ul Curent

**W - Write:**

✅ **Git commits standardizate:**
```bash
# Add custom /commit command pentru clawd
feat: [FEATURE_NAME]
- Bullet point changes
- Edge cases handled

AI: Updated [rules/commands] to handle [scenario]
```

✅ **Separate planning/implementation:**
- Ralph PRD = planning session
- Ralph implementation = clean session cu DOAR PRD
- NU amesteca research cu coding

✅ **Decision logs pentru ROA:**
```markdown
# decisions.log
## 2026-03-16: ANAF Monitor v2 Integration
- Decision: Use v2.2 with hash detection
- Reason: More reliable than version scraping
- Impact: Daily monitoring more stable
```

**I - Isolate:**

✅ **Research sub-agents pentru:**
- ROA database schema exploration (Oracle)
- ANAF documentation parsing
- Best practices web research (FastAPI, Vue.js)

✅ **Scout pattern pentru:**
- memory/kb/ exploration (înainte să încarci tot în context)
- Documentație ERP ROA (selective loading)

**S - Select:**

✅ **Layer 1 (Global Rules):** 
- Echo AGENTS.md, SOUL.md, USER.md
- Architecture decisions for clawd
- Standard coding patterns

✅ **Layer 2 (On-Demand):**
- `roa-oracle-rules.md` - DOAR când lucrezi la Oracle queries
- `telegram-bot-rules.md` - DOAR când lucrezi la roa2web Telegram
- `email-processing-rules.md` - DOAR când optimizezi email flows

✅ **Layer 3 (Skills):**
- Ralph skill (PRD generation)
- ANAF monitor skill
- YouTube processing skill
- Calendar integration skill

✅ **Layer 4 (Prime):**
```bash
# /prime-clawd - understand clawd ecosystem
# /prime-roa - understand ROA codebase structure
# /prime-tools - understand tools/ directory recent changes
```

**C - Compress:**

✅ **Evită compresie prin:**
- Fresh sessions pentru taskuri noi
- Sub-agents pentru research heavy
- Selective context loading

✅ **Când MUSAI compress:**
- `/handoff` pentru Ralph iterations (multiple PRD refinements)
- `/compact focus on validated edge cases` după testing


### 2. Optimizări Immediate

**🔧 Create custom commands:**

`.cloud/commands/commit.md`:
```markdown
# Git Commit Command

Create a standardized commit message:

1. Prefix: feat/fix/docs/refactor
2. Summary (50 chars max)
3. Detailed bullets of changes
4. AI improvements section if rules/commands updated

Format:
<prefix>: <summary>

- Change 1
- Change 2
- Edge case X handled

AI: Updated <component> to <improvement>
```

`.cloud/commands/plan.md`:
```markdown
# Planning Command

Create structured plan for implementation:

## Goal
[What we're building]

## Context
[Why we're building it]

## Architecture
[How it fits in codebase]

## Implementation Steps
1. [Step with acceptance criteria]
2. [Step with validation]

## Edge Cases
- [Case 1]
- [Case 2]

## Success Criteria
- [ ] Criteria 1
- [ ] Criteria 2
```

`.cloud/commands/prime.md`:
```markdown
# Prime Command

Explore clawd codebase for current session:

1. Read git log (last 20 commits)
2. Scan tools/ directory structure
3. Review memory/kb/index.json
4. Check recent changes in AGENTS.md, SOUL.md
5. Summarize current state and priorities
```

**🎯 Workflow nou pentru features:**

```
Session 1 (Planning):
→ /prime-clawd
→ Research cu sub-agents
→ /plan output: feature-plan.md

Session 2 (Implementation):
→ /execute feature-plan.md
→ Build + test
→ /commit

Session 3 (Validation - optional):
→ Load doar implementation results
→ E2E testing
→ /handoff dacă context se umflă
```

### 3. Beneficii Așteptate

✅ **Reducere erori AI cu 80%** (conform video)
✅ **Context windows 90%+ mai mici** (sub-agents)
✅ **Faster iterations** (planning separate de implementation)
✅ **Better long-term memory** (git log + decision logs)
✅ **Scalabilitate** (funcționează și pe codebase-uri mari ca ROA)

---

## 📌 Notițe Personale

**Conectare cu Ralph Workflow:**
- Ralph PRD generator = planning session perfectă
- Ralph implementation loop = execution session cu DOAR PRD
- Autoresearch (video anterior) + WHISK = combo puternic

**Aplicabilitate la proiecte curente:**
- **roa2web:** Codebase growing, context management devine critic
- **Chatbot Maria:** Documentație selective loading (nu tot kb/)
- **ANAF Monitor:** Decision logs pentru de ce v2.2 > alte versiuni
- **Email processing:** Research sub-agents pentru insight extraction logic

**Trade-offs:**
- Setup time pentru commands (1x effort)
- Disciplină necesară (separate sessions, nu lazy single context)
- Beneficii exponențiale pe termen lung

**80/20 win:**
- Focus pe W (git log + separate sessions) = 80% din beneficii
- Adaugă I (sub-agents research) când planifici features mari
- S (layered context) vine natural după ce ai structură
- C (compress) evitat prin primele 3

---

## 🔗 Resurse Menționate

- **Chroma technical report:** Context window performance research
- **Archon project:** AI command center (coming soon)
- **Commands repository:** GitHub (link în descriere video)
- **Free AI Transformation Workshop:** April 2nd (YouTube live cu Leor Weinstein, CTOX)

---

**Processed by:** Echo  
**Model:** Sonnet 4.5  
**Next steps:** 
1. Create `.cloud/commands/` structure în clawd
2. Implement `/commit`, `/plan`, `/prime` commands
3. Update notes index
4. Consider integration cu Ralph workflow
