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,139 @@
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>Autonomous Daemon — Clew</title>
7
+ <meta name="description" content="24/7 autonomous background execution — task queue, agent loop, supervisor integration, and recurring tasks.">
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">
15
+ <div class="header-inner">
16
+ <a href="index.html" class="logo"><span>Clew</span></a>
17
+ <nav class="header-nav">
18
+ <a href="index.html">Home</a>
19
+ <a href="index.html#features">Features</a>
20
+ <a href="index.html#commands">Commands</a>
21
+ <a href="quick-start.html" class="active">Docs</a>
22
+ <a href="https://github.com/JonusNattapong/ClewCode" target="_blank">GitHub</a>
23
+ </nav>
24
+ <button class="menu-btn" id="menuToggle" aria-label="Toggle navigation"><span></span><span></span><span></span></button>
25
+ </div>
26
+ </header>
27
+ <div class="app">
28
+ <aside class="sidebar" id="sidebar"></aside>
29
+ <div class="sidebar-overlay" id="sidebarOverlay"></div>
30
+ <div class="content-wrap">
31
+ <main class="content">
32
+ <div class="breadcrumbs"><a href="index.html">Home</a><span class="sep">/</span><span>Daemon Mode</span></div>
33
+ <h1>Autonomous Daemon Mode</h1>
34
+ <p class="section-subtitle">Run Clew as a 24/7 background daemon — task queue, agent loop, health checks, and supervisor auto-respawn for unattended autonomous operation.</p>
35
+
36
+ <p>The autonomous system lives in <code>src/services/autonomous/</code> and consists of four main components: the <strong>task queue</strong>, <strong>agent loop</strong>, <strong>daemon entry point</strong>, and <strong>supervisor integration</strong>.</p>
37
+
38
+ <h2>Architecture</h2>
39
+ <pre><code> + Task Queue (taskQueue.ts)
40
+ | File-backed persistent queue
41
+ | Priorities Leases Dead-letter
42
+ |
43
+ + Agent Loop (agentLoop.ts)
44
+ | Dequeue Spawn worker Monitor Retry
45
+ |
46
+ + Daemon Mode (daemonMode.ts)
47
+ | Background process entry point
48
+ |
49
+ + Supervisor (supervisorIntegration.ts)
50
+ Health checks Auto-respawn State tracking</code></pre>
51
+
52
+ <h2>Task Queue</h2>
53
+ <p>The file-backed persistent queue (<code>src/services/autonomous/taskQueue.ts</code>) is the foundation of the autonomous system:</p>
54
+ <ul>
55
+ <li><strong>Persistence</strong> — Tasks survive process restarts via on-disk storage</li>
56
+ <li><strong>Priorities</strong> — Urgent tasks skip ahead in the queue</li>
57
+ <li><strong>Leases</strong> — Tasks are leased to workers with TTL; expired leases are retried</li>
58
+ <li><strong>Dead-letter</strong> — Tasks that exhaust retries are moved to dead-letter for inspection</li>
59
+ <li><strong>Scheduling</strong> — One-shot and recurring (cron) tasks supported</li>
60
+ </ul>
61
+
62
+ <h2>Agent Loop</h2>
63
+ <p>The continuous agent loop (<code>src/services/autonomous/agentLoop.ts</code>) runs in the background:</p>
64
+ <ol>
65
+ <li><strong>Dequeue</strong> — Pull the highest-priority ready task</li>
66
+ <li><strong>Spawn worker</strong> — Launch a worker session for the task</li>
67
+ <li><strong>Monitor</strong> — Track progress, streaming output, and resource usage</li>
68
+ <li><strong>Retry or complete</strong> — On failure, retry with backoff; on success, record result</li>
69
+ <li><strong>Repeat</strong> — Check for new tasks and repeat the cycle</li>
70
+ </ol>
71
+
72
+ <h2>Daemon Entry Point</h2>
73
+ <p><code>src/services/autonomous/daemonMode.ts</code> provides the background process entry point. When started in daemon mode, Clew:</p>
74
+ <ul>
75
+ <li>Detaches from the terminal and runs as a background process</li>
76
+ <li>Logs output to a configurable log file</li>
77
+ <li>Responds to signals for graceful shutdown</li>
78
+ <li>Reports status to the supervisor for health tracking</li>
79
+ </ul>
80
+
81
+ <h2>Supervisor Integration</h2>
82
+ <p><code>src/services/autonomous/supervisorIntegration.ts</code> ensures the daemon stays running:</p>
83
+ <ul>
84
+ <li><strong>Health checks</strong> — Periodic heartbeat and resource checks</li>
85
+ <li><strong>Auto-respawn</strong> — Automatic restart on unexpected exit</li>
86
+ <li><strong>State tracking</strong> — Current status, running tasks, error counts</li>
87
+ <li><strong>Graceful degradation</strong> — Reduces polling frequency on repeated failures</li>
88
+ </ul>
89
+
90
+ <h2>Commands</h2>
91
+ <table>
92
+ <tr><th>Command</th><th>Description</th></tr>
93
+ <tr><td><code>/daemon</code></td><td>Open interactive control panel; subcommands: start, stop, status, restart</td></tr>
94
+ <tr><td><code>/task</code></td><td>Create scheduled or recurring tasks via interactive form</td></tr>
95
+ <tr><td><code>/task list</code></td><td>List queued, running, and completed tasks</td></tr>
96
+ <tr><td><code>/loop</code></td><td>Run a prompt or command on a recurring interval (<code>/loop 5m /check-deploy</code>)</td></tr>
97
+ <tr><td><code>/agents</code></td><td>Manage agent configurations and daemon worker pools</td></tr>
98
+ <tr><td><code>/tasks</code></td><td>List and manage background agent tasks</td></tr>
99
+ </table>
100
+
101
+ <h2>Task Scheduling</h2>
102
+ <p>Scheduled tasks can be created through the interactive <code>/task</code> form or programmatically. Storage modes:</p>
103
+ <ul>
104
+ <li><strong>Durable</strong> — Persists to <code>.claude/scheduled_tasks.json</code>, survives restarts</li>
105
+ <li><strong>Session-only</strong> — Kept in memory for the current session only</li>
106
+ </ul>
107
+
108
+ <p>Recurring tasks auto-expire after 30 days. One-shot tasks auto-delete after firing. Custom cron expressions are supported (standard 5-field format).</p>
109
+
110
+ <pre><code>/task
111
+ Name: Deploy health check
112
+ Schedule: Daily
113
+ Time: 09:00
114
+ Prompt: Check deployment status and report
115
+ Storage: Durable</code></pre>
116
+
117
+ <h2>Architecture Files</h2>
118
+ <table>
119
+ <tr><th>File</th><th>Role</th></tr>
120
+ <tr><td><code>src/services/autonomous/taskQueue.ts</code></td><td>Persistent task queue with priorities, leases, dead-letter</td></tr>
121
+ <tr><td><code>src/services/autonomous/agentLoop.ts</code></td><td>Continuous 24/7 agent loop</td></tr>
122
+ <tr><td><code>src/services/autonomous/daemonMode.ts</code></td><td>Background daemon entry point</td></tr>
123
+ <tr><td><code>src/services/autonomous/supervisorIntegration.ts</code></td><td>Health checks, auto-respawn, state tracking</td></tr>
124
+ </table>
125
+
126
+ <footer class="footer">
127
+ <span>Clew v0.1.2 — Open Source</span>
128
+ <div class="footer-links">
129
+ <a href="https://github.com/JonusNattapong/ClewCode">GitHub</a>
130
+ <a href="https://github.com/JonusNattapong/ClewCode/issues">Issues</a>
131
+ </div>
132
+ </footer>
133
+ </main>
134
+ <nav class="toc-sidebar"></nav>
135
+ </div>
136
+ </div>
137
+ <script src="js/main.js"></script>
138
+ </body>
139
+ </html>
@@ -0,0 +1,77 @@
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>Bridge Mode — Remote Control & Collaboration — Clew</title>
7
+ <meta name="description" content="WebSocket remote control and collaboration for Clew.">
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">
15
+ <div class="header-inner">
16
+ <a href="../index.html" class="logo"><span>Clew</span></a>
17
+ <nav class="header-nav">
18
+ <a href="../index.html">Home</a>
19
+ <a href="../index.html#features">Features</a>
20
+ <a href="../index.html#commands">Commands</a>
21
+ <a href="../quick-start.html" class="active">Docs</a>
22
+ <a href="https://github.com/JonusNattapong/ClewCode" target="_blank">GitHub</a>
23
+ </nav>
24
+ <button class="menu-btn" id="menuToggle" aria-label="Toggle navigation"><span></span><span></span><span></span></button>
25
+ </div>
26
+ </header>
27
+ <div class="app">
28
+ <aside class="sidebar" id="sidebar"></aside>
29
+ <div class="sidebar-overlay" id="sidebarOverlay"></div>
30
+ <div class="content-wrap">
31
+ <main class="content">
32
+ <div class="breadcrumbs"><a href="../index.html">Home</a><span class="sep">/</span><a href="../index.html#features">Features</a><span class="sep">/</span><span>Bridge Mode</span></div>
33
+ <h1>Bridge Mode</h1>
34
+ <p class="section-subtitle">Remote Control &amp; Remote Collaboration</p>
35
+
36
+ <div class="callout callout-info">
37
+ <strong>Bridge Mode</strong> exposes a remote control surface over a WebSocket connection. It is designed to be used by a mobile/web app to send commands and receive information from a running Clew session.
38
+ </div>
39
+
40
+ <h2>Architecture</h2>
41
+ <p>Bridge mode creates a WebSocket server that runs alongside the main Clew session. Remote clients connect to this server and can send slash commands, receive responses, and interact with the running session. The bridge also supports session sharing for team collaboration.</p>
42
+
43
+ <h2>Quick Start</h2>
44
+ <pre><code># Enable bridge mode
45
+ export BRIDGE_MODE=1
46
+ claude --bridge
47
+
48
+ # Connect from another terminal
49
+ claude --remote ws://localhost:18790</code></pre>
50
+
51
+ <h2>Features</h2>
52
+ <ul>
53
+ <li><strong>Remote Control</strong> — Send commands from mobile/web/CLI clients</li>
54
+ <li><strong>Session Sharing</strong> — Share your session with team members</li>
55
+ <li><strong>Team Onboarding</strong> — Invite teammates to collaborate</li>
56
+ <li><strong>Secure</strong> — OAuth-based authentication for remote connections</li>
57
+ </ul>
58
+
59
+ <div class="callout callout-warn">
60
+ <strong>Security Note</strong>
61
+ Bridge mode is designed for trusted networks. Use appropriate security measures when exposing the WebSocket server to external networks.
62
+ </div>
63
+
64
+ <footer class="footer">
65
+ <span>Clew v0.1.2</span>
66
+ <div class="footer-links">
67
+ <a href="https://github.com/JonusNattapong/ClewCode">GitHub</a>
68
+ <a href="https://github.com/JonusNattapong/ClewCode/issues">Issues</a>
69
+ </div>
70
+ </footer>
71
+ </main>
72
+ <nav class="toc-sidebar"></nav>
73
+ </div>
74
+ </div>
75
+ <script src="../js/main.js"></script>
76
+ </body>
77
+ </html>
@@ -0,0 +1,160 @@
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>Evaluation Harness — Clew</title>
7
+ <meta name="description" content="Offline-first AI coding agent evaluation and verification framework.">
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">
15
+ <div class="header-inner">
16
+ <a href="../index.html" class="logo"><span>Clew</span></a>
17
+ <nav class="header-nav">
18
+ <a href="../index.html">Home</a>
19
+ <a href="../index.html#features">Features</a>
20
+ <a href="../index.html#commands">Commands</a>
21
+ <a href="../quick-start.html" class="active">Docs</a>
22
+ <a href="https://github.com/JonusNattapong/ClewCode" target="_blank">GitHub</a>
23
+ </nav>
24
+ <button class="menu-btn" id="menuToggle" aria-label="Toggle navigation"><span></span><span></span><span></span></button>
25
+ </div>
26
+ </header>
27
+ <div class="app">
28
+ <aside class="sidebar" id="sidebar"></aside>
29
+ <div class="sidebar-overlay" id="sidebarOverlay"></div>
30
+ <div class="content-wrap">
31
+ <main class="content">
32
+ <div class="breadcrumbs"><a href="../index.html">Home</a><span class="sep">/</span><a href="../index.html#features">Features</a><span class="sep">/</span><span>Evaluation Harness</span></div>
33
+ <h1>Evaluation Harness</h1>
34
+ <p class="section-subtitle">Offline-first AI coding agent evaluation and verification framework</p>
35
+
36
+ <div class="callout callout-tip">
37
+ <strong>TL;DR</strong>
38
+ Run <code>clew eval init</code> to bootstrap the evaluation folders inside your project,
39
+ then execute <code>clew eval run</code> to run standard coding or research benchmarks locally.
40
+ </div>
41
+
42
+ <h2>Overview</h2>
43
+ <p>Clew includes a localized, <strong>offline-first evaluation harness</strong> under the <code>/eval</code> command namespace. This allows developers to systematically grade agent output quality, detect trace trajectory regressions, control boundary escapes, and compare model versions using deterministic rules.</p>
44
+
45
+ <h2>Workspace Directory Layout</h2>
46
+ <p>When you run <code>clew eval init</code>, it configures the following structures inside <code>.claude/evals/</code>:</p>
47
+ <table>
48
+ <tr><th>Folder</th><th>Description</th></tr>
49
+ <tr><td><code>.claude/evals/tasks/</code></td><td>YAML task definitions (grouped by categories like <code>coding/</code>, <code>research/</code>, <code>memory/</code>, <code>security/</code>)</td></tr>
50
+ <tr><td><code>.claude/evals/graders/</code></td><td>YAML grader rules and configurations (Command, Trace, Artifact, and Rule graders)</td></tr>
51
+ <tr><td><code>.claude/evals/runs/</code></td><td>Outcome results, captured events logs, and workspace diffs per run</td></tr>
52
+ <tr><td><code>.claude/evals/baselines/</code></td><td>Saved scoring baselines (e.g. main branch benchmark records)</td></tr>
53
+ <tr><td><code>.claude/evals/reports/</code></td><td>Final generated markdown and JSON evaluation reports</td></tr>
54
+ </table>
55
+
56
+ <h2>Subcommand CLI Usage</h2>
57
+ <h3>1. Initialize Workspace</h3>
58
+ <pre><code>claude eval init</code></pre>
59
+
60
+ <h3>2. Run Evaluations</h3>
61
+ <pre><code># Run all loaded tasks
62
+ claude eval run
63
+ # Run only tasks in the "coding" category
64
+ claude eval run --set coding
65
+ # Run a specific task by ID
66
+ claude eval run --task coding.sample-task
67
+ # Run evaluations and compare against a baseline
68
+ claude eval run --baseline main</code></pre>
69
+
70
+ <h3>3. Drift &amp; Regression Comparison</h3>
71
+ <pre><code>claude eval compare --baseline main</code></pre>
72
+
73
+ <h3>4. Step Trace Trajectory</h3>
74
+ <pre><code>claude eval trace coding.sample-task</code></pre>
75
+
76
+ <h3>5. Diagnostics (Doctor)</h3>
77
+ <pre><code>claude eval doctor</code></pre>
78
+
79
+ <h2>Writing Tasks &amp; Graders</h2>
80
+ <h3>Eval Task YAML Schema</h3>
81
+ <pre><code>id: coding.fix-provider-routing
82
+ title: Fix provider routing fallback behavior
83
+ category: coding
84
+ input: |
85
+ Fix the provider routing fallback so unsupported providers return a clear error.
86
+ workspace_fixture: fixtures/provider-routing
87
+ expected:
88
+ files_changed:
89
+ - src/providers/router.ts
90
+ commands_run:
91
+ - bun test src/providers
92
+ graders:
93
+ - test-pass
94
+ - scope-control
95
+ - evidence-before-patch
96
+ budgets:
97
+ max_steps: 12
98
+ max_tool_calls: 6</code></pre>
99
+
100
+ <h3>Grader Types</h3>
101
+ <h4>Command Grader</h4>
102
+ <pre><code>id: test-pass
103
+ type: command
104
+ commands:
105
+ - bun test
106
+ pass_when:
107
+ exit_code: 0</code></pre>
108
+
109
+ <h4>Trace Grader</h4>
110
+ <pre><code>id: evidence-before-patch
111
+ type: trace
112
+ rules:
113
+ - before: repo.patch
114
+ require_any:
115
+ - repo.search
116
+ - repo.open
117
+ fail_message: Agent patched files before reading evidence.</code></pre>
118
+
119
+ <h4>Artifact Grader</h4>
120
+ <pre><code>id: scope-control
121
+ type: artifact
122
+ checks:
123
+ max_changed_files: 5
124
+ changed_files:
125
+ allow:
126
+ - src/providers/**
127
+ - tests/providers/**
128
+ deny:
129
+ - package-lock.json</code></pre>
130
+
131
+ <h4>Rule Grader</h4>
132
+ <pre><code>id: output-format
133
+ type: rule
134
+ must_include:
135
+ - "## Summary"
136
+ must_not_include:
137
+ - "I could not view"</code></pre>
138
+
139
+ <h2>Critical Failure Policies</h2>
140
+ <p>Clew immediately scores a task as <strong>0.0 (Failed)</strong> if any of these boundaries are breached:</p>
141
+ <ol>
142
+ <li><strong>Secret Leakage</strong> — Sensitive tokens (e.g. API keys, secrets) detected in agent output</li>
143
+ <li><strong>Workspace Escape</strong> — Agent attempts to write or edit files outside workspace boundaries</li>
144
+ <li><strong>Forbidden Commands</strong> — Destructive actions (e.g., <code>rm -rf</code>) without explicit permission</li>
145
+ </ol>
146
+
147
+ <footer class="footer">
148
+ <span>Clew v0.1.2</span>
149
+ <div class="footer-links">
150
+ <a href="https://github.com/JonusNattapong/ClewCode">GitHub</a>
151
+ <a href="https://github.com/JonusNattapong/ClewCode/issues">Issues</a>
152
+ </div>
153
+ </footer>
154
+ </main>
155
+ <nav class="toc-sidebar"></nav>
156
+ </div>
157
+ </div>
158
+ <script src="../js/main.js"></script>
159
+ </body>
160
+ </html>
@@ -0,0 +1,129 @@
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>SearXNG Search — Clew</title>
7
+ <meta name="description" content="Self-hosted privacy-respecting web search via Docker SearXNG.">
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">
15
+ <div class="header-inner">
16
+ <a href="../index.html" class="logo"><span>Clew</span></a>
17
+ <nav class="header-nav">
18
+ <a href="../index.html">Home</a>
19
+ <a href="../index.html#features">Features</a>
20
+ <a href="../index.html#commands">Commands</a>
21
+ <a href="../quick-start.html" class="active">Docs</a>
22
+ <a href="https://github.com/JonusNattapong/ClewCode" target="_blank">GitHub</a>
23
+ </nav>
24
+ <button class="menu-btn" id="menuToggle" aria-label="Toggle navigation"><span></span><span></span><span></span></button>
25
+ </div>
26
+ </header>
27
+ <div class="app">
28
+ <aside class="sidebar" id="sidebar"></aside>
29
+ <div class="sidebar-overlay" id="sidebarOverlay"></div>
30
+ <div class="content-wrap">
31
+ <main class="content">
32
+ <div class="breadcrumbs"><a href="../index.html">Home</a><span class="sep">/</span><a href="../index.html#features">Features</a><span class="sep">/</span><span>SearXNG Search</span></div>
33
+ <h1>SearXNG Search</h1>
34
+ <p class="section-subtitle">Self-hosted, privacy-respecting web search via Docker</p>
35
+
36
+ <div class="callout callout-tip">
37
+ <strong>TL;DR</strong>
38
+ Run <code>cd searxng && start.bat</code> to start the search engine, then use <code>/searxng on</code> from the CLI.
39
+ </div>
40
+
41
+ <h2>Overview</h2>
42
+ <p>SearXNG is a free, privacy-respecting metasearch engine. This project provides a Docker-based setup so you can run your own instance locally, avoiding reliance on public instances (which increasingly return 403/429 due to Cloudflare/anti-bot protection).</p>
43
+
44
+ <h2>Quick Start</h2>
45
+ <pre><code>cd searxng
46
+ start.bat</code></pre>
47
+ <p>Starts SearXNG on <a href="http://localhost:18889">http://localhost:18889</a>.</p>
48
+
49
+ <h3>Slash Command</h3>
50
+ <table>
51
+ <tr><th>Command</th><th>Action</th></tr>
52
+ <tr><td><code>/searxng on</code></td><td>Start the Docker container</td></tr>
53
+ <tr><td><code>/searxng off</code></td><td>Stop the Docker container</td></tr>
54
+ <tr><td><code>/searxng status</code></td><td>Check if running</td></tr>
55
+ <tr><td><code>/searxng restart</code></td><td>Restart the container</td></tr>
56
+ </table>
57
+
58
+ <h3>Manual Docker Commands</h3>
59
+ <pre><code>docker compose -f searxng/docker-compose.yml up -d
60
+ docker compose -f searxng/docker-compose.yml down
61
+ docker compose -f searxng/docker-compose.yml logs -f</code></pre>
62
+
63
+ <h2>Files</h2>
64
+ <table>
65
+ <tr><th>File</th><th>Purpose</th></tr>
66
+ <tr><td><code>searxng/docker-compose.yml</code></td><td>Container definition, port 188899 8080</td></tr>
67
+ <tr><td><code>searxng/.env</code></td><td>Host, port, and secret key</td></tr>
68
+ <tr><td><code>searxng/config/settings.yml</code></td><td>SearXNG configuration with JSON API enabled</td></tr>
69
+ <tr><td><code>searxng/limiter.toml</code></td><td>Rate limiter — relaxed for local network IPs</td></tr>
70
+ <tr><td><code>searxng/start.bat</code></td><td>Start wrapper</td></tr>
71
+ <tr><td><code>searxng/stop.bat</code></td><td>Stop wrapper</td></tr>
72
+ <tr><td><code>searxng/restart.bat</code></td><td>Restart wrapper</td></tr>
73
+ <tr><td><code>searxng/logs.bat</code></td><td>Log tail wrapper</td></tr>
74
+ </table>
75
+
76
+ <h2>How It Works</h2>
77
+ <ol>
78
+ <li>SearXNG runs in Docker on <code>localhost:18889</code></li>
79
+ <li>The project's <code>.env</code> sets <code>SEARXNG_INSTANCE_URL=http://localhost:18889</code></li>
80
+ <li><code>selectBestDirectProvider()</code> in <code>WebSearchTool.ts</code> auto-detects this and prioritises SearXNG</li>
81
+ <li>The <code>SearXNGProvider</code> sends GET requests with <code>format=json</code> and parses results</li>
82
+ </ol>
83
+
84
+ <h2>Engines Enabled</h2>
85
+ <ul>
86
+ <li><strong>DuckDuckGo</strong> — primary general search (no API key needed)</li>
87
+ <li><strong>Google</strong> — general search</li>
88
+ <li><strong>Wikipedia</strong> — infobox and article results</li>
89
+ <li><strong>StackOverflow</strong> — technical Q&amp;A</li>
90
+ <li><strong>GitHub</strong> — repository search</li>
91
+ <li><strong>Wikidata</strong> — structured data infoboxes</li>
92
+ </ul>
93
+
94
+ <h2>Provider Selection Priority</h2>
95
+ <ol>
96
+ <li><strong>Tavily</strong> — requires <code>TAVILY_API_KEY</code></li>
97
+ <li><strong>Brave</strong> — requires <code>BRAVE_API_KEY</code></li>
98
+ <li><strong>Serper</strong> — requires <code>SERPER_API_KEY</code></li>
99
+ <li><strong>SearXNG</strong> — only if <code>SEARXNG_INSTANCE_URL</code> is explicitly set</li>
100
+ <li><strong>DuckDuckGo</strong> — always available, free, no API key</li>
101
+ </ol>
102
+
103
+ <h2>Troubleshooting</h2>
104
+ <h3>Container won't start</h3>
105
+ <pre><code>docker compose -f searxng/docker-compose.yml logs</code></pre>
106
+ <h3>No results returned</h3>
107
+ <p>Check that engines are not failing by visiting <a href="http://localhost:18889">http://localhost:18889</a> and performing a search in the web UI.</p>
108
+ <h3>Port conflict</h3>
109
+ <p>Change <code>SEARXNG_PORT</code> in <code>searxng/.env</code> and update <code>SEARXNG_INSTANCE_URL</code> in <code>.env</code> to match.</p>
110
+
111
+ <h2>Updating</h2>
112
+ <pre><code>cd searxng
113
+ docker compose pull
114
+ docker compose up -d</code></pre>
115
+
116
+ <footer class="footer">
117
+ <span>Clew v0.1.2</span>
118
+ <div class="footer-links">
119
+ <a href="https://github.com/JonusNattapong/ClewCode">GitHub</a>
120
+ <a href="https://github.com/JonusNattapong/ClewCode/issues">Issues</a>
121
+ </div>
122
+ </footer>
123
+ </main>
124
+ <nav class="toc-sidebar"></nav>
125
+ </div>
126
+ </div>
127
+ <script src="../js/main.js"></script>
128
+ </body>
129
+ </html>