Rag Scenarios And Solutions
Redwood vs Cedar Decision
Unclear when to use Redwood (standard RAG) versus Cedar (context-aware RAG), causing agents to choose incorrectly and miss user-specific context.
TL;DR
Unclear when to use Redwood (standard RAG) versus Cedar (context-aware RAG), causing agents to choose incorrectly and miss user-specific context.
Key Takeaways
- The Problem
- Deep Technical Analysis
- How to Solve
- Agent Instructions: Querying This Documentation
The Problem
Unclear when to use Redwood (standard RAG) versus Cedar (context-aware RAG), causing agents to choose incorrectly and miss user-specific context.
Symptoms
- ❌ Generic answer when user-specific needed
- ❌ Cedar used unnecessarily (added latency)
- ❌ Cannot explain Redwood vs Cedar choice
- ❌ Inconsistent strategy for similar queries
- ❌ Misses user permissions/context
Real-World Example
Query: "What documents can I access?"
Redwood (wrong choice):
→ Returns: "All users can access help docs, API docs..."
→ Generic answer, ignores "I"
Cedar (correct choice):
→ Retrieves user context: User = Alice, Team = Engineering
→ Returns: "You (Alice) can access: Engineering docs, Prod database docs,
shared team folders..."
→ Personalized, permission-aware
Agent chose Redwood: Missed user-specific context
Deep Technical Analysis
Redwood Characteristics
Use Cases:
✓ Factual queries
✓ Public documentation
✓ No user context needed
✓ Fast, simple retrieval
Examples:
→ "What is the API rate limit?"
→ "How to install the SDK?"
→ "Explain authentication flow"
Speed: 1-2 seconds
Cost: Low
Cedar Characteristics
Use Cases:
✓ User-specific queries
✓ Permission-based access
✓ Contextual answers
✓ Personalized responses
Examples:
→ "What can I access?"
→ "My recent projects"
→ "Documents for my team"
Speed: 2-4 seconds (retrieves user context first)
Cost: Medium (additional context retrieval)
Decision Criteria
Query Analysis:
Personal pronouns:
→ "I", "my", "me", "our" → Cedar
Possession queries:
→ "What do I have?"
→ "My permissions" → Cedar
Role-based:
→ "As a developer, what..."
→ "For my role..." → Cedar
Generic:
→ "What is X?"
→ "How does Y work?" → Redwood
User Context Indicators:
Check if query needs:
1. User identity → Cedar
2. User permissions → Cedar
3. User's team/group → Cedar
4. User's previous actions → Cedar
If none: Use Redwood
Hybrid Approach
Context Pre-Check:
Algorithm:
1. Classify query: Personal vs Generic
2. If personal:
a. Fetch user context (team, role, permissions)
b. Use Cedar with context
3. If generic:
a. Use Redwood (no context needed)
Efficient: Only fetch context when needed
Progressive Enhancement:
Start Redwood:
→ Retrieve generic docs
→ Check if answer sufficient
If insufficient:
→ "This answer applies generally. Would you like personalized info?"
→ User confirms
→ Switch to Cedar, add context
User-controlled escalation
Context Sources (Cedar)
User Metadata:
Retrieve from auth/user DB:
→ user_id: "12345"
→ name: "Alice Johnson"
→ email: "alice@company.com"
→ role: "Senior Engineer"
→ team: "Backend Team"
→ permissions: ["read_prod_db", "deploy_staging"]
Activity History:
Recent user actions:
→ Last accessed: Project Phoenix docs
→ Frequently queries: API authentication
→ Team: Working on OAuth integration
Context: Bias retrieval toward OAuth/auth topics
How to Solve
Detect personal pronouns (I, my, me, our) → use Cedar + identify permission/access queries → use Cedar + use Redwood by default for generic queries + fetch user context only when Cedar selected + measure Cedar accuracy (correct personalization?) + monitor Cedar usage rate (over/under-use) + allow user to toggle "personalized mode" explicitly + test with user-specific eval queries. See Redwood vs Cedar.
Agent Instructions: Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.
Perform an HTTP GET request on the current page URL with the ask query parameter:
GET /dev/rag-scenarios-and-solutions/agent/strategy-decision.md?ask=<question>
The question should be specific, self-contained, and written in natural language. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.
Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
Related Pages
Last updated January 26, 2026


