clew-code 0.2.1

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,181 @@
1
+ ---
2
+ layout: default
3
+ title: Taste
4
+ nav_order: 14
5
+ ---
6
+
7
+ # Taste
8
+
9
+ **Local-first preference-learning runtime for Clew.**
10
+
11
+ Taste learns your coding style from accept/reject/edit/test/lint signals and manual rules. It combines symbolic rules, semantic preference scoring, and contextual bandit optimization to adapt Clew's output to your preferences.
12
+
13
+ It does **not** fine-tune the base LLM. All learning is local, online, and preference-based.
14
+
15
+ ## What It Learns
16
+
17
+ - **Code style**: formatting, naming conventions, preferred patterns
18
+ - **Architecture**: module structure, dependency direction, layering
19
+ - **Tooling**: preferred build tools, linters, test frameworks
20
+ - **Testing**: test style, coverage expectations, mocking patterns
21
+ - **Naming**: variable/function/class naming conventions
22
+ - **Security**: safe patterns vs unsafe patterns
23
+ - **Performance**: efficient algorithms, caching, resource management
24
+ - **UI patterns**: component structure, state management, styling approach
25
+ - **Workflow**: commit style, review preferences, deployment habits
26
+
27
+ ## What It Does Not Do
28
+
29
+ - Does not fine-tune or modify the base LLM
30
+ - Does not send taste data to remote services (all data stays local)
31
+ - Does not automatically block edits without showing a reason
32
+ - Does not replace memory, skills, or CLAUDE.md files
33
+
34
+ ## How It Differs from Other Systems
35
+
36
+ | System | Purpose | Storage | Scope |
37
+ |--------|---------|---------|-------|
38
+ | **CLAUDE.md** | Project instructions | `.claude/` files | Static project rules |
39
+ | **Memory** | Cross-session facts | `memdir/` | Recall |
40
+ | **Skills** | Reusable procedures | Plugin/skill system | Task automation |
41
+ | **Taste** | Learned preferences | `.clew/taste/` | Adaptive preference optimization |
42
+
43
+ - Rules are explicit user preferences
44
+ - Memory is facts about the user and project
45
+ - Skills are reusable task procedures
46
+ - Taste is learned, weighted preference signals
47
+
48
+ ## Storage Paths
49
+
50
+ | Data | Path |
51
+ |------|------|
52
+ | Project profile | `.clew/taste/profile.json` |
53
+ | Project event log | `.clew/taste/events.jsonl` |
54
+ | Project packages | `.clew/taste/packages/` |
55
+ | Global profile | `~/.clew/taste/profile.json` |
56
+ | Global packages | `~/.clew/taste/packages/` |
57
+
58
+ ## Commands
59
+
60
+ | Command | Description |
61
+ |---------|-------------|
62
+ | `/taste` | Open interactive menu (arrow-key navigable) |
63
+ | `/taste status` | Print status |
64
+ | `/taste learn <rule>` | Add a manual rule |
65
+ | `/taste forget <id>` | Remove a rule by ID |
66
+ | `/taste profile` | Show full profile with rules |
67
+ | `/taste events` | Show recent learning events |
68
+ | `/taste decay` | Apply confidence decay |
69
+ | `/taste eval` | Run profile self-evaluation |
70
+ | `/taste export` | Export high-confidence rules |
71
+ | `/taste import <file>` | Import rules from file |
72
+ | `/taste on` | Enable taste |
73
+ | `/taste off` | Disable taste |
74
+
75
+ ## Configuration
76
+
77
+ Settings in `settings.json`:
78
+
79
+ ```json
80
+ {
81
+ "taste": {
82
+ "enabled": true,
83
+ "autoLearn": true,
84
+ "injectPrompts": true,
85
+ "validateEdits": true,
86
+ "minConfidence": 0.55,
87
+ "maxInjectedRules": 8,
88
+ "decayEnabled": true,
89
+ "banditEnabled": true,
90
+ "neuralScoringEnabled": true
91
+ }
92
+ }
93
+ ```
94
+
95
+ ## Architecture
96
+
97
+ Taste consists of several subsystems:
98
+
99
+ 1. **Signal Collection** — Captures accept, reject, edit, test, lint, and tool signals from
100
+ user interactions and converts them into learning events.
101
+
102
+ 2. **Reward Model** — Maps signal types to numeric reward values (accept = +1.0, reject = -1.0,
103
+ test pass = +0.4, etc.) and computes edit distance rewards dynamically.
104
+
105
+ 3. **Symbolic Engine** — Compiles high-confidence rules into checkable constraints.
106
+ Rules with confidence >= 0.85 can block edit acceptance. Rules below
107
+ threshold warn without blocking. Never blocks silently.
108
+
109
+ 4. **Neural Scorer** — Provider-agnostic lexical similarity scoring (Jaccard/TF-IDF)
110
+ that scores candidate output against active rules. Extensible to use
111
+ embedding APIs when available.
112
+
113
+ 5. **Contextual Bandit** — Epsilon-greedy bandit with 6 strategy arms (minimal,
114
+ strict_style, architecture_first, test_first, safety_first, refactor_heavy).
115
+ Selects optimal strategy based on feedback and context features.
116
+
117
+ 6. **Prompt Injection** — Injects a compact `<clew_taste>` block into the system
118
+ prompt with relevant rules. Max 8 rules by default, filtered by confidence
119
+ and sorted by relevance.
120
+
121
+ 7. **Decay Engine** — Gradual confidence reduction for unused rules (half-life
122
+ based, default 30 days). Prevents stale preferences from persisting.
123
+
124
+ 8. **Event Log** — Append-only JSONL file storing all raw learning events for
125
+ auditability and regression analysis.
126
+
127
+ ## Continuous RL (Local Online Preference Optimization)
128
+
129
+ Taste implements **local online preference optimization**:
130
+
131
+ - **Online**: learns continuously from each interaction, no batch training
132
+ - **Local**: all computation and storage stays on the user's machine
133
+ - **Preference-based**: optimizes for user preferences via reward signals
134
+ - **Multi-objective**: balances style, correctness, safety, and efficiency
135
+
136
+ The learning loop:
137
+
138
+ 1. User interacts with Clew (accepts, rejects, edits output)
139
+ 2. Signal collector captures the interaction as a typed event with reward
140
+ 3. Bandit arm updates based on reward signal
141
+ 4. Rule confidence adjusts based on positive/negative evidence
142
+ 5. Prompt injection adapts to reflect current learned preferences
143
+ 6. Decay gradually reduces stale rule confidence
144
+
145
+ This is **not** LLM fine-tuning. The base model's weights never change.
146
+ Taste adapts the prompt context and edit validation, not the model itself.
147
+
148
+ ## Privacy
149
+
150
+ - All taste data stays local by default
151
+ - Profiles and event logs are stored in `.clew/taste/` or `~/.clew/taste/`
152
+ - No data is sent to remote services
153
+ - Export/import is explicit and user-initiated
154
+ - Event logs are append-only for auditability
155
+
156
+ ## Integration Points
157
+
158
+ | Point | Status | Description |
159
+ |-------|--------|-------------|
160
+ | Prompt injection | Implemented | System prompt taste block via `TastePromptInjector` |
161
+ | Edit validation | Implemented | `validateEdit()` called in `FileEditPermissionRequest` |
162
+ | Accept/reject signals | Implemented | Fire-and-forget via `recordAcceptSignal`/`recordRejectSignal` in `PermissionContext` |
163
+ | Test/lint signals | No-op stub | Ready for `PostToolUse` output analysis |
164
+ | Tool result signals | Implemented | `recordToolSignal()` in `toolExecution.ts` |
165
+ | Interactive menu | Implemented | `/taste` Dialog with 11 actions, Spinner loading, input pre-fill |
166
+ | Status line | Implemented | `TasteStatusLine` shown in `PromptInputFooter` |
167
+ | Config live-reload | Implemented | `subscribeToSettingsChanges()` reloads config at runtime |
168
+ | Settings config | Implemented | `taste.*` in `settings.json` |
169
+
170
+ ## Example Usage
171
+
172
+ ```
173
+ /taste # Open interactive menu
174
+ /taste learn Use const instead of let
175
+ /taste learn Prefer named exports
176
+ /taste learn Never use any type
177
+ /taste status
178
+ /taste profile
179
+ /taste eval
180
+ /taste export
181
+ ```
@@ -0,0 +1,177 @@
1
+ ---
2
+ layout: default
3
+ title: Clew taste-1
4
+ nav_order: 14
5
+ ---
6
+
7
+ # Clew taste-1
8
+
9
+ **Local-first preference-learning runtime for ClewCode.**
10
+
11
+ Clew taste-1 learns the user's coding taste and working style from accept/reject/edit/test/lint signals and manual rules. It combines symbolic rules, semantic preference scoring, and contextual bandit optimization to adapt ClewCode's output to the user's preferences.
12
+
13
+ It does **not** fine-tune the base LLM. All learning is local, online, and preference-based.
14
+
15
+ ## What It Learns
16
+
17
+ - **Code style**: formatting, naming conventions, preferred patterns
18
+ - **Architecture**: module structure, dependency direction, layering
19
+ - **Tooling**: preferred build tools, linters, test frameworks
20
+ - **Testing**: test style, coverage expectations, mocking patterns
21
+ - **Naming**: variable/function/class naming conventions
22
+ - **Security**: safe patterns vs unsafe patterns
23
+ - **Performance**: efficient algorithms, caching, resource management
24
+ - **UI patterns**: component structure, state management, styling approach
25
+ - **Workflow**: commit style, review preferences, deployment habits
26
+
27
+ ## What It Does Not Do
28
+
29
+ - Does not fine-tune or modify the base LLM
30
+ - Does not send taste data to remote services (all data stays local)
31
+ - Does not automatically block edits without showing a reason
32
+ - Does not replace memory, skills, or CLAUDE.md files
33
+
34
+ ## How It Differs from Other Systems
35
+
36
+ | System | Purpose | Storage | Scope |
37
+ |--------|---------|---------|-------|
38
+ | **CLAUDE.md** | Project instructions | `.claude/` files | Static project rules |
39
+ | **Memory** | Cross-session facts | `memdir/` | Recall |
40
+ | **Skills** | Reusable procedures | Plugin/skill system | Task automation |
41
+ | **taste-1** | Learned preferences | `.clew/taste1/` | Adaptive preference optimization |
42
+
43
+ - Rules are explicit user preferences
44
+ - Memory is facts about the user and project
45
+ - Skills are reusable task procedures
46
+ - Taste is learned, weighted preference signals
47
+
48
+ ## Storage Paths
49
+
50
+ | Data | Path |
51
+ |------|------|
52
+ | Project profile | `.clew/taste1/profile.json` |
53
+ | Project event log | `.clew/taste1/events.jsonl` |
54
+ | Project packages | `.clew/taste1/packages/` |
55
+ | Global profile | `~/.clew/taste1/profile.json` |
56
+ | Global packages | `~/.clew/taste1/packages/` |
57
+
58
+ ## Commands
59
+
60
+ | Command | Description |
61
+ |---------|-------------|
62
+ | `/taste1` | Show status panel |
63
+ | `/taste1 status` | Print status |
64
+ | `/taste1 learn <rule>` | Add a manual rule |
65
+ | `/taste1 forget <id>` | Remove a rule by ID |
66
+ | `/taste1 profile` | Show full profile with rules |
67
+ | `/taste1 events` | Show recent learning events |
68
+ | `/taste1 decay` | Apply confidence decay |
69
+ | `/taste1 eval` | Run profile self-evaluation |
70
+ | `/taste1 export` | Export high-confidence rules |
71
+ | `/taste1 import <file>` | Import rules from file |
72
+ | `/taste1 on` | Enable taste-1 |
73
+ | `/taste1 off` | Disable taste-1 |
74
+
75
+ ## Configuration
76
+
77
+ Settings in `settings.json`:
78
+
79
+ ```json
80
+ {
81
+ "taste1": {
82
+ "enabled": true,
83
+ "autoLearn": true,
84
+ "injectPrompts": true,
85
+ "validateEdits": true,
86
+ "minConfidence": 0.55,
87
+ "maxInjectedRules": 8,
88
+ "decayEnabled": true,
89
+ "banditEnabled": true,
90
+ "neuralScoringEnabled": true
91
+ }
92
+ }
93
+ ```
94
+
95
+ ## Architecture
96
+
97
+ Clew taste-1 consists of several subsystems:
98
+
99
+ 1. **Signal Collection** — Captures accept, reject, edit, test, lint, and tool signals from
100
+ user interactions and converts them into learning events.
101
+
102
+ 2. **Reward Model** — Maps signal types to numeric reward values (accept = +1.0, reject = -1.0,
103
+ test pass = +0.4, etc.) and computes edit distance rewards dynamically.
104
+
105
+ 3. **Symbolic Engine** — Compiles high-confidence rules into checkable constraints.
106
+ Rules with confidence >= 0.85 can block edit acceptance. Rules below
107
+ threshold warn without blocking. Never blocks silently.
108
+
109
+ 4. **Neural Scorer** — Provider-agnostic lexical similarity scoring (Jaccard/TF-IDF)
110
+ that scores candidate output against active rules. Extensible to use
111
+ embedding APIs when available.
112
+
113
+ 5. **Contextual Bandit** — Epsilon-greedy bandit with 6 strategy arms (minimal,
114
+ strict_style, architecture_first, test_first, safety_first, refactor_heavy).
115
+ Selects optimal strategy based on feedback and context features.
116
+
117
+ 6. **Prompt Injection** — Injects a compact `<clew_taste1>` block into the system
118
+ prompt with relevant rules. Max 8 rules by default, filtered by confidence
119
+ and sorted by relevance.
120
+
121
+ 7. **Decay Engine** — Gradual confidence reduction for unused rules (half-life
122
+ based, default 30 days). Prevents stale preferences from persisting.
123
+
124
+ 8. **Event Log** — Append-only JSONL file storing all raw learning events for
125
+ auditability and regression analysis.
126
+
127
+ ## Continuous RL (Local Online Preference Optimization)
128
+
129
+ Clew taste-1 implements **local online preference optimization**:
130
+
131
+ - **Online**: learns continuously from each interaction, no batch training
132
+ - **Local**: all computation and storage stays on the user's machine
133
+ - **Preference-based**: optimizes for user preferences via reward signals
134
+ - **Multi-objective**: balances style, correctness, safety, and efficiency
135
+
136
+ The learning loop:
137
+
138
+ 1. User interacts with ClewCode (accepts, rejects, edits output)
139
+ 2. Signal collector captures the interaction as a typed event with reward
140
+ 3. Bandit arm updates based on reward signal
141
+ 4. Rule confidence adjusts based on positive/negative evidence
142
+ 5. Prompt injection adapts to reflect current learned preferences
143
+ 6. Decay gradually reduces stale rule confidence
144
+
145
+ This is **not** LLM fine-tuning. The base model's weights never change.
146
+ taste-1 adapts the prompt context and edit validation, not the model itself.
147
+
148
+ ## Privacy
149
+
150
+ - All taste data stays local by default
151
+ - Profiles and event logs are stored in `.clew/taste1/` or `~/.clew/taste1/`
152
+ - No data is sent to remote services
153
+ - Export/import is explicit and user-initiated
154
+ - Event logs are append-only for auditability
155
+
156
+ ## Integration Points
157
+
158
+ | Point | Status | Description |
159
+ |-------|--------|-------------|
160
+ | Prompt injection | Implemented | System prompt taste block via `TastePromptInjector` |
161
+ | Edit validation | No-op stub | Ready for `PreAcceptEdit` hook wiring |
162
+ | Accept/reject signals | No-op stub | Ready for tool approval flow wiring |
163
+ | Test/lint signals | No-op stub | Ready for `PostToolUse` output analysis |
164
+ | Tool result signals | No-op stub | Ready for `PostToolUse` hook wiring |
165
+ | Settings config | Implemented | `taste1.*` in `settings.json` |
166
+
167
+ ## Example Usage
168
+
169
+ ```
170
+ /taste1 learn Use const instead of let
171
+ /taste1 learn Prefer named exports
172
+ /taste1 learn Never use any type
173
+ /taste1 status
174
+ /taste1 profile
175
+ /taste1 eval
176
+ /taste1 export
177
+ ```
@@ -0,0 +1,168 @@
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>Tools — Clew</title>
7
+ <meta name="description" content="Complete reference for built-in tools in Clew — file operations, shell, search, agents, MCP, and automation.">
8
+ <link rel="preconnect" href="https://fonts.googleapis.com">
9
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
+ <link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
11
+ <link rel="stylesheet" href="css/styles.css">
12
+ </head>
13
+ <body>
14
+ <header class="header"><div class="header-inner"><a href="index.html" class="logo"><span>Clew</span></a><nav class="header-nav"><a href="index.html">Home</a><a href="index.html#features">Features</a><a href="index.html#commands">Commands</a><a href="quick-start.html" class="active">Docs</a><a href="https://github.com/JonusNattapong/ClewCode" target="_blank">GitHub</a></nav><button class="menu-btn" id="menuToggle" aria-label="Toggle navigation"><span></span><span></span><span></span></button></div></header>
15
+ <div class="app"><aside class="sidebar" id="sidebar"></aside><div class="sidebar-overlay" id="sidebarOverlay"></div>
16
+ <div class="content-wrap"><main class="content">
17
+ <div class="breadcrumbs"><a href="index.html">Home</a><span class="sep">/</span><span>Tools</span></div>
18
+ <h1>Tools</h1>
19
+ <p class="section-subtitle">Clew provides 50+ built-in tools plus dynamically loaded MCP tools. Tools are invoked by the AI model via <code>tool_use</code> blocks and executed through the <strong>StreamingToolExecutor</strong> with permission gating.</p>
20
+
21
+ <h2>How Tools Work</h2>
22
+ <p>Tools are defined with Zod schemas in <code>src/Tool.ts</code> via the <code>buildTool()</code> helper and registered in <code>src/tools.ts</code>. Each tool declares its input schema, output schema, concurrency safety, read-only status, and permission requirements.</p>
23
+
24
+ <pre><code>Model emits tool_use
25
+ Tool call normalization (toolCallParser.ts)
26
+ Permission check (permissions.ts)
27
+ PreToolUse hooks (plugins)
28
+ Tool execution (StreamingToolExecutor)
29
+ PostToolUse hooks (plugins)
30
+ Result returned as tool_result
31
+ Query loop continues</code></pre>
32
+
33
+ <h2>File &amp; Code Operations</h2>
34
+ <table>
35
+ <tr><th>Tool</th><th>Description</th><th>Schemas</th></tr>
36
+ <tr><td><code>Read</code> (FileReadTool)</td><td>Read files with line numbers, supports images, PDFs, Jupyter notebooks</td><td>Zod</td></tr>
37
+ <tr><td><code>Write</code> (FileWriteTool)</td><td>Create new files with full content</td><td>Zod</td></tr>
38
+ <tr><td><code>Edit</code> (FileEditTool)</td><td>Exact string replacement edits (surgical, diff-based)</td><td>Zod</td></tr>
39
+ <tr><td><code>Glob</code> (GlobTool)</td><td>Fast file pattern matching, sorted by modification time</td><td>Zod</td></tr>
40
+ <tr><td><code>Grep</code> (GrepTool)</td><td>Regex content search with context lines and multiline support</td><td>Zod</td></tr>
41
+ <tr><td><code>NotebookEdit</code> (NotebookEditTool)</td><td>Edit Jupyter notebook cells (replace, insert, delete)</td><td>Zod</td></tr>
42
+ <tr><td><code>JsonPath</code> (JsonPathTool)</td><td>Query, validate, format, and transform JSON data</td><td>Zod</td></tr>
43
+ </table>
44
+
45
+ <h2>Shell &amp; System</h2>
46
+ <table>
47
+ <tr><th>Tool</th><th>Description</th></tr>
48
+ <tr><td><code>Bash</code> (BashTool)</td><td>Execute shell commands with timeout, background, sandbox support, and permission gating</td></tr>
49
+ <tr><td><code>PowerShell</code> (PowerShellTool)</td><td>PowerShell execution on Windows (feature-gated)</td></tr>
50
+ <tr><td><code>Monitor</code> (MonitorTool)</td><td>Stream stdout/stderr from background tasks in real-time</td></tr>
51
+ <tr><td><code>TaskOutput</code> (TaskOutputTool)</td><td>Get output from running or completed tasks</td></tr>
52
+ <tr><td><code>TaskStop</code> (TaskStopTool)</td><td>Stop running background tasks</td></tr>
53
+ </table>
54
+
55
+ <h2>Search &amp; Web</h2>
56
+ <table>
57
+ <tr><th>Tool</th><th>Description</th></tr>
58
+ <tr><td><code>WebSearch</code> (WebSearchTool)</td><td>Multi-provider web search (Tavily, Brave, Serper, SearXNG, DuckDuckGo)</td></tr>
59
+ <tr><td><code>WebFetch</code> (WebFetchTool)</td><td>Fetch and analyze content from specific URLs</td></tr>
60
+ <tr><td><code>SessionSearch</code> (SessionSearchTool)</td><td>Full-text search across past session transcripts</td></tr>
61
+ <tr><td><code>CodeIndex</code> (CodeIndexTool)</td><td>Fuzzy code search across indexed codebase (feature-gated: CODE_INDEX)</td></tr>
62
+ <tr><td><code>ToolSearch</code> (ToolSearchTool)</td><td>Keyword search for deferred/lazy-loaded tools</td></tr>
63
+ </table>
64
+
65
+ <h2>Browser &amp; Automation</h2>
66
+ <table>
67
+ <tr><th>Tool</th><th>Description</th></tr>
68
+ <tr><td><code>Browser</code> (BrowserTool)</td><td>Stealth Playwright browser — navigate, click, type, screenshot, extract, fill forms</td></tr>
69
+ <tr><td><code>ComputerUse</code> (ComputerUseTool)</td><td>Windows-only computer use automation (feature-gated: ENABLE_COMPUTER_USE)</td></tr>
70
+ </table>
71
+
72
+ <h2>Agent &amp; Task Management</h2>
73
+ <table>
74
+ <tr><th>Tool</th><th>Description</th></tr>
75
+ <tr><td><code>Skill</code> (SkillTool)</td><td>Invoke skills and prompt-type commands by name</td></tr>
76
+ <tr><td><code>AskUserQuestion</code> (AskUserQuestionTool)</td><td>Ask the user interactive questions during execution</td></tr>
77
+ <tr><td><code>SendMessage</code> (SendMessageTool)</td><td>Send messages between agents in coordinator mode</td></tr>
78
+ <tr><td><code>EnterPlanMode</code> (EnterPlanModeTool)</td><td>Enter structured plan mode for complex tasks</td></tr>
79
+ <tr><td><code>ExitPlanMode</code> (ExitPlanModeV2Tool)</td><td>Exit plan mode and proceed with implementation</td></tr>
80
+ <tr><td><code>EnterWorktree / ExitWorktree</code></td><td>Create/exit isolated git worktrees (feature-gated)</td></tr>
81
+ <tr><td><code>TaskCreate / TaskGet / TaskUpdate / TaskList</code></td><td>Structured task tracking (V2 todo system)</td></tr>
82
+ <tr><td><code>TodoWrite</code> (TodoWriteTool)</td><td>Write todo items for task tracking</td></tr>
83
+ <tr><td><code>Config</code> (ConfigTool)</td><td>Configuration management (ant-only)</td></tr>
84
+ <tr><td><code>Brief</code> (BriefTool)</td><td>Generate brief summaries</td></tr>
85
+ </table>
86
+
87
+ <h2>Scheduled Tasks</h2>
88
+ <p>Scheduled tasks can be created from the interactive <code>/task</code> form. The form collects a name, project, schedule type, prompt, and storage mode, then creates the matching cron task through the same scheduling runtime used by <code>CronCreate</code>, <code>CronList</code>, and <code>CronDelete</code>.</p>
89
+
90
+ <table>
91
+ <tr><th>User action</th><th>Behavior</th></tr>
92
+ <tr><td><code>/task</code></td><td>Open the interactive scheduled task form</td></tr>
93
+ <tr><td>Select <code>Daily</code> around <code>09:00</code></td><td>Create a recurring daily task</td></tr>
94
+ <tr><td>Select <code>Weekdays</code> around <code>09:00</code></td><td>Create a weekday cron such as <code>0 9 * * 1-5</code></td></tr>
95
+ <tr><td>Select <code>In N minutes</code> with <code>10</code></td><td>Create a one-shot reminder</td></tr>
96
+ <tr><td>Select <code>Custom cron</code></td><td>Use a standard 5-field cron expression</td></tr>
97
+ <tr><td><code>/task scheduled</code></td><td>Open the same form explicitly</td></tr>
98
+ </table>
99
+
100
+ <ul>
101
+ <li><strong>Durable</strong> storage persists tasks to <code>.claude/scheduled_tasks.json</code> across sessions.</li>
102
+ <li><strong>Session-only</strong> storage keeps tasks in memory for the current session only.</li>
103
+ <li>Recurring tasks auto-expire after 30 days unless they are system-created permanent tasks.</li>
104
+ <li>One-shot tasks auto-delete after firing.</li>
105
+ <li>Natural language scheduling can still use the model-facing cron tools directly.</li>
106
+ </ul>
107
+
108
+ <pre><code>/task
109
+ Name: Server status
110
+ Schedule: Daily
111
+ Time: 20:00
112
+ Prompt: Check the server status
113
+ Storage: Durable</code></pre>
114
+
115
+ <h2>MCP (Model Context Protocol)</h2>
116
+ <table>
117
+ <tr><th>Tool</th><th>Description</th></tr>
118
+ <tr><td><code>ListMcpResources</code> (ListMcpResourcesTool)</td><td>List available resources from connected MCP servers</td></tr>
119
+ <tr><td><code>ReadMcpResource</code> (ReadMcpResourceTool)</td><td>Read resources exposed by MCP servers</td></tr>
120
+ <tr><td>MCP-provided tools</td><td>Dynamically loaded tools from MCP servers (filesystem, database, APIs)</td></tr>
121
+ </table>
122
+
123
+ <h2>Feature-Gated Tools</h2>
124
+ <table>
125
+ <tr><th>Tool</th><th>Flag</th><th>Description</th></tr>
126
+ <tr><td><code>LSP</code> (LSPTool)</td><td><code>ENABLE_LSP_TOOL=1</code></td><td>Language Server Protocol integration</td></tr>
127
+ <tr><td><code>ComputerUse</code></td><td><code>ENABLE_COMPUTER_USE=1</code> (Win)</td><td>Windows GUI automation</td></tr>
128
+ <tr><td><code>CodeIndex</code></td><td><code>CODE_INDEX</code> feature</td><td>Fuzzy code search</td></tr>
129
+ <tr><td><code>EnterWorktree / ExitWorktree</code></td><td>Worktree mode</td><td>Git worktree isolation</td></tr>
130
+ <tr><td><code>TeamCreate / TeamDelete / RequestShutdown</code></td><td>Agent swarms</td><td>Multi-agent team management</td></tr>
131
+ <tr><td><code>SubscribePrActivity / UnsubscribePrActivity</code></td><td>Agent swarms</td><td>PR activity monitoring</td></tr>
132
+ <tr><td><code>CronCreate / CronDelete / CronList</code></td><td><code>AGENT_TRIGGERS</code></td><td>Scheduled task triggers</td></tr>
133
+ <tr><td><code>PushNotification</code></td><td><code>KAIROS</code></td><td>Push notification support</td></tr>
134
+ </table>
135
+
136
+ <h2>Tool Safety &amp; Permissions</h2>
137
+ <p>Each tool declares:</p>
138
+ <ul>
139
+ <li><strong>isEnabled()</strong> — Whether the tool is available in the current build</li>
140
+ <li><strong>isConcurrencySafe()</strong> — Can run in parallel with other tools</li>
141
+ <li><strong>isReadOnly()</strong> — Does not modify filesystem</li>
142
+ <li><strong>isDestructive()</strong> — Performs irreversible operations</li>
143
+ <li><strong>checkPermissions()</strong> — Tool-specific permission logic</li>
144
+ <li><strong>validateInput()</strong> — Input validation before execution</li>
145
+ <li><strong>maxResultSizeChars</strong> — Max result size before disk persistence</li>
146
+ </ul>
147
+
148
+ <p>MCP tools from external servers are merged into the tool pool at runtime via <code>assembleToolPool()</code>. Tools are filtered by deny rules from the permission context.</p>
149
+
150
+ <div class="callout callout-info">
151
+ <strong>CLAUDE_CODE_SIMPLE mode</strong>
152
+ Setting <code>CLAUDE_CODE_SIMPLE=1</code> or using <code>--bare</code> limits tools to a minimal set: <code>Bash</code>, <code>Read</code>, <code>Edit</code>.
153
+ </div>
154
+
155
+ <footer class="footer">
156
+ <span>Clew v0.1.2 — Open Source</span>
157
+ <div class="footer-links">
158
+ <a href="https://github.com/JonusNattapong/ClewCode">GitHub</a>
159
+ <a href="https://github.com/JonusNattapong/ClewCode/issues">Issues</a>
160
+ </div>
161
+ </footer>
162
+ </main>
163
+ <nav class="toc-sidebar"></nav>
164
+ </div>
165
+ </div>
166
+ <script src="js/main.js"></script>
167
+ </body>
168
+ </html>
@@ -0,0 +1,104 @@
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>Troubleshooting — Clew</title>
7
+ <meta name="description" content="Common issues and solutions for Clew — provider keys, build errors, MCP, plugins, and runtime problems.">
8
+ <link rel="preconnect" href="https://fonts.googleapis.com">
9
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
+ <link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
11
+ <link rel="stylesheet" href="css/styles.css">
12
+ </head>
13
+ <body>
14
+ <header class="header"><div class="header-inner"><a href="index.html" class="logo"><span>Clew</span></a><nav class="header-nav"><a href="index.html">Home</a><a href="index.html#features">Features</a><a href="index.html#commands">Commands</a><a href="quick-start.html" class="active">Docs</a><a href="https://github.com/JonusNattapong/ClewCode" target="_blank">GitHub</a></nav><button class="menu-btn" id="menuToggle" aria-label="Toggle navigation"><span></span><span></span><span></span></button></div></header>
15
+ <div class="app"><aside class="sidebar" id="sidebar"></aside><div class="sidebar-overlay" id="sidebarOverlay"></div>
16
+ <div class="content-wrap"><main class="content">
17
+ <div class="breadcrumbs"><a href="index.html">Home</a><span class="sep">/</span><span>Troubleshooting</span></div>
18
+ <h1>Troubleshooting</h1>
19
+ <p class="section-subtitle">Start with <code>/doctor</code> — it checks runtime version, provider credentials, config integrity, plugin/MCP status, and Sentry telemetry.</p>
20
+
21
+ <h2>Startup Issues</h2>
22
+ <h3>"command not found: clew"</h3>
23
+ <p>npm global install path may not be in <code>PATH</code>. Use <code>npx clew-code</code> or <code>bun x clew-code</code> as alternatives.</p>
24
+
25
+ <h3>"Bun not found"</h3>
26
+ <p>Clew requires <a href="https://bun.sh">Bun 1.3+</a> as the runtime for the npm package.</p>
27
+
28
+ <h2>Provider Issues</h2>
29
+
30
+ <h3>"No API key configured"</h3>
31
+ <p>Set at least one provider API key as an environment variable. See <a href="providers.html">Providers</a> for the full list.</p>
32
+ <pre><code>export ANTHROPIC_API_KEY=sk-ant-...
33
+ export DEEPSEEK_API_KEY=sk-...</code></pre>
34
+ <p>Run <code>/doctor</code> to verify configured providers.</p>
35
+
36
+ <h3>"Rate limited" or "Quota exceeded"</h3>
37
+ <p>Set a fallback model via CLI: <code>--fallback-model &lt;model&gt;</code>. Or use <code>/model</code> to switch to a different provider. For rate limit options during a session, use <code>/rate-limit-options</code>.</p>
38
+
39
+ <h2>Build Issues</h2>
40
+
41
+ <h3>TypeScript errors during build</h3>
42
+ <pre><code>bun run build
43
+ # TypeScript errors may exist in uncommitted code or external modules.
44
+ # Run targeted checks:
45
+ bun x tsc --noEmit
46
+ bun test <targeted-path></code></pre>
47
+
48
+ <h3>Windows-specific issues</h3>
49
+ <ul>
50
+ <li>ripgrep is bundled at <code>src/utils/vendor/ripgrep/x64-win32/rg.exe</code></li>
51
+ <li>TTY polyfill may be needed for Ink compatibility</li>
52
+ <li>PowerShell and Bash may behave differently for tool execution</li>
53
+ <li>Windows argv normalization in <code>src/entry.ts</code></li>
54
+ </ul>
55
+
56
+ <h2>MCP Issues</h2>
57
+
58
+ <h3>"MCP server connection failed"</h3>
59
+ <p>Verify the server command exists and paths are correct. Check JSON config syntax with <code>/mcp</code> command.</p>
60
+
61
+ <h3>MCP tools not appearing</h3>
62
+ <p>Use <code>/mcp</code> to check server status. Tools are loaded at startup via <code>--mcp-config</code> or through <code>assembleToolPool()</code> during server connection. Verify the server implements <code>tools/list</code> correctly.</p>
63
+
64
+ <h2>Plugin Issues</h2>
65
+
66
+ <h3>Plugin not loading</h3>
67
+ <p>Check plugin manifest format and location. Use <code>/plugin</code> and <code>/reload-plugins</code> to refresh. For directory-based plugins, use <code>--plugin-dir &lt;path&gt;</code>.</p>
68
+
69
+ <h2>Feature Flags</h2>
70
+ <p>Some features require compile-time or runtime flags:</p>
71
+ <table>
72
+ <tr><th>Feature</th><th>Required Flag</th></tr>
73
+ <tr><td>Bridge mode</td><td><code>BRIDGE_MODE=1</code></td></tr>
74
+ <tr><td>Voice mode</td><td><code>VOICE_MODE=1</code></td></tr>
75
+ <tr><td>LSP tool</td><td><code>ENABLE_LSP_TOOL=1</code></td></tr>
76
+ <tr><td>Computer Use</td><td><code>ENABLE_COMPUTER_USE=1</code> (Windows)</td></tr>
77
+ <tr><td>Proactive features</td><td><code>KAIROS=1</code></td></tr>
78
+ <tr><td>Agent triggers</td><td><code>AGENT_TRIGGERS=1</code></td></tr>
79
+ <tr><td>Code index</td><td><code>CODE_INDEX=1</code></td></tr>
80
+ </table>
81
+
82
+ <h2>Getting Help</h2>
83
+ <ul>
84
+ <li><strong>In-app diagnostics:</strong> <code>/doctor</code> — comprehensive environment check</li>
85
+ <li><strong>Status overview:</strong> <code>/status</code> — version, model, API connectivity, tool statuses</li>
86
+ <li><strong>GitHub Issues:</strong> Report bugs and feature requests</li>
87
+ <li><strong>Debug mode:</strong> Run with <code>DEBUG=1</code> or <code>DEBUG=provider:anthropic</code> for detailed logging</li>
88
+ </ul>
89
+
90
+ <footer class="footer">
91
+ <span>Clew v0.1.2 — Open Source</span>
92
+ <div class="footer-links">
93
+ <a href="https://github.com/JonusNattapong/ClewCode">GitHub</a>
94
+ <a href="https://github.com/JonusNattapong/ClewCode/issues">Issues</a>
95
+ <a href="https://npmjs.com/package/clew-code">npm</a>
96
+ </div>
97
+ </footer>
98
+ </main>
99
+ <nav class="toc-sidebar"></nav>
100
+ </div>
101
+ </div>
102
+ <script src="js/main.js"></script>
103
+ </body>
104
+ </html>