{"id":48647223,"url":"https://github.com/kayba-ai/recursive-improve","last_synced_at":"2026-04-26T01:00:56.795Z","repository":{"id":347612994,"uuid":"1194570484","full_name":"kayba-ai/recursive-improve","owner":"kayba-ai","description":"🪞 Make your agents recursively self-improve","archived":false,"fork":false,"pushed_at":"2026-03-28T16:33:52.000Z","size":1753,"stargazers_count":30,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-28T18:28:47.769Z","etag":null,"topics":["agent-learning","agents","ai","ai-agent","ai-tools","llm","machine-learning"],"latest_commit_sha":null,"homepage":"https://kayba.ai/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kayba-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-28T14:37:25.000Z","updated_at":"2026-03-28T18:22:58.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/kayba-ai/recursive-improve","commit_stats":null,"previous_names":["kayba-ai/recursive-improve"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/kayba-ai/recursive-improve","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayba-ai%2Frecursive-improve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayba-ai%2Frecursive-improve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayba-ai%2Frecursive-improve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayba-ai%2Frecursive-improve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kayba-ai","download_url":"https://codeload.github.com/kayba-ai/recursive-improve/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayba-ai%2Frecursive-improve/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32282187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T18:29:39.964Z","status":"ssl_error","status_checked_at":"2026-04-25T18:29:32.149Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-learning","agents","ai","ai-agent","ai-tools","llm","machine-learning"],"created_at":"2026-04-10T06:00:29.406Z","updated_at":"2026-04-26T01:00:56.788Z","avatar_url":"https://github.com/kayba-ai.png","language":"Python","funding_links":[],"categories":["🔬 Autonomous Research \u0026 Self-Improving Agents","🛠️ General-purpose descendants","Python"],"sub_categories":["General-Purpose Descendants"],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://kayba.ai\"\u003e\u003cimg src=\"assets/banner.svg\" alt=\"recursive improve\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"left\"\u003e\n  \u003ca href=\"https://discord.gg/mqCqH7sTyK\"\u003e\u003cimg src=\"https://img.shields.io/discord/1429935408145236131?label=Discord\u0026logo=discord\u0026logoColor=white\u0026color=5865F2\" alt=\"Discord\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://twitter.com/kaybaai\"\u003e\u003cimg src=\"https://img.shields.io/twitter/follow/kaybaai?style=social\" alt=\"Twitter Follow\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://kayba.ai\"\u003e\u003cimg src=\"https://img.shields.io/badge/kayba.ai-6B8BA8?style=flat\u0026logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAIpElEQVR42q1XbWwU1xU9d2Z29sPe2V3jyHVwDNixkiBiqKKixA1IBloKCRJSAaU4ip0PhaiJE0JSqSU/WqlpihpXiaJGmJBGSiGOEj4MjsuHhDApENzEjYHaxTbGJUUuBsvaHXt3vbuzM6c/1l6MvW7+5EpPu/t23rvnnvfm3HsFgArAzsvLu1/TtF+SrAYQBKDguzUHgCkipyyRHfFI5AIAVQDA7/evE5E9IhIgp64hAJmxkwggItmRWUOQhENmliHXPpx4nmMiUmuaZrPk5+cvVBSlQ0S8JNMZRkRy7AIRgaqqsG0HyWQCqVQKjuMAABRFhdutw+32QASwbWcagOwXW0Q0kilFUX6giai/FsGkc23agqypqoZ02oJpmvB6vZi/YAHmlZaisLAQiqJgeHgYl/v7MTAwADoODMOAoigTAGVyTwGgkUyLiO44zm/EMIxhEZlDZh+YGvOEcxWmGUEwGMRjjz2GjRs2YunSpfDl+QAAdtrG+Pg4TNPEpUuX0PTxxzh48ADGx8fh9XpBTg9IKAI4pCmGYSQAceekHAJFVRCJRLB27Vq8/tvXseT7SwAAHR0dOHz4MDo6OnD9+nVYloX8vHyUlZdhcWUlUpaF5uZm9Pf3Q1XV20BM3AMASMMwjIRhGMw1CgoKCIAvvPACU8kkSXJgYIBPPPEEjUCAE7zmHHPvnMuqqioWFRXR7/czEAjk8mHlYCBzXpqmIRwOY9OmTfho70eZqP/RgdraWvT29kJEcN999+Ghhx7C3eV3w+P1IBwOo7u7G+3t7RgcHITH44HH44HjOFOjnmqTDExFF2AwGKTP5+OCBQt47T/XmE6n2dXVxbvuuosAWFRUxIaGBl7/73VONytlsedSD7dt20afz8f8/HwGg0HOwrK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+xlOp1mdCzK8fFxfvPNN3zmmWfYfq6dJLl79+4pWjAdwASqSQne1biLx48dnxAZN5csWcLzneezEtvb08sD+/fzvV3vsampiVf6rzCVSDEei7OpqYnLli1jS0sLk8kkw+Ew01aa69evp6IoDIVCMwFkJiaSUF4eS0pKaEZM7vj9DgKg2+1mcXEx3377bd68cZO5LBaNcWRkhPfee282ZwxcGaBt2zz9t9P0+Xy55PgWA4ZxiwUR4aZNm0iSO3bsoMfjoaIoVFWVlfdX8qWXXmLjzkZevXqVfX193Lp1Kx999FFGo1Hu3r2bJXNL2H6unalkhpXq6mpqmjYRvTEbAzOz4SvbXiFJtp1s44MPPkiXy3Vb0XH69GmeOHEi+/u5555jMplkV1cXU4kU6ZAv1r84Wx6YPR0bgQBDoRABsK62jqlkiiS579N9rKmp4eLFi+n3+/n5qc957tw5lpeXs6amhvs+3cdwOELHdhiPxTPORaaf+1QWcgEITMmMGSYqKyv5Wctn2fMeGxtjd3c3BwcHOTw8zBtDN7L/2WmbZ8+e5YoVKwhgFuczSjK4Z2tnNE1DNBqF4zhYvnw5Nvx0Ax5++GHMnz8fLpcLJGFZFgYHB3HhwgUcOnwYra2tSCTGEQgEZkjv9JJMDMMYBmTOlLp9Sh2f+VQUFQAxNjYG27YRDIZw553FKCgogCIKRsdGMXR9CDeHb8JxCMMwoKoKbNuezTEBAemMimEY+0Rkw63GRHI2JoBAVRVABGkrDctKZaNTFBW67oLL5co0gY6TqwCdaraIqCRbJC8vb5Gqqh0i4r7Vmk1nYmbRckvTJdsXfovTyZbLmXBuichSJRaLdYnIz0hGRUTL9IXIycAkLpKgQziOA8exp0Q8y9Jb8zLhPCYiNaZpnlcBqMlk8l8ej+cYyTkA7gCgT6L9DocNIAzgqIg8bZrmCQDq/wBcV6BSGdN3ewAAAABJRU5ErkJggg==\u0026logoColor=white\" alt=\"kayba.ai\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## make your agents recursively self-improve\n\n90% of Claude's code is now written by Claude. Recursive self-improvement is already happening at Anthropic. **What if you could do the same for your own agents?**\n\n## Closing the Loop\n\nYou have an agent. It works, most of the time. But it could be better. Solving harder problems, handling more edge cases, wasting fewer tokens. What if it could improve itself, recursively, every time it runs?\n\nRight now, it can't. Your agent is stateless. Every run starts from scratch. The only way to improve it is to manually improve it. There is no compounding of improvements.\n\n**recursive-improve** closes this loop:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/loop.gif\" alt=\"recursive improvement loop\" width=\"720\" /\u003e\n\u003c/p\u003e\n\nYour agent runs. Every LLM call is captured. Your coding agent analyzes the traces, identifying common failure patterns across runs, and applies targeted fixes. You run it again. It's better.\n\n---\n\n## Get Started\n\n### 1. Install\n\n```bash\nuv tool install \"recursive-improve[all] @ git+https://github.com/kayba-ai/recursive-improve.git\"\n```\n\nThen in your agent's project directory:\n\n```bash\ncd /path/to/your/agent\nrecursive-improve init\n```\n\nThis creates the `/recursive-improve` skill files and the `eval/traces/` directory.\n\n### 2. Add tracing to your agent\n\nAdd the tracing dependency to your project:\n\n```bash\nuv add \"recursive-improve @ git+https://github.com/kayba-ai/recursive-improve.git\"\n```\n\nTwo lines. Your agent code stays unchanged, but now your agents execution traces get saved locally.\n\n```python\nimport recursive_improve as ri\n\nri.patch()  # auto-captures openai, anthropic, litellm calls\n\nwith ri.session(\"./eval/traces\") as run:\n    result = my_agent(\"book a flight to Paris\")\n    run.finish(output=result, success=True)\n```\n\n\u003e **Already have traces?** Drop them in `eval/traces/` and skip to step 4.\n\n### 3. Run your agent a few times to generate traces\n\n### 4. Run the improvement loop\n\nOpen Claude Code or Codex in your project directory:\n\n```\n/recursive-improve\n```\n\n### 5. Re-run your agent\n\nClear old traces and run your agent again so the benchmark measures your improved code:\n\n```bash\nrm -f eval/traces/*.json\n# run your agent the same way as step 3\n```\n\n### 6. Benchmark\n\nMeasure whether your changes actually solved the problems:\n\n```\n/benchmark\n```\n\nResults are stored in `eval/benchmark_results.json` and auto-compared against the previous run on the same dynamic metrics that were generated for your agent.\n\n\u003e **CLI alternative:** `recursive-improve benchmark --label \"v1-baseline\"` and `recursive-improve benchmark list`\n\n### 7. Dashboard\n\nStart the interactive dashboard to visualize your improvement cycles:\n\n```bash\nrecursive-improve dashboard          # default: http://localhost:8420\nrecursive-improve dashboard -p 8080  # custom port\n```\n\nEach improvement cycle lives on its own branch. The dashboard shows before/after metrics for every cycle. See exactly what improved, merge the wins, discard the rest.\n\n![Dashboard](assets/dashboard.png)\n\n### 8. Run it overnight\n\n```\n/ratchet\n```\n\nAn autoresearch-style autonomous loop. It asks you what to optimize, then repeats: improve → run agent → eval → keep or revert. Only improvements survive. Check `eval/ratchet_summary.md` when you wake up.\n\n\u003e [!TIP]\n\u003e Want deeper analysis? [Kayba](https://kayba.ai) offers managed recursive agent improvement at scale, tailored to your agent.\n\n---\n\n## How It Works\n\nWhen you run the `/recursive-improve` skill, it walks through a structured pipeline:\n\n1. **Build context**: detects your agent's architecture, tools, and system prompt\n2. **Analyze traces**: reads your traces, surfaces failure patterns, missed opportunities, recurring errors\n3. **Measure**: runs built-in detectors (loops, give-ups, errors, recovery) and generates custom domain-specific evaluations from your insights, then computes baselines\n4. **Plan**: triages each insight into discard / code fix / prompt fix, prioritized by impact\n5. **Review**: presents the plan for your approval before anything changes\n6. **Fix**: implements approved changes on a dedicated branch\n\nEvery fix traces back to a specific insight, linked to a specific metric.\n\n---\n\n## Architecture\n\n```\nyour agent  ──\u003e  ri.patch() + ri.session()  ──\u003e  eval/traces/*.json\n                                                        │\n                                                        ▼\n                                                  /recursive-improve\n                                                        │\n                                                        ▼\n                                              improved agent code  ──\u003e  repeat\n                                                        │\n                                                        ▼\n                                                    benchmark  ──\u003e  recursive-improve dashboard\n\n                              ┌──────────────────────────────┐\n                              │  /ratchet (autonomous loop)   │\n                              │  improve → run → eval →       │\n                              │  keep or revert → repeat      │\n                              └──────────────────────────────┘\n```\n\n- **`ri.patch()`**: monkey-patches OpenAI, Anthropic, and LiteLLM clients to capture every call\n- **`ri.session()`**: context manager that writes structured trace JSON files\n- **`/recursive-improve`**: Claude Code / Codex skill that analyzes traces and applies fixes\n- **`recursive-improve benchmark`**: snapshot metric quality, store, and compare over time\n- **`recursive-improve dashboard`**: web UI to visualize runs and compare branches\n- **`/ratchet`**: autonomous keep-or-revert loop that runs `/recursive-improve` repeatedly overnight\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**Star this repo if you find it useful!**\n\n**Built with ❤️ by [Kayba](https://kayba.ai) and the open-source community.**\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkayba-ai%2Frecursive-improve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkayba-ai%2Frecursive-improve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkayba-ai%2Frecursive-improve/lists"}