[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-74311":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":9,"pushedAt":9,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":15,"starSnapshotCount":15,"syncStatus":14,"lastSyncTime":27,"discoverSource":28},74311,"724-office","wangziqi06\u002F724-office","wangziqi06","7\u002F24 Office — Self-evolving AI Agent system. 36 tools, 10,000 lines pure Python, modular architecture, MCP plugins, three-layer memory, nudge system, AI mirror, 24\u002F7 production.",null,"Python",1026,168,32,2,0,1,7,55.88,"MIT License",false,"master",true,[],"2026-06-12 04:01:14","# 7\u002F24 Office -- Self-Evolving AI Agent System\n\nA production-running AI agent built in **~10,000 lines of pure Python** with **zero framework dependency**. No LangChain, no LlamaIndex, no CrewAI -- just the standard library + a few small packages.\n\n**36 tools. 20 files. Modular architecture. Runs 24\u002F7.**\n\nBuilt solo with AI co-development tools. Production 24\u002F7 across multiple users.\n\n## What's New in v2.0\n\n- **Modular tool architecture** -- Split from monolithic `tools.py` into 7 domain modules\n- **Group chat support** -- Independent container for group conversations with @-mention gating\n- **AI Mirror** -- Behavioral profile reports (`soul_report`) + future-self dialogue mode (`future_self`)\n- **Nudge system** -- Structural behavior correction: auto-detects when LLM has tools but doesn't use them\n- **Dynamic tool filtering** -- 5 context profiles (voice\u002Fscheduler\u002Fgroup\u002Fdiagnostic\u002Fdefault) to reduce token waste\n- **Budget-aware system prompt** -- Token budget tracking during system prompt assembly\n- **Inactivity guard** -- Auto-skip cron tasks for dormant users (3-day threshold)\n- **Circuit breaker** -- Disable tools after 3 consecutive failures per session\n- **Interactive visualization** -- ECharts-based HTML pages via `render_page` (line\u002Fbar\u002Fpie\u002Fradar\u002Ftable\u002Freport)\n- **Container reconciliation** -- Router auto-rebuilds missing containers from routing table on startup\n- **Exponential backoff retry** -- Messaging API calls retry 3x with 2\u002F4\u002F8s delays\n- **Session auto-archiving** -- Daily black box recording of all conversations\n\n## Features\n\n- **Tool Use Loop** -- OpenAI-compatible function calling with automatic retry, up to 20 iterations per conversation\n- **Three-Layer Memory** -- Session history + LLM-compressed long-term memory + LanceDB vector retrieval\n- **MCP\u002FPlugin System** -- Connect external MCP servers via JSON-RPC (stdio or HTTP), hot-reload without restart\n- **Runtime Tool Creation** -- The agent can write, save, and load new Python tools at runtime (`create_tool`)\n- **Self-Repair** -- Daily self-check, session health diagnostics, error log analysis, auto-notification on failure\n- **Cron Scheduling** -- One-shot and recurring tasks, persistent across restarts, timezone-aware, inactivity guard\n- **Multi-Tenant Router** -- Docker-based auto-provisioning, one container per user, health-checked, reconciliation\n- **Multimodal** -- Image\u002Fvideo\u002Ffile\u002Fvoice\u002Flink handling, ASR (speech-to-text), vision via base64\n- **Web Search** -- Multi-engine (Tavily, Bocha, GitHub, HuggingFace) with auto-routing and dual-engine default\n- **Video Processing** -- Trim (with intelligent silence detection), add BGM, AI video generation via API\n- **Messaging Integration** -- Pluggable messaging platform with debounce, message splitting, streaming media upload\n- **Group Chat** -- Independent container, @-mention gating, context buffer (last 20 messages), speaker identification\n\n## Architecture\n\n```\n                    +-----------------+\n                    |  Messaging      |\n                    |  Platform       |\n                    +--------+--------+\n                             |\n                    +--------v--------+\n                    |   router.py     |  Multi-tenant routing\n                    |  Auto-provision |  Container reconciliation\n                    |  Group routing  |  Health checking\n                    +--------+--------+\n                             |\n                    +--------v--------+\n                    | xiaowang.py     |  Entry point\n                    |  HTTP server    |  Callback handling\n                    |  Debounce       |  Media download\u002FASR\n                    |  Group support  |  Inactivity tracking\n                    +--------+--------+\n                             |\n                    +--------v--------+\n                    |    llm.py       |  Tool Use Loop (core)\n                    |  Budget-aware   |  Session management\n                    |  system prompt  |  Nudge integration\n                    |  Multimodal     |  Memory injection\n                    +--------+--------+\n                             |\n     +----------+----+------+------+----+-----------+\n     |          |    |             |    |           |\n+----v-----+ +-v----v--+ +-------v-+ +-v--------+ |\n| tools_    | |tools_   | |tools_   | |tools_    | |\n| messaging | |admin    | |search   | |video     | |\n| send\u002Ffile | |exec\u002Fdiag| |web\u002Fmem  | |trim\u002Fbgm  | |\n| schedule  | |plugin   | |recall   | |generate  | |\n+-----------+ |MCP      | +---------+ +----------+ |\n              +----+----+                           |\n              +----v----+  +----------+  +----------v--+\n              |tools_   |  |tools_    |  |  nudge.py   |\n              |page     |  |mirror    |  |  5 rules    |\n              |ECharts  |  |soul rpt  |  |  auto-hint  |\n              |6 types  |  |future    |  +-------------+\n              +---------+  |self      |\n                           +----------+\n              +--------------+--------------+\n              |              |              |\n       +------v------+  +---v--------+  +--v-----------+\n       | memory.py   |  |scheduler.py|  | archive.py   |\n       | 3-layer     |  | cron+once  |  | daily black  |\n       | compress    |  | inactivity |  | box recorder |\n       | deduplicate |  | guard      |  +--------------+\n       | retrieve    |  +------------+\n       +------+------+\n              |\n       +------v------+\n       |mcp_client.py|  JSON-RPC over stdio\u002FHTTP\n       | Auto-reconnect + Hot-reload\n       +-------------+\n```\n\n## Memory System\n\n```\nLayer 1: Session (short-term)\n  - Last 40 messages per session, JSON files\n  - Overflow triggers compression\n  - Auto-archive sessions >100KB\n\nLayer 2: Compressed (long-term)\n  - LLM extracts structured facts from evicted messages\n  - Deduplication via cosine similarity (threshold: 0.92)\n  - Stored as vectors in LanceDB\n\nLayer 3: Retrieval (active recall)\n  - User message -> embedding -> vector search\n  - Top-K relevant memories injected into system prompt\n  - Budget-aware injection (tracks token usage)\n```\n\n## Tool List (36 built-in)\n\n| Category | Module | Tools |\n|----------|--------|-------|\n| Core | `tools_admin` | `exec`, `message` |\n| Files | `tools_admin` | `read_file`, `write_file`, `edit_file`, `list_files` |\n| Scheduling | `tools_messaging` | `schedule`, `list_schedules`, `remove_schedule` |\n| Media Send | `tools_messaging` | `send_image`, `send_file`, `send_video`, `send_link`, `send_location`, `send_namecard` |\n| Video | `tools_video` | `trim_video` (auto-cut silence), `add_bgm`, `generate_video` |\n| Search | `tools_search` | `web_search` (Tavily+Bocha dual-engine), `search_nearby` (geocoding+POI), `search_memory`, `recall` |\n| Visualization | `tools_page` | `render_page` (line\u002Fbar\u002Fpie\u002Fradar\u002Ftable\u002Freport via ECharts) |\n| AI Mirror | `tools_mirror` | `soul_report` (behavioral profile HTML), `future_self` (dialogue mode) |\n| Diagnostics | `tools_admin` | `self_check`, `diagnose`, `task_history`, `code_audit`, `asr_check`, `daily_digest` |\n| Memory | `tools_admin` | `compact_memory`, `compact_guides` |\n| Plugins | `tools_admin` | `create_tool`, `list_custom_tools`, `remove_tool` |\n| MCP | `tools_admin` | `reload_mcp` |\n\n## Module Structure\n\n| File | Lines | Responsibility |\n|------|-------|---------------|\n| `xiaowang.py` | ~1040 | Entry: config, HTTP server, callbacks, debounce, ASR, group support |\n| `llm.py` | ~1260 | LLM API + tool use loop + budget-aware system prompt + nudge integration |\n| `tools.py` | ~37 | Orchestration layer (imports domain modules) |\n| `tools_base.py` | ~314 | Registry + @tool decorator + dynamic filtering + circuit breaker |\n| `tools_messaging.py` | ~550 | Message\u002Ffile\u002Fschedule\u002Flocation\u002Fnamecard tools |\n| `tools_admin.py` | ~860 | Exec\u002Ffile ops\u002Fdiagnostics\u002Fplugins\u002FMCP management |\n| `tools_mirror.py` | ~716 | AI Mirror: soul_report + future_self |\n| `tools_page.py` | ~470 | Interactive HTML page generation (ECharts) |\n| `tools_search.py` | ~293 | Multi-engine web search + memory search |\n| `tools_video.py` | ~394 | Video trim\u002FBGM\u002Fgeneration |\n| `messaging.py` | ~447 | Messaging platform API wrapper + CDN upload\u002Fdownload |\n| `memory.py` | ~1100 | Three-layer memory (session + compressed + vector) |\n| `scheduler.py` | ~652 | Cron + one-shot scheduling + inactivity guard |\n| `router.py` | ~500+ | Multi-tenant Docker router + auto-provisioning + reconciliation |\n| `mcp_client.py` | ~342 | MCP protocol client (JSON-RPC, zero new deps) |\n| `nudge.py` | ~190 | Nudge system: detect tool misuse, auto-inject hints |\n| `archive.py` | ~204 | Daily session archiving (black box recorder) |\n| `audit.py` | ~448 | Automated 11-check code audit |\n\n## Quick Start\n\n### Option 1: Direct Run\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fwangziqi06\u002F724-office.git\ncd 724-office\ncp config.example.json config.json\n# Edit config.json with your API keys\n\npip install croniter lancedb websocket-client pilk numpy httpx beautifulsoup4 pydub jieba fpdf2\n\nmkdir -p workspace\u002Fmemory workspace\u002Ffiles\npython3 xiaowang.py\n```\n\n### Option 2: Docker Deployment (Recommended)\n\n```bash\n# Copy Dockerfile.example -> Dockerfile\n# Copy docker-compose.example.yml -> docker-compose.yml\n# Edit .env with your credentials\n\ndocker compose build\ndocker compose up -d\n```\n\nThe agent starts an HTTP server on port 8080. Point your messaging platform webhook to `http:\u002F\u002FYOUR_SERVER:8080\u002F`.\n\n## Configuration\n\nSee `config.example.json` for the full configuration structure. Key sections:\n\n- **models** -- LLM providers (any OpenAI-compatible API) with fallback chain\n- **messaging** -- Messaging platform credentials and endpoints\n- **memory** -- Three-layer memory system settings (embedding API, similarity threshold)\n- **asr** -- Speech-to-text API credentials\n- **video_api** -- AI video generation API\n- **mcp_servers** -- MCP server connections (stdio or HTTP transport)\n- **page_base_url** -- Base URL for generated visualization pages\n\n## Design Principles\n\n1. **Zero framework dependency** -- Every line is visible and debuggable. No magic. No hidden abstractions.\n2. **Modular tools** -- Adding a capability = adding one `@tool`-decorated function in the appropriate domain module.\n3. **Edge-deployable** -- Designed to run on Jetson Orin Nano (8GB RAM, ARM64). RAM budget under 2GB.\n4. **Self-evolving** -- The agent can create new tools at runtime, diagnose its own issues, and notify the owner.\n5. **Structural behavior correction** -- Don't fix agent mistakes with prompts. Add nudges, hooks, and validation.\n6. **Build for deletion** -- Every module should be cleanly removable when the model gets smarter.\n7. **Context is the scarcest resource** -- Token budget is the core design constraint, not compute.\n\n## License\n\nMIT\n","7\u002F24 Office 是一个自我进化的AI代理系统，旨在全天候运行。项目采用约10,000行纯Python代码构建，不依赖任何外部框架，仅使用标准库和少量小包。其核心功能包括36种工具、模块化架构设计、三层记忆机制（会话历史+LLM压缩长期记忆+LanceDB向量检索）、MCP插件系统支持外部服务连接、动态工具过滤以减少令牌浪费等。此外，它还具备行为分析报告、结构化行为纠正系统、预算意识的系统提示生成等功能。此项目适用于需要持续在线、多用户支持且具有一定自维护能力的AI助手场景，如客户服务、个人助理或团队协作环境。","2026-06-11 03:49:54","high_star"]