{"slug": "agenthatch-compile-any-skill-into-a-standalone-python-agent", "title": "Agenthatch – Compile any skill into a standalone Python agent", "summary": "Agenthatch launches a tool that compiles SKILL.md files into standalone Python agents, addressing isolation, validation, and scaling issues in multi-skill AI workflows. The deterministic pipeline parses markdown, runs six AI harnesses, and generates a runnable package with typed tools and MCP integration, reducing token waste and enabling unlimited skill scaling.", "body_md": "**Turn any SKILL.md into a standalone, runnable AI Agent.**\n\nSKILL.md promised a lot. Write a markdown file, tell your agent what to do, and it works. In practice, anyone who has used more than three skills across Claude Code, Codex CLI, or OpenClaw knows the friction:\n\n| Pain point | What actually happens |\n|---|---|\nNo isolation |\nSkills leak into each other. A file-organizer skill and a git-ops skill share the same context window. The agent confuses instructions meant for one with the other. |\nReference book, not operating manual |\nAgents treat SKILL.md as a loose suggestion, not a contract. Given a long skill, the model skim-reads it. It picks the parts that seem relevant and ignores the rest. |\nToken waste |\nEvery SKILL.md lives in the system prompt. Add 5 skills at 3KB each and you just burned 15KB of context before the conversation even starts. On long-running tasks this compounds fast. |\nNo validation |\nA typo in a tool name, a missing parameter, an ambiguous instruction. The agent won't catch any of it until runtime, and by then the conversation is 20 turns deep. |\nScale decays |\nSkills work at 1–3. At 10+ they become unmanageable. No dependency graph, no conflict detection, no way to tell which skill overrides which. |\n\nThe core issue isn't the format. It's that SKILL.md is **prompt engineering**, not\n**software engineering**. You're asking an LLM to interpret human prose at\nruntime, every time, with no compilation, no type checking, no contract.\n\nagenthatch treats a SKILL.md as **source code** — not a prompt. It compiles it\nthrough a deterministic pipeline into a standalone Python agent that you can\nimport, ship, and run anywhere.\n\n```\nSKILL.md  →  Parse  →  6-Harness LLM Pipeline  →  Code Generation  →  Runnable Agent\n   (input)   (Phase 1)    (Phase 2: AI inference)     (Phase 3: Jinja2)     (output)\n```\n\nThe result is a self-contained Python package with its own `pyproject.toml`\n\n,\na CLI entry point, typed tool definitions, MCP integration, and a runtime\nconfiguration. It's not a wrapper around your skill — it **is** the skill,\ncompiled into code.\n\n```\n# Install\npip install agenthatch\n\n# Initialize with your LLM provider\nagenthatch init\n\n# Add a SKILL.md\nagenthatch skills add ./my-skill/SKILL.md\n\n# Hatch it into an agent\nagenthatch hatch my-skill\n\n# Run it\nagenthatch run my-skill\n```\n\nThree steps from markdown to running agent. The hatched agent lives in your skillhouse and can be re-run anytime.\n\n| SKILL.md (raw) | agenthatch (hatched) | |\n|---|---|---|\nExecution |\nInterpreted at runtime by LLM | Compiled into standalone Python package |\nIsolation |\nAll skills share one context window | Each agent has its own runtime, tools, and config |\nValidation |\nNone. Typos and ambiguities caught at runtime. | Schema-validated AHSSPEC before code generation |\nToken cost |\nFull skill body in system prompt every turn | ~150 bytes of runtime config |\nTool definitions |\nProse descriptions, LLM guesses how to call | Type-annotated Python functions with JSON Schema |\nMCP |\nManual wiring per agent | Auto-detected, auto-configured |\nDeterminism |\nLLM interprets differently each time | Same SKILL.md → same AHSSPEC structure (low-temp inference) |\nMulti-skill scaling |\nDegrades past 3–5 skills | Unlimited. Each agent is a separate process. |\nDebugging |\nRead the LLM's chain-of-thought and pray | Standard Python debugging, logging, tests |\n\nagenthatch runs a **3-phase pipeline** with 6 AI harnesses working in parallel:\n\nThe SKILL.md is parsed for frontmatter, body, and directory files. No AI\ninvolved. A pure file-system operation. The output is a `ContextPack`\n\nwith zero semantic transformation.\n\nSix specialized AI harnesses process the skill, each with its own persona and temperature profile:\n\n| Harness | Role | Temp |\n|---|---|---|\nA — Identity |\nExtract name, version, description from frontmatter | 0.1 |\nB — Intent |\nInfer trigger phrases and user intents | 0.5 |\nC — Interface |\nDesign tool signatures, parameters, and return types | 0.5 |\nD — Base |\nDetect runtime base class and instruction structure | 0.3 |\nE — Assembly |\nCross-validate all harness outputs, produce AHSSPEC | 0.2 |\nF — MCP |\nDetect and configure MCP server connections | 0.3 |\n\nEach harness runs an **Analyze → Infer → Self-Validate → Correct** loop with\nup to 2 internal retries. Harness E cross-validates the other five outputs and\nproduces a unified AHSSPEC (Agent Hatch Standard Specification).\n\nJinja2 templates render the AHSSPEC into a complete Python agent package:\n\n```\nhatched-agent/\n├── pyproject.toml          # pip-installable package\n├── runtime.toml            # LLM provider, model, API keys\n├── README.md               # Generated usage docs\n├── agenthatch.yaml         # AHSSPEC manifest\n└── src/{package_name}/\n    ├── __init__.py\n    ├── agent.py            # Agent class (extends AHCoreAgent)\n    ├── tools.py            # Type-annotated tool implementations\n    └── references.py       # AI-extracted structured data\n```\n\nGenerated agents use the **PlanLayer state machine** — a 6-state planning\nengine that runs STARTING → PLANNING → EXECUTING → VERIFYING → REPLANNING →\nDONE. It adapts mid-task: merges completed steps, branches on failure, and\ndegrades gracefully when tools time out.\n\n## Click to expand: the full pipeline in detail\n\nSets up `~/.agenthatch/`\n\nwith your LLM provider configuration. Supports OpenAI,\nDeepSeek, Anthropic, and any OpenAI-compatible endpoint. The config file is\nTOML. Readable, versionable, easy to share.\n\nCopies the SKILL.md and its directory into the skillhouse index. The skillhouse tracks every skill you've added, its hatch status, and where its generated agent lives.\n\nThe full pipeline runs:\n\n```\nPhase 1 (deterministic): Parse SKILL.md → ContextPack\nPhase 2 (AI): 6 harnesses → HarnessOutput → Assembly → AHSSPEC\nPhase 3 (Jinja2): AHSSPEC → agent package\n```\n\nFlags:\n\n`--no-generate`\n\n— skip Phase 3, review the AHSSPEC first`--force`\n\n— overwrite existing hatched agent`--dry-run`\n\n— preview without writing files\n\nLaunches the hatched agent in interactive TUI mode. The agent loads its runtime config, connects to its LLM provider, and starts a conversation loop with tool calling, context compaction, and PlanLayer-driven execution.\n\n| Command | What it does |\n|---|---|\n`agenthatch init` |\nInitialize config and provider setup |\n`agenthatch skills add <path>` |\nRegister a SKILL.md in the skillhouse |\n`agenthatch skills list` |\nList all registered skills |\n`agenthatch skills delete <name>` |\nRemove a skill from the skillhouse |\n`agenthatch hatch <name>` |\nRun the full pipeline (parse → harness → generate) |\n`agenthatch run <name>` |\nLaunch a hatched agent in interactive TUI |\n`agenthatch search <query>` |\nSearch the skillhouse index |\n`agenthatch doctor` |\nDiagnose environment and dependencies |\n`agenthatch assemble` |\nRe-assemble an existing skillhouse agent |\n\n```\npip install agenthatch\n```\n\nRequires Python 3.11 or later.\n\nFor development:\n\n```\ngit clone https://github.com/agenthatch/agenthatch.git\ncd agenthatch\npip install -e \".[dev]\"\n```\n\n| Document | Link |\n|---|---|\n| Contributing Guide |\n|\n\n[SECURITY.md](/agenthatch/agenthatch/blob/main/SECURITY.md)[SUPPORT.md](/agenthatch/agenthatch/blob/main/SUPPORT.md)[ROADMAP.md](/agenthatch/agenthatch/blob/main/ROADMAP.md)[CODE_OF_CONDUCT.md](https://github.com/agenthatch/.github/blob/main/CODE_OF_CONDUCT.md)[CHANGELOG.md](/agenthatch/agenthatch/blob/main/CHANGELOG.md)[GitHub Discussions](https://github.com/agenthatch/agenthatch/discussions)— questions, ideas, roadmap[GitHub Issues](https://github.com/agenthatch/agenthatch/issues)— bugs and feature requests[X (Twitter)](https://x.com/EterRights)\n\nagenthatch is a solo project looking for its first contributors. Issues, pull requests, documentation, design -- every bit moves the project forward.\n\nSee [CONTRIBUTING.md](/agenthatch/agenthatch/blob/main/CONTRIBUTING.md) for dev setup, the quality gate\n(`hatch run quality:check`\n\n), and PR guidelines.\n\nAI-assisted contributions are welcome. Run the quality gate before submitting — that's all that matters.\n\nAnyone who maintains more than 3 SKILL.md files and feels the friction. Claude Code users, Codex CLI users, OpenClaw users — if you've ever thought \"I wish this skill was a real program,\" this is for you.\n\nYes. The hatched agent is a standalone Python package. You can run it as a CLI, import it as a library, or wrap it as an MCP server. It doesn't depend on any specific agent platform.\n\nAny MCP server that speaks the standard protocol. Harness F auto-detects MCP servers referenced in your SKILL.md and configures them in the generated agent's runtime.\n\nNo. SKILL.md is the input format. agenthatch is the compiler. You still write skills in markdown — agenthatch turns them into agents.\n\nMIT — see [LICENSE](/agenthatch/agenthatch/blob/main/LICENSE) for details.\n\n📖 简体中文版请见 README_CN.md", "url": "https://wpnews.pro/news/agenthatch-compile-any-skill-into-a-standalone-python-agent", "canonical_source": "https://github.com/agenthatch/agenthatch", "published_at": "2026-06-17 13:12:37+00:00", "updated_at": "2026-06-17 13:23:18.085657+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-agents", "generative-ai", "ai-infrastructure"], "entities": ["Agenthatch", "Claude Code", "Codex CLI", "OpenClaw", "Python", "MCP", "Jinja2", "JSON Schema"], "alternates": {"html": "https://wpnews.pro/news/agenthatch-compile-any-skill-into-a-standalone-python-agent", "markdown": "https://wpnews.pro/news/agenthatch-compile-any-skill-into-a-standalone-python-agent.md", "text": "https://wpnews.pro/news/agenthatch-compile-any-skill-into-a-standalone-python-agent.txt", "jsonld": "https://wpnews.pro/news/agenthatch-compile-any-skill-into-a-standalone-python-agent.jsonld"}}