Skip to content

Repository files navigation

GenericAgent — 3,300 Lines to Full OS Autonomy

English | 中文

A minimalist autonomous agent framework that gives any LLM physical-level control over your PC — browser, terminal, file system, keyboard, mouse, screen vision, and mobile devices — in ~3,300 lines of Python.

No Electron. No Docker. No Mac Mini. No 500K-line codebase. No paid installation service.

See It in Action


"Order me a milk tea" — navigates a delivery app, picks items, and checks out.

"Find GEM stocks with EXPMA golden cross, turnover > 5%" — quantitative screening via mootdx.

Autonomous web exploration — browses and summarizes on its own schedule.

"Find expenses over ¥2K in the past 3 months" — drives Alipay on a phone via ADB.

WeChat batch messaging — yes, it can drive WeChat too.

What Happens When You Use It

You: "Read my WeChat messages"
Agent: installs dependencies → reverse-engineers DB → writes reader script → saves as SOP
Next time: instant recall, zero setup.
You: "Monitor stock prices and alert me"
Agent: installs mootdx → builds screening workflow → sets up scheduled task → saves as SOP
Next time: one sentence to run.
You: "Send this file via Gmail"
Agent: configures OAuth → writes send script → saves as SOP
Next time: just works.

Dogfooding: This repository — from installing Git to git init, writing this README, to every commit message — was built entirely by GenericAgent without the author opening a terminal once.

Every task the agent solves becomes a permanent skill. After a few weeks, your instance has a unique skill tree — grown entirely from 3,300 lines of seed code.

The Seed Philosophy

Most agent frameworks ship as finished products. GenericAgent ships as a seed.

The 5 core SOPs define how the agent thinks, remembers, and operates. From there, every new capability is discovered and recorded by the agent itself:

  1. You ask it to do something new
  2. It figures out how (install dependencies, write scripts, test)
  3. It saves the procedure as a new SOP in its memory
  4. Next time, it recalls and executes directly

The agent doesn't just execute — it learns and remembers.

Quick Start

💡 Windows零基础用户:不知道Python是什么?下载便携版(19MB,解压即用)

# 1. Clone
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. Install minimal deps
pip install streamlit pywebview
# 3. Configure API key
cp mykey_template.py mykey.py
# Edit mykey.py with your LLM API key# 4. Launch
python launch.pyw

Also runs on Android — tested successfully on Termux with python agentmain.py (CLI frontend):

# In Termuxcd /sdcard/ga
python agentmain.py

Once running, tell the agent: "Execute web setup SOP to unlock browser tools" — it handles the rest. See WELCOME_NEW_USER.md for the full bootstrap sequence.

vs. Alternatives

GenericAgentOpenClawClaude Code
Codebase~3,300 lines~530,000 linesOpen-source (large)
Deploypip install + API keyMulti-service orchestrationCLI + subscription
BrowserInjects into real browser (keeps login state)Sandboxed/headlessVia MCP plugins
OS ControlKeyboard, mouse, vision, ADBMulti-agent delegationFile + terminal
Self-evolutionGrows SOPs & tools autonomouslyPlugin ecosystemStateless per session
Core shipped10 .py + 5 SOPsHundreds of modulesRich CLI toolkit

How It Works

User instruction
↓
┌─────────────────────┐
│ agent_loop.py (92L) │ ← Sense-Think-Act cycle
│ "What do I know? │
│ What should I do?" │
└────────┬────────────┘
↓
┌─────────────────────┐
│ 7 Atomic Tools │ ← All capabilities derive from these
│ code_run │ Execute any Python/PowerShell
│ file_read/write │ Direct disk access
│ file_patch │ Surgical code edits
│ web_scan │ Read live web pages
│ web_execute_js │ Control browser DOM
│ ask_user │ Human-in-the-loop
└────────┬────────────┘
↓
┌─────────────────────┐
│ Memory System │ ← Persistent across sessions
│ L0: Meta-SOP │ How to manage memory itself
│ L2: Global Facts │ Environment, credentials, paths
│ L3: Task SOPs │ Learned procedures (self-growing)
└─────────────────────┘

The agent starts with 7 primitive tools. Through code_run, it can install packages, write scripts, and interface with any hardware or API — effectively manufacturing new tools at runtime.

What Ships in the Box

Core engine (runs the agent):

  • agent_loop.py — Sense-Think-Act loop (92 lines)
  • ga.py — Tool definitions and execution
  • sidercall.py — LLM communication (multi-backend)
  • agentmain.py — Session orchestration

Interface (talk to the agent):

  • stapp.py — Streamlit web UI
  • tgapp.py — Telegram bot interface
  • launch.pyw — One-click launcher with floating window

Infrastructure:

  • TMWebDriver.py — Browser injection bridge (not Selenium — injects JS into your real browser via Tampermonkey)
  • simphtml.py — HTML→text cleaner for web perception

5 Core SOPs (shipped, version-controlled):

  1. memory_management_sop — L0 constitution: how the agent manages its own memory
  2. autonomous_operation_sop — Self-directed task execution
  3. scheduled_task_sop — Cron-like recurring tasks
  4. web_setup_sop — Browser environment bootstrap
  5. ljqCtrl_sop — Desktop physical control (keyboard, mouse, DPI-aware)

Everything else — Gmail integration, WeChat automation, vision APIs, game downloaders, stock analysis workflows — the agent builds and memorizes on its own through use.


GenericAgent — 3,300 行代码,完整 OS 级自主控制

一个极简自主 Agent 框架。用约 3,300 行 Python,让任意 LLM 获得对你 PC 的物理级控制能力——浏览器、终端、文件系统、键鼠、屏幕视觉、移动设备。

不需要 Electron,不需要 Docker,不需要 Mac Mini,不需要 53 万行代码,不需要付费安装服务。

用起来是什么样的

你:"帮我读取微信消息"
Agent:安装依赖 → 逆向数据库 → 写读取脚本 → 保存为 SOP
下次:一句话直接调用,零配置。
你:"帮我监控股票并提醒"
Agent:安装 mootdx → 构建选股工作流 → 设置定时任务 → 保存为 SOP
下次:一句话启动。
你:"用 Gmail 发这个文件"
Agent:配置 OAuth → 写发送脚本 → 保存为 SOP
下次:直接能用。

自举实证:本仓库从安装 Git、git init、编写 README 到每一条 commit message,全程由 GenericAgent 完成——作者没有打开过一次终端。

每个解决过的任务都会变成永久技能。用几周后,你的 Agent 实例会拥有一套独特的技能树——全部从 3,300 行种子代码中生长出来。

自举哲学

多数 Agent 框架以成品形态发布。GenericAgent 以种子形态发布。

5 个核心 SOP 定义了 Agent 如何思考、记忆和行动。之后的一切能力,由 Agent 在使用中自主发现并记录:

  1. 你让它做一件新事
  2. 它自己摸索方法(安装依赖、写脚本、测试)
  3. 把流程保存为新 SOP
  4. 下次直接调用

Agent 不只是执行——它学习并记忆

快速开始

# 1. 克隆
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. 安装最小依赖
pip install streamlit pywebview
# 3. 配置 API Key
cp mykey_template.py mykey.py
# 编辑 mykey.py 填入你的 LLM API Key# 4. 启动
python launch.pyw

同样可在 Android 上运行 — 已在 Termux 上测试通过,通过 python agentmain.py(CLI 前端)启动:

# 在 Termux 中cd /sdcard/ga
python agentmain.py

启动后告诉 Agent:"执行 web setup SOP 解锁浏览器工具"——剩下的它自己搞定。完整引导流程见 WELCOME_NEW_USER.md

对比

GenericAgentOpenClawClaude Code
代码量~3,300 行~530,000 行已开源(体量大)
部署pip install + API key多服务编排CLI + 订阅
浏览器注入真实浏览器(保留登录态)沙箱/无头浏览器通过 MCP 插件
OS 控制键鼠、视觉、ADB多 Agent 委派文件 + 终端
自我进化自主生长 SOP 和工具插件生态会话间无状态
出厂配置10 个 .py + 5 个 SOP数百模块丰富 CLI 工具集

工作原理

Agent 拥有 7 个原子工具:code_run(执行任意代码)、file_read/write/patch(文件操作)、web_scan(网页感知)、web_execute_js(浏览器控制)、ask_user(人机协作)。

通过 code_run,它可以安装任何包、编写任何脚本、对接任何硬件——相当于在运行时制造新工具。学到的流程保存为 SOP,下次直接调用。

核心循环只有 92 行(agent_loop.py):感知 → 思考 → 行动 → 记忆。

出厂清单

核心引擎

  • agent_loop.py — 感知-思考-行动循环(92 行)
  • ga.py — 工具定义与执行
  • sidercall.py — LLM 通信(多后端)
  • agentmain.py — 会话编排

交互界面

  • stapp.py — Streamlit Web UI
  • tgapp.py — Telegram 机器人
  • launch.pyw — 一键启动 + 悬浮窗

基础设施

  • TMWebDriver.py — 浏览器注入桥接(非 Selenium,通过 Tampermonkey 注入真实浏览器)
  • simphtml.py — HTML→文本清洗

5 个核心 SOP(出厂自带,版本控制):

  1. memory_management_sop — L0 宪法:Agent 如何管理自身记忆
  2. autonomous_operation_sop — 自主任务执行
  3. scheduled_task_sop — 定时任务
  4. web_setup_sop — 浏览器环境引导
  5. ljqCtrl_sop — 桌面物理控制(键鼠、DPI 感知)

其余一切——Gmail、微信自动化、视觉 API、游戏下载、股票分析——都是 Agent 在使用中自主构建并记忆的。

许可

MIT

About

AI-powered PC agent loop for desktop automation and intelligent task execution

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
GitHub - darcher005/pc-agent-loop: AI-powered PC agent loop for desktop automation and intelligent task execution · GitHub
Skip to content

Repository files navigation

GenericAgent — 3,300 Lines to Full OS Autonomy

English | 中文

A minimalist autonomous agent framework that gives any LLM physical-level control over your PC — browser, terminal, file system, keyboard, mouse, screen vision, and mobile devices — in ~3,300 lines of Python.

No Electron. No Docker. No Mac Mini. No 500K-line codebase. No paid installation service.

See It in Action


"Order me a milk tea" — navigates a delivery app, picks items, and checks out.

"Find GEM stocks with EXPMA golden cross, turnover > 5%" — quantitative screening via mootdx.

Autonomous web exploration — browses and summarizes on its own schedule.

"Find expenses over ¥2K in the past 3 months" — drives Alipay on a phone via ADB.

WeChat batch messaging — yes, it can drive WeChat too.

What Happens When You Use It

You: "Read my WeChat messages"
Agent: installs dependencies → reverse-engineers DB → writes reader script → saves as SOP
Next time: instant recall, zero setup.
You: "Monitor stock prices and alert me"
Agent: installs mootdx → builds screening workflow → sets up scheduled task → saves as SOP
Next time: one sentence to run.
You: "Send this file via Gmail"
Agent: configures OAuth → writes send script → saves as SOP
Next time: just works.

Dogfooding: This repository — from installing Git to git init, writing this README, to every commit message — was built entirely by GenericAgent without the author opening a terminal once.

Every task the agent solves becomes a permanent skill. After a few weeks, your instance has a unique skill tree — grown entirely from 3,300 lines of seed code.

The Seed Philosophy

Most agent frameworks ship as finished products. GenericAgent ships as a seed.

The 5 core SOPs define how the agent thinks, remembers, and operates. From there, every new capability is discovered and recorded by the agent itself:

  1. You ask it to do something new
  2. It figures out how (install dependencies, write scripts, test)
  3. It saves the procedure as a new SOP in its memory
  4. Next time, it recalls and executes directly

The agent doesn't just execute — it learns and remembers.

Quick Start

💡 Windows零基础用户:不知道Python是什么?下载便携版(19MB,解压即用)

# 1. Clone
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. Install minimal deps
pip install streamlit pywebview
# 3. Configure API key
cp mykey_template.py mykey.py
# Edit mykey.py with your LLM API key# 4. Launch
python launch.pyw

Also runs on Android — tested successfully on Termux with python agentmain.py (CLI frontend):

# In Termuxcd /sdcard/ga
python agentmain.py

Once running, tell the agent: "Execute web setup SOP to unlock browser tools" — it handles the rest. See WELCOME_NEW_USER.md for the full bootstrap sequence.

vs. Alternatives

GenericAgentOpenClawClaude Code
Codebase~3,300 lines~530,000 linesOpen-source (large)
Deploypip install + API keyMulti-service orchestrationCLI + subscription
BrowserInjects into real browser (keeps login state)Sandboxed/headlessVia MCP plugins
OS ControlKeyboard, mouse, vision, ADBMulti-agent delegationFile + terminal
Self-evolutionGrows SOPs & tools autonomouslyPlugin ecosystemStateless per session
Core shipped10 .py + 5 SOPsHundreds of modulesRich CLI toolkit

How It Works

User instruction
↓
┌─────────────────────┐
│ agent_loop.py (92L) │ ← Sense-Think-Act cycle
│ "What do I know? │
│ What should I do?" │
└────────┬────────────┘
↓
┌─────────────────────┐
│ 7 Atomic Tools │ ← All capabilities derive from these
│ code_run │ Execute any Python/PowerShell
│ file_read/write │ Direct disk access
│ file_patch │ Surgical code edits
│ web_scan │ Read live web pages
│ web_execute_js │ Control browser DOM
│ ask_user │ Human-in-the-loop
└────────┬────────────┘
↓
┌─────────────────────┐
│ Memory System │ ← Persistent across sessions
│ L0: Meta-SOP │ How to manage memory itself
│ L2: Global Facts │ Environment, credentials, paths
│ L3: Task SOPs │ Learned procedures (self-growing)
└─────────────────────┘

The agent starts with 7 primitive tools. Through code_run, it can install packages, write scripts, and interface with any hardware or API — effectively manufacturing new tools at runtime.

What Ships in the Box

Core engine (runs the agent):

  • agent_loop.py — Sense-Think-Act loop (92 lines)
  • ga.py — Tool definitions and execution
  • sidercall.py — LLM communication (multi-backend)
  • agentmain.py — Session orchestration

Interface (talk to the agent):

  • stapp.py — Streamlit web UI
  • tgapp.py — Telegram bot interface
  • launch.pyw — One-click launcher with floating window

Infrastructure:

  • TMWebDriver.py — Browser injection bridge (not Selenium — injects JS into your real browser via Tampermonkey)
  • simphtml.py — HTML→text cleaner for web perception

5 Core SOPs (shipped, version-controlled):

  1. memory_management_sop — L0 constitution: how the agent manages its own memory
  2. autonomous_operation_sop — Self-directed task execution
  3. scheduled_task_sop — Cron-like recurring tasks
  4. web_setup_sop — Browser environment bootstrap
  5. ljqCtrl_sop — Desktop physical control (keyboard, mouse, DPI-aware)

Everything else — Gmail integration, WeChat automation, vision APIs, game downloaders, stock analysis workflows — the agent builds and memorizes on its own through use.


GenericAgent — 3,300 行代码,完整 OS 级自主控制

一个极简自主 Agent 框架。用约 3,300 行 Python,让任意 LLM 获得对你 PC 的物理级控制能力——浏览器、终端、文件系统、键鼠、屏幕视觉、移动设备。

不需要 Electron,不需要 Docker,不需要 Mac Mini,不需要 53 万行代码,不需要付费安装服务。

用起来是什么样的

你:"帮我读取微信消息"
Agent:安装依赖 → 逆向数据库 → 写读取脚本 → 保存为 SOP
下次:一句话直接调用,零配置。
你:"帮我监控股票并提醒"
Agent:安装 mootdx → 构建选股工作流 → 设置定时任务 → 保存为 SOP
下次:一句话启动。
你:"用 Gmail 发这个文件"
Agent:配置 OAuth → 写发送脚本 → 保存为 SOP
下次:直接能用。

自举实证:本仓库从安装 Git、git init、编写 README 到每一条 commit message,全程由 GenericAgent 完成——作者没有打开过一次终端。

每个解决过的任务都会变成永久技能。用几周后,你的 Agent 实例会拥有一套独特的技能树——全部从 3,300 行种子代码中生长出来。

自举哲学

多数 Agent 框架以成品形态发布。GenericAgent 以种子形态发布。

5 个核心 SOP 定义了 Agent 如何思考、记忆和行动。之后的一切能力,由 Agent 在使用中自主发现并记录:

  1. 你让它做一件新事
  2. 它自己摸索方法(安装依赖、写脚本、测试)
  3. 把流程保存为新 SOP
  4. 下次直接调用

Agent 不只是执行——它学习并记忆

快速开始

# 1. 克隆
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. 安装最小依赖
pip install streamlit pywebview
# 3. 配置 API Key
cp mykey_template.py mykey.py
# 编辑 mykey.py 填入你的 LLM API Key# 4. 启动
python launch.pyw

同样可在 Android 上运行 — 已在 Termux 上测试通过,通过 python agentmain.py(CLI 前端)启动:

# 在 Termux 中cd /sdcard/ga
python agentmain.py

启动后告诉 Agent:"执行 web setup SOP 解锁浏览器工具"——剩下的它自己搞定。完整引导流程见 WELCOME_NEW_USER.md

对比

GenericAgentOpenClawClaude Code
代码量~3,300 行~530,000 行已开源(体量大)
部署pip install + API key多服务编排CLI + 订阅
浏览器注入真实浏览器(保留登录态)沙箱/无头浏览器通过 MCP 插件
OS 控制键鼠、视觉、ADB多 Agent 委派文件 + 终端
自我进化自主生长 SOP 和工具插件生态会话间无状态
出厂配置10 个 .py + 5 个 SOP数百模块丰富 CLI 工具集

工作原理

Agent 拥有 7 个原子工具:code_run(执行任意代码)、file_read/write/patch(文件操作)、web_scan(网页感知)、web_execute_js(浏览器控制)、ask_user(人机协作)。

通过 code_run,它可以安装任何包、编写任何脚本、对接任何硬件——相当于在运行时制造新工具。学到的流程保存为 SOP,下次直接调用。

核心循环只有 92 行(agent_loop.py):感知 → 思考 → 行动 → 记忆。

出厂清单

核心引擎

  • agent_loop.py — 感知-思考-行动循环(92 行)
  • ga.py — 工具定义与执行
  • sidercall.py — LLM 通信(多后端)
  • agentmain.py — 会话编排

交互界面

  • stapp.py — Streamlit Web UI
  • tgapp.py — Telegram 机器人
  • launch.pyw — 一键启动 + 悬浮窗

基础设施

  • TMWebDriver.py — 浏览器注入桥接(非 Selenium,通过 Tampermonkey 注入真实浏览器)
  • simphtml.py — HTML→文本清洗

5 个核心 SOP(出厂自带,版本控制):

  1. memory_management_sop — L0 宪法:Agent 如何管理自身记忆
  2. autonomous_operation_sop — 自主任务执行
  3. scheduled_task_sop — 定时任务
  4. web_setup_sop — 浏览器环境引导
  5. ljqCtrl_sop — 桌面物理控制(键鼠、DPI 感知)

其余一切——Gmail、微信自动化、视觉 API、游戏下载、股票分析——都是 Agent 在使用中自主构建并记忆的。

许可

MIT

About

AI-powered PC agent loop for desktop automation and intelligent task execution

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - darcher005/pc-agent-loop: AI-powered PC agent loop for desktop automation and intelligent task execution · GitHub
Skip to content

Repository files navigation

GenericAgent — 3,300 Lines to Full OS Autonomy

English | 中文

A minimalist autonomous agent framework that gives any LLM physical-level control over your PC — browser, terminal, file system, keyboard, mouse, screen vision, and mobile devices — in ~3,300 lines of Python.

No Electron. No Docker. No Mac Mini. No 500K-line codebase. No paid installation service.

See It in Action


"Order me a milk tea" — navigates a delivery app, picks items, and checks out.

"Find GEM stocks with EXPMA golden cross, turnover > 5%" — quantitative screening via mootdx.

Autonomous web exploration — browses and summarizes on its own schedule.

"Find expenses over ¥2K in the past 3 months" — drives Alipay on a phone via ADB.

WeChat batch messaging — yes, it can drive WeChat too.

What Happens When You Use It

You: "Read my WeChat messages"
Agent: installs dependencies → reverse-engineers DB → writes reader script → saves as SOP
Next time: instant recall, zero setup.
You: "Monitor stock prices and alert me"
Agent: installs mootdx → builds screening workflow → sets up scheduled task → saves as SOP
Next time: one sentence to run.
You: "Send this file via Gmail"
Agent: configures OAuth → writes send script → saves as SOP
Next time: just works.

Dogfooding: This repository — from installing Git to git init, writing this README, to every commit message — was built entirely by GenericAgent without the author opening a terminal once.

Every task the agent solves becomes a permanent skill. After a few weeks, your instance has a unique skill tree — grown entirely from 3,300 lines of seed code.

The Seed Philosophy

Most agent frameworks ship as finished products. GenericAgent ships as a seed.

The 5 core SOPs define how the agent thinks, remembers, and operates. From there, every new capability is discovered and recorded by the agent itself:

  1. You ask it to do something new
  2. It figures out how (install dependencies, write scripts, test)
  3. It saves the procedure as a new SOP in its memory
  4. Next time, it recalls and executes directly

The agent doesn't just execute — it learns and remembers.

Quick Start

💡 Windows零基础用户:不知道Python是什么?下载便携版(19MB,解压即用)

# 1. Clone
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. Install minimal deps
pip install streamlit pywebview
# 3. Configure API key
cp mykey_template.py mykey.py
# Edit mykey.py with your LLM API key# 4. Launch
python launch.pyw

Also runs on Android — tested successfully on Termux with python agentmain.py (CLI frontend):

# In Termuxcd /sdcard/ga
python agentmain.py

Once running, tell the agent: "Execute web setup SOP to unlock browser tools" — it handles the rest. See WELCOME_NEW_USER.md for the full bootstrap sequence.

vs. Alternatives

GenericAgentOpenClawClaude Code
Codebase~3,300 lines~530,000 linesOpen-source (large)
Deploypip install + API keyMulti-service orchestrationCLI + subscription
BrowserInjects into real browser (keeps login state)Sandboxed/headlessVia MCP plugins
OS ControlKeyboard, mouse, vision, ADBMulti-agent delegationFile + terminal
Self-evolutionGrows SOPs & tools autonomouslyPlugin ecosystemStateless per session
Core shipped10 .py + 5 SOPsHundreds of modulesRich CLI toolkit

How It Works

User instruction
↓
┌─────────────────────┐
│ agent_loop.py (92L) │ ← Sense-Think-Act cycle
│ "What do I know? │
│ What should I do?" │
└────────┬────────────┘
↓
┌─────────────────────┐
│ 7 Atomic Tools │ ← All capabilities derive from these
│ code_run │ Execute any Python/PowerShell
│ file_read/write │ Direct disk access
│ file_patch │ Surgical code edits
│ web_scan │ Read live web pages
│ web_execute_js │ Control browser DOM
│ ask_user │ Human-in-the-loop
└────────┬────────────┘
↓
┌─────────────────────┐
│ Memory System │ ← Persistent across sessions
│ L0: Meta-SOP │ How to manage memory itself
│ L2: Global Facts │ Environment, credentials, paths
│ L3: Task SOPs │ Learned procedures (self-growing)
└─────────────────────┘

The agent starts with 7 primitive tools. Through code_run, it can install packages, write scripts, and interface with any hardware or API — effectively manufacturing new tools at runtime.

What Ships in the Box

Core engine (runs the agent):

  • agent_loop.py — Sense-Think-Act loop (92 lines)
  • ga.py — Tool definitions and execution
  • sidercall.py — LLM communication (multi-backend)
  • agentmain.py — Session orchestration

Interface (talk to the agent):

  • stapp.py — Streamlit web UI
  • tgapp.py — Telegram bot interface
  • launch.pyw — One-click launcher with floating window

Infrastructure:

  • TMWebDriver.py — Browser injection bridge (not Selenium — injects JS into your real browser via Tampermonkey)
  • simphtml.py — HTML→text cleaner for web perception

5 Core SOPs (shipped, version-controlled):

  1. memory_management_sop — L0 constitution: how the agent manages its own memory
  2. autonomous_operation_sop — Self-directed task execution
  3. scheduled_task_sop — Cron-like recurring tasks
  4. web_setup_sop — Browser environment bootstrap
  5. ljqCtrl_sop — Desktop physical control (keyboard, mouse, DPI-aware)

Everything else — Gmail integration, WeChat automation, vision APIs, game downloaders, stock analysis workflows — the agent builds and memorizes on its own through use.


GenericAgent — 3,300 行代码,完整 OS 级自主控制

一个极简自主 Agent 框架。用约 3,300 行 Python,让任意 LLM 获得对你 PC 的物理级控制能力——浏览器、终端、文件系统、键鼠、屏幕视觉、移动设备。

不需要 Electron,不需要 Docker,不需要 Mac Mini,不需要 53 万行代码,不需要付费安装服务。

用起来是什么样的

你:"帮我读取微信消息"
Agent:安装依赖 → 逆向数据库 → 写读取脚本 → 保存为 SOP
下次:一句话直接调用,零配置。
你:"帮我监控股票并提醒"
Agent:安装 mootdx → 构建选股工作流 → 设置定时任务 → 保存为 SOP
下次:一句话启动。
你:"用 Gmail 发这个文件"
Agent:配置 OAuth → 写发送脚本 → 保存为 SOP
下次:直接能用。

自举实证:本仓库从安装 Git、git init、编写 README 到每一条 commit message,全程由 GenericAgent 完成——作者没有打开过一次终端。

每个解决过的任务都会变成永久技能。用几周后,你的 Agent 实例会拥有一套独特的技能树——全部从 3,300 行种子代码中生长出来。

自举哲学

多数 Agent 框架以成品形态发布。GenericAgent 以种子形态发布。

5 个核心 SOP 定义了 Agent 如何思考、记忆和行动。之后的一切能力,由 Agent 在使用中自主发现并记录:

  1. 你让它做一件新事
  2. 它自己摸索方法(安装依赖、写脚本、测试)
  3. 把流程保存为新 SOP
  4. 下次直接调用

Agent 不只是执行——它学习并记忆

快速开始

# 1. 克隆
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. 安装最小依赖
pip install streamlit pywebview
# 3. 配置 API Key
cp mykey_template.py mykey.py
# 编辑 mykey.py 填入你的 LLM API Key# 4. 启动
python launch.pyw

同样可在 Android 上运行 — 已在 Termux 上测试通过,通过 python agentmain.py(CLI 前端)启动:

# 在 Termux 中cd /sdcard/ga
python agentmain.py

启动后告诉 Agent:"执行 web setup SOP 解锁浏览器工具"——剩下的它自己搞定。完整引导流程见 WELCOME_NEW_USER.md

对比

GenericAgentOpenClawClaude Code
代码量~3,300 行~530,000 行已开源(体量大)
部署pip install + API key多服务编排CLI + 订阅
浏览器注入真实浏览器(保留登录态)沙箱/无头浏览器通过 MCP 插件
OS 控制键鼠、视觉、ADB多 Agent 委派文件 + 终端
自我进化自主生长 SOP 和工具插件生态会话间无状态
出厂配置10 个 .py + 5 个 SOP数百模块丰富 CLI 工具集

工作原理

Agent 拥有 7 个原子工具:code_run(执行任意代码)、file_read/write/patch(文件操作)、web_scan(网页感知)、web_execute_js(浏览器控制)、ask_user(人机协作)。

通过 code_run,它可以安装任何包、编写任何脚本、对接任何硬件——相当于在运行时制造新工具。学到的流程保存为 SOP,下次直接调用。

核心循环只有 92 行(agent_loop.py):感知 → 思考 → 行动 → 记忆。

出厂清单

核心引擎

  • agent_loop.py — 感知-思考-行动循环(92 行)
  • ga.py — 工具定义与执行
  • sidercall.py — LLM 通信(多后端)
  • agentmain.py — 会话编排

交互界面

  • stapp.py — Streamlit Web UI
  • tgapp.py — Telegram 机器人
  • launch.pyw — 一键启动 + 悬浮窗

基础设施

  • TMWebDriver.py — 浏览器注入桥接(非 Selenium,通过 Tampermonkey 注入真实浏览器)
  • simphtml.py — HTML→文本清洗

5 个核心 SOP(出厂自带,版本控制):

  1. memory_management_sop — L0 宪法:Agent 如何管理自身记忆
  2. autonomous_operation_sop — 自主任务执行
  3. scheduled_task_sop — 定时任务
  4. web_setup_sop — 浏览器环境引导
  5. ljqCtrl_sop — 桌面物理控制(键鼠、DPI 感知)

其余一切——Gmail、微信自动化、视觉 API、游戏下载、股票分析——都是 Agent 在使用中自主构建并记忆的。

许可

MIT

About

AI-powered PC agent loop for desktop automation and intelligent task execution

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - darcher005/pc-agent-loop: AI-powered PC agent loop for desktop automation and intelligent task execution · GitHub
Skip to content

Repository files navigation

GenericAgent — 3,300 Lines to Full OS Autonomy

English | 中文

A minimalist autonomous agent framework that gives any LLM physical-level control over your PC — browser, terminal, file system, keyboard, mouse, screen vision, and mobile devices — in ~3,300 lines of Python.

No Electron. No Docker. No Mac Mini. No 500K-line codebase. No paid installation service.

See It in Action


"Order me a milk tea" — navigates a delivery app, picks items, and checks out.

"Find GEM stocks with EXPMA golden cross, turnover > 5%" — quantitative screening via mootdx.

Autonomous web exploration — browses and summarizes on its own schedule.

"Find expenses over ¥2K in the past 3 months" — drives Alipay on a phone via ADB.

WeChat batch messaging — yes, it can drive WeChat too.

What Happens When You Use It

You: "Read my WeChat messages"
Agent: installs dependencies → reverse-engineers DB → writes reader script → saves as SOP
Next time: instant recall, zero setup.
You: "Monitor stock prices and alert me"
Agent: installs mootdx → builds screening workflow → sets up scheduled task → saves as SOP
Next time: one sentence to run.
You: "Send this file via Gmail"
Agent: configures OAuth → writes send script → saves as SOP
Next time: just works.

Dogfooding: This repository — from installing Git to git init, writing this README, to every commit message — was built entirely by GenericAgent without the author opening a terminal once.

Every task the agent solves becomes a permanent skill. After a few weeks, your instance has a unique skill tree — grown entirely from 3,300 lines of seed code.

The Seed Philosophy

Most agent frameworks ship as finished products. GenericAgent ships as a seed.

The 5 core SOPs define how the agent thinks, remembers, and operates. From there, every new capability is discovered and recorded by the agent itself:

  1. You ask it to do something new
  2. It figures out how (install dependencies, write scripts, test)
  3. It saves the procedure as a new SOP in its memory
  4. Next time, it recalls and executes directly

The agent doesn't just execute — it learns and remembers.

Quick Start

💡 Windows零基础用户:不知道Python是什么?下载便携版(19MB,解压即用)

# 1. Clone
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. Install minimal deps
pip install streamlit pywebview
# 3. Configure API key
cp mykey_template.py mykey.py
# Edit mykey.py with your LLM API key# 4. Launch
python launch.pyw

Also runs on Android — tested successfully on Termux with python agentmain.py (CLI frontend):

# In Termuxcd /sdcard/ga
python agentmain.py

Once running, tell the agent: "Execute web setup SOP to unlock browser tools" — it handles the rest. See WELCOME_NEW_USER.md for the full bootstrap sequence.

vs. Alternatives

GenericAgentOpenClawClaude Code
Codebase~3,300 lines~530,000 linesOpen-source (large)
Deploypip install + API keyMulti-service orchestrationCLI + subscription
BrowserInjects into real browser (keeps login state)Sandboxed/headlessVia MCP plugins
OS ControlKeyboard, mouse, vision, ADBMulti-agent delegationFile + terminal
Self-evolutionGrows SOPs & tools autonomouslyPlugin ecosystemStateless per session
Core shipped10 .py + 5 SOPsHundreds of modulesRich CLI toolkit

How It Works

User instruction
↓
┌─────────────────────┐
│ agent_loop.py (92L) │ ← Sense-Think-Act cycle
│ "What do I know? │
│ What should I do?" │
└────────┬────────────┘
↓
┌─────────────────────┐
│ 7 Atomic Tools │ ← All capabilities derive from these
│ code_run │ Execute any Python/PowerShell
│ file_read/write │ Direct disk access
│ file_patch │ Surgical code edits
│ web_scan │ Read live web pages
│ web_execute_js │ Control browser DOM
│ ask_user │ Human-in-the-loop
└────────┬────────────┘
↓
┌─────────────────────┐
│ Memory System │ ← Persistent across sessions
│ L0: Meta-SOP │ How to manage memory itself
│ L2: Global Facts │ Environment, credentials, paths
│ L3: Task SOPs │ Learned procedures (self-growing)
└─────────────────────┘

The agent starts with 7 primitive tools. Through code_run, it can install packages, write scripts, and interface with any hardware or API — effectively manufacturing new tools at runtime.

What Ships in the Box

Core engine (runs the agent):

  • agent_loop.py — Sense-Think-Act loop (92 lines)
  • ga.py — Tool definitions and execution
  • sidercall.py — LLM communication (multi-backend)
  • agentmain.py — Session orchestration

Interface (talk to the agent):

  • stapp.py — Streamlit web UI
  • tgapp.py — Telegram bot interface
  • launch.pyw — One-click launcher with floating window

Infrastructure:

  • TMWebDriver.py — Browser injection bridge (not Selenium — injects JS into your real browser via Tampermonkey)
  • simphtml.py — HTML→text cleaner for web perception

5 Core SOPs (shipped, version-controlled):

  1. memory_management_sop — L0 constitution: how the agent manages its own memory
  2. autonomous_operation_sop — Self-directed task execution
  3. scheduled_task_sop — Cron-like recurring tasks
  4. web_setup_sop — Browser environment bootstrap
  5. ljqCtrl_sop — Desktop physical control (keyboard, mouse, DPI-aware)

Everything else — Gmail integration, WeChat automation, vision APIs, game downloaders, stock analysis workflows — the agent builds and memorizes on its own through use.


GenericAgent — 3,300 行代码,完整 OS 级自主控制

一个极简自主 Agent 框架。用约 3,300 行 Python,让任意 LLM 获得对你 PC 的物理级控制能力——浏览器、终端、文件系统、键鼠、屏幕视觉、移动设备。

不需要 Electron,不需要 Docker,不需要 Mac Mini,不需要 53 万行代码,不需要付费安装服务。

用起来是什么样的

你:"帮我读取微信消息"
Agent:安装依赖 → 逆向数据库 → 写读取脚本 → 保存为 SOP
下次:一句话直接调用,零配置。
你:"帮我监控股票并提醒"
Agent:安装 mootdx → 构建选股工作流 → 设置定时任务 → 保存为 SOP
下次:一句话启动。
你:"用 Gmail 发这个文件"
Agent:配置 OAuth → 写发送脚本 → 保存为 SOP
下次:直接能用。

自举实证:本仓库从安装 Git、git init、编写 README 到每一条 commit message,全程由 GenericAgent 完成——作者没有打开过一次终端。

每个解决过的任务都会变成永久技能。用几周后,你的 Agent 实例会拥有一套独特的技能树——全部从 3,300 行种子代码中生长出来。

自举哲学

多数 Agent 框架以成品形态发布。GenericAgent 以种子形态发布。

5 个核心 SOP 定义了 Agent 如何思考、记忆和行动。之后的一切能力,由 Agent 在使用中自主发现并记录:

  1. 你让它做一件新事
  2. 它自己摸索方法(安装依赖、写脚本、测试)
  3. 把流程保存为新 SOP
  4. 下次直接调用

Agent 不只是执行——它学习并记忆

快速开始

# 1. 克隆
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. 安装最小依赖
pip install streamlit pywebview
# 3. 配置 API Key
cp mykey_template.py mykey.py
# 编辑 mykey.py 填入你的 LLM API Key# 4. 启动
python launch.pyw

同样可在 Android 上运行 — 已在 Termux 上测试通过,通过 python agentmain.py(CLI 前端)启动:

# 在 Termux 中cd /sdcard/ga
python agentmain.py

启动后告诉 Agent:"执行 web setup SOP 解锁浏览器工具"——剩下的它自己搞定。完整引导流程见 WELCOME_NEW_USER.md

对比

GenericAgentOpenClawClaude Code
代码量~3,300 行~530,000 行已开源(体量大)
部署pip install + API key多服务编排CLI + 订阅
浏览器注入真实浏览器(保留登录态)沙箱/无头浏览器通过 MCP 插件
OS 控制键鼠、视觉、ADB多 Agent 委派文件 + 终端
自我进化自主生长 SOP 和工具插件生态会话间无状态
出厂配置10 个 .py + 5 个 SOP数百模块丰富 CLI 工具集

工作原理

Agent 拥有 7 个原子工具:code_run(执行任意代码)、file_read/write/patch(文件操作)、web_scan(网页感知)、web_execute_js(浏览器控制)、ask_user(人机协作)。

通过 code_run,它可以安装任何包、编写任何脚本、对接任何硬件——相当于在运行时制造新工具。学到的流程保存为 SOP,下次直接调用。

核心循环只有 92 行(agent_loop.py):感知 → 思考 → 行动 → 记忆。

出厂清单

核心引擎

  • agent_loop.py — 感知-思考-行动循环(92 行)
  • ga.py — 工具定义与执行
  • sidercall.py — LLM 通信(多后端)
  • agentmain.py — 会话编排

交互界面

  • stapp.py — Streamlit Web UI
  • tgapp.py — Telegram 机器人
  • launch.pyw — 一键启动 + 悬浮窗

基础设施

  • TMWebDriver.py — 浏览器注入桥接(非 Selenium,通过 Tampermonkey 注入真实浏览器)
  • simphtml.py — HTML→文本清洗

5 个核心 SOP(出厂自带,版本控制):

  1. memory_management_sop — L0 宪法:Agent 如何管理自身记忆
  2. autonomous_operation_sop — 自主任务执行
  3. scheduled_task_sop — 定时任务
  4. web_setup_sop — 浏览器环境引导
  5. ljqCtrl_sop — 桌面物理控制(键鼠、DPI 感知)

其余一切——Gmail、微信自动化、视觉 API、游戏下载、股票分析——都是 Agent 在使用中自主构建并记忆的。

许可

MIT

About

AI-powered PC agent loop for desktop automation and intelligent task execution

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' GitHub - darcher005/pc-agent-loop: AI-powered PC agent loop for desktop automation and intelligent task execution · GitHub
Skip to content

Repository files navigation

GenericAgent — 3,300 Lines to Full OS Autonomy

English | 中文

A minimalist autonomous agent framework that gives any LLM physical-level control over your PC — browser, terminal, file system, keyboard, mouse, screen vision, and mobile devices — in ~3,300 lines of Python.

No Electron. No Docker. No Mac Mini. No 500K-line codebase. No paid installation service.

See It in Action


"Order me a milk tea" — navigates a delivery app, picks items, and checks out.

"Find GEM stocks with EXPMA golden cross, turnover > 5%" — quantitative screening via mootdx.

Autonomous web exploration — browses and summarizes on its own schedule.

"Find expenses over ¥2K in the past 3 months" — drives Alipay on a phone via ADB.

WeChat batch messaging — yes, it can drive WeChat too.

What Happens When You Use It

You: "Read my WeChat messages"
Agent: installs dependencies → reverse-engineers DB → writes reader script → saves as SOP
Next time: instant recall, zero setup.
You: "Monitor stock prices and alert me"
Agent: installs mootdx → builds screening workflow → sets up scheduled task → saves as SOP
Next time: one sentence to run.
You: "Send this file via Gmail"
Agent: configures OAuth → writes send script → saves as SOP
Next time: just works.

Dogfooding: This repository — from installing Git to git init, writing this README, to every commit message — was built entirely by GenericAgent without the author opening a terminal once.

Every task the agent solves becomes a permanent skill. After a few weeks, your instance has a unique skill tree — grown entirely from 3,300 lines of seed code.

The Seed Philosophy

Most agent frameworks ship as finished products. GenericAgent ships as a seed.

The 5 core SOPs define how the agent thinks, remembers, and operates. From there, every new capability is discovered and recorded by the agent itself:

  1. You ask it to do something new
  2. It figures out how (install dependencies, write scripts, test)
  3. It saves the procedure as a new SOP in its memory
  4. Next time, it recalls and executes directly

The agent doesn't just execute — it learns and remembers.

Quick Start

💡 Windows零基础用户:不知道Python是什么?下载便携版(19MB,解压即用)

# 1. Clone
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. Install minimal deps
pip install streamlit pywebview
# 3. Configure API key
cp mykey_template.py mykey.py
# Edit mykey.py with your LLM API key# 4. Launch
python launch.pyw

Also runs on Android — tested successfully on Termux with python agentmain.py (CLI frontend):

# In Termuxcd /sdcard/ga
python agentmain.py

Once running, tell the agent: "Execute web setup SOP to unlock browser tools" — it handles the rest. See WELCOME_NEW_USER.md for the full bootstrap sequence.

vs. Alternatives

GenericAgentOpenClawClaude Code
Codebase~3,300 lines~530,000 linesOpen-source (large)
Deploypip install + API keyMulti-service orchestrationCLI + subscription
BrowserInjects into real browser (keeps login state)Sandboxed/headlessVia MCP plugins
OS ControlKeyboard, mouse, vision, ADBMulti-agent delegationFile + terminal
Self-evolutionGrows SOPs & tools autonomouslyPlugin ecosystemStateless per session
Core shipped10 .py + 5 SOPsHundreds of modulesRich CLI toolkit

How It Works

User instruction
↓
┌─────────────────────┐
│ agent_loop.py (92L) │ ← Sense-Think-Act cycle
│ "What do I know? │
│ What should I do?" │
└────────┬────────────┘
↓
┌─────────────────────┐
│ 7 Atomic Tools │ ← All capabilities derive from these
│ code_run │ Execute any Python/PowerShell
│ file_read/write │ Direct disk access
│ file_patch │ Surgical code edits
│ web_scan │ Read live web pages
│ web_execute_js │ Control browser DOM
│ ask_user │ Human-in-the-loop
└────────┬────────────┘
↓
┌─────────────────────┐
│ Memory System │ ← Persistent across sessions
│ L0: Meta-SOP │ How to manage memory itself
│ L2: Global Facts │ Environment, credentials, paths
│ L3: Task SOPs │ Learned procedures (self-growing)
└─────────────────────┘

The agent starts with 7 primitive tools. Through code_run, it can install packages, write scripts, and interface with any hardware or API — effectively manufacturing new tools at runtime.

What Ships in the Box

Core engine (runs the agent):

  • agent_loop.py — Sense-Think-Act loop (92 lines)
  • ga.py — Tool definitions and execution
  • sidercall.py — LLM communication (multi-backend)
  • agentmain.py — Session orchestration

Interface (talk to the agent):

  • stapp.py — Streamlit web UI
  • tgapp.py — Telegram bot interface
  • launch.pyw — One-click launcher with floating window

Infrastructure:

  • TMWebDriver.py — Browser injection bridge (not Selenium — injects JS into your real browser via Tampermonkey)
  • simphtml.py — HTML→text cleaner for web perception

5 Core SOPs (shipped, version-controlled):

  1. memory_management_sop — L0 constitution: how the agent manages its own memory
  2. autonomous_operation_sop — Self-directed task execution
  3. scheduled_task_sop — Cron-like recurring tasks
  4. web_setup_sop — Browser environment bootstrap
  5. ljqCtrl_sop — Desktop physical control (keyboard, mouse, DPI-aware)

Everything else — Gmail integration, WeChat automation, vision APIs, game downloaders, stock analysis workflows — the agent builds and memorizes on its own through use.


GenericAgent — 3,300 行代码,完整 OS 级自主控制

一个极简自主 Agent 框架。用约 3,300 行 Python,让任意 LLM 获得对你 PC 的物理级控制能力——浏览器、终端、文件系统、键鼠、屏幕视觉、移动设备。

不需要 Electron,不需要 Docker,不需要 Mac Mini,不需要 53 万行代码,不需要付费安装服务。

用起来是什么样的

你:"帮我读取微信消息"
Agent:安装依赖 → 逆向数据库 → 写读取脚本 → 保存为 SOP
下次:一句话直接调用,零配置。
你:"帮我监控股票并提醒"
Agent:安装 mootdx → 构建选股工作流 → 设置定时任务 → 保存为 SOP
下次:一句话启动。
你:"用 Gmail 发这个文件"
Agent:配置 OAuth → 写发送脚本 → 保存为 SOP
下次:直接能用。

自举实证:本仓库从安装 Git、git init、编写 README 到每一条 commit message,全程由 GenericAgent 完成——作者没有打开过一次终端。

每个解决过的任务都会变成永久技能。用几周后,你的 Agent 实例会拥有一套独特的技能树——全部从 3,300 行种子代码中生长出来。

自举哲学

多数 Agent 框架以成品形态发布。GenericAgent 以种子形态发布。

5 个核心 SOP 定义了 Agent 如何思考、记忆和行动。之后的一切能力,由 Agent 在使用中自主发现并记录:

  1. 你让它做一件新事
  2. 它自己摸索方法(安装依赖、写脚本、测试)
  3. 把流程保存为新 SOP
  4. 下次直接调用

Agent 不只是执行——它学习并记忆

快速开始

# 1. 克隆
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. 安装最小依赖
pip install streamlit pywebview
# 3. 配置 API Key
cp mykey_template.py mykey.py
# 编辑 mykey.py 填入你的 LLM API Key# 4. 启动
python launch.pyw

同样可在 Android 上运行 — 已在 Termux 上测试通过,通过 python agentmain.py(CLI 前端)启动:

# 在 Termux 中cd /sdcard/ga
python agentmain.py

启动后告诉 Agent:"执行 web setup SOP 解锁浏览器工具"——剩下的它自己搞定。完整引导流程见 WELCOME_NEW_USER.md

对比

GenericAgentOpenClawClaude Code
代码量~3,300 行~530,000 行已开源(体量大)
部署pip install + API key多服务编排CLI + 订阅
浏览器注入真实浏览器(保留登录态)沙箱/无头浏览器通过 MCP 插件
OS 控制键鼠、视觉、ADB多 Agent 委派文件 + 终端
自我进化自主生长 SOP 和工具插件生态会话间无状态
出厂配置10 个 .py + 5 个 SOP数百模块丰富 CLI 工具集

工作原理

Agent 拥有 7 个原子工具:code_run(执行任意代码)、file_read/write/patch(文件操作)、web_scan(网页感知)、web_execute_js(浏览器控制)、ask_user(人机协作)。

通过 code_run,它可以安装任何包、编写任何脚本、对接任何硬件——相当于在运行时制造新工具。学到的流程保存为 SOP,下次直接调用。

核心循环只有 92 行(agent_loop.py):感知 → 思考 → 行动 → 记忆。

出厂清单

核心引擎

  • agent_loop.py — 感知-思考-行动循环(92 行)
  • ga.py — 工具定义与执行
  • sidercall.py — LLM 通信(多后端)
  • agentmain.py — 会话编排

交互界面

  • stapp.py — Streamlit Web UI
  • tgapp.py — Telegram 机器人
  • launch.pyw — 一键启动 + 悬浮窗

基础设施

  • TMWebDriver.py — 浏览器注入桥接(非 Selenium,通过 Tampermonkey 注入真实浏览器)
  • simphtml.py — HTML→文本清洗

5 个核心 SOP(出厂自带,版本控制):

  1. memory_management_sop — L0 宪法:Agent 如何管理自身记忆
  2. autonomous_operation_sop — 自主任务执行
  3. scheduled_task_sop — 定时任务
  4. web_setup_sop — 浏览器环境引导
  5. ljqCtrl_sop — 桌面物理控制(键鼠、DPI 感知)

其余一切——Gmail、微信自动化、视觉 API、游戏下载、股票分析——都是 Agent 在使用中自主构建并记忆的。

许可

MIT

About

AI-powered PC agent loop for desktop automation and intelligent task execution

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - darcher005/pc-agent-loop: AI-powered PC agent loop for desktop automation and intelligent task execution · GitHub
Skip to content

Repository files navigation

GenericAgent — 3,300 Lines to Full OS Autonomy

English | 中文

A minimalist autonomous agent framework that gives any LLM physical-level control over your PC — browser, terminal, file system, keyboard, mouse, screen vision, and mobile devices — in ~3,300 lines of Python.

No Electron. No Docker. No Mac Mini. No 500K-line codebase. No paid installation service.

See It in Action


"Order me a milk tea" — navigates a delivery app, picks items, and checks out.

"Find GEM stocks with EXPMA golden cross, turnover > 5%" — quantitative screening via mootdx.

Autonomous web exploration — browses and summarizes on its own schedule.

"Find expenses over ¥2K in the past 3 months" — drives Alipay on a phone via ADB.

WeChat batch messaging — yes, it can drive WeChat too.

What Happens When You Use It

You: "Read my WeChat messages"
Agent: installs dependencies → reverse-engineers DB → writes reader script → saves as SOP
Next time: instant recall, zero setup.
You: "Monitor stock prices and alert me"
Agent: installs mootdx → builds screening workflow → sets up scheduled task → saves as SOP
Next time: one sentence to run.
You: "Send this file via Gmail"
Agent: configures OAuth → writes send script → saves as SOP
Next time: just works.

Dogfooding: This repository — from installing Git to git init, writing this README, to every commit message — was built entirely by GenericAgent without the author opening a terminal once.

Every task the agent solves becomes a permanent skill. After a few weeks, your instance has a unique skill tree — grown entirely from 3,300 lines of seed code.

The Seed Philosophy

Most agent frameworks ship as finished products. GenericAgent ships as a seed.

The 5 core SOPs define how the agent thinks, remembers, and operates. From there, every new capability is discovered and recorded by the agent itself:

  1. You ask it to do something new
  2. It figures out how (install dependencies, write scripts, test)
  3. It saves the procedure as a new SOP in its memory
  4. Next time, it recalls and executes directly

The agent doesn't just execute — it learns and remembers.

Quick Start

💡 Windows零基础用户:不知道Python是什么?下载便携版(19MB,解压即用)

# 1. Clone
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. Install minimal deps
pip install streamlit pywebview
# 3. Configure API key
cp mykey_template.py mykey.py
# Edit mykey.py with your LLM API key# 4. Launch
python launch.pyw

Also runs on Android — tested successfully on Termux with python agentmain.py (CLI frontend):

# In Termuxcd /sdcard/ga
python agentmain.py

Once running, tell the agent: "Execute web setup SOP to unlock browser tools" — it handles the rest. See WELCOME_NEW_USER.md for the full bootstrap sequence.

vs. Alternatives

GenericAgentOpenClawClaude Code
Codebase~3,300 lines~530,000 linesOpen-source (large)
Deploypip install + API keyMulti-service orchestrationCLI + subscription
BrowserInjects into real browser (keeps login state)Sandboxed/headlessVia MCP plugins
OS ControlKeyboard, mouse, vision, ADBMulti-agent delegationFile + terminal
Self-evolutionGrows SOPs & tools autonomouslyPlugin ecosystemStateless per session
Core shipped10 .py + 5 SOPsHundreds of modulesRich CLI toolkit

How It Works

User instruction
↓
┌─────────────────────┐
│ agent_loop.py (92L) │ ← Sense-Think-Act cycle
│ "What do I know? │
│ What should I do?" │
└────────┬────────────┘
↓
┌─────────────────────┐
│ 7 Atomic Tools │ ← All capabilities derive from these
│ code_run │ Execute any Python/PowerShell
│ file_read/write │ Direct disk access
│ file_patch │ Surgical code edits
│ web_scan │ Read live web pages
│ web_execute_js │ Control browser DOM
│ ask_user │ Human-in-the-loop
└────────┬────────────┘
↓
┌─────────────────────┐
│ Memory System │ ← Persistent across sessions
│ L0: Meta-SOP │ How to manage memory itself
│ L2: Global Facts │ Environment, credentials, paths
│ L3: Task SOPs │ Learned procedures (self-growing)
└─────────────────────┘

The agent starts with 7 primitive tools. Through code_run, it can install packages, write scripts, and interface with any hardware or API — effectively manufacturing new tools at runtime.

What Ships in the Box

Core engine (runs the agent):

  • agent_loop.py — Sense-Think-Act loop (92 lines)
  • ga.py — Tool definitions and execution
  • sidercall.py — LLM communication (multi-backend)
  • agentmain.py — Session orchestration

Interface (talk to the agent):

  • stapp.py — Streamlit web UI
  • tgapp.py — Telegram bot interface
  • launch.pyw — One-click launcher with floating window

Infrastructure:

  • TMWebDriver.py — Browser injection bridge (not Selenium — injects JS into your real browser via Tampermonkey)
  • simphtml.py — HTML→text cleaner for web perception

5 Core SOPs (shipped, version-controlled):

  1. memory_management_sop — L0 constitution: how the agent manages its own memory
  2. autonomous_operation_sop — Self-directed task execution
  3. scheduled_task_sop — Cron-like recurring tasks
  4. web_setup_sop — Browser environment bootstrap
  5. ljqCtrl_sop — Desktop physical control (keyboard, mouse, DPI-aware)

Everything else — Gmail integration, WeChat automation, vision APIs, game downloaders, stock analysis workflows — the agent builds and memorizes on its own through use.


GenericAgent — 3,300 行代码,完整 OS 级自主控制

一个极简自主 Agent 框架。用约 3,300 行 Python,让任意 LLM 获得对你 PC 的物理级控制能力——浏览器、终端、文件系统、键鼠、屏幕视觉、移动设备。

不需要 Electron,不需要 Docker,不需要 Mac Mini,不需要 53 万行代码,不需要付费安装服务。

用起来是什么样的

你:"帮我读取微信消息"
Agent:安装依赖 → 逆向数据库 → 写读取脚本 → 保存为 SOP
下次:一句话直接调用,零配置。
你:"帮我监控股票并提醒"
Agent:安装 mootdx → 构建选股工作流 → 设置定时任务 → 保存为 SOP
下次:一句话启动。
你:"用 Gmail 发这个文件"
Agent:配置 OAuth → 写发送脚本 → 保存为 SOP
下次:直接能用。

自举实证:本仓库从安装 Git、git init、编写 README 到每一条 commit message,全程由 GenericAgent 完成——作者没有打开过一次终端。

每个解决过的任务都会变成永久技能。用几周后,你的 Agent 实例会拥有一套独特的技能树——全部从 3,300 行种子代码中生长出来。

自举哲学

多数 Agent 框架以成品形态发布。GenericAgent 以种子形态发布。

5 个核心 SOP 定义了 Agent 如何思考、记忆和行动。之后的一切能力,由 Agent 在使用中自主发现并记录:

  1. 你让它做一件新事
  2. 它自己摸索方法(安装依赖、写脚本、测试)
  3. 把流程保存为新 SOP
  4. 下次直接调用

Agent 不只是执行——它学习并记忆

快速开始

# 1. 克隆
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. 安装最小依赖
pip install streamlit pywebview
# 3. 配置 API Key
cp mykey_template.py mykey.py
# 编辑 mykey.py 填入你的 LLM API Key# 4. 启动
python launch.pyw

同样可在 Android 上运行 — 已在 Termux 上测试通过,通过 python agentmain.py(CLI 前端)启动:

# 在 Termux 中cd /sdcard/ga
python agentmain.py

启动后告诉 Agent:"执行 web setup SOP 解锁浏览器工具"——剩下的它自己搞定。完整引导流程见 WELCOME_NEW_USER.md

对比

GenericAgentOpenClawClaude Code
代码量~3,300 行~530,000 行已开源(体量大)
部署pip install + API key多服务编排CLI + 订阅
浏览器注入真实浏览器(保留登录态)沙箱/无头浏览器通过 MCP 插件
OS 控制键鼠、视觉、ADB多 Agent 委派文件 + 终端
自我进化自主生长 SOP 和工具插件生态会话间无状态
出厂配置10 个 .py + 5 个 SOP数百模块丰富 CLI 工具集

工作原理

Agent 拥有 7 个原子工具:code_run(执行任意代码)、file_read/write/patch(文件操作)、web_scan(网页感知)、web_execute_js(浏览器控制)、ask_user(人机协作)。

通过 code_run,它可以安装任何包、编写任何脚本、对接任何硬件——相当于在运行时制造新工具。学到的流程保存为 SOP,下次直接调用。

核心循环只有 92 行(agent_loop.py):感知 → 思考 → 行动 → 记忆。

出厂清单

核心引擎

  • agent_loop.py — 感知-思考-行动循环(92 行)
  • ga.py — 工具定义与执行
  • sidercall.py — LLM 通信(多后端)
  • agentmain.py — 会话编排

交互界面

  • stapp.py — Streamlit Web UI
  • tgapp.py — Telegram 机器人
  • launch.pyw — 一键启动 + 悬浮窗

基础设施

  • TMWebDriver.py — 浏览器注入桥接(非 Selenium,通过 Tampermonkey 注入真实浏览器)
  • simphtml.py — HTML→文本清洗

5 个核心 SOP(出厂自带,版本控制):

  1. memory_management_sop — L0 宪法:Agent 如何管理自身记忆
  2. autonomous_operation_sop — 自主任务执行
  3. scheduled_task_sop — 定时任务
  4. web_setup_sop — 浏览器环境引导
  5. ljqCtrl_sop — 桌面物理控制(键鼠、DPI 感知)

其余一切——Gmail、微信自动化、视觉 API、游戏下载、股票分析——都是 Agent 在使用中自主构建并记忆的。

许可

MIT

About

AI-powered PC agent loop for desktop automation and intelligent task execution

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - darcher005/pc-agent-loop: AI-powered PC agent loop for desktop automation and intelligent task execution · GitHub
Skip to content

Repository files navigation

GenericAgent — 3,300 Lines to Full OS Autonomy

English | 中文

A minimalist autonomous agent framework that gives any LLM physical-level control over your PC — browser, terminal, file system, keyboard, mouse, screen vision, and mobile devices — in ~3,300 lines of Python.

No Electron. No Docker. No Mac Mini. No 500K-line codebase. No paid installation service.

See It in Action


"Order me a milk tea" — navigates a delivery app, picks items, and checks out.

"Find GEM stocks with EXPMA golden cross, turnover > 5%" — quantitative screening via mootdx.

Autonomous web exploration — browses and summarizes on its own schedule.

"Find expenses over ¥2K in the past 3 months" — drives Alipay on a phone via ADB.

WeChat batch messaging — yes, it can drive WeChat too.

What Happens When You Use It

You: "Read my WeChat messages"
Agent: installs dependencies → reverse-engineers DB → writes reader script → saves as SOP
Next time: instant recall, zero setup.
You: "Monitor stock prices and alert me"
Agent: installs mootdx → builds screening workflow → sets up scheduled task → saves as SOP
Next time: one sentence to run.
You: "Send this file via Gmail"
Agent: configures OAuth → writes send script → saves as SOP
Next time: just works.

Dogfooding: This repository — from installing Git to git init, writing this README, to every commit message — was built entirely by GenericAgent without the author opening a terminal once.

Every task the agent solves becomes a permanent skill. After a few weeks, your instance has a unique skill tree — grown entirely from 3,300 lines of seed code.

The Seed Philosophy

Most agent frameworks ship as finished products. GenericAgent ships as a seed.

The 5 core SOPs define how the agent thinks, remembers, and operates. From there, every new capability is discovered and recorded by the agent itself:

  1. You ask it to do something new
  2. It figures out how (install dependencies, write scripts, test)
  3. It saves the procedure as a new SOP in its memory
  4. Next time, it recalls and executes directly

The agent doesn't just execute — it learns and remembers.

Quick Start

💡 Windows零基础用户:不知道Python是什么?下载便携版(19MB,解压即用)

# 1. Clone
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. Install minimal deps
pip install streamlit pywebview
# 3. Configure API key
cp mykey_template.py mykey.py
# Edit mykey.py with your LLM API key# 4. Launch
python launch.pyw

Also runs on Android — tested successfully on Termux with python agentmain.py (CLI frontend):

# In Termuxcd /sdcard/ga
python agentmain.py

Once running, tell the agent: "Execute web setup SOP to unlock browser tools" — it handles the rest. See WELCOME_NEW_USER.md for the full bootstrap sequence.

vs. Alternatives

GenericAgentOpenClawClaude Code
Codebase~3,300 lines~530,000 linesOpen-source (large)
Deploypip install + API keyMulti-service orchestrationCLI + subscription
BrowserInjects into real browser (keeps login state)Sandboxed/headlessVia MCP plugins
OS ControlKeyboard, mouse, vision, ADBMulti-agent delegationFile + terminal
Self-evolutionGrows SOPs & tools autonomouslyPlugin ecosystemStateless per session
Core shipped10 .py + 5 SOPsHundreds of modulesRich CLI toolkit

How It Works

User instruction
↓
┌─────────────────────┐
│ agent_loop.py (92L) │ ← Sense-Think-Act cycle
│ "What do I know? │
│ What should I do?" │
└────────┬────────────┘
↓
┌─────────────────────┐
│ 7 Atomic Tools │ ← All capabilities derive from these
│ code_run │ Execute any Python/PowerShell
│ file_read/write │ Direct disk access
│ file_patch │ Surgical code edits
│ web_scan │ Read live web pages
│ web_execute_js │ Control browser DOM
│ ask_user │ Human-in-the-loop
└────────┬────────────┘
↓
┌─────────────────────┐
│ Memory System │ ← Persistent across sessions
│ L0: Meta-SOP │ How to manage memory itself
│ L2: Global Facts │ Environment, credentials, paths
│ L3: Task SOPs │ Learned procedures (self-growing)
└─────────────────────┘

The agent starts with 7 primitive tools. Through code_run, it can install packages, write scripts, and interface with any hardware or API — effectively manufacturing new tools at runtime.

What Ships in the Box

Core engine (runs the agent):

  • agent_loop.py — Sense-Think-Act loop (92 lines)
  • ga.py — Tool definitions and execution
  • sidercall.py — LLM communication (multi-backend)
  • agentmain.py — Session orchestration

Interface (talk to the agent):

  • stapp.py — Streamlit web UI
  • tgapp.py — Telegram bot interface
  • launch.pyw — One-click launcher with floating window

Infrastructure:

  • TMWebDriver.py — Browser injection bridge (not Selenium — injects JS into your real browser via Tampermonkey)
  • simphtml.py — HTML→text cleaner for web perception

5 Core SOPs (shipped, version-controlled):

  1. memory_management_sop — L0 constitution: how the agent manages its own memory
  2. autonomous_operation_sop — Self-directed task execution
  3. scheduled_task_sop — Cron-like recurring tasks
  4. web_setup_sop — Browser environment bootstrap
  5. ljqCtrl_sop — Desktop physical control (keyboard, mouse, DPI-aware)

Everything else — Gmail integration, WeChat automation, vision APIs, game downloaders, stock analysis workflows — the agent builds and memorizes on its own through use.


GenericAgent — 3,300 行代码,完整 OS 级自主控制

一个极简自主 Agent 框架。用约 3,300 行 Python,让任意 LLM 获得对你 PC 的物理级控制能力——浏览器、终端、文件系统、键鼠、屏幕视觉、移动设备。

不需要 Electron,不需要 Docker,不需要 Mac Mini,不需要 53 万行代码,不需要付费安装服务。

用起来是什么样的

你:"帮我读取微信消息"
Agent:安装依赖 → 逆向数据库 → 写读取脚本 → 保存为 SOP
下次:一句话直接调用,零配置。
你:"帮我监控股票并提醒"
Agent:安装 mootdx → 构建选股工作流 → 设置定时任务 → 保存为 SOP
下次:一句话启动。
你:"用 Gmail 发这个文件"
Agent:配置 OAuth → 写发送脚本 → 保存为 SOP
下次:直接能用。

自举实证:本仓库从安装 Git、git init、编写 README 到每一条 commit message,全程由 GenericAgent 完成——作者没有打开过一次终端。

每个解决过的任务都会变成永久技能。用几周后,你的 Agent 实例会拥有一套独特的技能树——全部从 3,300 行种子代码中生长出来。

自举哲学

多数 Agent 框架以成品形态发布。GenericAgent 以种子形态发布。

5 个核心 SOP 定义了 Agent 如何思考、记忆和行动。之后的一切能力,由 Agent 在使用中自主发现并记录:

  1. 你让它做一件新事
  2. 它自己摸索方法(安装依赖、写脚本、测试)
  3. 把流程保存为新 SOP
  4. 下次直接调用

Agent 不只是执行——它学习并记忆

快速开始

# 1. 克隆
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. 安装最小依赖
pip install streamlit pywebview
# 3. 配置 API Key
cp mykey_template.py mykey.py
# 编辑 mykey.py 填入你的 LLM API Key# 4. 启动
python launch.pyw

同样可在 Android 上运行 — 已在 Termux 上测试通过,通过 python agentmain.py(CLI 前端)启动:

# 在 Termux 中cd /sdcard/ga
python agentmain.py

启动后告诉 Agent:"执行 web setup SOP 解锁浏览器工具"——剩下的它自己搞定。完整引导流程见 WELCOME_NEW_USER.md

对比

GenericAgentOpenClawClaude Code
代码量~3,300 行~530,000 行已开源(体量大)
部署pip install + API key多服务编排CLI + 订阅
浏览器注入真实浏览器(保留登录态)沙箱/无头浏览器通过 MCP 插件
OS 控制键鼠、视觉、ADB多 Agent 委派文件 + 终端
自我进化自主生长 SOP 和工具插件生态会话间无状态
出厂配置10 个 .py + 5 个 SOP数百模块丰富 CLI 工具集

工作原理

Agent 拥有 7 个原子工具:code_run(执行任意代码)、file_read/write/patch(文件操作)、web_scan(网页感知)、web_execute_js(浏览器控制)、ask_user(人机协作)。

通过 code_run,它可以安装任何包、编写任何脚本、对接任何硬件——相当于在运行时制造新工具。学到的流程保存为 SOP,下次直接调用。

核心循环只有 92 行(agent_loop.py):感知 → 思考 → 行动 → 记忆。

出厂清单

核心引擎

  • agent_loop.py — 感知-思考-行动循环(92 行)
  • ga.py — 工具定义与执行
  • sidercall.py — LLM 通信(多后端)
  • agentmain.py — 会话编排

交互界面

  • stapp.py — Streamlit Web UI
  • tgapp.py — Telegram 机器人
  • launch.pyw — 一键启动 + 悬浮窗

基础设施

  • TMWebDriver.py — 浏览器注入桥接(非 Selenium,通过 Tampermonkey 注入真实浏览器)
  • simphtml.py — HTML→文本清洗

5 个核心 SOP(出厂自带,版本控制):

  1. memory_management_sop — L0 宪法:Agent 如何管理自身记忆
  2. autonomous_operation_sop — 自主任务执行
  3. scheduled_task_sop — 定时任务
  4. web_setup_sop — 浏览器环境引导
  5. ljqCtrl_sop — 桌面物理控制(键鼠、DPI 感知)

其余一切——Gmail、微信自动化、视觉 API、游戏下载、股票分析——都是 Agent 在使用中自主构建并记忆的。

许可

MIT

About

AI-powered PC agent loop for desktop automation and intelligent task execution

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); GitHub - darcher005/pc-agent-loop: AI-powered PC agent loop for desktop automation and intelligent task execution · GitHub
Skip to content

Repository files navigation

GenericAgent — 3,300 Lines to Full OS Autonomy

English | 中文

A minimalist autonomous agent framework that gives any LLM physical-level control over your PC — browser, terminal, file system, keyboard, mouse, screen vision, and mobile devices — in ~3,300 lines of Python.

No Electron. No Docker. No Mac Mini. No 500K-line codebase. No paid installation service.

See It in Action


"Order me a milk tea" — navigates a delivery app, picks items, and checks out.

"Find GEM stocks with EXPMA golden cross, turnover > 5%" — quantitative screening via mootdx.

Autonomous web exploration — browses and summarizes on its own schedule.

"Find expenses over ¥2K in the past 3 months" — drives Alipay on a phone via ADB.

WeChat batch messaging — yes, it can drive WeChat too.

What Happens When You Use It

You: "Read my WeChat messages"
Agent: installs dependencies → reverse-engineers DB → writes reader script → saves as SOP
Next time: instant recall, zero setup.
You: "Monitor stock prices and alert me"
Agent: installs mootdx → builds screening workflow → sets up scheduled task → saves as SOP
Next time: one sentence to run.
You: "Send this file via Gmail"
Agent: configures OAuth → writes send script → saves as SOP
Next time: just works.

Dogfooding: This repository — from installing Git to git init, writing this README, to every commit message — was built entirely by GenericAgent without the author opening a terminal once.

Every task the agent solves becomes a permanent skill. After a few weeks, your instance has a unique skill tree — grown entirely from 3,300 lines of seed code.

The Seed Philosophy

Most agent frameworks ship as finished products. GenericAgent ships as a seed.

The 5 core SOPs define how the agent thinks, remembers, and operates. From there, every new capability is discovered and recorded by the agent itself:

  1. You ask it to do something new
  2. It figures out how (install dependencies, write scripts, test)
  3. It saves the procedure as a new SOP in its memory
  4. Next time, it recalls and executes directly

The agent doesn't just execute — it learns and remembers.

Quick Start

💡 Windows零基础用户:不知道Python是什么?下载便携版(19MB,解压即用)

# 1. Clone
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. Install minimal deps
pip install streamlit pywebview
# 3. Configure API key
cp mykey_template.py mykey.py
# Edit mykey.py with your LLM API key# 4. Launch
python launch.pyw

Also runs on Android — tested successfully on Termux with python agentmain.py (CLI frontend):

# In Termuxcd /sdcard/ga
python agentmain.py

Once running, tell the agent: "Execute web setup SOP to unlock browser tools" — it handles the rest. See WELCOME_NEW_USER.md for the full bootstrap sequence.

vs. Alternatives

GenericAgentOpenClawClaude Code
Codebase~3,300 lines~530,000 linesOpen-source (large)
Deploypip install + API keyMulti-service orchestrationCLI + subscription
BrowserInjects into real browser (keeps login state)Sandboxed/headlessVia MCP plugins
OS ControlKeyboard, mouse, vision, ADBMulti-agent delegationFile + terminal
Self-evolutionGrows SOPs & tools autonomouslyPlugin ecosystemStateless per session
Core shipped10 .py + 5 SOPsHundreds of modulesRich CLI toolkit

How It Works

User instruction
↓
┌─────────────────────┐
│ agent_loop.py (92L) │ ← Sense-Think-Act cycle
│ "What do I know? │
│ What should I do?" │
└────────┬────────────┘
↓
┌─────────────────────┐
│ 7 Atomic Tools │ ← All capabilities derive from these
│ code_run │ Execute any Python/PowerShell
│ file_read/write │ Direct disk access
│ file_patch │ Surgical code edits
│ web_scan │ Read live web pages
│ web_execute_js │ Control browser DOM
│ ask_user │ Human-in-the-loop
└────────┬────────────┘
↓
┌─────────────────────┐
│ Memory System │ ← Persistent across sessions
│ L0: Meta-SOP │ How to manage memory itself
│ L2: Global Facts │ Environment, credentials, paths
│ L3: Task SOPs │ Learned procedures (self-growing)
└─────────────────────┘

The agent starts with 7 primitive tools. Through code_run, it can install packages, write scripts, and interface with any hardware or API — effectively manufacturing new tools at runtime.

What Ships in the Box

Core engine (runs the agent):

  • agent_loop.py — Sense-Think-Act loop (92 lines)
  • ga.py — Tool definitions and execution
  • sidercall.py — LLM communication (multi-backend)
  • agentmain.py — Session orchestration

Interface (talk to the agent):

  • stapp.py — Streamlit web UI
  • tgapp.py — Telegram bot interface
  • launch.pyw — One-click launcher with floating window

Infrastructure:

  • TMWebDriver.py — Browser injection bridge (not Selenium — injects JS into your real browser via Tampermonkey)
  • simphtml.py — HTML→text cleaner for web perception

5 Core SOPs (shipped, version-controlled):

  1. memory_management_sop — L0 constitution: how the agent manages its own memory
  2. autonomous_operation_sop — Self-directed task execution
  3. scheduled_task_sop — Cron-like recurring tasks
  4. web_setup_sop — Browser environment bootstrap
  5. ljqCtrl_sop — Desktop physical control (keyboard, mouse, DPI-aware)

Everything else — Gmail integration, WeChat automation, vision APIs, game downloaders, stock analysis workflows — the agent builds and memorizes on its own through use.


GenericAgent — 3,300 行代码,完整 OS 级自主控制

一个极简自主 Agent 框架。用约 3,300 行 Python,让任意 LLM 获得对你 PC 的物理级控制能力——浏览器、终端、文件系统、键鼠、屏幕视觉、移动设备。

不需要 Electron,不需要 Docker,不需要 Mac Mini,不需要 53 万行代码,不需要付费安装服务。

用起来是什么样的

你:"帮我读取微信消息"
Agent:安装依赖 → 逆向数据库 → 写读取脚本 → 保存为 SOP
下次:一句话直接调用,零配置。
你:"帮我监控股票并提醒"
Agent:安装 mootdx → 构建选股工作流 → 设置定时任务 → 保存为 SOP
下次:一句话启动。
你:"用 Gmail 发这个文件"
Agent:配置 OAuth → 写发送脚本 → 保存为 SOP
下次:直接能用。

自举实证:本仓库从安装 Git、git init、编写 README 到每一条 commit message,全程由 GenericAgent 完成——作者没有打开过一次终端。

每个解决过的任务都会变成永久技能。用几周后,你的 Agent 实例会拥有一套独特的技能树——全部从 3,300 行种子代码中生长出来。

自举哲学

多数 Agent 框架以成品形态发布。GenericAgent 以种子形态发布。

5 个核心 SOP 定义了 Agent 如何思考、记忆和行动。之后的一切能力,由 Agent 在使用中自主发现并记录:

  1. 你让它做一件新事
  2. 它自己摸索方法(安装依赖、写脚本、测试)
  3. 把流程保存为新 SOP
  4. 下次直接调用

Agent 不只是执行——它学习并记忆

快速开始

# 1. 克隆
git clone https://github.com/lsdefine/pc-agent-loop.git
cd pc-agent-loop
# 2. 安装最小依赖
pip install streamlit pywebview
# 3. 配置 API Key
cp mykey_template.py mykey.py
# 编辑 mykey.py 填入你的 LLM API Key# 4. 启动
python launch.pyw

同样可在 Android 上运行 — 已在 Termux 上测试通过,通过 python agentmain.py(CLI 前端)启动:

# 在 Termux 中cd /sdcard/ga
python agentmain.py

启动后告诉 Agent:"执行 web setup SOP 解锁浏览器工具"——剩下的它自己搞定。完整引导流程见 WELCOME_NEW_USER.md

对比

GenericAgentOpenClawClaude Code
代码量~3,300 行~530,000 行已开源(体量大)
部署pip install + API key多服务编排CLI + 订阅
浏览器注入真实浏览器(保留登录态)沙箱/无头浏览器通过 MCP 插件
OS 控制键鼠、视觉、ADB多 Agent 委派文件 + 终端
自我进化自主生长 SOP 和工具插件生态会话间无状态
出厂配置10 个 .py + 5 个 SOP数百模块丰富 CLI 工具集

工作原理

Agent 拥有 7 个原子工具:code_run(执行任意代码)、file_read/write/patch(文件操作)、web_scan(网页感知)、web_execute_js(浏览器控制)、ask_user(人机协作)。

通过 code_run,它可以安装任何包、编写任何脚本、对接任何硬件——相当于在运行时制造新工具。学到的流程保存为 SOP,下次直接调用。

核心循环只有 92 行(agent_loop.py):感知 → 思考 → 行动 → 记忆。

出厂清单

核心引擎

  • agent_loop.py — 感知-思考-行动循环(92 行)
  • ga.py — 工具定义与执行
  • sidercall.py — LLM 通信(多后端)
  • agentmain.py — 会话编排

交互界面

  • stapp.py — Streamlit Web UI
  • tgapp.py — Telegram 机器人
  • launch.pyw — 一键启动 + 悬浮窗

基础设施

  • TMWebDriver.py — 浏览器注入桥接(非 Selenium,通过 Tampermonkey 注入真实浏览器)
  • simphtml.py — HTML→文本清洗

5 个核心 SOP(出厂自带,版本控制):

  1. memory_management_sop — L0 宪法:Agent 如何管理自身记忆
  2. autonomous_operation_sop — 自主任务执行
  3. scheduled_task_sop — 定时任务
  4. web_setup_sop — 浏览器环境引导
  5. ljqCtrl_sop — 桌面物理控制(键鼠、DPI 感知)

其余一切——Gmail、微信自动化、视觉 API、游戏下载、股票分析——都是 Agent 在使用中自主构建并记忆的。

许可

MIT

About

AI-powered PC agent loop for desktop automation and intelligent task execution

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages