clew-code 0.2.7 → 0.2.9
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.
- package/README.md +292 -299
- package/dist/main.js +2745 -2869
- package/docs/architecture.html +148 -145
- package/docs/architecture.th.html +79 -78
- package/docs/clew-code-architecture.html +1125 -0
- package/docs/commands.html +224 -223
- package/docs/commands.th.html +131 -130
- package/docs/configuration.html +147 -145
- package/docs/configuration.th.html +108 -106
- package/docs/css/styles.css +48 -42
- package/docs/daemon.html +129 -128
- package/docs/daemon.th.html +73 -72
- package/docs/features/bridge-mode.html +99 -98
- package/docs/features/bridge-mode.th.html +90 -89
- package/docs/features/evals.html +182 -181
- package/docs/features/evals.th.html +90 -89
- package/docs/features/peer.html +178 -177
- package/docs/features/searxng-search.html +151 -150
- package/docs/features/searxng-search.th.html +95 -94
- package/docs/features/sentry-setup.html +157 -156
- package/docs/features/sentry-setup.th.html +97 -96
- package/docs/index.html +299 -298
- package/docs/index.th.html +292 -290
- package/docs/installation.html +105 -103
- package/docs/installation.th.html +105 -103
- package/docs/internals/growthbook-ab-testing.html +113 -112
- package/docs/internals/growthbook-ab-testing.th.html +81 -80
- package/docs/internals/hidden-features.html +149 -147
- package/docs/internals/hidden-features.th.html +109 -107
- package/docs/js/main.js +83 -3
- package/docs/loop.html +181 -180
- package/docs/loop.th.html +227 -226
- package/docs/mcp.html +247 -246
- package/docs/mcp.th.html +207 -206
- package/docs/models.html +111 -110
- package/docs/models.th.html +61 -60
- package/docs/peer.html +236 -235
- package/docs/peer.th.html +280 -279
- package/docs/permission-model.html +102 -101
- package/docs/permission-model.th.html +67 -66
- package/docs/plugins.html +102 -101
- package/docs/plugins.th.html +79 -78
- package/docs/providers.html +126 -117
- package/docs/providers.th.html +80 -78
- package/docs/quick-start.html +93 -92
- package/docs/quick-start.th.html +40 -39
- package/docs/research-memory.html +82 -79
- package/docs/research-memory.th.html +72 -71
- package/docs/skills.html +117 -116
- package/docs/skills.th.html +90 -89
- package/docs/tools.html +170 -169
- package/docs/tools.th.html +84 -83
- package/docs/troubleshooting.html +106 -105
- package/docs/troubleshooting.th.html +85 -84
- package/package.json +164 -162
- package/docs/taste.html +0 -436
- package/docs/taste.th.html +0 -236
package/docs/taste.th.html
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="th">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>Taste — Clew Code</title>
|
|
7
|
-
<meta name="description" content="ระบบเรียนรู้ preference แบบ local-first สำหรับ Clew Code — accept/reject signals, symbolic rules, bandit optimization">
|
|
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&family=Noto+Sans+Thai: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">
|
|
17
|
-
<aside class="sidebar" id="sidebar"></aside>
|
|
18
|
-
<div class="sidebar-overlay" id="sidebarOverlay"></div>
|
|
19
|
-
<div class="content-wrap">
|
|
20
|
-
<main class="content">
|
|
21
|
-
<div class="breadcrumbs"><a href="index.th.html">หน้าแรก</a><span class="sep">/</span><span>Taste</span></div>
|
|
22
|
-
<h1>Taste</h1>
|
|
23
|
-
<p class="section-subtitle">ระบบเรียนรู้ preference แบบ local-first — จากสัญญาณ accept/reject/edit/lint/test สู่กฎที่ปรับแต่งได้</p>
|
|
24
|
-
|
|
25
|
-
<p>Taste เรียนรู้สไตล์โค้ดของคุณจากสัญญาณ accept, reject, edit, test, lint และกฎที่ผู้ใช้กำหนด มันรวมกฎสัญลักษณ์, การให้คะแนน preference เชิงความหมาย, และ contextual bandit optimization เพื่อปรับให้ Clew ตอบสนองตรงตามความต้องการของคุณ</p>
|
|
26
|
-
|
|
27
|
-
<p>มัน<strong>ไม่ได้</strong> fine-tune LLM — การเรียนรู้ทั้งหมดเป็น local, online, และ preference-based</p>
|
|
28
|
-
|
|
29
|
-
<h2>เทคนิคและหลักการ</h2>
|
|
30
|
-
|
|
31
|
-
<h3>เหตุใดต้องใช้ Preference Learning แทนที่จะใช้ Prompt เพียงอย่างเดียว?</h3>
|
|
32
|
-
<p>CLAUDE.md และ system prompt กำหนดกฎแบบ static — ใช้ได้ดีสำหรับกฎที่คุณรู้ล่วงหน้า แต่<strong>ไม่สามารถปรับตัวตาม feedback จริง</strong>ได้:</p>
|
|
33
|
-
<ul>
|
|
34
|
-
<li><strong>คุณไม่รู้ทุกกฎล่วงหน้า</strong> — บางทีคุณอาจไม่รู้ด้วยซ้ำว่าตัวเองชอบ pattern แบบไหนจนกว่าจะเห็นผลลัพธ์</li>
|
|
35
|
-
<li><strong>กฎเปลี่ยนตามโปรเจค</strong> — React project กับ Python library มีสไตล์ต่างกันโดยสิ้นเชิง</li>
|
|
36
|
-
<li><strong>มนุษย์สื่อสาร preference ได้ไม่สมบูรณ์</strong> — "เขียนโค้ดให้ดี" ไม่ใช่ instruction ที่ชัดเจนพอสำหรับ LLM</li>
|
|
37
|
-
</ul>
|
|
38
|
-
<p>Taste เรียนรู้จาก<em>พฤติกรรม</em>ของคุณแทน — ถ้าคุณ accept output ที่ใช้ <code>const</code> แทน <code>let</code> บ่อยๆ มันจะเรียนรู้ ถ้าคุณ reject หรือแก้ไข มันจะลดน้ำหนัก</p>
|
|
39
|
-
|
|
40
|
-
<h3>Online Feedback Loop — ไม่ใช่ Batch Training</h3>
|
|
41
|
-
<p>Taste ใช้<strong>online learning</strong> — เรียนรู้ทันทีจากทุก interaction:</p>
|
|
42
|
-
<pre><code>User interaction ──► Signal collector ──► Reward model (+1.0 / -1.0 / +0.4)
|
|
43
|
-
│
|
|
44
|
-
▼
|
|
45
|
-
Rule confidence update
|
|
46
|
-
│
|
|
47
|
-
┌───────────────┼───────────────┐
|
|
48
|
-
▼ ▼ ▼
|
|
49
|
-
Confidence ↑ Confidence ↓ Decay if unused
|
|
50
|
-
(accept/ (reject/edit) (30 day half-life)
|
|
51
|
-
test pass)</code></pre>
|
|
52
|
-
|
|
53
|
-
<h3>Multi-Signal Reward Model</h3>
|
|
54
|
-
<p>ไม่ใช่แค่ accept/reject — ใช้หลายสัญญาณประกอบกัน:</p>
|
|
55
|
-
<div class="table-wrap">
|
|
56
|
-
<table>
|
|
57
|
-
<tr><th>สัญญาณ</th><th>Reward</th><th>เหตุผล</th></tr>
|
|
58
|
-
<tr><td>Accept</td><td>+1.0</td><td>ผู้ใช้พอใจ — สัญญาณบวกแรงที่สุด</td></tr>
|
|
59
|
-
<tr><td>Reject</td><td>-1.0</td><td>ผู้ใช้ปฏิเสธ — สัญญาณลบแรงที่สุด</td></tr>
|
|
60
|
-
<tr><td>Edit (small)</td><td>-0.3</td><td>แก้ไขเล็กน้อย — เกือบพอใจ</td></tr>
|
|
61
|
-
<tr><td>Edit (large)</td><td>-0.7</td><td>แก้ไขเยอะ — output ห่างจากที่ต้องการ</td></tr>
|
|
62
|
-
<tr><td>Test pass</td><td>+0.4</td><td>โค้ดถูกต้องทางเทคนิค</td></tr>
|
|
63
|
-
<tr><td>Test fail</td><td>-0.6</td><td>โค้ดมี bug</td></tr>
|
|
64
|
-
<tr><td>Lint pass</td><td>+0.2</td><td>ตรงตาม style convention</td></tr>
|
|
65
|
-
<tr><td>Tool result OK</td><td>+0.3</td><td>เลือกใช้ tool ถูกต้อง</td></tr>
|
|
66
|
-
</table>
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
<h3>Contextual Bandit — เลือกกลยุทธ์ตามบริบท</h3>
|
|
70
|
-
<p>ไม่ใช่ทุกงานต้องการสไตล์เดียวกัน — refactor เน้น architecture, bug fix เน้น safety:</p>
|
|
71
|
-
<ul>
|
|
72
|
-
<li><strong>ε-greedy bandit 6 แขน</strong> — minimal, strict_style, architecture_first, test_first, safety_first, refactor_heavy</li>
|
|
73
|
-
<li><strong>Context features</strong> — วิเคราะห์ task context แล้วเลือกแขนที่ให้ reward สูงสุดในอดีต</li>
|
|
74
|
-
<li><strong>Exploration vs exploitation</strong> — ε โอกาสสุ่มลองแขนใหม่ (explore), 1-ε เลือกที่รู้ว่าดี (exploit) — default ε = 0.1</li>
|
|
75
|
-
<li><strong>ทำไมต้อง bandit?</strong> — กฎ "use const" อาจขัดกับ "minimal changes" ในบางบริบท Bandit ช่วย balance หลาย objective</li>
|
|
76
|
-
</ul>
|
|
77
|
-
|
|
78
|
-
<h3>Three-Tier Rule Engine</h3>
|
|
79
|
-
<p>ไม่ใช่ทุกกฎที่สำคัญเท่ากัน — แบ่งเป็น 3 ระดับตาม confidence:</p>
|
|
80
|
-
<ul>
|
|
81
|
-
<li><strong>Tier 1 — Symbolic (≥ 0.85)</strong> — <em>block</em> การแก้ไขที่ไม่ตรง: เช่น "ห้ามใช้ <code>any</code>" → block + แจ้งเหตุผล</li>
|
|
82
|
-
<li><strong>Tier 2 — Prompt Injection (≥ 0.55)</strong> — ใส่ใน system prompt เป็น <code><clew_taste></code> block (max 8 rules)</li>
|
|
83
|
-
<li><strong>Tier 3 — Scored (< 0.55)</strong> — ใช้ neural scorer (Jaccard/TF-IDF) เทียบ relevance แต่ไม่ inject</li>
|
|
84
|
-
</ul>
|
|
85
|
-
|
|
86
|
-
<h3>Auto-Learn — AI วิเคราะห์ Codebase</h3>
|
|
87
|
-
<p><code>TasteCodebaseAnalyzer</code> อ่าน .editorconfig, biome.json, tsconfig.json, สุ่ม 20 source files, git log 50 commits → ส่งให้ fast model วิเคราะห์ → หา patterns → เสนอเป็น suggestion ให้ผู้ใช้ accept/reject</p>
|
|
88
|
-
|
|
89
|
-
<h3>Decay — ป้องกัน Stale Rules</h3>
|
|
90
|
-
<ul>
|
|
91
|
-
<li><strong>Half-life decay</strong> — confidence ลดลงครึ่งทุก 30 วันถ้าไม่ใช้</li>
|
|
92
|
-
<li><strong>Cooldown</strong> — หลัง reject → cooldown 30 นาทีก่อนเสนอใหม่</li>
|
|
93
|
-
<li><strong>ทำไม?</strong> — โปรเจคเปลี่ยน, สไตล์ทีมเปลี่ยน, toolchain upgrade — กฎเก่าอาจไม่เกี่ยวข้องแล้ว</li>
|
|
94
|
-
</ul>
|
|
95
|
-
|
|
96
|
-
<h3>Privacy-First</h3>
|
|
97
|
-
<p>ทุกอย่าง local — ไม่ส่งข้อมูลไป cloud, event log เป็น append-only JSONL, export/import เกิดเมื่อผู้ใช้สั่งเท่านั้น</p>
|
|
98
|
-
|
|
99
|
-
<h2>สิ่งที่ระบบเรียนรู้</h2>
|
|
100
|
-
<ul>
|
|
101
|
-
<li><strong>Code style</strong> — formatting, naming conventions, preferred patterns</li>
|
|
102
|
-
<li><strong>Architecture</strong> — module structure, dependency direction, layering</li>
|
|
103
|
-
<li><strong>Tooling</strong> — preferred build tools, linters, test frameworks</li>
|
|
104
|
-
<li><strong>Testing</strong> — test style, coverage expectations, mocking patterns</li>
|
|
105
|
-
<li><strong>Naming</strong> — variable, function, and class naming conventions</li>
|
|
106
|
-
<li><strong>Security</strong> — safe patterns vs unsafe patterns</li>
|
|
107
|
-
<li><strong>Performance</strong> — efficient algorithms, caching, resource management</li>
|
|
108
|
-
<li><strong>UI patterns</strong> — component structure, state management, styling approach</li>
|
|
109
|
-
<li><strong>Workflow</strong> — commit style, review preferences, deployment habits</li>
|
|
110
|
-
</ul>
|
|
111
|
-
|
|
112
|
-
<h2>สิ่งที่ Taste ไม่ทำ</h2>
|
|
113
|
-
<ul>
|
|
114
|
-
<li>ไม่ fine-tune หรือแก้ไข base LLM</li>
|
|
115
|
-
<li>ไม่ส่งข้อมูลไปยัง remote services</li>
|
|
116
|
-
<li>ไม่ block การแก้ไขโดยไม่แสดงเหตุผล</li>
|
|
117
|
-
<li>ไม่แทนที่ memory, skills, หรือ CLAUDE.md</li>
|
|
118
|
-
</ul>
|
|
119
|
-
|
|
120
|
-
<h2>สถาปัตยกรรม</h2>
|
|
121
|
-
<pre><code> ╔══════════════════════════════════════════════════════════════════════════════╗
|
|
122
|
-
║ TASTE — PREFERENCE LEARNING RUNTIME ║
|
|
123
|
-
╚══════════════════════════════════════════════════════════════════════════════╝
|
|
124
|
-
|
|
125
|
-
┌──────────────────────────┐
|
|
126
|
-
│ USER INTERACTION │
|
|
127
|
-
│ accept / reject / edit │
|
|
128
|
-
│ test pass / lint signal │
|
|
129
|
-
└────────────┬─────────────┘
|
|
130
|
-
│
|
|
131
|
-
┌─────────────────────────────┼─────────────────────────────┐
|
|
132
|
-
│ │ │
|
|
133
|
-
▼ ▼ ▼
|
|
134
|
-
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
|
|
135
|
-
│ AcceptReject │ │ DiffSignal │ │EditDistance │
|
|
136
|
-
│ Tracker │ │ Extractor │ │ Reward │
|
|
137
|
-
└───────┬───────┘ └───────┬───────┘ └───────┬───────┘
|
|
138
|
-
│ │ │
|
|
139
|
-
└──────────────────────────┼───────────────────────────┘
|
|
140
|
-
│
|
|
141
|
-
▼
|
|
142
|
-
┌─────────────────────┐
|
|
143
|
-
│ TasteSignalCollector │
|
|
144
|
-
│ (unified event hub) │
|
|
145
|
-
└──────────┬──────────┘
|
|
146
|
-
│
|
|
147
|
-
▼
|
|
148
|
-
┌─────────────────────┐
|
|
149
|
-
│ TasteRewardModel │
|
|
150
|
-
│ signal → reward map │
|
|
151
|
-
└──────────┬──────────┘
|
|
152
|
-
│
|
|
153
|
-
┌───────────────┼───────────────┐
|
|
154
|
-
│ │ │
|
|
155
|
-
▼ ▼ ▼
|
|
156
|
-
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
|
157
|
-
│TasteBandit │ │AutoLearn │ │TasteDecay │
|
|
158
|
-
│ε-greedy (6 │ │Engine │ │confidence ↓ │
|
|
159
|
-
│strategy arms)│ │pattern→rule │ │over time │
|
|
160
|
-
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
|
|
161
|
-
│ │ │
|
|
162
|
-
│ ┌───────────┘ │
|
|
163
|
-
│ │ │
|
|
164
|
-
▼ ▼ │
|
|
165
|
-
┌──────────────────┐ │
|
|
166
|
-
│ TasteRuntime │◄────────────────────┘
|
|
167
|
-
│ (orchestrator) │
|
|
168
|
-
└────────┬─────────┘
|
|
169
|
-
│
|
|
170
|
-
┌─────────────┼─────────────┬──────────────────┐
|
|
171
|
-
│ │ │ │
|
|
172
|
-
▼ ▼ ▼ ▼
|
|
173
|
-
┌─────────┐ ┌──────────┐ ┌──────────────┐ ┌────────────────┐
|
|
174
|
-
│Symbolic │ │Neural │ │PromptInjector│ │ TasteEventLog │
|
|
175
|
-
│Engine │ │Scorer │ │injects │ │ append-only │
|
|
176
|
-
│compile │ │Jaccard/ │ │<clew_taste> │ │ JSONL │
|
|
177
|
-
│rules→ │ │TF-IDF │ │block (max 8 │ │ │
|
|
178
|
-
│check │ │relevance │ │rules) │ │ │
|
|
179
|
-
└────┬────┘ └────┬─────┘ └──────┬───────┘ └────────────────┘
|
|
180
|
-
│ │ │
|
|
181
|
-
▼ │ ▼
|
|
182
|
-
┌─────────┐ │ ┌────────────────┐
|
|
183
|
-
│validate │ │ │ SYSTEM PROMPT │
|
|
184
|
-
│Edit() │ └────►│ (taste block) │
|
|
185
|
-
│block if │ │ │
|
|
186
|
-
│conf ≥ │ │ → AI adapts │
|
|
187
|
-
│0.85 │ │ output style │
|
|
188
|
-
└─────────┘ └────────────────┘
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
═══ CODEBASE AUTO-LEARN ═══
|
|
192
|
-
|
|
193
|
-
Codebase ──► TasteCodebaseAnalyzer ──► PatternDetector ──► AutoLearnEngine
|
|
194
|
-
(อ่าน conventions) (ค้นหา patterns) (สร้าง rules)
|
|
195
|
-
│
|
|
196
|
-
▼
|
|
197
|
-
TasteProfileStore
|
|
198
|
-
.clew/taste/profile.json</code></pre>
|
|
199
|
-
|
|
200
|
-
<h2>คำสั่ง</h2>
|
|
201
|
-
<div class="table-wrap">
|
|
202
|
-
<table>
|
|
203
|
-
<tr><th>คำสั่ง</th><th>คำอธิบาย</th></tr>
|
|
204
|
-
<tr><td><code>/taste</code></td><td>เปิดเมนู interactive</td></tr>
|
|
205
|
-
<tr><td><code>/taste status</code></td><td>แสดงสถานะ</td></tr>
|
|
206
|
-
<tr><td><code>/taste profile</code></td><td>แสดง rules ทั้งหมด</td></tr>
|
|
207
|
-
<tr><td><code>/taste learn <rule></code></td><td>เพิ่ม rule เอง</td></tr>
|
|
208
|
-
<tr><td><code>/taste forget <id></code></td><td>ลบ rule</td></tr>
|
|
209
|
-
<tr><td><code>/taste suggest</code></td><td>ดูข้อเสนอจาก auto-learn</td></tr>
|
|
210
|
-
<tr><td><code>/taste accept <id></code></td><td>ยอมรับ suggestion</td></tr>
|
|
211
|
-
<tr><td><code>/taste reject <id></code></td><td>ปฏิเสธ suggestion</td></tr>
|
|
212
|
-
</table>
|
|
213
|
-
</div>
|
|
214
|
-
|
|
215
|
-
<h2>ความเป็นส่วนตัว</h2>
|
|
216
|
-
<ul>
|
|
217
|
-
<li>ข้อมูล taste ทั้งหมดอยู่ local</li>
|
|
218
|
-
<li>โปรไฟล์และ event log ใน <code>.clew/taste/</code> หรือ <code>~/.clew/taste/</code></li>
|
|
219
|
-
<li>ไม่ส่งข้อมูลไป cloud หรือ training</li>
|
|
220
|
-
<li>Export/import เกิดเมื่อผู้ใช้สั่งเท่านั้น</li>
|
|
221
|
-
</ul>
|
|
222
|
-
|
|
223
|
-
<footer class="footer">
|
|
224
|
-
<span>Clew Code — Open Source</span>
|
|
225
|
-
<div class="footer-links">
|
|
226
|
-
<a href="https://github.com/JonusNattapong/ClewCode">GitHub</a>
|
|
227
|
-
<a href="https://github.com/JonusNattapong/ClewCode/issues">Issues</a>
|
|
228
|
-
</div>
|
|
229
|
-
</footer>
|
|
230
|
-
</main>
|
|
231
|
-
<nav class="toc-sidebar"></nav>
|
|
232
|
-
</div>
|
|
233
|
-
</div>
|
|
234
|
-
<script src="js/main.js"></script>
|
|
235
|
-
</body>
|
|
236
|
-
</html>
|