V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
Hamiltonxx
V2EX  ›  分享创造

用 Rust 学 Claude Code, 记录两周从零到发布的过程

  •  
  •   Hamiltonxx · 3 月 26 日 · 1623 次点击

    最近在做一个系列,用 Rust 实现 AI Agent ,边学边记录。
    博客在这里: https://blog.cirray.cn
    目前已经写了入门指南、国内使用三道门槛、RAG+MCP Server 等,还在持续更新。
    欢迎感兴趣的一起交流。

    第 1 条附言  ·  3 月 26 日
    Day 3 更新:让 Agent 真正能干活(工具分发)。之前的 agent 只会说话,现在能读文件、写文件、跑命令了。https://blog.cirray.cn
    第 2 条附言  ·  3 月 27 日
    Day 4 更新:让 Agent 先想后做,还能分身。之前的 agent 是个急性子,任务一来直接上手没有规划。今天让它学会拆解任务、派出子 agent 并行干活。https://blog.cirray.cn/posts/rust-agent-todo-subagent-2026-03-27/
    第 3 条附言  ·  3 月 29 日
    Day 5 更新:知识按需注入,上下文永不爆炸。S05 让 agent 自己决定「什么时候加载什么知识」,S06 让它在长对话里自动压缩历史。https://blog.cirray.cn/posts/rust-agent-skill-compact-2026-03-29/
    第 4 条附言  ·  3 小时 14 分钟前
    系列完结,补上后面几天的更新:

    Day 8:Agent 学会管任务——带依赖关系的 Task 系统,拓扑排序决定执行顺序。https://blog.cirray.cn/posts/rust-agent-task-system-2026-03-31/

    Day 9:Agent 不再傻等——tokio::spawn 后台跑任务,mpsc channel 完成后回报。https://blog.cirray.cn/posts/rust-agent-background-tasks-2026-04-03/

    Day 10:一个 agent 变成一支团队——主 agent 分发,多 teammate 并发各自跑 loop 。https://blog.cirray.cn/posts/rust-agent-teams-2026-04-04/

    Day 11:协议 + 自治——统一消息格式,teammate
    空闲时自动扫任务板、认领符合角色的任务,不用人派。https://blog.cirray.cn/posts/rust-agent-protocols-autonomous-2026-04-05/

    Day 12:两个 agent 把对方文件覆盖了,PathBuf + current_dir 三行解决隔离。s_full.rs 把全部 12
    个机制合进一个文件。https://blog.cirray.cn/posts/rust-agent-worktree-day12-2026-04-06/

    Day 13-14 收尾:代码写完了,仓库还不算 Rust 项目——docs 全是 Python 、README 还在教 pip install 。逐一替换,最后 find . -name "*.py"
    输出空行,GitHub 语言统计 Python 0%。https://blog.cirray.cn/posts/rust-agent-day13-14-python-zero-2026-04-07/
    第 5 条附言  ·  3 小时 12 分钟前
    完整的过程记录都在博客: https://blog.cirray.cn 可以随时评论

    Rust 源码在这里,感兴趣的欢迎点个 star ,有问题也可以开 issue: https://github.com/Hamiltonxx/learn-claude-code-rust
    10 条回复    2026-03-28 21:21:17 +08:00
    twofox
        1
    twofox  
       3 月 26 日
    js 、python 生态滚滚,我一个 Javaer 对 Java 的发展感到悲观。

    传统的编译型语言似乎都很难在 ai agent 的客户端分到一杯羹

    我自己写的项目也已经是用 ts 做全栈了
    Hamiltonxx
        2
    Hamiltonxx  
    OP
       3 月 26 日
    @twofox 我之前也是全栈牛马。但是代码能力现在越来越不重要了,被逼着往 Agent Harness 路上走哇
    twofox
        3
    twofox  
       3 月 26 日
    @Hamiltonxx 代码能力不重要,但是生态选择还是很重要的。
    Hamiltonxx
        4
    Hamiltonxx  
    OP
       3 月 26 日
    @twofox 终究都要被大模型碾平。感觉做的事情能有一部分人认可就不错了。
    fds
        5
    fds  
       3 月 26 日
    @twofox #1 哈哈,我就是特别讨厌 Java ,太啰嗦了。js py 平常要用,但也不是特别喜欢。go 不错。用 bun 写 ts 也不错。编译型语言目前 rust 挺火呀,有了 AI 可以直接写了,没完全学会也能用。
    Hamiltonxx
        6
    Hamiltonxx  
    OP
       3 月 26 日
    @fds 其实 rust 也蛮啰嗦的。但是很稳。写起来自己就能用。python, java 这些写的东西自己根本不会用
    blur1119
        7
    blur1119  
       3 月 26 日
    harness 确实重要
    Hamiltonxx
        8
    Hamiltonxx  
    OP
       3 月 26 日
    @blur1119 没办法,Claude Code 让人看到无限可能
    startisan
        9
    startisan  
       3 月 28 日
    blog 写的太棒了。

    learncc 网站有点小问题,右上角跳转 github 的链接还没改。
    Hamiltonxx
        10
    Hamiltonxx  
    OP
       3 月 28 日
    @startisan 感谢提醒,顺便把 s03 s04 的 doc 也改了。 今天没写 s05,休息调整下,明天再上
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   5577 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 08:57 · PVG 16:57 · LAX 01:57 · JFK 04:57
    ♥ Do have faith in what you're doing.