CogitoAgent

agent
Security Audit
Fail
Health Warn
  • License รขโ‚ฌโ€ License: Apache-2.0
  • Description รขโ‚ฌโ€ Repository has a description
  • Active repo รขโ‚ฌโ€ Last push 0 days ago
  • Low visibility รขโ‚ฌโ€ Only 5 GitHub stars
Code Fail
  • execSync รขโ‚ฌโ€ Synchronous shell command execution in electron/main.js
  • os.homedir รขโ‚ฌโ€ User home directory access in electron/main.js
  • process.env รขโ‚ฌโ€ Environment variable access in electron/main.js
Permissions Pass
  • Permissions รขโ‚ฌโ€ No dangerous permissions requested

No AI report is available for this listing yet.

SUMMARY

๐Ÿ”ฅ CogitoAgent โ€” An autonomous AI agent, cloud-driven but locally executed. It continuously thinks, automatically analyzes, and integrates practical tools like file management, code execution, web search, and database operations โ€” secure and efficient.

README.md

CogitoAgent

Think Continuously ยท Act Autonomously ยท Stay Private

Cogito, ergo sum โ€” CogitoAgent is not just a tool; it is your autonomous thinking partner in your local environment.

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 configured by the user, with no need to upload any files to third-party servers, ensuring data privacy while providing a continuously operating intelligent assistant service.

CogitoAgent dashboard

Unlike traditional chatbots, CogitoAgent possesses the ability to Think Continuously, Explore Autonomously, and Execute Tools, capable of proactively discovering and organizing your local file assets in the background, with additional capabilities available through an extensible toolset.

Version Node License Status


Core Features

Feature Description
Privacy First All data stored locally; no files uploaded to third-party servers
Continuous Thinking Automatically triggers a thinking cycle every 3 seconds (configurable)
Tool Execution 16+ tool modules with 100+ tools for file operations, code execution, Git, databases, OCR, Office documents, and more
Security Sandbox JavaScript code execution uses isolated-vm for process-level isolation
Multi-Session Management Multiple independent conversation sessions with persistent storage and auto-compression
Desktop Mode Electron desktop window communicating via WebSocket with the terminal Agent
MCP Protocol Expose tools as MCP Server for integration with other AI clients
Plugin System Dynamically load custom tool plugins
Thought Chain Visualization Real-time visualization of thinking process and tool execution
Agent Cluster Sub-agent creation, task delegation, and multi-agent collaboration
Monitor Panel Dedicated window for real-time cluster topology, thought chain, and tool stats

๐Ÿš€ Quick Start

Requirements

  • Node.js 22.12 or higher
  • npm or yarn package manager
  • Python 3.x (optional, for Python code execution)

Note for users in China: If npm install fails to download the Electron binary:

$env:ELECTRON_MIRROR = "https://npmmirror.com/mirrors/electron/"
npm install

Installation

git clone https://gitee.com/cnt-code/cogito-agent.git
cd cogito-agent
npm install
npm start

First-Time Setup

  1. API Base URL โ€” Supports OpenAI-compatible third-party APIs
  2. API Key โ€” Your API key
  3. Model Name โ€” e.g., gpt-4o, claude-3-sonnet, etc.
  4. Workspace Path โ€” The directory the AI can access
  5. Persona Selection โ€” Choose a preset AI persona

Usage Modes

Command Mode Description
npm start Setup Wizard First-time configuration or modifying settings
npm run electron:desktop Desktop Mode Electron overlay window + terminal Agent via WebSocket
npm run electron:dashboard Dashboard Mode Full-window dashboard with session management and tool visualization
npm run cli CLI Mode Terminal-only, no Electron (for server/headless environments)

Tool System

All tools are managed by registry.js and invoked via [TOOL] functionName(args) [/TOOL].

Category File Main Functions
File Operations file.js ls, read, create, copy, mkdir
Path Utilities path.js getBasePath
Web Tools web.js search, browse, fetchPage
Browser Automation browser.js initBrowser, clickElement, fillField, selectOption, viewChanges, getPageContent, takeScreenshot, closeBrowser, searchOnPage, findElements, searchOnEngine, downloadFile
System Operations system.js listApps, openApp, closeApp
Code Execution code.js executeCode, executeFile, runJavaScript, runPython, formatCode
Security Sandbox sandbox.js createJavaScriptSandbox, runJavaScriptSandbox, runPythonSandbox, executeCodeSandbox
Git git.js gitInit, gitClone, gitAdd, gitCommit, gitPush, gitPull, gitStatus, gitLog, gitBranchCreate, gitBranchDelete, gitBranchList, gitCheckout, gitCheckoutNew, gitMerge, gitDiff, gitRemoteAdd, gitRemoteList, gitConfigUser, gitReset, gitStash, gitStashPop
Task Management task.js createTask, getTasks, getTask, updateTask, deleteTask, completeTask, splitTask, getTaskStats, clearTasks
Memory System memory.js addMemory, searchMemory, getAllMemories, getMemory, updateMemory, deleteMemory, getMemoryStats, getRelatedMemories, clearMemory
Data Processing data.js readCSV, writeCSV, readJSON, writeJSON, csvToJSON, jsonToCSV, queryData, analyzeData, sortData
Database db.js executeSQL, query, insert, update, deleteData, createTable, dropTable, getTables, getTableSchema, executeTransaction, closeDB
Email email.js sendEmail, sendTextEmail, sendHtmlEmail, sendTemplateEmail, sendEmailWithAttachments, checkEmailConfig
System Monitoring monitor.js getCPUInfo, getMemoryInfo, getDiskInfo, getNetworkInfo, getProcesses, getSystemInfo, getCurrentProcess, getSystemLoad, monitorSystem
Scheduled Tasks scheduler.js addScheduleTask, getScheduleTasks, getScheduleTask, updateScheduleTask, toggleScheduleTask, removeScheduleTask, startScheduler, stopScheduler
Storage storage.js FileStorage, createStorage
Image Recognition ocr.js ocr, ocrBatch
Vision Analysis vision.js vision, visionFromUrl
Office Documents office.js createPpt, createWord, createExcel, readExcel

Detailed tool documentation: registration mechanism, usage examples, best practices โ†’ introduction/tools.md (Chinese)


Architecture

Component Responsibility
Agent.js Thinking loop โ€” automatically triggers every 3 seconds
state.js State machine โ€” THINKING / AWAITING_INPUT / AWAITING_CONFIRMATION
registry.js Tool registry โ€” centralized management of all tool modules
session.js Session management โ€” multi-session switching, context compression
commands.js Command handling โ€” /help, /status, /persona, /sessions, etc.
sandbox.js Code sandbox โ€” isolated-vm process-level isolation
stats.js Statistics โ€” tool usage tracking and metrics
tracing.js Tracing โ€” lightweight observability for tool executions and LLM calls
retry.js Retry & Circuit Breaker โ€” reliable network requests
mcp.js MCP Server โ€” expose tools as MCP protocol
plugin.js Plugin system โ€” dynamic loading of custom tool plugins
ws-server.js WebSocket โ€” desktop mode communication (port 9527)

Complete architecture details: think cycle diagrams, tool call flow, state machine, message flow, WebSocket โ†’ introduction/architecture.md (Chinese)


Command Reference

Command Description
/sessions List all sessions
/new Create a new session
/switch <id> Switch to a session
/delete <id> Delete a session
/rename <name> Rename current session
/help Display help
/status Display current status
/config Display configuration
/persona <name> Switch persona
/personas List all available personas
/tools List all available tools
/clear Clear conversation history
/debug Toggle debug mode
ENTER Interrupt thinking, enter input mode
exit Exit the program

Configuration

Configuration via config.json and environment variables (.env), with env vars taking priority.

Full configuration reference: environment variables list, advanced options (compression, truncation, archiving) โ†’ introduction/configuration.md (Chinese)


Project Structure

cogito-agent/
โ”œโ”€โ”€ src/                              # Source code
โ”‚   โ”œโ”€โ”€ agent/                        # Core agent module
โ”‚   โ”‚   โ”œโ”€โ”€ Agent.js / state.js / registry.js
โ”‚   โ”‚   โ”œโ”€โ”€ commands.js / session.js / stats.js
โ”‚   โ”‚   โ”œโ”€โ”€ mcp.js / plugin.js / tracing.js / retry.js
โ”‚   โ”‚   โ””โ”€โ”€ tools/                    # 16+ tool modules
โ”‚   โ”œโ”€โ”€ api/                          # API layer (client, models, webSearch)
โ”‚   โ”œโ”€โ”€ io/                           # Terminal, Logger, WebSocket
โ”‚   โ”œโ”€โ”€ config.js                     # Configuration management
โ”‚   โ””โ”€โ”€ index.js                      # Application entry
โ”œโ”€โ”€ electron/                         # Desktop mode
โ”‚   โ”œโ”€โ”€ main.js / preload.cjs / agent-bridge.js
โ”‚   โ”œโ”€โ”€ desktop/ / dashboard/ / monitor/ / setup/
โ”‚   โ”œโ”€โ”€ shared/                       # Shared utilities
โ”‚   โ””โ”€โ”€ assets/
โ”œโ”€โ”€ personas/                         # 22 preset personas (13 modern + 9 ancient)
โ”œโ”€โ”€ tests/                            # Test files
โ”œโ”€โ”€ data/                             # Runtime data (auto-created)
โ””โ”€โ”€ introduction/                     # Detailed documentation
    โ”œโ”€โ”€ tools.md                      # Tool system details
    โ”œโ”€โ”€ architecture.md               # Architecture details
    โ”œโ”€โ”€ configuration.md              # Configuration guide
    โ”œโ”€โ”€ systems.md                    # Core systems details
    โ”œโ”€โ”€ extensions.md                 # Extensions details
    โ””โ”€โ”€ deployment.md                 # Deployment & development

Core Systems

See introduction/systems.md (Chinese) for details

  • Memory System โ€” SQLite-based long-term storage and semantic retrieval
  • Task Management โ€” Task creation, decomposition, and status tracking
  • Code Sandbox โ€” isolated-vm process-level isolation for JS and Python
  • Personas โ€” 22 preset roles with custom and hot-switch support
  • Session Management โ€” Independent contexts with auto-compression
  • Statistics โ€” Tool usage tracking and performance metrics
  • Thought Chain Visualization โ€” Real-time thinking process display
  • Agent Cluster โ€” Sub-agent creation, task delegation, and cluster monitoring, see introduction/agent-cluster.md

Extensions

See introduction/extensions.md (Chinese) for details

  • Plugin System โ€” Dynamic loading of custom tool plugins
  • MCP Protocol โ€” Expose tools as MCP Server
  • Tracing โ€” Lightweight observability for tool executions and LLM calls
  • Circuit Breaker & Retry โ€” Reliable network requests
  • Multi-Model โ€” OpenAI, Moark, Anthropic, Google support
  • Web Search โ€” Built-in internet search capability

Docker

See introduction/deployment.md (Chinese) for details

docker-compose up -d

Changelog

v2.3.0

  • Multi-session management, tool category on-demand loading, auto context compression
  • Sandbox upgrade โ€” deep freezing of built-in objects
  • New tracing.js, retry.js, MCP protocol, plugin system
  • New OCR and Vision analysis tools
  • Statistics module for tool usage tracking
  • Thought chain visualization

v2.2.0

  • Agent.js modularized, logger.js with log levels

v2.1.0

  • Removed vm2, switched to Node.js native vm module

v2.0.0

  • Code execution engine, Git, task management, memory system
  • Data processing, SQLite, email, monitoring, scheduled tasks

License

Apache 2.0


Built with CogitoAgent Team

Reviews (0)

No results found