# 克隆仓库
git clone https://github.com/MoonshotAI/kimi-cli.git
cd kimi-cli
# 初始化环境
make prepare
# 常用命令
uv run kimi # 运行
make format # 格式化
make check # 检查
make test # 测试
make build # 构建
日志调试:
from kimi_cli.utils.logging import logger
logger.debug("Detailed info")
logger.info("General info")
Wire 事件追踪:
async for msg in soul.run("test", cancel_event):
print(f"[{type(msg).__name__}] {msg}")
@pytest.mark.asyncio
async def test_context_append():
context = Context(Path(f.name))
message = Message(role="user", content=[TextPart(text="Hello")])
await context.append_message(message)
assert len(context.history) == 1
asyncio.gather()aiofiles 进行文件 I/OSecretStr 保护┌─────────────────────────────────────────────────────────────┐
│ 控制平面 (Control Plane) │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ Scheduler │ │ State Store│ │ Monitoring │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ 执行平面 (Execution Plane) │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ Agent Pod │ │ Agent Pod │ │ Agent Pod │ │
│ │ ┌─────────┐ │ │ ┌─────────┐ │ │ ┌─────────┐ │ │
│ │ │ Soul │ │ │ │ Soul │ │ │ │ Soul │ │ │
│ │ │ Context │ │ │ │ Context │ │ │ │ Context │ │ │
│ │ └─────────┘ │ │ └─────────┘ │ │ └─────────┘ │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
层次化记忆结构:
代理组织模式:
《Kimi Code CLI 详解》 是一部从设计思想到实现原理的深度技术解析作品,全书共10章:
代码仓库:https://github.com/MoonshotAI/kimi-cli
完整内容:所有章节已保存至 C:\GitHub\kimi-cli\book\ 目录
愿本书能为你带来启发和帮助,让我们一起探索 AI 辅助编程的无限可能!
感谢阅读,本系列完结。
还没有人回复