Original Note

Solo Agent Harness

  • self_study_notes
  • Original Note
  • Updated: 2026-08-31T10:06:42+08:00
Source Collection
self_study_notes
Source Path
self_study_notes/harness/SoloAgent-SerialSession/solo-agent-harness.md
Type
Original Note
Updated At
2026-08-31T10:06:42+08:00

Solo Agent Harness

GitHub 仓库

https://github.com/yumf24/claude-quickstarts/tree/main/autonomous-coding

表格总结

Agent failure modes and solutions

Problem Initializer Agent Behavior Coding Agent Behavior
Claude declares victory on the entire project too early. Set up a feature list file: based on the input spec, set up a structured JSON file with a list of end-to-end feature descriptions. Read the feature list file at the beginning of a session. Choose a single feature to start working on.
Claude leaves the environment in a state with bugs or undocumented progress. An initial git repo and progress notes file is written. Start the session by reading the progress notes file and git commit logs, and run a basic test on the development server to catch any undocumented bugs. End the session by writing a git commit and progress update.
Claude marks features as done prematurely. Set up a feature list file. Self-verify all features. Only mark features as “passing” after careful testing.
Claude has to spend time figuring out how to run the app. Write an init.sh script that can run the development server. Start the session by reading init.sh.

正文

Agent's failure

  • First, the agent tended to try to do too much at once
  • A second failure mode would often occur later in a project. After some features had already been built, a later agent instance would look around, see that progress had been made, and declare the job done.

Two-part solution

  1. Initializer agent: The very first agent session uses a specialized prompt that asks the model to set up the initial environment: an init.sh script, a claude-progress.txt file that keeps a log of what agents have done, and an initial git commit that shows what files were added.
  2. Coding agent: Every subsequent session asks the model to make incremental progress, then leave structured updates ./init.sh 需要是一个确定性命令,并且保证脚本具有幂等性:重复执行不会破坏环境。 通过 claude-progress.txt和git history使得每一个fresh context window都能快速理解当前进度

prompt best practice

Environment management

Feature list

example

{
    "category": "functional",
    "description": "New chat button creates a fresh conversation",
    "steps": [
      "Navigate to main interface",
      "Click the 'New Chat' button",
      "Verify a new conversation is created",
      "Check that chat area shows welcome state",
      "Verify conversation appears in sidebar"
    ],
    "passes": false
  }

using JSON for this, as the model is less likely to inappropriately change or overwrite JSON files compared to Markdown files.

Incremental progress

两个重要要求:

  1. Ask the coding Agent to work on only one feature at a time
  2. Ask  the model leaves the environment in a clean state after making a code change(ask the model to commit its progress to git with descriptive commit messages and to write summaries of its progress in a progress file)

Testing

提供更加强大的测试能力,不局限在testing with unit test or curl commands.(例如提供computer use功能)

Getting up to speed

可以复用的Coding Agent起始prompt

1. Run `pwd` to see the directory you’re working in. You’ll only be able to edit files in this directory.
2. Read the git logs and progress files to get up to speed on what was recently worked on.
3. Read the features list file and choose the highest-priority feature that’s not yet done to work on.

推荐初始化命令

git status --short
git log --oneline --decorate -10
git diff --stat

分别回答:

  • 当前有没有未提交修改
  • 最近做了什么
  • 当前修改涉及哪些文件

注意: 上述机制针对的是串行的不同session,不能直接用于并行Agents开发

推荐的启动会话应该做的流程

1. 确认工作目录
2. 检查 git status
3. 阅读 progress 文件
4. 阅读最近 Git 提交
5. 查看功能列表
6. 启动项目
7. 执行核心 smoke test
8. 如果基线失败,先修复
9. 如果基线正常,选择一个新 feature
10. 实现、端到端测试、记录并提交

claude 日志

[Assistant] I'll start by getting my bearings and understanding the current state of the project.
[Tool Use] <bash - pwd>
[Tool Use] <read - claude-progress.txt>
[Tool Use] <read - feature_list.json>
[Assistant] Let me check the git log to see recent work.
[Tool Use] <bash - git log --oneline -20>
[Assistant] Now let me check if there's an init.sh script to restart the servers.
<Starts the development server>
[Assistant] Excellent! Now let me navigate to the application and verify that some fundamental features are still working.
<Tests basic functionality>
[Assistant] Based on my verification testing, I can see that the fundamental functionality is working well. The core chat features, theme switching, conversation loading, and error handling are all functioning correctly. Now let me review the tests.json file more comprehensively to understand what needs to be implemented next.
<Starts work on a new feature>

Evidence-backed relations

Source Note · Same Topic

切换到中文