
2026年8月OpenHuman在GitHub上连续9天霸榜Trending35K Stars。它的核心理念是——打造你的个人AI化身一个了解你偏好、记忆你习惯、能自主进化、能完成各种任务的AI Agent。目录一、引言什么是OpenHuman二、架构深度剖析三、核心功能精讲四、代码深度分析五、实战部署六、OpenHuman vs OpenClaw vs Hermes七、总结一、引言什么是OpenHuman2026年8月一个名为OpenHuman的AI Agent框架在GitHub上连续9天霸榜Trending累计获得35K Stars。它的核心理念是——打造你的个人AI化身一个了解你的偏好、记忆你的习惯、能自主完成任务、不断学习和进化的AI Agent。与Dify可视化AI应用开发平台、crewAI多智能体编排框架不同OpenHuman的定位是个人AI Agent。它关注的是如何让AI更了解你——通过Memory Tree记录和推理用户偏好通过TokenJuice压缩上下文通过118工具完成各种任务。项目概览维度详情Stars35K连续9天 Trending #1开源协议Apache 2.0技术栈Python TypeScript React核心创新Memory Tree / TokenJuice工具生态118 内置工具支持模型OpenAI / DeepSeek / GLM / Ollama二、架构深度剖析OpenHuman的架构围绕三个核心组件展开Memory Tree记忆树、TokenJuice上下文压缩引擎和工具系统。核心组件1. Memory Tree树形记忆结构每层节点代表不同粒度的记忆根节点全局偏好语言、风格、技术栈中间节点会话上下文当前任务状态叶子节点即时交互具体指令和反馈2. TokenJuice上下文压缩引擎通过语义摘要和关键信息提取将长上下文压缩到1/5-1/10保留代码块、数字、实体等关键信息支持可配置压缩比3. 工具系统118内置工具浏览器自动化、文件操作、代码执行API调用、数据库查询、Git操作网页搜索、图片处理、文档生成三、核心功能精讲3.1 记忆系统与传统AI Agent的对话历史不同Memory Tree实现了结构化记忆管理永久记忆用户偏好、常用配置、个人信息会话记忆当前任务的上下文状态工作记忆正在处理的临时信息记忆通过语义检索和重要性评分来决定哪些信息被保留、哪些被压缩、哪些被遗忘。3.2 TokenJuice压缩TokenJuice的工作流程分为三步关键信息提取识别代码块、数字、日期、实体等不可丢失的信息语义摘要使用BART或其他摘要模型对上下文进行压缩信息合并将关键信息与摘要合并确保压缩后的上下文仍然可用实际效果在测试中TokenJuice将10000 token的上下文压缩到约2000 token同时保留90%以上问答所需的关键信息。四、代码深度分析4.1 Memory Tree核心实现import time import uuid import os import numpy as np class MemoryNode: 记忆树节点 def __init__(self, node_id, content, node_typefact, importance0.5, timestampNone): self.node_id node_id self.content content self.node_type node_type # fact | preference | session | context self.importance importance self.timestamp timestamp or time.time() self.children [] self.embedding None def add_child(self, child_node): self.children.append(child_node) def get_relevant(self, query_embedding, top_k5): 检索最相关的子记忆 scored [] for child in self.children: if child.embedding is not None: similarity np.dot(query_embedding, child.embedding) / ( np.linalg.norm(query_embedding) * np.linalg.norm(child.embedding) ) scored.append((similarity * child.importance, child)) scored.sort(reverseTrue) return [node for _, node in scored[:top_k]] class MemoryTree: 记忆树管理器 def __init__(self, storage_path~/.openhuman/memory): self.root MemoryNode(root, Global Memory, node_typeroot) self.storage_path os.path.expanduser(storage_path) os.makedirs(self.storage_path, exist_okTrue) def add_memory(self, content, node_typefact, parent_idNone, importanceNone): 添加记忆到树中 node_id str(uuid.uuid4()) if importance is None: importance self._estimate_importance(content) node MemoryNode(node_id, content, node_type, importance) if parent_id: parent self._find_node(self.root, parent_id) if parent: parent.add_child(node) else: self.root.add_child(node) return node def _estimate_importance(self, content): 基于内容特征评估记忆重要性 high_importance [preference, dislike, always, never, important, favorite] score 0.3 for kw in high_importance: if kw in content.lower(): score 0.1 return min(score, 1.0) def query(self, query_embedding, top_k5): 语义检索记忆 results [] self._search_recursive(self.root, query_embedding, results, top_k) return results def _search_recursive(self, node, query_embedding, results, top_k): 递归搜索记忆树 relevant node.get_relevant(query_embedding, top_k) results.extend(relevant) for child in node.children: self._search_recursive(child, query_embedding, results, top_k) results.sort(keylambda x: x.importance, reverseTrue) return results[:top_k]4.2 TokenJuice压缩引擎from transformers import pipeline import re class TokenJuice: 上下文压缩引擎 def __init__(self, compression_ratio0.3): self.compression_ratio compression_ratio self.summarizer pipeline(summarization, modelfacebook/bart-large-cnn) def compress(self, context, preserve_key_infoTrue): 压缩上下文保留关键信息 if len(context) 1000: return context # 1. 提取关键信息 key_info self._extract_key_info(context) if preserve_key_info else # 2. 语义摘要 summary self.summarizer( context, max_lengthint(len(context) * self.compression_ratio), min_length30, do_sampleFalse )[0][summary_text] # 3. 合并 if key_info: return f[关键信息]\n{key_info}\n\n[摘要]\n{summary} return summary def _extract_key_info(self, text): 提取关键信息 snippets [] # 代码块 code_blocks re.findall(r[\s\S]*?, text) snippets.extend(code_blocks) # 含数字的句子 for sent in text.split(.): if re.search(r\d, sent) and len(sent) 20: snippets.append(sent.strip()) return \n.join(snippets[:5])五、实战部署5.1 环境配置# 安装OpenHuman pip install openhuman # 初始化项目 openhuman init my-agent cd my-agent # 查看配置 cat config.yaml5.2 配置文件# config.yaml llm: provider: deepseek # 支持: openai / deepseek / glm / ollama model: deepseek-chat api_key: ${DEEPSEEK_API_KEY} memory: backend: local # local / chroma / pinecone vector_dim: 768 tools: enabled: - browser - filesystem - code_executor - web_search - github5.3 使用示例from openhuman import Agent # 创建Agent实例 agent Agent.from_config(config.yaml) # 让Agent了解你 agent.remember(我是一名Python开发者擅长后端开发) agent.remember(偏好使用FastAPI和PostgreSQL) agent.remember(日常使用VS Code和Git) # 执行任务 result agent.run( 帮我完成以下任务 1. 查看当前目录的文件结构 2. 创建一个Python脚本实现一个简单的REST API 3. 使用FastAPI框架 4. 将脚本保存到当前目录 ) print(result)5.4 模型接入OpenHuman支持多种LLM后端配置方式统一DeepSeek接入llm: provider: deepseek model: deepseek-chat api_key: ${DEEPSEEK_API_KEY}GLM接入llm: provider: glm model: glm-4-plus api_key: ${GLM_API_KEY}Ollama本地部署llm: provider: ollama model: qwen2.5:14b base_url: http://localhost:11434六、OpenHuman vs OpenClaw vs Hermes对比维度OpenHumanOpenClawHermes定位个人AI化身通用Agent框架轻量Agent记忆系统Memory Tree会话记忆简单记忆上下文压缩TokenJuice核心无无工具数量11820050学习曲线中高低适用场景个人助手企业应用快速原型模型支持OpenAI/DeepSeek/GLM/OllamaOpenAI/ClaudeOpenAI/Claude七、总结OpenHuman的独特之处在于它把记忆作为AI Agent的核心能力。Memory Tree让人工智能不再是每次对话都从零开始而是真正了解你。TokenJuice则解决了长上下文场景下的成本问题。从更宏观的视角看OpenHuman代表了AI Agent发展的一个方向从能干活到懂你。这不是技术上的突破而是产品理念上的转变——AI Agent不应该只是一个工具而应该是一个伙伴。开源社区的反应也印证了这一点35K Stars不只是一个数字而是开发者们对个人AI Agent这个方向的集体认同。当每一个开发者都能拥有一个了解自己的AI AgentAI编程的生产力将进入一个全新的阶段。