Learn from user answers and build persistent context. Use when agents need to remember user preferences, detect patterns in responses, and reduce repeated questions. Handles preference learning, pattern detection, and context management.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Learn from user answers and build persistent context. Use when agents need to remember user preferences, detect patterns in responses, and reduce repeated questions. Handles preference learning, pattern detection, and context management.
{"type":"object","properties":{"action":{"type":"string","enum":"[Truncated]","description":"Action to perform"},"question":{"type":"string","description":"Question that was asked (for analyze-answer)"},"context":{"type":"string","description":"Context of the question (for analyze-answer)"},"answer":{"type":"string","description":"User's answer (for analyze-answer)"},"user_id":{"type":"string","description":"User identifier (optional, defaults to 'default')"},"scope":{"type":"string","enum":"[Truncated]","description":"Scope of context to retrieve (for get-context)"},"updates":{"type":"object","description":"Context updates to apply (for update-context)"},"history_days":{"type":"number","description":"Number of days of history to analyze (for detect-patterns)"}},"required":["action"]}
output_schema
{"type":"object","properties":{"pattern_detected":{"type":"string","description":"Type of pattern detected"},"confidence":{"type":"number","description":"Confidence score (0-1)"},"suggested_rule":{"type":"string","description":"Suggested rule based on pattern"},"context_update":{"type":"object","description":"Updates to apply to user context"},"context":{"type":"object","description":"User context (for get-context)"},"patterns":{"type":"array","description":"Detected patterns (for detect-patterns)"},"_meta":{"type":"object","properties":"[Truncated]"}}}
Context Enhancement
Learn from user answers to detect patterns and build persistent context that reduces repeated questions.
FREE. No charge per call. Requires Claw0x API key for authentication.
What It Does
Context Enhancement analyzes user answers to detect patterns and build a persistent context layer that:
Remembers user preferences (language, code style, deployment strategy)
Detects patterns in responses (e.g., "always use TypeScript", "deploy to staging first")
Generates rules based on detected patterns
Reduces repeated questions by learning from past interactions
Prerequisites
IMPORTANT: This is the server-side version that runs through Claw0x Gateway. An API key is required for authentication, rate limiting, and usage tracking.
Note: For local use without API key, install via ClawHub: openclaw skills install context-enhancement
Pricing
FREE. No charge per call.
Requires Claw0x API key for authentication
No usage charges (price_per_call = 0)
Unlimited calls
Used for rate limiting and usage tracking
Use Cases
Scenario 1: Code Style Preferences
Problem: Agent asks "Use single or double quotes?" every time Solution: After first answer, Context Enhancement detects pattern and remembers preference Result: Agent automatically uses preferred style without asking
Scenario 2: Deployment Strategy
Problem: Agent doesn't remember user's deployment workflow Solution: Learns from answers like "Always deploy to staging first" Result: Agent follows learned deployment strategy automatically
Scenario 3: Language Preferences
Problem: Agent asks "TypeScript or JavaScript?" for every new file Solution: Detects language preference pattern from past answers Result: Agent defaults to preferred language
Scenario 4: Team Context Sharing
Problem: Each team member has to teach the agent their preferences Solution: Context can be shared across team members Result: Consistent behavior across team
Quick Reference
When This Happens
Do This
What You Get
User answers preference question
analyze-answer
Pattern detection + rule generation
Need to check user preferences
get-context
Current user context
Want to update context manually
update-context
Updated context
Want to see all detected patterns
detect-patterns
List of patterns with confidence scores
5-Minute Quickstart
Step 1: Get API Key (30 seconds)
Sign up at claw0x.com → Dashboard → Create API Key
{"pattern_detected":"language_preference","confidence":0.95,"suggested_rule":"User prefers TypeScript for new code","context_update":{"preferences.language":"TypeScript","preferences.use_cases":["Creating auth endpoint"]},"_meta":{"skill":"context-enhancement","latency_ms":15}}
history_days: Number of days to analyze (optional, defaults to 30)
Output Format
analyze-answer
{"pattern_detected":"language_preference","confidence":0.95,"suggested_rule":"User prefers TypeScript for new code","context_update":{"preferences.language":"TypeScript"},"_meta":{"skill":"context-enhancement","latency_ms":15}}
get-context
{"context":{"preferences":{"language":"TypeScript","deployment":"staging-first"},"patterns":[{"pattern":"language_preference","confidence":0.95,"examples":["Creating auth endpoint"],"rule":"User prefers TypeScript"}],"rules":["User prefers TypeScript for new code","Deploy to staging first"]},"_meta":{"skill":"context-enhancement","latency_ms":10}}
detect-patterns
{"patterns":[{"pattern":"language_preference","frequency":5,"confidence":0.95,"suggested_rule":"User prefers TypeScript"},{"pattern":"deployment_strategy","frequency":3,"confidence":0.98,"suggested_rule":"Deploy to staging first"}],"_meta":{"skill":"context-enhancement","latency_ms":12}}
Error Handling
Error Code
Meaning
Solution
400
Invalid input or missing required fields
Check input schema
401
Missing or invalid API key
Set CLAW0X_API_KEY
500
Internal error (not billed)
Retry or contact support
Pattern Detection Types
Pattern
Trigger
Confidence
Example Rule
language_preference
TypeScript/JavaScript questions
0.95
"User prefers TypeScript"
deployment_strategy
Deployment workflow questions
0.98
"Deploy to staging first"
code_style
Code style questions
0.92
"Use single quotes, no semicolons"
generic_preference
Any other question
0.7
"User answered X for Y"
Best Practices
Use consistent user_id: Same user_id across sessions to maintain context
Provide context: Include context field for better pattern detection
Check confidence: Only apply rules with confidence > 0.8
Review patterns: Periodically call detect-patterns to review learned patterns
Team context: Use team-level user_id for shared preferences
Limitations
Context stored in memory (use database for production)
Pattern detection is rule-based (not ML-based)
Limited to predefined pattern types
No automatic context expiration
Complementary Skills
btw: Ask clarifying questions before context is built
self-improving-agent: Learn from errors and corrections
capability-evolver: Analyze and improve agent capabilities
About Claw0x
This skill is provided by Claw0x, the native skills layer for AI agents.