@peonai/swarm 0.1.0

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 (61) hide show
  1. package/.dockerignore +6 -0
  2. package/Dockerfile +9 -0
  3. package/README.md +29 -0
  4. package/app/api/health/route.ts +2 -0
  5. package/app/api/v1/admin/agents/[id]/route.ts +12 -0
  6. package/app/api/v1/admin/agents/route.ts +31 -0
  7. package/app/api/v1/admin/audit/route.ts +23 -0
  8. package/app/api/v1/admin/cleanup/route.ts +21 -0
  9. package/app/api/v1/admin/export/route.ts +15 -0
  10. package/app/api/v1/admin/history/route.ts +23 -0
  11. package/app/api/v1/admin/profile/route.ts +23 -0
  12. package/app/api/v1/admin/settings/route.ts +44 -0
  13. package/app/api/v1/auth/route.ts +5 -0
  14. package/app/api/v1/memory/route.ts +105 -0
  15. package/app/api/v1/persona/[agentId]/route.ts +13 -0
  16. package/app/api/v1/persona/me/route.ts +12 -0
  17. package/app/api/v1/profile/observe/route.ts +34 -0
  18. package/app/api/v1/profile/route.ts +72 -0
  19. package/app/api/v1/reflect/route.ts +96 -0
  20. package/app/globals.css +190 -0
  21. package/app/i18n.ts +161 -0
  22. package/app/layout.tsx +12 -0
  23. package/app/page.tsx +561 -0
  24. package/docker-compose.yml +34 -0
  25. package/docs/DEBATE-ROUND1.md +244 -0
  26. package/docs/DEBATE-ROUND2.md +158 -0
  27. package/docs/REQUIREMENTS.md +162 -0
  28. package/docs/docs.html +272 -0
  29. package/docs/index.html +228 -0
  30. package/docs/script.js +103 -0
  31. package/docs/style.css +418 -0
  32. package/lib/auth.ts +63 -0
  33. package/lib/db.ts +63 -0
  34. package/lib/embedding.ts +29 -0
  35. package/lib/schema.ts +134 -0
  36. package/mcp-server.ts +56 -0
  37. package/next-env.d.ts +6 -0
  38. package/next.config.ts +5 -0
  39. package/package.json +34 -0
  40. package/packages/cli/README.md +33 -0
  41. package/packages/cli/bin/swarm.mjs +274 -0
  42. package/packages/cli/package.json +10 -0
  43. package/postcss.config.mjs +2 -0
  44. package/skill/CLAUDE.md +40 -0
  45. package/skill/CODEX.md +43 -0
  46. package/skill/GEMINI.md +38 -0
  47. package/skill/IFLOW.md +38 -0
  48. package/skill/OPENCODE.md +38 -0
  49. package/skill/swarm-ai-skill/SKILL.md +74 -0
  50. package/skill/swarm-ai-skill/env.sh +4 -0
  51. package/skill/swarm-ai-skill/scripts/bootstrap.sh +21 -0
  52. package/skill/swarm-ai-skill/scripts/env.sh +4 -0
  53. package/skill/swarm-ai-skill/scripts/env.sh.example +3 -0
  54. package/skill/swarm-ai-skill/scripts/memory-read.sh +8 -0
  55. package/skill/swarm-ai-skill/scripts/memory-write.sh +10 -0
  56. package/skill/swarm-ai-skill/scripts/observe.sh +9 -0
  57. package/skill/swarm-ai-skill/scripts/profile-read.sh +9 -0
  58. package/skill/swarm-ai-skill/scripts/profile-update.sh +9 -0
  59. package/skill/swarm-ai-skill/scripts/session-start.sh +19 -0
  60. package/tsconfig.json +21 -0
  61. package/tsconfig.tsbuildinfo +1 -0
package/docs/docs.html ADDED
@@ -0,0 +1,272 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Documentation — Swarm AI</title>
7
+ <link rel="preconnect" href="https://fonts.googleapis.com">
8
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
9
+ <link rel="stylesheet" href="style.css">
10
+ </head>
11
+ <body class="docs-page">
12
+
13
+ <nav class="nav">
14
+ <div class="nav-inner">
15
+ <a href="./" class="nav-logo">
16
+ <svg width="28" height="28" viewBox="0 0 100 100" fill="none">
17
+ <path d="M50 5L93.3 27.5V72.5L50 95L6.7 72.5V27.5L50 5Z" stroke="currentColor" stroke-width="4" fill="none"/>
18
+ <path d="M50 25L72.5 37.5V62.5L50 75L27.5 62.5V37.5L50 25Z" stroke="currentColor" stroke-width="3" fill="none" opacity="0.6"/>
19
+ <circle cx="50" cy="50" r="8" fill="currentColor" opacity="0.8"/>
20
+ </svg>
21
+ <span>Swarm AI</span>
22
+ </a>
23
+ <div class="nav-links">
24
+ <a href="#quickstart">Quick Start</a>
25
+ <a href="#integration">Integration</a>
26
+ <a href="#profile">Profile</a>
27
+ <a href="#memory">Memory</a>
28
+ <a href="#api">API</a>
29
+ <a href="https://github.com/euynahz/swarm-ai" class="nav-cta">GitHub</a>
30
+ </div>
31
+ </div>
32
+ </nav>
33
+
34
+ <div class="docs-layout">
35
+ <aside class="docs-sidebar">
36
+ <div class="sidebar-section">
37
+ <div class="sidebar-title">Getting Started</div>
38
+ <a href="#quickstart">Quick Start</a>
39
+ <a href="#integration">Platform Integration</a>
40
+ </div>
41
+ <div class="sidebar-section">
42
+ <div class="sidebar-title">Concepts</div>
43
+ <a href="#profile">Profile Structure</a>
44
+ <a href="#confidence">Confidence Scoring</a>
45
+ <a href="#memory">Memory &amp; Search</a>
46
+ <a href="#reflect">Reflect</a>
47
+ </div>
48
+ <div class="sidebar-section">
49
+ <div class="sidebar-title">Reference</div>
50
+ <a href="#api">API Endpoints</a>
51
+ <a href="#scripts">Shell Scripts</a>
52
+ <a href="#admin">Admin API</a>
53
+ <a href="#audit">Audit &amp; History</a>
54
+ <a href="#auth">Authentication</a>
55
+ <a href="#env">Environment</a>
56
+ </div>
57
+ </aside>
58
+
59
+ <main class="docs-main">
60
+
61
+ <section id="quickstart" class="doc-section">
62
+ <h1>Quick Start</h1>
63
+ <p>Get Swarm AI running locally in one command.</p>
64
+
65
+ <h2>1. Install &amp; start</h2>
66
+ <pre><code>npx @peonai/swarm</code></pre>
67
+ <p>The interactive installer will ask for port (default <code>3777</code>), admin token, and whether to install as a background service (systemd on Linux, launchd on macOS).</p>
68
+
69
+ <h3>Service commands</h3>
70
+ <pre><code>npx @peonai/swarm start # start the server
71
+ npx @peonai/swarm stop # stop
72
+ npx @peonai/swarm status # health check
73
+ npx @peonai/swarm uninstall # remove service (keeps data)</code></pre>
74
+
75
+ <p>Verify with:</p>
76
+ <pre><code>curl http://localhost:3777/api/health</code></pre>
77
+
78
+ <h3>Alternative: Manual</h3>
79
+ <pre><code>git clone https://github.com/euynahz/swarm-ai.git
80
+ cd swarm-ai
81
+ npm install
82
+ npm run dev</code></pre>
83
+
84
+ <h2>2. Register an agent</h2>
85
+ <pre><code>curl -X POST http://localhost:3777/api/v1/admin/agents \
86
+ -H "X-Admin-Token: swarm-admin-dev" \
87
+ -H "Content-Type: application/json" \
88
+ -d '{"id":"my-agent","name":"My Agent"}'</code></pre>
89
+ <p>Save the returned <code>apiKey</code> &mdash; your agent needs it for all subsequent requests.</p>
90
+
91
+ <h2>3. Write and read your first profile entry</h2>
92
+ <pre><code># Write
93
+ curl -X PATCH http://localhost:3777/api/v1/profile \
94
+ -H "Authorization: Bearer YOUR_API_KEY" \
95
+ -H "Content-Type: application/json" \
96
+ -d '{"layer":"identity","entries":{"name":"Alice","language":"en"}}'
97
+
98
+ # Read
99
+ curl http://localhost:3777/api/v1/profile \
100
+ -H "Authorization: Bearer YOUR_API_KEY"</code></pre>
101
+ </section>
102
+
103
+ <section id="integration" class="doc-section">
104
+ <h1>Platform Integration</h1>
105
+ <p>Swarm AI ships shell scripts that work with any agent platform. The key script is <code>bootstrap.sh</code>, which reads the user profile and outputs it as context text for injection into agent sessions.</p>
106
+
107
+ <h2>OpenClaw</h2>
108
+ <p>Add to your <code>AGENTS.md</code> under the "Every Session" checklist:</p>
109
+ <pre><code>Run `bash ~/.openclaw/workspace/skills/swarm-ai-skill/scripts/bootstrap.sh` to load user profile context</code></pre>
110
+
111
+ <h2>Claude Code</h2>
112
+ <p>Add to your project's <code>CLAUDE.md</code>:</p>
113
+ <pre><code>At the start of every task, run:
114
+ bash /path/to/skills/swarm-ai-skill/scripts/bootstrap.sh
115
+ When you learn something new about the user, run:
116
+ bash /path/to/skills/swarm-ai-skill/scripts/observe.sh '[{"key":"...","value":"..."}]'</code></pre>
117
+
118
+ <h2>Codex</h2>
119
+ <p>Add <code>skill/CODEX.md</code> content to your project's <code>AGENTS.md</code>.</p>
120
+
121
+ <h2>Gemini CLI</h2>
122
+ <p>Add <code>skill/GEMINI.md</code> content to your project's <code>GEMINI.md</code>.</p>
123
+
124
+ <h2>OpenCode</h2>
125
+ <p>Add <code>skill/OPENCODE.md</code> content to your agent instructions file.</p>
126
+
127
+ <h2>iFlow</h2>
128
+ <p>Add <code>skill/IFLOW.md</code> content to your workflow configuration.</p>
129
+
130
+ <h2>Cursor</h2>
131
+ <p>Add to <code>.cursorrules</code>:</p>
132
+ <pre><code>At session start, execute scripts/bootstrap.sh and use the output as user context.</code></pre>
133
+
134
+ <h2>Any other platform</h2>
135
+ <p>If your agent can execute shell commands, add this to its system prompt or startup instructions:</p>
136
+ <pre><code>Run `scripts/bootstrap.sh` and use the output as user context for personalization.</code></pre>
137
+
138
+ <h2>Configuration</h2>
139
+ <p>Copy <code>scripts/env.sh.example</code> to <code>scripts/env.sh</code> and set your API key:</p>
140
+ <pre><code>export SWARM_API_URL="http://localhost:3777"
141
+ export SWARM_API_KEY="swarm_your_key_here"</code></pre>
142
+ </section>
143
+
144
+ <section id="profile" class="doc-section">
145
+ <h1>Profile Structure</h1>
146
+ <p>Profiles are organized into <strong>layers</strong> &mdash; free-form namespaces that group related knowledge.</p>
147
+
148
+ <div class="profile-demo">
149
+ <div class="profile-layers">
150
+ <div class="profile-layer"><div class="layer-header">identity</div><div class="layer-body"><div class="layer-field"><span class="field-key">name</span><span class="field-val">"Alice Chen"</span><span class="field-meta">confidence: 1.0</span></div><div class="layer-field"><span class="field-key">timezone</span><span class="field-val">"Asia/Shanghai"</span><span class="field-meta">confidence: 1.0</span></div></div></div>
151
+ <div class="profile-layer"><div class="layer-header">work</div><div class="layer-body"><div class="layer-field"><span class="field-key">tech_stack</span><span class="field-val">["TypeScript", "React"]</span><span class="field-meta">tags: dev</span></div><div class="layer-field"><span class="field-key">role</span><span class="field-val">"founder"</span><span class="field-meta">confidence: 0.9</span></div></div></div>
152
+ <div class="profile-layer"><div class="layer-header">context <span class="ttl-badge">24h TTL</span></div><div class="layer-body"><div class="layer-field"><span class="field-key">current_task</span><span class="field-val">"building swarm-ai"</span><span class="field-meta">auto-expires</span></div></div></div>
153
+ </div>
154
+ </div>
155
+
156
+ <h2 id="confidence">Confidence Scoring</h2>
157
+ <p>Every observation carries a <code>confidence</code> value between 0 and 1. When an agent submits an observation via the <code>/observe</code> endpoint:</p>
158
+ <ul>
159
+ <li>If the new confidence is <strong>higher</strong> than the existing value, the observation overwrites it.</li>
160
+ <li>If the new confidence is <strong>lower or equal</strong>, the existing value is preserved.</li>
161
+ </ul>
162
+ <p>This ensures that confirmed facts (confidence 1.0) are never overwritten by guesses (confidence 0.3), regardless of which agent submits them.</p>
163
+
164
+ <h2>Tags and Filtering</h2>
165
+ <p>Each profile entry can carry tags for categorization. Query by layer or tag:</p>
166
+ <pre><code># Filter by layer
167
+ curl "http://localhost:3777/api/v1/profile?layer=work" -H "Authorization: Bearer $KEY"
168
+
169
+ # Filter by tag
170
+ curl "http://localhost:3777/api/v1/profile?tag=preference" -H "Authorization: Bearer $KEY"</code></pre>
171
+
172
+ <h2>Automatic Expiry</h2>
173
+ <p>Observations submitted to the <code>context</code> layer via <code>/observe</code> receive a default 24-hour TTL. Expired entries are automatically excluded from query results. Permanent layers like <code>identity</code> and <code>work</code> have no expiry.</p>
174
+ </section>
175
+
176
+ <section id="api" class="doc-section">
177
+ <h1>API Reference</h1>
178
+ <p>All agent endpoints require an <code>Authorization: Bearer &lt;api_key&gt;</code> header.</p>
179
+
180
+ <div class="api-table-wrap">
181
+ <table class="api-table">
182
+ <thead><tr><th>Method</th><th>Endpoint</th><th>Description</th></tr></thead>
183
+ <tbody>
184
+ <tr><td><span class="method get">GET</span></td><td>/api/v1/profile</td><td>Read profile. Query params: <code>layer</code>, <code>tag</code></td></tr>
185
+ <tr><td><span class="method patch">PATCH</span></td><td>/api/v1/profile</td><td>Update entries. Body: <code>{"layer":"...","entries":{...}}</code></td></tr>
186
+ <tr><td><span class="method post">POST</span></td><td>/api/v1/profile/observe</td><td>Submit observations with confidence merging</td></tr>
187
+ <tr><td><span class="method get">GET</span></td><td>/api/v1/memory</td><td>Search memory. Params: <code>q</code>, <code>mode=semantic</code>, <code>tag</code>, <code>type</code>, <code>limit</code></td></tr>
188
+ <tr><td><span class="method post">POST</span></td><td>/api/v1/memory</td><td>Write memory (auto-embeds). Body: <code>{"content":"...","tags":[...],"type":"..."}</code></td></tr>
189
+ <tr><td><span class="method post">POST</span></td><td>/api/v1/reflect</td><td>Trigger memory→profile reflection. Body: <code>{"since":"ISO","limit":100}</code></td></tr>
190
+ <tr><td><span class="method get">GET</span></td><td>/api/v1/persona/me</td><td>Read current agent persona</td></tr>
191
+ <tr><td><span class="method get">GET</span></td><td>/api/v1/persona/:agentId</td><td>Read another agent's persona</td></tr>
192
+ </tbody>
193
+ </table>
194
+ </div>
195
+
196
+ <h2>Observe Example</h2>
197
+ <div class="api-example">
198
+ <div class="api-example-header">POST /api/v1/profile/observe</div>
199
+ <pre><code>curl -X POST http://localhost:3777/api/v1/profile/observe \
200
+ -H "Authorization: Bearer $API_KEY" \
201
+ -H "Content-Type: application/json" \
202
+ -d '{
203
+ "observations": [{
204
+ "layer": "work",
205
+ "key": "tech_stack",
206
+ "value": ["TypeScript", "React", "Next.js"],
207
+ "confidence": 0.9,
208
+ "tags": ["dev", "skills"]
209
+ }]
210
+ }'</code></pre>
211
+ </div>
212
+ </section>
213
+
214
+ <section id="scripts" class="doc-section">
215
+ <h1>Shell Scripts</h1>
216
+ <p>Located in <code>skill/swarm-ai-skill/scripts/</code>. All scripts source <code>env.sh</code> for configuration.</p>
217
+
218
+ <div class="api-table-wrap">
219
+ <table class="api-table">
220
+ <thead><tr><th>Script</th><th>Usage</th><th>When to Use</th></tr></thead>
221
+ <tbody>
222
+ <tr><td><code>bootstrap.sh</code></td><td>No args</td><td>Session start &mdash; outputs profile as context text</td></tr>
223
+ <tr><td><code>profile-read.sh</code></td><td><code>[layer] [tag]</code></td><td>Query specific profile data</td></tr>
224
+ <tr><td><code>profile-update.sh</code></td><td><code>&lt;layer&gt; &lt;json&gt;</code></td><td>Confirmed new user information</td></tr>
225
+ <tr><td><code>observe.sh</code></td><td><code>&lt;json_array&gt;</code></td><td>Discovered preferences or habits</td></tr>
226
+ <tr><td><code>memory-read.sh</code></td><td><code>[query]</code></td><td>Search historical context</td></tr>
227
+ <tr><td><code>memory-write.sh</code></td><td><code>&lt;content&gt; [tags]</code></td><td>Record significant events</td></tr>
228
+ </tbody>
229
+ </table>
230
+ </div>
231
+ </section>
232
+
233
+ <section id="admin" class="doc-section">
234
+ <h1>Admin API</h1>
235
+ <p>Admin endpoints require an <code>X-Admin-Token</code> header or JWT <code>Authorization: Bearer &lt;jwt&gt;</code>.</p>
236
+
237
+ <div class="api-table-wrap">
238
+ <table class="api-table">
239
+ <thead><tr><th>Method</th><th>Endpoint</th><th>Description</th></tr></thead>
240
+ <tbody>
241
+ <tr><td><span class="method get">GET</span></td><td>/api/v1/admin/agents</td><td>List all agents</td></tr>
242
+ <tr><td><span class="method post">POST</span></td><td>/api/v1/admin/agents</td><td>Create agent. Body: <code>{"id":"...","name":"..."}</code></td></tr>
243
+ <tr><td><span class="method patch">PATCH</span></td><td>/api/v1/admin/agents</td><td>Update agent persona/name</td></tr>
244
+ <tr><td><span class="method delete">DELETE</span></td><td>/api/v1/admin/agents/:id</td><td>Delete agent and revoke API key</td></tr>
245
+ <tr><td><span class="method get">GET</span></td><td>/api/v1/admin/profile</td><td>View all raw profile data</td></tr>
246
+ <tr><td><span class="method put">PUT</span></td><td>/api/v1/admin/profile</td><td>Admin profile update</td></tr>
247
+ <tr><td><span class="method get">GET</span></td><td>/api/v1/admin/audit</td><td>Audit log. Params: <code>action</code>, <code>agent</code>, <code>limit</code></td></tr>
248
+ <tr><td><span class="method get">GET</span></td><td>/api/v1/admin/history</td><td>Profile change history. Params: <code>layer</code>, <code>key</code>, <code>limit</code></td></tr>
249
+ <tr><td><span class="method get">GET</span></td><td>/api/v1/admin/export</td><td>Export all data as JSON</td></tr>
250
+ </tbody>
251
+ </table>
252
+ </div>
253
+ </section>
254
+
255
+ </main>
256
+ </div>
257
+
258
+ <footer class="footer">
259
+ <div class="container footer-inner">
260
+ <div class="footer-brand">
261
+ <svg width="24" height="24" viewBox="0 0 100 100" fill="none"><path d="M50 5L93.3 27.5V72.5L50 95L6.7 72.5V27.5L50 5Z" stroke="currentColor" stroke-width="4" fill="none"/><circle cx="50" cy="50" r="8" fill="currentColor" opacity="0.6"/></svg>
262
+ <span>Swarm AI</span>
263
+ </div>
264
+ <div class="footer-links">
265
+ <a href="./">Home</a>
266
+ <a href="https://github.com/euynahz/swarm-ai">GitHub</a>
267
+ </div>
268
+ <p class="footer-copy">&copy; 2026 PeonAI. MIT License.</p>
269
+ </div>
270
+ </footer>
271
+ </body>
272
+ </html>
@@ -0,0 +1,228 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Swarm AI — Cross-Agent User Profile Hub</title>
7
+ <meta name="description" content="Teach one agent, all agents remember. A shared profile server for AI agents across platforms.">
8
+ <link rel="preconnect" href="https://fonts.googleapis.com">
9
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
10
+ <link rel="stylesheet" href="style.css">
11
+ </head>
12
+ <body>
13
+
14
+ <nav class="nav">
15
+ <div class="nav-inner">
16
+ <a href="/" class="nav-logo">
17
+ <svg width="28" height="28" viewBox="0 0 100 100" fill="none">
18
+ <path d="M50 5L93.3 27.5V72.5L50 95L6.7 72.5V27.5L50 5Z" stroke="currentColor" stroke-width="4" fill="none"/>
19
+ <path d="M50 25L72.5 37.5V62.5L50 75L27.5 62.5V37.5L50 25Z" stroke="currentColor" stroke-width="3" fill="none" opacity="0.6"/>
20
+ <circle cx="50" cy="50" r="8" fill="currentColor" opacity="0.8"/>
21
+ </svg>
22
+ <span>Swarm AI</span>
23
+ </a>
24
+ <div class="nav-links">
25
+ <a href="#problem">Problem</a>
26
+ <a href="#how-it-works">How It Works</a>
27
+ <a href="#features">Features</a>
28
+ <a href="docs.html">Docs</a>
29
+ <a href="https://github.com/euynahz/swarm-ai" class="nav-cta">GitHub</a>
30
+ </div>
31
+ </div>
32
+ </nav>
33
+
34
+ <section class="hero" id="hero">
35
+ <canvas id="hexCanvas"></canvas>
36
+ <div class="hero-content">
37
+ <p class="hero-eyebrow">Open Source User Profile Hub</p>
38
+ <h1>Teach one agent.<br>All agents remember.</h1>
39
+ <p class="hero-sub">A shared memory layer for AI agents across every platform and device. End the cycle of repeating yourself to every new assistant.</p>
40
+ <pre class="hero-code"><code>npx @peonai/swarm</code></pre>
41
+ <div class="hero-actions">
42
+ <a href="docs.html#quickstart" class="btn btn-primary">Get Started</a>
43
+ <a href="https://github.com/euynahz/swarm-ai" class="btn btn-ghost">View Source</a>
44
+ </div>
45
+ </div>
46
+ </section>
47
+
48
+ <section class="section section-problem" id="problem">
49
+ <div class="container">
50
+ <div class="section-label">The Problem</div>
51
+ <h2>N devices, M agents, N&times;M information silos</h2>
52
+ <p class="section-desc">Every AI agent you use starts from zero. Your coding assistant doesn't know your design preferences. Your writing tool doesn't know your tech stack. You repeat the same context, the same corrections, the same preferences &mdash; endlessly.</p>
53
+ <div class="silo-grid">
54
+ <div class="silo-card stagger">
55
+ <div class="silo-icon">
56
+ <svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>
57
+ </div>
58
+ <h3>Desktop Agent</h3>
59
+ <p>"What's your preferred language?"</p>
60
+ </div>
61
+ <div class="silo-card stagger">
62
+ <div class="silo-icon">
63
+ <svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="5" y="2" width="14" height="20" rx="2"/><line x1="12" y1="18" x2="12" y2="18" stroke-linecap="round" stroke-width="2"/></svg>
64
+ </div>
65
+ <h3>Mobile Agent</h3>
66
+ <p>"What's your preferred language?"</p>
67
+ </div>
68
+ <div class="silo-card stagger">
69
+ <div class="silo-icon">
70
+ <svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/><line x1="14" y1="4" x2="10" y2="20"/></svg>
71
+ </div>
72
+ <h3>Code Agent</h3>
73
+ <p>"What's your preferred language?"</p>
74
+ </div>
75
+ <div class="silo-card silo-card-accent stagger">
76
+ <div class="silo-icon">
77
+ <svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 2L2 7l10 5 10-5-10-5z"/><path d="M2 17l10 5 10-5"/><path d="M2 12l10 5 10-5"/></svg>
78
+ </div>
79
+ <h3>With Swarm AI</h3>
80
+ <p>"I already know. Let's get to work."</p>
81
+ </div>
82
+ </div>
83
+ </div>
84
+ </section>
85
+
86
+ <section class="section section-how" id="how-it-works">
87
+ <div class="container">
88
+ <div class="section-label">How It Works</div>
89
+ <h2>Three primitives, infinite memory</h2>
90
+ <div class="steps">
91
+ <div class="step stagger">
92
+ <div class="step-num">01</div>
93
+ <div class="step-line"></div>
94
+ <h3>Connect</h3>
95
+ <p>Register each agent with a unique API key. Each agent gets scoped read/write access to the shared profile store.</p>
96
+ </div>
97
+ <div class="step stagger">
98
+ <div class="step-num">02</div>
99
+ <div class="step-line"></div>
100
+ <h3>Observe</h3>
101
+ <p>Agents submit observations as they learn about you. Confidence scoring ensures high-quality data wins &mdash; guesses never overwrite facts.</p>
102
+ </div>
103
+ <div class="step stagger">
104
+ <div class="step-num">03</div>
105
+ <div class="step-line"></div>
106
+ <h3>Share</h3>
107
+ <p>Every agent reads the same profile at session start. What one learns, all know. Context follows you across tools and devices.</p>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ </section>
112
+
113
+ <section class="section section-arch" id="architecture">
114
+ <div class="container">
115
+ <div class="section-label">Architecture</div>
116
+ <h2>One server, every agent</h2>
117
+ <div class="arch-diagram">
118
+ <div class="arch-agents">
119
+ <div class="arch-node">OpenClaw</div>
120
+ <div class="arch-node">Claude Code</div>
121
+ <div class="arch-node">Codex</div>
122
+ <div class="arch-node">Gemini CLI</div>
123
+ <div class="arch-node">OpenCode</div>
124
+ <div class="arch-node">Cursor</div>
125
+ <div class="arch-node">iFlow</div>
126
+ </div>
127
+ <div class="arch-lines">
128
+ <svg viewBox="0 0 400 60" preserveAspectRatio="none">
129
+ <path d="M50,0 L200,55" stroke="var(--amber)" stroke-width="1" opacity="0.4"/>
130
+ <path d="M150,0 L200,55" stroke="var(--amber)" stroke-width="1" opacity="0.4"/>
131
+ <path d="M250,0 L200,55" stroke="var(--amber)" stroke-width="1" opacity="0.4"/>
132
+ <path d="M350,0 L200,55" stroke="var(--amber)" stroke-width="1" opacity="0.4"/>
133
+ </svg>
134
+ </div>
135
+ <div class="arch-center">
136
+ <div class="arch-server">Swarm AI Server<span>Next.js + SQLite</span></div>
137
+ </div>
138
+ <div class="arch-layers">
139
+ <div class="arch-layer">Identity</div>
140
+ <div class="arch-layer">Work</div>
141
+ <div class="arch-layer">Communication</div>
142
+ <div class="arch-layer">Context</div>
143
+ </div>
144
+ </div>
145
+ </div>
146
+ </section>
147
+
148
+ <section class="section section-features" id="features">
149
+ <div class="container">
150
+ <div class="section-label">Core Capabilities</div>
151
+ <h2>Built for the multi-agent era</h2>
152
+ <div class="feature-grid">
153
+ <div class="feature-card stagger">
154
+ <div class="feature-icon">
155
+ <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="var(--amber)" stroke-width="1.5"><path d="M12 2L2 7l10 5 10-5-10-5z"/><path d="M2 17l10 5 10-5"/><path d="M2 12l10 5 10-5"/></svg>
156
+ </div>
157
+ <h3>Free-form Layers</h3>
158
+ <p>Organize knowledge into any namespace. Identity, work, communication, or define your own. No rigid schema.</p>
159
+ </div>
160
+ <div class="feature-card stagger">
161
+ <div class="feature-icon">
162
+ <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="var(--amber)" stroke-width="1.5"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
163
+ </div>
164
+ <h3>Confidence Scoring</h3>
165
+ <p>Every observation carries a confidence value. High-confidence facts are never overwritten by low-confidence guesses.</p>
166
+ </div>
167
+ <div class="feature-card stagger">
168
+ <div class="feature-icon">
169
+ <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="var(--amber)" stroke-width="1.5"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
170
+ </div>
171
+ <h3>Automatic Expiry</h3>
172
+ <p>Context-layer data expires after 24 hours by default. Stale information cleans itself up without intervention.</p>
173
+ </div>
174
+ <div class="feature-card stagger">
175
+ <div class="feature-icon">
176
+ <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="var(--amber)" stroke-width="1.5"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>
177
+ </div>
178
+ <h3>Source Attribution</h3>
179
+ <p>Every field records which agent wrote it. Full provenance across your entire agent ecosystem.</p>
180
+ </div>
181
+ <div class="feature-card stagger">
182
+ <div class="feature-icon">
183
+ <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="var(--amber)" stroke-width="1.5"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
184
+ </div>
185
+ <h3>Per-Agent Auth</h3>
186
+ <p>Each agent gets a unique API key with scoped permissions. Read-only agents never modify your profile.</p>
187
+ </div>
188
+ <div class="feature-card stagger">
189
+ <div class="feature-icon">
190
+ <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="var(--amber)" stroke-width="1.5"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>
191
+ </div>
192
+ <h3>Zero Dependencies</h3>
193
+ <p>Shell scripts with curl. No SDK, no runtime, no framework lock-in. If your agent can run a command, it can join.</p>
194
+ </div>
195
+ </div>
196
+ </div>
197
+ </section>
198
+
199
+ <section class="section section-cta">
200
+ <div class="container" style="text-align:center">
201
+ <h2>Ready to unify your agents?</h2>
202
+ <p class="section-desc" style="margin:0 auto 36px">Self-hosted, open source, and running in under a minute.</p>
203
+ <pre class="hero-code" style="display:inline-block;margin:0 auto 24px;text-align:left"><code>npx @peonai/swarm</code></pre>
204
+ <div class="hero-actions" style="justify-content:center">
205
+ <a href="docs.html#quickstart" class="btn btn-primary">Read the Docs</a>
206
+ <a href="https://github.com/euynahz/swarm-ai" class="btn btn-ghost">View on GitHub</a>
207
+ </div>
208
+ </div>
209
+ </section>
210
+
211
+ <footer class="footer">
212
+ <div class="container footer-inner">
213
+ <div class="footer-brand">
214
+ <svg width="24" height="24" viewBox="0 0 100 100" fill="none"><path d="M50 5L93.3 27.5V72.5L50 95L6.7 72.5V27.5L50 5Z" stroke="currentColor" stroke-width="4" fill="none"/><circle cx="50" cy="50" r="8" fill="currentColor" opacity="0.6"/></svg>
215
+ <span>Swarm AI</span>
216
+ </div>
217
+ <div class="footer-links">
218
+ <a href="docs.html">Documentation</a>
219
+ <a href="https://github.com/euynahz/swarm-ai">GitHub</a>
220
+ <a href="https://github.com/euynahz/swarm-ai/issues">Issues</a>
221
+ </div>
222
+ <p class="footer-copy">&copy; 2026 PeonAI. MIT License.</p>
223
+ </div>
224
+ </footer>
225
+
226
+ <script src="script.js"></script>
227
+ </body>
228
+ </html>
package/docs/script.js ADDED
@@ -0,0 +1,103 @@
1
+ // Hex canvas background
2
+ const canvas = document.getElementById('hexCanvas');
3
+ if (canvas) {
4
+ const ctx = canvas.getContext('2d');
5
+ let w, h, hexes = [], mouse = { x: -1, y: -1 };
6
+
7
+ const resize = () => { w = canvas.width = canvas.offsetWidth; h = canvas.height = canvas.offsetHeight; init(); };
8
+
9
+ function init() {
10
+ hexes = [];
11
+ const size = 60, gap = size * 1.8;
12
+ for (let x = -size; x < w + size; x += gap * 0.866) {
13
+ for (let y = -size; y < h + size; y += gap * 0.75) {
14
+ const offset = (Math.floor(y / (gap * 0.75)) % 2) * gap * 0.433;
15
+ hexes.push({
16
+ x: x + offset, y, size: size * (0.6 + Math.random() * 0.4),
17
+ phase: Math.random() * Math.PI * 2, speed: 0.003 + Math.random() * 0.005
18
+ });
19
+ }
20
+ }
21
+ }
22
+
23
+ function drawHex(cx, cy, r) {
24
+ ctx.beginPath();
25
+ for (let i = 0; i < 6; i++) {
26
+ const a = Math.PI / 3 * i - Math.PI / 6;
27
+ ctx[i ? 'lineTo' : 'moveTo'](cx + r * Math.cos(a), cy + r * Math.sin(a));
28
+ }
29
+ ctx.closePath();
30
+ }
31
+
32
+ // Mouse proximity effect
33
+ canvas.addEventListener('mousemove', e => { mouse.x = e.clientX; mouse.y = e.clientY; });
34
+ canvas.addEventListener('mouseleave', () => { mouse.x = -1; mouse.y = -1; });
35
+
36
+ let t = 0;
37
+ function draw() {
38
+ ctx.clearRect(0, 0, w, h);
39
+ t++;
40
+ for (const hex of hexes) {
41
+ let alpha = 0.06 + 0.06 * Math.sin(t * hex.speed + hex.phase);
42
+ // Mouse proximity boost
43
+ if (mouse.x > 0) {
44
+ const dx = hex.x - mouse.x, dy = hex.y - mouse.y;
45
+ const dist = Math.sqrt(dx * dx + dy * dy);
46
+ if (dist < 200) alpha += 0.15 * (1 - dist / 200);
47
+ }
48
+ ctx.strokeStyle = `rgba(240,168,48,${alpha})`;
49
+ ctx.lineWidth = 0.8;
50
+ drawHex(hex.x, hex.y, hex.size);
51
+ ctx.stroke();
52
+ }
53
+ // Connection lines
54
+ for (let i = 0; i < hexes.length; i++) {
55
+ for (let j = i + 1; j < hexes.length; j++) {
56
+ const dx = hexes[i].x - hexes[j].x, dy = hexes[i].y - hexes[j].y;
57
+ const dist = Math.sqrt(dx * dx + dy * dy);
58
+ if (dist < 120) {
59
+ const alpha = 0.03 * (1 - dist / 120) * (0.5 + 0.5 * Math.sin(t * 0.004 + i));
60
+ ctx.strokeStyle = `rgba(240,168,48,${alpha})`;
61
+ ctx.lineWidth = 0.5;
62
+ ctx.beginPath();
63
+ ctx.moveTo(hexes[i].x, hexes[i].y);
64
+ ctx.lineTo(hexes[j].x, hexes[j].y);
65
+ ctx.stroke();
66
+ }
67
+ }
68
+ }
69
+ requestAnimationFrame(draw);
70
+ }
71
+ resize();
72
+ window.addEventListener('resize', resize);
73
+ draw();
74
+ }
75
+
76
+ // Scroll reveal with threshold
77
+ const observer = new IntersectionObserver(entries => {
78
+ entries.forEach(e => { if (e.isIntersecting) e.target.classList.add('visible'); });
79
+ }, { threshold: 0.15 });
80
+ document.querySelectorAll('.section').forEach(s => observer.observe(s));
81
+
82
+ // Feature card mouse-tracking glow
83
+ document.querySelectorAll('.feature-card').forEach(card => {
84
+ card.addEventListener('mousemove', e => {
85
+ const r = card.getBoundingClientRect();
86
+ card.style.setProperty('--mx', ((e.clientX - r.left) / r.width * 100) + '%');
87
+ card.style.setProperty('--my', ((e.clientY - r.top) / r.height * 100) + '%');
88
+ });
89
+ });
90
+
91
+ // Floating particles in hero
92
+ const hero = document.querySelector('.hero');
93
+ if (hero) {
94
+ for (let i = 0; i < 12; i++) {
95
+ const p = document.createElement('div');
96
+ p.className = 'particle';
97
+ p.style.cssText = `
98
+ left:${Math.random()*100}%;top:${Math.random()*100}%;
99
+ animation-delay:${Math.random()*6}s;animation-duration:${6+Math.random()*8}s;
100
+ `;
101
+ hero.appendChild(p);
102
+ }
103
+ }