kernelbot 1.0.23 → 1.0.25

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.
@@ -0,0 +1,235 @@
1
+ # Core Craft Principles
2
+
3
+ These apply regardless of design direction. This is the quality floor.
4
+
5
+ ---
6
+
7
+ ## Surface & Token Architecture
8
+
9
+ Professional interfaces don't pick colors randomly — they build systems. Understanding this architecture is the difference between "looks okay" and "feels like a real product."
10
+
11
+ ### The Primitive Foundation
12
+
13
+ Every color in your interface should trace back to a small set of primitives:
14
+
15
+ - **Foreground** — text colors (primary, secondary, muted)
16
+ - **Background** — surface colors (base, elevated, overlay)
17
+ - **Border** — edge colors (default, subtle, strong)
18
+ - **Brand** — your primary accent
19
+ - **Semantic** — functional colors (destructive, warning, success)
20
+
21
+ Don't invent new colors. Map everything to these primitives.
22
+
23
+ ### Surface Elevation Hierarchy
24
+
25
+ Surfaces stack. A dropdown sits above a card which sits above the page. Build a numbered system:
26
+
27
+ ```
28
+ Level 0: Base background (the app canvas)
29
+ Level 1: Cards, panels (same visual plane as base)
30
+ Level 2: Dropdowns, popovers (floating above)
31
+ Level 3: Nested dropdowns, stacked overlays
32
+ Level 4: Highest elevation (rare)
33
+ ```
34
+
35
+ In dark mode, higher elevation = slightly lighter. In light mode, higher elevation = slightly lighter or uses shadow. The principle: **elevated surfaces need visual distinction from what's beneath them.**
36
+
37
+ ### The Subtlety Principle
38
+
39
+ This is where most interfaces fail. Study Vercel, Supabase, Linear — their surfaces are **barely different** but still distinguishable. Their borders are **light but not invisible**.
40
+
41
+ **For surfaces:** The difference between elevation levels should be subtle — a few percentage points of lightness, not dramatic jumps. In dark mode, surface-100 might be 7% lighter than base, surface-200 might be 9%, surface-300 might be 12%. You can barely see it, but you feel it.
42
+
43
+ **For borders:** Borders should define regions without demanding attention. Use low opacity (0.05-0.12 alpha for dark mode, slightly higher for light). The border should disappear when you're not looking for it, but be findable when you need to understand the structure.
44
+
45
+ **The test:** Squint at your interface. You should still perceive the hierarchy — what's above what, where regions begin and end. But no single border or surface should jump out at you. If borders are the first thing you notice, they're too strong. If you can't find where one region ends and another begins, they're too subtle.
46
+
47
+ **Common AI mistakes to avoid:**
48
+ - Borders that are too visible (1px solid gray instead of subtle rgba)
49
+ - Surface jumps that are too dramatic (going from dark to light instead of dark to slightly-less-dark)
50
+ - Using different hues for different surfaces (gray card on blue background)
51
+ - Harsh dividers where subtle borders would do
52
+
53
+ ### Text Hierarchy via Tokens
54
+
55
+ Don't just have "text" and "gray text." Build four levels:
56
+
57
+ - **Primary** — default text, highest contrast
58
+ - **Secondary** — supporting text, slightly muted
59
+ - **Tertiary** — metadata, timestamps, less important
60
+ - **Muted** — disabled, placeholder, lowest contrast
61
+
62
+ Use all four consistently. If you're only using two, your hierarchy is too flat.
63
+
64
+ ### Border Progression
65
+
66
+ Borders aren't binary. Build a scale:
67
+
68
+ - **Default** — standard borders
69
+ - **Subtle/Muted** — softer separation
70
+ - **Strong** — emphasis, hover states
71
+ - **Stronger** — maximum emphasis, focus rings
72
+
73
+ Match border intensity to the importance of the boundary.
74
+
75
+ ### Dedicated Control Tokens
76
+
77
+ Form controls (inputs, checkboxes, selects) have specific needs. Don't just reuse surface tokens — create dedicated ones:
78
+
79
+ - **Control background** — often different from surface backgrounds
80
+ - **Control border** — needs to feel interactive
81
+ - **Control focus** — clear focus indication
82
+
83
+ This separation lets you tune controls independently from layout surfaces.
84
+
85
+ ### Context-Aware Bases
86
+
87
+ Different areas of your app might need different base surfaces:
88
+
89
+ - **Marketing pages** — might use darker/richer backgrounds
90
+ - **Dashboard/app** — might use neutral working backgrounds
91
+ - **Sidebar** — might differ from main canvas
92
+
93
+ The surface hierarchy works the same way — it just starts from a different base.
94
+
95
+ ### Alternative Backgrounds for Depth
96
+
97
+ Beyond shadows, use contrasting backgrounds to create depth. An "alternative" or "inset" background makes content feel recessed. Useful for:
98
+
99
+ - Empty states in data grids
100
+ - Code blocks
101
+ - Inset panels
102
+ - Visual grouping without borders
103
+
104
+ ---
105
+
106
+ ## Spacing System
107
+
108
+ Pick a base unit (4px and 8px are common) and use multiples throughout. The specific number matters less than consistency — every spacing value should be explainable as "X times the base unit."
109
+
110
+ Build a scale for different contexts:
111
+ - Micro spacing (icon gaps, tight element pairs)
112
+ - Component spacing (within buttons, inputs, cards)
113
+ - Section spacing (between related groups)
114
+ - Major separation (between distinct sections)
115
+
116
+ ## Symmetrical Padding
117
+
118
+ TLBR must match. If top padding is 16px, left/bottom/right must also be 16px. Exception: when content naturally creates visual balance.
119
+
120
+ ```css
121
+ /* Good */
122
+ padding: 16px;
123
+ padding: 12px 16px; /* Only when horizontal needs more room */
124
+
125
+ /* Bad */
126
+ padding: 24px 16px 12px 16px;
127
+ ```
128
+
129
+ ## Border Radius Consistency
130
+
131
+ Sharper corners feel technical, rounder corners feel friendly. Pick a scale that fits your product's personality and use it consistently.
132
+
133
+ The key is having a system: small radius for inputs and buttons, medium for cards, large for modals or containers. Don't mix sharp and soft randomly — inconsistent radius is as jarring as inconsistent spacing.
134
+
135
+ ## Depth & Elevation Strategy
136
+
137
+ Match your depth approach to your design direction. Choose ONE and commit:
138
+
139
+ **Borders-only (flat)** — Clean, technical, dense. Works for utility-focused tools where information density matters more than visual lift. Linear, Raycast, and many developer tools use almost no shadows — just subtle borders to define regions.
140
+
141
+ **Subtle single shadows** — Soft lift without complexity. A simple `0 1px 3px rgba(0,0,0,0.08)` can be enough. Works for approachable products that want gentle depth.
142
+
143
+ **Layered shadows** — Rich, premium, dimensional. Multiple shadow layers create realistic depth. Stripe and Mercury use this approach. Best for cards that need to feel like physical objects.
144
+
145
+ **Surface color shifts** — Background tints establish hierarchy without any shadows. A card at `#fff` on a `#f8fafc` background already feels elevated.
146
+
147
+ ```css
148
+ /* Borders-only approach */
149
+ --border: rgba(0, 0, 0, 0.08);
150
+ --border-subtle: rgba(0, 0, 0, 0.05);
151
+ border: 0.5px solid var(--border);
152
+
153
+ /* Single shadow approach */
154
+ --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
155
+
156
+ /* Layered shadow approach */
157
+ --shadow-layered:
158
+ 0 0 0 0.5px rgba(0, 0, 0, 0.05),
159
+ 0 1px 2px rgba(0, 0, 0, 0.04),
160
+ 0 2px 4px rgba(0, 0, 0, 0.03),
161
+ 0 4px 8px rgba(0, 0, 0, 0.02);
162
+ ```
163
+
164
+ ## Card Layouts
165
+
166
+ Monotonous card layouts are lazy design. A metric card doesn't have to look like a plan card doesn't have to look like a settings card.
167
+
168
+ Design each card's internal structure for its specific content — but keep the surface treatment consistent: same border weight, shadow depth, corner radius, padding scale, typography.
169
+
170
+ ## Isolated Controls
171
+
172
+ UI controls deserve container treatment. Date pickers, filters, dropdowns — these should feel like crafted objects.
173
+
174
+ **Never use native form elements for styled UI.** Native `<select>`, `<input type="date">`, and similar elements render OS-native dropdowns that cannot be styled. Build custom components instead:
175
+
176
+ - Custom select: trigger button + positioned dropdown menu
177
+ - Custom date picker: input + calendar popover
178
+ - Custom checkbox/radio: styled div with state management
179
+
180
+ Custom select triggers must use `display: inline-flex` with `white-space: nowrap` to keep text and chevron icons on the same row.
181
+
182
+ ## Typography Hierarchy
183
+
184
+ Build distinct levels that are visually distinguishable at a glance:
185
+
186
+ - **Headlines** — heavier weight, tighter letter-spacing for presence
187
+ - **Body** — comfortable weight for readability
188
+ - **Labels/UI** — medium weight, works at smaller sizes
189
+ - **Data** — often monospace, needs `tabular-nums` for alignment
190
+
191
+ Don't rely on size alone. Combine size, weight, and letter-spacing to create clear hierarchy. If you squint and can't tell headline from body, the hierarchy is too weak.
192
+
193
+ ## Monospace for Data
194
+
195
+ Numbers, IDs, codes, timestamps belong in monospace. Use `tabular-nums` for columnar alignment. Mono signals "this is data."
196
+
197
+ ## Iconography
198
+
199
+ Icons clarify, not decorate — if removing an icon loses no meaning, remove it. Choose a consistent icon set and stick with it throughout the product.
200
+
201
+ Give standalone icons presence with subtle background containers. Icons next to text should align optically, not mathematically.
202
+
203
+ ## Animation
204
+
205
+ Keep it fast and functional. Micro-interactions (hover, focus) should feel instant — around 150ms. Larger transitions (modals, panels) can be slightly longer — 200-250ms.
206
+
207
+ Use smooth deceleration easing (ease-out variants). Avoid spring/bounce effects in professional interfaces — they feel playful, not serious.
208
+
209
+ ## Contrast Hierarchy
210
+
211
+ Build a four-level system: foreground (primary) → secondary → muted → faint. Use all four consistently.
212
+
213
+ ## Color Carries Meaning
214
+
215
+ Gray builds structure. Color communicates — status, action, emphasis, identity. Unmotivated color is noise. Color that reinforces the product's world is character.
216
+
217
+ ## Navigation Context
218
+
219
+ Screens need grounding. A data table floating in space feels like a component demo, not a product. Consider including:
220
+
221
+ - **Navigation** — sidebar or top nav showing where you are in the app
222
+ - **Location indicator** — breadcrumbs, page title, or active nav state
223
+ - **User context** — who's logged in, what workspace/org
224
+
225
+ When building sidebars, consider using the same background as the main content area. Rely on a subtle border for separation rather than different background colors.
226
+
227
+ ## Dark Mode
228
+
229
+ Dark interfaces have different needs:
230
+
231
+ **Borders over shadows** — Shadows are less visible on dark backgrounds. Lean more on borders for definition.
232
+
233
+ **Adjust semantic colors** — Status colors (success, warning, error) often need to be slightly desaturated for dark backgrounds.
234
+
235
+ **Same structure, different values** — The hierarchy system still applies, just with inverted values.
@@ -0,0 +1,48 @@
1
+ # Memory Management
2
+
3
+ When and how to update `.interface-design/system.md`.
4
+
5
+ ## When to Add Patterns
6
+
7
+ Add to system.md when:
8
+ - Component used 2+ times
9
+ - Pattern is reusable across the project
10
+ - Has specific measurements worth remembering
11
+
12
+ ## Pattern Format
13
+
14
+ ```markdown
15
+ ### Button Primary
16
+ - Height: 36px
17
+ - Padding: 12px 16px
18
+ - Radius: 6px
19
+ - Font: 14px, 500 weight
20
+ ```
21
+
22
+ ## Don't Document
23
+
24
+ - One-off components
25
+ - Temporary experiments
26
+ - Variations better handled with props
27
+
28
+ ## Pattern Reuse
29
+
30
+ Before creating a component, check system.md:
31
+ - Pattern exists? Use it.
32
+ - Need variation? Extend, don't create new.
33
+
34
+ Memory compounds: each pattern saved makes future work faster and more consistent.
35
+
36
+ ---
37
+
38
+ # Validation Checks
39
+
40
+ If system.md defines specific values, check consistency:
41
+
42
+ **Spacing** — All values multiples of the defined base?
43
+
44
+ **Depth** — Using the declared strategy throughout? (borders-only means no shadows)
45
+
46
+ **Colors** — Using defined palette, not random hex codes?
47
+
48
+ **Patterns** — Reusing documented patterns instead of creating new?
package/.env.example CHANGED
@@ -1,3 +1,14 @@
1
+ # AI provider API keys (only the one matching your brain.provider is required)
1
2
  ANTHROPIC_API_KEY=sk-ant-...
3
+ OPENAI_API_KEY=sk-...
4
+ GOOGLE_API_KEY=AIza...
5
+ GROQ_API_KEY=gsk_...
6
+
7
+ # Required
2
8
  TELEGRAM_BOT_TOKEN=123456:ABC-DEF...
9
+
10
+ # Optional
3
11
  GITHUB_TOKEN=ghp_...
12
+ JIRA_BASE_URL=https://yourcompany.atlassian.net
13
+ JIRA_EMAIL=you@company.com
14
+ JIRA_API_TOKEN=your-jira-api-token
package/README.md CHANGED
@@ -1,21 +1,51 @@
1
1
  # KernelBot
2
2
 
3
- AI engineering agent a Telegram bot backed by Claude Sonnet with full OS control via tool use.
4
-
5
- Send a message in Telegram, and KernelBot will read files, write code, run commands, and respond with the results. It's your personal engineering assistant with direct access to your machine.
3
+ [kernelbot.io](https://kernelbot.io) | [npm](https://www.npmjs.com/package/kernelbot) | [GitHub](https://github.com/KernelCode/kernelbot)
4
+
5
+ AI engineering agent a Telegram bot backed by Claude, GPT, Gemini, or Groq with full OS control via tool use.
6
+
7
+ Send a message in Telegram, and KernelBot will read files, write code, run commands, browse the web, manage infrastructure, and respond with the results. It's your personal engineering assistant with direct access to your machine.
8
+
9
+ ## Features
10
+
11
+ - **Multi-model support** — choose your AI brain: Anthropic (Claude), OpenAI (GPT), Google (Gemini), or Groq (Llama/Mixtral). Switch models anytime from the CLI menu
12
+ - **Autonomous agent loop** — send one message and KernelBot chains tool calls until the task is done, no hand-holding needed
13
+ - **Full shell access** — run any command, install packages, build projects, run tests
14
+ - **File management** — read, write, and create files with automatic directory creation
15
+ - **Web browsing** — navigate pages, extract content, take screenshots, interact with forms and buttons (Puppeteer)
16
+ - **Git workflow** — clone repos, create branches, commit, push, and view diffs
17
+ - **GitHub integration** — create repos, open PRs, post code reviews, list and inspect pull requests
18
+ - **JIRA integration** — read tickets, search with JQL, list assigned/project tickets (Cloud + Server)
19
+ - **Claude Code sub-agent** — spawn a dedicated Claude Code CLI session for complex coding tasks (write, edit, debug, refactor)
20
+ - **Docker management** — list containers, read logs, exec into containers, run compose commands
21
+ - **Process control** — list, kill, and manage system processes and systemd services
22
+ - **System monitoring** — check CPU, RAM, disk usage, and read system logs
23
+ - **Networking** — make HTTP requests, check ports, test and reload nginx
24
+ - **Send images** — share screenshots and files directly in the Telegram chat
25
+ - **Conversation memory** — per-chat history that persists across restarts
26
+ - **Live status updates** — Claude Code activity consolidated into a single updating message instead of spam
27
+ - **Security built-in** — user allowlist, blocked paths, dangerous operation confirmation, audit logging, secret redaction
28
+ - **Zero config setup** — auto-detects config, prompts for missing credentials on first run
29
+ - **Credential management** — auto-prompts for missing API keys (GitHub, Anthropic, Telegram, JIRA) and saves them
6
30
 
7
31
  ## How It Works
8
32
 
9
33
  ```text
10
- You (Telegram) → KernelBot → Claude Sonnet (Anthropic API)
34
+ You (Telegram) → KernelBot → AI Brain (Claude / GPT / Gemini / Groq)
35
+
36
+ Tools (shell, files, git, docker, browser, etc.)
11
37
 
12
- OS Tools (shell, files, directories)
38
+ Claude Code CLI (coding tasks)
13
39
  ```
14
40
 
15
- KernelBot runs a **tool-use loop**: Claude decides which tools to call, KernelBot executes them on your OS, feeds results back, and Claude continues until the task is done. One message can trigger dozens of tool calls autonomously.
41
+ KernelBot runs a **tool-use loop**: the AI decides which tools to call, KernelBot executes them on your OS, feeds results back, and the AI continues until the task is done. One message can trigger dozens of tool calls autonomously.
42
+
43
+ For complex coding tasks, KernelBot can spawn **Claude Code CLI** as a sub-agent — giving it a dedicated coding environment with its own tool loop for writing, editing, and debugging code.
16
44
 
17
45
  ## Tools
18
46
 
47
+ ### File System & Shell
48
+
19
49
  | Tool | Description |
20
50
  | ----------------- | --------------------------------------------------- |
21
51
  | `execute_command` | Run any shell command (git, npm, python, etc.) |
@@ -23,9 +53,83 @@ KernelBot runs a **tool-use loop**: Claude decides which tools to call, KernelBo
23
53
  | `write_file` | Write/create files, auto-creates parent directories |
24
54
  | `list_directory` | List directory contents, optionally recursive |
25
55
 
56
+ ### Git & GitHub
57
+
58
+ | Tool | Description |
59
+ | -------------------- | ----------------------------------------------- |
60
+ | `git_clone` | Clone a repo (`org/repo` shorthand or full URL) |
61
+ | `git_checkout` | Checkout or create branches |
62
+ | `git_commit` | Stage all changes and commit |
63
+ | `git_push` | Push current branch to remote |
64
+ | `git_diff` | Show uncommitted changes |
65
+ | `github_create_pr` | Create a pull request |
66
+ | `github_get_pr_diff` | Get the diff of a PR |
67
+ | `github_post_review` | Post a review on a PR |
68
+ | `github_create_repo` | Create a new GitHub repository |
69
+ | `github_list_prs` | List pull requests for a repo |
70
+
71
+ ### Web Browsing
72
+
73
+ | Tool | Description |
74
+ | -------------------- | ------------------------------------------------------------------------- |
75
+ | `browse_website` | Navigate to a URL and extract page content (title, headings, text, links) |
76
+ | `screenshot_website` | Take a screenshot of a website, supports full-page and element capture |
77
+ | `extract_content` | Extract specific content using CSS selectors |
78
+ | `interact_with_page` | Click, type, scroll, and run JS on a webpage |
79
+ | `send_image` | Send an image/screenshot directly to the Telegram chat |
80
+
81
+ ### JIRA
82
+
83
+ | Tool | Description |
84
+ | -------------------------- | ----------------------------------------- |
85
+ | `jira_get_ticket` | Get details of a specific JIRA ticket |
86
+ | `jira_search_tickets` | Search tickets using JQL queries |
87
+ | `jira_list_my_tickets` | List tickets assigned to the current user |
88
+ | `jira_get_project_tickets` | Get tickets from a specific JIRA project |
89
+
90
+ ### Docker
91
+
92
+ | Tool | Description |
93
+ | ---------------- | -------------------------------------------- |
94
+ | `docker_ps` | List containers |
95
+ | `docker_logs` | Get container logs |
96
+ | `docker_exec` | Execute a command inside a running container |
97
+ | `docker_compose` | Run docker compose commands |
98
+
99
+ ### Process & System
100
+
101
+ | Tool | Description |
102
+ | ----------------- | ------------------------------------------------------ |
103
+ | `process_list` | List running processes, optionally filter by name |
104
+ | `kill_process` | Kill a process by PID or name |
105
+ | `service_control` | Manage systemd services (start, stop, restart, status) |
106
+
107
+ ### Monitoring
108
+
109
+ | Tool | Description |
110
+ | -------------- | ------------------------------- |
111
+ | `disk_usage` | Show disk space usage |
112
+ | `memory_usage` | Show RAM usage |
113
+ | `cpu_usage` | Show CPU load |
114
+ | `system_logs` | Read system or application logs |
115
+
116
+ ### Networking
117
+
118
+ | Tool | Description |
119
+ | -------------- | ------------------------------------------ |
120
+ | `check_port` | Check if a port is open and listening |
121
+ | `curl_url` | Make HTTP requests and return the response |
122
+ | `nginx_reload` | Test nginx config and reload if valid |
123
+
124
+ ### Coding
125
+
126
+ | Tool | Description |
127
+ | ------------------- | ----------------------------------------------------------------------------------------- |
128
+ | `spawn_claude_code` | Spawn Claude Code CLI for coding tasks — writing, fixing, reviewing, and scaffolding code |
129
+
26
130
  ## Disclaimer
27
131
 
28
- > **WARNING:** KernelBot has full access to your operating system. It can execute shell commands, read/write files, manage processes, control Docker containers, and interact with external services (GitHub, Telegram) on your behalf. Only run KernelBot on machines you own and control. Always configure `allowed_users` in production to restrict who can interact with the bot. The authors are not responsible for any damage caused by misuse.
132
+ > **WARNING:** KernelBot has full access to your operating system. It can execute shell commands, read/write files, manage processes, control Docker containers, browse the web, and interact with external services (GitHub, Telegram) on your behalf. Only run KernelBot on machines you own and control. Always configure `allowed_users` in production to restrict who can interact with the bot. The authors are not responsible for any damage caused by misuse.
29
133
 
30
134
  ## Installation
31
135
 
@@ -41,10 +145,13 @@ kernelbot
41
145
 
42
146
  That's it. On first run, KernelBot will:
43
147
 
44
- 1. Detect missing credentials and prompt for them
45
- 2. Save them to `~/.kernelbot/.env`
46
- 3. Verify API connections
47
- 4. Launch the Telegram bot
148
+ 1. Prompt you to select an AI provider and model
149
+ 2. Ask for your API key and Telegram bot token
150
+ 3. Save credentials to `~/.kernelbot/.env`
151
+ 4. Verify API connections
152
+ 5. Launch the Telegram bot
153
+
154
+ You can change your AI provider/model anytime from the CLI menu (option 5).
48
155
 
49
156
  ## Configuration
50
157
 
@@ -55,8 +162,17 @@ KernelBot auto-detects config from the current directory or `~/.kernelbot/`. Eve
55
162
  Set these in `.env` or as system environment variables:
56
163
 
57
164
  ```text
58
- ANTHROPIC_API_KEY=sk-ant-...
165
+ # AI provider key (only the one matching your provider is required)
166
+ ANTHROPIC_API_KEY=sk-ant-... # for Anthropic (Claude)
167
+ OPENAI_API_KEY=sk-... # for OpenAI (GPT)
168
+ GOOGLE_API_KEY=AIza... # for Google (Gemini)
169
+ GROQ_API_KEY=gsk_... # for Groq (Llama/Mixtral)
170
+
59
171
  TELEGRAM_BOT_TOKEN=123456:ABC-DEF...
172
+ GITHUB_TOKEN=ghp_... # optional, for GitHub tools
173
+ JIRA_BASE_URL=https://yourcompany.atlassian.net # optional, for JIRA tools
174
+ JIRA_EMAIL=you@company.com
175
+ JIRA_API_TOKEN=your-jira-api-token
60
176
  ```
61
177
 
62
178
  ### `config.yaml` (optional)
@@ -67,7 +183,8 @@ Drop a `config.yaml` in your working directory or `~/.kernelbot/` to customize b
67
183
  bot:
68
184
  name: KernelBot
69
185
 
70
- anthropic:
186
+ brain:
187
+ provider: anthropic # anthropic | openai | google | groq
71
188
  model: claude-sonnet-4-20250514
72
189
  max_tokens: 8192
73
190
  temperature: 0.3
@@ -77,11 +194,21 @@ telegram:
77
194
  allowed_users: [] # empty = allow all (dev mode)
78
195
  # allowed_users: [123456789] # lock to specific Telegram user IDs
79
196
 
197
+ jira:
198
+ base_url: https://yourcompany.atlassian.net
199
+ email: you@company.com
200
+ api_token: your-api-token
201
+
80
202
  security:
81
203
  blocked_paths: # paths the agent cannot touch
82
204
  - /etc/shadow
83
205
  - /etc/passwd
84
206
 
207
+ claude_code:
208
+ max_turns: 50
209
+ timeout_seconds: 600
210
+ # model: claude-sonnet-4-20250514 # optional model override
211
+
85
212
  logging:
86
213
  level: info
87
214
  max_file_size: 5242880 # 5 MB
@@ -90,35 +217,87 @@ conversation:
90
217
  max_history: 50 # messages per chat
91
218
  ```
92
219
 
220
+ ## Telegram Commands
221
+
222
+ | Command | Description |
223
+ | ---------- | ---------------------------------- |
224
+ | `/clean` | Clear conversation and start fresh |
225
+ | `/history` | Show message count in memory |
226
+ | `/help` | Show help message |
227
+
93
228
  ## Security
94
229
 
95
230
  - **User allowlist** — restrict bot access to specific Telegram user IDs. Empty list = dev mode (anyone can use it).
96
231
  - **Blocked paths** — files/directories the agent is forbidden from reading or writing (e.g., `/etc/shadow`, SSH keys).
232
+ - **Dangerous operation confirmation** — destructive actions require user confirmation before execution.
233
+ - **Browser URL blocklist** — internal/private network addresses are blocked from browsing.
97
234
  - **Audit logging** — every tool call is logged to `kernel-audit.log` with user, tool, params, result, and duration. Secrets in params are automatically redacted.
98
235
  - **Command timeout** — shell commands are killed after 30 seconds by default.
99
236
 
237
+ ## JIRA Integration
238
+
239
+ KernelBot can read and search JIRA tickets. Supports both Atlassian Cloud (`*.atlassian.net`) and self-hosted JIRA Server instances.
240
+
241
+ ### Setup
242
+
243
+ 1. **Get an API token** — for Atlassian Cloud, generate one at [id.atlassian.net/manage-profile/security/api-tokens](https://id.atlassian.net/manage-profile/security/api-tokens). For JIRA Server, use your password or a personal access token.
244
+
245
+ 2. **Configure** via environment variables or `config.yaml`:
246
+
247
+ ```text
248
+ JIRA_BASE_URL=https://yourcompany.atlassian.net
249
+ JIRA_EMAIL=you@company.com
250
+ JIRA_API_TOKEN=your-api-token
251
+ ```
252
+
253
+ If credentials are missing when a JIRA tool is called, KernelBot will prompt for them via Telegram.
254
+
255
+ ### Available Tools
256
+
257
+ - **`jira_get_ticket`** — Fetch a single ticket by key (e.g. `PROJ-123`). Returns summary, description, status, assignee, priority, and dates.
258
+ - **`jira_search_tickets`** — Search using JQL (e.g. `project = PROJ AND status = "In Progress"`). Returns up to `max_results` tickets.
259
+ - **`jira_list_my_tickets`** — List tickets assigned to the current user (or a specified assignee).
260
+ - **`jira_get_project_tickets`** — List all tickets in a project, ordered by last update.
261
+
100
262
  ## Project Structure
101
263
 
102
264
  ```text
103
265
  KernelBot/
104
266
  ├── bin/
105
- │ └── kernel.js # Entry point
267
+ │ └── kernel.js # Entry point + CLI menu
106
268
  ├── src/
107
- │ ├── agent.js # Sonnet tool-use loop
108
- │ ├── bot.js # Telegram bot (polling, auth, message handling)
109
- │ ├── conversation.js # Per-chat conversation history
269
+ │ ├── agent.js # AI tool-use loop (provider-agnostic)
270
+ │ ├── bot.js # Telegram bot (polling, auth, message handling)
271
+ │ ├── coder.js # Claude Code CLI spawner + smart output
272
+ │ ├── conversation.js # Per-chat conversation history
110
273
  │ ├── prompts/
111
- │ │ └── system.js # System prompt
274
+ │ │ └── system.js # System prompt
275
+ │ ├── providers/
276
+ │ │ ├── models.js # Provider & model catalog
277
+ │ │ ├── base.js # Abstract provider interface
278
+ │ │ ├── anthropic.js # Anthropic (Claude) provider
279
+ │ │ ├── openai-compat.js # OpenAI / Gemini / Groq provider
280
+ │ │ └── index.js # Provider factory
112
281
  │ ├── security/
113
- │ │ ├── auth.js # User allowlist
114
- │ │ └── audit.js # Tool call audit logging
282
+ │ │ ├── auth.js # User allowlist
283
+ │ │ ├── audit.js # Tool call audit logging
284
+ │ │ └── confirm.js # Dangerous operation detection
115
285
  │ ├── tools/
116
- │ │ ├── os.js # OS tool definitions + handlers
117
- │ │ └── index.js # Tool registry + dispatcher
286
+ │ │ ├── os.js # File system + shell tools
287
+ │ │ ├── git.js # Git operations
288
+ │ │ ├── github.js # GitHub API (PRs, repos, reviews)
289
+ │ │ ├── browser.js # Web browsing (Puppeteer)
290
+ │ │ ├── docker.js # Docker management
291
+ │ │ ├── process.js # Process management
292
+ │ │ ├── monitor.js # System monitoring (CPU, RAM, disk)
293
+ │ │ ├── network.js # Network tools (HTTP, ports, nginx)
294
+ │ │ ├── coding.js # Claude Code CLI handler
295
+ │ │ ├── jira.js # JIRA ticket reading + search
296
+ │ │ └── index.js # Tool registry + dispatcher
118
297
  │ └── utils/
119
- │ ├── config.js # Config loading (auto-detect + prompt)
120
- │ ├── display.js # CLI display (logo, spinners, banners)
121
- │ └── logger.js # Winston logger
298
+ │ ├── config.js # Config loading (auto-detect + prompt)
299
+ │ ├── display.js # CLI display (logo, spinners, banners)
300
+ │ └── logger.js # Winston logger
122
301
  ├── config.example.yaml
123
302
  ├── .env.example
124
303
  └── package.json
@@ -127,8 +306,20 @@ KernelBot/
127
306
  ## Requirements
128
307
 
129
308
  - Node.js 18+
130
- - [Anthropic API key](https://console.anthropic.com/)
309
+ - AI provider API key (one of):
310
+ - [Anthropic API key](https://console.anthropic.com/) (Claude)
311
+ - [OpenAI API key](https://platform.openai.com/api-keys) (GPT)
312
+ - [Google AI API key](https://aistudio.google.com/apikey) (Gemini)
313
+ - [Groq API key](https://console.groq.com/keys) (Llama/Mixtral)
131
314
  - [Telegram Bot Token](https://t.me/BotFather)
315
+ - Chromium/Chrome (for browser tools — installed automatically by Puppeteer)
316
+ - [GitHub Token](https://github.com/settings/tokens) (optional, for GitHub tools)
317
+ - [JIRA API Token](https://id.atlassian.net/manage-profile/security/api-tokens) (optional, for JIRA integration)
318
+ - [Claude Code CLI](https://www.npmjs.com/package/@anthropic-ai/claude-code) (optional, for coding tasks)
319
+
320
+ ## License
321
+
322
+ MIT
132
323
 
133
324
  ## Author
134
325