@rookiestar/eng-lang-tutor 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +5 -4
- package/README.md +16 -1
- package/README_EN.md +16 -1
- package/SKILL.md +113 -92
- package/docs/OPENCLAW_DEPLOYMENT.md +7 -4
- package/package.json +1 -1
- package/scripts/__pycache__/cli.cpython-313.pyc +0 -0
- package/scripts/__pycache__/command_parser.cpython-313.pyc +0 -0
- package/scripts/__pycache__/constants.cpython-313.pyc +0 -0
- package/scripts/__pycache__/cron_push.cpython-313.pyc +0 -0
- package/scripts/__pycache__/dedup.cpython-313.pyc +0 -0
- package/scripts/__pycache__/gamification.cpython-313.pyc +0 -0
- package/scripts/__pycache__/scorer.cpython-313.pyc +0 -0
- package/scripts/__pycache__/state_manager.cpython-313.pyc +0 -0
- package/scripts/__pycache__/utils.cpython-313.pyc +0 -0
- package/scripts/cli.py +203 -0
- package/scripts/constants.py +56 -0
- package/scripts/gamification.py +48 -34
- package/scripts/scorer.py +14 -32
- package/scripts/state_manager.py +41 -206
- package/scripts/tts/__pycache__/__init__.cpython-313.pyc +0 -0
- package/scripts/tts/__pycache__/base.cpython-313.pyc +0 -0
- package/scripts/tts/__pycache__/manager.cpython-313.pyc +0 -0
- package/scripts/tts/providers/__pycache__/__init__.cpython-313.pyc +0 -0
- package/scripts/tts/providers/__pycache__/xunfei.cpython-313.pyc +0 -0
- package/scripts/utils.py +78 -0
- package/templates/prompt_templates.md +47 -1235
- package/templates/prompts/display_guide.md +106 -0
- package/templates/prompts/initialization.md +213 -0
- package/templates/prompts/keypoint_generation.md +268 -0
- package/templates/prompts/output_rules.md +106 -0
- package/templates/prompts/quiz_generation.md +187 -0
- package/templates/prompts/responses.md +291 -0
- package/templates/prompts/shared_enums.md +97 -0
- package/templates/state_schema.json +1 -6
package/CLAUDE.md
CHANGED
|
@@ -70,7 +70,6 @@ Agent结合难度与偏好的设置,以及用户的历史学习进度动态生
|
|
|
70
70
|
|-----|------|
|
|
71
71
|
| **XP & 等级** | 1-20级,XP累积升级(启程者 → 行路人 → 探索者 → 开拓者) |
|
|
72
72
|
| **连胜系统** | 连续学习天数,支持连胜冻结(50宝石) |
|
|
73
|
-
| **联赛系统** | Bronze → Silver → Gold → Platinum → Diamond(周结算) |
|
|
74
73
|
| **徽章系统** | First Steps、Week Warrior、Month Master、Perfect 10、Vocab Hunter、Error Slayer |
|
|
75
74
|
| **宝石系统** | 用于购买连胜冻结、提示等 |
|
|
76
75
|
|
|
@@ -148,7 +147,7 @@ eng-lang-tutor/
|
|
|
148
147
|
├── scripts/
|
|
149
148
|
│ ├── state_manager.py # 状态持久化与事件日志
|
|
150
149
|
│ ├── scorer.py # 答案评估与XP计算
|
|
151
|
-
│ ├── gamification.py #
|
|
150
|
+
│ ├── gamification.py # 连胜/等级/徽章
|
|
152
151
|
│ └── dedup.py # 14天去重逻辑
|
|
153
152
|
├── templates/
|
|
154
153
|
│ ├── state_schema.json # 状态 JSON Schema
|
|
@@ -160,7 +159,8 @@ eng-lang-tutor/
|
|
|
160
159
|
├── examples/
|
|
161
160
|
│ ├── sample_keypoint.json # 示例知识点
|
|
162
161
|
│ └── sample_quiz.json # 示例Quiz
|
|
163
|
-
└──
|
|
162
|
+
└── (数据存储在外部目录)
|
|
163
|
+
~/.openclaw/state/eng-lang-tutor/ # 实际数据存储位置
|
|
164
164
|
├── state.json # 运行时状态
|
|
165
165
|
├── logs/
|
|
166
166
|
│ └── events_YYYY-MM.jsonl
|
|
@@ -169,6 +169,8 @@ eng-lang-tutor/
|
|
|
169
169
|
├── keypoint.json
|
|
170
170
|
├── quiz.json
|
|
171
171
|
└── user_answers.json
|
|
172
|
+
|
|
173
|
+
注: 可通过 OPENCLAW_STATE_DIR 环境变量自定义存储位置
|
|
172
174
|
```
|
|
173
175
|
|
|
174
176
|
## 4. 功能切片实现
|
|
@@ -185,7 +187,6 @@ eng-lang-tutor/
|
|
|
185
187
|
| 连胜更新 | gamification.py | study_date | new_streak |
|
|
186
188
|
| 等级更新 | gamification.py | XP | level |
|
|
187
189
|
| 徽章检查 | gamification.py | progress | new_badges |
|
|
188
|
-
| 联赛更新 | gamification.py | weekly_xp | league |
|
|
189
190
|
| 去重检查 | dedup.py | new_content, recent_content | is_duplicate |
|
|
190
191
|
|
|
191
192
|
### 4.2 核心工作流
|
package/README.md
CHANGED
|
@@ -45,6 +45,12 @@ openclaw skills list
|
|
|
45
45
|
openclaw skills info eng-lang-tutor
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
**重启 Gateway:**
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
openclaw gateway restart
|
|
52
|
+
```
|
|
53
|
+
|
|
48
54
|
**配置渠道:**
|
|
49
55
|
|
|
50
56
|
**Discord 配置:**
|
|
@@ -165,12 +171,21 @@ eng-lang-tutor/
|
|
|
165
171
|
│ ├── dedup.py # 14天去重逻辑
|
|
166
172
|
│ ├── command_parser.py # 用户命令解析
|
|
167
173
|
│ ├── cron_push.py # 定时内容推送
|
|
174
|
+
│ ├── constants.py # 共享常量(等级阈值)
|
|
175
|
+
│ ├── utils.py # 工具函数(安全除法、深度合并)
|
|
176
|
+
│ ├── cli.py # CLI 入口点
|
|
168
177
|
│ └── tts/ # TTS 语音合成模块
|
|
169
178
|
├── templates/
|
|
170
179
|
│ ├── state_schema.json # 状态 JSON Schema
|
|
171
180
|
│ ├── keypoint_schema.json # 知识点 JSON Schema
|
|
172
181
|
│ ├── quiz_schema.json # 测验 JSON Schema
|
|
173
|
-
│
|
|
182
|
+
│ ├── prompt_templates.md # LLM Prompt 模板索引
|
|
183
|
+
│ └── prompts/ # 拆分的 Prompt 模板
|
|
184
|
+
│ ├── keypoint_generation.md
|
|
185
|
+
│ ├── quiz_generation.md
|
|
186
|
+
│ ├── display_guide.md
|
|
187
|
+
│ ├── initialization.md
|
|
188
|
+
│ └── responses.md
|
|
174
189
|
├── references/
|
|
175
190
|
│ └── resources.md # 主题化学习资源
|
|
176
191
|
├── examples/
|
package/README_EN.md
CHANGED
|
@@ -45,6 +45,12 @@ openclaw skills list
|
|
|
45
45
|
openclaw skills info eng-lang-tutor
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
**Restart Gateway:**
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
openclaw gateway restart
|
|
52
|
+
```
|
|
53
|
+
|
|
48
54
|
### Configure Channel
|
|
49
55
|
|
|
50
56
|
**Discord Configuration:**
|
|
@@ -165,12 +171,21 @@ eng-lang-tutor/
|
|
|
165
171
|
│ ├── dedup.py # 14-day deduplication
|
|
166
172
|
│ ├── command_parser.py # User command parsing
|
|
167
173
|
│ ├── cron_push.py # Scheduled content push
|
|
174
|
+
│ ├── constants.py # Shared constants (level thresholds)
|
|
175
|
+
│ ├── utils.py # Utility functions (safe divide, deep merge)
|
|
176
|
+
│ ├── cli.py # CLI entry point
|
|
168
177
|
│ └── tts/ # TTS module
|
|
169
178
|
├── templates/
|
|
170
179
|
│ ├── state_schema.json # State JSON Schema
|
|
171
180
|
│ ├── keypoint_schema.json # Keypoint JSON Schema
|
|
172
181
|
│ ├── quiz_schema.json # Quiz JSON Schema
|
|
173
|
-
│
|
|
182
|
+
│ ├── prompt_templates.md # LLM prompt templates index
|
|
183
|
+
│ └── prompts/ # Split prompt templates
|
|
184
|
+
│ ├── keypoint_generation.md
|
|
185
|
+
│ ├── quiz_generation.md
|
|
186
|
+
│ ├── display_guide.md
|
|
187
|
+
│ ├── initialization.md
|
|
188
|
+
│ └── responses.md
|
|
174
189
|
├── references/
|
|
175
190
|
│ └── resources.md # Themed learning resources
|
|
176
191
|
├── examples/
|
package/SKILL.md
CHANGED
|
@@ -61,57 +61,48 @@ Output: results.json, updated state.json
|
|
|
61
61
|
|
|
62
62
|
## Quiz Types
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|------|-------------|----------|------------|
|
|
66
|
-
| multiple_choice | Select correct expression from 4 options | 10 | 1 (required) |
|
|
67
|
-
| chinglish_fix | Identify and correct Chinglish expression | 15 | 1 (required) |
|
|
68
|
-
| fill_blank | Complete dialogue with missing expression | 12 | 0-1 (random) |
|
|
69
|
-
| dialogue_completion | Choose appropriate response in context | 15 | 0-1 (random) |
|
|
64
|
+
> See [templates/prompts/shared_enums.md](templates/prompts/shared_enums.md#quiz-question-types-题型) for full definitions.
|
|
70
65
|
|
|
71
|
-
|
|
66
|
+
| Type | XP | Daily |
|
|
67
|
+
|------|-----|-------|
|
|
68
|
+
| multiple_choice | 10 | 1 (required) |
|
|
69
|
+
| chinglish_fix | 15 | 1 (required) |
|
|
70
|
+
| fill_blank / dialogue_completion | 12 | 0-1 (random) |
|
|
71
|
+
|
|
72
|
+
**Daily Quiz:** 3 questions, ~37 XP, pass with 2/3 correct
|
|
72
73
|
|
|
73
74
|
## Gamification System
|
|
74
75
|
|
|
75
76
|
### XP & Levels
|
|
76
77
|
|
|
77
78
|
This system has two independent level systems:
|
|
78
|
-
- **Ability Level (CEFR)**: A1-C2, determines content difficulty
|
|
79
|
-
- **Activity Level (Level)**: 1-20, measures engagement depth
|
|
79
|
+
- **Ability Level (CEFR)**: A1-C2, determines content difficulty
|
|
80
|
+
- **Activity Level (Level)**: 1-20, measures engagement depth
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
- Level 1-5 (Starter/启程者): 0-350 XP
|
|
83
|
-
- Level 6-10 (Traveler/行路人): 550-2000 XP
|
|
84
|
-
- Level 11-15 (Explorer/探索者): 2600-6000 XP
|
|
85
|
-
- Level 16-20 (Pioneer/开拓者): 7200-15000 XP
|
|
82
|
+
> See [templates/prompts/shared_enums.md](templates/prompts/shared_enums.md) for level stages and badge definitions.
|
|
86
83
|
|
|
87
84
|
### Streak System
|
|
88
85
|
- Consecutive days of study builds streak
|
|
89
|
-
- Streak
|
|
90
|
-
- Streak multiplier: 1.0 + (streak * 0.05), max 2.0x
|
|
86
|
+
- Streak multiplier: `1.0 + (streak * 0.05)`, max 2.0x
|
|
91
87
|
- Streak freeze costs 50 gems
|
|
92
88
|
|
|
93
|
-
### Badges
|
|
94
|
-
- First Steps: Complete first quiz (+10 gems)
|
|
95
|
-
- Week Warrior: 7-day streak (+25 gems)
|
|
96
|
-
- Month Master: 30-day streak (+100 gems)
|
|
97
|
-
- Perfect 10: 10 perfect quizzes (+50 gems)
|
|
98
|
-
- Vocab Hunter: Learn 100 expressions (+75 gems)
|
|
99
|
-
- Error Slayer: Clear 30 errors (+30 gems)
|
|
100
|
-
|
|
101
89
|
## Key Scripts
|
|
102
90
|
|
|
103
91
|
| Script | Purpose |
|
|
104
92
|
|--------|---------|
|
|
105
|
-
| state_manager.py | State persistence, event logging,
|
|
93
|
+
| state_manager.py | State persistence, event logging, error notebook |
|
|
106
94
|
| cron_push.py | Scheduled content push (keypoint/quiz placeholders) |
|
|
107
95
|
| scorer.py | Answer evaluation, XP calculation |
|
|
108
96
|
| gamification.py | Streak/level/badge logic |
|
|
109
97
|
| dedup.py | 14-day content deduplication |
|
|
110
98
|
| command_parser.py | Natural language command parsing |
|
|
99
|
+
| constants.py | Shared constants (level thresholds, level names) |
|
|
100
|
+
| utils.py | Utility functions (safe divide, deep merge) |
|
|
101
|
+
| cli.py | CLI entry point for state management |
|
|
111
102
|
|
|
112
103
|
## CLI Commands
|
|
113
104
|
|
|
114
|
-
> These bash commands are used by the Agent to execute operations.
|
|
105
|
+
> These bash commands are used by the Agent to execute operations. Data is stored in `~/.openclaw/state/eng-lang-tutor/` by default. Do NOT specify `--data-dir` unless using a custom location.
|
|
115
106
|
|
|
116
107
|
### Content Management
|
|
117
108
|
```bash
|
|
@@ -162,19 +153,17 @@ python3 scripts/state_manager.py schedule --keypoint-time 07:00 --quiz-time 21:0
|
|
|
162
153
|
|
|
163
154
|
## Core Principles
|
|
164
155
|
|
|
156
|
+
> See [templates/prompts/keypoint_generation.md](templates/prompts/keypoint_generation.md) for detailed generation rules.
|
|
157
|
+
|
|
165
158
|
1. **Always output valid JSON** - No markdown, no extra text
|
|
166
159
|
2. **Focus on "How Americans say it"** - NOT translation
|
|
167
|
-
3. **Every knowledge point must include**:
|
|
168
|
-
- Scene context
|
|
169
|
-
- Alternative expressions
|
|
170
|
-
- Chinglish trap + correction
|
|
160
|
+
3. **Every knowledge point must include**: Scene context, alternatives, Chinglish trap
|
|
171
161
|
4. **14-day deduplication** - No repeated topics or expressions
|
|
172
|
-
5. **Topic fingerprints** - Use unique identifiers for deduplication
|
|
173
162
|
|
|
174
163
|
## File Structure
|
|
175
164
|
|
|
176
165
|
```
|
|
177
|
-
data
|
|
166
|
+
~/.openclaw/state/eng-lang-tutor/ # Default data location
|
|
178
167
|
state.json # Core state (streak/xp/preferences)
|
|
179
168
|
logs/
|
|
180
169
|
events_2026-02.jsonl # Monthly event log
|
|
@@ -185,6 +174,8 @@ data/
|
|
|
185
174
|
user_answers.json # User's answers
|
|
186
175
|
```
|
|
187
176
|
|
|
177
|
+
**Note:** Data location can be customized via `OPENCLAW_STATE_DIR` environment variable.
|
|
178
|
+
|
|
188
179
|
## JSON Schemas
|
|
189
180
|
|
|
190
181
|
See templates/ directory:
|
|
@@ -194,11 +185,18 @@ See templates/ directory:
|
|
|
194
185
|
|
|
195
186
|
## Resource References
|
|
196
187
|
|
|
197
|
-
|
|
198
|
-
-
|
|
188
|
+
**Prompt Templates** (templates/prompts/):
|
|
189
|
+
- [shared_enums.md](templates/prompts/shared_enums.md) - Topics, CEFR levels, styles, badges
|
|
190
|
+
- [output_rules.md](templates/prompts/output_rules.md) - JSON/markdown formatting rules
|
|
191
|
+
- [keypoint_generation.md](templates/prompts/keypoint_generation.md) - Knowledge point generation
|
|
192
|
+
- [quiz_generation.md](templates/prompts/quiz_generation.md) - Quiz generation
|
|
193
|
+
- [display_guide.md](templates/prompts/display_guide.md) - Emoji and formatting guide
|
|
194
|
+
- [initialization.md](templates/prompts/initialization.md) - Onboarding flow
|
|
195
|
+
- [responses.md](templates/prompts/responses.md) - Response templates
|
|
199
196
|
|
|
200
|
-
|
|
201
|
-
-
|
|
197
|
+
**Other Resources:**
|
|
198
|
+
- [references/resources.md](references/resources.md) - Themed English learning resources
|
|
199
|
+
- [templates/prompt_templates.md](templates/prompt_templates.md) - Prompt template index
|
|
202
200
|
|
|
203
201
|
## Examples
|
|
204
202
|
|
|
@@ -250,32 +248,15 @@ The bot recognizes these natural language commands:
|
|
|
250
248
|
|
|
251
249
|
## Initialization Flow
|
|
252
250
|
|
|
253
|
-
|
|
251
|
+
> See [templates/prompts/initialization.md](templates/prompts/initialization.md) for detailed onboarding templates.
|
|
254
252
|
|
|
255
|
-
|
|
256
|
-
Step 0: Welcome → User replies "start"
|
|
257
|
-
Step 1: Select CEFR Level (A1-C2)
|
|
258
|
-
Step 2: Select Topic Interests (movies/news/gaming/sports/workplace/social/daily_life)
|
|
259
|
-
Step 3: Select Tutor Style (humorous/rigorous/casual/professional)
|
|
260
|
-
Step 4: Select Oral/Written Ratio (0-100% oral)
|
|
261
|
-
Step 5: Configure Schedule (keypoint time, quiz time) - Quiz must be later than keypoint
|
|
262
|
-
Step 6: Confirm Configuration → Set initialized=true + Create cron jobs
|
|
263
|
-
```
|
|
253
|
+
6-step onboarding: Welcome → CEFR Level → Topic Interests → Tutor Style → Oral/Written Ratio → Schedule → Confirm
|
|
264
254
|
|
|
265
|
-
**Step 6 Completion
|
|
266
|
-
When user confirms with "yes":
|
|
267
|
-
1. Set `initialized=true` via `state_manager.py`
|
|
268
|
-
2. Create cron jobs for keypoint and quiz push times:
|
|
269
|
-
```bash
|
|
270
|
-
# Parse schedule from state.json
|
|
271
|
-
# Keypoint job: {minute} {hour} * * * openclaw system event --text "Use eng-lang-tutor skill. Push today's keypoint." --mode now
|
|
272
|
-
# Quiz job: {minute} {hour} * * * openclaw system event --text "Use eng-lang-tutor skill. Push today's quiz invitation." --mode now
|
|
273
|
-
```
|
|
274
|
-
3. Log the completion event
|
|
255
|
+
**Step 6 Completion:** Set `initialized=true` + Create cron jobs for keypoint/quiz push times.
|
|
275
256
|
|
|
276
257
|
**State Fields:**
|
|
277
258
|
- `initialized`: Boolean - Whether user completed onboarding
|
|
278
|
-
- `onboarding_step`: Integer (0-6) - Current step
|
|
259
|
+
- `onboarding_step`: Integer (0-6) - Current step
|
|
279
260
|
|
|
280
261
|
---
|
|
281
262
|
|
|
@@ -283,53 +264,93 @@ When user confirms with "yes":
|
|
|
283
264
|
|
|
284
265
|
> **TIMEZONE AWARENESS:** All "today" date checks should use `state.json schedule.timezone` (default: Asia/Shanghai) to ensure consistent behavior across server locations. File paths like `daily/2026-02-21/` are timezone-specific.
|
|
285
266
|
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## ⛔ MANDATORY BASH COMMANDS - READ THIS FIRST ⛔
|
|
270
|
+
|
|
271
|
+
**When generating content via LLM, you MUST execute bash commands to persist data to disk.**
|
|
272
|
+
|
|
273
|
+
### After Keypoint Generation (MANDATORY)
|
|
274
|
+
```
|
|
275
|
+
Step 1: LLM generates keypoint JSON
|
|
276
|
+
Step 2: ⛔ EXECUTE THIS BASH COMMAND (do NOT skip):
|
|
277
|
+
python3 scripts/state_manager.py save_daily --content-type keypoint --content '<ESCAPED_JSON>'
|
|
278
|
+
Step 3: ⛔ EXECUTE THIS BASH COMMAND (do NOT skip):
|
|
279
|
+
python3 scripts/state_manager.py record_view
|
|
280
|
+
Step 4: Display formatted content to user
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### After Quiz Generation (MANDATORY)
|
|
284
|
+
```
|
|
285
|
+
Step 1: LLM generates quiz JSON
|
|
286
|
+
Step 2: ⛔ EXECUTE THIS BASH COMMAND (do NOT skip):
|
|
287
|
+
python3 scripts/state_manager.py save_daily --content-type quiz --content '<ESCAPED_JSON>'
|
|
288
|
+
Step 3: Present quiz questions to user
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**JSON Escaping Rules:**
|
|
292
|
+
- Wrap content in single quotes: `'{"key": "value"}'`
|
|
293
|
+
- Escape internal single quotes: `'` → `'\''`
|
|
294
|
+
- Example: `'{"title": "It'\''s a test"}'`
|
|
295
|
+
|
|
296
|
+
**⛔ FAILURE TO EXECUTE BASH COMMANDS = DATA LOSS ⛔**
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
286
300
|
### Quiz Already Completed
|
|
287
301
|
```
|
|
288
302
|
User: "quiz"
|
|
289
303
|
Bot checks: completion_status.quiz_completed_date == today?
|
|
290
304
|
→ YES: "You've already completed today's quiz! 🎉 Score: X/Y"
|
|
291
|
-
→ NO: Check quiz.json exists (
|
|
305
|
+
→ NO: Check quiz.json exists (~/.openclaw/state/eng-lang-tutor/daily/YYYY-MM-DD/quiz.json) and quiz.generated == true?
|
|
292
306
|
→ YES: Load quiz and present questions
|
|
293
|
-
→ NO:
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
307
|
+
→ NO:
|
|
308
|
+
1. Check if keypoint.json exists for today
|
|
309
|
+
→ If NO: Generate keypoint via LLM first
|
|
310
|
+
→ ⛔ EXECUTE: python3 scripts/state_manager.py save_daily --content-type keypoint --content '<ESCAPED_JSON>'
|
|
311
|
+
2. Generate quiz via LLM
|
|
312
|
+
3. Set generated=true in the JSON content
|
|
313
|
+
4. ⛔ EXECUTE: python3 scripts/state_manager.py save_daily --content-type quiz --content '<ESCAPED_JSON>'
|
|
314
|
+
5. Present questions to user
|
|
297
315
|
```
|
|
298
316
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
317
|
+
**⛔ CRITICAL: You MUST execute bash commands to save BEFORE presenting to user.**
|
|
318
|
+
|
|
319
|
+
### Manual Quiz Before Keypoint Push
|
|
320
|
+
```
|
|
321
|
+
User manually requests quiz before scheduled keypoint push time
|
|
322
|
+
Bot checks: Does keypoint.json exist for today?
|
|
323
|
+
→ NO:
|
|
324
|
+
1. IMMEDIATELY generate keypoint via LLM (do NOT say "will notify later")
|
|
325
|
+
2. ⛔ EXECUTE: python3 scripts/state_manager.py save_daily --content-type keypoint --content '<ESCAPED_JSON>'
|
|
326
|
+
3. Generate quiz via LLM
|
|
327
|
+
4. ⛔ EXECUTE: python3 scripts/state_manager.py save_daily --content-type quiz --content '<ESCAPED_JSON>'
|
|
328
|
+
5. Present quiz questions to user
|
|
329
|
+
→ All in ONE response - user should receive quiz immediately
|
|
330
|
+
→ YES: Proceed with quiz generation normally (see Quiz Already Completed section)
|
|
331
|
+
|
|
332
|
+
This ensures learning sequence is preserved even for early learners.
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
**⛔ CRITICAL: NEVER tell user "will generate later and notify" - always generate immediately.**
|
|
336
|
+
**⛔ CRITICAL: You MUST execute the bash save commands BEFORE presenting content to user.**
|
|
305
337
|
|
|
306
338
|
### Keypoint Query
|
|
307
339
|
```
|
|
308
340
|
User: "keypoint" or "知识点" or Cron Push
|
|
309
|
-
Bot checks: Does keypoint.json exist for today (
|
|
310
|
-
→ NO:
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
341
|
+
Bot checks: Does keypoint.json exist for today (~/.openclaw/state/eng-lang-tutor/daily/YYYY-MM-DD/keypoint.json)?
|
|
342
|
+
→ NO:
|
|
343
|
+
1. Generate new keypoint via LLM
|
|
344
|
+
2. Set generated=true in the JSON content
|
|
345
|
+
3. ⛔ EXECUTE: python3 scripts/state_manager.py save_daily --content-type keypoint --content '<ESCAPED_JSON>'
|
|
346
|
+
4. ⛔ EXECUTE: python3 scripts/state_manager.py record_view
|
|
347
|
+
5. Display formatted content to user
|
|
315
348
|
→ YES: Check keypoint.generated
|
|
316
|
-
→ TRUE:
|
|
317
|
-
→ FALSE:
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
1. After LLM generation, MUST update keypoint JSON with `"generated": true` to prevent re-generation
|
|
322
|
-
2. MUST save via bash command:
|
|
323
|
-
```bash
|
|
324
|
-
python3 scripts/state_manager.py save_daily --content-type keypoint --content '<ESCAPED_JSON>'
|
|
325
|
-
```
|
|
326
|
-
3. MUST record view after displaying:
|
|
327
|
-
```bash
|
|
328
|
-
python3 scripts/state_manager.py record_view
|
|
329
|
-
```
|
|
330
|
-
4. JSON content must be properly escaped:
|
|
331
|
-
- Wrap in single quotes
|
|
332
|
-
- Escape internal single quotes: `'` → `'\''`
|
|
349
|
+
→ TRUE: ⛔ EXECUTE: python3 scripts/state_manager.py record_view, then display to user
|
|
350
|
+
→ FALSE: Follow steps 1-5 above
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
**⛔ CRITICAL: You MUST execute bash commands to save BEFORE displaying to user.**
|
|
333
354
|
|
|
334
355
|
**Display Fields (from keypoint.json `display` object):**
|
|
335
356
|
|
|
@@ -352,7 +373,7 @@ Bot checks: Does keypoint.json exist for today (data/daily/YYYY-MM-DD/keypoint.j
|
|
|
352
373
|
### Keypoint History
|
|
353
374
|
```
|
|
354
375
|
User: "keypoint history" or "知识点 历史"
|
|
355
|
-
Bot scans:
|
|
376
|
+
Bot scans: ~/.openclaw/state/eng-lang-tutor/daily/ directory for YYYY-MM-DD/keypoint.json files
|
|
356
377
|
→ NO files found: "📚 No history yet. Start learning with 'keypoint' today!"
|
|
357
378
|
→ YES: List keypoints (most recent first), max 10 entries:
|
|
358
379
|
- {date}: {title/topic} (e.g., "2026-02-20: Touch Base - 工作沟通")
|
|
@@ -42,7 +42,8 @@ git clone https://github.com/rookiestar/eng-lang-tutor.git
|
|
|
42
42
|
├── templates/ # JSON Schema
|
|
43
43
|
├── references/ # 参考资源
|
|
44
44
|
├── examples/ # 示例文件
|
|
45
|
-
└──
|
|
45
|
+
└── (数据存储在外部目录)
|
|
46
|
+
~/.openclaw/state/eng-lang-tutor/ # 运行时数据(自动创建)
|
|
46
47
|
```
|
|
47
48
|
|
|
48
49
|
### 2.3 验证 Skill 加载
|
|
@@ -142,12 +143,14 @@ openclaw config set model.api_key YOUR_API_KEY
|
|
|
142
143
|
|
|
143
144
|
### 5.3 数据持久化
|
|
144
145
|
|
|
145
|
-
|
|
146
|
+
数据存储在 `~/.openclaw/state/eng-lang-tutor/` 目录,确保有正确的写入权限:
|
|
146
147
|
|
|
147
148
|
```bash
|
|
148
|
-
chmod -R 755 ~/.openclaw/
|
|
149
|
+
chmod -R 755 ~/.openclaw/state/eng-lang-tutor/
|
|
149
150
|
```
|
|
150
151
|
|
|
152
|
+
可通过环境变量 `OPENCLAW_STATE_DIR` 自定义数据目录。
|
|
153
|
+
|
|
151
154
|
## 6. 故障排查
|
|
152
155
|
|
|
153
156
|
### 6.1 Skill 未加载
|
|
@@ -208,7 +211,7 @@ python3 state_manager.py --show
|
|
|
208
211
|
┌─────────────────────────────────────────────────────────┐
|
|
209
212
|
│ eng-lang-tutor Skill │
|
|
210
213
|
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
211
|
-
│ │ SKILL.md │ │ scripts/ │ │
|
|
214
|
+
│ │ SKILL.md │ │ scripts/ │ │ ~/.openclaw │ │
|
|
212
215
|
│ │ (技能描述) │ │ (Python代码) │ │ (状态存储) │ │
|
|
213
216
|
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
|
214
217
|
└─────────────────────────────────────────────────────────┘
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|