JURIKO CLI includes an automatic conversation condensing feature that helps manage token usage by summarizing older parts of conversations when they approach the token limit. The condense threshold determines when this condensing is triggered.
The condense threshold is a percentage value (0-100) that determines when JURIKO should automatically condense (summarize) the conversation to reduce token usage. When the conversation reaches this percentage of the model's token limit, JURIKO will:
- Summarize older messages in the conversation
- Keep recent messages intact for context
- Reduce the total token count while preserving important information
- Default threshold: 75% of the model's token limit
- Range: 0-100 (percentage)
- Trigger: Automatic when threshold is reached
Set the JURIKO_CONDENSE_THRESHOLD environment variable:
# Set threshold to 80%
export JURIKO_CONDENSE_THRESHOLD=80
# Or run JURIKO with the environment variable
JURIKO_CONDENSE_THRESHOLD=80 jurikoThe threshold is stored in ~/.juriko/user-settings.json:
{
"condenseThreshold": 75,
"provider": "anthropic",
"model": "claude-3-5-sonnet-20241022"
}You can modify the threshold programmatically using the built-in functions:
import { getCondenseThreshold, saveCondenseThreshold } from './src/utils/user-settings';
// Get current threshold
const currentThreshold = await getCondenseThreshold();
console.log(`Current threshold: ${currentThreshold}%`);
// Set new threshold
await saveCondenseThreshold(85); // Set to 85%JURIKO checks for the condense threshold in this order:
- Environment Variable:
JURIKO_CONDENSE_THRESHOLD(0-100) - User Settings:
~/.juriko/user-settings.json - Default: 75%
- Threshold: 60-70%
- Best for: Users who want to minimize token usage and costs
- Trade-off: More frequent condensing, potential loss of some context
- Threshold: 75-80%
- Best for: Most users - good balance of context preservation and token management
- Trade-off: Moderate condensing frequency
- Threshold: 85-95%
- Best for: Users who prioritize maximum context retention
- Trade-off: Higher token usage, less frequent condensing
When the threshold is reached:
- Token Analysis: JURIKO calculates current token usage vs. model limit
- Message Selection: Identifies older messages for condensing
- Summarization: Uses the AI model to create a concise summary
- Context Preservation: Keeps recent messages and important context
- Token Reduction: Replaces verbose history with summary
# Terminal 1: Set for current session
export JURIKO_CONDENSE_THRESHOLD=70
juriko
# Terminal 2: Set for single run
JURIKO_CONDENSE_THRESHOLD=85 jurikoEdit ~/.juriko/user-settings.json:
{
"provider": "anthropic",
"model": "claude-3-5-sonnet-20241022",
"condenseThreshold": 80,
"theme": "dark"
}You can verify your current settings by examining the user settings file:
# View current settings
cat ~/.juriko/user-settings.json
# Check if environment variable is set
echo $JURIKO_CONDENSE_THRESHOLDDifferent models have different token limits, which affects when condensing triggers:
| Model | Token Limit | 75% Threshold | 80% Threshold |
|---|---|---|---|
| Claude 3.5 Sonnet | 200,000 | 150,000 | 160,000 |
| GPT-4 | 128,000 | 96,000 | 102,400 |
| GPT-3.5 Turbo | 16,385 | 12,289 | 13,108 |
Solution: Increase the threshold (e.g., from 75% to 85%)
Solution: Decrease the threshold (e.g., from 75% to 65%)
Check:
- Environment variable value:
echo $JURIKO_CONDENSE_THRESHOLD - User settings file:
cat ~/.juriko/user-settings.json - Valid range (0-100)
Note: JURIKO automatically clamps values to 0-100 range. Invalid values default to 75%.
- Start with default (75%): Works well for most users
- Monitor token usage: Adjust based on your conversation patterns
- Consider model limits: Smaller models may need lower thresholds
- Test different values: Find what works best for your workflow
- Use environment variables: For temporary threshold changes
You can create scripts to adjust thresholds based on context:
#!/bin/bash
# Set different thresholds for different projects
if [[ "$PWD" == *"large-project"* ]]; then
export JURIKO_CONDENSE_THRESHOLD=85 # More context for complex projects
else
export JURIKO_CONDENSE_THRESHOLD=70 # Less context for simple tasks
fi
jurikoCreate project-specific threshold settings:
# In your project directory
echo 'export JURIKO_CONDENSE_THRESHOLD=80' > .jurikorc
source .jurikorc
jurikoThe condense threshold is a powerful feature that helps JURIKO manage long conversations efficiently. By understanding and configuring this setting appropriately, you can optimize the balance between context preservation and token usage for your specific needs.
Default: 75% - Good for most users Configuration: Environment variable or user settings file Range: 0-100% Effect: Higher values = more context, more tokens; Lower values = less context, fewer tokens