pocketrb 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 (83) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +32 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +456 -0
  5. data/exe/pocketrb +6 -0
  6. data/lib/pocketrb/agent/compaction.rb +187 -0
  7. data/lib/pocketrb/agent/context.rb +171 -0
  8. data/lib/pocketrb/agent/loop.rb +276 -0
  9. data/lib/pocketrb/agent/spawn_tool.rb +72 -0
  10. data/lib/pocketrb/agent/subagent_manager.rb +196 -0
  11. data/lib/pocketrb/bus/events.rb +99 -0
  12. data/lib/pocketrb/bus/message_bus.rb +148 -0
  13. data/lib/pocketrb/channels/base.rb +69 -0
  14. data/lib/pocketrb/channels/cli.rb +109 -0
  15. data/lib/pocketrb/channels/telegram.rb +607 -0
  16. data/lib/pocketrb/channels/whatsapp.rb +242 -0
  17. data/lib/pocketrb/cli/base.rb +119 -0
  18. data/lib/pocketrb/cli/chat.rb +67 -0
  19. data/lib/pocketrb/cli/config.rb +52 -0
  20. data/lib/pocketrb/cli/cron.rb +144 -0
  21. data/lib/pocketrb/cli/gateway.rb +132 -0
  22. data/lib/pocketrb/cli/init.rb +39 -0
  23. data/lib/pocketrb/cli/plans.rb +28 -0
  24. data/lib/pocketrb/cli/skills.rb +34 -0
  25. data/lib/pocketrb/cli/start.rb +55 -0
  26. data/lib/pocketrb/cli/telegram.rb +93 -0
  27. data/lib/pocketrb/cli/version.rb +18 -0
  28. data/lib/pocketrb/cli/whatsapp.rb +60 -0
  29. data/lib/pocketrb/cli.rb +124 -0
  30. data/lib/pocketrb/config.rb +190 -0
  31. data/lib/pocketrb/cron/job.rb +155 -0
  32. data/lib/pocketrb/cron/service.rb +395 -0
  33. data/lib/pocketrb/heartbeat/service.rb +175 -0
  34. data/lib/pocketrb/mcp/client.rb +172 -0
  35. data/lib/pocketrb/mcp/memory_tool.rb +133 -0
  36. data/lib/pocketrb/media/processor.rb +258 -0
  37. data/lib/pocketrb/memory.rb +283 -0
  38. data/lib/pocketrb/planning/manager.rb +159 -0
  39. data/lib/pocketrb/planning/plan.rb +223 -0
  40. data/lib/pocketrb/planning/tool.rb +176 -0
  41. data/lib/pocketrb/providers/anthropic.rb +333 -0
  42. data/lib/pocketrb/providers/base.rb +98 -0
  43. data/lib/pocketrb/providers/claude_cli.rb +412 -0
  44. data/lib/pocketrb/providers/claude_max_proxy.rb +347 -0
  45. data/lib/pocketrb/providers/openrouter.rb +205 -0
  46. data/lib/pocketrb/providers/registry.rb +59 -0
  47. data/lib/pocketrb/providers/ruby_llm_provider.rb +136 -0
  48. data/lib/pocketrb/providers/types.rb +111 -0
  49. data/lib/pocketrb/session/manager.rb +192 -0
  50. data/lib/pocketrb/session/session.rb +204 -0
  51. data/lib/pocketrb/skills/builtin/github/SKILL.md +113 -0
  52. data/lib/pocketrb/skills/builtin/proactive/SKILL.md +101 -0
  53. data/lib/pocketrb/skills/builtin/reflection/SKILL.md +109 -0
  54. data/lib/pocketrb/skills/builtin/tmux/SKILL.md +130 -0
  55. data/lib/pocketrb/skills/builtin/weather/SKILL.md +130 -0
  56. data/lib/pocketrb/skills/create_tool.rb +115 -0
  57. data/lib/pocketrb/skills/loader.rb +164 -0
  58. data/lib/pocketrb/skills/modify_tool.rb +123 -0
  59. data/lib/pocketrb/skills/skill.rb +75 -0
  60. data/lib/pocketrb/tools/background_job_manager.rb +261 -0
  61. data/lib/pocketrb/tools/base.rb +118 -0
  62. data/lib/pocketrb/tools/browser.rb +152 -0
  63. data/lib/pocketrb/tools/browser_advanced.rb +470 -0
  64. data/lib/pocketrb/tools/browser_session.rb +167 -0
  65. data/lib/pocketrb/tools/cron.rb +222 -0
  66. data/lib/pocketrb/tools/edit_file.rb +101 -0
  67. data/lib/pocketrb/tools/exec.rb +194 -0
  68. data/lib/pocketrb/tools/jobs.rb +127 -0
  69. data/lib/pocketrb/tools/list_dir.rb +102 -0
  70. data/lib/pocketrb/tools/memory.rb +167 -0
  71. data/lib/pocketrb/tools/message.rb +70 -0
  72. data/lib/pocketrb/tools/para_memory.rb +264 -0
  73. data/lib/pocketrb/tools/read_file.rb +65 -0
  74. data/lib/pocketrb/tools/registry.rb +160 -0
  75. data/lib/pocketrb/tools/send_file.rb +158 -0
  76. data/lib/pocketrb/tools/think.rb +35 -0
  77. data/lib/pocketrb/tools/web_fetch.rb +150 -0
  78. data/lib/pocketrb/tools/web_search.rb +102 -0
  79. data/lib/pocketrb/tools/write_file.rb +55 -0
  80. data/lib/pocketrb/version.rb +5 -0
  81. data/lib/pocketrb.rb +75 -0
  82. data/pocketrb.gemspec +60 -0
  83. metadata +327 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 90af53988338c89d33687693fc1a57069e32851cc3c98ce9f3bd52b69b335af6
4
+ data.tar.gz: 4095da56b7bf3b918485e90191cb568eacd24dfdcf47bddc1845b9702ce4a547
5
+ SHA512:
6
+ metadata.gz: e2a1e6398ba744257c0cde3b288c64dcb331684a52fff7e68c43ca9d9640b1b3de8edda1536d5eb2819a91b2b127bc29caebe14dd5ba606450e609b86667cb2c
7
+ data.tar.gz: 5010acdbbf7916b1e33392783559568cd6b74b4dd1d26d1017ca144f9b705478e15466d92fe069b966bd8dfda7473d14d8af5a3a2ee07e4db6fe21d253b69312
data/CHANGELOG.md ADDED
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2026-02-04
9
+
10
+ ### Added
11
+
12
+ - Initial release
13
+ - Core infrastructure with MessageBus for async message passing
14
+ - Multi-LLM provider support (Anthropic API, Anthropic OAuth/Max, OpenRouter, RubyLLM, ClaudeCLI)
15
+ - Agent loop with tool execution and iteration handling
16
+ - Session management with JSONL persistence
17
+ - Context compaction for long conversations (40 messages / 50K tokens threshold)
18
+ - Core tools: read_file, write_file, edit_file, list_dir, exec, web_search, web_fetch, think, plan
19
+ - Simple JSON-based memory system with keyword matching (no external dependencies)
20
+ - Memory tool for storing/recalling facts, preferences, and context
21
+ - Multi-channel support: CLI, Telegram, WhatsApp (via bridge)
22
+ - Skills system with SKILL.md files and runtime creation
23
+ - Built-in skills: proactive, reflection
24
+ - Planning system for complex multi-step tasks
25
+ - Cron service for scheduled tasks
26
+ - Job queue for long-running background commands
27
+ - Vision support for image analysis (Claude providers)
28
+ - Browser automation tools (Playwright integration)
29
+ - File sending capabilities (Telegram)
30
+ - CLI commands: chat, telegram, whatsapp, gateway, config, skills, cron, jobs
31
+ - Configuration management with workspace and global configs
32
+ - Persona support (separate memory from workspace)
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Maciej Mensfeld
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.
data/README.md ADDED
@@ -0,0 +1,456 @@
1
+ # Pocketrb
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/pocketrb.svg)](https://badge.fury.io/rb/pocketrb)
4
+ [![CI](https://github.com/mensfeld/pocketrb/actions/workflows/ci.yml/badge.svg)](https://github.com/mensfeld/pocketrb/actions/workflows/ci.yml)
5
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.txt)
6
+
7
+ A pocket-sized Ruby AI agent framework with multi-LLM support and advanced capabilities.
8
+
9
+ ## Features
10
+
11
+ - **Clean async architecture**: MessageBus, proper tool_use API, async processing
12
+ - **Multi-LLM support**: Claude (API + Max/OAuth), OpenRouter, OpenAI-compatible APIs, RubyLLM
13
+ - **Multi-channel**: CLI, Telegram, WhatsApp (via bridge)
14
+ - **Advanced features**: Planning system, context compaction, runtime skills system
15
+ - **Simple memory**: JSON-based memory with keyword matching (no external dependencies)
16
+ - **Media support**: Vision (images) via Claude, document handling
17
+ - **Scheduling**: Cron jobs for automated tasks
18
+ - **Personas**: Separate memory and identity from workspace for portable agent personalities
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ gem install pocketrb
24
+ ```
25
+
26
+ Or add to your Gemfile:
27
+
28
+ ```ruby
29
+ gem 'pocketrb'
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ ```bash
35
+ # Set your API key
36
+ export ANTHROPIC_API_KEY=your-key
37
+
38
+ # Initialize a workspace
39
+ pocketrb init
40
+
41
+ # Start chatting
42
+ pocketrb chat
43
+ ```
44
+
45
+ ## Usage
46
+
47
+ ### CLI Chat
48
+
49
+ ```bash
50
+ pocketrb chat [options]
51
+ ```
52
+
53
+ Options:
54
+ - `-m, --model MODEL` - Model to use (default: claude-sonnet-4-20250514)
55
+ - `-p, --provider PROVIDER` - LLM provider (anthropic, openrouter, ruby_llm)
56
+ - `-w, --workspace DIR` - Workspace directory for file access
57
+ - `-M, --memory-dir DIR` - Memory/persona directory (default: same as workspace)
58
+ - `-s, --system-prompt TEXT` - Custom system prompt
59
+
60
+ ### Telegram Bot
61
+
62
+ ```bash
63
+ export TELEGRAM_BOT_TOKEN=your-bot-token
64
+ pocketrb telegram --allowed-users your_username
65
+ ```
66
+
67
+ Options:
68
+ - `-t, --token TOKEN` - Bot token (or use env var)
69
+ - `-u, --allowed-users` - Restrict access to specific usernames/IDs
70
+ - `-w, --workspace` - File access directory
71
+ - `-M, --memory-dir` - Persona/memory directory
72
+
73
+ ### WhatsApp Bot
74
+
75
+ Requires the [whatsapp-web.js bridge](https://github.com/user/whatsapp-bridge) running.
76
+
77
+ ```bash
78
+ pocketrb whatsapp --bridge-url ws://localhost:3001 --allowed-users +1234567890
79
+ ```
80
+
81
+ ### Separating Workspace from Memory (Personas)
82
+
83
+ Run with full filesystem access but a specific persona's memory:
84
+
85
+ ```bash
86
+ pocketrb telegram \
87
+ --workspace / \
88
+ --memory-dir ~/.pocketrb/personas/koda \
89
+ --token "$TELEGRAM_BOT_TOKEN" \
90
+ --allowed-users your_username
91
+ ```
92
+
93
+ This gives the agent:
94
+ - Full filesystem access via `--workspace /`
95
+ - Koda's personality and memory via `--memory-dir`
96
+
97
+ ## Personas
98
+
99
+ Personas allow you to give the agent a persistent identity and memory separate from the working directory.
100
+
101
+ ### Directory Structure
102
+
103
+ ```
104
+ ~/.pocketrb/personas/my-agent/
105
+ ├── IDENTITY.md # Agent personality and instructions
106
+ ├── MEMORY.md # Background knowledge and facts
107
+ ├── memory/ # Daily notes
108
+ │ ├── 2026-02-01.md
109
+ │ └── 2026-02-02.md
110
+ ├── skills/ # Custom skills
111
+ └── .pocketrb/
112
+ ├── config.yml # Agent-specific config
113
+ └── sessions/ # Conversation history
114
+ ```
115
+
116
+ ### IDENTITY.md
117
+
118
+ Defines who the agent is. Loaded into the system prompt automatically.
119
+
120
+ ```markdown
121
+ # Agent Identity
122
+
123
+ ## Who I Am
124
+
125
+ **Name:** Assistant
126
+ **Role:** Helpful AI assistant
127
+ **Personality:** Friendly, direct, technically skilled
128
+
129
+ ## How I Work
130
+
131
+ - I verify before claiming things are done
132
+ - I explain what I'm doing when executing commands
133
+ - I ask for clarification when requirements are unclear
134
+
135
+ ## Communication Style
136
+
137
+ - Concise and direct
138
+ - Technical when appropriate
139
+ - No unnecessary pleasantries
140
+ ```
141
+
142
+ ### MEMORY.md
143
+
144
+ Background knowledge the agent should always have access to.
145
+
146
+ ```markdown
147
+ # Background Knowledge
148
+
149
+ ## User Information
150
+
151
+ - **Name**: John
152
+ - **Timezone**: UTC+1
153
+ - **Preferences**: Prefers Python over JavaScript
154
+
155
+ ## Project Context
156
+
157
+ - Working on a web scraping project
158
+ - Database is PostgreSQL 16
159
+ - Deployment target is AWS Lambda
160
+ ```
161
+
162
+ ## Skills
163
+
164
+ Skills are reusable prompts that extend the agent's capabilities.
165
+
166
+ ### Creating Skills
167
+
168
+ Create a skill in `skills/skill-name/SKILL.md`:
169
+
170
+ ```markdown
171
+ ---
172
+ name: code-review
173
+ description: Review code for quality and best practices
174
+ triggers:
175
+ - review
176
+ - code review
177
+ - check this code
178
+ metadata:
179
+ emoji: "🔍"
180
+ requires:
181
+ bins: []
182
+ ---
183
+
184
+ # Code Review Skill
185
+
186
+ When reviewing code, analyze:
187
+
188
+ 1. **Correctness**: Does it do what it's supposed to?
189
+ 2. **Readability**: Is the code clear and well-organized?
190
+ 3. **Performance**: Any obvious inefficiencies?
191
+ 4. **Security**: Input validation, injection risks, etc.
192
+ 5. **Edge cases**: What happens with unexpected input?
193
+
194
+ Provide specific, actionable feedback with line numbers.
195
+ ```
196
+
197
+ ### Skill Frontmatter
198
+
199
+ | Field | Description |
200
+ |-------|-------------|
201
+ | `name` | Skill identifier |
202
+ | `description` | Short description shown in skill list |
203
+ | `triggers` | Phrases that activate this skill |
204
+ | `always` | If true, always loaded into context |
205
+ | `metadata.emoji` | Display emoji |
206
+ | `metadata.requires.bins` | Required binaries (e.g., `["git", "docker"]`) |
207
+ | `metadata.os` | Supported OS (e.g., `["linux", "darwin"]`) |
208
+
209
+ ### Built-in Skills
210
+
211
+ Pocketrb includes several built-in skills:
212
+
213
+ - **github** - GitHub CLI operations (`gh pr`, `gh issue`, etc.)
214
+ - **tmux** - Tmux session management for isolated workspaces
215
+ - **weather** - Weather forecasts via wttr.in
216
+
217
+ ### Listing Skills
218
+
219
+ ```bash
220
+ pocketrb skills
221
+ ```
222
+
223
+ ### Runtime Skill Creation
224
+
225
+ The agent can create new skills at runtime using the `skill_create` tool:
226
+
227
+ ```
228
+ Create a skill called "deploy" that guides deployment to production
229
+ ```
230
+
231
+ ## Tools
232
+
233
+ ### File Operations
234
+
235
+ | Tool | Description |
236
+ |------|-------------|
237
+ | `read_file` | Read file contents with line numbers |
238
+ | `write_file` | Write content to a file |
239
+ | `edit_file` | Search/replace editing |
240
+ | `list_dir` | List directory contents |
241
+
242
+ ### Execution
243
+
244
+ | Tool | Description |
245
+ |------|-------------|
246
+ | `exec` | Execute shell commands (auto-backgrounds long commands) |
247
+ | `spawn` | Spawn background subagents for parallel work |
248
+
249
+ ### Web
250
+
251
+ | Tool | Description |
252
+ |------|-------------|
253
+ | `web_search` | Search the web (requires `BRAVE_API_KEY`) |
254
+ | `web_fetch` | Fetch and extract content from URLs |
255
+
256
+ ### Planning & Memory
257
+
258
+ | Tool | Description |
259
+ |------|-------------|
260
+ | `think` | Internal reasoning for complex problems |
261
+ | `plan` | Create and manage multi-step execution plans |
262
+ | `memory` | Store and search long-term memory |
263
+
264
+ ### Communication
265
+
266
+ | Tool | Description |
267
+ |------|-------------|
268
+ | `message` | Send messages to channels (Telegram, WhatsApp) |
269
+
270
+ ## Providers
271
+
272
+ ### Anthropic (default)
273
+
274
+ ```bash
275
+ export ANTHROPIC_API_KEY=sk-ant-...
276
+ pocketrb chat --provider anthropic
277
+ ```
278
+
279
+ ### Claude Max (OAuth)
280
+
281
+ For Claude Max subscribers:
282
+
283
+ ```bash
284
+ export ANTHROPIC_OAUTH_TOKEN=your-oauth-token
285
+ pocketrb chat --provider anthropic
286
+ ```
287
+
288
+ ### OpenRouter
289
+
290
+ Access multiple models:
291
+
292
+ ```bash
293
+ export OPENROUTER_API_KEY=your-key
294
+ pocketrb chat --provider openrouter --model anthropic/claude-sonnet-4
295
+ ```
296
+
297
+ ## Memory System
298
+
299
+ Pocketrb uses a simple, dependency-free memory system:
300
+
301
+ ### Static Memory
302
+
303
+ - **MEMORY.md** - Static background knowledge loaded into every conversation
304
+ - **IDENTITY.md** - Agent personality and instructions
305
+
306
+ ### Dynamic Memory
307
+
308
+ The agent can store and recall facts using the `memory` tool:
309
+
310
+ **Categories:**
311
+ - `learned` - Things the agent has learned (e.g., "deployment process")
312
+ - `user` - User information (e.g., "timezone: UTC+1")
313
+ - `preference` - User preferences (e.g., "coding_style: functional")
314
+ - `context` - General context (e.g., "database: PostgreSQL 16")
315
+
316
+ **Storage:**
317
+ - Facts stored in `memory/facts.json`
318
+ - Recent events in `memory/recent.json`
319
+ - Simple keyword matching for relevance (no vector DB required)
320
+
321
+ **Usage:**
322
+ ```
323
+ Agent: I'll remember that your timezone is UTC+1
324
+ [Uses memory tool: store, category: user, key: "timezone", value: "UTC+1"]
325
+
326
+ User: What's my timezone?
327
+ Agent: [Recalls from memory] Your timezone is UTC+1
328
+ ```
329
+
330
+ ## Scheduling
331
+
332
+ ### Cron Jobs
333
+
334
+ Schedule recurring tasks:
335
+
336
+ ```bash
337
+ # Add a job that runs every hour
338
+ pocketrb cron add --name "hourly-check" --message "Check system status" --every 3600
339
+
340
+ # Add a cron-style job (9am daily)
341
+ pocketrb cron add --name "morning-report" --message "Generate daily report" --cron "0 9 * * *"
342
+
343
+ # Add a one-time job
344
+ pocketrb cron add --name "reminder" --message "Meeting in 10 minutes" --at "2026-02-03T14:50:00"
345
+
346
+ # List jobs
347
+ pocketrb cron list
348
+
349
+ # Remove a job
350
+ pocketrb cron remove job_id
351
+ ```
352
+
353
+
354
+ ## Gateway Mode
355
+
356
+ Run all services together:
357
+
358
+ ```bash
359
+ pocketrb gateway \
360
+ --telegram-token "$TELEGRAM_BOT_TOKEN" \
361
+ --telegram-users your_username \
362
+ --enable-cron
363
+ ```
364
+
365
+ ## Context Compaction
366
+
367
+ Long conversations are automatically summarized to save tokens:
368
+
369
+ - Triggers after 40 messages or ~50k tokens
370
+ - Keeps last 15 messages intact
371
+ - Summarizes older messages using the LLM
372
+ - Falls back to basic summary if LLM fails
373
+
374
+ ## Configuration
375
+
376
+ ### Config File
377
+
378
+ Located at `workspace/.pocketrb/config.yml` or `~/.pocketrb/config.yml`:
379
+
380
+ ```yaml
381
+ provider: anthropic
382
+ model: claude-sonnet-4-20250514
383
+ max_iterations: 50
384
+ ```
385
+
386
+ ### Commands
387
+
388
+ ```bash
389
+ pocketrb config show
390
+ pocketrb config set model claude-opus-4-20250514
391
+ pocketrb config get model
392
+ ```
393
+
394
+ ## Environment Variables
395
+
396
+ | Variable | Description |
397
+ |----------|-------------|
398
+ | `ANTHROPIC_API_KEY` | Anthropic API key |
399
+ | `ANTHROPIC_OAUTH_TOKEN` | Claude Max OAuth token |
400
+ | `OPENROUTER_API_KEY` | OpenRouter API key |
401
+ | `BRAVE_API_KEY` | Brave Search API key (for web_search tool) |
402
+ | `TELEGRAM_BOT_TOKEN` | Telegram bot token |
403
+ | `POCKETRB_PROVIDER` | Default provider (anthropic, openrouter, ruby_llm, claude_cli) |
404
+ | `POCKETRB_MODEL` | Default model |
405
+ | `POCKETRB_LOG_LEVEL` | Log level (debug, info, warn, error) |
406
+
407
+ ## Architecture
408
+
409
+ ```
410
+ ┌─────────────────────────────────────────────────────────────────┐
411
+ │ Pocketrb Core │
412
+ ├─────────────────────────────────────────────────────────────────┤
413
+ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
414
+ │ │ MessageBus │ │ LLMProvider │ │ Memory System │ │
415
+ │ │ (Async::Q) │ │ (multi-LLM) │ │ (JSON + keyword match) │ │
416
+ │ └──────┬──────┘ └──────┬──────┘ └───────────┬─────────────┘ │
417
+ │ │ │ │ │
418
+ │ ┌──────▼──────────────────▼──────────────────────▼─────────┐ │
419
+ │ │ AgentLoop │ │
420
+ │ │ - Context building (identity, memory, history) │ │
421
+ │ │ - Tool execution via ToolRegistry │ │
422
+ │ │ - Context compaction for long conversations │ │
423
+ │ │ - Session management (JSONL persistence) │ │
424
+ │ └──────────────────────────────────────────────────────────┘ │
425
+ │ │ │ │
426
+ │ ┌──────▼──────┐ ┌──────▼──────┐ ┌──────────────────────┐ │
427
+ │ │ SkillLoader │ │ CronService │ │ ToolRegistry │ │
428
+ │ │ (SKILL.md) │ │ (schedule) │ │ (file, exec, web...) │ │
429
+ │ └─────────────┘ └─────────────┘ └──────────────────────┘ │
430
+ │ │ │
431
+ │ ┌──────▼────────────────────────────────────────────────────┐ │
432
+ │ │ Channels │ │
433
+ │ │ CLI │ Telegram │ WhatsApp │ (extensible) │ │
434
+ │ └───────────────────────────────────────────────────────────┘ │
435
+ └─────────────────────────────────────────────────────────────────┘
436
+ ```
437
+
438
+ ## Development
439
+
440
+ ```bash
441
+ # Install dependencies
442
+ bundle install
443
+
444
+ # Run tests
445
+ bundle exec rspec
446
+
447
+ # Run specific test
448
+ bundle exec rspec spec/unit/tools/read_file_spec.rb
449
+
450
+ # Interactive console
451
+ bundle exec irb -r ./lib/pocketrb
452
+ ```
453
+
454
+ ## License
455
+
456
+ MIT License - see LICENSE.txt
data/exe/pocketrb ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "pocketrb"
5
+
6
+ Pocketrb::CLI.start(ARGV)