T

Maximize Claude Context with TOON Format

Claude Projects offer powerful context capabilities. Learn how TOON format helps you fit more knowledge into Claude's context window while maintaining readability and reducing token usage.

Why TOON for Claude Projects?

📊

More Data, Same Context

Claude 3 models have 200K token windows. TOON's efficiency lets you include 30-60% more information in the same space.

🎯

Better Understanding

Claude parses tabular TOON data more accurately than nested JSON, leading to better responses and fewer misunderstandings.

💰

Lower API Costs

Reduced token usage means lower costs for Claude API usage, especially important for high-volume applications.

Context Window Optimization

ModelContext WindowWith JSONWith TOON (+40%)
Claude 3 Opus200K tokens~125K data tokens~175K data tokens
Claude 3 Sonnet200K tokens~125K data tokens~175K data tokens
Claude 3 Haiku200K tokens~125K data tokens~175K data tokens

* Assuming typical project setup with system prompts and instructions

Practical Example: Knowledge Base Integration

Scenario:

You're building a customer support Claude Project with a product catalog of 500 items. Each item has name, SKU, price, category, and description.

With JSON(~45,000 tokens)
{
  "products": [
    {
      "id": "PRD-1001",
      "name": "Wireless Mouse",
      "price": 29.99,
      "category": "Electronics",
      "stock": 150
    },
    {
      "id": "PRD-1002",
      "name": "USB-C Cable",
      "price": 12.99,
      "category": "Electronics",
      "stock": 300
    }
    // ... 498 more items
  ]
}

JSON uses ~90 tokens per product × 500 = 45,000 tokens

With TOON(~25,000 tokens - 44% savings)
products[500]{id,name,price,category,stock}:
  PRD-1001,Wireless Mouse,29.99,Electronics,150
  PRD-1002,USB-C Cable,12.99,Electronics,300
  PRD-1003,Laptop Stand,49.99,Accessories,75
  PRD-1004,Desk Lamp,34.99,Furniture,120
  ...
  (496 more rows)

TOON uses ~50 tokens per product × 500 = 25,000 tokens

Result: You save 20,000 tokens (44%) which can be used for:

  • • More detailed product descriptions
  • • Additional product attributes
  • • Customer interaction history
  • • Longer conversation context

Implementation Guide

1

Convert Your Data to TOON

Use our converter to transform your knowledge base from JSON to TOON format:

import { jsonToToon } from '@/lib/toon-converter';

const knowledgeBase = {
  // your data here
};

const result = jsonToToon(JSON.stringify(knowledgeBase));
console.log('Token savings:', result.tokenSavings + '%');
2

Add to Claude Project Knowledge

In Claude Projects, add your TOON-formatted data to the project knowledge section. Claude will understand and reference it naturally in conversations.

3

Optimize Your System Prompt

Include a brief explanation of TOON format in your system prompt:

You have access to product data in TOON format.
TOON uses tabular notation for arrays:
products[N]{field1,field2,...}:
  val1,val2,...

This format is more compact than JSON while maintaining
all data relationships.

Best Practices for Claude + TOON

Use TOON for Large Datasets: TOON shines when you have 50+ items with uniform structure.
Mix TOON with Regular Text: You can use TOON for data and regular prose for instructions.
Keep Field Names Clear: Use descriptive field names that Claude can easily understand (product_id vs pid).
Test Parsing Accuracy: Ask Claude to extract specific values to verify it's parsing your TOON data correctly.
Update Incrementally: When data changes, TOON's compact format makes updates easier to manage.

Ready to Optimize Your Claude Project?

Convert your data to TOON format and see immediate improvements in context efficiency.

Try TOON Converter