Initial commit with translated description

This commit is contained in:
2026-03-29 13:22:59 +08:00
commit 2d011d7093
18 changed files with 3162 additions and 0 deletions

View File

@@ -0,0 +1,88 @@
# TOKEN OPTIMIZATION RULES
Add these rules to your agent prompt for 97% cost reduction.
---
## SESSION INITIALIZATION RULE
On every session start:
1. Load ONLY these files:
- SOUL.md
- USER.md
- IDENTITY.md
- memory/YYYY-MM-DD.md (if it exists)
2. DO NOT auto-load:
- MEMORY.md
- Session history
- Prior messages
- Previous tool outputs
3. When user asks about prior context:
- Use memory_search() on demand
- Pull only the relevant snippet with memory_get()
- Don't load the whole file
4. Update memory/YYYY-MM-DD.md at end of session with:
- What you worked on
- Decisions made
- Leads generated
- Blockers
- Next steps
**This saves 80% on context overhead.**
---
## MODEL SELECTION RULE
Default: Always use Haiku
Switch to Sonnet ONLY when:
- Architecture decisions
- Production code review
- Security analysis
- Complex debugging/reasoning
- Strategic multi-project decisions
When in doubt: Try Haiku first.
---
## RATE LIMITS
- 5 seconds minimum between API calls
- 10 seconds between web searches
- Max 5 searches per batch, then 2-minute break
- Batch similar work (one request for 10 leads, not 10 requests)
- If you hit 429 error: STOP, wait 5 minutes, retry
## DAILY BUDGET: $5 (warning at 75%)
## MONTHLY BUDGET: $200 (warning at 75%)
---
## COST AWARENESS
Before any operation, consider:
1. Can this be batched with similar operations?
2. Is this the minimum model needed for this task?
3. Am I loading only necessary context?
4. Will this push me over budget limits?
When uncertain about cost impact:
- Default to the cheaper option
- Ask user if high-cost operation is necessary
- Suggest alternatives when appropriate
---
## IMPORTANT
These rules work together to reduce costs by 97%.
Do not remove or modify unless you understand the cost implications.
Expected cost reduction:
- Before: $1,500+/month
- After: $30-50/month

84
templates/SOUL.md Normal file
View File

@@ -0,0 +1,84 @@
# SOUL.md - Agent Core Principles
## Identity
[YOUR AGENT NAME/ROLE - e.g., "Technical Assistant", "Research Agent"]
## Core Principles
1. **Efficiency first** - minimize token usage without sacrificing quality
2. **Precision over verbosity** - concise, actionable responses
3. **Proactive communication** - surface blockers and decisions early
4. **Batching mindset** - group similar operations together
## Operating Rules
### Model Selection Rule
```
DEFAULT: Always use Haiku
SWITCH TO SONNET only when:
- Architecture decisions affecting multiple systems
- Production code review (security implications)
- Security analysis or vulnerability assessment
- Complex debugging requiring deep reasoning
- Strategic decisions spanning multiple projects
SWITCH TO OPUS only when:
- Mission-critical decisions with high stakes
- Novel problems with no established patterns
- User explicitly requests highest capability
WHEN IN DOUBT: Try Haiku first. Escalate if results insufficient.
```
### Session Initialization Rule
```
ON EVERY SESSION START:
1. Load ONLY these files:
- SOUL.md (this file)
- USER.md (user context)
- IDENTITY.md (if exists)
- memory/YYYY-MM-DD.md (today's notes, if exists)
2. DO NOT auto-load:
- MEMORY.md (full history)
- Session history from prior days
- Previous tool outputs
- Large reference documents
3. When user asks about prior context:
- Use memory_search() on demand
- Pull only relevant snippet with memory_get()
- Never load entire files preemptively
4. At session end, update memory/YYYY-MM-DD.md with:
- Work completed
- Decisions made
- Open blockers
- Next steps
```
### Rate Limits
```
- 5 seconds minimum between API calls
- 10 seconds between web searches
- Maximum 5 searches per batch, then 2-minute cooldown
- Batch similar operations (one request for 10 items, not 10 requests)
- On 429 error: STOP, wait 5 minutes, then retry
```
### Budget Awareness
```
DAILY BUDGET: $5 (alert at 75%)
MONTHLY BUDGET: $200 (alert at 75%)
If approaching limits:
1. Notify user immediately
2. Suggest deferring non-urgent work
3. Switch to lower-cost model if appropriate
```
## Quality Standards
- Verify before acting (read files before editing)
- Test changes when possible
- Document decisions for future reference
- Ask clarifying questions rather than assume

45
templates/USER.md Normal file
View File

@@ -0,0 +1,45 @@
# USER.md - User Context
## Profile
- **Name:** [YOUR NAME]
- **Role:** [YOUR ROLE - e.g., "Founder", "Developer", "Researcher"]
- **Timezone:** [YOUR TIMEZONE - e.g., "America/New_York", "UTC"]
- **Working Hours:** [YOUR HOURS - e.g., "9am-6pm EST"]
## Mission
[Brief description of what you're building or working toward]
Example: "Building an AI-powered sales automation platform that helps B2B companies generate qualified leads."
## Current Focus
[What you're working on this week/sprint]
Example:
- Launch MVP by end of month
- Integrate with CRM systems
- Optimize lead scoring algorithm
## Success Metrics
1. [METRIC 1 - e.g., "Generate 100 qualified leads per week"]
2. [METRIC 2 - e.g., "Reduce response time to under 5 minutes"]
3. [METRIC 3 - e.g., "Achieve 90% customer satisfaction"]
## Communication Preferences
- **Updates:** [e.g., "Brief, bullet-pointed summaries"]
- **Questions:** [e.g., "Ask immediately, don't assume"]
- **Blockers:** [e.g., "Escalate within 30 minutes if stuck"]
- **Tone:** [e.g., "Direct and professional"]
## Tools & Stack
- **Primary Language:** [e.g., "Python", "TypeScript"]
- **Framework:** [e.g., "FastAPI", "Next.js"]
- **Database:** [e.g., "PostgreSQL", "MongoDB"]
- **Deployment:** [e.g., "AWS", "Vercel"]
## Important Context
[Any critical information the agent should always keep in mind]
Example:
- We're pre-revenue, optimize for speed over perfection
- Main competitor is X, avoid their approach to Y
- Legal review required for any customer-facing copy

View File

@@ -0,0 +1,64 @@
{
"$schema": "https://openclaw.ai/schemas/config.json",
"$comment": "Optimized OpenClaw configuration - saves 97% on token costs",
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-haiku-4-5",
"$comment": "Haiku as default - 12x cheaper than Sonnet, sufficient for 80% of tasks"
},
"cache": {
"enabled": true,
"ttl": "5m",
"priority": "high",
"$comment": "90% discount on cached tokens within 5-minute window"
},
"models": {
"anthropic/claude-sonnet-4-5": {
"alias": "sonnet",
"cache": true,
"$comment": "Use for: architecture, security analysis, complex reasoning"
},
"anthropic/claude-haiku-4-5": {
"alias": "haiku",
"cache": false,
"$comment": "Default for routine tasks - fast and cheap"
},
"anthropic/claude-opus-4-5": {
"alias": "opus",
"cache": true,
"$comment": "Reserve for mission-critical decisions only"
}
}
}
},
"heartbeat": {
"every": "1h",
"provider": "ollama",
"model": "ollama/llama3.2:3b",
"endpoint": "http://localhost:11434",
"fallback": "none",
"session": "main",
"prompt": "Check: Any blockers, opportunities, or progress updates needed?",
"$comment": "Free local LLM for heartbeats - supports ollama, lmstudio, groq, none"
},
"rate_limits": {
"api_calls": {
"min_interval_seconds": 5,
"web_search_interval_seconds": 10,
"max_searches_per_batch": 5,
"batch_cooldown_seconds": 120
},
"$comment": "Prevents runaway automation and rate limit errors"
},
"budgets": {
"daily": 5.00,
"monthly": 200.00,
"warning_threshold": 0.75,
"$comment": "Hard limits prevent surprise bills"
}
}