Real-world lessons from building with the Claude Agent SDK:
-
Manager vs Worker Separation - The conversational Claude should NEVER write implementation code. Create issues, let worker agents implement. This prevents scope creep and ensures all work is tracked.
-
Don't Remove Functionality - When adding features, expand existing code rather than replacing it. Easy to accidentally break things during "simplification."
-
Maintain Broad Perspective - Easy to get tunnel vision on one feature. Keep the whole system in mind.
-
Git Worktrees for Isolation - Workers operate in worktrees so failures don't affect main branch. Essential for autonomous operation.
-
Frequent Commits - Worker should commit after each significant change. Enables recovery and visibility.
-
Local Validation First - Run lint/typecheck/tests locally before pushing. Faster feedback than CI.
-
Handle API Rate Limits - GitHub API has rate limits. Worker needs backoff logic.
-
Tool Results Are Rich - Tool results can include system reminders and context. Parse carefully.
-
Context Windows Fill Up - Long conversations get compacted. Maintain external state (todo lists, issue descriptions) rather than relying on conversation memory.
-
Parallel Tool Calls - Use parallel tool calls when operations are independent. Significant speedup.
-
Subagent Spawning - Task tool spawns subagents for complex work. Each subagent is fresh context.
- GitHub Issues as source of truth for requirements
- Worker agent handling full PR lifecycle
- Claude GitHub integration for automated review
- Structured logging for debugging autonomous workers
- Error recovery when worker hits unexpected states
- Balancing autonomy with user oversight
- Managing context across long conversations
- Testing async/autonomous behaviors