agent-loopslisted
Install: claude install-skill ArieGoldkin/claude-forge
# Agent Loops
Enable LLMs to reason, plan, and take autonomous actions.
## Key Decisions
| Parameter | Recommended | Notes |
|-----------|-------------|-------|
| Max steps | 5-15 | Higher for research, lower for actions with side effects |
| Temperature | 0.3-0.7 | Lower for deterministic tasks, higher for creative |
| Memory window | 10-20 messages | Summarize older context to avoid token overflow |
| Validation frequency | Every 3-5 steps | Self-check to prevent drift |
## Patterns
Choose based on task type:
- **ReAct** (Thought/Action/Observation loop) - Default for most tasks
- **Plan-and-Execute** - For multi-step tasks where upfront planning reduces errors
- **Self-Correction** - When output quality must be validated before returning
See [agent-workflow-template.ts](${CLAUDE_SKILL_DIR}/templates/agent-workflow-template.ts) for a complete TypeScript implementation.
### Karpathy Loop (Autonomous Iteration)
Metric-driven autonomous improvement loop. Establish baseline, then iterate: hypothesize, modify, evaluate, keep if improved, discard if regressed. Continue until budget exhausted or goal reached.
**Components**: mutable target + measurable metric + fixed budget + binary keep/discard
**Use cases**: performance optimization, coverage improvement, ML training, cost reduction
**Key constraint**: single metric with clear direction (minimize/maximize) removes ambiguity
**Safety**: git-based rollback, file allowlists, correctness gates, stuck detection
See `/experi