The complete guide to Claude Code setup. 100+ hours saved. 370x optimization. Production-tested patterns for skills, hooks, and MCP integration.
Purpose: Reduce Perplexity MCP costs by 80%+ using cache-first pattern Prerequisites: Perplexity MCP configured, Basic Memory MCP installed Time to Implement: 15 minutes ROI: $0.005 per cached query (80%+ budget savings on repeat topics)
Perplexity MCP charges $0.005 per query (~$5/month budget). Without caching:
Before ANY Perplexity search:
mcp__basic-memory__search_notes("topic"))In .mcp.json or .claude/mcp_servers.json:
{
"mcpServers": {
"perplexity": {
"type": "stdio",
"command": "npx",
"args": ["-y", "perplexity-mcp"],
"env": {
"PERPLEXITY_API_KEY": "${PERPLEXITY_API_KEY}"
}
},
"basic-memory": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@anthropics/mcp-server-basic-memory"],
"env": {
"MEMORY_PATH": "~/basic-memory"
}
}
}
}
The cache should be global (available across all projects):
mkdir -p ~/basic-memory/research-cache
Add this to your project’s CLAUDE.md Critical Rules section:
### Perplexity Cache-First Rule
PATTERN: "ALWAYS check Memory MCP before Perplexity"
BEFORE_SEARCH: "mcp__basic-memory__search_notes('topic')"
IF_FOUND: "Use cached result (FREE!)"
IF_NOT_FOUND: "Use Perplexity, then cache with mcp__basic-memory__write_note(folder='research-cache')"
ROI: "$0.005 per cached query, 80%+ savings"
# Before any Perplexity search
mcp__basic-memory__search_notes("topic keywords")
If results found → STOP! Use the cached result.
# Only if cache miss
mcp__perplexity__search(query="your research question")
# RIGHT AFTER every Perplexity search
mcp__basic-memory__write_note(
title="Topic Keywords Summary",
content="""# Research: [Topic]
**Source**: Perplexity search
**Date**: [Today's date]
**Query**: [What you searched for]
## Key Findings
- Finding 1
- Finding 2
- Finding 3
## Sources
- [List sources from Perplexity response]
""",
folder="research-cache"
)
Use descriptive, searchable titles:
| Topic | Cache Title |
|---|---|
| React 19 features | react-19-features-2025 |
| Claude Code hooks | claude-code-hooks-guide |
| PostgreSQL optimization | postgresql-query-optimization |
| Node.js best practices | nodejs-best-practices-2025 |
| Searches/Month | Cost | |—————-|——| | 100 | $0.50 | | 500 | $2.50 | | 1000 | $5.00 |
| Searches/Month | Actual Queries | Cost | |—————-|—————-|——| | 100 | 20 | $0.10 | | 500 | 100 | $0.50 | | 1000 | 200 | $1.00 |
Savings: 80% cost reduction
Scenario: You need to look up “Claude Code hooks” for the 5th time this month.
Without caching (old way):
User: "How do Claude Code hooks work?"
Claude: [Uses Perplexity] → $0.005
...(next week)...
User: "What hook types are available?"
Claude: [Uses Perplexity again] → $0.005
Cost: $0.01+ and growing
With caching (new way):
User: "How do Claude Code hooks work?"
Claude: [Checks cache] → Found 'claude-code-hooks-guide' → FREE!
...(next week)...
User: "What hook types are available?"
Claude: [Checks same cache] → Same note → FREE!
Cost: $0.005 (one-time) + $0.00 (all future)
research-cache/ folder createdSource Project: Production production system
Validation: research-cache/ folder with 10+ cached results
Pattern: Documented in CLAUDE.md as mandatory rule
Enforcement: PostToolUse hook reminder after every Perplexity call
Cost Optimization Authority: Proven pattern for 80%+ Perplexity cost reduction Usage: Implement on any project using Perplexity MCP Created: December 2025