{"id":49044282,"url":"https://github.com/lsdefine/GenericAgent","last_synced_at":"2026-04-29T07:01:04.545Z","repository":{"id":332973739,"uuid":"1135791677","full_name":"lsdefine/GenericAgent","owner":"lsdefine","description":"Self-evolving agent: grows skill tree from 3.3K-line seed, achieving full system control with 6x less token consumption","archived":false,"fork":false,"pushed_at":"2026-04-28T04:01:07.000Z","size":25925,"stargazers_count":7823,"open_issues_count":38,"forks_count":901,"subscribers_count":22,"default_branch":"main","last_synced_at":"2026-04-28T06:09:24.187Z","etag":null,"topics":["ai-agent","automation","autonomous-agent","browser-automation","claude","computer-control","desktop-automation","gemini","lightweight","llm-agent","memory-system","python","self-evolving","skill-tree","task-automation"],"latest_commit_sha":null,"homepage":"https://github.com/lsdefine/GenericAgent","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lsdefine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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-01-16T15:45:24.000Z","updated_at":"2026-04-28T06:09:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"55a42fdb-dbcf-42c4-ac69-add140bb93a9","html_url":"https://github.com/lsdefine/GenericAgent","commit_stats":null,"previous_names":["lsdefine/pc-agent-loop","lsdefine/genericagent"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lsdefine/GenericAgent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsdefine%2FGenericAgent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsdefine%2FGenericAgent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsdefine%2FGenericAgent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsdefine%2FGenericAgent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lsdefine","download_url":"https://codeload.github.com/lsdefine/GenericAgent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsdefine%2FGenericAgent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32414422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["ai-agent","automation","autonomous-agent","browser-automation","claude","computer-control","desktop-automation","gemini","lightweight","llm-agent","memory-system","python","self-evolving","skill-tree","task-automation"],"created_at":"2026-04-19T16:00:31.906Z","updated_at":"2026-04-29T07:01:04.528Z","avatar_url":"https://github.com/lsdefine.png","language":"Python","readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"assets/images/bar.jpg\" width=\"880\"/\u003e\n\n\u003ca href=\"https://trendshift.io/repositories/25944\" target=\"_blank\"\u003e\u003cimg src=\"https://trendshift.io/api/badge/repositories/25944\" alt=\"lsdefine%2FGenericAgent | Trendshift\" style=\"width: 250px; height: 55px;\" width=\"250\" height=\"55\"/\u003e\u003c/a\u003e\n\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#english\"\u003eEnglish\u003c/a\u003e | \u003ca href=\"#chinese\"\u003e中文\u003c/a\u003e | 📄 Technical Report:\u0026nbsp;\u003ca href=\"https://arxiv.org/abs/2604.17091\"\u003e\u003cimg src=\"https://img.shields.io/badge/arXiv-2604.17091-b31b1b?logo=arxiv\u0026logoColor=white\" alt=\"arXiv\" height=\"18\"/\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"assets/GenericAgent_Technical_Report.pdf\"\u003e\u003cimg src=\"https://img.shields.io/badge/-PDF-EA4335?logo=adobeacrobatreader\u0026logoColor=white\" alt=\"Technical Report PDF\" height=\"18\"/\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://github.com/JinyiHan99/GA-Technical-Report\"\u003e\u003cimg src=\"https://img.shields.io/badge/-Code%20%26%20Data-181717?logo=github\u0026logoColor=white\" alt=\"Experiments \u0026 Reproduction Repo\" height=\"18\"/\u003e\u003c/a\u003e | 📘 \u003ca href=\"https://datawhalechina.github.io/hello-generic-agent/\"\u003e教程\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\u003ca name=\"english\"\u003e\u003c/a\u003e\n## 🌟 Overview\n\n**GenericAgent** is a minimal, self-evolving autonomous agent framework. Its core is just **~3K lines of code**. Through **9 atomic tools + a ~100-line Agent Loop**, it grants any LLM system-level control over a local computer — covering browser, terminal, filesystem, keyboard/mouse input, screen vision, and mobile devices (ADB).\n\nIts design philosophy: **don't preload skills — evolve them.**\n\nEvery time GenericAgent solves a new task, it automatically crystallizes the execution path into an skill for direct reuse later. The longer you use it, the more skills accumulate — forming a skill tree that belongs entirely to you, grown from 3K lines of seed code.\n\n\u003e **🤖 Self-Bootstrap Proof** — Everything in this repository, from installing Git and running `git init` to every commit message, was completed autonomously by GenericAgent. The author never opened a terminal once.\n\n## 📋 Core Features\n- **Self-Evolving**: Automatically crystallizes each task into an skill. Capabilities grow with every use, forming your personal skill tree.\n- **Minimal Architecture**: ~3K lines of core code. Agent Loop is ~100 lines. No complex dependencies, zero deployment overhead.\n- **Strong Execution**: Injects into a real browser (preserving login sessions). 9 atomic tools take direct control of the system.\n- **High Compatibility**: Supports Claude / Gemini / Kimi / MiniMax and other major models. Cross-platform.\n- **Token Efficient**: \u003c30K context window — a fraction of the 200K–1M other agents consume. Layered memory ensures the right knowledge is always in scope. Less noise, fewer hallucinations, higher success rate — at a fraction of the cost.\n\n\n## 🧬 Self-Evolution Mechanism\n\nThis is what fundamentally distinguishes GenericAgent from every other agent framework.\n\n```\n[New Task] --\u003e [Autonomous Exploration] (install deps, write scripts, debug \u0026 verify) --\u003e\n[Crystallize Execution Path into skill] --\u003e [Write to Memory Layer] --\u003e [Direct Recall on Next Similar Task]\n```\n\n| What you say | What the agent does the first time | Every time after |\n|---|---|---|\n| *\"Read my WeChat messages\"* | Install deps → reverse DB → write read script → save skill | **one-line invoke** |\n| *\"Monitor stocks and alert me\"* | Install mootdx → build selection flow → configure cron → save skill | **one-line start** |\n| *\"Send this file via Gmail\"* | Configure OAuth → write send script → save skill | **ready to use** |\n\nAfter a few weeks, your agent instance will have a skill tree no one else in the world has — all grown from 3K lines of seed code.\n\n\n##### 🎯 Demo Showcase\n\n| 🧋 Food Delivery Order | 📈 Quantitative Stock Screening |\n|:---:|:---:|\n| \u003cimg src=\"assets/demo/order_tea.gif\" width=\"100%\" alt=\"Order Tea\"\u003e | \u003cimg src=\"assets/demo/selectstock.gif\" width=\"100%\" alt=\"Stock Selection\"\u003e |\n| *\"Order me a milk tea\"* — Navigates the delivery app, selects items, and completes checkout automatically. | *\"Find GEM stocks with EXPMA golden cross, turnover \u003e 5%\"* — Screens stocks with quantitative conditions. |\n| 🌐 Autonomous Web Exploration | 💰 Expense Tracking | 💬 Batch Messaging |\n| \u003cimg src=\"assets/demo/autonomous_explore.png\" width=\"100%\" alt=\"Web Exploration\"\u003e | \u003cimg src=\"assets/demo/alipay_expense.png\" width=\"100%\" alt=\"Alipay Expense\"\u003e | \u003cimg src=\"assets/demo/wechat_batch.png\" width=\"100%\" alt=\"WeChat Batch\"\u003e |\n| Autonomously browses and periodically summarizes web content. | *\"Find expenses over ¥2K in the last 3 months\"* — Drives Alipay via ADB. | Sends bulk WeChat messages, fully driving the WeChat client. |\n\n## 📅 Latest News\n\n- **2026-04-21:** 📄 [Technical Report released on arXiv](https://arxiv.org/abs/2604.17091) — *GenericAgent: A Token-Efficient Self-Evolving LLM Agent via Contextual Information Density Maximization*\n- **2026-04-11:** Introduced **L4 session archive memory** and scheduler cron integration\n- **2026-03-23:** Support personal WeChat as a bot frontend\n- **2026-03-10:** [Released million-scale Skill Library](https://mp.weixin.qq.com/s/q2gQ7YvWoiAcwxzaiwpuiQ?scene=1\u0026click_id=7)\n- **2026-03-08:** [Released \"Dintal Claw\" — a GenericAgent-powered government affairs bot](https://mp.weixin.qq.com/s/eiEhwo-j6S-WpLxgBnNxBg)\n- **2026-03-01:** [GenericAgent featured by Jiqizhixin (机器之心)](https://mp.weixin.qq.com/s/uVWpTTF5I1yzAENV_qm7yg)\n- **2026-01-16:** GenericAgent V1.0 public release\n\n---\n\n## 🚀 Quick Start\n\n#### Method 1: Standard Installation\n\n```bash\n# 1. Clone the repo\ngit clone https://github.com/lsdefine/GenericAgent.git\ncd GenericAgent\n\n# 2. Install minimal dependencies\npip install requests streamlit pywebview\n\n# 3. Configure API Key\ncp mykey_template.py mykey.py\n# Edit mykey.py and fill in your LLM API Key\n\n# 4. Launch\npython launch.pyw\n```\n\n#### Method 2: uv (for experienced Python users)\n\nIf you prefer a modern Python workflow, GenericAgent also provides a minimal `pyproject.toml`:\n\n```bash\ngit clone https://github.com/lsdefine/GenericAgent.git\ncd GenericAgent\nuv pip install -e \".[ui]\"        # Core + GUI dependencies\ncp mykey_template.py mykey.py\npython launch.pyw\n```\n\n\u003e GenericAgent is meant to grow its environment through the Agent itself, not by pre-installing every possible package.\n\nFull guide: [GETTING_STARTED.md](GETTING_STARTED.md)\n\n---\n\n## 🤖 Bot Interface (Optional)\n\n### Telegram Bot\n\n```python\n# mykey.py\ntg_bot_token = 'YOUR_BOT_TOKEN'\ntg_allowed_users = [YOUR_USER_ID]\n```\n\n```bash\npython frontends/tgapp.py\n```\n\n### Alternative App Frontends\n\nBesides the default Streamlit web UI, you can also try other frontend styles:\n\n```bash\npython frontends/qtapp.py                # Qt-based desktop app\nstreamlit run frontends/stapp2.py        # Alternative Streamlit UI\n```\n\n### Common Chat Commands\n\nThe default Streamlit desktop UI started by `python launch.pyw`, plus the QQ / Telegram / Feishu / WeCom / DingTalk frontends, support these chat commands:\n\n- `/new` - start a fresh conversation and clear the current context\n- `/continue` - list recoverable conversation snapshots\n- `/continue N` - restore the `N`th recoverable conversation\n\n\n## 📊 Comparison with Similar Tools\n\n| Feature | GenericAgent | OpenClaw | Claude Code |\n|------|:---:|:---:|:---:|\n| **Codebase** | ~3K lines | ~530,000 lines | Open-sourced (large) |\n| **Deployment** | `pip install` + API Key | Multi-service orchestration | CLI + subscription |\n| **Browser Control** | Real browser (session preserved) | Sandbox / headless browser | Via MCP plugin |\n| **OS Control** | Mouse/kbd, vision, ADB | Multi-agent delegation | File + terminal |\n| **Self-Evolution** | Autonomous skill growth | Plugin ecosystem | Stateless between sessions |\n| **Out of the Box** | A few core files + starter skills | Hundreds of modules | Rich CLI toolset |\n\n\n## 🧠 How It Works\n\nGenericAgent accomplishes complex tasks through **Layered Memory × Minimal Toolset × Autonomous Execution Loop**, continuously accumulating experience during execution.\n\n1️⃣ **Layered Memory System**\n\u003e _Memory crystallizes throughout task execution, letting the agent build stable, efficient working patterns over time._\n\n- **L0 — Meta Rules**: Core behavioral rules and system constraints of the agent\n- **L1 — Insight Index**: Minimal memory index for fast routing and recall\n- **L2 — Global Facts**: Stable knowledge accumulated over long-term operation\n- **L3 — Task Skills / SOPs**: Reusable workflows for completing specific task types\n- **L4 — Session Archive**: Archived task records distilled from finished sessions for long-horizon recall\n\n2️⃣ **Autonomous Execution Loop**\n\n\u003e _Perceive environment state → Task reasoning → Execute tools → Write experience to memory → Loop_\n\nThe entire core loop is just **~100 lines of code** (`agent_loop.py`).\n\n3️⃣ **Minimal Toolset**\n\u003e _GenericAgent provides only **9 atomic tools**, forming the foundational capabilities for interacting with the outside world._\n\n| Tool | Function |\n|------|------|\n| `code_run` | Execute arbitrary code |\n| `file_read` | Read files |\n| `file_write` | Write files |\n| `file_patch` | Patch / modify files |\n| `web_scan` | Perceive web content |\n| `web_execute_js` | Control browser behavior |\n| `ask_user` | Human-in-the-loop confirmation |\n\n\u003e Additionally, 2 **memory management tools** (`update_working_checkpoint`, `start_long_term_update`) allow the agent to persist context and accumulate experience across sessions.\n\n4️⃣ **Capability Extension Mechanism**\n\u003e _Capable of dynamically creating new tools._\n\nVia `code_run`, GenericAgent can dynamically install Python packages, write new scripts, call external APIs, or control hardware at runtime — crystallizing temporary abilities into permanent tools.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"assets/images/workflow.jpg\" alt=\"GenericAgent Workflow\" width=\"400\"/\u003e\n  \u003cbr\u003e\u003cem\u003eGenericAgent Workflow Diagram\u003c/em\u003e\n\u003c/div\u003e\n\n\n## ⭐ Support\n\nIf this project helped you, please consider leaving a **Star!** 🙏\n\nYou're also welcome to join our **GenericAgent Community Group** for discussion, feedback, and co-building 👏\n\n\u003cdiv align=\"center\"\u003e\n  \u003ctable\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003e\u003cstrong\u003eWeChat Group 8\u003c/strong\u003e\u003cbr\u003e\u003cimg src=\"assets/images/wechat_group8.jpg\" alt=\"WeChat Group 8 QR Code\" width=\"250\"/\u003e\u003c/td\u003e\n      \u003ctd align=\"center\"\u003e\u003cstrong\u003eWeChat Group 9\u003c/strong\u003e\u003cbr\u003e\u003cimg src=\"assets/images/wechat_group9.jpg\" alt=\"WeChat Group 9 QR Code\" width=\"250\"/\u003e\u003c/td\u003e\n      \u003ctd align=\"center\"\u003e\u003cstrong\u003eWeChat Group 11\u003c/strong\u003e\u003cbr\u003e\u003cimg src=\"assets/images/wechat_group11.jpg\" alt=\"WeChat Group 11 QR Code\" width=\"250\"/\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n\u003c/div\u003e\n\n## 🚩 Friendly Links\n\nThanks for the support from the LinuxDo community!\n\n[![LinuxDo](https://img.shields.io/badge/社区-LinuxDo-blue?style=for-the-badge)](https://linux.do/)\n\n## 📄 License\n\nMIT License — see [LICENSE](LICENSE)\n\n*Disclaimer: This project does not build or operate any commercial website. Apart from DintalClaw, no institution, organization, or individual is currently officially authorized to conduct commercial activities under the GenericAgent name.*\n\n\n---\n\u003ca name=\"chinese\"\u003e\u003c/a\u003e\n## 🌟 项目简介\n\n**GenericAgent** 是一个极简、可自我进化的自主 Agent 框架。核心仅 **~3K 行代码**，通过 **9 个原子工具 + ~100 行 Agent Loop**，赋予任意 LLM 对本地计算机的系统级控制能力，覆盖浏览器、终端、文件系统、键鼠输入、屏幕视觉及移动设备。\n\n它的设计哲学是：**不预设技能，靠进化获得能力。**\n\n每解决一个新任务，GenericAgent 就将执行路径自动固化为 Skill，供后续直接调用。使用时间越长，沉淀的技能越多，形成一棵完全属于你、从 3K 行种子代码生长出来的专属技能树。\n\n\u003e **🤖 自举实证** — 本仓库的一切，从安装 Git、`git init` 到每一条 commit message，均由 GenericAgent 自主完成。作者全程未打开过一次终端。\n\n## 📋 核心特性\n- **自我进化**: 每次任务自动沉淀 Skill，能力随使用持续增长，形成专属技能树\n- **极简架构**: ~3K 行核心代码，Agent Loop 约百行，无复杂依赖，部署零负担\n- **强执行力**: 注入真实浏览器（保留登录态），9 个原子工具直接接管系统\n- **高兼容性**: 支持 Claude / Gemini / Kimi / MiniMax 等主流模型，跨平台运行\n- **极致省 Token**: 上下文窗口不到 30K，是其他 Agent（200K–1M）的零头。分层记忆让关键信息始终在场——噪声更少，幻觉更低，成功率反而更高，而成本低一个数量级。\n\n## 🧬 自我进化机制\n\n这是 GenericAgent 区别于其他 Agent 框架的根本所在。\n\n```\n[遇到新任务]--\u003e[自主摸索](安装依赖、编写脚本、调试验证)--\u003e\n[将执行路径固化为 Skill]--\u003e[写入记忆层]--\u003e[下次同类任务直接调用]\n```\n\n| 你说的一句话 | Agent 第一次做了什么 | 之后每次 |\n|---|---|---|\n| *\"监控股票并提醒我\"* | 安装 mootdx → 构建选股流程 → 配置定时任务 → 保存 Skill | **一句话启动** |\n| *\"用 Gmail 发这个文件\"* | 配置 OAuth → 编写发送脚本 → 保存 Skill | **直接可用** |\n\n用几周后，你的 Agent 实例将拥有一套任何人都没有的专属技能树，全部从 3K 行种子代码中生长而来。\n\n\u003c!-- | *\"帮我读取微信消息\"* | 安装依赖 → 逆向数据库 → 写读取脚本 → 保存 Skill | **一句话调用** | --\u003e\n\n#### 🎯 实例展示\n\n| 🧋 外卖下单 | 📈 量化选股 |\n|:---:|:---:|\n| \u003cimg src=\"assets/demo/order_tea.gif\" width=\"100%\" alt=\"Order Tea\"\u003e | \u003cimg src=\"assets/demo/selectstock.gif\" width=\"100%\" alt=\"Stock Selection\"\u003e |\n| *\"Order me a milk tea\"* — 自动导航外卖 App，选品并完成结账 | *\"Find GEM stocks with EXPMA golden cross, turnover \u003e 5%\"* — 量化条件筛股 |\n| 🌐 自主网页探索 | 💰 支出追踪 | 💬 批量消息 |\n| \u003cimg src=\"assets/demo/autonomous_explore.png\" width=\"100%\" alt=\"Web Exploration\"\u003e | \u003cimg src=\"assets/demo/alipay_expense.png\" width=\"100%\" alt=\"Alipay Expense\"\u003e | \u003cimg src=\"assets/demo/wechat_batch.png\" width=\"100%\" alt=\"WeChat Batch\"\u003e |\n| 自主浏览并定时汇总网页信息 | *\"查找近 3 个月超 ¥2K 的支出\"* — 通过 ADB 驱动支付宝 | 批量发送微信消息，完整驱动微信客户端 |\n\n\n\n## 📅 最新动态\n\n- **2026-04-21:** 📄 [技术报告已发布至 arXiv](https://arxiv.org/abs/2604.17091) — *GenericAgent: A Token-Efficient Self-Evolving LLM Agent via Contextual Information Density Maximization*\n- **2026-04-11:** 引入 **L4 会话归档记忆**，并接入 scheduler cron 调度\n- **2026-03-23:** 支持个人微信接入作为 Bot 前端\n- **2026-03-10:** [发布百万级 Skill 库](https://mp.weixin.qq.com/s/q2gQ7YvWoiAcwxzaiwpuiQ?scene=1\u0026click_id=7)\n- **2026-03-08:** [发布以 GenericAgent 为核心的\"政务龙虾\" Dintal Claw](https://mp.weixin.qq.com/s/eiEhwo-j6S-WpLxgBnNxBg)\n- **2026-03-01:** [GenericAgent 被机器之心报道](https://mp.weixin.qq.com/s/uVWpTTF5I1yzAENV_qm7yg)\n- **2026-01-16:** GenericAgent V1.0 公开版本发布\n\n---\n\n## 🚀 快速开始\n\n#### 方法一：标准安装\n\n```bash\n# 1. 克隆仓库\ngit clone https://github.com/lsdefine/GenericAgent.git\ncd GenericAgent\n\n# 2. 安装最小依赖\npip install requests streamlit pywebview\n\n# 3. 配置 API Key\ncp mykey_template.py mykey.py\n# 编辑 mykey.py，填入你的 LLM API Key\n\n# 4. 启动\npython launch.pyw\n```\n\n#### 方法二：uv 快速安装（熟悉 Python 的用户）\n\n如果你习惯现代 Python 工作流，GenericAgent 也提供了一个最小化的 `pyproject.toml`：\n\n```bash\ngit clone https://github.com/lsdefine/GenericAgent.git\ncd GenericAgent\nuv pip install -e \".[ui]\"        # 核心 + GUI 依赖\ncp mykey_template.py mykey.py\npython launch.pyw\n```\n\n\u003e GenericAgent 更推荐由 Agent 在使用中自举环境，而不是预先手动装完整依赖。\n\n完整引导流程见 [GETTING_STARTED.md](GETTING_STARTED.md)。\n\n📖 新手使用指南（图文版）：[飞书文档](https://my.feishu.cn/wiki/CGrDw0T76iNFuskmwxdcWrpinPb)\n\n📘 完整入门教程（Datawhale 出品）：[Hello GenericAgent](https://datawhalechina.github.io/hello-generic-agent/) · [GitHub](https://github.com/datawhalechina/hello-generic-agent)\n\n---\n\n## 🤖 Bot 接口（可选）\n\n### 微信 Bot（个人微信）\n\n无需额外配置，扫码登录即可：\n\n```bash\npip install pycryptodome qrcode requests\npython frontends/wechatapp.py\n```\n\n\u003e 首次启动会弹出二维码，用微信扫码完成绑定。之后通过微信消息与 Agent 交互。\n\n### QQ Bot\n\n使用 `qq-botpy` WebSocket 长连接，**无需公网 webhook**：\n\n```bash\npip install qq-botpy\n```\n\n在 `mykey.py` 中补充：\n\n```python\nqq_app_id = \"YOUR_APP_ID\"\nqq_app_secret = \"YOUR_APP_SECRET\"\nqq_allowed_users = [\"YOUR_USER_OPENID\"]  # 或 ['*'] 公开访问\n```\n\n```bash\npython frontends/qqapp.py\n```\n\n\u003e 在 [QQ 开放平台](https://q.qq.com) 创建机器人获取 AppID / AppSecret。首次消息后，用户 openid 记录于 `temp/qqapp.log`。\n\n### 飞书（Lark）\n\n```bash\npip install lark-oapi\npython frontends/fsapp.py\n```\n\n```python\nfs_app_id = \"cli_xxx\"\nfs_app_secret = \"xxx\"\nfs_allowed_users = [\"ou_xxx\"]  # 或 ['*']\n```\n\n**入站支持**：文本、富文本 post、图片、文件、音频、media、交互卡片 / 分享卡片  \n**出站支持**：流式进度卡片、图片回传、文件 / media 回传  \n**视觉模型**：图片首轮以真正的多模态输入发送给兼容 OpenAI Vision 的后端\n\n详细配置见 [assets/SETUP_FEISHU.md](assets/SETUP_FEISHU.md)\n\n\n### 企业微信（WeCom）\n\n```bash\npip install wecom_aibot_sdk\npython frontends/wecomapp.py\n```\n\n```python\nwecom_bot_id = \"your_bot_id\"\nwecom_secret = \"your_bot_secret\"\nwecom_allowed_users = [\"your_user_id\"]\nwecom_welcome_message = \"你好，我在线上。\"\n```\n\n### 钉钉（DingTalk）\n\n```bash\npip install dingtalk-stream\npython frontends/dingtalkapp.py\n```\n\n```python\ndingtalk_client_id = \"your_app_key\"\ndingtalk_client_secret = \"your_app_secret\"\ndingtalk_allowed_users = [\"your_staff_id\"]  # 或 ['*']\n```\n\n### 其他 App 前端\n\n除默认的 Streamlit Web UI 外，还可以尝试不同风格的前端：\n\n```bash\npython frontends/qtapp.py                # 基于 Qt 的桌面应用\nstreamlit run frontends/stapp2.py        # 另一种 Streamlit 风格 UI\n```\n\n### 通用聊天命令\n\n默认通过 `python launch.pyw` 启动的 Streamlit 桌面 UI，以及 QQ / Telegram / 飞书 / 企业微信 / 钉钉前端，都支持以下命令：\n\n- `/new` - 开启新对话并清空当前上下文\n- `/continue` - 列出可恢复会话快照\n- `/continue N` - 恢复第 `N` 个可恢复会话\n\n\n## 📊 与同类产品对比\n\n| 特性 | GenericAgent | OpenClaw | Claude Code |\n|------|:---:|:---:|:---:|\n| **代码量** | ~3K 行 | ~530,000 行 | 已开源（体量大） |\n| **部署方式** | `pip install` + API Key | 多服务编排 | CLI + 订阅 |\n| **浏览器控制** | 注入真实浏览器（保留登录态） | 沙箱 / 无头浏览器 | 通过 MCP 插件 |\n| **OS 控制** | 键鼠、视觉、ADB | 多 Agent 委派 | 文件 + 终端 |\n| **自我进化** | 自主生长 Skill 和工具 | 插件生态 | 会话间无状态 |\n| **出厂配置** | 几个核心文件 + 少量初始 Skills | 数百模块 | 丰富 CLI 工具集 |\n\n\n## 🧠 工作机制\n\nGenericAgent 通过**分层记忆 × 最小工具集 × 自主执行循环**完成复杂任务，并在执行过程中持续积累经验。\n\n1️⃣ **分层记忆系统**\n\u003e 记忆在任务执行过程中持续沉淀，使 Agent 逐步形成稳定且高效的工作方式\n\n\n- **L0 — 元规则（Meta Rules）**：Agent 的基础行为规则和系统约束\n- **L1 — 记忆索引（Insight Index）**：极简索引层，用于快速路由与召回\n- **L2 — 全局事实（Global Facts）**：在长期运行过程中积累的稳定知识\n- **L3 — 任务 Skills / SOPs**：完成特定任务类型的可复用流程\n- **L4 — 会话归档（Session Archive）**：从已完成任务中提炼出的归档记录，用于长程召回\n\n2️⃣ **自主执行循环**\n\n\u003e 感知环境状态  →  任务推理  →  调用工具执行  →  经验写入记忆  →  循环\n\n整个核心循环仅 **约百行代码**（`agent_loop.py`）。\n\n3️⃣ **最小工具集**\n\u003eGenericAgent 仅提供 **9 个原子工具**，构成与外部世界交互的基础能力\n\n| 工具 | 功能 |\n|------|------|\n| `code_run` | 执行任意代码 |\n| `file_read` | 读取文件 |\n| `file_write` | 写入文件 |\n| `file_patch` | 修改文件 |\n| `web_scan` | 感知网页内容 |\n| `web_execute_js` | 控制浏览器行为 |\n| `ask_user` | 人机协作确认 |\n\n\u003e 此外，还有 2 个**记忆管理工具**（`update_working_checkpoint`、`start_long_term_update`），使 Agent 能够跨会话积累经验、维持持久上下文。\n\n4️⃣ **能力扩展机制**\n\u003e 具备动态创建新的工具能力\n\u003e\n通过 `code_run`，GenericAgent 可在运行时动态安装 Python 包、编写新脚本、调用外部 API 或控制硬件，将临时能力固化为永久工具。\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"assets/images/workflow.jpg\" alt=\"GenericAgent 工作流程\" width=\"400\"/\u003e\n  \u003cbr\u003e\u003cem\u003eGenericAgent 工作流程图\u003c/em\u003e\n\u003c/div\u003e\n\n## ⭐ 支持\n如果这个项目对您有帮助，欢迎点一个 **Star!** 🙏\n\n同时也欢迎加入我们的**GenericAgent体验交流群**，一起交流、反馈和共建 👏\n\u003cdiv align=\"center\"\u003e\n  \u003ctable\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003e\u003cstrong\u003e微信群 9\u003c/strong\u003e\u003cbr\u003e\u003cimg src=\"assets/images/wechat_group9.jpg\" alt=\"微信群 9 二维码\" width=\"250\"/\u003e\u003c/td\u003e\n      \u003ctd align=\"center\"\u003e\u003cstrong\u003e微信群 11\u003c/strong\u003e\u003cbr\u003e\u003cimg src=\"assets/images/wechat_group11.jpg\" alt=\"微信群 11 二维码\" width=\"250\"/\u003e\u003c/td\u003e\n      \u003ctd align=\"center\"\u003e\u003cstrong\u003e微信群 12\u003c/strong\u003e\u003cbr\u003e\u003cimg src=\"assets/images/wechat_group12.jpg\" alt=\"微信群 12 二维码\" width=\"250\"/\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n\u003c/div\u003e\n\n## 🚩 友情链接\n\n感谢 **LinuxDo** 社区的支持！\n\n[![LinuxDo](https://img.shields.io/badge/社区-LinuxDo-blue?style=for-the-badge)](https://linux.do/)\n\n\n## 📄 许可\nMIT License — 详见 [LICENSE](LICENSE)\n\n*声明：本项目未构建任何商业站点；除 DintalClaw 外，目前未官方授权任何机构、组织或个人以 GenericAgent 名义从事商业活动。*\n\n## 📈 Star History\n\n\u003ca href=\"https://star-history.com/#lsdefine/GenericAgent\u0026Date\"\u003e\n \u003cpicture\u003e\n   \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/svg?repos=lsdefine/GenericAgent\u0026type=Date\u0026theme=dark\" /\u003e\n   \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/svg?repos=lsdefine/GenericAgent\u0026type=Date\" /\u003e\n   \u003cimg alt=\"Star History Chart\" src=\"https://api.star-history.com/svg?repos=lsdefine/GenericAgent\u0026type=Date\" /\u003e\n \u003c/picture\u003e\n\u003c/a\u003e\n","funding_links":[],"categories":["Personal Assistants \u0026 Conversational Agents","🤖 AI \u0026 Machine Learning","Frameworks \u0026 Libraries"],"sub_categories":["Chatbots","Single Agent"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsdefine%2FGenericAgent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flsdefine%2FGenericAgent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsdefine%2FGenericAgent/lists"}