Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

drop session hooks, keep on-demand skills

erwanMarmelab4e8ce55b10f5
diff --git a/.claude/hooks/package.json b/.claude/hooks/package.json
deleted file mode 100644
index 5bbefffb..00000000
--- a/.claude/hooks/package.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "type": "commonjs"
-}
diff --git a/.claude/hooks/ponytail-activate.js b/.claude/hooks/ponytail-activate.js
deleted file mode 100644
index 824d94b2..00000000
--- a/.claude/hooks/ponytail-activate.js
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/env node
-// ponytail — Claude Code SessionStart activation hook
-//
-// Runs on every session start:
-// 1. Writes flag file at ~/.claude/.ponytail-active (statusline reads this)
-// 2. Emits ponytail ruleset as hidden SessionStart context
-// 3. Detects missing statusline config and emits setup nudge
-
-const fs = require("fs");
-const path = require("path");
-const { getDefaultMode, getClaudeDir } = require("./ponytail-config");
-const { getPonytailInstructions } = require("./ponytail-instructions");
-const {
- clearMode,
- isCodex,
- setMode,
- writeHookOutput,
-} = require("./ponytail-runtime");
-
-const claudeDir = getClaudeDir();
-const settingsPath = path.join(claudeDir, "settings.json");
-
-const mode = getDefaultMode();
-
-// "off" mode — skip activation entirely, don't write flag or emit rules
-if (mode === "off") {
- clearMode();
- writeHookOutput("SessionStart", "off", isCodex ? "" : "OK");
- process.exit(0);
-}
-
-// 1. Write flag file
-try {
- setMode(mode);
-} catch (e) {
- // Silent fail -- flag is best-effort, don't block the hook
-}
-
-// 2. Emit the ponytail ruleset, filtered to the active intensity level.
-let output = getPonytailInstructions(mode);
-
-// 3. Detect missing statusline config — nudge Claude to help set it up
-if (!isCodex)
- try {
- let hasStatusline = false;
- if (fs.existsSync(settingsPath)) {
- const settings = JSON.parse(fs.readFileSync(settingsPath, "utf8"));
- if (settings.statusLine) {
- hasStatusline = true;
- }
- }
-
- if (!hasStatusline) {
- const isWindows = process.platform === "win32";
- const scriptName = isWindows
- ? "ponytail-statusline.ps1"
- : "ponytail-statusline.sh";
- const scriptPath = path.join(__dirname, scriptName);
- const command = isWindows
- ? `powershell -ExecutionPolicy Bypass -File "${scriptPath}"`
- : `bash "${scriptPath}"`;
- const statusLineSnippet =
- '"statusLine": { "type": "command", "command": ' +
- JSON.stringify(command) +
- " }";
- output +=
- "\n\n" +
- "STATUSLINE SETUP NEEDED: The ponytail plugin includes a statusline badge showing active mode " +
- "(e.g. [PONYTAIL], [PONYTAIL:ULTRA]). It is not configured yet. " +
- "To enable, add this to ~/.claude/settings.json: " +
- statusLineSnippet +
- " " +
- "Proactively offer to set this up for the user on first interaction.";
- }
- } catch (e) {
- // Silent fail — don't block session start over statusline detection
- }
-
-writeHookOutput("SessionStart", mode, output);
diff --git a/.claude/hooks/ponytail-config.js b/.claude/hooks/ponytail-config.js
deleted file mode 100644
index a4efed38..00000000
--- a/.claude/hooks/ponytail-config.js
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/usr/bin/env node
-// ponytail — shared configuration resolver
-//
-// Resolution order for default mode:
-// 1. PONYTAIL_DEFAULT_MODE environment variable
-// 2. Config file defaultMode field:
-// - $XDG_CONFIG_HOME/ponytail/config.json (any platform, if set)
-// - ~/.config/ponytail/config.json (macOS / Linux fallback)
-// - %APPDATA%\ponytail\config.json (Windows fallback)
-// 3. 'full'
-
-const fs = require("fs");
-const path = require("path");
-const os = require("os");
-
-const DEFAULT_MODE = "full";
-const VALID_MODES = ["off", "lite", "full", "ultra", "review"];
-const RUNTIME_MODES = ["off", "lite", "full", "ultra"];
-
-function normalizeMode(mode) {
- if (typeof mode !== "string") return null;
- const normalized = mode.trim().toLowerCase();
- return RUNTIME_MODES.includes(normalized) ? normalized : null;
-}
-
-function normalizeConfigMode(mode) {
- if (typeof mode !== "string") return null;
- const normalized = mode.trim().toLowerCase();
- return VALID_MODES.includes(normalized) ? normalized : null;
-}
-
-function normalizePersistedMode(mode) {
- return normalizeMode(mode) || normalizeConfigMode(mode);
-}
-
-function getConfigDir() {
- if (process.env.XDG_CONFIG_HOME) {
- return path.join(process.env.XDG_CONFIG_HOME, "ponytail");
- }
- if (process.platform === "win32") {
- return path.join(
- process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming"),
- "ponytail",
- );
- }
- return path.join(os.homedir(), ".config", "ponytail");
-}
-
-function getConfigPath() {
- return path.join(getConfigDir(), "config.json");
-}
-
-function getClaudeDir() {
- // ponytail: CLAUDE_CONFIG_DIR overrides ~/.claude, matching Claude Code.
- return process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), ".claude");
-}
-
-function getDefaultMode() {
- // 1. Environment variable (highest priority)
- const envMode = process.env.PONYTAIL_DEFAULT_MODE;
- if (envMode && VALID_MODES.includes(envMode.toLowerCase())) {
- return envMode.toLowerCase();
- }
-
- // 2. Config file
- try {
- const configPath = getConfigPath();
- const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
- if (
- config.defaultMode &&
- VALID_MODES.includes(config.defaultMode.toLowerCase())
- ) {
- return config.defaultMode.toLowerCase();
- }
- } catch (e) {
- // Config file doesn't exist or is invalid — fall through
- }
-
- // 3. Default
- return DEFAULT_MODE;
-}
-
-function writeDefaultMode(mode) {
- const normalized = normalizeConfigMode(mode);
- if (!normalized) return null;
-
- const configPath = getConfigPath();
- fs.mkdirSync(path.dirname(configPath), { recursive: true });
- fs.writeFileSync(
- configPath,
- JSON.stringify({ defaultMode: normalized }, null, 2),
- "utf8",
- );
- return normalized;
-}
-
-module.exports = {
- DEFAULT_MODE,
- VALID_MODES,
- RUNTIME_MODES,
- getDefaultMode,
- getConfigDir,
- getConfigPath,
- getClaudeDir,
- normalizeMode,
- normalizeConfigMode,
- normalizePersistedMode,
- writeDefaultMode,
-};
diff --git a/.claude/hooks/ponytail-instructions.js b/.claude/hooks/ponytail-instructions.js
deleted file mode 100644
index 2775df58..00000000
--- a/.claude/hooks/ponytail-instructions.js
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/usr/bin/env node
-// Shared Ponytail instruction builder for Claude hooks and Pi extension.
-
-const fs = require("fs");
-const path = require("path");
-const {
- DEFAULT_MODE,
- normalizeMode,
- normalizePersistedMode,
-} = require("./ponytail-config");
-
-const INDEPENDENT_MODES = new Set(["review"]);
-const SKILL_PATH = path.join(__dirname, "..", "skills", "ponytail", "SKILL.md");
-
-function filterSkillBodyForMode(body, mode) {
- const effectiveMode = normalizeMode(mode) || DEFAULT_MODE;
- const withoutFrontmatter = String(body || "").replace(
- /^---[\s\S]*?---\s*/,
- "",
- );
-
- // Only the intensity table rows and worked examples are mode-specific, and
- // both are keyed by a mode name (lite/full/ultra). A bullet whose label is
- // not a mode — e.g. "No unrequested abstractions: ..." — is a normal rule
- // and must be kept verbatim.
- return withoutFrontmatter
- .split(/\r?\n/)
- .filter((line) => {
- const tableLabel = line.match(/^\|\s*\*\*(.+?)\*\*\s*\|/);
- if (tableLabel) {
- const labelMode = normalizeMode(tableLabel[1].trim());
- if (labelMode) return labelMode === effectiveMode;
- }
-
- const exampleLabel = line.match(/^-\s*([^:]+):\s*/);
- if (exampleLabel) {
- const labelMode = normalizeMode(exampleLabel[1].trim());
- if (labelMode) return labelMode === effectiveMode;
- }
-
- return true;
- })
- .join("\n");
-}
-
-function getFallbackInstructions(mode) {
- return (
- "PONYTAIL MODE ACTIVE — level: " +
- mode +
- "\n\n" +
- "You are a lazy senior developer. Lazy means efficient, not careless. The best code is the code never written.\n\n" +
- "## Persistence\n\n" +
- 'ACTIVE EVERY RESPONSE. No drift back to over-building. Still active if unsure. Off only: "stop ponytail" / "normal mode".\n\n' +
- "Current level: **" +
- mode +
- "**. Switch: `/ponytail lite|full|ultra`.\n\n" +
- "## The ladder\n\n" +
- "Before any code, stop at the first rung that holds:\n" +
- "1. Does this need to be built at all? (YAGNI)\n" +
- "2. Does the standard library do this? Use it.\n" +
- "3. Does a native platform feature cover it? Use it.\n" +
- "4. Does an already-installed dependency solve it? Use it.\n" +
- "5. Can this be one line? Make it one line.\n" +
- "6. Only then: write the minimum code that works.\n\n" +
- "## Rules\n\n" +
- "No abstractions that were not requested. No avoidable dependencies. No boilerplate nobody asked for. " +
- "Deletion over addition. Boring over clever. Fewest files possible. " +
- "Ship the lazy version and question the complex request in the same response — never stall. " +
- "Between two same-size stdlib options, pick the one correct on edge cases. " +
- "Mark intentional simplifications with a `ponytail:` comment — a shortcut with a known ceiling names the ceiling and the upgrade path in the comment.\n\n" +
- "## Output\n\n" +
- "Code first. Then at most three short lines: what was skipped, when to add it. " +
- "If the explanation is longer than the code, delete the explanation. " +
- "Explanation the user explicitly asked for is not debt, give it in full.\n\n" +
- "## When NOT to be lazy\n\n" +
- "Never simplify away: input validation at trust boundaries, error handling that prevents data loss, " +
- "security measures, accessibility basics, the calibration real hardware needs (the platform is never the spec ideal), anything the user explicitly asked to keep. " +
- "Lazy code without its check is unfinished: non-trivial logic leaves ONE runnable check behind (assert-based demo/self-check or one small test file; no frameworks). Trivial one-liners need no test.\n\n" +
- "## Boundaries\n\n" +
- 'Ponytail governs what you build, not how you talk. "stop ponytail" or "normal mode": revert. Level persists until changed or session end.'
- );
-}
-
-function getPonytailInstructions(mode) {
- const configuredMode = normalizePersistedMode(mode) || DEFAULT_MODE;
-
- if (INDEPENDENT_MODES.has(configuredMode)) {
- return (
- "PONYTAIL MODE ACTIVE — level: " +
- configuredMode +
- ". Behavior defined by /ponytail-" +
- configuredMode +
- " skill."
- );
- }
-
- const effectiveMode = normalizeMode(configuredMode) || DEFAULT_MODE;
-
- try {
- return (
- "PONYTAIL MODE ACTIVE — level: " +
- effectiveMode +
- "\n\n" +
- filterSkillBodyForMode(fs.readFileSync(SKILL_PATH, "utf8"), effectiveMode)
- );
- } catch (e) {
- return getFallbackInstructions(effectiveMode);
- }
-}
-
-module.exports = {
- filterSkillBodyForMode,
- getFallbackInstructions,
- getPonytailInstructions,
-};
diff --git a/.claude/hooks/ponytail-mode-tracker.js b/.claude/hooks/ponytail-mode-tracker.js
deleted file mode 100644
index 72082c83..00000000
--- a/.claude/hooks/ponytail-mode-tracker.js
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env node
-// ponytail — UserPromptSubmit hook to track which ponytail mode is active
-// Inspects user input for /ponytail commands and writes mode to flag file
-
-const { getDefaultMode } = require("./ponytail-config");
-const { clearMode, setMode, writeHookOutput } = require("./ponytail-runtime");
-
-let input = "";
-process.stdin.on("data", (chunk) => {
- input += chunk;
-});
-process.stdin.on("end", () => {
- try {
- // Strip UTF-8 BOM some shells prepend when piping (breaks JSON.parse)
- const data = JSON.parse(input.replace(/^\uFEFF/, ""));
- const prompt = (data.prompt || "").trim().toLowerCase();
-
- // Match /ponytail commands
- if (/^[/@$]ponytail/.test(prompt)) {
- const parts = prompt.split(/\s+/);
- const cmd = parts[0].replace(/^[@$]/, "/");
- const arg = parts[1] || "";
-
- let mode = null;
-
- if (cmd === "/ponytail-review" || cmd === "/ponytail:ponytail-review") {
- mode = "review";
- } else if (cmd === "/ponytail" || cmd === "/ponytail:ponytail") {
- if (arg === "lite") mode = "lite";
- else if (arg === "full") mode = "full";
- else if (arg === "ultra") mode = "ultra";
- else if (arg === "off") mode = "off";
- else mode = getDefaultMode();
- }
-
- if (mode && mode !== "off") {
- setMode(mode);
- writeHookOutput(
- "UserPromptSubmit",
- mode,
- "PONYTAIL MODE CHANGED — level: " + mode,
- );
- } else if (mode === "off") {
- clearMode();
- writeHookOutput("UserPromptSubmit", "off", "PONYTAIL MODE OFF");
- }
- }
-
- // Detect deactivation
- if (/\b(stop ponytail|normal mode)\b/i.test(prompt)) {
- clearMode();
- writeHookOutput("UserPromptSubmit", "off", "PONYTAIL MODE OFF");
- }
- } catch (e) {
- // Silent fail
- }
-});
diff --git a/.claude/hooks/ponytail-runtime.js b/.claude/hooks/ponytail-runtime.js
deleted file mode 100644
index 4db199d2..00000000
--- a/.claude/hooks/ponytail-runtime.js
+++ /dev/null
@@ -1,58 +0,0 @@
-const fs = require("fs");
-const path = require("path");
-const { getClaudeDir } = require("./ponytail-config");
-
-const STATE_FILE = ".ponytail-active";
-const isCopilot = Boolean(process.env.COPILOT_PLUGIN_DATA);
-const isCodex = !isCopilot && Boolean(process.env.PLUGIN_DATA);
-
-let stateDir = getClaudeDir();
-if (isCodex) stateDir = process.env.PLUGIN_DATA;
-if (isCopilot) stateDir = process.env.COPILOT_PLUGIN_DATA;
-
-const statePath = path.join(stateDir, STATE_FILE);
-
-function setMode(mode) {
- fs.mkdirSync(path.dirname(statePath), { recursive: true });
- fs.writeFileSync(statePath, mode);
-}
-
-function clearMode() {
- try {
- fs.unlinkSync(statePath);
- } catch (e) {}
-}
-
-function writeHookOutput(event, mode, context = "") {
- if (isCopilot) {
- // Copilot reads additionalContext on SessionStart; ignores output elsewhere.
- process.stdout.write(
- JSON.stringify(
- event === "SessionStart" && context
- ? { additionalContext: context }
- : {},
- ),
- );
- return;
- }
- if (isCodex) {
- const output = { systemMessage: `PONYTAIL:${mode.toUpperCase()}` };
- if (context) {
- output.hookSpecificOutput = {
- hookEventName: event,
- additionalContext: context,
- };
- }
- process.stdout.write(JSON.stringify(output));
- return;
- }
- process.stdout.write(context);
-}
-
-module.exports = {
- clearMode,
- isCodex,
- isCopilot,
- setMode,
- writeHookOutput,
-};
diff --git a/.claude/hooks/ponytail-statusline.ps1 b/.claude/hooks/ponytail-statusline.ps1
deleted file mode 100644
index d9fe437c..00000000
--- a/.claude/hooks/ponytail-statusline.ps1
+++ /dev/null
@@ -1,19 +0,0 @@
-$Flag = Join-Path $HOME ".claude/.ponytail-active"
-if (-not (Test-Path $Flag)) {
- exit 0
-}
-
-$Mode = ""
-try {
- $Mode = (Get-Content $Flag -ErrorAction Stop | Select-Object -First 1).Trim()
-} catch {
- exit 0
-}
-
-$Esc = [char]27
-if ([string]::IsNullOrEmpty($Mode) -or $Mode -eq "full") {
- [Console]::Write("${Esc}[38;5;108m[PONYTAIL]${Esc}[0m")
-} else {
- $Suffix = $Mode.ToUpperInvariant()
- [Console]::Write("${Esc}[38;5;108m[PONYTAIL:$Suffix]${Esc}[0m")
-}
diff --git a/.claude/hooks/ponytail-statusline.sh b/.claude/hooks/ponytail-statusline.sh
deleted file mode 100644
index 5e83a273..00000000
--- a/.claude/hooks/ponytail-statusline.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env bash
-flag="$HOME/.claude/.ponytail-active"
-[ -f "$flag" ] || exit 0
-
-mode=$(head -n1 "$flag" | tr -d '[:space:]')
-
-if [ -z "$mode" ] || [ "$mode" = "full" ]; then
- printf '\033[38;5;108m[PONYTAIL]\033[0m'
-else
- printf '\033[38;5;108m[PONYTAIL:%s]\033[0m' "$(printf '%s' "$mode" | tr '[:lower:]' '[:upper:]')"
-fi
diff --git a/.claude/settings.json b/.claude/settings.json
index cd62d6b0..7338f9b7 100644
--- a/.claude/settings.json
+++ b/.claude/settings.json
@@ -22,31 +22,6 @@
"pr": ""
},
"hooks": {
- "SessionStart": [
- {
- "matcher": "startup|resume|clear|compact",
- "hooks": [
- {
- "type": "command",
- "command": "command -v node >/dev/null 2>&1 && node \"$CLAUDE_PROJECT_DIR/.claude/hooks/ponytail-activate.js\" || exit 0",
- "timeout": 5,
- "statusMessage": "Loading ponytail mode..."
- }
- ]
- }
- ],
- "UserPromptSubmit": [
- {
- "hooks": [
- {
- "type": "command",
- "command": "command -v node >/dev/null 2>&1 && node \"$CLAUDE_PROJECT_DIR/.claude/hooks/ponytail-mode-tracker.js\" || exit 0",
- "timeout": 5,
- "statusMessage": "Tracking ponytail mode..."
- }
- ]
- }
- ],
"PreToolUse": [
{
"matcher": "Bash",
diff --git a/CLAUDE.md b/CLAUDE.md
index ec55c43a..bf8df867 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -36,7 +36,7 @@ There is no cross-agent messaging: the orchestrator dispatches every agent as a
Only **developer** runs on opus; everything else is sonnet or haiku.
-The **developer** and **simple-developer** apply the **Ponytail** minimization ladder (full mode) on every change, via inline directives in their prompts. Ponytail is installed **natively** in-repo (no plugin or marketplace): its skills live in `.claude/skills/ponytail*`, its `/ponytail*` commands in `.claude/commands/`, and its `SessionStart` / `UserPromptSubmit` hooks are wired in `.claude/settings.json` to `.claude/hooks/ponytail-*.js` (CommonJS scripts — `.claude/hooks/package.json` pins them to `commonjs` since the repo is an ESM package). It provides orchestrator-level guidance and the manual `/ponytail*` commands — but those `SessionStart` / `UserPromptSubmit` hooks reach only the main session, NOT `Agent`-dispatched subagents, which is why the dev agents get the ladder inline rather than from the hooks.
+The **developer** and **simple-developer** apply the **Ponytail** minimization ladder (full mode) on every change, via inline directives in their prompts — the only mechanism that reaches `Agent`-dispatched subagents. Ponytail is also installed **natively** in-repo as on-demand skills (no plugin, no marketplace, no hooks): its skills live in `.claude/skills/ponytail*` and its `/ponytail*` commands in `.claude/commands/`, for interactive use in the main session (`/ponytail-review`, `/ponytail-audit`, …). These do not affect the dev agents, whose ladder comes from the inline directives above.
## The orchestrator's job between hand-offs