Metadata-Version: 2.4
Name: molt-agent
Version: 0.1.0
Summary: The coding agent that grows its own tools. Watch it molt.
Author: MOLT contributors
License: MIT
Project-URL: Homepage, https://github.com/houyongsheng/deepseek-harness-molt
Project-URL: Repository, https://github.com/houyongsheng/deepseek-harness-molt
Keywords: agent,ai,self-improving,llm,tools,skills,deepseek-harness
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28
Dynamic: license-file

<p align="center">
  <b><a href="README.md">English</a></b> &nbsp;·&nbsp; <a href="README.zh.md">简体中文</a>
</p>

# MOLT 🦀

> **The coding agent that grows its own tools.**

Most agents solve your task and forget everything they learned. **MOLT doesn't forget.** After every job it reflects on what it did, and when it spots a reusable pattern, it **writes itself a new tool**, **tests it**, and **keeps it** in a skill library. Next time the pattern shows up, the tool is already there.

Watch the toolbox compound:

```
$ molt run "tidy the config files" --learn --mock

── molt run — task ─────────────────────────────────────────────
  task: tidy the config files
  model: mock

── final answer ────────────────────────────────────────────────
  All done — I inspected the workspace and the job is complete.

── learn ───────────────────────────────────────────────────────
  ✔ grew a new tool: `parse_csv_line` → .molt/skills/parse_csv_line

$ molt skills list
  parse_csv_line    [project]  Parse a CSV line of key=value pairs into a dict.

$ molt run "parse some key=value config" --mock      # the tool is already there
```

That's the whole idea: **your AI doesn't just code — it molts.** It sheds the old, grows a new tool, and keeps it.

---

## Why MOLT

- **It compounds.** Every task can make the next one cheaper and more reliable. Your agent gets better at *your* codebase, not just smarter in general.
- **It's honest self-modification.** A skill only enters the library after **passing its own test**. The agent can grow itself new tools, but they have to prove they work first.
- **It's shareable.** `molt export` bundles your toolbox; `molt install` pulls someone else's. Your agent's hard-won skills become a library you can fork, star, and share.
- **It's yours.** MIT, zero tracking, runs on any OpenAI-compatible model — DeepSeek by default.

## Quickstart

```bash
# From PyPI (the package is published as `molt-agent`):
pip install molt-agent

# …or straight from source:
git clone https://github.com/houyongsheng/deepseek-harness-molt
cd deepseek-harness-molt
pip install -e .

export DEEPSEEK_API_KEY=sk-...
```

Run a task and let it learn:

```bash
molt run "add retry logic to the http client" --learn
```

No API key? Run the exact same loop with a built-in fake model:

```bash
molt run "tidy the config files" --learn --mock
molt evolve "polish the project" -n 5 --mock     # watch the toolbox grow
```

## Commands

| Command | What it does |
|---|---|
| `molt run "task" [--learn]` | Run one task. `--learn` keeps any reusable tool it finds. |
| `molt evolve "goal" -n N` | Loop subtask + learn N times; watch the toolbox accumulate. |
| `molt learn` | Re-run reflection over the last transcript. |
| `molt skills list / show <n> / remove <n>` | Inspect the skill library. |
| `molt export [--out DIR]` | Bundle your skills for sharing. |
| `molt install <path-or-git-url>` | Pull someone else's skills into your toolbox. |

## How it works

```
   task ─▶ agent loop ─▶ answer
               │
               └──▶ reflect: "did I hit a reusable pattern?"
                        │ yes
                        ▼
                   author a skill (python + schema + test)
                        │
                   test it ── fail ─▶ discard
                        │ pass
                        ▼
                   commit to .molt/skills/
                        │
                        ▼
              next run loads it as a tool
```

- **Run** — an agent loop with `shell`, `read_file`, `write_file`, plus every skill you've grown.
- **Reflect** — a second LLM pass asks: was anything here reusable? If yes, it returns a skill as JSON.
- **Test** — the skill's own test runs in a fresh subprocess; no test, no commit.
- **Reuse** — skills become callable tools, project skills shadowing your home library.

Skills live at `.molt/skills/<name>/` (project) and `~/.molt/skills/` (home). Each is plain files: `skill.json` (name/description/inputs), `skill.py` (`def run(**kwargs)`), `test.py`.

## Sharing the toolbox

```bash
molt export --out ./my-agent-toolbox      # copy your skills + manifest
molt install /path/to/my-agent-toolbox    # or: molt install git@github.com:you/toolbox.git
```

That's the seed of an ecosystem: **your agent's skills are a library, and libraries get forked, starred, and shared.**

## Trust & safety

- **Tested before committed.** Untested or failing skills never enter the library.
- **Skills run in-process.** MOLT is built for skills *you* or your project authored — treat others' skills the way you'd treat any code you `pip install`. Use `--mock` and a sandbox/container to evaluate before trusting.
- **Plain files, no lock-in.** Your toolbox is just directories; delete it, share it, move it.

## Roadmap (honest)

- [ ] Skill **dedup/merge** so repeated patterns collapse into one tool
- [ ] Skill **evals** — benchmark a skill's accuracy before/after you edit it
- [ ] A **registry command** (`molt publish`) for a real community hub
- [ ] Streaming the agent loop, richer built-in tools, `--sandbox`

## License

MIT — go build something that grows itself.
