clew-code 0.2.21 → 0.2.23

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 (67) hide show
  1. package/README.md +45 -45
  2. package/dist/main.js +2906 -2722
  3. package/docs/architecture.html +91 -148
  4. package/docs/assets/clew-agent-loop.png +0 -0
  5. package/docs/assets/clew-general-architecture.png +0 -0
  6. package/docs/assets/clew-mcp-architecture.png +0 -0
  7. package/docs/assets/clew-p2p-swarm.png +0 -0
  8. package/docs/changelog.html +150 -0
  9. package/docs/cli-reference.html +90 -0
  10. package/docs/commands.html +133 -241
  11. package/docs/configuration.html +85 -147
  12. package/docs/contributing.html +91 -0
  13. package/docs/css/styles.css +272 -152
  14. package/docs/daemon.html +62 -129
  15. package/docs/features/bridge-mode.html +61 -66
  16. package/docs/features/evals.html +57 -149
  17. package/docs/features/searxng-search.html +58 -118
  18. package/docs/features/sentry-setup.html +61 -124
  19. package/docs/index.html +185 -148
  20. package/docs/installation.html +77 -105
  21. package/docs/internals/growthbook-ab-testing.html +69 -91
  22. package/docs/internals/hidden-features.html +81 -143
  23. package/docs/js/main.js +29 -0
  24. package/docs/loop.html +69 -181
  25. package/docs/mcp.html +99 -247
  26. package/docs/models.html +63 -92
  27. package/docs/permission-model.html +86 -102
  28. package/docs/plugins.html +84 -102
  29. package/docs/providers.html +87 -127
  30. package/docs/quick-start.html +81 -93
  31. package/docs/research-memory.html +71 -102
  32. package/docs/security.html +71 -0
  33. package/docs/skills.html +67 -117
  34. package/docs/swarm.html +78 -236
  35. package/docs/tools.html +183 -171
  36. package/docs/troubleshooting.html +86 -106
  37. package/docs/voice-mode.html +79 -0
  38. package/package.json +1 -1
  39. package/docs/architecture.th.html +0 -79
  40. package/docs/clew-code-architecture.html +0 -1126
  41. package/docs/commands.th.html +0 -269
  42. package/docs/configuration.th.html +0 -108
  43. package/docs/daemon.th.html +0 -73
  44. package/docs/features/bridge-mode.th.html +0 -62
  45. package/docs/features/evals.th.html +0 -62
  46. package/docs/features/searxng-search.th.html +0 -67
  47. package/docs/features/sentry-setup.th.html +0 -69
  48. package/docs/features/swarm.html +0 -156
  49. package/docs/generated/providers.html +0 -625
  50. package/docs/generated/tools.html +0 -558
  51. package/docs/index.th.html +0 -292
  52. package/docs/installation.th.html +0 -105
  53. package/docs/internals/growthbook-ab-testing.th.html +0 -60
  54. package/docs/internals/hidden-features.th.html +0 -107
  55. package/docs/loop.th.html +0 -227
  56. package/docs/mcp.th.html +0 -207
  57. package/docs/models.th.html +0 -61
  58. package/docs/permission-model.th.html +0 -67
  59. package/docs/plugins.th.html +0 -79
  60. package/docs/prompts-and-features.html +0 -806
  61. package/docs/providers.th.html +0 -81
  62. package/docs/quick-start.th.html +0 -89
  63. package/docs/research-memory.th.html +0 -72
  64. package/docs/skills.th.html +0 -90
  65. package/docs/swarm.th.html +0 -280
  66. package/docs/tools.th.html +0 -84
  67. package/docs/troubleshooting.th.html +0 -85
package/docs/models.html CHANGED
@@ -1,110 +1,81 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Models — Clew</title>
7
- <meta name="description" content="Model selection guide for Clew — how to pick, switch, and manage models across 29 providers.">
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
- <link rel="icon" type="image/svg+xml" href="./assets/clew.svg">
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Models — Clew Code</title>
7
+ <meta name="description" href="Model configuration and selection in Clew Code.">
8
+ <link rel="icon" type="image/svg+xml" href="assets/clew.svg">
9
+ <link rel="preconnect" href="https://fonts.googleapis.com">
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">
13
12
  </head>
14
13
  <body>
15
14
  <header class="header"></header>
16
- <div class="app"><aside class="sidebar" id="sidebar"></aside><div class="sidebar-overlay" id="sidebarOverlay"></div>
17
- <div class="content-wrap"><main class="content">
18
- <div class="breadcrumbs"><a href="index.html">Home</a><span class="sep">/</span><span>Models</span></div>
19
- <h1>Models</h1>
20
- <p class="section-subtitle">Clew supports 100+ models across 29 providers. Pick the right model for each task — from frontier reasoning to fast local inference.</p>
15
+ <div id="sidebarOverlay" class="sidebar-overlay"></div>
16
+ <aside id="sidebar" class="sidebar"></aside>
21
17
 
22
- <h2>Model Selection Guide</h2>
23
- <table>
24
- <tr><th>Workload</th><th>Recommended Models</th><th>Context</th><th>Notes</th></tr>
25
- <tr><td>Complex architecture &amp; large edits</td><td>claude-opus-4-7, claude-sonnet-4-6, gpt-5.5, deepseek-v4-pro</td><td>1M tokens</td><td>Best tool calling, strong reasoning, largest context</td></tr>
26
- <tr><td>Code review &amp; debugging</td><td>claude-sonnet-4-6, gpt-5.5, gemini-3.1-pro-preview</td><td>1M-2M tokens</td><td>Good instruction following, reliable output</td></tr>
27
- <tr><td>Quick search &amp; summarization</td><td>claude-haiku-4-5, deepseek-v4-flash, mistral-small-4, groq/llama-3.3-70b</td><td>128K-200K</td><td>Fast, cost-effective, lower latency</td></tr>
28
- <tr><td>Offline / air-gapped</td><td>ollama/llama4:70b, ollama/llama3.3</td><td>131K tokens</td><td>Fully local, no network needed</td></tr>
29
- <tr><td>Cost-sensitive bulk</td><td>kilocode/kilo-auto/free, opencode-go/minimax-m2.7, groq/llama-3.1-8b</td><td>Varies</td><td>Free or minimal cost tiers available</td></tr>
30
- <tr><td>Research &amp; reasoning</td><td>claude-opus-4-7, deepseek-v4-pro, gemini-3.1-pro-preview</td><td>1M-2M tokens</td><td>Deep reasoning, chain-of-thought</td></tr>
31
- <tr><td>Vision / multimodal</td><td>claude-sonnet-4-6, gpt-5.5, gemini-3.1-pro-preview, deepseek-v4-flash</td><td>1M tokens</td><td>Image understanding, document analysis</td></tr>
32
- </table>
18
+ <div class="content-wrap">
19
+ <div class="content">
33
20
 
34
- <h2>Notable Models by Provider</h2>
35
- <table>
36
- <tr><th>Provider</th><th>Models Available</th></tr>
37
- <tr><td>Anthropic</td><td>claude-opus-4-7 (1M ctx), claude-sonnet-4-6 (1M ctx, recommended), claude-haiku-4-5 (200K ctx, fast)</td></tr>
38
- <tr><td>OpenAI</td><td>gpt-5.5 (1M ctx), gpt-5.4 (1M ctx), gpt-5.4-mini (fast)</td></tr>
39
- <tr><td>Google</td><td>gemini-3.1-pro-preview (2M ctx), gemini-3.1-flash-lite (1M ctx, fast)</td></tr>
40
- <tr><td>DeepSeek</td><td>deepseek-v4-pro (1M ctx, MoE), deepseek-v4-flash (1M ctx, fast MoE)</td></tr>
41
- <tr><td>xAI</td><td>grok-4.3 (128K ctx)</td></tr>
42
- <tr><td>Mistral</td><td>mistral-medium-3.5, mistral-small-4, mistral-large-3</td></tr>
43
- <tr><td>Groq</td><td>llama-3.3-70b, llama-3.1-8b-instant (fast)</td></tr>
44
- <tr><td>Ollama</td><td>llama4:70b (local), llama3.3 (local), qwen3.6-plus (local)</td></tr>
45
- <tr><td>OpenCode</td><td>claude-opus-4-7, claude-sonnet-4-6, gpt-5.5, gemini-3.1-pro, kimi-k2.6</td></tr>
46
- <tr><td>KiloCode</td><td>kilo-auto/free, kilo-auto/balanced, kilo-auto/frontier</td></tr>
47
- <tr><td>Cohere</td><td>command-a-plus (128K ctx)</td></tr>
48
- <tr><td>Perplexity</td><td>sonar-pro, sonar, sonar-reasoning-pro</td></tr>
49
- <tr><td>Together AI</td><td>deepseek-v4, Qwen3.6, Llama-4</td></tr>
50
- <tr><td>NVIDIA NIM</td><td>deepseek-v4-pro, glm-5.1, nemotron-3</td></tr>
51
- <tr><td>Cerebras</td><td>qwen-3-235b (extremely fast)</td></tr>
52
- <tr><td>Moonshot (Kimi)</td><td>kimi-k2.6 (128K ctx)</td></tr>
53
- <tr><td>Zhipu (GLM)</td><td>glm-4.7 (128K ctx)</td></tr>
54
- <tr><td>Hugging Face</td><td>llama-3.3-70b-instruct</td></tr>
55
- <tr><td>Poe</td><td>claude-3-7-sonnet</td></tr>
56
- </table>
21
+ <div class="breadcrumbs"><a href="index.html">Home</a><span class="sep">/</span><span class="current">Models</span></div>
57
22
 
58
- <h2>Model Switching</h2>
59
- <pre><code>/model # Interactive picker (fetches live models from provider API when supported)
60
- /model list # List all available models from the active provider API
61
- /model claude-sonnet-4-7 # Switch by full ID
62
- /model sonnet # Alias-based switching
63
- --model opus # CLI flag at startup</code></pre>
64
- <p>For providers with a /v1/models endpoint (OpenAI, DeepSeek, NVIDIA, etc.), the picker fetches live models from the API instead of the static providers.json list.
65
- The picker shows <strong>all models from every provider</strong> in named sections — not just the active provider's models. Recent models appear at top with the active provider's default. Select any model from any provider directly.</p>
66
- <p>Model switching is instant — the next conversation turn uses the new model. Previous context is preserved.</p>
23
+ <h1>Models</h1>
24
+ <p class="sub">Select and configure AI models from any supported provider. Switch mid-session without restarting.</p>
67
25
 
68
- <h2>Model Aliases</h2>
69
- <p>Short aliases are resolved to full model IDs: <code>sonnet</code>, <code>opus</code>, <code>haiku</code>, <code>gpt5</code>, <code>flash</code>, etc.</p>
26
+ <h2 id="switching">Switching Models</h2>
27
+ <p>Use the <code>/model</code> command in the REPL:</p>
28
+ <pre><code class="language-bash">❯ /model # interactive provider/model picker
29
+ ❯ /model openai # switch to OpenAI provider
30
+ ❯ /model gpt-5.5 # set specific model
31
+ ❯ /model list # list available models from all providers
32
+ </code></pre>
70
33
 
71
- <h2>CLI Flags for Models</h2>
72
- <table>
73
- <tr><th>Flag</th><th>Description</th></tr>
74
- <tr><td><code>--model &lt;name&gt;</code></td><td>Set model at startup (e.g., <code>--model sonnet</code> or <code>--model claude-opus-4-7</code>)</td></tr>
75
- <tr><td><code>--effort &lt;level&gt;</code></td><td>Set reasoning effort: <code>low</code>, <code>medium</code>, <code>high</code>, <code>max</code></td></tr>
76
- <tr><td><code>--max-turns &lt;N&gt;</code></td><td>Limit agentic turns in non-interactive mode</td></tr>
77
- <tr><td><code>--thinking &lt;mode&gt;</code></td><td>Thinking mode: <code>enabled</code>, <code>adaptive</code>, <code>disabled</code></td></tr>
78
- <tr><td><code>--fallback-model &lt;model&gt;</code></td><td>Fallback when primary model is overloaded (print mode only)</td></tr>
79
- <tr><td><code>--task-budget &lt;tokens&gt;</code></td><td>API-side task budget in tokens</td></tr>
80
- <tr><td><code>--max-budget-usd &lt;amount&gt;</code></td><td>Maximum spend on API calls (print mode only)</td></tr>
81
- </table>
34
+ <h2 id="capabilities">Capability Tags</h2>
35
+ <p>The <code>/model list</code> command fetches live model lists from provider APIs and displays capability tags:</p>
36
+ <pre><code>deepseek-v4-flash [200K ctx, tools, reason, free]
37
+ gpt-5.5 [128K ctx, vision, tools]
38
+ claude-sonnet-5 [200K ctx, vision, tools, reason]
39
+ gemini-2.0-flash [1M ctx, vision, tools, free]
40
+ </code></pre>
41
+ <p>Tags include context window size, vision support, tool calling, reasoning, and free tier availability.</p>
82
42
 
83
- <h2>Model Capabilities</h2>
84
- <p>Each model declaration in <code>providers.json</code> includes:</p>
85
- <ul>
86
- <li>Model ID and display label</li>
87
- <li>Context window (<code>maxContext</code>) and max output tokens (<code>maxOutput</code>)</li>
88
- <li>Tool calling type (<code>native</code>, <code>none</code>)</li>
89
- <li>Vision support</li>
90
- <li>Streaming mode (<code>full</code>, <code>partial</code>)</li>
91
- <li>Reasoning support</li>
92
- <li>System prompt support</li>
93
- <li>Tags (for filtering): <code>fast</code>, <code>verified</code>, <code>recommended</code>, <code>latest</code>, <code>free</code>, <code>vision</code>, <code>tools</code>, <code>native</code>, <code>moe</code>, <code>local</code></li>
94
- </ul>
43
+ <h2 id="reasoning">Reasoning Effort</h2>
44
+ <p>For models that support configurable reasoning (DeepSeek, NVIDIA, OpenRouter, etc.):</p>
45
+ <pre><code class="language-bash">❯ /effort low
46
+ /effort medium
47
+ /effort high
48
+ </code></pre>
95
49
 
96
- <footer class="footer">
97
- <span>Clew 0.2.14 Open Source</span>
98
- <div class="footer-links">
99
- <a href="https://github.com/ClewCode/ClewCode">GitHub</a>
100
- <a href="https://github.com/ClewCode/ClewCode/issues">Issues</a>
101
- </div>
102
- </footer>
103
- </main>
104
- <nav class="toc-sidebar"></nav>
50
+ <h2 id="local">Local Models (Ollama)</h2>
51
+ <p>Run models locally with Ollama:</p>
52
+ <pre><code class="language-bash">❯ /model ollama/llama3.3
53
+ /model ollama/mistral
54
+ /model ollama/codellama
55
+ </code></pre>
56
+ <p>Set the Ollama host:</p>
57
+ <pre><code class="language-bash">export OLLAMA_HOST=http://localhost:11434
58
+ </code></pre>
59
+
60
+ <h2 id="image-gen">Image Generation Models</h2>
61
+ <p><code>GenerateImage</code> auto-discovers image-capable models from provider APIs on first use:</p>
62
+ <table>
63
+ <thead><tr><th>Provider</th><th>Models Discovered</th><th>API Key</th></tr></thead>
64
+ <tbody>
65
+ <tr><td>OpenAI</td><td><code>dall-e-3</code>, future DALL-E versions</td><td><code>OPENAI_API_KEY</code></td></tr>
66
+ <tr><td>OpenRouter</td><td><code>gemini-3.1-flash-image-preview</code>, <code>flux.2-pro</code>, <code>recraft-v3</code>, etc.</td><td><code>OPENROUTER_API_KEY</code></td></tr>
67
+ <tr><td>Google</td><td><code>imagen-3.0-generate-002</code>, future Imagen versions</td><td><code>GOOGLE_API_KEY</code></td></tr>
68
+ </tbody>
69
+ </table>
70
+ <p>To override auto-discovery, add <code>"capabilities": { "imageGen": { "defaultModel": "...", "apiType": "..." } }</code> to the provider in <code>providers.json</code>.</p>
71
+
72
+ <h2 id="provider-defaults">Provider Defaults</h2>
73
+ <p>Each provider has a default model. The first time you switch to a provider, its default model is selected automatically. Override with:</p>
74
+ <pre><code class="language-bash">❯ /model deepseek-v4-flash
75
+ </code></pre>
105
76
  </div>
106
77
  </div>
78
+
107
79
  <script src="js/main.js"></script>
108
80
  </body>
109
81
  </html>
110
-
@@ -1,102 +1,86 @@
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>Permission Model — Clew</title>
7
- <meta name="description" content="Tool execution permissions in Clew — modes, rules, and security.">
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
- <link rel="icon" type="image/svg+xml" href="./assets/clew.svg">
13
- </head>
14
- <body>
15
- <header class="header"></header>
16
- <div class="app"><aside class="sidebar" id="sidebar"></aside><div class="sidebar-overlay" id="sidebarOverlay"></div>
17
- <div class="content-wrap"><main class="content">
18
- <div class="breadcrumbs"><a href="index.html">Home</a><span class="sep">/</span><span>Permission Model</span></div>
19
- <h1>Permission Model</h1>
20
- <p class="section-subtitle">Clew gates tool execution through a tiered permission system with multiple modes, allow/deny rules, and tool-specific checks.</p>
21
-
22
- <h2>Permission Modes</h2>
23
- <p>Defined in <code>src/types/permissions.ts</code>. Seven user-addressable modes:</p>
24
- <table>
25
- <tr><th>Mode</th><th>Behavior</th></tr>
26
- <tr><td><code>default</code></td><td>Ask before sensitive tool actions (read/write/bash/network). Safe default.</td></tr>
27
- <tr><td><code>ask</code></td><td>Always ask before any tool execution.</td></tr>
28
- <tr><td><code>plan</code></td><td>Prefer planning mode — AI must present a plan before executing tools.</td></tr>
29
- <tr><td><code>auto</code></td><td>Auto-approve low-risk actions using transcript classifier (requires <code>TRANSCRIPT_CLASSIFIER</code> feature). Prompt for risky operations.</td></tr>
30
- <tr><td><code>acceptEdits</code></td><td>Auto-approve file edit operations. Useful for rapid iteration.</td></tr>
31
- <tr><td><code>bypassPermissions</code></td><td>Skip all permission prompts. Use only in trusted sandboxes.</td></tr>
32
- <tr><td><code>dontAsk</code></td><td>Never ask auto-deny anything that would require permission.</td></tr>
33
- </table>
34
-
35
- <h2>Permission Rules</h2>
36
- <p>Granular allow/deny rules control specific tools and their arguments:</p>
37
- <pre><code>/permissions # Open interactive permission rule manager</code></pre>
38
- <p>Rules can target specific tools with pattern matching:</p>
39
- <ul>
40
- <li><code>Bash(git *)</code> — Allow/deny git commands specifically</li>
41
- <li><code>Edit</code> — Allow/deny all file edits</li>
42
- <li><code>Bash(rm *)</code> — Warn/block destructive shell commands</li>
43
- </ul>
44
-
45
- <h2>Rule Sources</h2>
46
- <p>Permission rules come from multiple sources (evaluated in order, with later sources overriding earlier ones):</p>
47
- <ul>
48
- <li><code>userSettings</code> — From user config file</li>
49
- <li><code>projectSettings</code> — From project-level settings</li>
50
- <li><code>localSettings</code> Local overrides</li>
51
- <li><code>flagSettings</code> — From CLI flags (<code>--allowedTools</code>, <code>--disallowedTools</code>)</li>
52
- <li><code>policySettings</code> — Managed/organization policy</li>
53
- </ul>
54
-
55
- <h2>Tool Permission Flow</h2>
56
- <pre><code>1. Tool input validation (validateInput)
57
- 2. Tool-specific checkPermissions()
58
- 3. Deny rule check (permissions.ts getDenyRuleForTool)
59
- 4. Permission mode evaluation (mode-based auto decision)
60
- 5. Plugin hooks (PreToolUse PostToolUse)
61
- 6. Classifier-based auto-approval (auto mode)
62
- 7. User permission dialog (if needed)</code></pre>
63
-
64
- <h2>CLI Flags for Permissions</h2>
65
- <table>
66
- <tr><th>Flag</th><th>Description</th></tr>
67
- <tr><td><code>--permission-mode &lt;mode&gt;</code></td><td>Set session permission mode</td></tr>
68
- <tr><td><code>--dangerously-skip-permissions</code></td><td>Bypass all checks (sandbox only)</td></tr>
69
- <tr><td><code>--allow-dangerously-skip-permissions</code></td><td>Enable bypass as optional mode</td></tr>
70
- <tr><td><code>--allowedTools, --allowed-tools &lt;tools...&gt;</code></td><td>Allowlist specific tools with patterns</td></tr>
71
- <tr><td><code>--disallowedTools, --disallowed-tools &lt;tools...&gt;</td><td>Denylist specific tools with patterns</td></tr>
72
- </table>
73
-
74
- <h2>Security Best Practices</h2>
75
- <ul>
76
- <li><strong>Default mode</strong> for day-to-day development</li>
77
- <li><strong>Plan mode</strong> for production infrastructure or unfamiliar code</li>
78
- <li><strong>Bypass modes</strong> only in disposable worktrees or Docker sandboxes</li>
79
- <li>Use allow/deny rules to permit safe patterns (e.g., <code>Bash(git *)</code>) while blocking dangerous ones</li>
80
- <li>Run <code>/doctor</code> to audit current permission settings</li>
81
- </ul>
82
-
83
- <div class="callout callout-warn">
84
- <strong>Use Caution</strong>
85
- <code>bypassPermissions</code> mode executes all tool actions without prompting. Restrict to trusted, sandboxed environments.
86
- </div>
87
-
88
- <footer class="footer">
89
- <span>Clew Code 0.2.14 — Open Source</span>
90
- <div class="footer-links">
91
- <a href="https://github.com/ClewCode/ClewCode">GitHub</a>
92
- <a href="https://github.com/ClewCode/ClewCode/issues">Issues</a>
93
- </div>
94
- </footer>
95
- </main>
96
- <nav class="toc-sidebar"></nav>
97
- </div>
98
- </div>
99
- <script src="js/main.js"></script>
100
- </body>
101
- </html>
102
-
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>Permission Model — Clew Code</title>
7
+ <meta name="description" href="Permission modes and security model in Clew Code.">
8
+ <link rel="icon" type="image/svg+xml" href="assets/clew.svg">
9
+ <link rel="preconnect" href="https://fonts.googleapis.com">
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"></header>
15
+ <div id="sidebarOverlay" class="sidebar-overlay"></div>
16
+ <aside id="sidebar" class="sidebar"></aside>
17
+
18
+ <div class="content-wrap">
19
+ <div class="content">
20
+
21
+ <div class="breadcrumbs"><a href="index.html">Home</a><span class="sep">/</span><span class="current">Permission Model</span></div>
22
+
23
+ <h1>Permission Model</h1>
24
+ <p class="sub">Clew Code provides 7 permission modes with granular allow/deny rules for safe AI-assisted development.</p>
25
+
26
+ <h2 id="modes">Permission Modes</h2>
27
+ <table>
28
+ <thead>
29
+ <tr><th>Mode</th><th>Description</th></tr>
30
+ </thead>
31
+ <tbody>
32
+ <tr><td><code>default</code></td><td>Ask for every tool execution. Maximum safety.</td></tr>
33
+ <tr><td><code>ask</code></td><td>Prompt for confirmation on each action.</td></tr>
34
+ <tr><td><code>plan</code></td><td>Full-access planning with bypass permissions. Read, write, edit freely during planning.</td></tr>
35
+ <tr><td><code>auto</code></td><td>Auto-approve safe tools (read, grep, glob). Ask for destructive operations.</td></tr>
36
+ <tr><td><code>acceptEdits</code></td><td>Auto-approve file edits within allowed patterns.</td></tr>
37
+ <tr><td><code>bypassPermissions</code></td><td>Full access all tools approved automatically.</td></tr>
38
+ <tr><td><code>dontAsk</code></td><td>Execute everything without prompting. Use with caution.</td></tr>
39
+ </tbody>
40
+ </table>
41
+
42
+ <h2 id="switching">Switching Modes</h2>
43
+ <p>Use the <code>/permissions</code> command in the REPL:</p>
44
+ <pre><code class="language-bash">❯ /permissions plan # enter full-access plan mode
45
+ /permissions auto # auto-approve safe operations
46
+ /permissions default # back to asking for each action
47
+ </code></pre>
48
+
49
+ <h2 id="rules">Allow/Deny Rules</h2>
50
+ <p>Configure granular rules in <code>.clew/settings.json</code>:</p>
51
+ <pre><code class="language-json">{
52
+ "allow": [
53
+ "bash: npm run dev",
54
+ "bash: git status",
55
+ "write: src/**"
56
+ ],
57
+ "deny": [
58
+ "bash: rm -rf",
59
+ "bash: git push --force"
60
+ ]
61
+ }
62
+ </code></pre>
63
+ <p>Rules support glob pattern matching against tool names and arguments.</p>
64
+
65
+ <h2 id="safety">Safety Gates</h2>
66
+ <p>The <code>safetyGate</code> system validates:</p>
67
+ <ul>
68
+ <li>Command paths prevents execution of dangerous commands</li>
69
+ <li>File paths blocks writes outside project boundaries</li>
70
+ <li>Destructive operations requires explicit approval</li>
71
+ <li>Bash output cap 100 MB limit to prevent runaway processes</li>
72
+ </ul>
73
+
74
+ <h2 id="plan-mode">Plan Mode</h2>
75
+ <p>Plan mode is a special full-access mode for architectural work:</p>
76
+ <ul>
77
+ <li>Read, write, and edit files without permission prompts</li>
78
+ <li>Plan files persist to <code>.clew/plans/</code> with progress snapshots</li>
79
+ <li>Exit with <code>ExitPlanMode</code> to present the plan for approval</li>
80
+ </ul>
81
+ </div>
82
+ </div>
83
+
84
+ <script src="js/main.js"></script>
85
+ </body>
86
+ </html>
package/docs/plugins.html CHANGED
@@ -1,102 +1,84 @@
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>Plugins — Clew</title>
7
- <meta name="description" content="Extend Clew with plugins — commands, agents, skills, hooks, MCP servers, and marketplace support.">
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
- <link rel="icon" type="image/svg+xml" href="./assets/clew.svg">
13
- </head>
14
- <body>
15
- <header class="header"></header>
16
- <div class="app"><aside class="sidebar" id="sidebar"></aside><div class="sidebar-overlay" id="sidebarOverlay"></div>
17
- <div class="content-wrap"><main class="content">
18
- <div class="breadcrumbs"><a href="index.html">Home</a><span class="sep">/</span><span>Plugins</span></div>
19
- <h1>Plugins</h1>
20
- <p class="section-subtitle">Plugins extend Clew with custom commands, agents, skills, execution hooks, MCP servers, and LSP integrations. Plugin management is handled by <code>src/services/plugins/</code> and <code>src/utils/plugins/</code>.</p>
21
-
22
- <h2>What Plugins Can Provide</h2>
23
- <table>
24
- <tr><th>Extension</th><th>Description</th></tr>
25
- <tr><td>Slash Commands</td><td>Custom <code>/command</code> implementations registered via plugin manifest</td></tr>
26
- <tr><td>Agents</td><td>Specialized agent configurations with custom prompts and tool access</td></tr>
27
- <tr><td>Skills</td><td>Reusable task instructions from plugin skill directories</td></tr>
28
- <tr><td>Execution Hooks</td><td>Pre/post hooks at tool, bash, prompt, and edit stages</td></tr>
29
- <tr><td>MCP Servers</td><td>Model Context Protocol server definitions bundled with the plugin</td></tr>
30
- <tr><td>LSP Servers</td><td>Language Server Protocol integration</td></tr>
31
- </table>
32
-
33
- <h2>Hook System</h2>
34
- <table>
35
- <tr><th>Hook Point</th><th>When It Fires</th></tr>
36
- <tr><td><code>PreToolUse</code></td><td>Before a tool executes — validation, input modification, logging</td></tr>
37
- <tr><td><code>PostToolUse</code></td><td>After a tool completes — result transformation, audit</td></tr>
38
- <tr><td><code>PreBash</code></td><td>Before shell command execution — sanitization, env injection</td></tr>
39
- <tr><td><code>PostPrompt</code></td><td>After prompt construction — context augmentation</td></tr>
40
- <tr><td><code>PreAcceptEdit</code></td><td>Before accepting an edit validation, policy enforcement</td></tr>
41
- </table>
42
-
43
- <h2>Plugin Management</h2>
44
- <pre><code>/plugin # List installed plugins
45
- /plugin-details # Show detailed plugin information
46
- /reload-plugins # Activate pending plugin changes
47
- clew plugin validate /path # Validate a plugin manifest (CLI)</code></pre>
48
-
49
- <p>Plugins are loaded from these locations:</p>
50
- <ul>
51
- <li><strong>Bundled</strong> Shipped with Clew</li>
52
- <li><strong>User</strong> Installed by the user (via marketplace or manual)</li>
53
- <li><strong>Plugin dir</strong> Custom directories via <code>--plugin-dir &lt;path&gt;</code> (repeatable)</li>
54
- </ul>
55
-
56
- <p>The <code>PluginInstallationManager</code> (<code>src/services/plugins/PluginInstallationManager.ts</code>) handles automatic installation, marketplace reconciliation, and plugin refresh. Use <code>/reload-plugins</code> after installing or updating plugins.</p>
57
-
58
- <h2>Built-in Plugins</h2>
59
- <table>
60
- <tr><th>Plugin</th><th>Description</th></tr>
61
- <tr><td><code>commit-commands</code></td><td>Git workflow — commit, push, PR creation, branch cleanup (<code>clean_gone</code>)</td></tr>
62
- <tr><td><code>commit-push-pr</code></td><td>Commit, push, and open a PR in one step</td></tr>
63
- <tr><td><code>code-review</code></td><td>Automated PR code review</td></tr>
64
- <tr><td><code>feature-dev</code></td><td>Guided feature development with codebase understanding</td></tr>
65
- <tr><td><code>frontend-design</code></td><td>Production-grade UI/UX generation</td></tr>
66
- <tr><td><code>verify</code></td><td>Typecheck, lint, build, and test pipeline</td></tr>
67
- <tr><td><code>precommit</code></td><td>Pre-commit review with full verification</td></tr>
68
- <tr><td><code>commit</code></td><td>Conventional git commit message generation</td></tr>
69
- <tr><td><code>simplify</code></td><td>Code quality and reuse review</td></tr>
70
- <tr><td><code>debug</code></td><td>Debugging assistance and diagnosis</td></tr>
71
- <tr><td><code>web-search</code></td><td>Multi-provider web search</td></tr>
72
- <tr><td><code>scrapling</code></td><td>Web scraping with Scrapling framework</td></tr>
73
- <tr><td><code>skillify</code></td><td>Create reusable skills from workflows</td></tr>
74
- <tr><td><code>remember</code></td><td>Save user preferences</td></tr>
75
- </table>
76
-
77
- <h2>Plugin Structure</h2>
78
- <pre><code>my-plugin/
79
- manifest.json # Plugin metadata and capability declarations
80
- commands/ # Custom slash commands
81
- skills/ # Reusable task instructions
82
- agents/ # Agent configurations
83
- hooks/ # Hook implementations</code></pre>
84
-
85
- <h2>Marketplace</h2>
86
- <p>Plugins can be distributed through marketplaces. The <code>marketplaceManager</code> (<code>src/utils/plugins/marketplaceManager.ts</code>) handles marketplace source discovery, cache management, and plugin installation from remote sources.</p>
87
-
88
- <footer class="footer">
89
- <span>Clew Code 0.2.14 — Open Source</span>
90
- <div class="footer-links">
91
- <a href="https://github.com/ClewCode/ClewCode">GitHub</a>
92
- <a href="https://github.com/ClewCode/ClewCode/issues">Issues</a>
93
- </div>
94
- </footer>
95
- </main>
96
- <nav class="toc-sidebar"></nav>
97
- </div>
98
- </div>
99
- <script src="js/main.js"></script>
100
- </body>
101
- </html>
102
-
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>Plugins — Clew Code</title>
7
+ <meta name="description" href="Plugin system, marketplace, and hooks in Clew Code.">
8
+ <link rel="icon" type="image/svg+xml" href="assets/clew.svg">
9
+ <link rel="preconnect" href="https://fonts.googleapis.com">
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"></header>
15
+ <div id="sidebarOverlay" class="sidebar-overlay"></div>
16
+ <aside id="sidebar" class="sidebar"></aside>
17
+
18
+ <div class="content-wrap">
19
+ <div class="content">
20
+
21
+ <div class="breadcrumbs"><a href="index.html">Home</a><span class="sep">/</span><span class="current">Plugins</span></div>
22
+
23
+ <h1>Plugins</h1>
24
+ <p class="sub">Extend Clew Code without touching source code. Plugins can add tools, hook into lifecycle events, and integrate with external systems.</p>
25
+
26
+ <h2 id="overview">Overview</h2>
27
+ <p>Plugins are self-contained packages with a manifest file that declare hooks, tools, and configurations. They are hot-reloadable — no restart needed.</p>
28
+
29
+ <h2 id="lifecycle">Lifecycle Hooks</h2>
30
+ <p>Plugins can hook into every stage of the agent lifecycle:</p>
31
+ <table>
32
+ <thead>
33
+ <tr><th>Hook</th><th>Trigger</th></tr>
34
+ </thead>
35
+ <tbody>
36
+ <tr><td><code>PreToolUse</code></td><td>Before a tool is executed</td></tr>
37
+ <tr><td><code>PostToolUse</code></td><td>After a tool completes</td></tr>
38
+ <tr><td><code>PreBash</code></td><td>Before a bash command runs</td></tr>
39
+ <tr><td><code>PostPrompt</code></td><td>After a prompt is processed</td></tr>
40
+ <tr><td><code>PreAcceptEdit</code></td><td>Before a file edit is applied</td></tr>
41
+ </tbody>
42
+ </table>
43
+
44
+ <h2 id="commands">Plugin Commands</h2>
45
+ <table>
46
+ <thead>
47
+ <tr><th>Command</th><th>Description</th></tr>
48
+ </thead>
49
+ <tbody>
50
+ <tr><td><code>/plugin install &lt;name&gt;</code></td><td>Install a plugin from the marketplace</td></tr>
51
+ <tr><td><code>/plugin list</code></td><td>List installed plugins</td></tr>
52
+ <tr><td><code>/plugin remove &lt;name&gt;</code></td><td>Remove a plugin</td></tr>
53
+ <tr><td><code>/plugin marketplace</code></td><td>Browse the plugin marketplace</td></tr>
54
+ <tr><td><code>/hooks</code></td><td>View active hooks</td></tr>
55
+ </tbody>
56
+ </table>
57
+
58
+ <h2 id="plugin-manifest">Plugin Manifest</h2>
59
+ <p>Plugins declare themselves via a manifest:</p>
60
+ <pre><code class="language-json">{
61
+ "name": "my-plugin",
62
+ "version": "1.0.0",
63
+ "hooks": {
64
+ "PreToolUse": "./pre-tool.js",
65
+ "PostToolUse": "./post-tool.js"
66
+ },
67
+ "tools": [
68
+ {
69
+ "name": "my_custom_tool",
70
+ "description": "A custom tool",
71
+ "schema": { ... }
72
+ }
73
+ ]
74
+ }
75
+ </code></pre>
76
+
77
+ <h2 id="marketplace">Plugin Marketplace</h2>
78
+ <p>Discover and install community plugins via the built-in marketplace browser. Use <code>/plugin marketplace</code> to explore available plugins.</p>
79
+ </div>
80
+ </div>
81
+
82
+ <script src="js/main.js"></script>
83
+ </body>
84
+ </html>