seraph-agent 0.2.0__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 (180) hide show
  1. seraph_agent-0.2.0/PKG-INFO +277 -0
  2. seraph_agent-0.2.0/README.md +234 -0
  3. seraph_agent-0.2.0/brain/acp/__init__.py +1 -0
  4. seraph_agent-0.2.0/brain/acp/server.py +380 -0
  5. seraph_agent-0.2.0/brain/agent/__init__.py +0 -0
  6. seraph_agent-0.2.0/brain/agent/ambient_learning.py +218 -0
  7. seraph_agent-0.2.0/brain/agent/bootstrap.py +107 -0
  8. seraph_agent-0.2.0/brain/agent/btw.py +40 -0
  9. seraph_agent-0.2.0/brain/agent/cache.py +89 -0
  10. seraph_agent-0.2.0/brain/agent/command_queue.py +119 -0
  11. seraph_agent-0.2.0/brain/agent/compaction.py +256 -0
  12. seraph_agent-0.2.0/brain/agent/confidence.py +183 -0
  13. seraph_agent-0.2.0/brain/agent/context_anchors.py +139 -0
  14. seraph_agent-0.2.0/brain/agent/context_manager.py +84 -0
  15. seraph_agent-0.2.0/brain/agent/context_references.py +76 -0
  16. seraph_agent-0.2.0/brain/agent/conversation_branching.py +189 -0
  17. seraph_agent-0.2.0/brain/agent/core.py +221 -0
  18. seraph_agent-0.2.0/brain/agent/cost_router.py +234 -0
  19. seraph_agent-0.2.0/brain/agent/debounce.py +118 -0
  20. seraph_agent-0.2.0/brain/agent/delivery.py +176 -0
  21. seraph_agent-0.2.0/brain/agent/device_pairing.py +151 -0
  22. seraph_agent-0.2.0/brain/agent/dock.py +55 -0
  23. seraph_agent-0.2.0/brain/agent/doctor.py +174 -0
  24. seraph_agent-0.2.0/brain/agent/dreaming.py +193 -0
  25. seraph_agent-0.2.0/brain/agent/event_stream.py +87 -0
  26. seraph_agent-0.2.0/brain/agent/failover.py +347 -0
  27. seraph_agent-0.2.0/brain/agent/focus.py +63 -0
  28. seraph_agent-0.2.0/brain/agent/heartbeat.py +201 -0
  29. seraph_agent-0.2.0/brain/agent/i18n.py +112 -0
  30. seraph_agent-0.2.0/brain/agent/insights.py +93 -0
  31. seraph_agent-0.2.0/brain/agent/link_understanding.py +183 -0
  32. seraph_agent-0.2.0/brain/agent/llm.py +792 -0
  33. seraph_agent-0.2.0/brain/agent/loop_detection.py +189 -0
  34. seraph_agent-0.2.0/brain/agent/markdown_chunks.py +108 -0
  35. seraph_agent-0.2.0/brain/agent/model_router.py +259 -0
  36. seraph_agent-0.2.0/brain/agent/multi_model_consensus.py +186 -0
  37. seraph_agent-0.2.0/brain/agent/pairing.py +128 -0
  38. seraph_agent-0.2.0/brain/agent/personas.py +66 -0
  39. seraph_agent-0.2.0/brain/agent/preemptive_checks.py +232 -0
  40. seraph_agent-0.2.0/brain/agent/process_registry.py +153 -0
  41. seraph_agent-0.2.0/brain/agent/process_tree.py +112 -0
  42. seraph_agent-0.2.0/brain/agent/prompt_builder.py +87 -0
  43. seraph_agent-0.2.0/brain/agent/prompt_compiler.py +141 -0
  44. seraph_agent-0.2.0/brain/agent/prompt_pressure.py +244 -0
  45. seraph_agent-0.2.0/brain/agent/redact.py +76 -0
  46. seraph_agent-0.2.0/brain/agent/restart_recovery.py +132 -0
  47. seraph_agent-0.2.0/brain/agent/self_healing.py +288 -0
  48. seraph_agent-0.2.0/brain/agent/self_improve.py +285 -0
  49. seraph_agent-0.2.0/brain/agent/setup_wizard.py +198 -0
  50. seraph_agent-0.2.0/brain/agent/skill_extraction.py +243 -0
  51. seraph_agent-0.2.0/brain/agent/ssrf_guard.py +124 -0
  52. seraph_agent-0.2.0/brain/agent/tailscale.py +60 -0
  53. seraph_agent-0.2.0/brain/agent/thinking.py +102 -0
  54. seraph_agent-0.2.0/brain/agent/thread_ownership.py +98 -0
  55. seraph_agent-0.2.0/brain/agent/title_generator.py +57 -0
  56. seraph_agent-0.2.0/brain/agent/token_budget_viz.py +210 -0
  57. seraph_agent-0.2.0/brain/agent/tool_prediction.py +174 -0
  58. seraph_agent-0.2.0/brain/agent/trajectory.py +136 -0
  59. seraph_agent-0.2.0/brain/agent/url_safety.py +163 -0
  60. seraph_agent-0.2.0/brain/agent/video_generation.py +62 -0
  61. seraph_agent-0.2.0/brain/auth.py +103 -0
  62. seraph_agent-0.2.0/brain/channels/__init__.py +0 -0
  63. seraph_agent-0.2.0/brain/channels/base.py +329 -0
  64. seraph_agent-0.2.0/brain/channels/canvas.py +244 -0
  65. seraph_agent-0.2.0/brain/channels/dingtalk_bot.py +70 -0
  66. seraph_agent-0.2.0/brain/channels/discord_bot.py +349 -0
  67. seraph_agent-0.2.0/brain/channels/discord_features.py +263 -0
  68. seraph_agent-0.2.0/brain/channels/email_bot.py +81 -0
  69. seraph_agent-0.2.0/brain/channels/feishu_bot.py +105 -0
  70. seraph_agent-0.2.0/brain/channels/google_chat_bot.py +70 -0
  71. seraph_agent-0.2.0/brain/channels/imessage_bot.py +64 -0
  72. seraph_agent-0.2.0/brain/channels/irc_bot.py +83 -0
  73. seraph_agent-0.2.0/brain/channels/line_bot.py +74 -0
  74. seraph_agent-0.2.0/brain/channels/matrix_bot.py +73 -0
  75. seraph_agent-0.2.0/brain/channels/mattermost_bot.py +87 -0
  76. seraph_agent-0.2.0/brain/channels/msteams_bot.py +75 -0
  77. seraph_agent-0.2.0/brain/channels/nostr_bot.py +69 -0
  78. seraph_agent-0.2.0/brain/channels/pwa.py +270 -0
  79. seraph_agent-0.2.0/brain/channels/signal_bot.py +65 -0
  80. seraph_agent-0.2.0/brain/channels/slack_bot.py +190 -0
  81. seraph_agent-0.2.0/brain/channels/slack_features.py +196 -0
  82. seraph_agent-0.2.0/brain/channels/sms_bot.py +75 -0
  83. seraph_agent-0.2.0/brain/channels/telegram.py +1682 -0
  84. seraph_agent-0.2.0/brain/channels/telegram_features.py +323 -0
  85. seraph_agent-0.2.0/brain/channels/twitch_bot.py +75 -0
  86. seraph_agent-0.2.0/brain/channels/voice_wake.py +263 -0
  87. seraph_agent-0.2.0/brain/channels/webchat.py +136 -0
  88. seraph_agent-0.2.0/brain/channels/whatsapp_bot.py +160 -0
  89. seraph_agent-0.2.0/brain/channels/whatsapp_features.py +281 -0
  90. seraph_agent-0.2.0/brain/cli.py +181 -0
  91. seraph_agent-0.2.0/brain/config.py +204 -0
  92. seraph_agent-0.2.0/brain/config_schema.py +221 -0
  93. seraph_agent-0.2.0/brain/control_ui/__init__.py +1 -0
  94. seraph_agent-0.2.0/brain/control_ui/api.py +603 -0
  95. seraph_agent-0.2.0/brain/cron/__init__.py +0 -0
  96. seraph_agent-0.2.0/brain/cron/scheduler.py +169 -0
  97. seraph_agent-0.2.0/brain/diagnostics/__init__.py +1 -0
  98. seraph_agent-0.2.0/brain/diagnostics/telemetry.py +199 -0
  99. seraph_agent-0.2.0/brain/eval/__init__.py +0 -0
  100. seraph_agent-0.2.0/brain/eval/runner.py +201 -0
  101. seraph_agent-0.2.0/brain/mcp_server.py +164 -0
  102. seraph_agent-0.2.0/brain/memory/__init__.py +0 -0
  103. seraph_agent-0.2.0/brain/memory/store.py +293 -0
  104. seraph_agent-0.2.0/brain/models/router.py +273 -0
  105. seraph_agent-0.2.0/brain/plugins/__init__.py +0 -0
  106. seraph_agent-0.2.0/brain/plugins/example_plugin.py +37 -0
  107. seraph_agent-0.2.0/brain/plugins/loader.py +322 -0
  108. seraph_agent-0.2.0/brain/rules/__init__.py +0 -0
  109. seraph_agent-0.2.0/brain/rules/enforcer.py +180 -0
  110. seraph_agent-0.2.0/brain/secrets/__init__.py +1 -0
  111. seraph_agent-0.2.0/brain/secrets/manager.py +277 -0
  112. seraph_agent-0.2.0/brain/security/__init__.py +1 -0
  113. seraph_agent-0.2.0/brain/security/sandbox.py +200 -0
  114. seraph_agent-0.2.0/brain/server.py +272 -0
  115. seraph_agent-0.2.0/brain/sessions/__init__.py +0 -0
  116. seraph_agent-0.2.0/brain/sessions/store.py +330 -0
  117. seraph_agent-0.2.0/brain/sessions/sync.py +94 -0
  118. seraph_agent-0.2.0/brain/skills/__init__.py +0 -0
  119. seraph_agent-0.2.0/brain/skills/generator.py +185 -0
  120. seraph_agent-0.2.0/brain/skills/guard.py +232 -0
  121. seraph_agent-0.2.0/brain/skills/marketplace.py +222 -0
  122. seraph_agent-0.2.0/brain/tools/__init__.py +0 -0
  123. seraph_agent-0.2.0/brain/tools/approval.py +84 -0
  124. seraph_agent-0.2.0/brain/tools/audit.py +294 -0
  125. seraph_agent-0.2.0/brain/tools/browser.py +112 -0
  126. seraph_agent-0.2.0/brain/tools/checkpoint.py +86 -0
  127. seraph_agent-0.2.0/brain/tools/clarify.py +43 -0
  128. seraph_agent-0.2.0/brain/tools/clipboard.py +84 -0
  129. seraph_agent-0.2.0/brain/tools/context.py +65 -0
  130. seraph_agent-0.2.0/brain/tools/database.py +77 -0
  131. seraph_agent-0.2.0/brain/tools/delegate.py +133 -0
  132. seraph_agent-0.2.0/brain/tools/email_tool.py +80 -0
  133. seraph_agent-0.2.0/brain/tools/export.py +83 -0
  134. seraph_agent-0.2.0/brain/tools/export_html.py +93 -0
  135. seraph_agent-0.2.0/brain/tools/files.py +155 -0
  136. seraph_agent-0.2.0/brain/tools/filter.py +83 -0
  137. seraph_agent-0.2.0/brain/tools/fuzzy.py +109 -0
  138. seraph_agent-0.2.0/brain/tools/git.py +107 -0
  139. seraph_agent-0.2.0/brain/tools/grounding.py +137 -0
  140. seraph_agent-0.2.0/brain/tools/health.py +63 -0
  141. seraph_agent-0.2.0/brain/tools/homeassistant.py +95 -0
  142. seraph_agent-0.2.0/brain/tools/image.py +89 -0
  143. seraph_agent-0.2.0/brain/tools/interrupt.py +59 -0
  144. seraph_agent-0.2.0/brain/tools/mcp.py +135 -0
  145. seraph_agent-0.2.0/brain/tools/mixture.py +169 -0
  146. seraph_agent-0.2.0/brain/tools/notify.py +52 -0
  147. seraph_agent-0.2.0/brain/tools/openapi_import.py +169 -0
  148. seraph_agent-0.2.0/brain/tools/patch.py +120 -0
  149. seraph_agent-0.2.0/brain/tools/progress.py +77 -0
  150. seraph_agent-0.2.0/brain/tools/qr_code.py +73 -0
  151. seraph_agent-0.2.0/brain/tools/ratelimit.py +59 -0
  152. seraph_agent-0.2.0/brain/tools/registry.py +75 -0
  153. seraph_agent-0.2.0/brain/tools/sandbox.py +112 -0
  154. seraph_agent-0.2.0/brain/tools/session_search.py +55 -0
  155. seraph_agent-0.2.0/brain/tools/skills_hub.py +134 -0
  156. seraph_agent-0.2.0/brain/tools/ssh.py +82 -0
  157. seraph_agent-0.2.0/brain/tools/terminal.py +112 -0
  158. seraph_agent-0.2.0/brain/tools/todo.py +84 -0
  159. seraph_agent-0.2.0/brain/tools/transcribe.py +74 -0
  160. seraph_agent-0.2.0/brain/tools/usage.py +106 -0
  161. seraph_agent-0.2.0/brain/tools/vision.py +99 -0
  162. seraph_agent-0.2.0/brain/tools/voice.py +88 -0
  163. seraph_agent-0.2.0/brain/tools/voice_mode.py +96 -0
  164. seraph_agent-0.2.0/brain/tools/web.py +128 -0
  165. seraph_agent-0.2.0/brain/tools/webhook.py +138 -0
  166. seraph_agent-0.2.0/brain/tui/__init__.py +1 -0
  167. seraph_agent-0.2.0/brain/tui/app.py +203 -0
  168. seraph_agent-0.2.0/pyproject.toml +70 -0
  169. seraph_agent-0.2.0/seraph_agent.egg-info/PKG-INFO +277 -0
  170. seraph_agent-0.2.0/seraph_agent.egg-info/SOURCES.txt +178 -0
  171. seraph_agent-0.2.0/seraph_agent.egg-info/dependency_links.txt +1 -0
  172. seraph_agent-0.2.0/seraph_agent.egg-info/entry_points.txt +2 -0
  173. seraph_agent-0.2.0/seraph_agent.egg-info/requires.txt +22 -0
  174. seraph_agent-0.2.0/seraph_agent.egg-info/top_level.txt +1 -0
  175. seraph_agent-0.2.0/setup.cfg +4 -0
  176. seraph_agent-0.2.0/tests/test_agent.py +183 -0
  177. seraph_agent-0.2.0/tests/test_core.py +120 -0
  178. seraph_agent-0.2.0/tests/test_llm.py +78 -0
  179. seraph_agent-0.2.0/tests/test_router.py +64 -0
  180. seraph_agent-0.2.0/tests/test_tools.py +95 -0
@@ -0,0 +1,277 @@
1
+ Metadata-Version: 2.4
2
+ Name: seraph-agent
3
+ Version: 0.2.0
4
+ Summary: The AI agent that audits itself. 26 providers, 42 tools, 22 channels, self-improving.
5
+ Author: bosskalash
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/bosskalash/seraph
8
+ Project-URL: Documentation, https://github.com/bosskalash/seraph#readme
9
+ Project-URL: Repository, https://github.com/bosskalash/seraph
10
+ Project-URL: Issues, https://github.com/bosskalash/seraph/issues
11
+ Keywords: ai,agent,self-improving,telegram,discord,llm,tools
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ Requires-Dist: requests>=2.31
24
+ Requires-Dist: flask>=3.0
25
+ Requires-Dist: pyyaml>=6.0
26
+ Requires-Dist: openai>=1.0
27
+ Requires-Dist: anthropic>=0.30
28
+ Provides-Extra: all
29
+ Requires-Dist: openai>=1.0; extra == "all"
30
+ Requires-Dist: anthropic>=0.30; extra == "all"
31
+ Requires-Dist: google-generativeai>=0.5; extra == "all"
32
+ Requires-Dist: boto3>=1.34; extra == "all"
33
+ Requires-Dist: openwakeword>=0.6; extra == "all"
34
+ Requires-Dist: pyaudio>=0.2; extra == "all"
35
+ Requires-Dist: qrcode>=7.0; extra == "all"
36
+ Requires-Dist: websocket-client>=1.7; extra == "all"
37
+ Requires-Dist: opentelemetry-api>=1.20; extra == "all"
38
+ Requires-Dist: opentelemetry-sdk>=1.20; extra == "all"
39
+ Requires-Dist: opentelemetry-exporter-otlp>=1.20; extra == "all"
40
+ Provides-Extra: dev
41
+ Requires-Dist: pytest>=7.0; extra == "dev"
42
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
43
+
44
+ # Seraph
45
+
46
+ **The AI agent that audits itself.**
47
+
48
+ Self-improving, self-auditing, multi-channel AI agent platform. 45 tools, 22 channels, runs everywhere.
49
+
50
+ ## Why Seraph?
51
+
52
+ | | OpenClaw | Hermes | Seraph |
53
+ |--|----------|--------|--------|
54
+ | Self-improving | No | Yes | **Yes** |
55
+ | Self-auditing | No | No | **Yes** |
56
+ | Anti-dilution | No | No | **Yes** |
57
+ | Windows native | Clunky | No (WSL) | **Yes** |
58
+ | Channels | 22 | 16 | **22** |
59
+ | Tools | ~30 | 48 | **45** |
60
+ | Models | ~10 | 200+ | **200+** |
61
+ | Memory | SQLite | SQLite+FTS5 | **SQLite+FTS5** |
62
+ | Skills guard | No | Regex | **Regex + trust scoring** |
63
+ | Smart routing | No | Yes | **Yes + failover + pool** |
64
+ | Canvas | Electron | No | **Web (any browser)** |
65
+ | Companion app | Native | No | **PWA (all platforms)** |
66
+
67
+ ## Install
68
+
69
+ **Quick start (pip):**
70
+ ```bash
71
+ pip install seraph-agent
72
+ seraph onboard
73
+ ```
74
+
75
+ **From source:**
76
+ ```bash
77
+ git clone https://github.com/bosskalash/seraph.git
78
+ cd seraph
79
+ pip install -e ".[all]"
80
+ python3 brain/cli.py onboard
81
+ ```
82
+
83
+ **Docker:**
84
+ ```bash
85
+ git clone https://github.com/bosskalash/seraph.git
86
+ cd seraph
87
+ cp .env.example .env # edit with your keys
88
+ docker compose up -d
89
+ ```
90
+
91
+ **Manual:**
92
+ ```bash
93
+ git clone https://github.com/bosskalash/seraph.git ~/seraph
94
+ cd ~/seraph
95
+ pip install requests flask pyyaml openai
96
+ # Edit .env with your API keys
97
+ python3 run.py
98
+ ```
99
+
100
+ ## Setup
101
+
102
+ 1. Get an API key from [OpenAI](https://platform.openai.com) or [Anthropic](https://console.anthropic.com)
103
+ 2. Get a Telegram bot token from [@BotFather](https://t.me/BotFather)
104
+ 3. Run `seraph onboard` or edit `.env`:
105
+ ```env
106
+ SERAPH_PROVIDER=openai
107
+ SERAPH_MODEL=gpt-5.4
108
+ OPENAI_API_KEY=your-key-here
109
+ SERAPH_TELEGRAM_TOKEN=your-bot-token
110
+ SERAPH_ALLOWED_USERS=your-telegram-id
111
+ ```
112
+ 4. Run: `python3 run.py`
113
+ 5. Message your bot on Telegram
114
+
115
+ ## 45 Built-in Tools
116
+
117
+ | Category | Tools |
118
+ |----------|-------|
119
+ | **Core** | terminal, read_file, write_file, list_files, clipboard |
120
+ | **Web** | web_search, web_fetch, browse (headless) |
121
+ | **Code** | run_code (sandbox), apply_patch, audit_file, audit_directory |
122
+ | **AI** | describe_image (vision), mixture_of_agents, delegate_task, verify_claim |
123
+ | **Media** | generate_image (DALL-E), text_to_speech, transcribe, voice_respond |
124
+ | **Comms** | send_email, notify, manage_webhook, send_notification |
125
+ | **Data** | query_sqlite, export_conversation, export_html, search_sessions |
126
+ | **DevOps** | ssh, git, git_clone, import_api (OpenAPI), health_check |
127
+ | **Smart Home** | homeassistant |
128
+ | **Workflow** | todo, checkpoint, clarify, request_approval, interrupt, progress |
129
+ | **Skills** | skills_hub (install/search/sync), fuzzy_find, mcp (Model Context Protocol) |
130
+ | **Meta** | canvas (visual workspace), qr_code, usage_stats |
131
+
132
+ ## 22 Channels
133
+
134
+ | Channel | Protocol | Status |
135
+ |---------|----------|--------|
136
+ | Telegram | Bot API | Production |
137
+ | Discord | Gateway WS | Ready |
138
+ | Slack | Socket Mode | Ready |
139
+ | WhatsApp | Cloud API | Ready |
140
+ | Signal | signal-cli REST | Ready |
141
+ | Matrix | Client-Server | Ready |
142
+ | Email | IMAP + SMTP | Ready |
143
+ | SMS | Twilio | Ready |
144
+ | IRC | Raw socket | Ready |
145
+ | MS Teams | Bot Framework | Ready |
146
+ | Google Chat | Webhook API | Ready |
147
+ | LINE | Messaging API | Ready |
148
+ | Mattermost | REST API | Ready |
149
+ | Twitch | IRC over SSL | Ready |
150
+ | Nostr | Relay protocol | Ready |
151
+ | DingTalk | Robot API | Ready |
152
+ | Feishu/Lark | Open API | Ready |
153
+ | iMessage | BlueBubbles | Ready |
154
+ | WebChat | HTTP server | Ready |
155
+ | Canvas | Visual workspace | Ready |
156
+ | Voice Wake | Mic + wake word | Ready |
157
+ | PWA | Progressive Web App | Ready |
158
+
159
+ ## 40+ Slash Commands
160
+
161
+ ```
162
+ /new Fresh conversation /improve Self-improvement cycle
163
+ /model View or change model /cron Manage scheduled jobs
164
+ /status System status /heartbeat Health monitor
165
+ /tools List available tools /doctor Run diagnostics
166
+ /exec Run a shell command /approve DM pairing approval
167
+ /search Search the web /think Set reasoning level
168
+ /read Read a file /insights Conversation analytics
169
+ /files List workspace files /update Pull latest from git
170
+ /memory Memory status /restart Restart the bot
171
+ /remember Save a fact /backup Backup all data
172
+ /forget Remove a fact /logs View recent logs
173
+ /recall Search past conversations /budget Daily spending limit
174
+ /persona Switch personality /template Prompt templates
175
+ /raw Direct LLM (zero overhead) /config View/change settings
176
+ /sandbox Run Python code /compress Smart compress
177
+ /branch Fork conversation /retry Retry last response
178
+ /undo Undo last exchange /send Send a file
179
+ /checkpoint Save conversation state /id Show Telegram ID
180
+ /restore Restore a checkpoint /help Show all commands
181
+ ```
182
+
183
+ ## Architecture
184
+
185
+ ```
186
+ User (Telegram/Discord/Slack/22 channels)
187
+ |
188
+ v
189
+ Gateway (Go) -- HTTP proxy, health, routing
190
+ |
191
+ v
192
+ Brain (Python) -- LLM reasoning + 45 tools
193
+ |
194
+ v
195
+ SQLite -- memory (FTS5), sessions, skills, rules
196
+ |
197
+ v
198
+ Canvas / PWA -- visual workspace + mobile app
199
+ ```
200
+
201
+ ## What Makes Seraph Different
202
+
203
+ ### Anti-Dilution Engine
204
+ Other platforms waste 30-50% of context on bloated system prompts. Seraph has:
205
+ - **Smart tool filtering** -- only sends relevant tools per message
206
+ - **Prompt compiler** -- minifies, deduplicates, strips decorations
207
+ - **Context budget** -- system overhead capped at 20%
208
+ - **Lazy injection** -- memory only loaded when conversation needs it
209
+ - **`/raw` mode** -- zero injection, direct LLM access
210
+
211
+ ### Self-Improvement Loop
212
+ The agent improves itself over time:
213
+ - Reviews conversations for user corrections
214
+ - Stores lessons in active memory
215
+ - Auto-generates reusable skills from complex tasks
216
+ - Self-audits its own code for bugs
217
+ - Runs on cron (every 6h) or manual (`/improve`)
218
+
219
+ ### Skills Guard
220
+ Every external skill is security-scanned before installation:
221
+ - 30+ threat patterns (exfiltration, injection, destructive, credential theft)
222
+ - Trust scoring (0-100)
223
+ - Install policy by source (builtin/trusted/community)
224
+
225
+ ### Canvas
226
+ Live visual workspace at `http://localhost:18803/canvas`. The agent can push HTML, code, tables, charts, and run JavaScript in your browser.
227
+
228
+ ### Model Router
229
+ - **Smart routing** -- simple questions use cheap model, complex use strong
230
+ - **Failover chain** -- auto-switch when a model is down
231
+ - **Credential pool** -- rotate API keys with exponential backoff
232
+
233
+ ## Configuration
234
+
235
+ ### YAML Config (`~/.seraph/config.yaml`)
236
+ ```yaml
237
+ model: gpt-5.4
238
+ provider: openai
239
+ memory:
240
+ enabled: true
241
+ skills:
242
+ auto_generate: true
243
+ audit:
244
+ enabled: true
245
+ max_rounds: 5
246
+ ```
247
+
248
+ ### Identity (`~/.seraph/SOUL.md`)
249
+ Customize who your agent is. Injected into every prompt.
250
+
251
+ ### MCP Servers (`~/.seraph/mcp.json`)
252
+ ```json
253
+ {
254
+ "mcpServers": {
255
+ "context7": {
256
+ "command": "npx",
257
+ "args": ["-y", "@upstash/context7-mcp"]
258
+ }
259
+ }
260
+ }
261
+ ```
262
+
263
+ ### Supported Models
264
+ - OpenAI: gpt-5.4, gpt-4.1, gpt-4o, gpt-4o-mini
265
+ - Anthropic: claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5
266
+ - OpenRouter: 200+ models via one API key
267
+
268
+ ## Testing
269
+
270
+ ```bash
271
+ pip install -e ".[dev]"
272
+ python -m pytest tests/ -v
273
+ ```
274
+
275
+ ## License
276
+
277
+ MIT
@@ -0,0 +1,234 @@
1
+ # Seraph
2
+
3
+ **The AI agent that audits itself.**
4
+
5
+ Self-improving, self-auditing, multi-channel AI agent platform. 45 tools, 22 channels, runs everywhere.
6
+
7
+ ## Why Seraph?
8
+
9
+ | | OpenClaw | Hermes | Seraph |
10
+ |--|----------|--------|--------|
11
+ | Self-improving | No | Yes | **Yes** |
12
+ | Self-auditing | No | No | **Yes** |
13
+ | Anti-dilution | No | No | **Yes** |
14
+ | Windows native | Clunky | No (WSL) | **Yes** |
15
+ | Channels | 22 | 16 | **22** |
16
+ | Tools | ~30 | 48 | **45** |
17
+ | Models | ~10 | 200+ | **200+** |
18
+ | Memory | SQLite | SQLite+FTS5 | **SQLite+FTS5** |
19
+ | Skills guard | No | Regex | **Regex + trust scoring** |
20
+ | Smart routing | No | Yes | **Yes + failover + pool** |
21
+ | Canvas | Electron | No | **Web (any browser)** |
22
+ | Companion app | Native | No | **PWA (all platforms)** |
23
+
24
+ ## Install
25
+
26
+ **Quick start (pip):**
27
+ ```bash
28
+ pip install seraph-agent
29
+ seraph onboard
30
+ ```
31
+
32
+ **From source:**
33
+ ```bash
34
+ git clone https://github.com/bosskalash/seraph.git
35
+ cd seraph
36
+ pip install -e ".[all]"
37
+ python3 brain/cli.py onboard
38
+ ```
39
+
40
+ **Docker:**
41
+ ```bash
42
+ git clone https://github.com/bosskalash/seraph.git
43
+ cd seraph
44
+ cp .env.example .env # edit with your keys
45
+ docker compose up -d
46
+ ```
47
+
48
+ **Manual:**
49
+ ```bash
50
+ git clone https://github.com/bosskalash/seraph.git ~/seraph
51
+ cd ~/seraph
52
+ pip install requests flask pyyaml openai
53
+ # Edit .env with your API keys
54
+ python3 run.py
55
+ ```
56
+
57
+ ## Setup
58
+
59
+ 1. Get an API key from [OpenAI](https://platform.openai.com) or [Anthropic](https://console.anthropic.com)
60
+ 2. Get a Telegram bot token from [@BotFather](https://t.me/BotFather)
61
+ 3. Run `seraph onboard` or edit `.env`:
62
+ ```env
63
+ SERAPH_PROVIDER=openai
64
+ SERAPH_MODEL=gpt-5.4
65
+ OPENAI_API_KEY=your-key-here
66
+ SERAPH_TELEGRAM_TOKEN=your-bot-token
67
+ SERAPH_ALLOWED_USERS=your-telegram-id
68
+ ```
69
+ 4. Run: `python3 run.py`
70
+ 5. Message your bot on Telegram
71
+
72
+ ## 45 Built-in Tools
73
+
74
+ | Category | Tools |
75
+ |----------|-------|
76
+ | **Core** | terminal, read_file, write_file, list_files, clipboard |
77
+ | **Web** | web_search, web_fetch, browse (headless) |
78
+ | **Code** | run_code (sandbox), apply_patch, audit_file, audit_directory |
79
+ | **AI** | describe_image (vision), mixture_of_agents, delegate_task, verify_claim |
80
+ | **Media** | generate_image (DALL-E), text_to_speech, transcribe, voice_respond |
81
+ | **Comms** | send_email, notify, manage_webhook, send_notification |
82
+ | **Data** | query_sqlite, export_conversation, export_html, search_sessions |
83
+ | **DevOps** | ssh, git, git_clone, import_api (OpenAPI), health_check |
84
+ | **Smart Home** | homeassistant |
85
+ | **Workflow** | todo, checkpoint, clarify, request_approval, interrupt, progress |
86
+ | **Skills** | skills_hub (install/search/sync), fuzzy_find, mcp (Model Context Protocol) |
87
+ | **Meta** | canvas (visual workspace), qr_code, usage_stats |
88
+
89
+ ## 22 Channels
90
+
91
+ | Channel | Protocol | Status |
92
+ |---------|----------|--------|
93
+ | Telegram | Bot API | Production |
94
+ | Discord | Gateway WS | Ready |
95
+ | Slack | Socket Mode | Ready |
96
+ | WhatsApp | Cloud API | Ready |
97
+ | Signal | signal-cli REST | Ready |
98
+ | Matrix | Client-Server | Ready |
99
+ | Email | IMAP + SMTP | Ready |
100
+ | SMS | Twilio | Ready |
101
+ | IRC | Raw socket | Ready |
102
+ | MS Teams | Bot Framework | Ready |
103
+ | Google Chat | Webhook API | Ready |
104
+ | LINE | Messaging API | Ready |
105
+ | Mattermost | REST API | Ready |
106
+ | Twitch | IRC over SSL | Ready |
107
+ | Nostr | Relay protocol | Ready |
108
+ | DingTalk | Robot API | Ready |
109
+ | Feishu/Lark | Open API | Ready |
110
+ | iMessage | BlueBubbles | Ready |
111
+ | WebChat | HTTP server | Ready |
112
+ | Canvas | Visual workspace | Ready |
113
+ | Voice Wake | Mic + wake word | Ready |
114
+ | PWA | Progressive Web App | Ready |
115
+
116
+ ## 40+ Slash Commands
117
+
118
+ ```
119
+ /new Fresh conversation /improve Self-improvement cycle
120
+ /model View or change model /cron Manage scheduled jobs
121
+ /status System status /heartbeat Health monitor
122
+ /tools List available tools /doctor Run diagnostics
123
+ /exec Run a shell command /approve DM pairing approval
124
+ /search Search the web /think Set reasoning level
125
+ /read Read a file /insights Conversation analytics
126
+ /files List workspace files /update Pull latest from git
127
+ /memory Memory status /restart Restart the bot
128
+ /remember Save a fact /backup Backup all data
129
+ /forget Remove a fact /logs View recent logs
130
+ /recall Search past conversations /budget Daily spending limit
131
+ /persona Switch personality /template Prompt templates
132
+ /raw Direct LLM (zero overhead) /config View/change settings
133
+ /sandbox Run Python code /compress Smart compress
134
+ /branch Fork conversation /retry Retry last response
135
+ /undo Undo last exchange /send Send a file
136
+ /checkpoint Save conversation state /id Show Telegram ID
137
+ /restore Restore a checkpoint /help Show all commands
138
+ ```
139
+
140
+ ## Architecture
141
+
142
+ ```
143
+ User (Telegram/Discord/Slack/22 channels)
144
+ |
145
+ v
146
+ Gateway (Go) -- HTTP proxy, health, routing
147
+ |
148
+ v
149
+ Brain (Python) -- LLM reasoning + 45 tools
150
+ |
151
+ v
152
+ SQLite -- memory (FTS5), sessions, skills, rules
153
+ |
154
+ v
155
+ Canvas / PWA -- visual workspace + mobile app
156
+ ```
157
+
158
+ ## What Makes Seraph Different
159
+
160
+ ### Anti-Dilution Engine
161
+ Other platforms waste 30-50% of context on bloated system prompts. Seraph has:
162
+ - **Smart tool filtering** -- only sends relevant tools per message
163
+ - **Prompt compiler** -- minifies, deduplicates, strips decorations
164
+ - **Context budget** -- system overhead capped at 20%
165
+ - **Lazy injection** -- memory only loaded when conversation needs it
166
+ - **`/raw` mode** -- zero injection, direct LLM access
167
+
168
+ ### Self-Improvement Loop
169
+ The agent improves itself over time:
170
+ - Reviews conversations for user corrections
171
+ - Stores lessons in active memory
172
+ - Auto-generates reusable skills from complex tasks
173
+ - Self-audits its own code for bugs
174
+ - Runs on cron (every 6h) or manual (`/improve`)
175
+
176
+ ### Skills Guard
177
+ Every external skill is security-scanned before installation:
178
+ - 30+ threat patterns (exfiltration, injection, destructive, credential theft)
179
+ - Trust scoring (0-100)
180
+ - Install policy by source (builtin/trusted/community)
181
+
182
+ ### Canvas
183
+ Live visual workspace at `http://localhost:18803/canvas`. The agent can push HTML, code, tables, charts, and run JavaScript in your browser.
184
+
185
+ ### Model Router
186
+ - **Smart routing** -- simple questions use cheap model, complex use strong
187
+ - **Failover chain** -- auto-switch when a model is down
188
+ - **Credential pool** -- rotate API keys with exponential backoff
189
+
190
+ ## Configuration
191
+
192
+ ### YAML Config (`~/.seraph/config.yaml`)
193
+ ```yaml
194
+ model: gpt-5.4
195
+ provider: openai
196
+ memory:
197
+ enabled: true
198
+ skills:
199
+ auto_generate: true
200
+ audit:
201
+ enabled: true
202
+ max_rounds: 5
203
+ ```
204
+
205
+ ### Identity (`~/.seraph/SOUL.md`)
206
+ Customize who your agent is. Injected into every prompt.
207
+
208
+ ### MCP Servers (`~/.seraph/mcp.json`)
209
+ ```json
210
+ {
211
+ "mcpServers": {
212
+ "context7": {
213
+ "command": "npx",
214
+ "args": ["-y", "@upstash/context7-mcp"]
215
+ }
216
+ }
217
+ }
218
+ ```
219
+
220
+ ### Supported Models
221
+ - OpenAI: gpt-5.4, gpt-4.1, gpt-4o, gpt-4o-mini
222
+ - Anthropic: claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5
223
+ - OpenRouter: 200+ models via one API key
224
+
225
+ ## Testing
226
+
227
+ ```bash
228
+ pip install -e ".[dev]"
229
+ python -m pytest tests/ -v
230
+ ```
231
+
232
+ ## License
233
+
234
+ MIT
@@ -0,0 +1 @@
1
+ from .server import ACPServer