v2.3.2 · Local Autonomous Agent

COGITO

AGENT

Think Continuously · Act Autonomously · Stay Private

持续思考 · 自主行动 · 数据私有

"Cogito, ergo sum — I think, therefore I am. CogitoAgent is not just a tool; it is your autonomous thinking partner running entirely in your local environment."

— CogitoAgent v2.3.2
GitHubGitHub GiteeGitee Issues反馈

Your Local AI Autonomous Agent您的本地 AI 自主智能体

CogitoAgent is a locally-run autonomous AI agent that integrates file management, knowledge mining, system operations, code execution, and web connectivity. It runs directly within the working directory you configure — with no need to upload files to third-party servers. CogitoAgent 是一款本地运行的自主 AI 智能体,集成了文件管理、知识挖掘、系统操作、代码执行、网络搜索等功能。它直接在您配置的工作目录内运行,无需将文件上传至第三方服务器。

Unlike traditional chatbots, CogitoAgent possesses the ability to Think Continuously, Explore Autonomously, and Execute Tools, capable of proactively discovering and organizing your local assets in the background. 与传统聊天机器人不同,CogitoAgent 拥有 持续思考自主探索工具执行 的能力,可以在后台主动发现和整理您的本地资源。

Continuous Thinking持续思考
Event-driven, thinks continuously as events arrive事件驱动,随事件持续思考
Privacy First隐私优先
All data stays local, no uploads数据完全本地,无需上传
Rich Toolset丰富工具集
28 modules: files, code, Git, OCR, DB, GIS, Bio, Med, Chem, Finance...28个模块:文件、代码、Git、OCR、数据库、GIS、生物、医学、化学、金融等
Persistent Memory持久记忆
Long-term storage, cross-session learning长期记忆存储,跨会话学习
cogito-agent
$ npm start
[think] Scanning workspace...
[think] Found 3 pending tasks
[think] Fetching latest updates...
Planning complete, awaiting instructions
[think] Loading persona: Default — your intelligent assistant
Agent ready. Type '/help' for available commands.
$
🤖 Hello! I'm CogitoAgent, your local autonomous AI assistant 🧠
I'm continuously thinking and exploring your workspace to help organize, analyze, and create.
💡 What can I do for you today? Try '/help' to see all available commands!
Desktop Preview桌面预览
CogitoAgent Electron Desktop
200+
Tool Functions工具函数
28
Tool Modules工具模块
25
Preset Personas预设人设
20
Quick Commands快捷指令
01

Supported Models支持模型

OpenAI (GPT-4o)
Moark
Anthropic (Claude)
Google (Gemini)
Ollama (Local)
OpenAI-Compatible API
02

Tool Modules工具模块

All tool functions are managed uniformly by registry.ts and called using the [TOOL] functionName(args) [/TOOL] format. Tools are loaded on-demand by category. 所有工具函数由 registry.ts 统一管理,使用 [TOOL] functionName(args) [/TOOL] 格式调用。工具按分类按需加载。

File Operations文件操作
ls, read, create, copy, mkdir, delete, rename
Web Tools网页工具
search, browse, fetchPage, searchOnEngine
Code Execution代码执行
JavaScript, Python, formatCode, executeFile
Git VCSGit 版本控制
commit, push, branch, checkout, diff, stash
Task Management任务管理
create, track, split, complete, stats
Memory System记忆系统
store, search, recall, stats, related
Database数据库
SQLite queries, transactions, schema
Image Recognition (OCR)图像识别 (OCR)
text extraction, batch processing
Vision Analysis视觉分析
image description, content understanding
Email邮件功能
text, HTML, attachments, templates
Scheduled Tasks定时任务
cron-style scheduling, toggle
System Monitor系统监控
CPU, memory, disk, processes
WeChat Channel微信通道
QR login, receive/send messages, dedicated session
Browser Automation浏览器自动化
click, fill, screenshot, navigate
GIS & Maps地理信息系统
geocode, reverse geocode, spatial query, routing
06

Live Interactive Demos实时交互演示

Experience CogitoAgent's three modes — Desktop, Dashboard, and Monitor — all running live in your browser with simulated data. 体验 CogitoAgent 的三种模式 — 桌面端、Dashboard 和监控面板,全部在浏览器中实时模拟运行。

Desktop Mode桌面模式 LIVE实时
Dashboard ModeDashboard 模式 LIVE实时
Monitor Panel监控面板 LIVE实时
07

Vision & OCR视觉与 OCR

CogitoAgent integrates advanced computer vision capabilities, enabling image analysis, OCR text extraction, and visual understanding. CogitoAgent 集成了先进的计算机视觉能力,支持图像分析、OCR 文本提取和视觉理解。

Vision Analysis视觉分析
CogitoAgent Vision Analysis
Analyze images for content description, object detection, scene understanding, and more using multi-modal AI models. 使用多模态 AI 模型分析图像内容描述、物体检测、场景理解等。
Web Search Preview网页搜索预览
CogitoAgent Web Search
Search the web, browse pages, and extract structured information from any public URL. 搜索网页、浏览页面,从任意公开 URL 提取结构化信息。
// Example: Vision analysis
[TOOL] vision("screenshot.png", "Describe this image") [/TOOL]

// Example: OCR text extraction
[TOOL] ocr("document.png") [/TOOL]

// Example: Batch OCR
[TOOL] ocrBatch("img1.png, img2.png") [/TOOL]
03

Architecture架构设计

The Agent core runs an event-driven thinking loop: on each user message or tool result it builds context → calls the API → parses output → executes tools → and immediately continues. No fixed polling interval — turns advance as fast as the model and tools allow. Agent 核心运行事件驱动的思考循环:每收到一条用户消息或工具结果,便构建上下文 → 调用 API → 解析输出 → 执行工具 → 并立即推进下一轮。无固定轮询间隔,循环速度取决于模型与工具的实际耗时。

🧠
Thinking Loop思考循环
3s interval auto-trigger3秒间隔自动触发
⚙️
State Machine状态机
THINKING → AWAIT_INPUT → AWAIT_CONFIRM思考 → 等待输入 → 等待确认
🔌
Plugin System插件系统
Dynamic tool loading动态工具加载
🛡️
Sandbox Security沙箱安全
isolated-vm process isolationisolated-vm 进程隔离
📁
Multi-Session多会话管理
Persistent storage, context compression持久化存储,上下文压缩
🌐
MCP ProtocolMCP 协议
Model Context Protocol support模型上下文协议支持
📋
Tool Registry工具注册表
Centralized tool management集中式工具管理
🔔
Event Bus事件总线
Pub/sub inter-module communication发布/订阅模块间通信
🧑
Persona System人设系统
25 preset role profiles25 个预设角色档案
🌉
Streaming Bridge流式桥接
WebSocket real-time relayWebSocket 实时中继
04

Technical Details技术细节

🔄

State Machine状态机

Three core states managed by state.ts with strict transitions. state.ts 管理的三个核心状态,具有严格的状态转换。

// State transitions
AWAITING_INPUTTHINKING (user input)
THINKINGAWAITING_CONFIRMATION (dangerous tool)
THINKINGAWAITING_INPUT (response ready)
AWAITING_CONFIRMATIONTHINKING (confirmed)
🔌

Tool Registry工具注册表

Centralized tool management with metadata including category, parameters, danger level, and execution handler. 集中式工具管理,包含分类、参数、危险等级和执行句柄等元数据。

// Tool registration format
name: 'functionName',
description: 'description',
parameters: { /* JSON Schema */ },
category: 'file/code/git/...',
dangerLevel: 'none/low/medium/high'
🛡️

Security Sandbox安全沙箱

Process-level isolation using isolated-vm with deep-freezing of built-in objects and resource limits. 使用 isolated-vm 实现进程级隔离,内置对象深度冻结,资源使用受限。

// Sandbox security features
Deep freeze of built-in objects
No file system access
No network access
Execution timeout limit
Memory usage limit
📦

Context Compression上下文压缩

Auto-compression when conversation exceeds max length. Uses LLM to summarize early messages while keeping recent context. 当对话超过最大长度时自动压缩。使用 LLM 总结早期消息,保留最近上下文。

// Compression strategy
maxHistoryLength: 100 (messages)
compressThreshold: 80% of max
keepRecent: 20 latest messages
summarize: Early messages → summary
📈

Tracing & Retry追踪与重试

Lightweight observability with tracing.ts and reliable network requests with retry.ts using exponential backoff. 轻量级可观测性(tracing.ts)和可靠网络请求(retry.ts),支持指数退避策略。

// Retry configuration
maxAttempts: 3
delay: 1000ms
backoff: 'exponential'
retryOn: [Error, Timeout]
🌐

MCP ProtocolMCP 协议

Model Context Protocol support for integration with other AI clients. Exposes tools via JSON-RPC. 支持模型上下文协议(MCP),可与其他 AI 客户端集成。通过 JSON-RPC 暴露工具。

// MCP methods
tools/list - List all tools
tools/call - Invoke tool
resources/list - List resources
resources/read - Read resource
CogitoAgent Cluster Architecture

Thinking Cycle Workflow思考循环流程

01
Perceive Input感知输入
02
Build Prompt构建提示
03
Call LLM调用 LLM
04
Parse Response解析响应
05
Execute Tools执行工具
06
Update State更新状态

Continues until the response is ready; turns advance immediately as tool results arrive 持续运行直到响应就绪;工具结果返回后立即推进下一轮

CogitoAgent Monitor Panel

Project Structure项目结构

// Core files and their responsibilities

src/
├── agent/ // Agent core modules
│ ├── Agent.ts // Thinking loop controller
│ ├── state.ts // State machine management
│ ├── registry.ts // Tool registration & discovery
│ ├── session.ts // Multi-session management
│ ├── commands.ts // Command handling (/help, /status, etc.)
│ ├── stats.ts // Usage statistics & metrics
│ ├── tracing.ts // Lightweight observability
│ ├── cluster-commands.ts // Sub-agent commands
│ ├── mcp.ts // MCP Server protocol
│ ├── plugin.ts // Plugin system
│ └── tools/ // 28+ tool modules
├── api/ // API layer (client, models, webSearch)
├── io/ // Terminal, Logger, WebSocket
├── config.ts // Configuration management
└── index.ts // Application entry

electron/ // Desktop mode (Electron)
personas/ // 25 preset personas
data/ // Runtime data (auto-created)
05

Getting Started快速开始

CogitoAgent offers multiple operation modes to suit different environments and preferences. CogitoAgent 提供多种运行模式以适应不同环境和偏好。

🖥️ Desktop Mode🖥️ 桌面模式
Electron desktop window + terminal Agent, communicating via WebSocket (port 9527). Features a semi-transparent frosted glass dialog for seamless interaction. Electron 桌面窗口 + 终端 Agent,通过 WebSocket(端口 9527)通信。半透明毛玻璃对话框,实现无缝交互。
npm start
📊 Dashboard Mode📊 仪表盘模式
Full-window dashboard with session management, tool usage statistics, and real-time monitoring. This is the default mode of `npm start`. 全屏仪表盘,包含会话管理、工具使用统计和实时监控,即 npm start 的默认模式。
npm start
💻 CLI Mode💻 命令行模式
Pure command-line mode without Electron or WebSocket. Ideal for servers, remote connections, or resource-constrained environments. 纯命令行模式,无 Electron 或 WebSocket。适用于服务器、远程连接或资源受限环境。
npm run cli
🚀 Setup Wizard🚀 配置向导
Interactive setup wizard for first-time configuration: API settings, workspace path, and persona selection. 交互式配置向导,首次运行时引导完成:API 设置、工作区路径和人设选择。
npm start
CogitoAgent Dashboard

On first run (npm start), the setup wizard will guide you through API configuration, workspace setup, and persona selection. 首次运行时(npm start),配置向导将引导您完成 API 配置、工作区设置和人设选择。

08

Quick Commands快捷指令

ENTER Interrupt thinking, enter command打断思考,输入指令
exit Exit program退出程序
/help Show help显示帮助
/status View status查看状态
/persona Switch persona切换人设
/personas List all personas列出所有人设
/tools List all tools查看所有工具
/config Show configuration查看配置
/sessions List all sessions列出所有会话
/new Create new session创建新会话
/switch Switch session切换会话
/clear Clear conversation清除对话
/wechat/status WeChat channel status微信通道状态
/wechat/login Login via QR code扫码登录微信
/wechat/logout Logout from WeChat退出微信登录
/spawn Create sub-agent创建子智能体
/agents List sub-agents列出子智能体
/delegate Delegate task委派任务

Ready to Get Started?准备好开始了吗?

Choose your preferred mode and let CogitoAgent work for you. 选择您喜欢的模式,让 CogitoAgent 为您工作。