j4flmao/agent-skills/core-architectures
Claude Code and agent skill by j4flmao/agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Use this skill when the user says 'agent loop', 'perceive think act', 'ReAct vs plan-and-solve', 'agent keeps looping', 'agent self-reflection', 'Reflexion', 'agent termination condition'. Explains and implements the mechanics of a single agent's control loop: observation assembly, action selection, termination, re-planning, and reflection. Do NOT use for: overall agent design (ai/ai-agents), workflow pattern selection (ai/agentic-workflows), tool schemas (ai/ai-agents/tool-calling-principles), or memory stores (ai/ai-agents/memory-systems).
Install
npx vskill@latest install j4flmao/agent-skills/core-architecturesSKILL.md
Agent Core Loop
Purpose
Every agent reduces to a loop: build context from state, ask the model for the next action, execute it, record the observation, decide whether to stop. Reliability comes from the parts around the model call: how context is assembled, how actions are validated, how progress is measured, and when the loop terminates. This skill covers those mechanics and the trade-offs between ReAct, plan-and-solve, and reflection variants.
Agent Protocol
Trigger
"agent loop", "ReAct", "plan-and-solve", "re-planning", "self-reflection", "Reflexion", "agent stuck in a loop", "termination condition", "max iterations".
Input Context
- Current loop code or framework config.
- Typical task length and failure transcripts (where it loops, stalls, or stops early).
- Tool list with side-effect classification.
Output Artifact
Loop specification or patch: state object, step function, termination rules, reflection policy.
Response Format
Completion Criteria
- [ ] Success is a checkable predicate, not "model says done".
- [ ] Explicit caps and a no-progress detector.
- [ ] Actions validated before execution.
- [ ] Reflection uses an external signal (test result, error, evaluator), not introspection alone.
The Loop as a State Machine
Variants
| Variant | How it works | Strength | Weakness | |
|---|---|---|---|---|
| ReAct | Decide one action at a time from latest observation | Adapts to surprises | Drifts on long tasks; myopic | |
| Plan-and-solve | Write full plan, then execute in order | Coherent on long tasks | Brittle when a step fails | |
| Plan-execute-replan | Plan, execute one step, revise remaining plan | Coherent and adaptive | Extra LLM call per step | |
| Reflexion | After a failed attempt, write a verbal lesson; retry with lessons in context | Learns across attempts | Needs a reliable failure signal | |
| LLMCompiler-style | Plan a DAG of tool calls, run independent ones in parallel | Lower latency | Planning errors propagate |
Rule of thumb: start with ReAct for short tasks (< ~10 steps); add an explicit plan object once tasks get longer or drift appears; add reflection only when you have an automatic success test.
Reference Implementation (framework-agnostic)
Termination Rules
- Success predicate: tests pass, schema validates, the user-visible artifact exists. Never trust "I am done" alone.
- Hard caps: steps, tokens, wall clock, money.
- No-progress detector: repeated identical calls, repeated identical errors, or no state change for k steps.
- Escalation: on abort, return partial results plus the reason, and route to a human when the task matters.
Reflection Done Right
- Trigger on a concrete failure (test failure, exception, evaluator rejection).
- Feed the failure evidence, not just "try again".
- Store lessons as short imperative notes ("run migrations before tests"), cap how many are kept, and drop stale ones.
- Measure: a reflection step that does not raise the success rate on your eval set is pure cost.
Anti-Patterns
- Asking the model whether it succeeded instead of checking.
- Unlimited history: early constraints scroll out or get diluted; keep goal and plan pinned.
- Parsing free-text "Action:" lines when native tool calling is available.
- Retrying the same failing call with identical arguments.
- Planning once and never revising.
Checklist
- [ ] State object with goal, plan, observations, lessons, counters.
- [ ] Context assembly pins goal/plan; observations truncated and windowed.
- [ ] Unknown tools and invalid args returned as observations, not crashes.
- [ ] Duplicate-call and no-progress detection.
- [ ] Success predicate implemented in code.
- [ ] Abort path returns partial work and reason.
References
- Yao et al., "ReAct" (ICLR 2023); Shinn et al., "Reflexion" (NeurIPS 2023); Kim et al., "An LLM Compiler for Parallel Function Calling" (ICML 2024).
- Parent:
../SKILL.md; planning detail:../references/planning-strategies.md.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ai/ai-agents/core-architectures/SKILL.md
Popularity
- Repository stars
- 29
- Repository forks
- 1
- 7-day trend score
- 22
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/j4flmao/agent-skills/core-architectures)