03. 核心模块对比:Crush vs Kimi Code CLI
3.1 Agent/Session/Message 三层模型
Crush 核心模型
Coordinator (协调 Agent、Session、Message、Tools)
↓
SessionAgent → Session → Message
Kimi Code CLI 核心模型
KimiCLI (编排 Runtime、Soul、Agent、Session)
↓
KimiSoul → Context → Message
3.2 Agent 实现对比
Crush: SessionAgent (Go)
type SessionAgent interface {
Run(context.Context, SessionAgentCall) (*fantasy.AgentResult, error)
SetModels(large Model, small Model)
SetTools(tools []fantasy.AgentTool)
SetSystemPrompt(systemPrompt string)
Cancel(sessionID string)
Summarize(context.Context, string, fantasy.ProviderOptions) error
}
Kimi Code CLI: KimiSoul (Python)
class KimiSoul:
async def run(self, user_input: str | list[ContentPart]):
await self._turn(user_input)
async def _agent_loop(self) -> TurnOutcome:
while True:
if self._context.token_count >= limit:
await self.compact_context()
step_outcome = await self._step()
3.3 Session/Context 对比
| 维度 | Crush (Session) | Kimi Code CLI (Context) |
|---|
| 存储 | SQLite | 文件JSON |
| 事件 | PubSub通知 | 无内置 |
| Token跟踪 | 精确 (LLM返回) | 估算 |
| 检查点 | 无 | 支持 |
| Cost | 跟踪 | 不跟踪 |
3.4 Tool 基础结构对比
Crush: fantasy.AgentTool
func NewBashTool(permissions, workingDir, shell, cfg) fantasy.AgentTool {
return fantasy.NewAgentTool("bash", description,
func(ctx context.Context, params BashParams) (ToolResponse, error) {
return executeBash(ctx, params)
})
}
Kimi Code CLI: CallableTool2
class Shell(CallableTool2[Params]):
name: str = "Shell"
params: type[Params] = Params
async def __call__(self, params: Params) -> ToolReturnValue:
if not await self._approval.request(...):
return ToolRejectedError()
return ToolOk(output=result.stdout)
3.5 Runtime/Coordinator 对比
| 维度 | Crush (Coordinator) | Kimi Code CLI (Runtime) |
|---|
| 摘要 | 内置方法 | Soul的compact_context |
| 时间旅行 | 不支持 | DenwaRenji |
| 子Agent | agent_tool | LaborMarket |
| 技能 | Skills系统 | skills字典 |