chill-agent 1.3.0 → 1.5.0
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/.agents/plugins/marketplace.json +39 -0
- package/.agents/rules/ponytail.md +30 -0
- package/.claude-plugin/marketplace.json +17 -0
- package/.claude-plugin/plugin.json +35 -0
- package/.cline-plugin/plugin.json +35 -0
- package/.clinerules/chill-agent +274 -0
- package/.clinerules/ponytail.md +30 -0
- package/.codex-plugin/plugin.json +35 -0
- package/.cursor/rules/chill-agent.mdc +278 -0
- package/.cursor/rules/ponytail.mdc +36 -0
- package/.cursor-plugin/plugin.json +35 -0
- package/.devin-plugin/plugin.json +35 -0
- package/.grok-plugin/marketplace.json +16 -0
- package/.grok-plugin/plugin.json +35 -0
- package/.kimi-plugin/plugin.json +35 -0
- package/.kiro/steering/ponytail.md +35 -0
- package/.omp-plugin/plugin.json +35 -0
- package/.openclaw/skills/chill-audit/SKILL.md +103 -0
- package/.openclaw/skills/chill-debt/SKILL.md +44 -0
- package/.openclaw/skills/chill-gain/SKILL.md +52 -0
- package/.openclaw/skills/chill-help/SKILL.md +76 -0
- package/.openclaw/skills/chill-review/SKILL.md +101 -0
- package/.openclaw/skills/chill-slop/SKILL.md +274 -0
- package/.openclaw/skills/chill-slop-code/SKILL.md +93 -0
- package/.openclaw/skills/chill-slop-copywriting/SKILL.md +80 -0
- package/.openclaw/skills/chill-slop-human/SKILL.md +73 -0
- package/.openclaw/skills/chill-slop-mobile/SKILL.md +95 -0
- package/.openclaw/skills/chill-slop-ui/SKILL.md +114 -0
- package/.openclaw/skills/ponytail/SKILL.md +52 -0
- package/.openclaw/skills/ponytail-audit/SKILL.md +103 -0
- package/.openclaw/skills/ponytail-debt/SKILL.md +44 -0
- package/.openclaw/skills/ponytail-gain/SKILL.md +52 -0
- package/.openclaw/skills/ponytail-help/SKILL.md +76 -0
- package/.openclaw/skills/ponytail-review/SKILL.md +101 -0
- package/.opencode/command/chill-audit.toml +2 -0
- package/.opencode/command/chill-debt.toml +2 -0
- package/.opencode/command/chill-gain.toml +2 -0
- package/.opencode/command/chill-help.toml +2 -0
- package/.opencode/command/chill-review.toml +2 -0
- package/.opencode/command/chill.toml +2 -0
- package/.opencode/command/ponytail-audit.md +5 -0
- package/.opencode/command/ponytail-debt.md +5 -0
- package/.opencode/command/ponytail-gain.md +5 -0
- package/.opencode/command/ponytail-help.md +5 -0
- package/.opencode/command/ponytail-review.md +5 -0
- package/.opencode/command/ponytail.md +5 -0
- package/.opencode/plugins/index.js +4 -0
- package/.opencode/plugins/ponytail-frontmatter.cjs +63 -0
- package/.opencode/plugins/ponytail.mjs +206 -0
- package/.qoder-plugin/plugin.json +35 -0
- package/.windsurf/rules/chill-agent.md +274 -0
- package/.windsurf/rules/ponytail.md +30 -0
- package/AGENTS.md +19 -0
- package/__init__.py +228 -0
- package/benchmarks/README.md +10 -0
- package/benchmarks/loc.js +21 -0
- package/benchmarks/results/token-efficiency.md +10 -0
- package/commands/ponytail-audit.toml +2 -0
- package/commands/ponytail-debt.toml +2 -0
- package/commands/ponytail-gain.toml +2 -0
- package/commands/ponytail-help.toml +2 -0
- package/commands/ponytail-review.toml +2 -0
- package/commands/ponytail.toml +2 -0
- package/examples/README.md +8 -0
- package/examples/anti-slop-copy.md +7 -0
- package/examples/anti-slop-ui.md +14 -0
- package/examples/csv-sum.md +27 -0
- package/examples/debounce.md +22 -0
- package/examples/deep-clone.md +14 -0
- package/examples/modal-dialog.md +19 -0
- package/hooks/chill-activate.js +19 -0
- package/hooks/chill-mode-tracker.js +23 -0
- package/hooks/chill-statusline.ps1 +10 -0
- package/hooks/chill-statusline.sh +9 -0
- package/hooks/claude-codex-hooks.json +11 -0
- package/hooks/copilot-hooks.json +11 -0
- package/hooks/cursor-hooks.json +17 -0
- package/hooks/ponytail-activate.js +201 -0
- package/hooks/ponytail-instructions.js +98 -0
- package/hooks/ponytail-mode-tracker.js +216 -0
- package/hooks/ponytail-runtime.js +182 -0
- package/hooks/ponytail-statusline.ps1 +24 -0
- package/hooks/ponytail-statusline.sh +18 -0
- package/hooks/qoder-hooks.json +11 -0
- package/i18n/README.es.md +17 -0
- package/i18n/README.id.md +25 -0
- package/i18n/README.ja.md +17 -0
- package/i18n/README.zh-CN.md +17 -0
- package/package.json +29 -3
- package/pi-extension/index.js +254 -0
- package/pi-extension/package.json +8 -0
- package/scripts/check-rule-copies.js +74 -0
- package/scripts/check-versions.js +77 -0
- package/scripts/cursor-hooks.js +145 -0
- package/scripts/generate-chillslop.mjs +42 -0
- package/scripts/generate-examples.mjs +149 -0
- package/scripts/generate-plugin-doors.mjs +108 -0
- package/scripts/sync-ponytail.mjs +65 -0
- package/scripts/uninstall.js +92 -0
- package/skills/ponytail/SKILL.md +52 -0
- package/skills/ponytail-audit/SKILL.md +103 -0
- package/skills/ponytail-debt/SKILL.md +44 -0
- package/skills/ponytail-gain/SKILL.md +52 -0
- package/skills/ponytail-help/SKILL.md +76 -0
- package/skills/ponytail-review/SKILL.md +101 -0
- package/tests/commands.test.js +94 -0
- package/tests/copilot-plugin.test.js +35 -0
- package/tests/correctness.test.js +245 -0
- package/tests/cursor-hooks.test.js +343 -0
- package/tests/gemini-extension.test.js +91 -0
- package/tests/grok-plugin.test.js +39 -0
- package/tests/hermes-plugin.test.js +403 -0
- package/tests/hooks.test.js +1005 -0
- package/tests/kimi-plugin.test.js +25 -0
- package/tests/loc.test.js +18 -0
- package/tests/manifests.test.js +29 -0
- package/tests/openclaw-skills.test.js +26 -0
- package/tests/opencode-plugin.test.js +340 -0
- package/tests/qoder-plugin.test.js +84 -0
- package/tests/rules.test.js +34 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// ponytail — UserPromptSubmit hook to track which ponytail mode is active
|
|
3
|
+
// Inspects user input for /ponytail commands and writes mode to flag file
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const { spawn } = require('child_process');
|
|
8
|
+
const { getClaudeDir, getDefaultMode, isDeactivationCommand, writeDefaultMode } = require('./ponytail-config');
|
|
9
|
+
const {
|
|
10
|
+
clearMode,
|
|
11
|
+
cursorRuleNotice,
|
|
12
|
+
cursorRulePath,
|
|
13
|
+
isCodeBuddy,
|
|
14
|
+
isCodex,
|
|
15
|
+
isCopilot,
|
|
16
|
+
isCursor,
|
|
17
|
+
isQoder,
|
|
18
|
+
readMode,
|
|
19
|
+
setMode,
|
|
20
|
+
writeHookOutput,
|
|
21
|
+
} = require('./ponytail-runtime');
|
|
22
|
+
const { getPonytailInstructions } = require('./ponytail-instructions');
|
|
23
|
+
|
|
24
|
+
let input = '';
|
|
25
|
+
let done = false;
|
|
26
|
+
|
|
27
|
+
function finish() {
|
|
28
|
+
if (done) return;
|
|
29
|
+
done = true;
|
|
30
|
+
try {
|
|
31
|
+
// Strip UTF-8 BOM some shells prepend when piping (breaks JSON.parse)
|
|
32
|
+
const data = JSON.parse(input.replace(/^\uFEFF/, ''));
|
|
33
|
+
const prompt = (data.prompt || '').trim().toLowerCase();
|
|
34
|
+
|
|
35
|
+
// Cursor with the always-on rule in the workspace: no hook can change or
|
|
36
|
+
// switch off a rule, so answer the command with the notice instead of
|
|
37
|
+
// writing a mode the rule would contradict (#817). Ordinary prompts
|
|
38
|
+
// stay silent as usual.
|
|
39
|
+
if (isCursor && (/^[/@$]ponytail/.test(prompt) || isDeactivationCommand(prompt))) {
|
|
40
|
+
const rule = cursorRulePath();
|
|
41
|
+
if (rule) {
|
|
42
|
+
writeHookOutput('UserPromptSubmit', readMode() || 'off', cursorRuleNotice(rule));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Match /ponytail commands
|
|
48
|
+
let modeSwitched = false;
|
|
49
|
+
let deactivated = false;
|
|
50
|
+
let defaultNotice = '';
|
|
51
|
+
if (/^[/@$]ponytail/.test(prompt)) {
|
|
52
|
+
const parts = prompt.split(/\s+/);
|
|
53
|
+
const cmd = parts[0].replace(/^[@$]/, '/');
|
|
54
|
+
const arg = parts[1] || '';
|
|
55
|
+
|
|
56
|
+
let mode = null;
|
|
57
|
+
let isReportOnly = false;
|
|
58
|
+
|
|
59
|
+
// /ponytail-review is a one-shot skill, not a session level (#736).
|
|
60
|
+
// Matching it here used to setMode('review'), which latched
|
|
61
|
+
// INDEPENDENT_MODES for the rest of the session.
|
|
62
|
+
if (cmd === '/ponytail' || cmd === '/ponytail:ponytail') {
|
|
63
|
+
// `/ponytail default <mode>` persists the default to config (survives
|
|
64
|
+
// restarts). Plain switches stay session-scoped ("sticks until session
|
|
65
|
+
// end"), so this is the only path that writes config. review is not a
|
|
66
|
+
// valid default (#377), so only off/lite/full/ultra are accepted.
|
|
67
|
+
if (arg === 'default') {
|
|
68
|
+
const dmode = parts[2];
|
|
69
|
+
if (dmode === 'off' || dmode === 'lite' || dmode === 'full' || dmode === 'ultra') {
|
|
70
|
+
writeDefaultMode(dmode);
|
|
71
|
+
defaultNotice = 'PONYTAIL DEFAULT SET — new sessions start in ' + dmode + '.';
|
|
72
|
+
if (!isQoder) writeHookOutput('UserPromptSubmit', dmode, defaultNotice);
|
|
73
|
+
}
|
|
74
|
+
// Qoder still needs this turn's ruleset: the block below folds the
|
|
75
|
+
// notice into it. mode stays null, so the session level is untouched.
|
|
76
|
+
if (!isQoder) return; // don't fall through to the session-mode switch
|
|
77
|
+
}
|
|
78
|
+
// `/ponytail band [on|off]` shows or hides the band above the Claude Code
|
|
79
|
+
// prompt (hooks/band reads this flag). It outlives the session; absent = shown.
|
|
80
|
+
// Other hosts have no band, so there the word stays an unknown argument.
|
|
81
|
+
if (arg === 'band' && !isCopilot && !isCodex && !isQoder && !isCodeBuddy && !isCursor) {
|
|
82
|
+
// `/ponytail band import`: past sessions into the board, in the background, so the prompt
|
|
83
|
+
// is answered right away while the transcripts are read. Detached, it outlives this hook's
|
|
84
|
+
// process.exit below.
|
|
85
|
+
if (parts[2] === 'import') {
|
|
86
|
+
spawn(process.execPath, [path.join(__dirname, 'ponytail-band-import.js')], { detached: true, stdio: 'ignore' });
|
|
87
|
+
writeHookOutput('UserPromptSubmit', readMode() || 'off', 'PONYTAIL BAND IMPORT: past Claude Code sessions (cost, agent time, tokens) are being added to the board in the background. Open the board in a minute. Confirm in one short line.');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const flag = path.join(getClaudeDir(), '.ponytail-band');
|
|
91
|
+
let hidden = false;
|
|
92
|
+
try { hidden = fs.readFileSync(flag, 'utf8').trim() === 'off'; } catch (e) {}
|
|
93
|
+
const show = parts[2] === 'on' ? true : parts[2] === 'off' ? false : hidden;
|
|
94
|
+
if (show) {
|
|
95
|
+
try { fs.unlinkSync(flag); } catch (e) {}
|
|
96
|
+
} else {
|
|
97
|
+
fs.mkdirSync(path.dirname(flag), { recursive: true });
|
|
98
|
+
fs.writeFileSync(flag, 'off');
|
|
99
|
+
}
|
|
100
|
+
writeHookOutput('UserPromptSubmit', readMode() || 'off', show
|
|
101
|
+
? 'PONYTAIL BAND ON: the band shows above the prompt again. The ponytail level is unchanged. Confirm in one short line.'
|
|
102
|
+
: 'PONYTAIL BAND OFF: the band above the prompt is hidden, `/ponytail band` brings it back. The ponytail level is unchanged. Confirm in one short line.');
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (arg === 'lite') mode = 'lite';
|
|
106
|
+
else if (arg === 'full') mode = 'full';
|
|
107
|
+
else if (arg === 'ultra') mode = 'ultra';
|
|
108
|
+
else if (arg === 'off') mode = 'off';
|
|
109
|
+
else if (arg === '') {
|
|
110
|
+
// Bare /ponytail switches ponytail on: off → the default level (full if
|
|
111
|
+
// the default is off too); already on → keep the level, report it (#639).
|
|
112
|
+
const live = readMode();
|
|
113
|
+
if (live && live !== 'off') {
|
|
114
|
+
isReportOnly = true;
|
|
115
|
+
mode = live;
|
|
116
|
+
} else {
|
|
117
|
+
mode = getDefaultMode() === 'off' ? 'full' : getDefaultMode();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (isReportOnly) {
|
|
123
|
+
// On Qoder the ruleset block below already reports; a second write
|
|
124
|
+
// here would put two JSON objects on stdout.
|
|
125
|
+
if (!isQoder) {
|
|
126
|
+
writeHookOutput(
|
|
127
|
+
'UserPromptSubmit',
|
|
128
|
+
mode,
|
|
129
|
+
'PONYTAIL MODE ACTIVE — level: ' + mode,
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
} else if (mode && mode !== 'off') {
|
|
133
|
+
setMode(mode);
|
|
134
|
+
modeSwitched = true;
|
|
135
|
+
// ponytail: Qoder needs the full ruleset every turn, so when a mode
|
|
136
|
+
// switch happens we fold the confirmation into the ruleset output
|
|
137
|
+
// below (one JSON on stdout) instead of emitting two separate writes.
|
|
138
|
+
if (!isQoder) {
|
|
139
|
+
// Cursor (#817) and Codex have no /ponytail command that would load
|
|
140
|
+
// the skill body for the new level, and the SessionStart ruleset is
|
|
141
|
+
// filtered to the start level, so the tracker delivers that level's
|
|
142
|
+
// ruleset along with the confirmation.
|
|
143
|
+
const header = 'PONYTAIL MODE CHANGED — level: ' + mode;
|
|
144
|
+
writeHookOutput(
|
|
145
|
+
'UserPromptSubmit',
|
|
146
|
+
mode,
|
|
147
|
+
(isCodex || isCursor) ? header + '\n\n' + getPonytailInstructions(mode) : header,
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
} else if (mode === 'off') {
|
|
151
|
+
if (isQoder) setMode('off');
|
|
152
|
+
else clearMode();
|
|
153
|
+
|
|
154
|
+
deactivated = true;
|
|
155
|
+
writeHookOutput('UserPromptSubmit', 'off', 'PONYTAIL MODE OFF');
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Detect deactivation
|
|
160
|
+
if (!modeSwitched && !deactivated && isDeactivationCommand(prompt)) {
|
|
161
|
+
if (isQoder) setMode('off');
|
|
162
|
+
else clearMode();
|
|
163
|
+
|
|
164
|
+
deactivated = true;
|
|
165
|
+
writeHookOutput('UserPromptSubmit', 'off', 'PONYTAIL MODE OFF');
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Qoder has no SessionStart event, so UserPromptSubmit does double duty:
|
|
169
|
+
// activate the default mode on first prompt (if no flag exists yet), then
|
|
170
|
+
// inject the ruleset on every prompt. Claude Code/Codex do this in
|
|
171
|
+
// SessionStart via ponytail-activate.js; Qoder can't, so we do it here.
|
|
172
|
+
// Skip when deactivated — user just turned ponytail off.
|
|
173
|
+
if (isQoder && !deactivated) {
|
|
174
|
+
let currentMode = readMode();
|
|
175
|
+
if (!currentMode) {
|
|
176
|
+
// First prompt in session — initialize from config/env default
|
|
177
|
+
currentMode = getDefaultMode();
|
|
178
|
+
if (currentMode !== 'off') {
|
|
179
|
+
try { setMode(currentMode); } catch (e) {}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (currentMode && currentMode !== 'off') {
|
|
183
|
+
// ponytail: one JSON per invocation — mode-switch confirmation is
|
|
184
|
+
// folded into the ruleset header so Qoder gets both in one write.
|
|
185
|
+
const header = (defaultNotice ? defaultNotice + '\n\n' : '') + (modeSwitched
|
|
186
|
+
? 'PONYTAIL MODE CHANGED — level: ' + currentMode + '\n\n'
|
|
187
|
+
: '');
|
|
188
|
+
writeHookOutput('UserPromptSubmit', currentMode, header + getPonytailInstructions(currentMode));
|
|
189
|
+
} else if (defaultNotice) {
|
|
190
|
+
writeHookOutput('UserPromptSubmit', currentMode, defaultNotice);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
} catch (e) {
|
|
194
|
+
// Silent fail
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
process.stdin.on('data', chunk => { input += chunk; });
|
|
199
|
+
// Exit on 'end', not just finish(): the fallback timer below must stay ref'd
|
|
200
|
+
// (see #790) so it can actually fire when stdin is stuck, and a ref'd timer
|
|
201
|
+
// would otherwise keep the process alive for its full 1000ms on this normal
|
|
202
|
+
// fast path.
|
|
203
|
+
process.stdin.on('end', () => { finish(); process.exit(0); });
|
|
204
|
+
|
|
205
|
+
// Never hang the session. On Windows, Claude Code runs this hook through a
|
|
206
|
+
// PowerShell `if {}` wrapper that can swallow the piped prompt JSON, so stdin
|
|
207
|
+
// 'end' never fires and the hook blocks forever — freezing the session (#443).
|
|
208
|
+
// On error, or after a short fallback, process whatever arrived (recovering the
|
|
209
|
+
// mode if data came without EOF) and exit. The fallback timer MUST stay ref'd:
|
|
210
|
+
// on Windows a stuck ref'd stdin handle keeps the event loop alive, and an
|
|
211
|
+
// unref'd timer competing with it is never scheduled — so the fallback was
|
|
212
|
+
// dead code in exactly the #443/#790 case it exists for, and the hook hung
|
|
213
|
+
// until Claude Code's external 5s watchdog killed it (#790). Mirrors the
|
|
214
|
+
// best-effort, never-block contract the other lifecycle hooks already follow.
|
|
215
|
+
process.stdin.on('error', () => { finish(); process.exit(0); });
|
|
216
|
+
setTimeout(() => { finish(); process.exit(0); }, 1000);
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
const { createHash } = require('crypto');
|
|
5
|
+
const { getClaudeDir, getQoderDir } = require('./ponytail-config');
|
|
6
|
+
|
|
7
|
+
const STATE_FILE = '.ponytail-active';
|
|
8
|
+
|
|
9
|
+
// ponytail: VS Code Copilot never sets COPILOT_PLUGIN_DATA — it only injects
|
|
10
|
+
// CLAUDE_PLUGIN_ROOT, pointed at an install path under .vscode/agent-plugins/
|
|
11
|
+
// (#528). Without this fallback isCopilot was false, so ponytail assumed
|
|
12
|
+
// native Claude Code and emitted the statusline nudge, which VS Code Copilot
|
|
13
|
+
// doesn't read.
|
|
14
|
+
function isVsCodeCopilotRoot(pluginRoot) {
|
|
15
|
+
if (!pluginRoot) return false;
|
|
16
|
+
return pluginRoot.split(/[\\/]+/).includes('agent-plugins') &&
|
|
17
|
+
pluginRoot.toLowerCase().includes('.vscode');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const isCopilot = Boolean(process.env.COPILOT_PLUGIN_DATA) ||
|
|
21
|
+
isVsCodeCopilotRoot(process.env.CLAUDE_PLUGIN_ROOT);
|
|
22
|
+
const isCodex = !isCopilot && Boolean(process.env.PLUGIN_DATA);
|
|
23
|
+
const isQoder = !isCopilot && !isCodex && Boolean(process.env.QODER_SESSION_ID);
|
|
24
|
+
// CodeBuddy (#854) loads the Claude-format plugin and sets CLAUDE_PLUGIN_ROOT
|
|
25
|
+
// too, but adds CODEBUDDY_PLUGIN_ROOT only for its own plugin hook processes.
|
|
26
|
+
const isCodeBuddy = !isCopilot && !isCodex && !isQoder && Boolean(process.env.CODEBUDDY_PLUGIN_ROOT);
|
|
27
|
+
// Cursor (#817): CURSOR_VERSION is set only in the environment Cursor builds
|
|
28
|
+
// for hook processes (Cursor 3.20.17 assigns it in exactly one place, the hook
|
|
29
|
+
// env builder), so it never leaks into a Claude Code session running inside
|
|
30
|
+
// Cursor's terminal. Cursor also sets it when it runs a Claude-format plugin's
|
|
31
|
+
// hooks next to CLAUDE_PLUGIN_ROOT, and it needs Cursor-shaped JSON either
|
|
32
|
+
// way, so this check comes after the hosts with their own data dirs.
|
|
33
|
+
const isCursor = !isCopilot && !isCodex && !isQoder && !isCodeBuddy && Boolean(process.env.CURSOR_VERSION);
|
|
34
|
+
|
|
35
|
+
let stateDir = getClaudeDir();
|
|
36
|
+
if (isCodex) stateDir = process.env.PLUGIN_DATA;
|
|
37
|
+
// COPILOT_PLUGIN_DATA is unset under VS Code Copilot, so fall back to
|
|
38
|
+
// getClaudeDir() rather than building a path from undefined.
|
|
39
|
+
if (isCopilot) stateDir = process.env.COPILOT_PLUGIN_DATA || getClaudeDir();
|
|
40
|
+
if (isQoder) stateDir = getQoderDir();
|
|
41
|
+
if (isCodeBuddy) stateDir = process.env.CODEBUDDY_CONFIG_DIR || path.join(os.homedir(), '.codebuddy');
|
|
42
|
+
if (isCursor) stateDir = path.join(os.homedir(), '.cursor');
|
|
43
|
+
|
|
44
|
+
const statePath = path.join(stateDir, STATE_FILE);
|
|
45
|
+
|
|
46
|
+
// Claude Code hands every hook its project dir, so the live mode is kept per
|
|
47
|
+
// project and concurrent sessions in different repos stop overwriting each other
|
|
48
|
+
// (#662, #809). Hosts without it keep the single shared flag.
|
|
49
|
+
// ponytail: sessions in the SAME repo still share one mode, and the statusline
|
|
50
|
+
// scripts read the shared flag (last write wins); key by session_id if either matters.
|
|
51
|
+
const projectDir = (process.env.CLAUDE_PROJECT_DIR || '').trim();
|
|
52
|
+
// Replacing separators with '_' aliases e.g. /work/a/b and /work/a_b (#662).
|
|
53
|
+
// Do not read old sanitized keys: they cannot be assigned to one project safely.
|
|
54
|
+
const projectStatePath = projectDir
|
|
55
|
+
? path.join(stateDir, 'ponytail-modes',
|
|
56
|
+
createHash('sha256').update(path.normalize(projectDir)).digest('hex'))
|
|
57
|
+
: null;
|
|
58
|
+
|
|
59
|
+
// The shared flag is still written, for the statusline and project-less hosts.
|
|
60
|
+
function setMode(mode) {
|
|
61
|
+
for (const file of [projectStatePath, statePath]) {
|
|
62
|
+
if (!file) continue;
|
|
63
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
64
|
+
fs.writeFileSync(file, mode);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function clearMode() {
|
|
69
|
+
for (const file of [projectStatePath, statePath]) {
|
|
70
|
+
if (file) try { fs.unlinkSync(file); } catch (e) {}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Live mode written by activate/mode-tracker. Absent flag = ponytail off.
|
|
75
|
+
function readMode() {
|
|
76
|
+
try {
|
|
77
|
+
return fs.readFileSync(projectStatePath || statePath, 'utf8').trim() || null;
|
|
78
|
+
} catch (e) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Cursor's always-on project rule (.cursor/rules/ponytail.mdc) already puts the
|
|
84
|
+
// ruleset in front of every prompt and no hook can switch a rule off, so while
|
|
85
|
+
// it is in the workspace the hooks step back instead of injecting a second,
|
|
86
|
+
// possibly contradicting, copy (#817). Cursor hands every hook the workspace
|
|
87
|
+
// root as CURSOR_PROJECT_DIR; project hooks also run from that directory.
|
|
88
|
+
// ponytail: first workspace root only, a rule in a secondary folder of a
|
|
89
|
+
// multi-root workspace goes undetected.
|
|
90
|
+
function cursorRulePath() {
|
|
91
|
+
const root = process.env.CURSOR_PROJECT_DIR || process.cwd();
|
|
92
|
+
const rule = path.join(root, '.cursor', 'rules', 'ponytail.mdc');
|
|
93
|
+
return fs.existsSync(rule) ? rule : null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function cursorRuleNotice(rule) {
|
|
97
|
+
return 'PONYTAIL: the always-on Cursor rule ' + rule + ' is active in this workspace and ' +
|
|
98
|
+
'already carries the ponytail ruleset, so the ponytail hooks injected nothing further. ' +
|
|
99
|
+
'Mode switching (/ponytail lite|full|ultra|off, "stop ponytail") is unavailable while ' +
|
|
100
|
+
'that rule exists. When the user tries to switch or turn off ponytail, tell them to ' +
|
|
101
|
+
'delete that rule so hooks.json can manage the level.';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Synchronous: every hook calls process.exit() right after this, and on macOS a pipe
|
|
105
|
+
// write is async, so a pending write died with the process (#1043).
|
|
106
|
+
function writeOut(text) {
|
|
107
|
+
fs.writeSync(1, text);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function writeHookOutput(event, mode, context = '') {
|
|
111
|
+
if (isCopilot) {
|
|
112
|
+
// Copilot reads additionalContext on SessionStart; ignores output elsewhere.
|
|
113
|
+
writeOut(JSON.stringify(
|
|
114
|
+
event === 'SessionStart' && context ? { additionalContext: context } : {}));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (isCodex) {
|
|
118
|
+
// No systemMessage: Codex maps it to a yellow `warning:` entry (and de-greens the
|
|
119
|
+
// completed-hook bullet), reading as an error every session (#605). The mode still
|
|
120
|
+
// shows via the additionalContext "hook context:" line — active level when on,
|
|
121
|
+
// "PONYTAIL MODE OFF" when off (that path passes context too).
|
|
122
|
+
// ponytail: if openai/codex#16933 lands and hides additionalContext, restore a
|
|
123
|
+
// non-warning mode signal here.
|
|
124
|
+
const output = {};
|
|
125
|
+
if (context) {
|
|
126
|
+
output.hookSpecificOutput = {
|
|
127
|
+
hookEventName: event,
|
|
128
|
+
additionalContext: context,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
writeOut(JSON.stringify(output));
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (isQoder || isCodeBuddy) {
|
|
135
|
+
// Qoder: hookSpecificOutput JSON, same shape as Codex minus systemMessage.
|
|
136
|
+
// UserPromptSubmit additionalContext is injected into the Agent's conversation.
|
|
137
|
+
// CodeBuddy would take raw stdout too, but also echoes it into the chat.
|
|
138
|
+
const output = {};
|
|
139
|
+
if (context) {
|
|
140
|
+
output.hookSpecificOutput = {
|
|
141
|
+
hookEventName: event,
|
|
142
|
+
additionalContext: context,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
writeOut(JSON.stringify(output));
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (isCursor) {
|
|
149
|
+
// Cursor parses stdout as JSON and treats empty stdout as "nothing to
|
|
150
|
+
// say"; raw text would be logged as a parse error. sessionStart takes
|
|
151
|
+
// additional_context into the conversation's system context;
|
|
152
|
+
// beforeSubmitPrompt needs continue:true and, in Cursor 3.20.17, injects
|
|
153
|
+
// additional_context into that turn (docs/cursor-hooks.md).
|
|
154
|
+
if (!context) return;
|
|
155
|
+
const output = { additional_context: context };
|
|
156
|
+
if (event === 'UserPromptSubmit') output.continue = true;
|
|
157
|
+
writeOut(JSON.stringify(output));
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
// Native Claude: SessionStart accepts raw stdout, but SubagentStart needs the
|
|
161
|
+
// hookSpecificOutput JSON form or the context is dropped.
|
|
162
|
+
if (event === 'SubagentStart') {
|
|
163
|
+
writeOut(JSON.stringify(
|
|
164
|
+
{ hookSpecificOutput: { hookEventName: event, additionalContext: context } }));
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
writeOut(context);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
module.exports = {
|
|
171
|
+
clearMode,
|
|
172
|
+
cursorRuleNotice,
|
|
173
|
+
cursorRulePath,
|
|
174
|
+
isCodeBuddy,
|
|
175
|
+
isCodex,
|
|
176
|
+
isCopilot,
|
|
177
|
+
isCursor,
|
|
178
|
+
isQoder,
|
|
179
|
+
readMode,
|
|
180
|
+
setMode,
|
|
181
|
+
writeHookOutput,
|
|
182
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# CLAUDE_CONFIG_DIR overrides ~/.claude, matching where the hooks write the flag (issue #34)
|
|
2
|
+
$ClaudeDir = if ($env:CLAUDE_CONFIG_DIR) { $env:CLAUDE_CONFIG_DIR } else { Join-Path $HOME ".claude" }
|
|
3
|
+
$Flag = Join-Path $ClaudeDir ".ponytail-active"
|
|
4
|
+
if (-not (Test-Path $Flag)) {
|
|
5
|
+
exit 0
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
$Mode = ""
|
|
9
|
+
try {
|
|
10
|
+
$Mode = (Get-Content $Flag -ErrorAction Stop | Select-Object -First 1).Trim()
|
|
11
|
+
} catch {
|
|
12
|
+
exit 0
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
$Esc = [char]27
|
|
16
|
+
# ultra is the high-intensity mode; flag it amber so it stands out from the
|
|
17
|
+
# default green. The level is still in the text, so color is a redundant cue.
|
|
18
|
+
$Color = if ($Mode -eq "ultra") { "173" } else { "108" }
|
|
19
|
+
if ([string]::IsNullOrEmpty($Mode) -or $Mode -eq "full") {
|
|
20
|
+
[Console]::Write("${Esc}[38;5;${Color}m[PONYTAIL]${Esc}[0m")
|
|
21
|
+
} else {
|
|
22
|
+
$Suffix = $Mode.ToUpperInvariant()
|
|
23
|
+
[Console]::Write("${Esc}[38;5;${Color}m[PONYTAIL:$Suffix]${Esc}[0m")
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# CLAUDE_CONFIG_DIR overrides ~/.claude, matching where the hooks write the flag (issue #34)
|
|
3
|
+
flag="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/.ponytail-active"
|
|
4
|
+
[ -f "$flag" ] || exit 0
|
|
5
|
+
|
|
6
|
+
mode=$(head -n1 "$flag" | tr -d '[:space:]')
|
|
7
|
+
|
|
8
|
+
# ultra is the high-intensity mode; flag it amber so it stands out from the
|
|
9
|
+
# default green at a glance. The level is still in the text, so color is a
|
|
10
|
+
# redundant cue, not the only one.
|
|
11
|
+
color=108
|
|
12
|
+
[ "$mode" = "ultra" ] && color=173
|
|
13
|
+
|
|
14
|
+
if [ -z "$mode" ] || [ "$mode" = "full" ]; then
|
|
15
|
+
printf '\033[38;5;%sm[PONYTAIL]\033[0m' "$color"
|
|
16
|
+
else
|
|
17
|
+
printf '\033[38;5;%sm[PONYTAIL:%s]\033[0m' "$color" "$(printf '%s' "$mode" | tr '[:lower:]' '[:upper:]')"
|
|
18
|
+
fi
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# ChillAgent (Español)
|
|
2
|
+
|
|
3
|
+
> **Motor Anti-Slop 2.0 y Estándar de Desarrollador Senior Pragmático para Agentes de IA.**
|
|
4
|
+
> Combina la artesanía visual de [anti-slop](https://github.com/miqdadbadjuber/anti-slop) con el minimalismo YAGNI de [ponytail](https://github.com/dietrichgebert/ponytail).
|
|
5
|
+
|
|
6
|
+
## Inicio Rápido
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
# Asistente interactivo
|
|
10
|
+
npx chill-agent@latest
|
|
11
|
+
|
|
12
|
+
# Auditoría de código
|
|
13
|
+
npx chill-agent@latest audit
|
|
14
|
+
|
|
15
|
+
# Reparación automática
|
|
16
|
+
npx chill-agent@latest audit --fix
|
|
17
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ChillAgent (Bahasa Indonesia)
|
|
2
|
+
|
|
3
|
+
> **Mesin Anti-Slop 2.0 & Standar Senior Developer Pragmatis untuk Coding Agent AI.**
|
|
4
|
+
> Menggabungkan ketelitian visual bebas-slop dari [anti-slop](https://github.com/miqdadbadjuber/anti-slop) dengan prinsip minimalis YAGNI tanpa kompromi dari [ponytail](https://github.com/dietrichgebert/ponytail).
|
|
5
|
+
|
|
6
|
+
## Perintah Cepat
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
# Jalankan wizard interaktif langsung
|
|
10
|
+
npx chill-agent@latest
|
|
11
|
+
|
|
12
|
+
# Audit file dari gradien ungu, card mengambang & copy klise
|
|
13
|
+
npx chill-agent@latest audit
|
|
14
|
+
|
|
15
|
+
# Otomatis bersihkan kode dari AI slop
|
|
16
|
+
npx chill-agent@latest audit --fix
|
|
17
|
+
|
|
18
|
+
# Buat panduan desain kelas Linear
|
|
19
|
+
npx chill-agent@latest init-design
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Prinsip Inti
|
|
23
|
+
1. **The Smallest Complete Change:** Gunakan native platform dan standard library sebelum menambah dependensi eksternal.
|
|
24
|
+
2. **The Purpose Test:** Setiap gradien, warna, atau layout harus memiliki fungsi domain yang jelas. AI defaults (gradien ungu, rounded-3xl) dilarang.
|
|
25
|
+
3. **Delivery Disclosure:** Di akhir setiap jawaban teknis, sebutkan apa yang sengaja di-skip dan batas trade-off kode.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# ChillAgent (日本語)
|
|
2
|
+
|
|
3
|
+
> **AIコーディングエージェントのためのAnti-Slop 2.0エンジン & プラグマティックシニア開発者標準**
|
|
4
|
+
> [anti-slop](https://github.com/miqdadbadjuber/anti-slop) の視覚的クラフトマンシップと [ponytail](https://github.com/dietrichgebert/ponytail) のミニマリズム(YAGNI)を統合。
|
|
5
|
+
|
|
6
|
+
## コマンド
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
# 対話型ウィザード
|
|
10
|
+
npx chill-agent@latest
|
|
11
|
+
|
|
12
|
+
# スロップの監査
|
|
13
|
+
npx chill-agent@latest audit
|
|
14
|
+
|
|
15
|
+
# 自動修復
|
|
16
|
+
npx chill-agent@latest audit --fix
|
|
17
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# ChillAgent (简体中文)
|
|
2
|
+
|
|
3
|
+
> **面向 AI 编程助手的 Anti-Slop 2.0 引擎与极简实用高级开发者标准**
|
|
4
|
+
> 融合 [anti-slop](https://github.com/miqdadbadjuber/anti-slop) 的视觉精益标准与 [ponytail](https://github.com/dietrichgebert/ponytail) 的无废话极简主义 (YAGNI)。
|
|
5
|
+
|
|
6
|
+
## 快速使用
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
# 启动交互式配置向导
|
|
10
|
+
npx chill-agent@latest
|
|
11
|
+
|
|
12
|
+
# 扫描项目中的 AI 泛滥特征
|
|
13
|
+
npx chill-agent@latest audit
|
|
14
|
+
|
|
15
|
+
# 自动修复
|
|
16
|
+
npx chill-agent@latest audit --fix
|
|
17
|
+
```
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chill-agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Zero-bloat Anti-Slop 2.0 Engine & Pragmatic Senior Developer Standard. Fuses Anti-Slop visual craftsmanship with Ponytail YAGNI minimalism across all coding agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"chill-agent": "bin/chill-agent.js"
|
|
7
|
+
"chill-agent": "bin/chill-agent.js",
|
|
8
|
+
"ponytail": "bin/chill-agent.js"
|
|
8
9
|
},
|
|
9
10
|
"main": "./src/index.js",
|
|
10
11
|
"scripts": {
|
|
11
12
|
"start": "node ./bin/chill-agent.js",
|
|
12
|
-
"test": "node --test test
|
|
13
|
+
"test": "node --test tests/manifests.test.js tests/rules.test.js test/auditor.test.js",
|
|
13
14
|
"audit": "node ./bin/chill-agent.js audit",
|
|
14
15
|
"lint": "node ./bin/chill-agent.js audit"
|
|
15
16
|
},
|
|
@@ -40,6 +41,31 @@
|
|
|
40
41
|
"rules/",
|
|
41
42
|
"commands/",
|
|
42
43
|
"docs/",
|
|
44
|
+
"examples/",
|
|
45
|
+
"benchmarks/",
|
|
46
|
+
"hooks/",
|
|
47
|
+
"i18n/",
|
|
48
|
+
"tests/",
|
|
49
|
+
"scripts/",
|
|
50
|
+
"pi-extension/",
|
|
51
|
+
".agents/",
|
|
52
|
+
".claude-plugin/",
|
|
53
|
+
".cursor/",
|
|
54
|
+
".cursor-plugin/",
|
|
55
|
+
".windsurf/",
|
|
56
|
+
".cline-plugin/",
|
|
57
|
+
".clinerules/",
|
|
58
|
+
".codex-plugin/",
|
|
59
|
+
".kimi-plugin/",
|
|
60
|
+
".omp-plugin/",
|
|
61
|
+
".devin-plugin/",
|
|
62
|
+
".grok-plugin/",
|
|
63
|
+
".qoder-plugin/",
|
|
64
|
+
".kiro/",
|
|
65
|
+
".openclaw/",
|
|
66
|
+
".opencode/",
|
|
67
|
+
"__init__.py",
|
|
68
|
+
"AGENTS.md",
|
|
43
69
|
"chillslop.md",
|
|
44
70
|
"antislop.md",
|
|
45
71
|
"GUIDE.md",
|