clew-code 0.2.4 β 0.2.5
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 +264 -292
- package/dist/clew-dev.js +5118 -2840
- package/dist/main.js +2358 -2133
- package/docs/_config.yml +1 -1
- package/docs/architecture.html +145 -166
- package/docs/architecture.th.html +2 -23
- package/docs/commands.html +1 -22
- package/docs/commands.th.html +1 -22
- package/docs/configuration.html +145 -166
- package/docs/configuration.th.html +2 -23
- package/docs/css/styles.css +22 -0
- package/docs/daemon.html +128 -160
- package/docs/daemon.th.html +2 -30
- package/docs/features/bridge-mode.html +98 -98
- package/docs/features/bridge-mode.th.html +1 -1
- package/docs/features/evals.html +181 -181
- package/docs/features/evals.th.html +1 -1
- package/docs/features/searxng-search.html +150 -150
- package/docs/features/searxng-search.th.html +1 -1
- package/docs/features/sentry-setup.html +156 -156
- package/docs/features/sentry-setup.th.html +1 -1
- package/docs/index.html +298 -333
- package/docs/index.th.html +1 -36
- package/docs/installation.html +103 -124
- package/docs/installation.th.html +2 -23
- package/docs/internals/growthbook-ab-testing.html +112 -112
- package/docs/internals/growthbook-ab-testing.th.html +1 -1
- package/docs/internals/hidden-features.html +147 -147
- package/docs/internals/hidden-features.th.html +1 -1
- package/docs/js/main.js +78 -7
- package/docs/loop.html +180 -0
- package/docs/loop.th.html +226 -0
- package/docs/mcp.html +246 -157
- package/docs/mcp.th.html +156 -60
- package/docs/models.html +1 -22
- package/docs/models.th.html +1 -22
- package/docs/peer.html +235 -0
- package/docs/peer.th.html +279 -0
- package/docs/permission-model.html +101 -122
- package/docs/permission-model.th.html +2 -23
- package/docs/plugins.html +101 -122
- package/docs/plugins.th.html +2 -23
- package/docs/providers.html +117 -138
- package/docs/providers.th.html +2 -23
- package/docs/quick-start.html +92 -120
- package/docs/quick-start.th.html +1 -29
- package/docs/research-memory.html +79 -111
- package/docs/research-memory.th.html +2 -30
- package/docs/skills.html +116 -137
- package/docs/skills.th.html +2 -23
- package/docs/taste.html +96 -29
- package/docs/taste.th.html +193 -54
- package/docs/tools.html +169 -190
- package/docs/tools.th.html +2 -23
- package/docs/troubleshooting.html +105 -126
- package/docs/troubleshooting.th.html +2 -23
- package/package.json +2 -2
|
@@ -1,147 +1,147 @@
|
|
|
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>Hidden Features & Internals β Clew</title>
|
|
7
|
-
<meta name="description" content="Feature-gated commands, internal-only tools, and beta flags in 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
|
-
<link rel="icon" type="image/svg+xml" href="../assets/clew.svg">
|
|
13
|
-
</head>
|
|
14
|
-
<body>
|
|
15
|
-
<header class="header">
|
|
16
|
-
<div class="header-inner">
|
|
17
|
-
<a href="../index.html" class="logo">
|
|
18
|
-
<span>Clew Code</span>
|
|
19
|
-
</a>
|
|
20
|
-
<nav class="header-nav">
|
|
21
|
-
<a href="../index.html">Home</a>
|
|
22
|
-
<a href="../index.html#features">Features</a>
|
|
23
|
-
<a href="../index.html#commands">Commands</a>
|
|
24
|
-
<a href="../quick-start.html" class="active">Docs</a>
|
|
25
|
-
<a href="https://github.com/JonusNattapong/ClewCode" target="_blank">GitHub</a>
|
|
26
|
-
<div class="lang-wrap">
|
|
27
|
-
<button class="lang-btn">π</button>
|
|
28
|
-
<div class="lang-menu">
|
|
29
|
-
<a href="../../readme/README.zh.md">δΈζ</a>
|
|
30
|
-
<a href="../../readme/README.th.md">ΰΉΰΈΰΈ’</a>
|
|
31
|
-
<a href="../../readme/README.ja.md">ζ₯ζ¬θͺ</a>
|
|
32
|
-
<a href="../../readme/README.ko.md">νκ΅μ΄</a>
|
|
33
|
-
<a href="../../readme/README.es.md">EspaΓ±ol</a>
|
|
34
|
-
<a href="../../readme/README.fr.md">FranΓ§ais</a>
|
|
35
|
-
<a href="../../readme/README.de.md">Deutsch</a>
|
|
36
|
-
<a href="../../readme/README.pt.md">PortuguΓͺs</a>
|
|
37
|
-
<a href="../../readme/README.vi.md">TiαΊΏng Viα»t</a>
|
|
38
|
-
<a href="../../readme/README.id.md">Bahasa Indonesia</a>
|
|
39
|
-
<a href="../../readme/README.ru.md">Π ΡΡΡΠΊΠΈΠΉ</a>
|
|
40
|
-
<a href="../../readme/README.hi.md">ΰ€Ήΰ€Ώΰ€¨ΰ₯ΰ€¦ΰ₯</a>
|
|
41
|
-
<a href="../../README.md">English</a>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</nav>
|
|
45
|
-
<button class="menu-btn" id="menuToggle" aria-label="Toggle navigation"><span></span><span></span><span></span></button>
|
|
46
|
-
</div>
|
|
47
|
-
</header>
|
|
48
|
-
<div class="app">
|
|
49
|
-
<aside class="sidebar" id="sidebar"></aside>
|
|
50
|
-
<div class="sidebar-overlay" id="sidebarOverlay"></div>
|
|
51
|
-
<div class="content-wrap">
|
|
52
|
-
<main class="content">
|
|
53
|
-
<div class="breadcrumbs"><a href="../index.html">Home</a><span class="sep">/</span><a href="../index.html#features">Internals</a><span class="sep">/</span><span>Hidden Features</span></div>
|
|
54
|
-
<h1>Hidden Features & Internals</h1>
|
|
55
|
-
<p class="section-subtitle">Feature-gated commands, internal-only tools, and beta flags β not visible in the standard help menu.</p>
|
|
56
|
-
|
|
57
|
-
<div class="callout callout-warn">
|
|
58
|
-
<strong>Internal / Beta</strong>
|
|
59
|
-
These features may change without notice. Most require specific environment variables or build-time feature flags.
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
<h2>Feature-Gated Commands</h2>
|
|
63
|
-
<p>From <code>src/commands.ts</code> β enabled via environment variables:</p>
|
|
64
|
-
<table>
|
|
65
|
-
<tr><th>Command</th><th>Env Variable</th><th>Description</th></tr>
|
|
66
|
-
<tr><td><code>/bridge</code></td><td><code>BRIDGE_MODE=1</code></td><td>WebSocket remote control and collaboration</td></tr>
|
|
67
|
-
<tr><td><code>/voice</code></td><td><code>VOICE_MODE=1</code></td><td>Toggle voice mode</td></tr>
|
|
68
|
-
<tr><td><code>/brief</code></td><td><code>KAIROS=1</code></td><td>Brief command for quick context</td></tr>
|
|
69
|
-
<tr><td><code>/assistant</code></td><td><code>KAIROS=1</code></td><td>Assistant mode with proactive behavior</td></tr>
|
|
70
|
-
</table>
|
|
71
|
-
|
|
72
|
-
<h2>Internal-Only Commands</h2>
|
|
73
|
-
<p>Defined in <code>INTERNAL_ONLY_COMMANDS</code> in <code>src/commands.ts</code>:</p>
|
|
74
|
-
<table>
|
|
75
|
-
<tr><th>Command</th><th>Description</th></tr>
|
|
76
|
-
<tr><td><code>/backfill-sessions</code></td><td>Backfill session data</td></tr>
|
|
77
|
-
<tr><td><code>/break-cache</code></td><td>Break internal caches</td></tr>
|
|
78
|
-
<tr><td><code>/bughunter</code></td><td>Automated bug hunting workflow</td></tr>
|
|
79
|
-
<tr><td><code>/commit-push-pr</code></td><td>Commit, push, and PR creation</td></tr>
|
|
80
|
-
<tr><td><code>/ctx-viz</code></td><td>Context visualization</td></tr>
|
|
81
|
-
<tr><td><code>/init-verifiers</code></td><td>Initialize verifiers</td></tr>
|
|
82
|
-
<tr><td><code>/issue</code></td><td>Issue management</td></tr>
|
|
83
|
-
<tr><td><code>/mock-limits</code></td><td>Mock usage limits for testing</td></tr>
|
|
84
|
-
<tr><td><code>/reset-limits</code></td><td>Reset usage limits</td></tr>
|
|
85
|
-
<tr><td><code>/ultraplan</code></td><td>Extended plan mode</td></tr>
|
|
86
|
-
<tr><td><code>/version</code></td><td>Show version</td></tr>
|
|
87
|
-
<tr><td><code>/bridge-kick</code></td><td>Bridge session management</td></tr>
|
|
88
|
-
<tr><td><code>/onboarding</code></td><td>Interactive onboarding wizard</td></tr>
|
|
89
|
-
<tr><td><code>/team-onboarding</code></td><td>Generate teammate ramp-up guide</td></tr>
|
|
90
|
-
<tr><td><code>/share</code></td><td>Share session</td></tr>
|
|
91
|
-
<tr><td><code>/summary</code></td><td>Summarize conversation</td></tr>
|
|
92
|
-
<tr><td><code>/teleport</code></td><td>Teleport session</td></tr>
|
|
93
|
-
<tr><td><code>/ant-trace</code></td><td>Anthropic-internal tracing</td></tr>
|
|
94
|
-
<tr><td><code>/perf-issue</code></td><td>Performance issue reporting</td></tr>
|
|
95
|
-
<tr><td><code>/env</code></td><td>Environment inspection</td></tr>
|
|
96
|
-
<tr><td><code>/oauth-refresh</code></td><td>OAuth token refresh</td></tr>
|
|
97
|
-
<tr><td><code>/debug-tool-call</code></td><td>Tool call debugging</td></tr>
|
|
98
|
-
<tr><td><code>/autofix-pr</code></td><td>Autofix PR workflow</td></tr>
|
|
99
|
-
</table>
|
|
100
|
-
|
|
101
|
-
<h2>Feature-Gated Tools</h2>
|
|
102
|
-
<table>
|
|
103
|
-
<tr><th>Tool</th><th>Flag / Feature</th></tr>
|
|
104
|
-
<tr><td><code>LSPTool</code></td><td><code>ENABLE_LSP_TOOL=1</code></td></tr>
|
|
105
|
-
<tr><td><code>ComputerUseTool</code></td><td><code>ENABLE_COMPUTER_USE=1</code> (Windows)</td></tr>
|
|
106
|
-
<tr><td><code>CodeIndexTool</code></td><td><code>CODE_INDEX</code> feature flag</td></tr>
|
|
107
|
-
<tr><td><code>EnterWorktreeTool / ExitWorktreeTool</code></td><td>Worktree mode enabled</td></tr>
|
|
108
|
-
<tr><td><code>PowerShellTool</code></td><td>PowerShell tool enabled in settings</td></tr>
|
|
109
|
-
<tr><td><code>CronCreateTool / CronDeleteTool / CronListTool</code></td><td><code>AGENT_TRIGGERS</code> feature</td></tr>
|
|
110
|
-
<tr><td><code>PushNotificationTool</code></td><td><code>KAIROS</code> feature</td></tr>
|
|
111
|
-
<tr><td><code>REPLTool</code></td><td><code>USER_TYPE=ant</code></td></tr>
|
|
112
|
-
<tr><td><code>ConfigTool / TungstenTool</code></td><td><code>USER_TYPE=ant</code></td></tr>
|
|
113
|
-
</table>
|
|
114
|
-
|
|
115
|
-
<h2>Build-Time Feature Flags</h2>
|
|
116
|
-
<ul>
|
|
117
|
-
<li><code>TRANSCRIPT_CLASSIFIER</code> β Enables auto permission mode with transcript-based classification</li>
|
|
118
|
-
<li><code>CHICAGO_MCP</code> β Enables Chicago MCP protocol features</li>
|
|
119
|
-
</ul>
|
|
120
|
-
|
|
121
|
-
<h2>Runtime Feature Detection</h2>
|
|
122
|
-
<p>Features are checked via <code>feature('FEATURE_NAME')</code> (compile-time) and <code>isEnvTruthy()</code> (runtime):</p>
|
|
123
|
-
<ul>
|
|
124
|
-
<li><code>PROACTIVE</code> / <code>KAIROS</code> β Proactive agent behavior</li>
|
|
125
|
-
<li><code>AGENT_TRIGGERS</code> β Scheduled and remote agent triggers</li>
|
|
126
|
-
<li><code>KAIROS_GITHUB_WEBHOOKS</code> β GitHub webhook subscriptions</li>
|
|
127
|
-
<li><code>KAIROS_PUSH_NOTIFICATION</code> β Push notification support</li>
|
|
128
|
-
<li><code>CONTEXT_COLLAPSE</code> β Context collapse inspection</li>
|
|
129
|
-
<li><code>MCP_SKILLS</code> β MCP-provided skills</li>
|
|
130
|
-
<li><code>CODE_INDEX</code> β Code indexing and search</li>
|
|
131
|
-
<li><code>COORDINATOR_MODE</code> β Multi-agent coordinator mode</li>
|
|
132
|
-
</ul>
|
|
133
|
-
|
|
134
|
-
<footer class="footer">
|
|
135
|
-
<span>Clew v0.
|
|
136
|
-
<div class="footer-links">
|
|
137
|
-
<a href="https://github.com/JonusNattapong/ClewCode">GitHub</a>
|
|
138
|
-
<a href="https://github.com/JonusNattapong/ClewCode/issues">Issues</a>
|
|
139
|
-
</div>
|
|
140
|
-
</footer>
|
|
141
|
-
</main>
|
|
142
|
-
<nav class="toc-sidebar"></nav>
|
|
143
|
-
</div>
|
|
144
|
-
</div>
|
|
145
|
-
<script src="../js/main.js"></script>
|
|
146
|
-
</body>
|
|
147
|
-
</html>
|
|
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>Hidden Features & Internals β Clew</title>
|
|
7
|
+
<meta name="description" content="Feature-gated commands, internal-only tools, and beta flags in 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
|
+
<link rel="icon" type="image/svg+xml" href="../assets/clew.svg">
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<header class="header">
|
|
16
|
+
<div class="header-inner">
|
|
17
|
+
<a href="../index.html" class="logo">
|
|
18
|
+
<span>Clew Code</span>
|
|
19
|
+
</a>
|
|
20
|
+
<nav class="header-nav">
|
|
21
|
+
<a href="../index.html">Home</a>
|
|
22
|
+
<a href="../index.html#features">Features</a>
|
|
23
|
+
<a href="../index.html#commands">Commands</a>
|
|
24
|
+
<a href="../quick-start.html" class="active">Docs</a>
|
|
25
|
+
<a href="https://github.com/JonusNattapong/ClewCode" target="_blank">GitHub</a>
|
|
26
|
+
<div class="lang-wrap">
|
|
27
|
+
<button class="lang-btn">π</button>
|
|
28
|
+
<div class="lang-menu">
|
|
29
|
+
<a href="../../readme/README.zh.md">δΈζ</a>
|
|
30
|
+
<a href="../../readme/README.th.md">ΰΉΰΈΰΈ’</a>
|
|
31
|
+
<a href="../../readme/README.ja.md">ζ₯ζ¬θͺ</a>
|
|
32
|
+
<a href="../../readme/README.ko.md">νκ΅μ΄</a>
|
|
33
|
+
<a href="../../readme/README.es.md">EspaΓ±ol</a>
|
|
34
|
+
<a href="../../readme/README.fr.md">FranΓ§ais</a>
|
|
35
|
+
<a href="../../readme/README.de.md">Deutsch</a>
|
|
36
|
+
<a href="../../readme/README.pt.md">PortuguΓͺs</a>
|
|
37
|
+
<a href="../../readme/README.vi.md">TiαΊΏng Viα»t</a>
|
|
38
|
+
<a href="../../readme/README.id.md">Bahasa Indonesia</a>
|
|
39
|
+
<a href="../../readme/README.ru.md">Π ΡΡΡΠΊΠΈΠΉ</a>
|
|
40
|
+
<a href="../../readme/README.hi.md">ΰ€Ήΰ€Ώΰ€¨ΰ₯ΰ€¦ΰ₯</a>
|
|
41
|
+
<a href="../../README.md">English</a>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</nav>
|
|
45
|
+
<button class="menu-btn" id="menuToggle" aria-label="Toggle navigation"><span></span><span></span><span></span></button>
|
|
46
|
+
</div>
|
|
47
|
+
</header>
|
|
48
|
+
<div class="app">
|
|
49
|
+
<aside class="sidebar" id="sidebar"></aside>
|
|
50
|
+
<div class="sidebar-overlay" id="sidebarOverlay"></div>
|
|
51
|
+
<div class="content-wrap">
|
|
52
|
+
<main class="content">
|
|
53
|
+
<div class="breadcrumbs"><a href="../index.html">Home</a><span class="sep">/</span><a href="../index.html#features">Internals</a><span class="sep">/</span><span>Hidden Features</span></div>
|
|
54
|
+
<h1>Hidden Features & Internals</h1>
|
|
55
|
+
<p class="section-subtitle">Feature-gated commands, internal-only tools, and beta flags β not visible in the standard help menu.</p>
|
|
56
|
+
|
|
57
|
+
<div class="callout callout-warn">
|
|
58
|
+
<strong>Internal / Beta</strong>
|
|
59
|
+
These features may change without notice. Most require specific environment variables or build-time feature flags.
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<h2>Feature-Gated Commands</h2>
|
|
63
|
+
<p>From <code>src/commands.ts</code> β enabled via environment variables:</p>
|
|
64
|
+
<table>
|
|
65
|
+
<tr><th>Command</th><th>Env Variable</th><th>Description</th></tr>
|
|
66
|
+
<tr><td><code>/bridge</code></td><td><code>BRIDGE_MODE=1</code></td><td>WebSocket remote control and collaboration</td></tr>
|
|
67
|
+
<tr><td><code>/voice</code></td><td><code>VOICE_MODE=1</code></td><td>Toggle voice mode</td></tr>
|
|
68
|
+
<tr><td><code>/brief</code></td><td><code>KAIROS=1</code></td><td>Brief command for quick context</td></tr>
|
|
69
|
+
<tr><td><code>/assistant</code></td><td><code>KAIROS=1</code></td><td>Assistant mode with proactive behavior</td></tr>
|
|
70
|
+
</table>
|
|
71
|
+
|
|
72
|
+
<h2>Internal-Only Commands</h2>
|
|
73
|
+
<p>Defined in <code>INTERNAL_ONLY_COMMANDS</code> in <code>src/commands.ts</code>:</p>
|
|
74
|
+
<table>
|
|
75
|
+
<tr><th>Command</th><th>Description</th></tr>
|
|
76
|
+
<tr><td><code>/backfill-sessions</code></td><td>Backfill session data</td></tr>
|
|
77
|
+
<tr><td><code>/break-cache</code></td><td>Break internal caches</td></tr>
|
|
78
|
+
<tr><td><code>/bughunter</code></td><td>Automated bug hunting workflow</td></tr>
|
|
79
|
+
<tr><td><code>/commit-push-pr</code></td><td>Commit, push, and PR creation</td></tr>
|
|
80
|
+
<tr><td><code>/ctx-viz</code></td><td>Context visualization</td></tr>
|
|
81
|
+
<tr><td><code>/init-verifiers</code></td><td>Initialize verifiers</td></tr>
|
|
82
|
+
<tr><td><code>/issue</code></td><td>Issue management</td></tr>
|
|
83
|
+
<tr><td><code>/mock-limits</code></td><td>Mock usage limits for testing</td></tr>
|
|
84
|
+
<tr><td><code>/reset-limits</code></td><td>Reset usage limits</td></tr>
|
|
85
|
+
<tr><td><code>/ultraplan</code></td><td>Extended plan mode</td></tr>
|
|
86
|
+
<tr><td><code>/version</code></td><td>Show version</td></tr>
|
|
87
|
+
<tr><td><code>/bridge-kick</code></td><td>Bridge session management</td></tr>
|
|
88
|
+
<tr><td><code>/onboarding</code></td><td>Interactive onboarding wizard</td></tr>
|
|
89
|
+
<tr><td><code>/team-onboarding</code></td><td>Generate teammate ramp-up guide</td></tr>
|
|
90
|
+
<tr><td><code>/share</code></td><td>Share session</td></tr>
|
|
91
|
+
<tr><td><code>/summary</code></td><td>Summarize conversation</td></tr>
|
|
92
|
+
<tr><td><code>/teleport</code></td><td>Teleport session</td></tr>
|
|
93
|
+
<tr><td><code>/ant-trace</code></td><td>Anthropic-internal tracing</td></tr>
|
|
94
|
+
<tr><td><code>/perf-issue</code></td><td>Performance issue reporting</td></tr>
|
|
95
|
+
<tr><td><code>/env</code></td><td>Environment inspection</td></tr>
|
|
96
|
+
<tr><td><code>/oauth-refresh</code></td><td>OAuth token refresh</td></tr>
|
|
97
|
+
<tr><td><code>/debug-tool-call</code></td><td>Tool call debugging</td></tr>
|
|
98
|
+
<tr><td><code>/autofix-pr</code></td><td>Autofix PR workflow</td></tr>
|
|
99
|
+
</table>
|
|
100
|
+
|
|
101
|
+
<h2>Feature-Gated Tools</h2>
|
|
102
|
+
<table>
|
|
103
|
+
<tr><th>Tool</th><th>Flag / Feature</th></tr>
|
|
104
|
+
<tr><td><code>LSPTool</code></td><td><code>ENABLE_LSP_TOOL=1</code></td></tr>
|
|
105
|
+
<tr><td><code>ComputerUseTool</code></td><td><code>ENABLE_COMPUTER_USE=1</code> (Windows)</td></tr>
|
|
106
|
+
<tr><td><code>CodeIndexTool</code></td><td><code>CODE_INDEX</code> feature flag</td></tr>
|
|
107
|
+
<tr><td><code>EnterWorktreeTool / ExitWorktreeTool</code></td><td>Worktree mode enabled</td></tr>
|
|
108
|
+
<tr><td><code>PowerShellTool</code></td><td>PowerShell tool enabled in settings</td></tr>
|
|
109
|
+
<tr><td><code>CronCreateTool / CronDeleteTool / CronListTool</code></td><td><code>AGENT_TRIGGERS</code> feature</td></tr>
|
|
110
|
+
<tr><td><code>PushNotificationTool</code></td><td><code>KAIROS</code> feature</td></tr>
|
|
111
|
+
<tr><td><code>REPLTool</code></td><td><code>USER_TYPE=ant</code></td></tr>
|
|
112
|
+
<tr><td><code>ConfigTool / TungstenTool</code></td><td><code>USER_TYPE=ant</code></td></tr>
|
|
113
|
+
</table>
|
|
114
|
+
|
|
115
|
+
<h2>Build-Time Feature Flags</h2>
|
|
116
|
+
<ul>
|
|
117
|
+
<li><code>TRANSCRIPT_CLASSIFIER</code> β Enables auto permission mode with transcript-based classification</li>
|
|
118
|
+
<li><code>CHICAGO_MCP</code> β Enables Chicago MCP protocol features</li>
|
|
119
|
+
</ul>
|
|
120
|
+
|
|
121
|
+
<h2>Runtime Feature Detection</h2>
|
|
122
|
+
<p>Features are checked via <code>feature('FEATURE_NAME')</code> (compile-time) and <code>isEnvTruthy()</code> (runtime):</p>
|
|
123
|
+
<ul>
|
|
124
|
+
<li><code>PROACTIVE</code> / <code>KAIROS</code> β Proactive agent behavior</li>
|
|
125
|
+
<li><code>AGENT_TRIGGERS</code> β Scheduled and remote agent triggers</li>
|
|
126
|
+
<li><code>KAIROS_GITHUB_WEBHOOKS</code> β GitHub webhook subscriptions</li>
|
|
127
|
+
<li><code>KAIROS_PUSH_NOTIFICATION</code> β Push notification support</li>
|
|
128
|
+
<li><code>CONTEXT_COLLAPSE</code> β Context collapse inspection</li>
|
|
129
|
+
<li><code>MCP_SKILLS</code> β MCP-provided skills</li>
|
|
130
|
+
<li><code>CODE_INDEX</code> β Code indexing and search</li>
|
|
131
|
+
<li><code>COORDINATOR_MODE</code> β Multi-agent coordinator mode</li>
|
|
132
|
+
</ul>
|
|
133
|
+
|
|
134
|
+
<footer class="footer">
|
|
135
|
+
<span>Clew Code v0.2.4 β Open Source</span>
|
|
136
|
+
<div class="footer-links">
|
|
137
|
+
<a href="https://github.com/JonusNattapong/ClewCode">GitHub</a>
|
|
138
|
+
<a href="https://github.com/JonusNattapong/ClewCode/issues">Issues</a>
|
|
139
|
+
</div>
|
|
140
|
+
</footer>
|
|
141
|
+
</main>
|
|
142
|
+
<nav class="toc-sidebar"></nav>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
<script src="../js/main.js"></script>
|
|
146
|
+
</body>
|
|
147
|
+
</html>
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
</ul>
|
|
93
93
|
|
|
94
94
|
<footer class="footer">
|
|
95
|
-
<span>Clew v0.
|
|
95
|
+
<span>Clew Code v0.2.4 β ΰΉΰΈΰΉΰΈΰΈΰΈΰΈΰΈ£ΰΉΰΈͺ</span>
|
|
96
96
|
<div class="footer-links">
|
|
97
97
|
<a href="https://github.com/JonusNattapong/ClewCode">GitHub</a>
|
|
98
98
|
<a href="https://github.com/JonusNattapong/ClewCode/issues">ΰΈΰΈ±ΰΈΰΈ«ΰΈ²</a>
|
package/docs/js/main.js
CHANGED
|
@@ -17,6 +17,82 @@
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
// ββ Header Injection βββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
21
|
+
function injectHeader() {
|
|
22
|
+
var header = document.querySelector('.header');
|
|
23
|
+
if (!header) return;
|
|
24
|
+
|
|
25
|
+
var path = window.location.pathname;
|
|
26
|
+
var isThai = /\.th\.html$/.test(path);
|
|
27
|
+
var isIndex = /\/index(\.th)?\.html$/.test(path) || path === '/' || path.endsWith('/docs/');
|
|
28
|
+
var currentPage = path.split('/').pop() || 'index.html';
|
|
29
|
+
|
|
30
|
+
var logoHref = isThai ? 'index.th.html' : 'index.html';
|
|
31
|
+
var docsHref = isThai ? 'quick-start.th.html' : 'quick-start.html';
|
|
32
|
+
var ariaLabel = isThai ? 'ΰΉΰΈΰΈ΄ΰΈ/ΰΈΰΈ΄ΰΈΰΉΰΈ‘ΰΈΰΈΉ' : 'Toggle navigation';
|
|
33
|
+
|
|
34
|
+
// Build language dropdown
|
|
35
|
+
var langEn = isThai
|
|
36
|
+
? currentPage.replace(/\.th\.html$/, '.html')
|
|
37
|
+
: '../README.md';
|
|
38
|
+
|
|
39
|
+
var langs = [
|
|
40
|
+
{ url: langEn, label: 'English', code: 'en' },
|
|
41
|
+
{ url: '../readme/README.th.md', label: 'ΰΉΰΈΰΈ’', code: 'th' }
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
var langOptionsHtml = langs.map(function (lang) {
|
|
45
|
+
var sel = (lang.code === (isThai ? 'th' : 'en')) ? ' selected' : '';
|
|
46
|
+
return '<option value="' + lang.url + '"' + sel + '>' + lang.label + '</option>';
|
|
47
|
+
}).join('');
|
|
48
|
+
|
|
49
|
+
var langSelectHtml =
|
|
50
|
+
'<select class="lang-select" aria-label="Language">' +
|
|
51
|
+
' <option value="" disabled hidden>π</option>' +
|
|
52
|
+
langOptionsHtml +
|
|
53
|
+
'</select>';
|
|
54
|
+
|
|
55
|
+
header.innerHTML =
|
|
56
|
+
'<div class="header-inner">' +
|
|
57
|
+
' <a href="' + logoHref + '" class="logo"><span>Clew Code</span></a>' +
|
|
58
|
+
' <nav class="header-nav">' +
|
|
59
|
+
' <a href="' + logoHref + '">' + (isThai ? 'ΰΈ«ΰΈΰΉΰΈ²ΰΉΰΈ£ΰΈ' : 'Home') + '</a>' +
|
|
60
|
+
' <a href="' + logoHref + '#features">' + (isThai ? 'ΰΈΰΈ΅ΰΉΰΈΰΈΰΈ£ΰΉ' : 'Features') + '</a>' +
|
|
61
|
+
' <a href="' + logoHref + '#commands">' + (isThai ? 'ΰΈΰΈ³ΰΈͺΰΈ±ΰΉΰΈ' : 'Commands') + '</a>' +
|
|
62
|
+
' <a href="' + docsHref + '">' + (isThai ? 'ΰΉΰΈΰΈΰΈͺΰΈ²ΰΈ£' : 'Docs') + '</a>' +
|
|
63
|
+
' <a href="https://github.com/JonusNattapong/ClewCode" target="_blank">GitHub</a>' +
|
|
64
|
+
' ' + langSelectHtml +
|
|
65
|
+
' </nav>' +
|
|
66
|
+
' <button class="menu-btn" id="menuToggle" aria-label="' + ariaLabel + '"><span></span><span></span><span></span></button>' +
|
|
67
|
+
'</div>';
|
|
68
|
+
|
|
69
|
+
// Language select change handler
|
|
70
|
+
var langSelect = header.querySelector('.lang-select');
|
|
71
|
+
if (langSelect) {
|
|
72
|
+
langSelect.addEventListener('change', function () {
|
|
73
|
+
var url = this.value;
|
|
74
|
+
if (url) window.location.href = url;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Active link: exact page match
|
|
79
|
+
var navLinks = header.querySelectorAll('.header-nav a');
|
|
80
|
+
navLinks.forEach(function (link) {
|
|
81
|
+
var href = link.getAttribute('href');
|
|
82
|
+
if (!href) return;
|
|
83
|
+
var hrefPage = href.split('/').pop().split('#')[0];
|
|
84
|
+
if (hrefPage === currentPage) link.classList.add('active');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// Non-index pages: mark "Docs" as active
|
|
88
|
+
if (!isIndex) {
|
|
89
|
+
var docsLink = header.querySelector('.header-nav a[href*="quick-start"]');
|
|
90
|
+
if (docsLink) docsLink.classList.add('active');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
injectHeader();
|
|
95
|
+
|
|
20
96
|
// ββ Sidebar Injection ββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
21
97
|
if (sidebar) {
|
|
22
98
|
sidebar.innerHTML =
|
|
@@ -64,6 +140,8 @@
|
|
|
64
140
|
' <a href="' + rootPrefix + 'features/evals.html" class="sidebar-link"><span class="link-icon"></span>Evaluation Harness</a>' +
|
|
65
141
|
' <a href="' + rootPrefix + 'features/sentry-setup.html" class="sidebar-link"><span class="link-icon"></span>Sentry Setup</a>' +
|
|
66
142
|
' <a href="' + rootPrefix + 'taste.html" class="sidebar-link"><span class="link-icon"></span>Taste</a>' +
|
|
143
|
+
' <a href="' + rootPrefix + 'peer.html" class="sidebar-link"><span class="link-icon"></span>Peer System</a>' +
|
|
144
|
+
' <a href="' + rootPrefix + 'loop.html" class="sidebar-link"><span class="link-icon"></span>Agent Loop</a>' +
|
|
67
145
|
' </nav>' +
|
|
68
146
|
'</div>' +
|
|
69
147
|
'<div class="sidebar-section">' +
|
|
@@ -117,13 +195,6 @@
|
|
|
117
195
|
if (hrefPage === currentPage) link.classList.add('active');
|
|
118
196
|
});
|
|
119
197
|
|
|
120
|
-
document.querySelectorAll('.header-nav a').forEach(function (link) {
|
|
121
|
-
var href = link.getAttribute('href');
|
|
122
|
-
if (!href) return;
|
|
123
|
-
var hrefPage = href.split('/').pop().split('#')[0];
|
|
124
|
-
if (hrefPage === currentPage) link.classList.add('active');
|
|
125
|
-
});
|
|
126
|
-
|
|
127
198
|
// ββ Code Copy Buttons ββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
128
199
|
function addCopyButtons() {
|
|
129
200
|
document.querySelectorAll('.content pre').forEach(function (pre) {
|
package/docs/loop.html
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
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>Agent Loop β Clew Code</title>
|
|
7
|
+
<meta name="description" content="Autonomous agent loop β task queue consumer, worker lifecycle, retry logic, dead-letter queue, lease-based concurrency">
|
|
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">
|
|
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.html">Home</a><span class="sep">/</span><span>Agent Loop</span></div>
|
|
22
|
+
<h1>Autonomous Agent Loop</h1>
|
|
23
|
+
<p class="section-subtitle">24/7 background execution loop β pulls tasks from queue, spawns workers, monitors status, retries on failure, dead-letters when exhausted.</p>
|
|
24
|
+
|
|
25
|
+
<p>The agent loop lives in <code>src/services/autonomous/agentLoop.ts</code> β the single consumer that reads the task queue and manages the lifecycle of all worker processes.</p>
|
|
26
|
+
|
|
27
|
+
<h2>Techniques & Principles</h2>
|
|
28
|
+
|
|
29
|
+
<h3>Why a Loop instead of a Message Queue?</h3>
|
|
30
|
+
<p>Message queue systems like RabbitMQ/Kafka carry setup and maintenance overhead. The agent loop uses a <strong>JSON file as a persistent queue</strong> β zero external dependencies:</p>
|
|
31
|
+
<ul>
|
|
32
|
+
<li><strong>Zero external deps</strong> β uses <code>fs.watch</code> to detect queue file changes</li>
|
|
33
|
+
<li><strong>File-based atomicity</strong> β single-file read/write under lock allows multiple processes to compete for consumption</li>
|
|
34
|
+
<li><strong>Self-debouncing</strong> β <code>ourWriteInProgress</code> flag prevents self-triggered re-reads</li>
|
|
35
|
+
<li><strong>Cross-platform</strong> β JSON files work everywhere, no broker installation needed</li>
|
|
36
|
+
</ul>
|
|
37
|
+
|
|
38
|
+
<h3>Lease-Based Concurrency</h3>
|
|
39
|
+
<p>The classic distributed worker problem: two workers see the same task and duplicate work. Leases solve this without a distributed lock:</p>
|
|
40
|
+
<pre><code>Main Loop Queue File (.json) Worker Process
|
|
41
|
+
β β β
|
|
42
|
+
β getNextTask() β β
|
|
43
|
+
βββββββββββββββββββββββββββββββΊβ β
|
|
44
|
+
βββββ task {id, status:pending}β β
|
|
45
|
+
β β β
|
|
46
|
+
β leaseTask(id, agentId) β β
|
|
47
|
+
βββββββββββββββββββββββββββββββΊβ β
|
|
48
|
+
β (atomic: check no lease β β
|
|
49
|
+
β β write leaseOwner + β β
|
|
50
|
+
β leaseExpiresAt) β β
|
|
51
|
+
βββββββββ true (leased) βββββββ β
|
|
52
|
+
β β β
|
|
53
|
+
β spawnWorker(prompt) β β
|
|
54
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββΊβ
|
|
55
|
+
ββββββ WorkerSession {id, pid} β β
|
|
56
|
+
β β β
|
|
57
|
+
β βββ LOOP βββ β β
|
|
58
|
+
β while running: β β
|
|
59
|
+
β checkWorker(sessionId) β β
|
|
60
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββΊβ
|
|
61
|
+
β ββββ "running" / "completed" / "failed" β
|
|
62
|
+
β β β
|
|
63
|
+
β [completed] β releaseLease β β
|
|
64
|
+
β β markCompleted β β
|
|
65
|
+
β β β
|
|
66
|
+
β [failed] β markFailed β β
|
|
67
|
+
β β retryTask() β β
|
|
68
|
+
β β stopWorker() β β
|
|
69
|
+
β β β
|
|
70
|
+
β [timeout 30m] β stopWorker β β
|
|
71
|
+
β β releaseLeaseβ β
|
|
72
|
+
β β retryTask() β β</code></pre>
|
|
73
|
+
|
|
74
|
+
<h3>Retry with Exponential Backoff</h3>
|
|
75
|
+
<pre><code>Retry attempt Backoff delay Cumulative wait
|
|
76
|
+
βββββββββββββ βββββββββββββ ββββββββββββββ
|
|
77
|
+
1 base Γ 2ΒΉ = 30s 30s
|
|
78
|
+
2 base Γ 2Β² = 60s 90s
|
|
79
|
+
3 base Γ 2Β³ = 120s 210s
|
|
80
|
+
4 base Γ 2β΄ = 240s 450s
|
|
81
|
+
5 (max) base Γ 2β΅ = 480s 930s (~15 min)
|
|
82
|
+
|
|
83
|
+
After max retries β dead_letter queue
|
|
84
|
+
Dead-letter preserves: title, description, lastError, errorLog, retryCount</code></pre>
|
|
85
|
+
<ul>
|
|
86
|
+
<li><strong>Exponential backoff</strong> β base = 15s, factor = 2</li>
|
|
87
|
+
<li><strong>Max retries</strong> β 5 per task (default)</li>
|
|
88
|
+
<li><strong>Dead-letter queue</strong> β exhausted tasks are moved to <code>dead_letter</code> status with reason + error log</li>
|
|
89
|
+
</ul>
|
|
90
|
+
|
|
91
|
+
<h3>Worker Lifecycle + Concurrent Cap</h3>
|
|
92
|
+
<ul>
|
|
93
|
+
<li><strong>MAX_CONCURRENT_WORKERS = 3</strong> β prevents resource exhaustion</li>
|
|
94
|
+
<li><strong>Worker timeout = 30 min</strong> β long-running tasks are killed to free resources</li>
|
|
95
|
+
<li><strong>Worker poll = 10s</strong> β status checks via supervisor IPC</li>
|
|
96
|
+
<li><strong>Loop sleep = 5s</strong> β idle interval when no tasks or workers full</li>
|
|
97
|
+
</ul>
|
|
98
|
+
|
|
99
|
+
<h3>Supervisor Integration</h3>
|
|
100
|
+
<p>Workers are spawned through a <strong>Supervisor process</strong> (child_process) for crash isolation:</p>
|
|
101
|
+
<ul>
|
|
102
|
+
<li><strong>Crash isolation</strong> β worker crash doesn't crash the loop</li>
|
|
103
|
+
<li><strong>Output capture</strong> β stdout/stderr saved to <code>~/.claude/daemon/jobs/{sessionId}/output.log</code></li>
|
|
104
|
+
<li><strong>Health via IPC</strong> β loop checks status through supervisor, not raw PID (avoids PID reuse bugs)</li>
|
|
105
|
+
</ul>
|
|
106
|
+
|
|
107
|
+
<h3>Integration Points</h3>
|
|
108
|
+
<ul>
|
|
109
|
+
<li><strong>Peer todo listener</strong> β receives tasks from remote peers via <code>/peer-todo</code> HTTP endpoint β adds to queue</li>
|
|
110
|
+
<li><strong>Cron scheduler</strong> β fires scheduled tasks β adds to queue</li>
|
|
111
|
+
<li><strong>File watcher</strong> β <code>fs.watch</code> on queue file detects new tasks from other processes (e.g. CLI <code>/task add</code>)</li>
|
|
112
|
+
</ul>
|
|
113
|
+
|
|
114
|
+
<h3>Crash Recovery</h3>
|
|
115
|
+
<pre><code>Previous Run Crash
|
|
116
|
+
β
|
|
117
|
+
βΌ
|
|
118
|
+
startLoop() called
|
|
119
|
+
β
|
|
120
|
+
βββ loadQueue() β restore queue from disk
|
|
121
|
+
βββ sleep(2000ms) β ensure old process is dead
|
|
122
|
+
βββ expireLeases() β clear all stale leases
|
|
123
|
+
βββ start heartbeat (every 60s)
|
|
124
|
+
βββ start cron scheduler
|
|
125
|
+
βββ start peer sharing
|
|
126
|
+
βββ start file watcher
|
|
127
|
+
βββ MAIN LOOP βββΊ getNextTask() β processTask() β loop</code></pre>
|
|
128
|
+
|
|
129
|
+
<h2>Task Lifecycle (State Machine)</h2>
|
|
130
|
+
<pre><code> ββββββββββββ
|
|
131
|
+
β pending βββββββββββββββββββββββββββββββββ
|
|
132
|
+
ββββββ¬ββββββ β
|
|
133
|
+
β leaseTask() β
|
|
134
|
+
βΌ β
|
|
135
|
+
ββββββββββββ β
|
|
136
|
+
βin_progressβ β
|
|
137
|
+
ββββββ¬ββββββ β
|
|
138
|
+
βββββββββββββΌββββββββββββ β
|
|
139
|
+
βΌ βΌ βΌ β
|
|
140
|
+
ββββββββββββ ββββββββββββ ββββββββββββ β
|
|
141
|
+
βcompleted β β failed β βcancelled β β
|
|
142
|
+
ββββββββββββ ββββββ¬ββββββ ββββββββββββ β
|
|
143
|
+
β retryTask() β
|
|
144
|
+
βββ retryCount < max β backoff β βββββ
|
|
145
|
+
β
|
|
146
|
+
βββ retryCount β₯ max
|
|
147
|
+
β
|
|
148
|
+
βΌ
|
|
149
|
+
ββββββββββββββββ
|
|
150
|
+
β dead_letter β
|
|
151
|
+
β (preserved β
|
|
152
|
+
β for review) β
|
|
153
|
+
ββββββββββββββββ</code></pre>
|
|
154
|
+
|
|
155
|
+
<h2>Related Files</h2>
|
|
156
|
+
<table>
|
|
157
|
+
<tr><th>File</th><th>Role</th></tr>
|
|
158
|
+
<tr><td><code>src/services/autonomous/agentLoop.ts</code></td><td>Main loop β start, stop, processTask, worker lifecycle</td></tr>
|
|
159
|
+
<tr><td><code>src/services/autonomous/taskQueue.ts</code></td><td>Queue CRUD, lease management, retry, dead-letter, file watcher</td></tr>
|
|
160
|
+
<tr><td><code>src/services/autonomous/daemonMode.ts</code></td><td>Daemon entry point β calls startLoop/stopLoop</td></tr>
|
|
161
|
+
<tr><td><code>src/Task.ts</code></td><td>Task type definitions, state machine, task ID generation</td></tr>
|
|
162
|
+
<tr><td><code>src/tasks/LocalAgentTask/</code></td><td>Local worker task β UI + lifecycle</td></tr>
|
|
163
|
+
<tr><td><code>src/tasks/RemoteAgentTask/</code></td><td>Remote worker task β UI + lifecycle</td></tr>
|
|
164
|
+
<tr><td><code>src/components/AutonomousExecutionAccordion.tsx</code></td><td>UI component for task queue display in REPL</td></tr>
|
|
165
|
+
</table>
|
|
166
|
+
|
|
167
|
+
<footer class="footer">
|
|
168
|
+
<span>Clew Code β Open Source</span>
|
|
169
|
+
<div class="footer-links">
|
|
170
|
+
<a href="https://github.com/JonusNattapong/ClewCode">GitHub</a>
|
|
171
|
+
<a href="https://github.com/JonusNattapong/ClewCode/issues">Issues</a>
|
|
172
|
+
</div>
|
|
173
|
+
</footer>
|
|
174
|
+
</main>
|
|
175
|
+
<nav class="toc-sidebar"></nav>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
<script src="js/main.js"></script>
|
|
179
|
+
</body>
|
|
180
|
+
</html>
|