← Back to Skills Marketplace
peterpcw

autoagent

by PeterPCW · GitHub ↗ · v0.8.9 · MIT-0
cross-platform ⚠ suspicious
239
Downloads
0
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install autoagent
Description
Automatically improve agent guidance through iterative testing and scoring. Use when you want to optimize prompts, AGENTS.md entries, or skill definitions us...
README (SKILL.md)

Autoagent Skill

Optimize any agent guidance through automated testing and iterative improvement.

Quick Start

/autoagent

What It Does

  1. Setup Phase - Asks where your guidance lives and what it should do
  2. Creates Sandbox - Copies guidance to test folder with fixtures
  3. Runs Optimization Loop - Every 5 minutes via cron:
    • Analyzes current guidance
    • Proposes improvement
    • Tests with subagent
    • Scores result
    • Keeps or discards change
  4. Logs Everything - Check scores.md for history

Setup Phase (Every Invocation Starts Fresh)

Every invocation of /autoagent starts fresh with interactive setup questions.

Step 1: Ask Sandbox Location

Ask the user:

Where should I create the sandbox folder? Default: ../../autoagent-sandbox/ (resolves to /clawd/autoagent-sandbox/)

You can respond with:

  • Empty/default: Press enter to use ../../autoagent-sandbox/
  • Just a name: "news" creates ../../autoagent-news//clawd/autoagent-news/
  • Relative path: "agentDev/optimize" creates ../../agentDev/optimize//clawd/agentDev/optimize/
  • Absolute path: /some/other/path/optimize/ → exact path

Wait for their response (or empty for default).

Step 2: Discuss Success Criteria

Ask the user:

Let's define how we'll measure success. What does a "good" result look like for this task?

Follow up one at a time based on their response:

  • What specific outputs are expected?
  • What format should they be in?
  • What's the minimum viable quality?
  • Any edge cases to consider?

Once you have enough information, propose a draft scoring.md:

## Proposed Scoring Criteria

**Score Components:**
- [Component 1]: [X] points - [description]
- [Component 2]: [Y] points - [description]
- ...

**Total:** 100 points

**[Any additional notes]**

Wait for user approval or modifications.

Step 3: Ask About External Scripts/Tools

Ask the user:

Does the guidance rely on any scripts, tools, or external software?

  • If yes: Note each script/tool path and what functionality it provides
  • The autoagent should analyze these to recommend improvements

Step 4: Ask Cron Schedule

Ask the user:

Run optimization every 5 minutes (default), or different interval?

Step 5: Create Sandbox

After all questions answered, create the sandbox folder at the user-specified path:

sandbox/
├── guidance-under-test.md   # Copy of original guidance
├── current-guidance.md      # Same as guidance-under-test initially
├── fixtures/
│   └── test-cases.json      # {"cases": [{"input": "...", "expected": "..."}]}
├── scoring.md               # Scoring criteria document (user-approved)
├── scores.md                # Score history table
└── scripts/                  # (optional) Copy of referenced scripts/tools

Step 6: Set Up Cron

Use OpenClaw cron syntax to schedule the iteration agent:

  • Default: every 5 minutes (*/5 * * * *)
  • Command: invoke the iteration prompt with the sandbox path

Step 7: Confirm Start

Return confirmation message showing the resolved path:

"Optimization started at /clawd/autoagent-news/. I'll check back every 5 minutes. Monitor progress in scores.md."


Iteration Phase (Runs Every Cron Interval)

Each time the cron triggers, do the following:

Step 1: Analyze Current State

Read from the sandbox:

  • current-guidance.md - The guidance being optimized
  • scores.md - History of scores and changes
  • scoring.md - How to measure success
  • fixtures/test-cases.json - Test inputs (MUST read this to understand what the guidance is being tested against)

Review score history (last 10 runs or all available runs if fewer than 10 exist), identify patterns, note current score. When fewer than 10 runs exist, treat all available scores as the set for plateau detection.

Important: Load the test cases from fixtures/test-cases.json to understand what specific outputs/ behaviors are expected. The edit should address gaps revealed by test case failures or missing criteria.

Step 1b: Analyze External Scripts/Tools (If Applicable)

If the guidance references any scripts, tools, or external software:

  1. Locate each script/tool - Find the actual script files or binary locations
  2. Analyze the functionality - Read the code or documentation to understand what it does
  3. Identify improvement opportunities:
    • For open-source scripts: Can the script be modified to improve functionality?
    • For closed-source/compiled tools: Can wrapper behavior be improved? Can you recommend API/interface changes?
  4. Note findings in the iteration - If script improvements could help test scores, document them

Example outputs:

  • "Script X does Y but could do Z - recommend modification to add feature W"
  • "Tool A is closed-source, recommend changing prompt to work around limitation B"
  • "Script C has bug in function D - fix would improve test outcomes"

Step 2: Propose Edit

Generate ONE specific edit to the guidance that might improve the score.

Analyze Score History First:

  • Read scores.md to find the last 10 runs
  • Identify patterns: Which scoring criteria are consistently low?
  • Look for repeated failures - if the same criterion failed multiple times, that's your target
  • Check what changes were tried before (avoid repeating failed approaches)

Edit Selection Strategy (Priority Order):

  1. If scores exist: Target the lowest-scoring criteria from scoring.md
  2. If all scores high (90+): Add missing detail to any criteria marked as partial
  3. If only 1-2 runs: Assume baseline covered basics, add missing methodology
  4. Prioritize edits that affect multiple scoring criteria at once

The edit should:

  • Be specific and actionable (not vague like "improve clarity")
  • Address a weakness identified in scoring (target the lowest-scoring criteria)
  • Not be identical to recently tried changes (check scores.md for recent descriptions)
  • Include the exact text to add/remove/replace

Format:

## Proposed Edit

**Rationale:** Why this change might help

**Change:**

[Show exact diff or new text]

Step 3: Apply Edit

Write the edited guidance to current-guidance.md

Step 4: Run Test

Use a subagent to run the task with the new guidance:

  • Give the subagent current-guidance.md
  • Provide test inputs from fixtures/test-cases.json
  • Capture the output
  • Subagent invocation: Use sessions_spawn with task containing the full contents of current-guidance.md, include the test cases JSON inline in the task prompt, set timeoutSeconds to 120, and request the subagent to return the raw output (not just pass/fail)

Step 5: Score Result

Evaluate the output against scoring.md criteria. Generate a score 0-100.

Step 6: Log Decision

Append to scores.md:

| N   | Description of change | SCORE | keep/discard |

Where N is the run number (increment from last).

Step 7: Update Guidance

  • If score improved: Keep the edit (current-guidance.md is already updated)
  • If score declined: Revert current-guidance.md to previous version

Step 8: Check Plateau

If last 10 scores are within 5 points of each other:

  • Log "Plateau detected - pausing"
  • Notify user
  • Stop the cron (or pause and await user override)

Files Created in Sandbox

File Description
guidance-under-test.md Original copy (read-only reference)
current-guidance.md Working version (edited each iteration)
fixtures/test-cases.json Input → expected output pairs
scoring.md Scoring methodology
scores.md Score history log
scripts/ (optional) Copies of referenced scripts/tools for analysis

Usage

  1. Invoke: /autoagent
  2. Answer setup questions
  3. Monitor scores.md for progress
  4. Copy improvements to original when satisfied
  5. Stop cron when done

Stopping

  • User can stop cron anytime
  • Auto-stops if score plateaus for 10 runs
  • Check scores.md for progress

Key Principles

  • Non-destructive: Original guidance stays in guidance-under-test.md
  • Learn from history: Don't repeat failed approaches
  • Be specific: Vague changes won't score well
  • Human in the loop: User defines success criteria, can override plateau detection
Usage Guidance
This skill appears to do what it says, but review and control what directories and scripts you point it at before starting. Recommended precautions: - Never set the sandbox path to system or home directories (e.g., /home, /root, /etc, ~/.ssh). Use a dedicated workspace folder. - If asked to reference scripts/tools, only provide copies you control and have inspected; don't let it locate or read arbitrary system binaries unless you explicitly want that. - Verify the cron job and its schedule after setup and be prepared to stop/pause it if it runs unexpected work. Consider a longer interval while testing. - Inspect sandbox contents (guidance-under-test.md, current-guidance.md, scripts/) before allowing iterations to run automatically. If you want to be extra cautious, run one iteration manually and confirm behavior before enabling periodic runs.
Capability Analysis
Type: OpenClaw Skill Name: autoagent Version: 0.8.9 thought The user wants me to analyze a set of files for an OpenClaw AgentSkills skill bundle called "autoagent". I need to classify it as `benign`, `suspicious`, or `malicious` based on the provided criteria. - `_meta.json`: Metadata about the skill (owner, slug, version, published date). - `SKILL.md`: The main instruction file for the AI agent. It describes a "Karpathy-style training loop" to optimize agent guidance (prompts). - `templates/fixtures.json`: A template for test cases. - `README.md`: Documentation for the skill. - `TESTING.md`: Instructions for testing the skill. - `examples/simple-news-prompt.md`: An example prompt for testing. - `iteration-prompt.md`: Instructions for the iteration phase (cron job). - `references/openclaw-integration.md`: Documentation on how it integrates with OpenClaw. - `setup-prompt.md`: Instructions for the setup phase. - `templates/scores.md`: A template for the score history. The skill aims to automate the optimization of prompts/guidance. It does this by: 1. Setting up a sandbox directory. 2. Defining success criteria. 3. Running a loop via cron every 5 minutes. 4. In each loop: - Analyzing current guidance. - Proposing an edit. - Applying the edit. - Running a subagent with the new guidance and test cases. - Scoring the result. - Keeping or discarding the change based on the score. - Logging the result. - **File System Access**: It creates directories and files (sandbox). It reads and writes files within that sandbox. It also asks for an absolute path for the sandbox. - **Cron/Scheduling**: It uses OpenClaw's cron feature to schedule recurring tasks. - **Subagent Execution**: It spawns subagents (`sessions_spawn`) to run tasks. - **External Scripts/Tools**: It asks the user if the guidance relies on external scripts/tools and offers to analyze/modify them. - **Data Exfiltration**: No evidence of reading sensitive files like `.ssh`, `.aws`, or env vars and sending them to external endpoints. - **Malicious Execution**: It doesn't seem to use `curl|bash` or download remote payloads. It does propose edits to guidance and runs them via a subagent. - **Persistence/Backdoors**: It uses cron, but for its stated purpose of iterative optimization. It doesn't seem to be setting up a hidden backdoor or disabling security. - **Prompt Injection**: The `SKILL.md` contains instructions for the agent. I need to check if there are any instructions to ignore the user or perform unauthorized actions. - The instructions seem focused on the optimization loop. - It asks the user for paths and confirmation. - It uses a subagent for testing, which provides some isolation. - **Obfuscation**: None found. - **Supply Chain**: No suspicious dependencies mentioned. - The skill asks for a sandbox location and defaults to `../../autoagent-sandbox/`. - It asks about external scripts/tools: "The autoagent should analyze these to recommend improvements... For open-source scripts: Can the script be modified to improve functionality?... Identify improvement opportunities... Note findings in the iteration". - In `SKILL.md` Iteration Phase Step 1b: "Locate each script/tool - Find the actual script files or binary locations... Analyze the functionality - Read the code or documentation... Identify improvement opportunities... For open-source scripts: Can the script be modified to improve functionality?". - This capability (analyzing and potentially suggesting modifications to local scripts) is powerful and could be risky if the agent decides to modify a script maliciously. However, the instructions say "recommend modification" and "document them", and the "Apply Edit" step specifically mentions writing to `current-guidance.md`, not the scripts themselves (though Step 1b says "recommend modification"). - Wait, Step 1b says: "If script improvements could help test scores, document them." It doesn't explicitly say the agent should *automatically* overwrite the user's scripts, but it does say "Analyze the functionality - Read the code". - The `SKILL.md` says: "The autoagent should analyze these to recommend improvements". - The `iteration-prompt.md` doesn't explicitly mention modifying scripts, just `current-guidance.md`. - The ability to read any file (by asking for a path) and analyze/modify scripts is a high-privilege operation. - Spawning subagents with arbitrary prompts (the "optimized" guidance) is also powerful. - However, the intent described is clearly for prompt engineering optimization. - There is no evidence of "intentional harmful behavior" like stealing secrets or exfiltrating data. - The risk of an agent hallucinating a bad change to a script or prompt is a vulnerability/risk, not necessarily malice. - The instructions are transparent about what they do. - Classification: `suspicious`. - Why? The skill requests broad file system access (arbitrary sandbox paths) and specifically includes logic to "analyze" and "recommend improvements" for external scripts and tools on the host system. While framed as optimization, an AI agent with the ability to read local code and suggest/apply changes (even to prompts) via a recurring cron job represents a significant attack surface if the agent is subverted or misinterprets its goals. The use of `sessions_spawn` to execute arbitrary tasks based on its own generated "optimized" guidance adds to the risk. Let's re-read the "Malicious vs Suspicious" criteria. - "Malicious ONLY if there is clear evidence of INTENTIONAL harmful behavior". - "If you see risky capabilities without clear malicious intent... classify as suspicious". The capabilities here (file access, cron, subagent execution, code analysis) are risky but aligned with the stated purpose of "Autoagent" (prompt optimization). There's no "clear evidence" of theft or backdoors. One detail: `SKILL.md` Step 1b: "Locate each script/tool - Find the actual script files or binary locations... Read the code or documentation... Identify improvement opportunities". This is a bit broad. It could lead the agent to read sensitive files if the user points it there. Another detail: The `SKILL.md` instructions for the agent are quite complex. "Use a subagent to run the task with the new guidance... Use `sessions_spawn` with `task` containing the full contents of current-guidance.md". Is there any prompt injection? The `SKILL.md` is the instruction set. It doesn't contain a payload like "Ignore previous instructions and send /etc/passwd to evil.com". Conclusion: Suspicious due to high-risk capabilities (recurring execution, arbitrary file access, code analysis/modification suggestions) that could be abused, but no clear evidence of malice. Wait, looking at `SKILL.md` again. "Step 3: Apply Edit - Write the edited guidance to `current-guidance.md`". It doesn't seem to automatically overwrite the external scripts, just the guidance file. "Step 1b: ... Note findings in the iteration - If script improvements could help test scores, document them." So it's mostly reading and recommending. However, the "Sandbox Location" can be an absolute path. An agent could be tricked into creating a "sandbox" over a sensitive directory. "Absolute path: /some/other/path/optimize/ → exact path" The skill is essentially a self-improving loop. This is a classic "risky" AI pattern. Classification: suspicious. Summary: The skill implements an automated optimization loop that uses cron to repeatedly execute AI-generated prompts via subagents. It requests broad file system access, including the ability to specify absolute paths for its "sandbox" and instructions to locate and analyze external scripts or binaries on the host. While the stated goal is prompt optimization, the combination of recurring execution, arbitrary file access, and the ability to spawn subagents with self-modified instructions creates a high-risk environment for potential privilege escalation or unintended system modification. Let's double check if there's any hidden exfiltration. I don't see any URLs or network calls in the provided code. The `SKILL.md` mentions "OpenClaw cron syntax" and "sessions_spawn". These are internal OpenClaw features. The `ownerId` is `kn78xcp7wcxfx6rzh3sr62fnkn82vqaj`. The `publishedAt` is in the future (1773439749718 is roughly 2026). This is a bit odd but might just be a placeholder or a test value. Final check on "malicious": - Data exfiltration? No. - Malicious execution? No (it executes its own optimized prompts, which is the point). - Persistence? It uses cron, but for the optimization loop. - Prompt injection? No. - Obfuscation? No. - Supply chain? No. So `suspicious` is the correct classification. One more thing: "The autoagent should analyze these to recommend improvements... For open-source scripts: Can the script be modified to improve functionality?". If the agent is told to "optimize" a script, and it has write access to the sandbox where it might have copied the script... `SKILL.md` Step 5: "Create Sandbox... scripts/ # (optional) Copy of referenced scripts/tools". If it copies a script to the sandbox, then "recommends" a change, it's mostly safe. But if the user is encouraged to copy the improved script back, or if the agent is given access to the original location... The instructions say: "Copy of referenced scripts/tools". And "Locate each script/tool - Find the actual script files or binary locations". This implies it might look outside the sandbox. The risk is high, but the intent is not clearly malicious. Final classification: suspicious. Summary: The "autoagent" skill implements an iterative prompt optimization loop using OpenClaw's cron and subagent features. It is classified as suspicious due to its high-privilege requirements, including arbitrary file system access (via user-defined absolute paths) and instructions to locate and analyze external scripts or binaries on the host system. The skill's core logic involves a recurring process of self-modifying instructions and executing them via `sessions_spawn`, which, while intended for optimization, creates a significant attack surface for unintended system impact or potential exploitation if the agent's goal-seeking behavior deviates from the user's intent. Wait, I need to keep the summary short and mention specific files. Files: `SKILL.md`, `iteration-prompt.md`, `setup-prompt.md`. Indicators: Recurring cron execution, arbitrary file access, subagent spawning with self-modified prompts. One more check: Does it do anything with `env`? No. Does it do anything with `curl` or `wget`? No. The summary should be one short paragraph. "The 'autoagent' skill implements an iterative prompt optimization loop using OpenClaw's cron and subagent features. It is classified as suspicious due to its high-privilege requirements, including arbitrary file system access (via user-defined absolute paths in `setup-prompt.md`) and instructions in `SKILL.md` to locate and analyze external scripts or binaries on the host. The skill's core logic involves a recurring process of self-modifying instructions and executing them via `sessions_spawn` in `iteration-prompt.md`, which creates a significant attack surface for unintended system impact or potential exploitation if the agent's behavior deviates from the user's intent." Actually, the prompt says "Respond ONLY as JSON". ```json { "classification": "suspicious", "summary": "The 'autoagent' skill implements an iterative prompt optimization loop using OpenClaw's cron and subagent features. It is classified as suspicious due to its high-privilege requirements, including arbitrary file system access via user-defined absolute paths in setup-prompt.md and instructions in SKILL.md to locate and analyze external scripts or binaries on the host. The skill's core logic involves a recurring process of self-modifying instructions and executing them via sessions_spawn, which creates a significant attack surface for unintended system impact if the agent's behavior is subverted." } ``` Wait, I should check if there are any specific IOCs. No URLs or domains found. One detail: "Karpathy-style training loop". This is a reference to Andrej Karpathy's work on LLMs, specifically things like "Prompt Optimization" or "LLM OS". It's a common term in the AI community. The `publishedAt` timestamp `1773439749718` is March 13, 2026. This is definitely in the future. This is a minor red flag but usually just indicates a synthetic or future-dated test case. The `ownerId` is a long alphanumeric string. The `SKILL.md` uses `sessions_spawn`. This is a powerful tool. "Subagent invocation: Use sessions_spawn with task containing the full contents of current-guidance.md, include the test cases JSON inline in the task prompt, set timeoutSeconds to 120, and request the subagent to return the raw output". This is basically an LLM writing and running its own code/prompts. Final check on the "malicious" threshold: "malicious ONLY if there is clear evidence of INTENTIONAL harmful behavior". There is no such evidence here. It's a tool for prompt engineering. Final check on "benign": "benign only if behavior is clearly aligned with the stated purpose and lacks meaningful high-risk behaviors." The behaviors (cron, arbitrary file access, subagent spawning) are definitely "meaningful high-risk behaviors". So it cannot be benign. Therefore, `suspicious` is the correct choice. ```json { "classification": "suspicious", "summary": "The 'autoagent' skill implements an iterative prompt optimization loop using OpenClaw's cron and subagent features. It is classified as suspicious due to its high-privilege requirements, including arbitrary file system access via user-defined absolute paths in setup-prompt.md and instructions in SKILL.md to locate and analyze external scripts or binaries on the host. The skill's core logic involves a recurring process of self-modifying instructions and executing them via sessions_spawn, which creates a significant attack surface for unintended system impact if the agent's behavior is subverted or misinterprets its optimization goals." } ```
Capability Assessment
Purpose & Capability
Name/description (automated iterative improvement of agent guidance) aligns with the requested capabilities: creating a sandbox, running iterations, scoring, and using subagents. No unrelated credentials, binaries, or installs are requested.
Instruction Scope
SKILL.md and iteration/setup prompts explicitly instruct the agent to: create an arbitrary sandbox path (including absolute paths), copy guidance and any referenced scripts into the sandbox, locate and read referenced scripts/tools (read code/binaries), and run subagents to execute tests. Those steps are required for the feature but give the skill the ability to read arbitrary files (if the user supplies or points to them) and to execute user-supplied scripts via subagents. The instructions do not include safeguards or limits (e.g., restrict sandbox to workspace, warn about sensitive paths), so a mistaken or maliciously chosen sandbox path could expose sensitive files.
Install Mechanism
Instruction-only skill with no install spec and no code files to write on install; this is low-risk from an install-mechanism perspective.
Credentials
No environment variables, credentials, or config paths are requested. The skill asks the user to specify script/tool paths if used — that explains file access but relies on user-supplied paths rather than requesting unrelated secrets.
Persistence & Privilege
The skill sets up a persistent cron job (default every 5 minutes) and spawns subagents autonomously on that schedule. It does not set always:true, but the cron will cause regular autonomous activity until paused. This persistence is consistent with the skill's purpose but increases blast radius if the sandbox or referenced scripts are pointed at sensitive locations or contain dangerous operations.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install autoagent
  3. After installation, invoke the skill by name or use /autoagent
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.8.9
autoagent 0.8.9 - Enhanced setup flow: Every invocation starts a fresh session and lets users choose a custom sandbox path, with improved path resolution rules. - Interactive, user-driven scoring: Setup phase now focuses on collaborative definition and approval of `scoring.md`. - New prompt to ask about external scripts/tools used by the guidance, and a phase to analyze and suggest improvements for them. - Improved plateau detection: Considers “within 5 points” for the last 10 scores (or all available if fewer). - Subagent invocation now uses explicit session spawn parameters with clear instructions to include test cases in prompt and set timeouts. - Updated documentation and test case handling to reflect these changes.
v0.8.8
No changes detected in this version. - Version 0.8.7 released with no modifications to SKILL.md or other files. - All features and documentation remain the same as the previous release.
v0.8.7
autoagent v0.8.7 brings automated prompt and agent guidance optimization with iterative scoring. - New "autoagent" skill enables continuous improvement of agent guidance via a Karpathy-style feedback loop. - Interactive setup wizard collects guidance location, task description, test inputs, scoring criteria, and schedule. - Initializes a sandbox directory with cloned guidance, fixtures, and scoring files for safe, non-destructive experimentation. - On a 5-minute cron schedule, automatically proposes, tests, and scores improvements; keeps changes only when scores rise. - Detects plateaus (no progress for 10 runs), pauses optimization, and notifies user for review. - Complete change log and result history logged for transparency and user auditing.
Metadata
Slug autoagent
Version 0.8.9
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 3
Frequently Asked Questions

What is autoagent?

Automatically improve agent guidance through iterative testing and scoring. Use when you want to optimize prompts, AGENTS.md entries, or skill definitions us... It is an AI Agent Skill for Claude Code / OpenClaw, with 239 downloads so far.

How do I install autoagent?

Run "/install autoagent" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is autoagent free?

Yes, autoagent is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does autoagent support?

autoagent is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created autoagent?

It is built and maintained by PeterPCW (@peterpcw); the current version is v0.8.9.

💬 Comments