iCode Agent · 第一个任务

修复一个失败的测试。

了解 iCode Agent 工作方式的最快方法,是找一个小 bug。你给它目标;它负责调查、修改和验证。

1. 在你的项目中启动 iCode Agent

cd ~/my-project
icode-agent

2. 让它修复

在提示符中输入:

Fix the failing tests in this repository.

3. 看它工作

每一步你都能实时看到——工具调用及其输出的实时预览:

▸ read src/math.ts
✓ read src/math.ts
▸ bash bun test math.test.ts
✓ bash bun test math.test.ts      ← observes the failure
▸ edit src/math.ts                ← repairs the code
✓ edit src/math.ts
▸ bash bun test math.test.ts
✓ bash bun test math.test.ts      ← verifies: all tests pass

Fixed the add() function ... All tests pass.

对智能体来说,失败不是错误——而是信息。它会不断修复并重新验证,直到任务完成或需要你介入。

4. 保持掌控

  • 引导——在它工作时输入消息并按 Enter,它就会改变方向。
  • 排队——Alt+Enter 将后续消息排到当前任务之后。
  • 中断——Esc 中止;已排队的消息会返回编辑器。
  • 展开——Ctrl+O 显示完整的工具输出,而不是预览。

5. 更进一步

任务完成后,你的工作会被保存。退出后用 --continue 回来,或打开 /session 管理会话。