episode-start
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEpisode Start
启动学习片段
Start a new learning episode in the self-learning memory system.
在自学习记忆系统中启动一个新的学习片段。
Purpose
目的
Create a new episode record with proper context for the memory backend to learn from execution patterns.
创建一条带有合适上下文的新片段记录,供记忆后端从执行模式中学习。
Steps
步骤
-
Understand the task: Parse the task description and identify:
- Task type (implementation, debugging, refactoring, testing)
- Domain (storage, patterns, retrieval, testing, etc.)
- Language context (Rust/Tokio/async patterns)
-
Prepare TaskContext: Ensure you have:
- : "rust"
language - : One of [storage, patterns, retrieval, embedding, testing, ci]
domain - : Array of relevant tags (e.g., ["turso", "async", "tokio"])
tags
-
Create episode: Call
SelfLearningMemory::start_episode(task_description, context)- Task description should be clear and concise (1-2 sentences)
- Include relevant context from the user's request
-
Store episode_id: Keep the episode ID for logging subsequent steps
-
Initialize step logging: Prepare to log execution steps with:
- Tool used
- Action taken
- Latency/tokens (if applicable)
- Success status
- Observations
-
理解任务:解析任务描述并确定:
- 任务类型(实现、调试、重构、测试)
- 领域(存储、模式、检索、测试等)
- 语言上下文(Rust/Tokio/异步模式)
-
准备TaskContext:确保你具备:
- :"rust"
language - :以下选项之一 [storage, patterns, retrieval, embedding, testing, ci]
domain - :相关标签数组(例如,["turso", "async", "tokio"])
tags
-
创建片段:调用
SelfLearningMemory::start_episode(task_description, context)- 任务描述应清晰简洁(1-2句话)
- 包含用户请求中的相关上下文
-
存储episode_id:保留片段ID以记录后续步骤
-
初始化步骤日志:准备记录执行步骤,包括:
- 使用的工具
- 执行的操作
- 延迟/令牌数(如适用)
- 成功状态
- 观察结果
Storage Requirements
存储要求
- Persist to Turso (durable storage)
- Cache in redb (fast access)
- Store context as JSON blob
- 持久化到Turso(持久存储)
- 在redb中缓存(快速访问)
- 将上下文存储为JSON blob
Example
示例
rust
let context = TaskContext {
language: "rust".to_string(),
domain: "storage".to_string(),
tags: vec!["turso".to_string(), "async".to_string()],
};
let episode_id = memory
.start_episode(
"Implement async batch pattern updates",
context
)
.await?;rust
let context = TaskContext {
language: "rust".to_string(),
domain: "storage".to_string(),
tags: vec!["turso".to_string(), "async".to_string()],
};
let episode_id = memory
.start_episode(
"Implement async batch pattern updates",
context
)
.await?;Notes
注意事项
- Always validate that both Turso and redb connections are healthy
- Use anyhow::Result for error handling
- Log any initialization failures with context
- 始终验证Turso和redb连接是否正常
- 使用anyhow::Result进行错误处理
- 记录任何带有上下文的初始化失败信息