一键导入
memory-construction
JOB-256 — blanket From impl, removing redundant Into impls, RwLock vs Mutex for memory.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
JOB-256 — blanket From impl, removing redundant Into impls, RwLock vs Mutex for memory.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | memory-construction |
| description | JOB-256 — blanket From impl, removing redundant Into impls, RwLock vs Mutex for memory. |
This 10-line block is copy-pasted across SimpleMemory, WindowBufferMemory, DummyMemory:
impl Into<Arc<Mutex<dyn BaseMemory>>> for SimpleMemory {
fn into(self) -> Arc<Mutex<dyn BaseMemory>> {
Arc::new(Mutex::new(self))
}
}
// repeated for DummyMemory, WindowBufferMemory
Also: Into<Arc<dyn BaseMemory>> (non-mutex) is implemented on all three but never used
by any chain or executor — it is dead API.
// Will replace the 6 manual impls (3 types × 2 variants)
impl<T: BaseMemory + Send + Sync + 'static> From<T> for Arc<Mutex<dyn BaseMemory>> {
fn from(mem: T) -> Self {
Arc::new(Mutex::new(mem))
}
}
Call sites using .into() will continue to work unchanged.
Until JOB-256 is merged, implement the conversions manually:
use std::sync::Arc;
use tokio::sync::Mutex;
use langchainx::schemas::memory::BaseMemory;
pub struct SlidingWindowMemory { /* ... */ }
impl BaseMemory for SlidingWindowMemory { /* ... */ }
// Required until blanket impl lands
impl Into<Arc<Mutex<dyn BaseMemory>>> for SlidingWindowMemory {
fn into(self) -> Arc<Mutex<dyn BaseMemory>> {
Arc::new(Mutex::new(self))
}
}
// DO NOT add Into<Arc<dyn BaseMemory>> — it is dead API
## Mutex vs RwLock
All memory uses tokio::sync::Mutex today. Memory is read far more often than written
(read on every plan() call, write only on Finish). RwLock would allow concurrent readers.
JOB-256 also evaluates switching to RwLock. Do not change this unilaterally — it is
part of the JOB-256 scope.
AgentExecutor, ChatAgent (ReAct), OpenAIToolsAgent, and the Agent trait.
JOB-251 — Why Arc<dyn LLM> over LLMClone, migration pattern, and correct LLM ownership model.
All Chain types — LLMChain, ConversationalChain, SequentialChain, StuffDocuments, ConversationalRetrievalQA, SqlDatabaseChain.
Trait conformance tests, property-based tests (proptest), fuzz targets, and boundary contracts for langchainx traits.
Core langchainx patterns — LLMChain, builder pattern, Chain trait, prompt macros, and basic invocation.
Constructing LLM backends (OpenAI, Claude, DeepSeek, Qwen, Ollama) and configuring CallOptions.