plutus-ai 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. plutus_ai-0.3.2/.claude/settings.json +19 -0
  2. plutus_ai-0.3.2/.gitignore +44 -0
  3. plutus_ai-0.3.2/ARCHITECTURE.md +65 -0
  4. plutus_ai-0.3.2/CLAUDE.md +78 -0
  5. plutus_ai-0.3.2/LICENSE +21 -0
  6. plutus_ai-0.3.2/PKG-INFO +438 -0
  7. plutus_ai-0.3.2/README.md +394 -0
  8. plutus_ai-0.3.2/install.ps1 +113 -0
  9. plutus_ai-0.3.2/install.sh +82 -0
  10. plutus_ai-0.3.2/plutus/__init__.py +3 -0
  11. plutus_ai-0.3.2/plutus/__main__.py +5 -0
  12. plutus_ai-0.3.2/plutus/cli.py +640 -0
  13. plutus_ai-0.3.2/plutus/config.py +252 -0
  14. plutus_ai-0.3.2/plutus/connectors/__init__.py +25 -0
  15. plutus_ai-0.3.2/plutus/connectors/base.py +191 -0
  16. plutus_ai-0.3.2/plutus/connectors/email.py +133 -0
  17. plutus_ai-0.3.2/plutus/connectors/telegram.py +496 -0
  18. plutus_ai-0.3.2/plutus/connectors/telegram_bridge.py +343 -0
  19. plutus_ai-0.3.2/plutus/connectors/whatsapp.py +94 -0
  20. plutus_ai-0.3.2/plutus/core/__init__.py +5 -0
  21. plutus_ai-0.3.2/plutus/core/agent.py +1188 -0
  22. plutus_ai-0.3.2/plutus/core/computer_use_agent.py +450 -0
  23. plutus_ai-0.3.2/plutus/core/conversation.py +364 -0
  24. plutus_ai-0.3.2/plutus/core/heartbeat.py +181 -0
  25. plutus_ai-0.3.2/plutus/core/llm.py +373 -0
  26. plutus_ai-0.3.2/plutus/core/memory.py +596 -0
  27. plutus_ai-0.3.2/plutus/core/model_router.py +378 -0
  28. plutus_ai-0.3.2/plutus/core/planner.py +297 -0
  29. plutus_ai-0.3.2/plutus/core/scheduler.py +517 -0
  30. plutus_ai-0.3.2/plutus/core/subprocess_manager.py +399 -0
  31. plutus_ai-0.3.2/plutus/core/summarizer.py +300 -0
  32. plutus_ai-0.3.2/plutus/core/worker_pool.py +423 -0
  33. plutus_ai-0.3.2/plutus/gateway/__init__.py +1 -0
  34. plutus_ai-0.3.2/plutus/gateway/routes.py +2102 -0
  35. plutus_ai-0.3.2/plutus/gateway/server.py +837 -0
  36. plutus_ai-0.3.2/plutus/gateway/ws.py +389 -0
  37. plutus_ai-0.3.2/plutus/guardrails/__init__.py +13 -0
  38. plutus_ai-0.3.2/plutus/guardrails/audit.py +83 -0
  39. plutus_ai-0.3.2/plutus/guardrails/engine.py +203 -0
  40. plutus_ai-0.3.2/plutus/guardrails/policies.py +144 -0
  41. plutus_ai-0.3.2/plutus/guardrails/tiers.py +190 -0
  42. plutus_ai-0.3.2/plutus/pc/__init__.py +45 -0
  43. plutus_ai-0.3.2/plutus/pc/browser_control.py +1022 -0
  44. plutus_ai-0.3.2/plutus/pc/computer_use.py +531 -0
  45. plutus_ai-0.3.2/plutus/pc/context.py +702 -0
  46. plutus_ai-0.3.2/plutus/pc/desktop_control.py +1830 -0
  47. plutus_ai-0.3.2/plutus/pc/keyboard.py +317 -0
  48. plutus_ai-0.3.2/plutus/pc/mouse.py +334 -0
  49. plutus_ai-0.3.2/plutus/pc/os_control.py +588 -0
  50. plutus_ai-0.3.2/plutus/pc/platform_utils.py +265 -0
  51. plutus_ai-0.3.2/plutus/pc/screen.py +515 -0
  52. plutus_ai-0.3.2/plutus/pc/smart_click.py +232 -0
  53. plutus_ai-0.3.2/plutus/pc/windows.py +697 -0
  54. plutus_ai-0.3.2/plutus/pc/workflow.py +406 -0
  55. plutus_ai-0.3.2/plutus/skills/__init__.py +27 -0
  56. plutus_ai-0.3.2/plutus/skills/apps/__init__.py +0 -0
  57. plutus_ai-0.3.2/plutus/skills/apps/browser.py +106 -0
  58. plutus_ai-0.3.2/plutus/skills/apps/calendar.py +198 -0
  59. plutus_ai-0.3.2/plutus/skills/apps/files.py +175 -0
  60. plutus_ai-0.3.2/plutus/skills/apps/gmail.py +138 -0
  61. plutus_ai-0.3.2/plutus/skills/apps/spotify.py +163 -0
  62. plutus_ai-0.3.2/plutus/skills/apps/whatsapp.py +233 -0
  63. plutus_ai-0.3.2/plutus/skills/base.py +43 -0
  64. plutus_ai-0.3.2/plutus/skills/creator.py +611 -0
  65. plutus_ai-0.3.2/plutus/skills/engine.py +255 -0
  66. plutus_ai-0.3.2/plutus/skills/loader.py +109 -0
  67. plutus_ai-0.3.2/plutus/skills/python_runner.py +529 -0
  68. plutus_ai-0.3.2/plutus/skills/registry.py +130 -0
  69. plutus_ai-0.3.2/plutus/tools/__init__.py +6 -0
  70. plutus_ai-0.3.2/plutus/tools/app_manager.py +413 -0
  71. plutus_ai-0.3.2/plutus/tools/base.py +46 -0
  72. plutus_ai-0.3.2/plutus/tools/browser.py +277 -0
  73. plutus_ai-0.3.2/plutus/tools/clipboard.py +94 -0
  74. plutus_ai-0.3.2/plutus/tools/code_analysis.py +97 -0
  75. plutus_ai-0.3.2/plutus/tools/code_editor.py +186 -0
  76. plutus_ai-0.3.2/plutus/tools/connector_tool.py +368 -0
  77. plutus_ai-0.3.2/plutus/tools/desktop.py +296 -0
  78. plutus_ai-0.3.2/plutus/tools/filesystem.py +249 -0
  79. plutus_ai-0.3.2/plutus/tools/memory_tool.py +278 -0
  80. plutus_ai-0.3.2/plutus/tools/pc_control.py +949 -0
  81. plutus_ai-0.3.2/plutus/tools/process.py +134 -0
  82. plutus_ai-0.3.2/plutus/tools/registry.py +183 -0
  83. plutus_ai-0.3.2/plutus/tools/scheduler_tool.py +256 -0
  84. plutus_ai-0.3.2/plutus/tools/shell.py +165 -0
  85. plutus_ai-0.3.2/plutus/tools/subprocess_tool.py +150 -0
  86. plutus_ai-0.3.2/plutus/tools/system_info.py +145 -0
  87. plutus_ai-0.3.2/plutus/tools/tool_creator.py +365 -0
  88. plutus_ai-0.3.2/plutus/tools/web_search.py +308 -0
  89. plutus_ai-0.3.2/plutus/tools/worker_tool.py +239 -0
  90. plutus_ai-0.3.2/plutus/tools/wsl.py +366 -0
  91. plutus_ai-0.3.2/plutus/workers/__init__.py +0 -0
  92. plutus_ai-0.3.2/plutus/workers/code_analysis_worker.py +369 -0
  93. plutus_ai-0.3.2/plutus/workers/custom_worker.py +249 -0
  94. plutus_ai-0.3.2/plutus/workers/file_edit_worker.py +411 -0
  95. plutus_ai-0.3.2/plutus/workers/shell_worker.py +113 -0
  96. plutus_ai-0.3.2/pyproject.toml +73 -0
  97. plutus_ai-0.3.2/tests/__init__.py +0 -0
  98. plutus_ai-0.3.2/tests/test_config.py +149 -0
  99. plutus_ai-0.3.2/tests/test_guardrails.py +257 -0
  100. plutus_ai-0.3.2/tests/test_memory_system.py +690 -0
  101. plutus_ai-0.3.2/tests/test_subprocess.py +590 -0
  102. plutus_ai-0.3.2/tests/test_tools.py +299 -0
  103. plutus_ai-0.3.2/ui/index.html +19 -0
  104. plutus_ai-0.3.2/ui/package-lock.json +4253 -0
  105. plutus_ai-0.3.2/ui/package.json +29 -0
  106. plutus_ai-0.3.2/ui/pnpm-lock.yaml +2563 -0
  107. plutus_ai-0.3.2/ui/pnpm-workspace.yaml +2 -0
  108. plutus_ai-0.3.2/ui/postcss.config.js +6 -0
  109. plutus_ai-0.3.2/ui/public/plutus.svg +6 -0
  110. plutus_ai-0.3.2/ui/src/App.tsx +335 -0
  111. plutus_ai-0.3.2/ui/src/components/chat/ChatInput.tsx +111 -0
  112. plutus_ai-0.3.2/ui/src/components/chat/ChatView.tsx +177 -0
  113. plutus_ai-0.3.2/ui/src/components/chat/CommandCenter.tsx +389 -0
  114. plutus_ai-0.3.2/ui/src/components/chat/ConversationHistory.tsx +409 -0
  115. plutus_ai-0.3.2/ui/src/components/chat/MarkdownRenderer.tsx +192 -0
  116. plutus_ai-0.3.2/ui/src/components/chat/MessageBubble.tsx +637 -0
  117. plutus_ai-0.3.2/ui/src/components/chat/ToolApproval.tsx +59 -0
  118. plutus_ai-0.3.2/ui/src/components/connectors/ConnectorsView.tsx +664 -0
  119. plutus_ai-0.3.2/ui/src/components/dashboard/ActivityFeed.tsx +111 -0
  120. plutus_ai-0.3.2/ui/src/components/dashboard/DashboardView.tsx +338 -0
  121. plutus_ai-0.3.2/ui/src/components/dashboard/StatusCard.tsx +39 -0
  122. plutus_ai-0.3.2/ui/src/components/guardrails/GuardrailsView.tsx +120 -0
  123. plutus_ai-0.3.2/ui/src/components/guardrails/PermissionToggle.tsx +93 -0
  124. plutus_ai-0.3.2/ui/src/components/guardrails/TierSelector.tsx +94 -0
  125. plutus_ai-0.3.2/ui/src/components/layout/Header.tsx +73 -0
  126. plutus_ai-0.3.2/ui/src/components/layout/Sidebar.tsx +201 -0
  127. plutus_ai-0.3.2/ui/src/components/layout/UpdateBanner.tsx +192 -0
  128. plutus_ai-0.3.2/ui/src/components/memory/MemoryView.tsx +573 -0
  129. plutus_ai-0.3.2/ui/src/components/onboarding/OnboardingWizard.tsx +1139 -0
  130. plutus_ai-0.3.2/ui/src/components/pc-control/PCControlView.tsx +1065 -0
  131. plutus_ai-0.3.2/ui/src/components/settings/HeartbeatConfig.tsx +271 -0
  132. plutus_ai-0.3.2/ui/src/components/settings/ModelConfig.tsx +348 -0
  133. plutus_ai-0.3.2/ui/src/components/settings/SettingsView.tsx +252 -0
  134. plutus_ai-0.3.2/ui/src/components/settings/WSLSetup.tsx +733 -0
  135. plutus_ai-0.3.2/ui/src/components/skills/SkillsView.tsx +807 -0
  136. plutus_ai-0.3.2/ui/src/components/tool-creator/ToolCreatorView.tsx +710 -0
  137. plutus_ai-0.3.2/ui/src/components/tools/ToolsView.tsx +346 -0
  138. plutus_ai-0.3.2/ui/src/components/workers/WorkersView.tsx +814 -0
  139. plutus_ai-0.3.2/ui/src/hooks/useApi.ts +26 -0
  140. plutus_ai-0.3.2/ui/src/hooks/useWebSocket.ts +66 -0
  141. plutus_ai-0.3.2/ui/src/index.css +169 -0
  142. plutus_ai-0.3.2/ui/src/lib/api.ts +329 -0
  143. plutus_ai-0.3.2/ui/src/lib/types.ts +135 -0
  144. plutus_ai-0.3.2/ui/src/main.tsx +10 -0
  145. plutus_ai-0.3.2/ui/src/stores/appStore.ts +113 -0
  146. plutus_ai-0.3.2/ui/tailwind.config.ts +36 -0
  147. plutus_ai-0.3.2/ui/tsconfig.json +25 -0
  148. plutus_ai-0.3.2/ui/tsconfig.tsbuildinfo +1 -0
  149. plutus_ai-0.3.2/ui/vite.config.ts +26 -0
@@ -0,0 +1,19 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(pytest tests*)",
5
+ "Bash(ruff check*)",
6
+ "Bash(pip install*)",
7
+ "Bash(cd ui && npm*)",
8
+ "Bash(git status*)",
9
+ "Bash(git diff*)",
10
+ "Bash(git log*)",
11
+ "Bash(git branch*)",
12
+ "Bash(git add*)",
13
+ "Bash(git commit*)",
14
+ "Bash(git push*)",
15
+ "Bash(plutus*)"
16
+ ],
17
+ "deny": []
18
+ }
19
+ }
@@ -0,0 +1,44 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ *.egg
9
+ .eggs/
10
+ *.whl
11
+
12
+ # Virtual environments
13
+ .venv/
14
+ venv/
15
+ env/
16
+
17
+ # IDE
18
+ .vscode/
19
+ .idea/
20
+ *.swp
21
+ *.swo
22
+ *~
23
+
24
+ # Node.js / UI
25
+ ui/node_modules/
26
+ ui/.vite/
27
+
28
+ # Plutus runtime
29
+ .plutus/
30
+ *.db
31
+ audit.jsonl
32
+
33
+ # OS
34
+ .DS_Store
35
+ Thumbs.db
36
+
37
+ # Environment
38
+ .env
39
+ .env.local
40
+
41
+ # Testing
42
+ .pytest_cache/
43
+ htmlcov/
44
+ .coverage
@@ -0,0 +1,65 @@
1
+ # Plutus Agent — Architecture
2
+
3
+ ## Core Enhancement: Subprocess-Spawning AI Agent
4
+
5
+ The key upgrade is a **subprocess orchestrator** that allows Claude to:
6
+
7
+ 1. **Spawn worker subprocesses** — isolated child processes for file editing, code analysis, and tool creation
8
+ 2. **Parallel execution** — multiple workers can run simultaneously
9
+ 3. **Dynamic tool creation** — Claude can write new tools at runtime and hot-load them
10
+ 4. **Sandboxed execution** — each subprocess runs in its own context with resource limits
11
+
12
+ ## Module Structure
13
+
14
+ ```
15
+ plutus/
16
+ ├── __init__.py
17
+ ├── __main__.py
18
+ ├── cli.py # Enhanced CLI with interactive REPL mode
19
+ ├── config.py # Configuration management
20
+ ├── core/
21
+ │ ├── agent.py # Main agent runtime (enhanced)
22
+ │ ├── conversation.py # Conversation/context management
23
+ │ ├── heartbeat.py # Heartbeat system
24
+ │ ├── llm.py # LLM client (LiteLLM)
25
+ │ ├── memory.py # SQLite memory store
26
+ │ ├── planner.py # Plan management
27
+ │ └── subprocess_manager.py # NEW: Subprocess orchestrator
28
+ ├── gateway/ # Web API + WebSocket
29
+ ├── guardrails/ # Permission tiers + audit
30
+ ├── skills/ # YAML skill definitions
31
+ └── tools/
32
+ ├── base.py # Tool base class
33
+ ├── registry.py # Tool registry (enhanced with hot-reload)
34
+ ├── filesystem.py # File operations
35
+ ├── shell.py # Shell commands
36
+ ├── process.py # Process management
37
+ ├── code_analysis.py # NEW: AST-based code analysis
38
+ ├── code_editor.py # NEW: Intelligent code editing
39
+ ├── tool_creator.py # NEW: Dynamic tool creation
40
+ ├── subprocess_tool.py # NEW: Subprocess spawning tool
41
+ ├── browser.py
42
+ ├── clipboard.py
43
+ ├── desktop.py
44
+ ├── system_info.py
45
+ └── app_manager.py
46
+ ```
47
+
48
+ ## Subprocess Architecture
49
+
50
+ ```
51
+ Main Agent Process
52
+ ├── SubprocessManager
53
+ │ ├── Worker Pool (configurable max)
54
+ │ ├── Task Queue (priority-based)
55
+ │ └── Result Collector
56
+ ├── Workers
57
+ │ ├── FileEditWorker — applies diffs, creates files
58
+ │ ├── CodeAnalysisWorker — AST parsing, linting, dependency analysis
59
+ │ ├── ShellWorker — sandboxed command execution
60
+ │ └── CustomWorker — runs dynamically-created tools
61
+ └── Communication
62
+ ├── stdin/stdout JSON protocol
63
+ ├── Shared temp directory for large payloads
64
+ └── Event stream back to agent
65
+ ```
@@ -0,0 +1,78 @@
1
+ # Plutus - AI Agent with Full System Control
2
+
3
+ ## Quick Reference
4
+
5
+ ```bash
6
+ # Install
7
+ pip install -e ".[dev]"
8
+ cd ui && npm install
9
+
10
+ # Run
11
+ plutus start # Production (serves built UI)
12
+ plutus start --dev # Dev mode (Vite proxy on :5173)
13
+
14
+ # Test
15
+ pytest tests # All tests
16
+ pytest tests -x -q # Stop on first failure, quiet output
17
+
18
+ # Lint
19
+ ruff check plutus/ # Check Python
20
+ ruff check --fix plutus/ # Auto-fix
21
+
22
+ # Build UI
23
+ cd ui && npm run build # TypeScript check + Vite build → ui/dist/
24
+ ```
25
+
26
+ ## Architecture
27
+
28
+ Monorepo: Python backend (`plutus/`) + React/TypeScript frontend (`ui/`).
29
+
30
+ ### Backend (`plutus/`)
31
+
32
+ - **`core/agent.py`** — Main agent loop. `process_message()` yields `AgentEvent` objects. Tool rounds are capped by `config.agent.max_tool_rounds` (plan tool calls don't count toward the limit).
33
+ - **`core/llm.py`** — LLM client via LiteLLM. Model-agnostic (Anthropic, OpenAI, Ollama, custom).
34
+ - **`core/memory.py`** — SQLite-backed async store (aiosqlite). Conversations, messages, learned facts.
35
+ - **`core/conversation.py`** — Message history management with context windowing.
36
+ - **`core/planner.py`** — Built-in plan tool for multi-step task tracking.
37
+ - **`core/heartbeat.py`** — Autonomous background execution with configurable intervals.
38
+ - **`gateway/server.py`** — FastAPI server, lifespan setup, static UI serving.
39
+ - **`gateway/routes.py`** — REST API endpoints for config, guardrails, history, approvals.
40
+ - **`gateway/ws.py`** — WebSocket handler for real-time agent events.
41
+ - **`guardrails/`** — 4-tier permission system (observer → assistant → operator → autonomous). Policies in `tiers.py`, engine in `engine.py`, audit logging.
42
+ - **`tools/`** — Tool implementations (shell, filesystem, browser, process, system_info, clipboard, desktop, app_manager). Each extends base `Tool` class with async `execute()`.
43
+ - **`config.py`** — Pydantic config stored at `~/.plutus/config.json`. Secrets in `~/.plutus/.secrets.json` (chmod 600).
44
+
45
+ ### Frontend (`ui/`)
46
+
47
+ - React 19 + TypeScript 5.6 + Vite 6 + TailwindCSS 3.4
48
+ - Zustand for state (`stores/appStore.ts`)
49
+ - Components: `chat/`, `dashboard/`, `settings/`, `guardrails/`
50
+ - API client: `lib/api.ts` — REST calls to FastAPI backend
51
+ - WebSocket hook: `hooks/useWebSocket.ts` — real-time event streaming
52
+
53
+ ### Key Patterns
54
+
55
+ - **Event streaming**: Agent emits typed events (`thinking`, `text`, `tool_call`, `tool_result`, `done`) → WebSocket → UI renders in real time.
56
+ - **Guardrail flow**: Every tool call → `guardrails.check()` → allowed / denied / requires_approval → approval queue with timeout.
57
+ - **Config updates**: UI PATCH `/api/config` → `config.update(patch)` → deep merge → save to disk. Some settings (heartbeat) apply live via dedicated endpoints.
58
+
59
+ ## Code Style
60
+
61
+ - Python: ruff with `line-length = 100`, rules `E, F, I, N, W, UP`, target `py311`
62
+ - Use `from __future__ import annotations` in all Python files
63
+ - Type hints everywhere (Pydantic models for config, typed dicts for tool results)
64
+ - Async-first: all I/O operations use async/await
65
+ - Frontend: TypeScript strict mode, functional React components with hooks
66
+
67
+ ## Testing
68
+
69
+ - pytest with `asyncio_mode = "auto"` — async tests just work
70
+ - Test files: `tests/test_config.py`, `tests/test_guardrails.py`, `tests/test_tools.py`
71
+ - Run `pytest tests -x -q` before committing
72
+
73
+ ## Config Locations
74
+
75
+ - `~/.plutus/config.json` — All settings (model, guardrails, gateway, memory, heartbeat, planner, agent)
76
+ - `~/.plutus/.secrets.json` — API keys only (chmod 600, never in config.json)
77
+ - `~/.plutus/memory.db` — SQLite conversation/memory store
78
+ - `~/.plutus/skills/` — User-defined YAML skills
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Plutus Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,438 @@
1
+ Metadata-Version: 2.4
2
+ Name: plutus-ai
3
+ Version: 0.3.2
4
+ Summary: Autonomous AI agent with subprocess orchestration, dynamic tool creation, and a local-first web interface
5
+ Project-URL: Homepage, https://github.com/plutus-ai/plutus
6
+ Project-URL: Repository, https://github.com/plutus-ai/plutus
7
+ Project-URL: Issues, https://github.com/plutus-ai/plutus/issues
8
+ Author: Plutus Contributors
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: agent,ai,autonomous,guardrails,local-first
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: aiohttp>=3.9.0
21
+ Requires-Dist: aiosqlite>=0.20.0
22
+ Requires-Dist: anthropic>=0.40.0
23
+ Requires-Dist: click>=8.1.0
24
+ Requires-Dist: fastapi>=0.115.0
25
+ Requires-Dist: httpx>=0.28.0
26
+ Requires-Dist: litellm>=1.55.0
27
+ Requires-Dist: playwright>=1.49.0
28
+ Requires-Dist: psutil>=6.1.0
29
+ Requires-Dist: pyautogui>=0.9.54
30
+ Requires-Dist: pydantic-settings>=2.6.0
31
+ Requires-Dist: pydantic>=2.10.0
32
+ Requires-Dist: pyperclip>=1.8.0
33
+ Requires-Dist: python-multipart>=0.0.18
34
+ Requires-Dist: pywinauto>=0.6.8; sys_platform == 'win32'
35
+ Requires-Dist: rich>=13.9.0
36
+ Requires-Dist: uvicorn[standard]>=0.32.0
37
+ Requires-Dist: websockets>=14.0
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
40
+ Requires-Dist: pytest-cov>=6.0.0; extra == 'dev'
41
+ Requires-Dist: pytest>=8.3.0; extra == 'dev'
42
+ Requires-Dist: ruff>=0.8.0; extra == 'dev'
43
+ Description-Content-Type: text/markdown
44
+
45
+ # Plutus — Autonomous AI Agent with Subprocess Orchestration
46
+
47
+ <p align="center">
48
+ <strong>A better, easier-to-use AI agent that spawns subprocesses to edit code, analyze files, and create new tools on the fly.</strong>
49
+ </p>
50
+
51
+ <p align="center">
52
+ <a href="#features">Features</a> •
53
+ <a href="#quick-start">Quick Start</a> •
54
+ <a href="#architecture">Architecture</a> •
55
+ <a href="#tools">Tools</a> •
56
+ <a href="#dynamic-tool-creation">Dynamic Tools</a> •
57
+ <a href="#configuration">Configuration</a>
58
+ </p>
59
+
60
+ ---
61
+
62
+ ## What is Plutus?
63
+
64
+ Plutus is an autonomous AI agent system that gives Claude (or any LLM) the ability to **spawn isolated subprocesses** for file editing, code analysis, shell execution, and dynamic tool creation. Think of it as **Claude Code on steroids** — the AI can not only run commands and edit files, but also create entirely new tools at runtime to solve problems it wasn't originally designed for.
65
+
66
+ ### Key Differentiators
67
+
68
+ | Feature | OpenClaw | Plutus |
69
+ |---------|----------|--------|
70
+ | File editing | Basic read/write | Subprocess-isolated surgical edits with diff output |
71
+ | Code analysis | None | Full AST analysis (functions, classes, complexity, call graphs) |
72
+ | Subprocess spawning | None | Parallel worker pool with JSON protocol |
73
+ | Dynamic tool creation | None | Create, validate, and hot-load new Python tools at runtime |
74
+ | CLI experience | Basic | Rich interactive REPL with slash commands |
75
+ | Guardrails | Basic | 4-tier system (observer → autonomous) with audit logging |
76
+ | Planning | None | Built-in plan/step tracking with auto-progress |
77
+
78
+ ## Features
79
+
80
+ ### Subprocess Orchestration
81
+ The agent spawns isolated worker subprocesses for every operation — file edits, code analysis, shell commands, and custom scripts all run in their own process with resource limits and timeouts.
82
+
83
+ ### Intelligent Code Editing
84
+ Surgical find/replace edits with diff output. The agent reads files, applies precise changes, and verifies the result — all in subprocess isolation.
85
+
86
+ ### Deep Code Analysis
87
+ AST-based analysis of Python files:
88
+ - Function and class extraction with signatures
89
+ - Cyclomatic complexity scoring (A–F ratings)
90
+ - Import dependency mapping
91
+ - Call graph generation
92
+ - TODO/FIXME/HACK detection
93
+ - Module summarization
94
+
95
+ ### Dynamic Tool Creation
96
+ The agent can write new Python tools at runtime:
97
+ 1. Writes the tool code
98
+ 2. Validates it (syntax check)
99
+ 3. Saves it to `~/.plutus/custom_tools/`
100
+ 4. Hot-loads it into the tool registry
101
+ 5. Uses it immediately
102
+
103
+ ### 4-Tier Guardrail System
104
+ - **Observer** — Read-only, AI can only observe
105
+ - **Assistant** — Every action requires user approval
106
+ - **Operator** — Pre-approved actions run autonomously
107
+ - **Autonomous** — Full control, no restrictions
108
+
109
+ ### Multiple Interfaces
110
+ - **Terminal REPL** (`plutus chat`) — Rich interactive chat with slash commands
111
+ - **Single prompt** (`plutus run "..."`) — Execute one task and exit
112
+ - **Web UI** (`plutus start`) — Full web interface with WebSocket streaming
113
+
114
+ ## Quick Start
115
+
116
+ ### Installation
117
+
118
+ ```bash
119
+ # Clone the repository
120
+ git clone https://github.com/Crypt0nly/plutus.git
121
+ cd plutus
122
+
123
+ # Install with pip
124
+ pip install -e .
125
+
126
+ # Run setup wizard
127
+ plutus setup
128
+ ```
129
+
130
+ ### First Run
131
+
132
+ ```bash
133
+ # Interactive terminal chat
134
+ plutus chat
135
+
136
+ # Or run a single prompt
137
+ plutus run "Create a Python script that sorts a CSV file by the second column"
138
+
139
+ # Or launch the web UI
140
+ plutus start
141
+ ```
142
+
143
+ ### Chat Commands
144
+
145
+ Inside `plutus chat`, use slash commands:
146
+
147
+ | Command | Description |
148
+ |---------|-------------|
149
+ | `/help` | Show available commands |
150
+ | `/tools` | List all available tools |
151
+ | `/plan` | Show current execution plan |
152
+ | `/clear` | Start a new conversation |
153
+ | `/tier` | Show or change guardrail tier |
154
+ | `/workers` | Show active subprocesses |
155
+ | `/exit` | Exit the chat |
156
+
157
+ ## Architecture
158
+
159
+ ```
160
+ ┌─────────────────────────────────────────────────────┐
161
+ │ Agent Runtime │
162
+ │ ┌──────────┐ ┌──────────┐ ┌──────────────────┐ │
163
+ │ │ LLM │ │ Planner │ │ Guardrails │ │
164
+ │ │ (Claude) │ │ │ │ (4-tier system) │ │
165
+ │ └────┬─────┘ └──────────┘ └──────────────────┘ │
166
+ │ │ │
167
+ │ ┌────▼──────────────────────────────────────────┐ │
168
+ │ │ Tool Registry │ │
169
+ │ │ ┌────────┐ ┌────────────┐ ┌───────────────┐ │ │
170
+ │ │ │ Shell │ │ Code Editor│ │ Code Analysis │ │ │
171
+ │ │ └────────┘ └────────────┘ └───────────────┘ │ │
172
+ │ │ ┌────────────┐ ┌──────────────┐ ┌─────────┐ │ │
173
+ │ │ │ Subprocess │ │ Tool Creator │ │ Browser │ │ │
174
+ │ │ └────────────┘ └──────────────┘ └─────────┘ │ │
175
+ │ │ ┌──────────┐ ┌─────────┐ ┌─────────────────┐ │ │
176
+ │ │ │Filesystem│ │ Process │ │ Custom Tools... │ │ │
177
+ │ │ └──────────┘ └─────────┘ └─────────────────┘ │ │
178
+ │ └───────────────────┬───────────────────────────┘ │
179
+ │ │ │
180
+ │ ┌───────────────────▼───────────────────────────┐ │
181
+ │ │ Subprocess Manager │ │
182
+ │ │ ┌─────────────┐ ┌──────────────────────┐ │ │
183
+ │ │ │ Worker Pool │ │ JSON stdin/stdout │ │ │
184
+ │ │ │ (max: 8) │ │ protocol │ │ │
185
+ │ │ └─────────────┘ └──────────────────────┘ │ │
186
+ │ └───────────────────────────────────────────────┘ │
187
+ │ │ │
188
+ │ ┌───────────────────▼───────────────────────────┐ │
189
+ │ │ Worker Subprocesses │ │
190
+ │ │ ┌──────┐ ┌──────────┐ ┌──────────┐ ┌──────┐ │ │
191
+ │ │ │Shell │ │File Edit │ │Code Anal.│ │Custom│ │ │
192
+ │ │ │Worker│ │Worker │ │Worker │ │Worker│ │ │
193
+ │ │ └──────┘ └──────────┘ └──────────┘ └──────┘ │ │
194
+ │ └───────────────────────────────────────────────┘ │
195
+ └─────────────────────────────────────────────────────┘
196
+ ```
197
+
198
+ ### Subprocess Communication Protocol
199
+
200
+ Workers communicate via **JSON over stdin/stdout** (one JSON object per line):
201
+
202
+ ```
203
+ Agent → Worker: {"action": "edit", "path": "/file.py", "edits": [...]}
204
+ Worker → Agent: {"success": true, "result": {"changes": 2, "diff": "..."}}
205
+ ```
206
+
207
+ This design provides:
208
+ - **Isolation** — each operation runs in its own process
209
+ - **Safety** — crashes in workers don't affect the agent
210
+ - **Parallelism** — multiple workers can run simultaneously
211
+ - **Simplicity** — JSON protocol is easy to debug and extend
212
+
213
+ ## Tools
214
+
215
+ ### Built-in Tools
216
+
217
+ | Tool | Description |
218
+ |------|-------------|
219
+ | `shell` | Execute shell commands |
220
+ | `filesystem` | File system operations (legacy, still available) |
221
+ | `code_editor` | Create, read, and edit files via subprocess |
222
+ | `code_analysis` | AST-based Python code analysis via subprocess |
223
+ | `subprocess` | Direct subprocess spawning for parallel tasks |
224
+ | `tool_creator` | Create new tools at runtime |
225
+ | `process` | System process management |
226
+ | `system_info` | System information queries |
227
+ | `browser` | Web browsing (Playwright) |
228
+ | `clipboard` | Clipboard operations |
229
+ | `desktop` | Desktop/window management |
230
+ | `app_manager` | Application management |
231
+
232
+ ### Code Editor Operations
233
+
234
+ ```
235
+ read — Read file content (with optional line range)
236
+ write — Create or overwrite a file
237
+ append — Append content to a file
238
+ edit — Apply surgical find/replace edits
239
+ delete — Delete a file or directory
240
+ move — Move/rename a file
241
+ copy — Copy a file or directory
242
+ mkdir — Create directories
243
+ list — List directory contents
244
+ find — Find files by glob pattern
245
+ grep — Search file contents with regex
246
+ diff — Show diff between two files
247
+ ```
248
+
249
+ ### Code Analysis Operations
250
+
251
+ ```
252
+ analyze — Full analysis (everything below combined)
253
+ find_functions — List all function/method definitions with signatures
254
+ find_classes — List all class definitions with methods
255
+ find_imports — Extract all import statements
256
+ find_todos — Find TODO/FIXME/HACK/NOTE comments
257
+ complexity — Calculate cyclomatic complexity per function
258
+ symbols — Extract all top-level symbols
259
+ call_graph — Build function call graph
260
+ summarize — Generate human-readable summary
261
+ ```
262
+
263
+ ## Dynamic Tool Creation
264
+
265
+ The agent can create new tools when it encounters a task that requires capabilities it doesn't have:
266
+
267
+ ```python
268
+ # Example: Agent creates a CSV processor tool
269
+ tool_creator(
270
+ operation="create",
271
+ tool_name="csv_processor",
272
+ description="Process and transform CSV files",
273
+ code="""
274
+ import csv
275
+ from pathlib import Path
276
+
277
+ def main(args):
278
+ path = args.get('path', '')
279
+ operation = args.get('operation', 'read')
280
+
281
+ if operation == 'read':
282
+ with open(path) as f:
283
+ reader = csv.DictReader(f)
284
+ rows = list(reader)
285
+ return {'success': True, 'result': {'rows': rows, 'count': len(rows)}}
286
+
287
+ elif operation == 'sort':
288
+ column = args.get('column', '')
289
+ with open(path) as f:
290
+ reader = csv.DictReader(f)
291
+ rows = sorted(list(reader), key=lambda r: r.get(column, ''))
292
+ return {'success': True, 'result': {'rows': rows, 'count': len(rows)}}
293
+
294
+ return {'success': False, 'error': f'Unknown operation: {operation}'}
295
+ """
296
+ )
297
+ ```
298
+
299
+ Created tools are:
300
+ - **Validated** — syntax-checked before saving
301
+ - **Persisted** — saved to `~/.plutus/custom_tools/` across sessions
302
+ - **Hot-loaded** — immediately available in the tool registry
303
+ - **Isolated** — executed in subprocess workers
304
+
305
+ ## Configuration
306
+
307
+ ### Config File: `~/.plutus/config.json`
308
+
309
+ ```json
310
+ {
311
+ "model": {
312
+ "provider": "anthropic",
313
+ "model": "claude-sonnet-4-6",
314
+ "temperature": 0.7,
315
+ "max_tokens": 4096
316
+ },
317
+ "guardrails": {
318
+ "tier": "operator",
319
+ "audit_enabled": true
320
+ },
321
+ "agent": {
322
+ "max_tool_rounds": 25
323
+ },
324
+ "planner": {
325
+ "enabled": true,
326
+ "auto_plan": true
327
+ },
328
+ "gateway": {
329
+ "host": "127.0.0.1",
330
+ "port": 7777
331
+ }
332
+ }
333
+ ```
334
+
335
+ ### Supported Providers
336
+
337
+ | Provider | Models | Config |
338
+ |----------|--------|--------|
339
+ | Anthropic | Claude 4 Sonnet, Claude 4 Opus, etc. | `ANTHROPIC_API_KEY` |
340
+ | OpenAI | GPT-4.1, GPT-4.1-mini, etc. | `OPENAI_API_KEY` |
341
+ | Ollama | Llama 3.2, Mistral, etc. | Local, no key needed |
342
+ | Custom | Any OpenAI-compatible endpoint | `API_KEY` + base URL |
343
+
344
+ ### API Keys
345
+
346
+ Keys are stored securely in `~/.plutus/.secrets.json` (chmod 600) and never exposed via the API. Set them via:
347
+
348
+ ```bash
349
+ # Setup wizard
350
+ plutus setup
351
+
352
+ # Environment variable
353
+ export ANTHROPIC_API_KEY=sk-ant-...
354
+
355
+ # Or via the web UI settings page
356
+ ```
357
+
358
+ ## CLI Reference
359
+
360
+ ```bash
361
+ plutus # Show help
362
+ plutus start # Launch web UI + API server
363
+ plutus chat # Interactive terminal chat
364
+ plutus run "prompt" # Run a single prompt
365
+ plutus setup # Setup wizard
366
+ plutus status # Show configuration
367
+ plutus tools # List available tools
368
+ plutus set-tier <tier> # Change guardrail tier
369
+ plutus audit # Show audit log
370
+ plutus config-show # Display full config as JSON
371
+ ```
372
+
373
+ ## Development
374
+
375
+ ```bash
376
+ # Install dev dependencies
377
+ pip install -e ".[dev]"
378
+
379
+ # Run tests
380
+ pytest tests/ -v
381
+
382
+ # Run specific test file
383
+ pytest tests/test_subprocess.py -v
384
+
385
+ # Lint
386
+ ruff check plutus/
387
+ ```
388
+
389
+ ## Project Structure
390
+
391
+ ```
392
+ plutus/
393
+ ├── plutus/
394
+ │ ├── __init__.py
395
+ │ ├── __main__.py
396
+ │ ├── cli.py # CLI with chat REPL
397
+ │ ├── config.py # Configuration management
398
+ │ ├── core/
399
+ │ │ ├── agent.py # Main agent runtime
400
+ │ │ ├── conversation.py # Conversation management
401
+ │ │ ├── heartbeat.py # Heartbeat system
402
+ │ │ ├── llm.py # LLM client (LiteLLM)
403
+ │ │ ├── memory.py # SQLite memory store
404
+ │ │ ├── planner.py # Plan management
405
+ │ │ └── subprocess_manager.py # Subprocess orchestrator
406
+ │ ├── gateway/ # Web API + WebSocket
407
+ │ ├── guardrails/ # Permission tiers + audit
408
+ │ ├── skills/ # YAML skill definitions
409
+ │ ├── tools/
410
+ │ │ ├── base.py # Tool base class
411
+ │ │ ├── registry.py # Tool registry with hot-reload
412
+ │ │ ├── code_analysis.py # AST-based code analysis
413
+ │ │ ├── code_editor.py # File creation and editing
414
+ │ │ ├── subprocess_tool.py # Direct subprocess spawning
415
+ │ │ ├── tool_creator.py # Dynamic tool creation
416
+ │ │ ├── shell.py # Shell commands
417
+ │ │ ├── filesystem.py # File system operations
418
+ │ │ ├── process.py # Process management
419
+ │ │ ├── browser.py # Web browsing
420
+ │ │ └── ...
421
+ │ └── workers/
422
+ │ ├── shell_worker.py # Shell command worker
423
+ │ ├── file_edit_worker.py # File editing worker
424
+ │ ├── code_analysis_worker.py # Code analysis worker
425
+ │ └── custom_worker.py # Dynamic tool worker
426
+ ├── ui/ # React web interface
427
+ ├── tests/
428
+ │ ├── test_subprocess.py # 34 comprehensive tests
429
+ │ ├── test_config.py
430
+ │ ├── test_guardrails.py
431
+ │ └── test_tools.py
432
+ ├── pyproject.toml
433
+ └── README.md
434
+ ```
435
+
436
+ ## License
437
+
438
+ MIT License — see [LICENSE](LICENSE) for details.