diff --git a/package.json b/package.json new file mode 100644 index 0000000..f93e02f --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "node-lief": "^1.0.0" + } +} diff --git a/scripts/package.json b/scripts/package.json new file mode 100644 index 0000000..f93e02f --- /dev/null +++ b/scripts/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "node-lief": "^1.0.0" + } +} diff --git a/scripts/setup.sh b/scripts/setup.sh old mode 100644 new mode 100755 diff --git a/system-prompt/2.1.112/backup-cli.sh b/system-prompt/2.1.112/backup-cli.sh new file mode 100755 index 0000000..eb2fd70 --- /dev/null +++ b/system-prompt/2.1.112/backup-cli.sh @@ -0,0 +1,87 @@ +#!/bin/bash +# Backup script for Claude Code CLI bundle +# Only backs up if the file matches the known original hash + +set -e + +# Known original - update these when Claude Code updates +EXPECTED_VERSION="2.1.112" +EXPECTED_HASH="bc3358282800e3e99daa8e71ac5b7b1566bd0d7ca7eb94f714a7859365d3163f" + +# Find claude CLI using which and common locations +get_claude_cli() { + # Method 1: Use 'which claude' and follow symlinks + local claude_bin=$(which claude 2>/dev/null) + if [ -n "$claude_bin" ]; then + local real_path=$(realpath "$claude_bin") + local cli_path=$(dirname "$real_path")/cli.js + if [ -f "$cli_path" ]; then + echo "$cli_path" + return 0 + fi + fi + + # Method 2: Check common npm global locations + for loc in "/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js" \ + "/usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js"; do + if [ -f "$loc" ]; then + echo "$loc" + return 0 + fi + done + + # Method 3: Check local install location + local claude_launcher="$HOME/.claude/local/claude" + if [ -f "$claude_launcher" ]; then + local bin_path=$(grep 'exec' "$claude_launcher" | head -1 | sed 's/.*exec "\([^"]*\)".*/\1/') + [ -n "$bin_path" ] && realpath "$bin_path" + return 0 + fi + + return 1 +} + +# Allow custom path for testing, otherwise find it dynamically +if [ -n "$1" ]; then + CLI_PATH="$1" +else + CLI_PATH=$(get_claude_cli) + if [ -z "$CLI_PATH" ]; then + echo "Error: Could not find claude CLI. Is claude installed?" + exit 1 + fi +fi +BACKUP_PATH="$CLI_PATH.backup" + +# Check if backup already exists +if [ -f "$BACKUP_PATH" ]; then + echo "Error: Backup already exists at $BACKUP_PATH" + echo "Delete it manually if you want to create a new backup." + exit 1 +fi + +# Check if cli.js exists +if [ ! -f "$CLI_PATH" ]; then + echo "Error: CLI not found at $CLI_PATH" + exit 1 +fi + +# Compute current hash +CURRENT_HASH=$(shasum -a 256 "$CLI_PATH" | cut -d' ' -f1) + +# Compare hashes +if [ "$CURRENT_HASH" != "$EXPECTED_HASH" ]; then + echo "Error: Hash mismatch - file may be modified or different version" + echo "" + echo "Expected (v$EXPECTED_VERSION): $EXPECTED_HASH" + echo "Current: $CURRENT_HASH" + echo "" + echo "If Claude Code was updated, update EXPECTED_VERSION and EXPECTED_HASH in this script." + exit 1 +fi + +# Create backup +cp "$CLI_PATH" "$BACKUP_PATH" +echo "Backup created: $BACKUP_PATH" +echo "Version: $EXPECTED_VERSION" +echo "Hash: $EXPECTED_HASH" diff --git a/system-prompt/2.1.112/native-extract.js b/system-prompt/2.1.112/native-extract.js new file mode 100755 index 0000000..c4e6d55 --- /dev/null +++ b/system-prompt/2.1.112/native-extract.js @@ -0,0 +1,155 @@ +#!/usr/bin/env node +/** + * Extract cli.js from Claude Code native binary + * Supports ELF (Linux) and Mach-O (macOS) formats + */ + +const LIEF = require("node-lief"); +const fs = require("fs"); + +const BUN_TRAILER = Buffer.from("\n---- Bun! ----\n"); +const SIZEOF_OFFSETS = 32; +const SIZEOF_STRING_POINTER = 8; +const SIZEOF_MODULE_V1 = 4 * SIZEOF_STRING_POINTER + 4; // 36 bytes (Bun < 1.3.9) +const SIZEOF_MODULE_V2 = 4 * SIZEOF_STRING_POINTER + 4 + 16; // 52 bytes (Bun >= 1.3.9, added extra field) + +function detectModuleSize(modulesListLength) { + if (modulesListLength % SIZEOF_MODULE_V2 === 0) return SIZEOF_MODULE_V2; + if (modulesListLength % SIZEOF_MODULE_V1 === 0) return SIZEOF_MODULE_V1; + return SIZEOF_MODULE_V1; // fallback +} + +function parseStringPointer(buffer, offset) { + return { offset: buffer.readUInt32LE(offset), length: buffer.readUInt32LE(offset + 4) }; +} + +function parseOffsets(buffer) { + let pos = 0; + const byteCount = buffer.readBigUInt64LE(pos); pos += 8; + const modulesPtr = parseStringPointer(buffer, pos); pos += 8; + const entryPointId = buffer.readUInt32LE(pos); pos += 4; + const compileExecArgvPtr = parseStringPointer(buffer, pos); + return { byteCount, modulesPtr, entryPointId, compileExecArgvPtr }; +} + +function getStringPointerContent(buffer, sp) { + return buffer.subarray(sp.offset, sp.offset + sp.length); +} + +function parseModule(buffer, offset) { + let pos = offset; + return { + name: parseStringPointer(buffer, pos), contents: parseStringPointer(buffer, pos + 8), + sourcemap: parseStringPointer(buffer, pos + 16), bytecode: parseStringPointer(buffer, pos + 24), + encoding: buffer.readUInt8(pos + 32), loader: buffer.readUInt8(pos + 33), + moduleFormat: buffer.readUInt8(pos + 34), side: buffer.readUInt8(pos + 35) + }; +} + +function isClaudeModule(name) { + return name.endsWith("/claude") || name === "claude" || + name.endsWith("/claude.exe") || name === "claude.exe" || + name.endsWith("/cli.js"); +} + +function extractBunDataFromSection(sectionData) { + // Try u64 header first (Bun >= 1.3.4), then u32 + const bunDataSizeU64 = sectionData.length >= 8 ? Number(sectionData.readBigUInt64LE(0)) : 0; + const bunDataSizeU32 = sectionData.readUInt32LE(0); + + let headerSize, bunDataSize; + if (sectionData.length >= 8 && 8 + bunDataSizeU64 <= sectionData.length && 8 + bunDataSizeU64 >= sectionData.length - 4096) { + headerSize = 8; bunDataSize = bunDataSizeU64; + } else if (4 + bunDataSizeU32 <= sectionData.length && 4 + bunDataSizeU32 >= sectionData.length - 4096) { + headerSize = 4; bunDataSize = bunDataSizeU32; + } else { + throw new Error("Cannot determine section header format"); + } + + const bunDataContent = sectionData.subarray(headerSize, headerSize + bunDataSize); + const trailerStart = bunDataContent.length - BUN_TRAILER.length; + const offsetsStart = bunDataContent.length - SIZEOF_OFFSETS - BUN_TRAILER.length; + const offsetsBytes = bunDataContent.subarray(offsetsStart, offsetsStart + SIZEOF_OFFSETS); + + return { bunOffsets: parseOffsets(offsetsBytes), bunData: bunDataContent, sectionHeaderSize: headerSize }; +} + +function extractFromELFOverlay(binary) { + const overlay = binary.overlay; + const offsetsStart = overlay.length - 8 - BUN_TRAILER.length - SIZEOF_OFFSETS; + const offsetsBytes = overlay.subarray(offsetsStart, overlay.length - 8 - BUN_TRAILER.length); + const bunOffsets = parseOffsets(offsetsBytes); + const tailDataLen = 8 + BUN_TRAILER.length + SIZEOF_OFFSETS; + const dataStart = overlay.length - tailDataLen - Number(bunOffsets.byteCount); + const dataRegion = overlay.subarray(dataStart, overlay.length - tailDataLen); + const trailerBytes = overlay.subarray(overlay.length - 8 - BUN_TRAILER.length, overlay.length - 8); + return { bunOffsets, bunData: Buffer.concat([dataRegion, offsetsBytes, trailerBytes]) }; +} + +function extractFromELFRaw(binaryPath) { + const buf = fs.readFileSync(binaryPath); + const trailerIdx = buf.lastIndexOf(BUN_TRAILER); + if (trailerIdx === -1) throw new Error("Bun trailer not found in binary"); + const offsetsStart = trailerIdx - SIZEOF_OFFSETS; + const offsetsBytes = buf.subarray(offsetsStart, trailerIdx); + const bunOffsets = parseOffsets(offsetsBytes); + const dataStart = offsetsStart - Number(bunOffsets.byteCount); + const bunData = buf.subarray(dataStart, trailerIdx + BUN_TRAILER.length); + return { bunOffsets, bunData, dataStartInFile: dataStart }; +} + +function extractFromELF(binary, binaryPath) { + if (binary.hasOverlay && binary.overlay.length > 0) { + return extractFromELFOverlay(binary); + } + return extractFromELFRaw(binaryPath); +} + +function extractFromMachO(binary) { + const bunSegment = binary.getSegment("__BUN"); + if (!bunSegment) throw new Error("__BUN segment not found"); + const bunSection = bunSegment.getSection("__bun"); + if (!bunSection) throw new Error("__bun section not found"); + return extractBunDataFromSection(bunSection.content); +} + +function extract(binaryPath) { + LIEF.logging.disable(); + const binary = LIEF.parse(binaryPath); + + let bunData, bunOffsets; + if (binary.format === "ELF") { + ({ bunData, bunOffsets } = extractFromELF(binary, binaryPath)); + } else if (binary.format === "MachO") { + ({ bunData, bunOffsets } = extractFromMachO(binary)); + } else { + throw new Error(`Unsupported format: ${binary.format}`); + } + + const modulesListBytes = getStringPointerContent(bunData, bunOffsets.modulesPtr); + const moduleSize = detectModuleSize(modulesListBytes.length); + const modulesCount = Math.floor(modulesListBytes.length / moduleSize); + + for (let i = 0; i < modulesCount; i++) { + const module = parseModule(modulesListBytes, i * moduleSize); + const moduleName = getStringPointerContent(bunData, module.name).toString("utf-8"); + if (isClaudeModule(moduleName)) { + return getStringPointerContent(bunData, module.contents); + } + } + throw new Error("Claude module not found"); +} + +// Main +const binaryPath = process.argv[2] || `${process.env.HOME}/.local/share/claude/versions/2.1.17`; +const outputPath = process.argv[3] || "/tmp/native-cli.js"; + +try { + console.log(`Extracting from: ${binaryPath}`); + const cliJs = extract(binaryPath); + fs.writeFileSync(outputPath, cliJs); + console.log(`Extracted to: ${outputPath} (${cliJs.length} bytes)`); +} catch (err) { + console.error("Error:", err.message); + process.exit(1); +} diff --git a/system-prompt/2.1.112/native-repack.js b/system-prompt/2.1.112/native-repack.js new file mode 100755 index 0000000..d94828e --- /dev/null +++ b/system-prompt/2.1.112/native-repack.js @@ -0,0 +1,255 @@ +#!/usr/bin/env node +/** + * Repack patched cli.js into Claude Code native binary + * Uses in-place replacement to avoid issues with overlapping Bun string pointers + * Supports ELF (Linux) and Mach-O (macOS) formats + */ + +const LIEF = require("node-lief"); +const fs = require("fs"); +const { execSync } = require("child_process"); + +const BUN_TRAILER = Buffer.from("\n---- Bun! ----\n"); +const SIZEOF_OFFSETS = 32; +const SIZEOF_STRING_POINTER = 8; +const SIZEOF_MODULE_V1 = 4 * SIZEOF_STRING_POINTER + 4; // 36 bytes (Bun < 1.3.9) +const SIZEOF_MODULE_V2 = 4 * SIZEOF_STRING_POINTER + 4 + 16; // 52 bytes (Bun >= 1.3.9, added extra field) + +function detectModuleSize(modulesListLength) { + if (modulesListLength % SIZEOF_MODULE_V2 === 0) return SIZEOF_MODULE_V2; + if (modulesListLength % SIZEOF_MODULE_V1 === 0) return SIZEOF_MODULE_V1; + return SIZEOF_MODULE_V1; // fallback +} + +function parseStringPointer(buffer, offset) { + return { offset: buffer.readUInt32LE(offset), length: buffer.readUInt32LE(offset + 4) }; +} + +function writeStringPointer(buffer, offset, sp) { + buffer.writeUInt32LE(sp.offset, offset); + buffer.writeUInt32LE(sp.length, offset + 4); +} + +function parseOffsets(buffer) { + let pos = 0; + const byteCount = buffer.readBigUInt64LE(pos); pos += 8; + const modulesPtr = parseStringPointer(buffer, pos); pos += 8; + const entryPointId = buffer.readUInt32LE(pos); pos += 4; + const compileExecArgvPtr = parseStringPointer(buffer, pos); + return { byteCount, modulesPtr, entryPointId, compileExecArgvPtr }; +} + +function getStringPointerContent(buffer, sp) { + return buffer.subarray(sp.offset, sp.offset + sp.length); +} + +function parseModule(buffer, offset) { + let pos = offset; + return { + name: parseStringPointer(buffer, pos), contents: parseStringPointer(buffer, pos + 8), + sourcemap: parseStringPointer(buffer, pos + 16), bytecode: parseStringPointer(buffer, pos + 24), + encoding: buffer.readUInt8(pos + 32), loader: buffer.readUInt8(pos + 33), + moduleFormat: buffer.readUInt8(pos + 34), side: buffer.readUInt8(pos + 35) + }; +} + +function isClaudeModule(name) { + return name.endsWith("/claude") || name === "claude" || + name.endsWith("/claude.exe") || name === "claude.exe" || + name.endsWith("/cli.js"); +} + +function extractBunDataFromSection(sectionData) { + const bunDataSizeU64 = sectionData.length >= 8 ? Number(sectionData.readBigUInt64LE(0)) : 0; + const bunDataSizeU32 = sectionData.readUInt32LE(0); + let headerSize, bunDataSize; + if (sectionData.length >= 8 && 8 + bunDataSizeU64 <= sectionData.length && 8 + bunDataSizeU64 >= sectionData.length - 4096) { + headerSize = 8; bunDataSize = bunDataSizeU64; + } else if (4 + bunDataSizeU32 <= sectionData.length && 4 + bunDataSizeU32 >= sectionData.length - 4096) { + headerSize = 4; bunDataSize = bunDataSizeU32; + } else { + throw new Error("Cannot determine section header format"); + } + const bunDataContent = sectionData.subarray(headerSize, headerSize + bunDataSize); + const offsetsStart = bunDataContent.length - SIZEOF_OFFSETS - BUN_TRAILER.length; + const offsetsBytes = bunDataContent.subarray(offsetsStart, offsetsStart + SIZEOF_OFFSETS); + return { bunOffsets: parseOffsets(offsetsBytes), bunData: bunDataContent, sectionHeaderSize: headerSize }; +} + +function extractFromELFOverlay(binary) { + const overlay = binary.overlay; + const offsetsStart = overlay.length - 8 - BUN_TRAILER.length - SIZEOF_OFFSETS; + const offsetsBytes = overlay.subarray(offsetsStart, overlay.length - 8 - BUN_TRAILER.length); + const bunOffsets = parseOffsets(offsetsBytes); + const tailDataLen = 8 + BUN_TRAILER.length + SIZEOF_OFFSETS; + const dataStart = overlay.length - tailDataLen - Number(bunOffsets.byteCount); + const dataRegion = overlay.subarray(dataStart, overlay.length - tailDataLen); + const trailerBytes = overlay.subarray(overlay.length - 8 - BUN_TRAILER.length, overlay.length - 8); + return { bunOffsets, bunData: Buffer.concat([dataRegion, offsetsBytes, trailerBytes]), dataStart, useRaw: false }; +} + +function extractFromELFRaw(binaryPath) { + const buf = fs.readFileSync(binaryPath); + const trailerIdx = buf.lastIndexOf(BUN_TRAILER); + if (trailerIdx === -1) throw new Error("Bun trailer not found in binary"); + const offsetsStart = trailerIdx - SIZEOF_OFFSETS; + const offsetsBytes = buf.subarray(offsetsStart, trailerIdx); + const bunOffsets = parseOffsets(offsetsBytes); + const dataStartInFile = offsetsStart - Number(bunOffsets.byteCount); + const bunData = buf.subarray(dataStartInFile, trailerIdx + BUN_TRAILER.length); + return { bunOffsets, bunData, dataStartInFile, useRaw: true }; +} + +function extractFromELF(binary, binaryPath) { + if (binary.hasOverlay && binary.overlay.length > 0) { + return extractFromELFOverlay(binary); + } + return extractFromELFRaw(binaryPath); +} + +function extractFromMachO(binary) { + const bunSegment = binary.getSegment("__BUN"); + if (!bunSegment) throw new Error("__BUN segment not found"); + const bunSection = bunSegment.getSection("__bun"); + if (!bunSection) throw new Error("__bun section not found"); + return extractBunDataFromSection(bunSection.content); +} + +/** + * In-place replacement of cli.js contents within the bun data buffer. + * The old rebuildBunData approach copied each module's strings separately, + * but Bun uses overlapping string pointers (shared memory regions), causing + * the rebuilt buffer to be ~13x larger than the original (1.5GB vs 118MB). + * + * This approach writes the patched content directly over the original location, + * padding with semicolons if the patched content is smaller. The module's + * contents length pointer is updated to reflect the new size (without padding). + */ +function patchBunDataInPlace(bunData, bunOffsets, modifiedClaudeJs) { + const modulesListBytes = getStringPointerContent(bunData, bunOffsets.modulesPtr); + const moduleSize = detectModuleSize(modulesListBytes.length); + const modulesCount = Math.floor(modulesListBytes.length / moduleSize); + + for (let i = 0; i < modulesCount; i++) { + const module = parseModule(modulesListBytes, i * moduleSize); + const moduleName = getStringPointerContent(bunData, module.name).toString("utf-8"); + + if (isClaudeModule(moduleName)) { + const origSize = module.contents.length; + const newSize = modifiedClaudeJs.length; + + if (newSize > origSize) { + throw new Error(`Patched cli.js (${newSize} bytes) is larger than original (${origSize} bytes). In-place replacement requires patched content to be <= original size.`); + } + + // Write patched content at the original location + modifiedClaudeJs.copy(bunData, module.contents.offset); + + // Pad remaining space with semicolons (valid JS no-ops) + if (newSize < origSize) { + bunData.fill(0x3B, module.contents.offset + newSize, module.contents.offset + origSize); // 0x3B = ';' + } + + // Update the contents length in the module list to reflect actual content size. + // The bytecode pointer may overlap with or follow the contents region, so we + // keep the original length to avoid shifting any data. The semicolons are + // harmless JS that won't affect execution. + + console.log(` Replaced cli.js: ${origSize} -> ${newSize} bytes (${origSize - newSize} bytes padded)`); + return bunData; + } + } + + throw new Error("Claude module not found in bun data"); +} + +// Main +const binaryPath = process.argv[2]; +const patchedCliPath = process.argv[3]; +const outputPath = process.argv[4]; + +if (!binaryPath || !patchedCliPath || !outputPath) { + console.log("Usage: node native-repack.js "); + process.exit(1); +} + +LIEF.logging.disable(); +const binary = LIEF.parse(binaryPath); +const patchedCli = fs.readFileSync(patchedCliPath); + +console.log(`Binary format: ${binary.format}`); +console.log(`Patched cli.js: ${patchedCli.length} bytes`); + +if (binary.format === "ELF") { + // For ELF, read the entire binary and do byte-level replacement + const binaryBuf = fs.readFileSync(binaryPath); + const result = extractFromELF(binary, binaryPath); + const { bunData, bunOffsets, useRaw } = result; + + patchBunDataInPlace(bunData, bunOffsets, patchedCli); + + const dataRegionSize = Number(bunOffsets.byteCount); + if (useRaw) { + // New format: bunData is a subarray of the file buffer from extractFromELFRaw + // The data was patched in-place via the subarray, so the file buffer is already updated. + // But bunData from extractFromELFRaw is a subarray of a separate readFileSync buffer, + // so we need to write it back to the main buffer. + bunData.copy(binaryBuf, result.dataStartInFile, 0, dataRegionSize); + } else { + // Old format: overlay-based extraction + const elfSize = binaryBuf.length - binary.overlay.length; + const overlayOffset = elfSize + result.dataStart; + bunData.copy(binaryBuf, overlayOffset, 0, dataRegionSize); + } + + const origStat = fs.statSync(binaryPath); + fs.writeFileSync(outputPath, binaryBuf); + fs.chmodSync(outputPath, origStat.mode); + +} else if (binary.format === "MachO") { + // For Mach-O, patch the section data in place via LIEF + const bunSegment = binary.getSegment("__BUN"); + const bunSection = bunSegment.getSection("__bun"); + const sectionData = Buffer.from(bunSection.content); + + // Determine header size + const bunDataSizeU64 = sectionData.length >= 8 ? Number(sectionData.readBigUInt64LE(0)) : 0; + const bunDataSizeU32 = sectionData.readUInt32LE(0); + let headerSize; + if (sectionData.length >= 8 && 8 + bunDataSizeU64 <= sectionData.length && 8 + bunDataSizeU64 >= sectionData.length - 4096) { + headerSize = 8; + } else if (4 + bunDataSizeU32 <= sectionData.length && 4 + bunDataSizeU32 >= sectionData.length - 4096) { + headerSize = 4; + } else { + throw new Error("Cannot determine section header format"); + } + + const result = extractBunDataFromSection(sectionData); + patchBunDataInPlace(result.bunData, result.bunOffsets, patchedCli); + + // Write patched bun data back into section data + result.bunData.copy(sectionData, headerSize); + + if (binary.hasCodeSignature) binary.removeSignature(); + bunSection.content = sectionData; + + const tempPath = outputPath + ".tmp"; + binary.write(tempPath); + const origStat = fs.statSync(binaryPath); + fs.chmodSync(tempPath, origStat.mode); + fs.renameSync(tempPath, outputPath); + + // Re-sign on macOS + try { + execSync(`codesign -s - -f "${outputPath}"`, { stdio: "ignore" }); + console.log("Code signed successfully"); + } catch (e) { + console.warn("Warning: codesign failed, binary may not run"); + } + +} else { + console.error(`Unsupported format: ${binary.format}`); + process.exit(1); +} + +console.log(`Written to: ${outputPath}`); diff --git a/system-prompt/2.1.112/patch-cli.js b/system-prompt/2.1.112/patch-cli.js new file mode 100644 index 0000000..1f15725 --- /dev/null +++ b/system-prompt/2.1.112/patch-cli.js @@ -0,0 +1,389 @@ +#!/usr/bin/env node +/** + * Patch script for Claude Code CLI system prompt + * Always restores from backup first, then applies patches + */ + +const fs = require('fs'); +const crypto = require('crypto'); +const path = require('path'); + +// Configuration +const EXPECTED_VERSION = '2.1.112'; +const EXPECTED_HASHES = { + npm: 'bc3358282800e3e99daa8e71ac5b7b1566bd0d7ca7eb94f714a7859365d3163f', + 'native-linux-arm64': 'aa70162cce78a9563b5f1c69801b7011b8421c43c937790da94a77f2fa6a2a97', + 'native-linux-x64': 'fc88492e748593040e60a730b6c11ce022f28b942346b61cf206a87440240aa7', + 'native-macos-arm64': '8a671d562f68deae99c9d0bb405e26268515905950f1b9f2cd4457da45a95f85', + // 'native-macos-x64': 'TODO: test on x64 Mac and add hash', +}; + +// Unicode characters that native (Bun) builds escape differently +// Using codepoints to avoid syntax issues with special quotes +const UNICODE_ESCAPES = [ + ['\u2014', '\\u2014'], // em-dash — + ['\u2192', '\\u2192'], // arrow → + ['\u2013', '\\u2013'], // en-dash – + ['\u201c', '\\u201c'], // left double quote " + ['\u201d', '\\u201d'], // right double quote " + ['\u2018', '\\u2018'], // left single quote ' + ['\u2019', '\\u2019'], // right single quote ' + ['\u2026', '\\u2026'], // ellipsis … +]; + +// Convert literal Unicode to escape sequences (for native binary compatibility) +function toNativeEscapes(str) { + let result = str; + for (const [char, escape] of UNICODE_ESCAPES) { + result = result.split(char).join(escape); + } + return result; +} + +// Auto-detect CLI path by following the claude binary +const { execSync } = require('child_process'); + +function findClaudeCli() { + const home = process.env.HOME; + + // Method 1: Use 'which claude' and follow symlinks + try { + const claudePath = execSync('which claude', { encoding: 'utf8' }).trim(); + const realPath = fs.realpathSync(claudePath); + + // cli.js is in the same directory as the symlink target + const cliPath = path.join(path.dirname(realPath), 'cli.js'); + if (fs.existsSync(cliPath)) return cliPath; + + // Fallback: check if realPath itself is cli.js + if (realPath.endsWith('cli.js')) return realPath; + } catch (e) { + // which failed, try other methods + } + + // Method 2: Check common npm global locations + const globalLocations = [ + '/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js', + '/usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js', + ]; + + for (const loc of globalLocations) { + if (fs.existsSync(loc)) return loc; + } + + // Method 3: Check local install location + const localLauncher = path.join(home, '.claude/local/claude'); + if (fs.existsSync(localLauncher)) { + const content = fs.readFileSync(localLauncher, 'utf8'); + const execMatch = content.match(/exec\s+"([^"]+)"/); + if (execMatch) { + return fs.realpathSync(execMatch[1]); + } + } + + return null; +} + +// Allow custom path for testing, otherwise find it dynamically +const customPath = process.argv.slice(2).find(a => !a.startsWith('--')); +const basePath = customPath || findClaudeCli(); + +if (!basePath) { + console.error('Error: Could not find Claude Code CLI. Tried:'); + console.error(' - which claude'); + console.error(' - /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js'); + console.error(' - /usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js'); + console.error(' - ~/.claude/local/claude'); + console.error(''); + console.error('Pass the path as an argument: node patch-cli.js /path/to/cli.js'); + process.exit(1); +} + +const backupPath = basePath + '.backup'; +const patchDir = __dirname; + +// Helper to load patch strings from files (avoids template literal issues) +function loadPatch(name) { + const findPath = path.join(patchDir, 'patches', `${name}.find.txt`); + const replacePath = path.join(patchDir, 'patches', `${name}.replace.txt`); + if (fs.existsSync(findPath) && fs.existsSync(replacePath)) { + return { + find: fs.readFileSync(findPath, 'utf8'), + replace: fs.readFileSync(replacePath, 'utf8') + }; + } + return null; +} + +// Convert find/replace patterns to regex-based matching for variable references +// This allows patches to work across versions where variable names change +function createRegexPatch(find, replace) { + // Two types of placeholders: + // 1. ${varName} - matches template literal vars like ${n3}, ${T3} + // 2. __NAME__ - matches plain identifiers like kY7, aDA (for function names) + const varRegex = /\$\{[a-zA-Z0-9_.$]+(?:\([a-zA-Z0-9_.$]*\)(?:\/\d+)?)?\}/g; + const identRegex = /__[A-Z0-9_]+__/g; + + // Extract unique placeholders from find pattern (in order) + const placeholders = []; + const seenPlaceholders = new Set(); + + // Find all ${...} patterns + let match; + while ((match = varRegex.exec(find)) !== null) { + if (!seenPlaceholders.has(match[0])) { + seenPlaceholders.add(match[0]); + placeholders.push({ text: match[0], type: 'var' }); + } + } + + // Find all __NAME__ patterns + while ((match = identRegex.exec(find)) !== null) { + if (!seenPlaceholders.has(match[0])) { + seenPlaceholders.add(match[0]); + placeholders.push({ text: match[0], type: 'ident' }); + } + } + + // If no placeholders, return null (use simple string match) + if (placeholders.length === 0) { + return null; + } + + // Build regex pattern: escape everything except placeholders, which become capture groups + let regexStr = find; + // First escape all regex special chars + regexStr = regexStr.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + + // Then replace each unique placeholder with appropriate capture group + for (const p of placeholders) { + const escaped = p.text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + // ${...} matches template literals, __NAME__ matches identifiers + const capture = p.type === 'var' + ? '(\\$\\{[a-zA-Z0-9_.$]+(?:\\([a-zA-Z0-9_.$]*\\)(?:\\/\\d+)?)?\\})' + : '([a-zA-Z0-9_$]+)'; + regexStr = regexStr.split(escaped).join(capture); + } + + // Build replacement string with backreferences + let replaceStr = replace; + for (let i = 0; i < placeholders.length; i++) { + replaceStr = replaceStr.split(placeholders[i].text).join(`$${i + 1}`); + } + + return { + regex: new RegExp(regexStr), + replace: replaceStr, + varCount: placeholders.length + }; +} + +// Patches to apply (find → replace) +// Only patches saving 100+ chars are included +const patches = [ + // Big wins (1KB+) + { name: 'Slim TodoWrite examples (6KB → 0.4KB)', file: 'todowrite-examples' }, + { name: 'Remove Task tool Usage notes + examples (~2KB)', + customRegex: /(\$\{[a-zA-Z0-9_]+\})\n\nUsage notes:[\s\S]*?\n\n(\$\{[^}]+\})(?=`\}var)/, + customReplace: '$1' }, + { name: 'Simplify git commit section (~3.4KB)', file: 'git-commit' }, + { name: 'Slim Bash tool description (3.7KB → 0.6KB)', file: 'bash-tool' }, + { name: 'Simplify PR creation section (~1.7KB)', file: 'pr-creation' }, + { name: 'Slim EnterPlanMode When to Use (1.2KB → 200 chars)', file: 'enterplanmode-when-to-use' }, + { name: 'Slim TodoWrite states section (1.8KB → 0.4KB)', file: 'todowrite-states' }, + { name: 'Slim Skill tool instructions (887 → 80 chars)', file: 'skill-tool' }, + { name: 'Slim TodoWrite When to Use (1.2KB → 200 chars)', file: 'todowrite-when-to-use' }, + + // Medium wins (200-1000 chars) + { name: 'Slim over-engineering bullets (~900 → 200 chars)', file: 'over-engineering' }, + { name: 'Slim LSP tool description (~750 → 150 chars)', file: 'lsp-tool' }, + { name: 'Slim Edit tool description (~900 → 200 chars)', file: 'edit-tool' }, + { name: 'Slim EnterPlanMode examples (670 → 150 chars)', file: 'enterplanmode-examples' }, + { name: 'Slim EnterPlanMode What Happens (~400 → 120 chars)', file: 'enterplanmode-whathappens' }, + { name: 'Slim ExitPlanMode description (~1.5KB → 200 chars)', file: 'exitplanmode' }, + { name: 'Slim WebFetch usage notes (808 → 120 chars)', file: 'webfetch-usage' }, + { name: 'Slim Grep tool description (~715 → 350 chars)', file: 'grep-tool' }, + { name: 'Slim TodoWrite examples v2 (~400 chars)', file: 'todowrite-examples-v2' }, + { name: 'Slim claude-code-guide agent (~500 → 115 chars)', file: 'agent-claude-code-guide' }, + { name: 'Slim NotebookEdit (~510 → 100 chars)', file: 'notebookedit' }, + { name: 'Slim Write tool description (~550 → 100 chars)', file: 'write-tool' }, + { name: 'Slim WebSearch CRITICAL section (485 → 100 chars)', file: 'websearch-critical' }, + { name: 'Slim BashOutput (~440 → 95 chars)', file: 'bashoutput' }, + { name: 'Remove Code References section (363 chars)', file: 'code-references' }, + { name: 'Further slim git commit (~400 → 200 chars)', file: 'git-commit-v2' }, + { name: 'Slim Explore agent (~350 → 120 chars)', file: 'agent-explore' }, + { name: 'Slim security warning (~430 → 120 chars)', file: 'security-warning' }, + { name: 'Further slim PR creation (~400 → 150 chars)', file: 'pr-creation-v2' }, + { name: 'Slim Glob tool description (~400 → 100 chars)', file: 'glob-tool' }, + { name: 'Slim AskUserQuestion (~450 → 190 chars)', file: 'askuserquestion' }, + { name: 'Slim Bash.description param (~300 → 40 chars)', file: 'bash-description-param' }, + { name: 'Slim hooks instruction (~380 → 110 chars)', file: 'hooks-instruction' }, + { name: 'Slim Grep -A/-B/-C context params (~300 → 100 chars)', file: 'grep-params-context' }, + { name: 'Slim KillShell (~260 → 35 chars)', file: 'killshell' }, + { name: 'Slim Glob.path param (~255 → 65 chars)', file: 'glob-path-param' }, + { name: 'Slim Task tool intro (4.1KB → 0.6KB)', file: 'task-tool-intro' }, + { name: 'Slim Task tool when-not-to-use', file: 'task-tool-whennot' }, + { name: 'Slim Grep output_mode param (227 → 70 chars)', file: 'grep-params-output_mode' }, + { name: 'Slim Grep head_limit param (232 → 30 chars)', file: 'grep-params-head_limit' }, + { name: 'Slim doing tasks intro (~230 → 30 chars)', file: 'doing-tasks-intro' }, + { name: 'Slim CLI format instruction (~230 → 35 chars)', file: 'cli-format-instruction' }, + { name: 'Slim Read tool intro (292 → 110 chars)', file: 'read-tool' }, + { name: 'Slim Read capabilities (400 → 80 chars)', file: 'read-capabilities' }, + { name: 'Slim system-reminder instruction (~280 → 90 chars)', file: 'system-reminder-instruction' }, + { name: 'Slim output text instruction (~230 → 60 chars)', file: 'output-text-instruction' }, + { name: 'Slim general-purpose agent (~280 → 100 chars)', file: 'agent-general-purpose' }, + // glob-parallel-calls and read-parallel-calls removed - their text is already removed by glob-tool and read-tool patches + { name: 'Slim URL warning (~220 → 70 chars)', file: 'url-warning' }, + { name: 'Slim security vulnerabilities (~200 → 60 chars)', file: 'security-vulnerabilities' }, + { name: 'Slim Plan agent (~210 → 85 chars)', file: 'agent-plan' }, + { name: 'Slim Read offset/limit line (~165 → 50 chars)', file: 'read-tool-offset' }, + { name: 'Slim Grep offset param (135 → 35 chars)', file: 'grep-params-offset' }, + { name: 'Slim Grep type param (114 → 30 chars)', file: 'grep-params-type' }, + { name: 'Slim todos mark complete (~150 → 45 chars)', file: 'todos-mark-complete' }, + + // New patches + { name: 'Slim TaskUpdate description (~1.8KB → 150 chars)', file: 'taskupdate' }, + { name: 'Slim TaskList description (~1.2KB → 90 chars)', file: 'tasklist' }, +]; + +// Helper: compute SHA256 hash +function sha256(filepath) { + const content = fs.readFileSync(filepath); + return crypto.createHash('sha256').update(content).digest('hex'); +} + +// Main +function main() { + console.log('Claude Code CLI Patcher'); + console.log('=======================\n'); + + // 1. Check backup exists + if (!fs.existsSync(backupPath)) { + console.error(`Error: No backup found at ${backupPath}`); + console.error('Run backup-cli.sh first.'); + process.exit(1); + } + + // 2. Verify backup hash (accepts both npm and native builds) + const backupHash = sha256(backupPath); + const validHashes = Object.values(EXPECTED_HASHES); + if (!validHashes.includes(backupHash)) { + console.error('Error: Backup hash mismatch'); + console.error(`Expected one of: ${validHashes.join(', ')}`); + console.error(`Got: ${backupHash}`); + process.exit(1); + } + const buildType = Object.entries(EXPECTED_HASHES).find(([, h]) => h === backupHash)?.[0] || 'unknown'; + console.log(`Backup verified (v${EXPECTED_VERSION}, ${buildType} build)`); + + // 3. Restore from backup + fs.copyFileSync(backupPath, basePath); + console.log('Restored from backup\n'); + + // 4. Apply patches + let content = fs.readFileSync(basePath, 'utf8'); + let appliedCount = 0; + + // Support --max=N for bisecting + const maxArg = process.argv.find(a => a.startsWith('--max=')); + const maxPatches = maxArg ? parseInt(maxArg.split('=')[1]) : Infinity; + if (maxPatches !== Infinity) { + console.log(`Limiting to first ${maxPatches} patches (bisect mode)\n`); + } + + let patchIndex = 0; + for (const patch of patches) { + if (patchIndex >= maxPatches) { + console.log(`[STOP] Reached max patches limit (${maxPatches})`); + break; + } + patchIndex++; + // Custom regex patches bypass the normal find/replace flow + if (patch.customRegex) { + if (patch.customRegex.test(content)) { + content = content.replace(patch.customRegex, patch.customReplace); + console.log(`[OK] ${patch.name} (custom regex)`); + appliedCount++; + } else { + console.log(`[SKIP] ${patch.name} (custom regex not found)`); + } + continue; + } + + let find, replace; + + // Load from file if specified, otherwise use inline + if (patch.file) { + const loaded = loadPatch(patch.file); + if (!loaded) { + console.log(`[SKIP] ${patch.name} (patch files not found)`); + continue; + } + find = loaded.find; + replace = loaded.replace; + } else { + find = patch.find; + replace = patch.replace; + } + + // Try regex-based matching for patterns with variable references + const regexPatch = createRegexPatch(find, replace); + // Also create native-escaped variants for Bun-compiled binaries + const findNative = toNativeEscapes(find); + const replaceNative = toNativeEscapes(replace); + const regexPatchNative = (findNative !== find) ? createRegexPatch(findNative, replaceNative) : null; + + let applied = false; + + if (regexPatch) { + // Use regex matching + if (regexPatch.regex.test(content)) { + content = content.replace(regexPatch.regex, regexPatch.replace); + console.log(`[OK] ${patch.name} (regex, ${regexPatch.varCount} vars)`); + applied = true; + } else if (regexPatchNative && regexPatchNative.regex.test(content)) { + content = content.replace(regexPatchNative.regex, regexPatchNative.replace); + console.log(`[OK] ${patch.name} (regex+native, ${regexPatchNative.varCount} vars)`); + applied = true; + } else { + console.log(`[SKIP] ${patch.name} (regex not found)`); + } + } else if (content.includes(find)) { + // Simple string match (no variables) + if (patch.replaceAll) { + content = content.split(find).join(replace); + } else { + content = content.replace(find, replace); + } + console.log(`[OK] ${patch.name}`); + applied = true; + } else if (findNative !== find && content.includes(findNative)) { + // Try native-escaped variant + if (patch.replaceAll) { + content = content.split(findNative).join(replaceNative); + } else { + content = content.replace(findNative, replaceNative); + } + console.log(`[OK] ${patch.name} (native)`); + applied = true; + } else { + console.log(`[SKIP] ${patch.name} (not found)`); + } + + if (applied) appliedCount++; + } + + // 5. Write patched file + fs.writeFileSync(basePath, content); + + // 6. Summary + const newHash = sha256(basePath); + const sizeDiff = fs.statSync(backupPath).size - fs.statSync(basePath).size; + + console.log('\n-----------------------'); + console.log(`Patches applied: ${appliedCount}/${patches.length}`); + console.log(`Size reduction: ${sizeDiff} bytes`); + console.log(`New hash: ${newHash}`); +} + +main(); diff --git a/system-prompt/2.1.112/patch-native.sh b/system-prompt/2.1.112/patch-native.sh new file mode 100755 index 0000000..db055af --- /dev/null +++ b/system-prompt/2.1.112/patch-native.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# Patch Claude Code native binary +# Usage: ./patch-native.sh [binary-path] + +set -e + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +BINARY_PATH="${1:-$HOME/.local/share/claude/versions/2.1.112}" +BACKUP_PATH="${BINARY_PATH}.backup" +TMP_CLI="/tmp/native-cli-$$.js" + +echo "Claude Code Native Binary Patcher" +echo "==================================" +echo "" + +# Check binary exists +if [ ! -f "$BINARY_PATH" ]; then + echo "Error: Binary not found at $BINARY_PATH" + exit 1 +fi + +# Get expected hashes from patch-cli.js +EXPECTED_HASHES=$(grep -E "^\s+'native-|^\s+npm:" "$SCRIPT_DIR/patch-cli.js" | sed "s/.*'\([a-f0-9]\{64\}\)'.*/\1/" | tr '\n' ' ') + +# Create backup if needed +if [ ! -f "$BACKUP_PATH" ]; then + echo "Validating binary before creating backup..." + + # Extract cli.js to check hash + TMP_CHECK="/tmp/native-cli-check-$$.js" + node "$SCRIPT_DIR/native-extract.js" "$BINARY_PATH" "$TMP_CHECK" 2>/dev/null + ACTUAL_HASH=$(shasum -a 256 "$TMP_CHECK" | cut -d' ' -f1) + rm -f "$TMP_CHECK" + + # Validate hash + if ! echo "$EXPECTED_HASHES" | grep -q "$ACTUAL_HASH"; then + echo "Error: Binary hash doesn't match any expected hash" + echo "Got: $ACTUAL_HASH" + echo "Expected: $EXPECTED_HASHES" + echo "" + echo "The binary may already be patched or is an unknown version." + echo "To force, manually create the backup: cp \"$BINARY_PATH\" \"$BACKUP_PATH\"" + exit 1 + fi + + echo "Hash validated: $ACTUAL_HASH" + echo "Creating backup: $BACKUP_PATH" + cp "$BINARY_PATH" "$BACKUP_PATH" +else + echo "Backup exists: $BACKUP_PATH" + echo "Restoring from backup..." + cp "$BACKUP_PATH" "$BINARY_PATH" +fi + +# Extract cli.js +echo "" +echo "Step 1: Extracting cli.js..." +node "$SCRIPT_DIR/native-extract.js" "$BACKUP_PATH" "$TMP_CLI" + +# Create cli.js backup for patcher +TMP_CLI_BACKUP="${TMP_CLI}.backup" +cp "$TMP_CLI" "$TMP_CLI_BACKUP" + +# Patch cli.js +echo "" +echo "Step 2: Applying patches..." +node "$SCRIPT_DIR/patch-cli.js" "$TMP_CLI" + +# Repack binary +echo "" +echo "Step 3: Repacking binary..." +node "$SCRIPT_DIR/native-repack.js" "$BACKUP_PATH" "$TMP_CLI" "$BINARY_PATH" + +# Cleanup +rm -f "$TMP_CLI" "$TMP_CLI_BACKUP" + +echo "" +echo "Done! Testing..." +"$BINARY_PATH" --version + +echo "" +echo "Patched binary: $BINARY_PATH" +echo "Backup: $BACKUP_PATH" diff --git a/system-prompt/2.1.112/patches/agent-claude-code-guide.find.txt b/system-prompt/2.1.112/patches/agent-claude-code-guide.find.txt new file mode 100644 index 0000000..e6a7dd3 --- /dev/null +++ b/system-prompt/2.1.112/patches/agent-claude-code-guide.find.txt @@ -0,0 +1 @@ +whenToUse:`Use this agent when the user asks questions ("Can Claude...", "Does Claude...", "How do I...") about: (1) Claude Code (the CLI tool) - features, hooks, slash commands, MCP servers, settings, IDE integrations, keyboard shortcuts; (2) Claude Agent SDK - building custom agents; (3) Claude API (formerly Anthropic API) - API usage, tool use, Anthropic SDK usage. **IMPORTANT:** Before spawning a new agent, check if there is already a running or recently completed claude-code-guide agent that you can continue via ${vf}.` \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/agent-claude-code-guide.replace.txt b/system-prompt/2.1.112/patches/agent-claude-code-guide.replace.txt new file mode 100644 index 0000000..31a6b23 --- /dev/null +++ b/system-prompt/2.1.112/patches/agent-claude-code-guide.replace.txt @@ -0,0 +1 @@ +whenToUse:`For questions about Claude Code, Agent SDK, or Claude API. Check for existing agent to resume before spawning new.` \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/agent-explore.find.txt b/system-prompt/2.1.112/patches/agent-explore.find.txt new file mode 100644 index 0000000..e51f751 --- /dev/null +++ b/system-prompt/2.1.112/patches/agent-explore.find.txt @@ -0,0 +1 @@ +'Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (eg. "src/components/**/*.tsx"), search code for keywords (eg. "API endpoints"), or answer questions about the codebase (eg. "how do API endpoints work?"). When calling this agent, specify the desired thoroughness level: "quick" for basic searches, "medium" for moderate exploration, or "very thorough" for comprehensive analysis across multiple locations and naming conventions.' \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/agent-explore.replace.txt b/system-prompt/2.1.112/patches/agent-explore.replace.txt new file mode 100644 index 0000000..d25cb1f --- /dev/null +++ b/system-prompt/2.1.112/patches/agent-explore.replace.txt @@ -0,0 +1 @@ +'Fast codebase exploration. Find files by pattern, search code, answer codebase questions. Specify thoroughness: "quick", "medium", or "very thorough".' \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/agent-general-purpose.find.txt b/system-prompt/2.1.112/patches/agent-general-purpose.find.txt new file mode 100644 index 0000000..e6455ca --- /dev/null +++ b/system-prompt/2.1.112/patches/agent-general-purpose.find.txt @@ -0,0 +1 @@ +whenToUse:"General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you." \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/agent-general-purpose.replace.txt b/system-prompt/2.1.112/patches/agent-general-purpose.replace.txt new file mode 100644 index 0000000..10ddd74 --- /dev/null +++ b/system-prompt/2.1.112/patches/agent-general-purpose.replace.txt @@ -0,0 +1 @@ +whenToUse:"For complex searches, code exploration, and multi-step tasks. Use when unsure about finding the right match quickly." \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/agent-plan.find.txt b/system-prompt/2.1.112/patches/agent-plan.find.txt new file mode 100644 index 0000000..b28a9f9 --- /dev/null +++ b/system-prompt/2.1.112/patches/agent-plan.find.txt @@ -0,0 +1 @@ +whenToUse:"Software architect agent for designing implementation plans. Use this when you need to plan the implementation strategy for a task. Returns step-by-step plans, identifies critical files, and considers architectural trade-offs." \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/agent-plan.replace.txt b/system-prompt/2.1.112/patches/agent-plan.replace.txt new file mode 100644 index 0000000..2a55c25 --- /dev/null +++ b/system-prompt/2.1.112/patches/agent-plan.replace.txt @@ -0,0 +1 @@ +whenToUse:"For implementation planning. Returns step-by-step plans with critical files and trade-offs." \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/askuserquestion.find.txt b/system-prompt/2.1.112/patches/askuserquestion.find.txt new file mode 100644 index 0000000..3c00a7a --- /dev/null +++ b/system-prompt/2.1.112/patches/askuserquestion.find.txt @@ -0,0 +1,9 @@ +Use this tool when you need to ask the user questions during execution. This allows you to: +1. Gather user preferences or requirements +2. Clarify ambiguous instructions +3. Get decisions on implementation choices as you work +4. Offer choices to the user about what direction to take. + +Usage notes: +- Users will always be able to select "Other" to provide custom text input +- Use multiSelect: true to allow multiple answers to be selected for a question \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/askuserquestion.replace.txt b/system-prompt/2.1.112/patches/askuserquestion.replace.txt new file mode 100644 index 0000000..4faf833 --- /dev/null +++ b/system-prompt/2.1.112/patches/askuserquestion.replace.txt @@ -0,0 +1 @@ +Ask user questions to gather preferences, clarify instructions, or get implementation decisions. Users can always select "Other" for custom input. Use multiSelect: true for multiple selections. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/bash-description-param.find.txt b/system-prompt/2.1.112/patches/bash-description-param.find.txt new file mode 100644 index 0000000..657bd25 --- /dev/null +++ b/system-prompt/2.1.112/patches/bash-description-param.find.txt @@ -0,0 +1 @@ +Clear, concise description of what this command does in active voice. Never use words like "complex" or "risk" in the description - just describe what it does. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/bash-description-param.replace.txt b/system-prompt/2.1.112/patches/bash-description-param.replace.txt new file mode 100644 index 0000000..1b59ede --- /dev/null +++ b/system-prompt/2.1.112/patches/bash-description-param.replace.txt @@ -0,0 +1 @@ +5-10 word active voice description of command \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/bash-tool.find.txt b/system-prompt/2.1.112/patches/bash-tool.find.txt new file mode 100644 index 0000000..610493e --- /dev/null +++ b/system-prompt/2.1.112/patches/bash-tool.find.txt @@ -0,0 +1 @@ +IMPORTANT: Avoid using this tool to run ${K} commands, unless explicitly instructed or after you have verified that a dedicated tool cannot accomplish your task. Instead, use the appropriate dedicated tool as this will provide a much better experience for the user: \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/bash-tool.replace.txt b/system-prompt/2.1.112/patches/bash-tool.replace.txt new file mode 100644 index 0000000..11cf95a --- /dev/null +++ b/system-prompt/2.1.112/patches/bash-tool.replace.txt @@ -0,0 +1 @@ +IMPORTANT: Avoid find/grep/cat/head/tail/sed/awk/echo - use dedicated tools: \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/bashoutput.find.txt b/system-prompt/2.1.112/patches/bashoutput.find.txt new file mode 100644 index 0000000..e226165 --- /dev/null +++ b/system-prompt/2.1.112/patches/bashoutput.find.txt @@ -0,0 +1,6 @@ +- Retrieves output from a running or completed task (background shell, agent, or remote session) +- Takes a task_id parameter identifying the task +- Returns the task output along with status information +- Use block=true (default) to wait for task completion +- Use block=false for non-blocking check of current status +- Task IDs can be found using the /tasks command \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/bashoutput.replace.txt b/system-prompt/2.1.112/patches/bashoutput.replace.txt new file mode 100644 index 0000000..6e49dda --- /dev/null +++ b/system-prompt/2.1.112/patches/bashoutput.replace.txt @@ -0,0 +1 @@ +Retrieves output from background bash shells. Takes bash_id, returns new output since last check. Use /tasks for IDs. diff --git a/system-prompt/2.1.112/patches/cli-format-instruction.find.txt b/system-prompt/2.1.112/patches/cli-format-instruction.find.txt new file mode 100644 index 0000000..6ff919f --- /dev/null +++ b/system-prompt/2.1.112/patches/cli-format-instruction.find.txt @@ -0,0 +1 @@ +You can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/cli-format-instruction.replace.txt b/system-prompt/2.1.112/patches/cli-format-instruction.replace.txt new file mode 100644 index 0000000..20afe28 --- /dev/null +++ b/system-prompt/2.1.112/patches/cli-format-instruction.replace.txt @@ -0,0 +1 @@ +Use GitHub markdown. Monospace, CommonMark. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/code-references.find.txt b/system-prompt/2.1.112/patches/code-references.find.txt new file mode 100644 index 0000000..bfbb315 --- /dev/null +++ b/system-prompt/2.1.112/patches/code-references.find.txt @@ -0,0 +1 @@ +When referencing specific functions or pieces of code include the pattern file_path:line_number to allow the user to easily navigate to the source code location. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/code-references.replace.txt b/system-prompt/2.1.112/patches/code-references.replace.txt new file mode 100644 index 0000000..91c354d --- /dev/null +++ b/system-prompt/2.1.112/patches/code-references.replace.txt @@ -0,0 +1 @@ +# . \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/doing-tasks-intro.find.txt b/system-prompt/2.1.112/patches/doing-tasks-intro.find.txt new file mode 100644 index 0000000..6c38387 --- /dev/null +++ b/system-prompt/2.1.112/patches/doing-tasks-intro.find.txt @@ -0,0 +1 @@ +The user will primarily request you to perform software engineering tasks. These may include solving bugs, adding new functionality, refactoring code, explaining code, and more. When given an unclear or generic instruction, consider it in the context of these \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/doing-tasks-intro.replace.txt b/system-prompt/2.1.112/patches/doing-tasks-intro.replace.txt new file mode 100644 index 0000000..cb63146 --- /dev/null +++ b/system-prompt/2.1.112/patches/doing-tasks-intro.replace.txt @@ -0,0 +1 @@ +For software engineering tasks: \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/edit-tool.find.txt b/system-prompt/2.1.112/patches/edit-tool.find.txt new file mode 100644 index 0000000..e9c08aa --- /dev/null +++ b/system-prompt/2.1.112/patches/edit-tool.find.txt @@ -0,0 +1,7 @@ +Performs exact string replacements in files. + +Usage:${ovY()} +- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: ${q}. Everything after that is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string. +- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required. +- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.${K} +- Use \`replace_all\` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/edit-tool.replace.txt b/system-prompt/2.1.112/patches/edit-tool.replace.txt new file mode 100644 index 0000000..e3eb11f --- /dev/null +++ b/system-prompt/2.1.112/patches/edit-tool.replace.txt @@ -0,0 +1 @@ +Exact string replacement.${ovY()} Preserve exact indentation (ignore line prefix). Prefer editing over new files.${K} Use replace_all to rename across file. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/enterplanmode-examples.find.txt b/system-prompt/2.1.112/patches/enterplanmode-examples.find.txt new file mode 100644 index 0000000..3adf1f1 --- /dev/null +++ b/system-prompt/2.1.112/patches/enterplanmode-examples.find.txt @@ -0,0 +1,28 @@ +## Examples + +### GOOD - Use EnterPlanMode: +User: "Add user authentication to the app" +- Requires architectural decisions (session vs JWT, where to store tokens, middleware structure) + +User: "Optimize the database queries" +- Multiple approaches possible, need to profile first, significant impact + +User: "Implement dark mode" +- Architectural decision on theme system, affects many components + +User: "Add a delete button to the user profile" +- Seems simple but involves: where to place it, confirmation dialog, API call, error handling, state updates + +User: "Update the error handling in the API" +- Affects multiple files, user should approve the approach + +### BAD - Don't use EnterPlanMode: +User: "Fix the typo in the README" +- Straightforward, no planning needed + +User: "Add a console.log to debug this function" +- Simple, obvious implementation + +User: "What files handle routing?" +- Research task, not implementation planning + diff --git a/system-prompt/2.1.112/patches/enterplanmode-examples.replace.txt b/system-prompt/2.1.112/patches/enterplanmode-examples.replace.txt new file mode 100644 index 0000000..8e88bd6 --- /dev/null +++ b/system-prompt/2.1.112/patches/enterplanmode-examples.replace.txt @@ -0,0 +1,5 @@ +## Examples + +GOOD: "Add user authentication" - requires architectural decisions (session vs JWT, middleware) +BAD: "Fix the typo in README" - straightforward, no planning needed + diff --git a/system-prompt/2.1.112/patches/enterplanmode-whathappens.find.txt b/system-prompt/2.1.112/patches/enterplanmode-whathappens.find.txt new file mode 100644 index 0000000..ef27849 --- /dev/null +++ b/system-prompt/2.1.112/patches/enterplanmode-whathappens.find.txt @@ -0,0 +1,9 @@ +## What Happens in Plan Mode + +In plan mode, you'll: +1. Thoroughly explore the codebase using Glob, Grep, and Read tools +2. Understand existing patterns and architecture +3. Design an implementation approach +4. Present your plan to the user for approval +5. Use ${__VAR__} if you need to clarify approaches +6. Exit plan mode with ExitPlanMode when ready to implement \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/enterplanmode-whathappens.replace.txt b/system-prompt/2.1.112/patches/enterplanmode-whathappens.replace.txt new file mode 100644 index 0000000..e366b45 --- /dev/null +++ b/system-prompt/2.1.112/patches/enterplanmode-whathappens.replace.txt @@ -0,0 +1,3 @@ +## What Happens in Plan Mode + +Explore codebase, design approach, present plan for approval. Use ${__VAR__} to clarify, ExitPlanMode when ready. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/enterplanmode-when-to-use.find.txt b/system-prompt/2.1.112/patches/enterplanmode-when-to-use.find.txt new file mode 100644 index 0000000..216a04b --- /dev/null +++ b/system-prompt/2.1.112/patches/enterplanmode-when-to-use.find.txt @@ -0,0 +1,30 @@ +**Prefer using EnterPlanMode** for implementation tasks unless they're simple. Use it when ANY of these conditions apply: + +1. **New Feature Implementation**: Adding meaningful new functionality + - Example: "Add a logout button" - where should it go? What should happen on click? + - Example: "Add form validation" - what rules? What error messages? + +2. **Multiple Valid Approaches**: The task can be solved in several different ways + - Example: "Add caching to the API" - could use Redis, in-memory, file-based, etc. + - Example: "Improve performance" - many optimization strategies possible + +3. **Code Modifications**: Changes that affect existing behavior or structure + - Example: "Update the login flow" - what exactly should change? + - Example: "Refactor this component" - what's the target architecture? + +4. **Architectural Decisions**: The task requires choosing between patterns or technologies + - Example: "Add real-time updates" - WebSockets vs SSE vs polling + - Example: "Implement state management" - Redux vs Context vs custom solution + +5. **Multi-File Changes**: The task will likely touch more than 2-3 files + - Example: "Refactor the authentication system" + - Example: "Add a new API endpoint with tests" + +6. **Unclear Requirements**: You need to explore before understanding the full scope + - Example: "Make the app faster" - need to profile and identify bottlenecks + - Example: "Fix the bug in checkout" - need to investigate root cause + +7. **User Preferences Matter**: The implementation could reasonably go multiple ways + - If you would use ${__VAR__} to clarify the approach, use EnterPlanMode instead + - Plan mode lets you explore first, then present options with context + diff --git a/system-prompt/2.1.112/patches/enterplanmode-when-to-use.replace.txt b/system-prompt/2.1.112/patches/enterplanmode-when-to-use.replace.txt new file mode 100644 index 0000000..fa47f2e --- /dev/null +++ b/system-prompt/2.1.112/patches/enterplanmode-when-to-use.replace.txt @@ -0,0 +1,4 @@ +## When to Use This Tool + +Use EnterPlanMode when: multiple valid approaches exist, significant architectural decisions needed, large-scale changes across many files, unclear requirements needing exploration, or user input needed before starting. + diff --git a/system-prompt/2.1.112/patches/exitplanmode.find.txt b/system-prompt/2.1.112/patches/exitplanmode.find.txt new file mode 100644 index 0000000..670ce4b --- /dev/null +++ b/system-prompt/2.1.112/patches/exitplanmode.find.txt @@ -0,0 +1,23 @@ +Use this tool when you are in plan mode and have finished writing your plan to the plan file and are ready for user approval. + +## How This Tool Works +- You should have already written your plan to the plan file specified in the plan mode system message +- This tool does NOT take the plan content as a parameter - it will read the plan from the file you wrote +- This tool simply signals that you're done planning and ready for the user to review and approve +- The user will see the contents of your plan file when they review it + +## When to Use This Tool +IMPORTANT: Only use this tool when the task requires planning the implementation steps of a task that requires writing code. For research tasks where you're gathering information, searching files, reading files or in general trying to understand the codebase - do NOT use this tool. + +## Before Using This Tool +Ensure your plan is complete and unambiguous: +- If you have unresolved questions about requirements or approach, use AskUserQuestion first (in earlier phases) +- Once your plan is finalized, use THIS tool to request approval + +**Important:** Do NOT use AskUserQuestion to ask "Is this plan okay?" or "Should I proceed?" - that's exactly what THIS tool does. ExitPlanMode inherently requests user approval of your plan. + +## Examples + +1. Initial task: "Search for and understand the implementation of vim mode in the codebase" - Do not use the exit plan mode tool because you are not planning the implementation steps of a task. +2. Initial task: "Help me implement yank mode for vim" - Use the exit plan mode tool after you have finished planning the implementation steps of the task. +3. Initial task: "Add a new feature to handle user authentication" - If unsure about auth method (OAuth, JWT, etc.), use AskUserQuestion first, then use exit plan mode tool after clarifying the approach. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/exitplanmode.replace.txt b/system-prompt/2.1.112/patches/exitplanmode.replace.txt new file mode 100644 index 0000000..e0f6510 --- /dev/null +++ b/system-prompt/2.1.112/patches/exitplanmode.replace.txt @@ -0,0 +1,4 @@ +Signal plan completion for user approval. Plan is read from the file you wrote. + +Only for implementation tasks requiring code, NOT research/exploration. +Use AskUserQuestion for clarifications BEFORE finalizing plan, not after. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/git-commit-v2.find.txt b/system-prompt/2.1.112/patches/git-commit-v2.find.txt new file mode 100644 index 0000000..d924345 --- /dev/null +++ b/system-prompt/2.1.112/patches/git-commit-v2.find.txt @@ -0,0 +1,18 @@ +# Committing changes with git + +Only commit when requested. Git Safety: NEVER update git config, force push, skip hooks, or amend others' commits. Before amending, check authorship. + +Steps: +1. Run git status, git diff, git log in parallel +2. Draft concise commit message (focus on "why"). Don't commit secrets (.env, credentials.json) +3. Stage files, commit, then verify with git status +4. If pre-commit hook modifies files, amend only if you authored and haven't pushed + +Use HEREDOC for commit messages: + +git commit -m "$(cat <<'EOF' + Commit message here. + EOF + )" + + diff --git a/system-prompt/2.1.112/patches/git-commit-v2.replace.txt b/system-prompt/2.1.112/patches/git-commit-v2.replace.txt new file mode 100644 index 0000000..42756cc --- /dev/null +++ b/system-prompt/2.1.112/patches/git-commit-v2.replace.txt @@ -0,0 +1,6 @@ +# Git commits +Only when requested. NEVER force push, skip hooks, or amend others' commits. +1. Run git status, git diff, git log in parallel +2. Draft concise message (focus on "why"), avoid secrets +3. Stage, commit, verify with git status + diff --git a/system-prompt/2.1.112/patches/git-commit.find.txt b/system-prompt/2.1.112/patches/git-commit.find.txt new file mode 100644 index 0000000..23ab40a --- /dev/null +++ b/system-prompt/2.1.112/patches/git-commit.find.txt @@ -0,0 +1,49 @@ +# Committing changes with git + +Only create commits when requested by the user. If unclear, ask first. When the user asks you to create a new git commit, follow these steps carefully: + +You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. The numbered steps below indicate which commands should be batched in parallel. + +Git Safety Protocol: +- NEVER update the git config +- NEVER run destructive git commands (push --force, reset --hard, checkout ., restore ., clean -f, branch -D) unless the user explicitly requests these actions. Taking unauthorized destructive actions is unhelpful and can result in lost work, so it's best to ONLY run these commands when given direct instructions +- NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it +- NEVER run force push to main/master, warn the user if they request it +- CRITICAL: Always create NEW commits rather than amending, unless the user explicitly requests a git amend. When a pre-commit hook fails, the commit did NOT happen — so --amend would modify the PREVIOUS commit, which may result in destroying work or losing previous changes. Instead, after hook failure, fix the issue, re-stage, and create a NEW commit +- When staging files, prefer adding specific files by name rather than using "git add -A" or "git add .", which can accidentally include sensitive files (.env, credentials) or large binaries +- NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive + +1. Run the following bash commands in parallel, each using the ${VAR1} tool: + - Run a git status command to see all untracked files. IMPORTANT: Never use the -uall flag as it can cause memory issues on large repos. + - Run a git diff command to see both staged and unstaged changes that will be committed. + - Run a git log command to see recent commit messages, so that you can follow this repository's commit message style. +2. Analyze all staged changes (both previously staged and newly added) and draft a commit message: + - Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.). Ensure the message accurately reflects the changes and their purpose (i.e. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.). + - Do not commit files that likely contain secrets (.env, credentials.json, etc). Warn the user if they specifically request to commit those files + - Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what" + - Ensure it accurately reflects the changes and their purpose +3. Run the following commands in parallel: + - Add relevant untracked files to the staging area. + - Create the commit with a message${__VAR2__?` ending with: + ${__VAR2__}`:"."} + - Run git status after the commit completes to verify success. + Note: git status depends on the commit completing, so run it sequentially after the commit. +4. If the commit fails due to pre-commit hook: fix the issue and create a NEW commit + +Important notes: +- NEVER run additional commands to read or explore code, besides git bash commands +- NEVER use the ${VAR3.name} or ${VAR4} tools +- DO NOT push to the remote repository unless the user explicitly asks you to do so +- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported. +- IMPORTANT: Do not use --no-edit with git rebase commands, as the --no-edit flag is not a valid option for git rebase. +- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit +- In order to ensure good formatting, ALWAYS pass the commit message via a HEREDOC, a la this example: + +git commit -m "$(cat <<'EOF' + Commit message here.${__VAR2__?` + + ${__VAR2__}`:""} + EOF + )" + + diff --git a/system-prompt/2.1.112/patches/git-commit.replace.txt b/system-prompt/2.1.112/patches/git-commit.replace.txt new file mode 100644 index 0000000..d924345 --- /dev/null +++ b/system-prompt/2.1.112/patches/git-commit.replace.txt @@ -0,0 +1,18 @@ +# Committing changes with git + +Only commit when requested. Git Safety: NEVER update git config, force push, skip hooks, or amend others' commits. Before amending, check authorship. + +Steps: +1. Run git status, git diff, git log in parallel +2. Draft concise commit message (focus on "why"). Don't commit secrets (.env, credentials.json) +3. Stage files, commit, then verify with git status +4. If pre-commit hook modifies files, amend only if you authored and haven't pushed + +Use HEREDOC for commit messages: + +git commit -m "$(cat <<'EOF' + Commit message here. + EOF + )" + + diff --git a/system-prompt/2.1.112/patches/glob-path-param.find.txt b/system-prompt/2.1.112/patches/glob-path-param.find.txt new file mode 100644 index 0000000..5b735ce --- /dev/null +++ b/system-prompt/2.1.112/patches/glob-path-param.find.txt @@ -0,0 +1 @@ +The directory to search in. If not specified, the current working directory will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter "undefined" or "null" - simply omit it for the default behavior. Must be a valid directory path if provided. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/glob-path-param.replace.txt b/system-prompt/2.1.112/patches/glob-path-param.replace.txt new file mode 100644 index 0000000..079dc50 --- /dev/null +++ b/system-prompt/2.1.112/patches/glob-path-param.replace.txt @@ -0,0 +1 @@ +Directory to search (default: cwd). Omit for default. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/glob-tool.find.txt b/system-prompt/2.1.112/patches/glob-tool.find.txt new file mode 100644 index 0000000..5664700 --- /dev/null +++ b/system-prompt/2.1.112/patches/glob-tool.find.txt @@ -0,0 +1,5 @@ +- Fast file pattern matching tool that works with any codebase size +- Supports glob patterns like "**/*.js" or "src/**/*.ts" +- Returns matching file paths sorted by modification time +- Use this tool when you need to find files by name patterns +- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/glob-tool.replace.txt b/system-prompt/2.1.112/patches/glob-tool.replace.txt new file mode 100644 index 0000000..5205551 --- /dev/null +++ b/system-prompt/2.1.112/patches/glob-tool.replace.txt @@ -0,0 +1 @@ +Fast file pattern matching (**/*.js, src/**/*.ts). Returns paths by mtime. For multi-round searches, use Agent. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/grep-params-context.find.txt b/system-prompt/2.1.112/patches/grep-params-context.find.txt new file mode 100644 index 0000000..d5cd27e --- /dev/null +++ b/system-prompt/2.1.112/patches/grep-params-context.find.txt @@ -0,0 +1 @@ +"-B":__WRAP__(__VAR1__.number().optional()).describe('Number of lines to show before each match (rg -B). Requires output_mode: "content", ignored otherwise.'),"-A":__WRAP__(__VAR1__.number().optional()).describe('Number of lines to show after each match (rg -A). Requires output_mode: "content", ignored otherwise.'),"-C":__WRAP__(__VAR1__.number().optional()).describe("Alias for context."),context:__WRAP__(__VAR1__.number().optional()).describe('Number of lines to show before and after each match (rg -C). Requires output_mode: "content", ignored otherwise.') \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/grep-params-context.replace.txt b/system-prompt/2.1.112/patches/grep-params-context.replace.txt new file mode 100644 index 0000000..c236847 --- /dev/null +++ b/system-prompt/2.1.112/patches/grep-params-context.replace.txt @@ -0,0 +1 @@ +"-B":__WRAP__(__VAR1__.number().optional()).describe("Lines before match (rg -B)"),"-A":__WRAP__(__VAR1__.number().optional()).describe("Lines after match (rg -A)"),"-C":__WRAP__(__VAR1__.number().optional()).describe("Alias for context."),context:__WRAP__(__VAR1__.number().optional()).describe("Context lines (rg -C)") \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/grep-params-head_limit.find.txt b/system-prompt/2.1.112/patches/grep-params-head_limit.find.txt new file mode 100644 index 0000000..e809853 --- /dev/null +++ b/system-prompt/2.1.112/patches/grep-params-head_limit.find.txt @@ -0,0 +1 @@ +head_limit:__WRAP__(__VAR1__.number().optional()).describe('Limit output to first N lines/entries, equivalent to "| head -N". Works across all output modes: content (limits output lines), files_with_matches (limits file paths), count (limits count entries). Defaults to 250 when unspecified. Pass 0 for unlimited (use sparingly — large result sets waste context).'), \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/grep-params-head_limit.replace.txt b/system-prompt/2.1.112/patches/grep-params-head_limit.replace.txt new file mode 100644 index 0000000..7aee505 --- /dev/null +++ b/system-prompt/2.1.112/patches/grep-params-head_limit.replace.txt @@ -0,0 +1 @@ +head_limit:__WRAP__(__VAR1__.number().optional()).describe("Limit to first N results"), diff --git a/system-prompt/2.1.112/patches/grep-params-offset.find.txt b/system-prompt/2.1.112/patches/grep-params-offset.find.txt new file mode 100644 index 0000000..56eb4df --- /dev/null +++ b/system-prompt/2.1.112/patches/grep-params-offset.find.txt @@ -0,0 +1 @@ +.describe('Skip first N lines/entries before applying head_limit, equivalent to "| tail -n +N | head -N". Works across all output modes. Defaults to 0.') \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/grep-params-offset.replace.txt b/system-prompt/2.1.112/patches/grep-params-offset.replace.txt new file mode 100644 index 0000000..e3aa85f --- /dev/null +++ b/system-prompt/2.1.112/patches/grep-params-offset.replace.txt @@ -0,0 +1 @@ +.describe("Skip first N results. Default: 0") \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/grep-params-output_mode.find.txt b/system-prompt/2.1.112/patches/grep-params-output_mode.find.txt new file mode 100644 index 0000000..dc35421 --- /dev/null +++ b/system-prompt/2.1.112/patches/grep-params-output_mode.find.txt @@ -0,0 +1 @@ +output_mode:__VAR1__.enum(["content","files_with_matches","count"]).optional().describe('Output mode: "content" shows matching lines (supports -A/-B/-C context, -n line numbers, head_limit), "files_with_matches" shows file paths (supports head_limit), "count" shows match counts (supports head_limit). Defaults to "files_with_matches".'), \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/grep-params-output_mode.replace.txt b/system-prompt/2.1.112/patches/grep-params-output_mode.replace.txt new file mode 100644 index 0000000..f1fc544 --- /dev/null +++ b/system-prompt/2.1.112/patches/grep-params-output_mode.replace.txt @@ -0,0 +1 @@ +output_mode:__VAR1__.enum(["content","files_with_matches","count"]).optional().describe("Output mode. Default: files_with_matches"), diff --git a/system-prompt/2.1.112/patches/grep-params-type.find.txt b/system-prompt/2.1.112/patches/grep-params-type.find.txt new file mode 100644 index 0000000..f117225 --- /dev/null +++ b/system-prompt/2.1.112/patches/grep-params-type.find.txt @@ -0,0 +1 @@ +type:__VAR1__.string().optional().describe("File type to search (rg --type). Common types: js, py, rust, go, java, etc. More efficient than include for standard file types."), \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/grep-params-type.replace.txt b/system-prompt/2.1.112/patches/grep-params-type.replace.txt new file mode 100644 index 0000000..e033364 --- /dev/null +++ b/system-prompt/2.1.112/patches/grep-params-type.replace.txt @@ -0,0 +1 @@ +type:__VAR1__.string().optional().describe("File type (rg --type)"), diff --git a/system-prompt/2.1.112/patches/grep-tool.find.txt b/system-prompt/2.1.112/patches/grep-tool.find.txt new file mode 100644 index 0000000..0b8d567 --- /dev/null +++ b/system-prompt/2.1.112/patches/grep-tool.find.txt @@ -0,0 +1,10 @@ +A powerful search tool built on ripgrep + + Usage: + - ALWAYS use ${OX} for search tasks. NEVER invoke \`grep\` or \`rg\` as a ${O4} command. The ${OX} tool has been optimized for correct permissions and access. + - Supports full regex syntax (e.g., "log.*Error", "function\\s+\\w+") + - Filter files with glob parameter (e.g., "*.js", "**/*.tsx") or type parameter (e.g., "js", "py", "rust") + - Output modes: "content" shows matching lines, "files_with_matches" shows only file paths (default), "count" shows match counts + - Use ${n3} tool for open-ended searches requiring multiple rounds + - Pattern syntax: Uses ripgrep (not grep) - literal braces need escaping (use \`interface\\{\\}\` to find \`interface{}\` in Go code) + - Multiline matching: By default patterns match within single lines only. For cross-line patterns like \`struct \\{[\\s\\S]*?field\`, use \`multiline: true\` \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/grep-tool.replace.txt b/system-prompt/2.1.112/patches/grep-tool.replace.txt new file mode 100644 index 0000000..9613331 --- /dev/null +++ b/system-prompt/2.1.112/patches/grep-tool.replace.txt @@ -0,0 +1,8 @@ +A powerful search tool built on ripgrep + + Usage: + - ALWAYS use ${OX} for search tasks. NEVER invoke \`grep\` or \`rg\` as a ${O4} command. + - Full regex syntax. Filter by glob ("*.js") or type ("js", "py") + - Output modes: "content" (lines), "files_with_matches" (paths, default), "count" + - Uses ripgrep syntax - escape literal braces (\`interface\\{\\}\`) + - For multiline patterns, use \`multiline: true\` diff --git a/system-prompt/2.1.112/patches/hooks-instruction.find.txt b/system-prompt/2.1.112/patches/hooks-instruction.find.txt new file mode 100644 index 0000000..f548115 --- /dev/null +++ b/system-prompt/2.1.112/patches/hooks-instruction.find.txt @@ -0,0 +1 @@ +Users may configure 'hooks', shell commands that execute in response to events like tool calls, in settings. Treat feedback from hooks, including , as coming from the user. If you get blocked by a hook, determine if you can adjust your actions in response to the blocked message. If not, ask the user to check their hooks configuration. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/hooks-instruction.replace.txt b/system-prompt/2.1.112/patches/hooks-instruction.replace.txt new file mode 100644 index 0000000..e1cc792 --- /dev/null +++ b/system-prompt/2.1.112/patches/hooks-instruction.replace.txt @@ -0,0 +1 @@ +User-configured hooks run on events. Treat hook feedback as user input. If blocked, adjust or ask user to check hooks. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/killshell.find.txt b/system-prompt/2.1.112/patches/killshell.find.txt new file mode 100644 index 0000000..17524f4 --- /dev/null +++ b/system-prompt/2.1.112/patches/killshell.find.txt @@ -0,0 +1,4 @@ +- Stops a running background task by its ID +- Takes a task_id parameter identifying the task to stop +- Returns a success or failure status +- Use this tool when you need to terminate a long-running task diff --git a/system-prompt/2.1.112/patches/killshell.replace.txt b/system-prompt/2.1.112/patches/killshell.replace.txt new file mode 100644 index 0000000..314c68a --- /dev/null +++ b/system-prompt/2.1.112/patches/killshell.replace.txt @@ -0,0 +1 @@ +Terminate a background task by ID. diff --git a/system-prompt/2.1.112/patches/lsp-tool.find.txt b/system-prompt/2.1.112/patches/lsp-tool.find.txt new file mode 100644 index 0000000..7380bc9 --- /dev/null +++ b/system-prompt/2.1.112/patches/lsp-tool.find.txt @@ -0,0 +1,19 @@ +Interact with Language Server Protocol (LSP) servers to get code intelligence features. + +Supported operations: +- goToDefinition: Find where a symbol is defined +- findReferences: Find all references to a symbol +- hover: Get hover information (documentation, type info) for a symbol +- documentSymbol: Get all symbols (functions, classes, variables) in a document +- workspaceSymbol: Search for symbols across the entire workspace +- goToImplementation: Find implementations of an interface or abstract method +- prepareCallHierarchy: Get call hierarchy item at a position (functions/methods) +- incomingCalls: Find all functions/methods that call the function at a position +- outgoingCalls: Find all functions/methods called by the function at a position + +All operations require: +- filePath: The file to operate on +- line: The line number (1-based, as shown in editors) +- character: The character offset (1-based, as shown in editors) + +Note: LSP servers must be configured for the file type. If no server is available, an error will be returned. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/lsp-tool.replace.txt b/system-prompt/2.1.112/patches/lsp-tool.replace.txt new file mode 100644 index 0000000..c93f3d2 --- /dev/null +++ b/system-prompt/2.1.112/patches/lsp-tool.replace.txt @@ -0,0 +1 @@ +LSP code intelligence. Operations: goToDefinition, findReferences, hover, documentSymbol, workspaceSymbol. Requires filePath, line (1-based), character (1-based). diff --git a/system-prompt/2.1.112/patches/notebookedit.find.txt b/system-prompt/2.1.112/patches/notebookedit.find.txt new file mode 100644 index 0000000..4671f9b --- /dev/null +++ b/system-prompt/2.1.112/patches/notebookedit.find.txt @@ -0,0 +1 @@ +Completely replaces the contents of a specific cell in a Jupyter notebook (.ipynb file) with new source. Jupyter notebooks are interactive documents that combine code, text, and visualizations, commonly used for data analysis and scientific computing. The notebook_path parameter must be an absolute path, not a relative path. The cell_number is 0-indexed. Use edit_mode=insert to add a new cell at the index specified by cell_number. Use edit_mode=delete to delete the cell at the index specified by cell_number. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/notebookedit.replace.txt b/system-prompt/2.1.112/patches/notebookedit.replace.txt new file mode 100644 index 0000000..ad1bfbe --- /dev/null +++ b/system-prompt/2.1.112/patches/notebookedit.replace.txt @@ -0,0 +1 @@ +Edit Jupyter notebook cells. Requires absolute path. edit_mode: replace (default), insert, or delete. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/output-text-instruction.find.txt b/system-prompt/2.1.112/patches/output-text-instruction.find.txt new file mode 100644 index 0000000..fe1fad1 --- /dev/null +++ b/system-prompt/2.1.112/patches/output-text-instruction.find.txt @@ -0,0 +1 @@ +All text you output outside of tool use is displayed to the user. Output text to communicate with the user. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/output-text-instruction.replace.txt b/system-prompt/2.1.112/patches/output-text-instruction.replace.txt new file mode 100644 index 0000000..3b86177 --- /dev/null +++ b/system-prompt/2.1.112/patches/output-text-instruction.replace.txt @@ -0,0 +1 @@ +Text output is shown to user. Use tools for tasks only, not communication. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/over-engineering.find.txt b/system-prompt/2.1.112/patches/over-engineering.find.txt new file mode 100644 index 0000000..d14d81b --- /dev/null +++ b/system-prompt/2.1.112/patches/over-engineering.find.txt @@ -0,0 +1 @@ +Don't add features, refactor, or introduce abstractions beyond what the task requires. A bug fix doesn't need surrounding cleanup; a one-shot operation doesn't need a helper. Don't design for hypothetical future requirements. Three similar lines is better than a premature abstraction. No half-finished implementations either.","Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use feature flags or backwards-compatibility shims when you can just change the code. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/over-engineering.replace.txt b/system-prompt/2.1.112/patches/over-engineering.replace.txt new file mode 100644 index 0000000..ed87570 --- /dev/null +++ b/system-prompt/2.1.112/patches/over-engineering.replace.txt @@ -0,0 +1 @@ +Don't add features, refactor, docstrings, comments, or type annotations beyond what's asked. Don't add error handling for impossible scenarios. Don't create abstractions for one-time operations.`,...[]] \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/pr-creation-v2.find.txt b/system-prompt/2.1.112/patches/pr-creation-v2.find.txt new file mode 100644 index 0000000..7dd320d --- /dev/null +++ b/system-prompt/2.1.112/patches/pr-creation-v2.find.txt @@ -0,0 +1,17 @@ +# Creating pull requests +Use gh for GitHub tasks. For PRs: +1. Run git status, git diff, git log, and \`git diff [base-branch]...HEAD\` in parallel +2. Analyze ALL commits (not just latest) and draft PR summary +3. Push if needed, then create PR with HEREDOC: + +gh pr create --title "the pr title" --body "$(cat <<'EOF' +## Summary +<1-3 bullet points> + +## Test plan +[Bulleted markdown checklist of TODOs for testing the pull request...] +EOF +)" + +Return the PR URL when done. + diff --git a/system-prompt/2.1.112/patches/pr-creation-v2.replace.txt b/system-prompt/2.1.112/patches/pr-creation-v2.replace.txt new file mode 100644 index 0000000..96f6adb --- /dev/null +++ b/system-prompt/2.1.112/patches/pr-creation-v2.replace.txt @@ -0,0 +1,5 @@ +# Pull requests +1. Run git status, diff, log, and \`git diff [base]...HEAD\` in parallel +2. Analyze ALL commits, draft summary +3. Push if needed, create with gh pr create. Return PR URL. + diff --git a/system-prompt/2.1.112/patches/pr-creation.find.txt b/system-prompt/2.1.112/patches/pr-creation.find.txt new file mode 100644 index 0000000..6fb32a5 --- /dev/null +++ b/system-prompt/2.1.112/patches/pr-creation.find.txt @@ -0,0 +1,34 @@ +# Creating pull requests +Use the gh command via the Bash tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a Github URL use the gh command to get the information needed. + +IMPORTANT: When the user asks you to create a pull request, follow these steps carefully: + +1. Run the following bash commands in parallel using the ${VAR1} tool, in order to understand the current state of the branch since it diverged from the main branch: + - Run a git status command to see all untracked files (never use -uall flag) + - Run a git diff command to see both staged and unstaged changes that will be committed + - Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote + - Run a git log command and \`git diff [base-branch]...HEAD\` to understand the full commit history for the current branch (from the time it diverged from the base branch) +2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request title and summary: + - Keep the PR title short (under 70 characters) + - Use the description/body for details, not the title +3. Run the following commands in parallel: + - Create new branch if needed + - Push to remote with -u flag if needed + - Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting. + +gh pr create --title "the pr title" --body "$(cat <<'EOF' +## Summary +<1-3 bullet points> + +## Test plan +[Bulleted markdown checklist of TODOs for testing the pull request...]${__VAR2__?` + +${__VAR2__}`:""} +EOF +)" + + +Important: +- DO NOT use the ${VAR3.name} or ${VAR4} tools +- Return the PR URL when you're done, so the user can see it + diff --git a/system-prompt/2.1.112/patches/pr-creation.replace.txt b/system-prompt/2.1.112/patches/pr-creation.replace.txt new file mode 100644 index 0000000..7dd320d --- /dev/null +++ b/system-prompt/2.1.112/patches/pr-creation.replace.txt @@ -0,0 +1,17 @@ +# Creating pull requests +Use gh for GitHub tasks. For PRs: +1. Run git status, git diff, git log, and \`git diff [base-branch]...HEAD\` in parallel +2. Analyze ALL commits (not just latest) and draft PR summary +3. Push if needed, then create PR with HEREDOC: + +gh pr create --title "the pr title" --body "$(cat <<'EOF' +## Summary +<1-3 bullet points> + +## Test plan +[Bulleted markdown checklist of TODOs for testing the pull request...] +EOF +)" + +Return the PR URL when done. + diff --git a/system-prompt/2.1.112/patches/read-capabilities.find.txt b/system-prompt/2.1.112/patches/read-capabilities.find.txt new file mode 100644 index 0000000..b88ab1a --- /dev/null +++ b/system-prompt/2.1.112/patches/read-capabilities.find.txt @@ -0,0 +1,4 @@ +- This tool allows Claude Code to read images (eg PNG, JPG, etc). When reading an image file the contents are presented visually as Claude Code is a multimodal LLM.${__VAR1__()?` +- This tool can read PDF files (.pdf). For large PDFs (more than 10 pages), you MUST provide the pages parameter to read specific page ranges (e.g., pages: "1-5"). Reading a large PDF without the pages parameter will fail. Maximum 20 pages per request.`:""} +- This tool can read Jupyter notebooks (.ipynb files) and returns all cells with their outputs, combining code, text, and visualizations. +- This tool can only read files, not directories. To read a directory, use an ls command via the ${__VAR2__} tool. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/read-capabilities.replace.txt b/system-prompt/2.1.112/patches/read-capabilities.replace.txt new file mode 100644 index 0000000..89d78ff --- /dev/null +++ b/system-prompt/2.1.112/patches/read-capabilities.replace.txt @@ -0,0 +1,2 @@ +- Supports images, PDFs, and Jupyter notebooks (.ipynb). +- Only reads files, not directories (use ${__VAR2__} for ls). \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/read-tool-offset.find.txt b/system-prompt/2.1.112/patches/read-tool-offset.find.txt new file mode 100644 index 0000000..5f01819 --- /dev/null +++ b/system-prompt/2.1.112/patches/read-tool-offset.find.txt @@ -0,0 +1 @@ +- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/read-tool-offset.replace.txt b/system-prompt/2.1.112/patches/read-tool-offset.replace.txt new file mode 100644 index 0000000..d86a049 --- /dev/null +++ b/system-prompt/2.1.112/patches/read-tool-offset.replace.txt @@ -0,0 +1 @@ +- Optional: specify offset and limit for long files \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/read-tool.find.txt b/system-prompt/2.1.112/patches/read-tool.find.txt new file mode 100644 index 0000000..9c1c0c4 --- /dev/null +++ b/system-prompt/2.1.112/patches/read-tool.find.txt @@ -0,0 +1,4 @@ +Reads a file from the local filesystem. You can access any file directly by using this tool. +Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned. + +Usage: \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/read-tool.replace.txt b/system-prompt/2.1.112/patches/read-tool.replace.txt new file mode 100644 index 0000000..9d49b90 --- /dev/null +++ b/system-prompt/2.1.112/patches/read-tool.replace.txt @@ -0,0 +1,3 @@ +Reads a file from the local filesystem. Assume paths provided by user are valid. Non-existent files return errors. + +Usage: \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/security-vulnerabilities.find.txt b/system-prompt/2.1.112/patches/security-vulnerabilities.find.txt new file mode 100644 index 0000000..4ae731c --- /dev/null +++ b/system-prompt/2.1.112/patches/security-vulnerabilities.find.txt @@ -0,0 +1 @@ +Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/security-vulnerabilities.replace.txt b/system-prompt/2.1.112/patches/security-vulnerabilities.replace.txt new file mode 100644 index 0000000..1a446ec --- /dev/null +++ b/system-prompt/2.1.112/patches/security-vulnerabilities.replace.txt @@ -0,0 +1 @@ +Avoid OWASP top 10 vulnerabilities. Fix insecure code immediately. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/security-warning.find.txt b/system-prompt/2.1.112/patches/security-warning.find.txt new file mode 100644 index 0000000..dde09ac --- /dev/null +++ b/system-prompt/2.1.112/patches/security-warning.find.txt @@ -0,0 +1 @@ +IMPORTANT: Assist with authorized security testing, defensive security, CTF challenges, and educational contexts. Refuse requests for destructive techniques, DoS attacks, mass targeting, supply chain compromise, or detection evasion for malicious purposes. Dual-use security tools (C2 frameworks, credential testing, exploit development) require clear authorization context: pentesting engagements, CTF competitions, security research, or defensive use cases. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/security-warning.replace.txt b/system-prompt/2.1.112/patches/security-warning.replace.txt new file mode 100644 index 0000000..8869446 --- /dev/null +++ b/system-prompt/2.1.112/patches/security-warning.replace.txt @@ -0,0 +1 @@ +IMPORTANT: Assist with authorized security testing, defensive security, CTFs, education. Refuse destructive/malicious techniques. Dual-use tools require clear authorization context. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/skill-tool.find.txt b/system-prompt/2.1.112/patches/skill-tool.find.txt new file mode 100644 index 0000000..3eb416f --- /dev/null +++ b/system-prompt/2.1.112/patches/skill-tool.find.txt @@ -0,0 +1,16 @@ +When users ask you to perform tasks, check if any of the available skills match. Skills provide specialized capabilities and domain knowledge. + +When users reference a "slash command" or "/", they are referring to a skill. Use this tool to invoke it. + +How to invoke: +- Set \`skill\` to the exact name of an available skill (no leading slash). For plugin-namespaced skills use the fully qualified \`plugin:skill\` form. +- Set \`args\` to pass optional arguments. + +Important: +- Available skills are listed in system-reminder messages in the conversation +- Only invoke a skill that appears in that list, or one the user explicitly typed as \`/\` in their message. Never guess or invent a skill name from training data; otherwise do not call this tool +- When a skill matches the user's request, this is a BLOCKING REQUIREMENT: invoke the relevant Skill tool BEFORE generating any other response about the task +- NEVER mention a skill without actually calling this tool +- Do not invoke a skill that is already running +- Do not use this tool for built-in CLI commands (like /help, /clear, etc.) +- If you see a <${TV}> tag in the current conversation turn, the skill has ALREADY been loaded - follow the instructions directly instead of calling this tool again \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/skill-tool.replace.txt b/system-prompt/2.1.112/patches/skill-tool.replace.txt new file mode 100644 index 0000000..139ee4e --- /dev/null +++ b/system-prompt/2.1.112/patches/skill-tool.replace.txt @@ -0,0 +1 @@ +Invoke skills with skill name only. Only use skills from "Available skills" below. diff --git a/system-prompt/2.1.112/patches/system-reminder-instruction.find.txt b/system-prompt/2.1.112/patches/system-reminder-instruction.find.txt new file mode 100644 index 0000000..a6f4abd --- /dev/null +++ b/system-prompt/2.1.112/patches/system-reminder-instruction.find.txt @@ -0,0 +1 @@ +Tool results and user messages may include or other tags. Tags contain information from the system. They bear no direct relation to the specific tool results or user messages in which they appear. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/system-reminder-instruction.replace.txt b/system-prompt/2.1.112/patches/system-reminder-instruction.replace.txt new file mode 100644 index 0000000..e28ed31 --- /dev/null +++ b/system-prompt/2.1.112/patches/system-reminder-instruction.replace.txt @@ -0,0 +1 @@ + tags in messages are auto-added system info, not related to that specific message. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/task-tool-intro.find.txt b/system-prompt/2.1.112/patches/task-tool-intro.find.txt new file mode 100644 index 0000000..c7a1f0d --- /dev/null +++ b/system-prompt/2.1.112/patches/task-tool-intro.find.txt @@ -0,0 +1,5 @@ +Launch a new agent to handle complex, multi-step tasks. Each agent type has specific capabilities and tools available to it. + +${__AGV1__}${__AGV2__} + +${__ZZ__?`When using the ${__TOOLVAR__} tool, specify a subagent_type to use a specialized agent, or omit it to fork yourself — a fork inherits your full conversation context.`:`When using the ${__TOOLVAR__} tool, specify a subagent_type parameter to select which agent type to use. If omitted, the general-purpose agent is used.`} \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/task-tool-intro.replace.txt b/system-prompt/2.1.112/patches/task-tool-intro.replace.txt new file mode 100644 index 0000000..2f4d83f --- /dev/null +++ b/system-prompt/2.1.112/patches/task-tool-intro.replace.txt @@ -0,0 +1,4 @@ +Launch agents for complex, multi-step tasks. Specify subagent_type parameter. + +Available agent types: +${__AGV1__}${__AGV2__} \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/task-tool-whennot.find.txt b/system-prompt/2.1.112/patches/task-tool-whennot.find.txt new file mode 100644 index 0000000..3e4cbc5 --- /dev/null +++ b/system-prompt/2.1.112/patches/task-tool-whennot.find.txt @@ -0,0 +1,3 @@ +## When not to use + +If the target is already known, use the direct tool: ${__VAR1__} for a known path, ${__VAR2__} for a specific symbol or string. Reserve this tool for open-ended questions that span the codebase, or tasks that match an available agent type. diff --git a/system-prompt/2.1.112/patches/task-tool-whennot.replace.txt b/system-prompt/2.1.112/patches/task-tool-whennot.replace.txt new file mode 100644 index 0000000..5ee125b --- /dev/null +++ b/system-prompt/2.1.112/patches/task-tool-whennot.replace.txt @@ -0,0 +1 @@ +## When not to use: For specific file reads use ${__VAR1__}; for specific string search use ${__VAR2__}. diff --git a/system-prompt/2.1.112/patches/tasklist.find.txt b/system-prompt/2.1.112/patches/tasklist.find.txt new file mode 100644 index 0000000..f7a28f3 --- /dev/null +++ b/system-prompt/2.1.112/patches/tasklist.find.txt @@ -0,0 +1,20 @@ +Use this tool to list all tasks in the task list. + +## When to Use This Tool + +- To see what tasks are available to work on (status: 'pending', no owner, not blocked) +- To check overall progress on the project +- To find tasks that are blocked and need dependencies resolved +${A}- After completing a task, to check for newly unblocked work or claim the next available task +- **Prefer working on tasks in ID order** (lowest ID first) when multiple tasks are available, as earlier tasks often set up context for later ones + +## Output + +Returns a summary of each task: +${K} +- **subject**: Brief description of the task +- **status**: 'pending', 'in_progress', or 'completed' +- **owner**: Agent ID if assigned, empty if available +- **blockedBy**: List of open task IDs that must be resolved first (tasks with blockedBy cannot be claimed until dependencies resolve) + +Use TaskGet with a specific task ID to view full details including description and comments. diff --git a/system-prompt/2.1.112/patches/tasklist.replace.txt b/system-prompt/2.1.112/patches/tasklist.replace.txt new file mode 100644 index 0000000..988285b --- /dev/null +++ b/system-prompt/2.1.112/patches/tasklist.replace.txt @@ -0,0 +1 @@ +List all tasks. Shows id, subject, status, owner, blockedBy. Use TaskGet for full details. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/taskupdate.find.txt b/system-prompt/2.1.112/patches/taskupdate.find.txt new file mode 100644 index 0000000..faae51d --- /dev/null +++ b/system-prompt/2.1.112/patches/taskupdate.find.txt @@ -0,0 +1,74 @@ +Use this tool to update a task in the task list. + +## When to Use This Tool + +**Mark tasks as resolved:** +- When you have completed the work described in a task +- When a task is no longer needed or has been superseded +- IMPORTANT: Always mark your assigned tasks as resolved when you finish them +- After resolving, call TaskList to find your next task + +- ONLY mark a task as completed when you have FULLY accomplished it +- If you encounter errors, blockers, or cannot finish, keep the task as in_progress +- When blocked, create a new task describing what needs to be resolved +- Never mark a task as completed if: + - Tests are failing + - Implementation is partial + - You encountered unresolved errors + - You couldn't find necessary files or dependencies + +**Delete tasks:** +- When a task is no longer relevant or was created in error +- Setting status to \`deleted\` permanently removes the task + +**Update task details:** +- When requirements change or become clearer +- When establishing dependencies between tasks + +## Fields You Can Update + +- **status**: The task status (see Status Workflow below) +- **subject**: Change the task title (imperative form, e.g., "Run tests") +- **description**: Change the task description +- **activeForm**: Present continuous form shown in spinner when in_progress (e.g., "Running tests") +- **owner**: Change the task owner (agent name) +- **metadata**: Merge metadata keys into the task (set a key to null to delete it) +- **addBlocks**: Mark tasks that cannot start until this one completes +- **addBlockedBy**: Mark tasks that must complete before this one can start + +## Status Workflow + +Status progresses: \`pending\` → \`in_progress\` → \`completed\` + +Use \`deleted\` to permanently remove a task. + +## Staleness + +Make sure to read a task's latest state using \`TaskGet\` before updating it. + +## Examples + +Mark task as in progress when starting work: +\`\`\`json +{"taskId": "1", "status": "in_progress"} +\`\`\` + +Mark task as completed after finishing work: +\`\`\`json +{"taskId": "1", "status": "completed"} +\`\`\` + +Delete a task: +\`\`\`json +{"taskId": "1", "status": "deleted"} +\`\`\` + +Claim a task by setting owner: +\`\`\`json +{"taskId": "1", "owner": "my-name"} +\`\`\` + +Set up task dependencies: +\`\`\`json +{"taskId": "2", "addBlockedBy": ["1"]} +\`\`\` \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/taskupdate.replace.txt b/system-prompt/2.1.112/patches/taskupdate.replace.txt new file mode 100644 index 0000000..fd26b6e --- /dev/null +++ b/system-prompt/2.1.112/patches/taskupdate.replace.txt @@ -0,0 +1 @@ +Update task status/details. Only mark completed when FULLY done (no failing tests, partial work, or errors). Use TaskGet before updating stale tasks. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/todos-mark-complete.find.txt b/system-prompt/2.1.112/patches/todos-mark-complete.find.txt new file mode 100644 index 0000000..81e0fb7 --- /dev/null +++ b/system-prompt/2.1.112/patches/todos-mark-complete.find.txt @@ -0,0 +1 @@ +Mark each task as completed as soon as you are done with the task. Do not batch up multiple tasks before marking them as completed. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/todos-mark-complete.replace.txt b/system-prompt/2.1.112/patches/todos-mark-complete.replace.txt new file mode 100644 index 0000000..87fb245 --- /dev/null +++ b/system-prompt/2.1.112/patches/todos-mark-complete.replace.txt @@ -0,0 +1 @@ +Mark todos completed immediately after each task. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/todowrite-examples-v2.find.txt b/system-prompt/2.1.112/patches/todowrite-examples-v2.find.txt new file mode 100644 index 0000000..490b363 --- /dev/null +++ b/system-prompt/2.1.112/patches/todowrite-examples-v2.find.txt @@ -0,0 +1,15 @@ +## Examples of When to Use the Todo List + + +User: Add dark mode toggle, then run tests and build +Assistant: I'll create a todo list to track this multi-step task. +*Creates todos: 1) Add toggle component, 2) Add state management, 3) Update styles, 4) Run tests and build* + + +## Examples of When NOT to Use the Todo List + + +User: How do I print 'Hello World' in Python? +Assistant: print("Hello World") + + diff --git a/system-prompt/2.1.112/patches/todowrite-examples-v2.replace.txt b/system-prompt/2.1.112/patches/todowrite-examples-v2.replace.txt new file mode 100644 index 0000000..e69de29 diff --git a/system-prompt/2.1.112/patches/todowrite-examples.find.txt b/system-prompt/2.1.112/patches/todowrite-examples.find.txt new file mode 100644 index 0000000..c5a22e9 --- /dev/null +++ b/system-prompt/2.1.112/patches/todowrite-examples.find.txt @@ -0,0 +1,82 @@ +## Examples of When to Use the Todo List + + +User: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done! +Assistant: *Creates todo list with the following items:* +1. Creating dark mode toggle component in Settings page +2. Adding dark mode state management (context/store) +3. Implementing CSS-in-JS styles for dark theme +4. Updating existing components to support theme switching +5. Running tests and build process, addressing any failures or errors that occur +*Begins working on the first task* + + +The assistant used the todo list because: +1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes +2. The user explicitly requested tests and build be run afterward +3. The assistant inferred that tests and build need to pass by adding "Ensure tests and build succeed" as the final task + + + + +User: Help me rename the function getCwd to getCurrentWorkingDirectory across my project +Assistant: *Uses grep or search tools to locate all instances of getCwd in the codebase* +I've found 15 instances of 'getCwd' across 8 different files. +*Creates todo list with specific items for each file that needs updating* + + +The assistant used the todo list because: +1. First, the assistant searched to understand the scope of the task +2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps +3. The todo list helps ensure every instance is tracked and updated systematically +4. This approach prevents missing any occurrences and maintains code consistency + + + + + +User: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow. +Assistant: *Creates a todo list breaking down each feature into specific tasks based on the project architecture* +Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system. + + +The assistant used the todo list because: +1. The user provided multiple complex features to implement in a comma separated list +2. The todo list helps organize these large features into manageable tasks +3. This approach allows for tracking progress across the entire implementation + + + + +User: Can you help optimize my React application? It's rendering slowly and has performance issues. +Assistant: *Reviews component structure, render patterns, state management, and data fetching* +After analyzing your codebase, I've identified several performance issues. +*Creates todo list with items like: 1) Implementing memoization for expensive calculations in ProductList, 2) Adding virtualization for long lists in Dashboard, 3) Optimizing image loading in Gallery component, 4) Fixing state update loops in ShoppingCart, 5) Reviewing bundle size and implementing code splitting* +Let's start by implementing memoization for the expensive calculations in your ProductList component. + + +The assistant used the todo list because: +1. First, the assistant examined the codebase to identify specific performance issues +2. Based on this analysis, it identified multiple optimization opportunities +3. Performance optimization is a non-trivial task requiring multiple steps +4. The todo list helps methodically track improvements across different components +5. This systematic approach ensures all performance bottlenecks are addressed + + + +## Examples of When NOT to Use the Todo List + + +User: How do I print 'Hello World' in Python? +Assistant: In Python, you can print "Hello World" with this simple code: + +python +print("Hello World") + +This will output the text "Hello World" to the console when executed. + + +The assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request. + + + diff --git a/system-prompt/2.1.112/patches/todowrite-examples.replace.txt b/system-prompt/2.1.112/patches/todowrite-examples.replace.txt new file mode 100644 index 0000000..490b363 --- /dev/null +++ b/system-prompt/2.1.112/patches/todowrite-examples.replace.txt @@ -0,0 +1,15 @@ +## Examples of When to Use the Todo List + + +User: Add dark mode toggle, then run tests and build +Assistant: I'll create a todo list to track this multi-step task. +*Creates todos: 1) Add toggle component, 2) Add state management, 3) Update styles, 4) Run tests and build* + + +## Examples of When NOT to Use the Todo List + + +User: How do I print 'Hello World' in Python? +Assistant: print("Hello World") + + diff --git a/system-prompt/2.1.112/patches/todowrite-states.find.txt b/system-prompt/2.1.112/patches/todowrite-states.find.txt new file mode 100644 index 0000000..30e021a --- /dev/null +++ b/system-prompt/2.1.112/patches/todowrite-states.find.txt @@ -0,0 +1,37 @@ +## Task States and Management + +1. **Task States**: Use these states to track progress: + - pending: Task not yet started + - in_progress: Currently working on (limit to ONE task at a time) + - completed: Task finished successfully + + **IMPORTANT**: Task descriptions must have two forms: + - content: The imperative form describing what needs to be done (e.g., "Run tests", "Build the project") + - activeForm: The present continuous form shown during execution (e.g., "Running tests", "Building the project") + +2. **Task Management**: + - Update task status in real-time as you work + - Mark tasks complete IMMEDIATELY after finishing (don't batch completions) + - Exactly ONE task must be in_progress at any time (not less, not more) + - Complete current tasks before starting new ones + - Remove tasks that are no longer relevant from the list entirely + +3. **Task Completion Requirements**: + - ONLY mark a task as completed when you have FULLY accomplished it + - If you encounter errors, blockers, or cannot finish, keep the task as in_progress + - When blocked, create a new task describing what needs to be resolved + - Never mark a task as completed if: + - Tests are failing + - Implementation is partial + - You encountered unresolved errors + - You couldn't find necessary files or dependencies + +4. **Task Breakdown**: + - Create specific, actionable items + - Break complex tasks into smaller, manageable steps + - Use clear, descriptive task names + - Always provide both forms: + - content: "Fix authentication bug" + - activeForm: "Fixing authentication bug" + +When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/todowrite-states.replace.txt b/system-prompt/2.1.112/patches/todowrite-states.replace.txt new file mode 100644 index 0000000..4bf3ff9 --- /dev/null +++ b/system-prompt/2.1.112/patches/todowrite-states.replace.txt @@ -0,0 +1,8 @@ +## Task States +States: pending, in_progress (one at a time), completed. +Each task needs: content ("Run tests") and activeForm ("Running tests"). + +Rules: +- Mark complete IMMEDIATELY when done, never batch +- Only mark complete if fully accomplished (no failing tests, partial work, or errors) +- If blocked, keep in_progress and add new task for blocker \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/todowrite-when-to-use.find.txt b/system-prompt/2.1.112/patches/todowrite-when-to-use.find.txt new file mode 100644 index 0000000..cd13cc4 --- /dev/null +++ b/system-prompt/2.1.112/patches/todowrite-when-to-use.find.txt @@ -0,0 +1,20 @@ +## When to Use This Tool +Use this tool proactively in these scenarios: + +1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions +2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations +3. User explicitly requests todo list - When the user directly asks you to use the todo list +4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated) +5. After receiving new instructions - Immediately capture user requirements as todos +6. When you start working on a task - Mark it as in_progress BEFORE beginning work. Ideally you should only have one todo as in_progress at a time +7. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation + +## When NOT to Use This Tool + +Skip using this tool when: +1. There is only a single, straightforward task +2. The task is trivial and tracking it provides no organizational benefit +3. The task can be completed in less than 3 trivial steps +4. The task is purely conversational or informational + +NOTE that you should not use this tool if there is only one trivial task to do. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/todowrite-when-to-use.replace.txt b/system-prompt/2.1.112/patches/todowrite-when-to-use.replace.txt new file mode 100644 index 0000000..17145eb --- /dev/null +++ b/system-prompt/2.1.112/patches/todowrite-when-to-use.replace.txt @@ -0,0 +1,6 @@ +## When to Use +Use for: 3+ step tasks, multiple tasks, user-requested lists. +Mark in_progress before starting, completed immediately when done. + +## When NOT to Use +Skip for: single trivial tasks, informational questions, <3 steps. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/url-warning.find.txt b/system-prompt/2.1.112/patches/url-warning.find.txt new file mode 100644 index 0000000..79f5f5f --- /dev/null +++ b/system-prompt/2.1.112/patches/url-warning.find.txt @@ -0,0 +1 @@ +IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/url-warning.replace.txt b/system-prompt/2.1.112/patches/url-warning.replace.txt new file mode 100644 index 0000000..efb726f --- /dev/null +++ b/system-prompt/2.1.112/patches/url-warning.replace.txt @@ -0,0 +1 @@ +IMPORTANT: Never guess URLs. Only use URLs from user messages or local files. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/webfetch-usage.find.txt b/system-prompt/2.1.112/patches/webfetch-usage.find.txt new file mode 100644 index 0000000..899467c --- /dev/null +++ b/system-prompt/2.1.112/patches/webfetch-usage.find.txt @@ -0,0 +1,9 @@ +Usage notes: + - IMPORTANT: If an MCP-provided web fetch tool is available, prefer using that tool instead of this one, as it may have fewer restrictions. + - The URL must be a fully-formed valid URL + - HTTP URLs will be automatically upgraded to HTTPS + - The prompt should describe what information you want to extract from the page + - This tool is read-only and does not modify any files + - Results may be summarized if the content is very large + - Includes a self-cleaning 15-minute cache for faster responses when repeatedly accessing the same URL + - When a URL redirects to a different host, the tool will inform you and provide the redirect URL in a special format. You should then make a new WebFetch request with the redirect URL to fetch the content. diff --git a/system-prompt/2.1.112/patches/webfetch-usage.replace.txt b/system-prompt/2.1.112/patches/webfetch-usage.replace.txt new file mode 100644 index 0000000..32a4f05 --- /dev/null +++ b/system-prompt/2.1.112/patches/webfetch-usage.replace.txt @@ -0,0 +1,3 @@ +Usage notes: + - Prefer MCP web fetch tools (mcp__*) if available + - On redirect to different host, make new request with redirect URL diff --git a/system-prompt/2.1.112/patches/websearch-critical.find.txt b/system-prompt/2.1.112/patches/websearch-critical.find.txt new file mode 100644 index 0000000..23b6265 --- /dev/null +++ b/system-prompt/2.1.112/patches/websearch-critical.find.txt @@ -0,0 +1,12 @@ +CRITICAL REQUIREMENT - You MUST follow this: + - After answering the user's question, you MUST include a "Sources:" section at the end of your response + - In the Sources section, list all relevant URLs from the search results as markdown hyperlinks: [Title](URL) + - This is MANDATORY - never skip including sources in your response + - Example format: + + [Your answer here] + + Sources: + - [Source Title 1](https://example.com/1) + - [Source Title 2](https://example.com/2) + diff --git a/system-prompt/2.1.112/patches/websearch-critical.replace.txt b/system-prompt/2.1.112/patches/websearch-critical.replace.txt new file mode 100644 index 0000000..68471b2 --- /dev/null +++ b/system-prompt/2.1.112/patches/websearch-critical.replace.txt @@ -0,0 +1,2 @@ +IMPORTANT: Always include a "Sources:" section with markdown hyperlinks [Title](URL) at end of response. + diff --git a/system-prompt/2.1.112/patches/write-tool.find.txt b/system-prompt/2.1.112/patches/write-tool.find.txt new file mode 100644 index 0000000..633aac6 --- /dev/null +++ b/system-prompt/2.1.112/patches/write-tool.find.txt @@ -0,0 +1,7 @@ +Writes a file to the local filesystem. + +Usage: +- This tool will overwrite the existing file if there is one at the provided path.${vF5()} +- Prefer the Edit tool for modifying existing files — it only sends the diff. Only use this tool to create new files or for complete rewrites. +- NEVER create documentation files (*.md) or README files unless explicitly requested by the User. +- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked. \ No newline at end of file diff --git a/system-prompt/2.1.112/patches/write-tool.replace.txt b/system-prompt/2.1.112/patches/write-tool.replace.txt new file mode 100644 index 0000000..2e21d15 --- /dev/null +++ b/system-prompt/2.1.112/patches/write-tool.replace.txt @@ -0,0 +1 @@ +Write file (overwrites existing).${vF5()} Prefer editing over creating. No unsolicited docs/READMEs. \ No newline at end of file diff --git a/system-prompt/2.1.112/restore-cli.sh b/system-prompt/2.1.112/restore-cli.sh new file mode 100755 index 0000000..2213e06 --- /dev/null +++ b/system-prompt/2.1.112/restore-cli.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# Restore Claude Code CLI from backup + +set -e + +# Find claude CLI using which and common locations +get_claude_cli() { + # Method 1: Use 'which claude' and follow symlinks + local claude_bin=$(which claude 2>/dev/null) + if [ -n "$claude_bin" ]; then + local real_path=$(realpath "$claude_bin") + local cli_path=$(dirname "$real_path")/cli.js + if [ -f "$cli_path" ]; then + echo "$cli_path" + return 0 + fi + fi + + # Method 2: Check common npm global locations + for loc in "/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js" \ + "/usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js"; do + if [ -f "$loc" ]; then + echo "$loc" + return 0 + fi + done + + # Method 3: Check local install location + local claude_launcher="$HOME/.claude/local/claude" + if [ -f "$claude_launcher" ]; then + local bin_path=$(grep 'exec' "$claude_launcher" | head -1 | sed 's/.*exec "\([^"]*\)".*/\1/') + [ -n "$bin_path" ] && realpath "$bin_path" + return 0 + fi + + return 1 +} + +# Allow custom path for testing, otherwise find it dynamically +if [ -n "$1" ]; then + CLI_PATH="$1" +else + CLI_PATH=$(get_claude_cli) + if [ -z "$CLI_PATH" ]; then + echo "Error: Could not find claude CLI. Is claude installed?" + exit 1 + fi +fi +BACKUP_PATH="$CLI_PATH.backup" + +if [ ! -f "$BACKUP_PATH" ]; then + echo "Error: No backup found at $BACKUP_PATH" + exit 1 +fi + +cp "$BACKUP_PATH" "$CLI_PATH" +echo "Restored from backup." diff --git a/system-prompt/2.1.121/backup-cli.sh b/system-prompt/2.1.121/backup-cli.sh new file mode 100755 index 0000000..c6a3370 --- /dev/null +++ b/system-prompt/2.1.121/backup-cli.sh @@ -0,0 +1,87 @@ +#!/bin/bash +# Backup script for Claude Code CLI bundle +# Only backs up if the file matches the known original hash + +set -e + +# Known original - update these when Claude Code updates +EXPECTED_VERSION="2.1.121" +EXPECTED_HASH="885f3342ff45bb4258517a4dc0f8405bbe2817f237d6b8b2fe4429694ecbe9c2" + +# Find claude CLI using which and common locations +get_claude_cli() { + # Method 1: Use 'which claude' and follow symlinks + local claude_bin=$(which claude 2>/dev/null) + if [ -n "$claude_bin" ]; then + local real_path=$(realpath "$claude_bin") + local cli_path=$(dirname "$real_path")/cli.js + if [ -f "$cli_path" ]; then + echo "$cli_path" + return 0 + fi + fi + + # Method 2: Check common npm global locations + for loc in "/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js" \ + "/usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js"; do + if [ -f "$loc" ]; then + echo "$loc" + return 0 + fi + done + + # Method 3: Check local install location + local claude_launcher="$HOME/.claude/local/claude" + if [ -f "$claude_launcher" ]; then + local bin_path=$(grep 'exec' "$claude_launcher" | head -1 | sed 's/.*exec "\([^"]*\)".*/\1/') + [ -n "$bin_path" ] && realpath "$bin_path" + return 0 + fi + + return 1 +} + +# Allow custom path for testing, otherwise find it dynamically +if [ -n "$1" ]; then + CLI_PATH="$1" +else + CLI_PATH=$(get_claude_cli) + if [ -z "$CLI_PATH" ]; then + echo "Error: Could not find claude CLI. Is claude installed?" + exit 1 + fi +fi +BACKUP_PATH="$CLI_PATH.backup" + +# Check if backup already exists +if [ -f "$BACKUP_PATH" ]; then + echo "Error: Backup already exists at $BACKUP_PATH" + echo "Delete it manually if you want to create a new backup." + exit 1 +fi + +# Check if cli.js exists +if [ ! -f "$CLI_PATH" ]; then + echo "Error: CLI not found at $CLI_PATH" + exit 1 +fi + +# Compute current hash +CURRENT_HASH=$(shasum -a 256 "$CLI_PATH" | cut -d' ' -f1) + +# Compare hashes +if [ "$CURRENT_HASH" != "$EXPECTED_HASH" ]; then + echo "Error: Hash mismatch - file may be modified or different version" + echo "" + echo "Expected (v$EXPECTED_VERSION): $EXPECTED_HASH" + echo "Current: $CURRENT_HASH" + echo "" + echo "If Claude Code was updated, update EXPECTED_VERSION and EXPECTED_HASH in this script." + exit 1 +fi + +# Create backup +cp "$CLI_PATH" "$BACKUP_PATH" +echo "Backup created: $BACKUP_PATH" +echo "Version: $EXPECTED_VERSION" +echo "Hash: $EXPECTED_HASH" diff --git a/system-prompt/2.1.121/native-extract.js b/system-prompt/2.1.121/native-extract.js new file mode 100755 index 0000000..c4e6d55 --- /dev/null +++ b/system-prompt/2.1.121/native-extract.js @@ -0,0 +1,155 @@ +#!/usr/bin/env node +/** + * Extract cli.js from Claude Code native binary + * Supports ELF (Linux) and Mach-O (macOS) formats + */ + +const LIEF = require("node-lief"); +const fs = require("fs"); + +const BUN_TRAILER = Buffer.from("\n---- Bun! ----\n"); +const SIZEOF_OFFSETS = 32; +const SIZEOF_STRING_POINTER = 8; +const SIZEOF_MODULE_V1 = 4 * SIZEOF_STRING_POINTER + 4; // 36 bytes (Bun < 1.3.9) +const SIZEOF_MODULE_V2 = 4 * SIZEOF_STRING_POINTER + 4 + 16; // 52 bytes (Bun >= 1.3.9, added extra field) + +function detectModuleSize(modulesListLength) { + if (modulesListLength % SIZEOF_MODULE_V2 === 0) return SIZEOF_MODULE_V2; + if (modulesListLength % SIZEOF_MODULE_V1 === 0) return SIZEOF_MODULE_V1; + return SIZEOF_MODULE_V1; // fallback +} + +function parseStringPointer(buffer, offset) { + return { offset: buffer.readUInt32LE(offset), length: buffer.readUInt32LE(offset + 4) }; +} + +function parseOffsets(buffer) { + let pos = 0; + const byteCount = buffer.readBigUInt64LE(pos); pos += 8; + const modulesPtr = parseStringPointer(buffer, pos); pos += 8; + const entryPointId = buffer.readUInt32LE(pos); pos += 4; + const compileExecArgvPtr = parseStringPointer(buffer, pos); + return { byteCount, modulesPtr, entryPointId, compileExecArgvPtr }; +} + +function getStringPointerContent(buffer, sp) { + return buffer.subarray(sp.offset, sp.offset + sp.length); +} + +function parseModule(buffer, offset) { + let pos = offset; + return { + name: parseStringPointer(buffer, pos), contents: parseStringPointer(buffer, pos + 8), + sourcemap: parseStringPointer(buffer, pos + 16), bytecode: parseStringPointer(buffer, pos + 24), + encoding: buffer.readUInt8(pos + 32), loader: buffer.readUInt8(pos + 33), + moduleFormat: buffer.readUInt8(pos + 34), side: buffer.readUInt8(pos + 35) + }; +} + +function isClaudeModule(name) { + return name.endsWith("/claude") || name === "claude" || + name.endsWith("/claude.exe") || name === "claude.exe" || + name.endsWith("/cli.js"); +} + +function extractBunDataFromSection(sectionData) { + // Try u64 header first (Bun >= 1.3.4), then u32 + const bunDataSizeU64 = sectionData.length >= 8 ? Number(sectionData.readBigUInt64LE(0)) : 0; + const bunDataSizeU32 = sectionData.readUInt32LE(0); + + let headerSize, bunDataSize; + if (sectionData.length >= 8 && 8 + bunDataSizeU64 <= sectionData.length && 8 + bunDataSizeU64 >= sectionData.length - 4096) { + headerSize = 8; bunDataSize = bunDataSizeU64; + } else if (4 + bunDataSizeU32 <= sectionData.length && 4 + bunDataSizeU32 >= sectionData.length - 4096) { + headerSize = 4; bunDataSize = bunDataSizeU32; + } else { + throw new Error("Cannot determine section header format"); + } + + const bunDataContent = sectionData.subarray(headerSize, headerSize + bunDataSize); + const trailerStart = bunDataContent.length - BUN_TRAILER.length; + const offsetsStart = bunDataContent.length - SIZEOF_OFFSETS - BUN_TRAILER.length; + const offsetsBytes = bunDataContent.subarray(offsetsStart, offsetsStart + SIZEOF_OFFSETS); + + return { bunOffsets: parseOffsets(offsetsBytes), bunData: bunDataContent, sectionHeaderSize: headerSize }; +} + +function extractFromELFOverlay(binary) { + const overlay = binary.overlay; + const offsetsStart = overlay.length - 8 - BUN_TRAILER.length - SIZEOF_OFFSETS; + const offsetsBytes = overlay.subarray(offsetsStart, overlay.length - 8 - BUN_TRAILER.length); + const bunOffsets = parseOffsets(offsetsBytes); + const tailDataLen = 8 + BUN_TRAILER.length + SIZEOF_OFFSETS; + const dataStart = overlay.length - tailDataLen - Number(bunOffsets.byteCount); + const dataRegion = overlay.subarray(dataStart, overlay.length - tailDataLen); + const trailerBytes = overlay.subarray(overlay.length - 8 - BUN_TRAILER.length, overlay.length - 8); + return { bunOffsets, bunData: Buffer.concat([dataRegion, offsetsBytes, trailerBytes]) }; +} + +function extractFromELFRaw(binaryPath) { + const buf = fs.readFileSync(binaryPath); + const trailerIdx = buf.lastIndexOf(BUN_TRAILER); + if (trailerIdx === -1) throw new Error("Bun trailer not found in binary"); + const offsetsStart = trailerIdx - SIZEOF_OFFSETS; + const offsetsBytes = buf.subarray(offsetsStart, trailerIdx); + const bunOffsets = parseOffsets(offsetsBytes); + const dataStart = offsetsStart - Number(bunOffsets.byteCount); + const bunData = buf.subarray(dataStart, trailerIdx + BUN_TRAILER.length); + return { bunOffsets, bunData, dataStartInFile: dataStart }; +} + +function extractFromELF(binary, binaryPath) { + if (binary.hasOverlay && binary.overlay.length > 0) { + return extractFromELFOverlay(binary); + } + return extractFromELFRaw(binaryPath); +} + +function extractFromMachO(binary) { + const bunSegment = binary.getSegment("__BUN"); + if (!bunSegment) throw new Error("__BUN segment not found"); + const bunSection = bunSegment.getSection("__bun"); + if (!bunSection) throw new Error("__bun section not found"); + return extractBunDataFromSection(bunSection.content); +} + +function extract(binaryPath) { + LIEF.logging.disable(); + const binary = LIEF.parse(binaryPath); + + let bunData, bunOffsets; + if (binary.format === "ELF") { + ({ bunData, bunOffsets } = extractFromELF(binary, binaryPath)); + } else if (binary.format === "MachO") { + ({ bunData, bunOffsets } = extractFromMachO(binary)); + } else { + throw new Error(`Unsupported format: ${binary.format}`); + } + + const modulesListBytes = getStringPointerContent(bunData, bunOffsets.modulesPtr); + const moduleSize = detectModuleSize(modulesListBytes.length); + const modulesCount = Math.floor(modulesListBytes.length / moduleSize); + + for (let i = 0; i < modulesCount; i++) { + const module = parseModule(modulesListBytes, i * moduleSize); + const moduleName = getStringPointerContent(bunData, module.name).toString("utf-8"); + if (isClaudeModule(moduleName)) { + return getStringPointerContent(bunData, module.contents); + } + } + throw new Error("Claude module not found"); +} + +// Main +const binaryPath = process.argv[2] || `${process.env.HOME}/.local/share/claude/versions/2.1.17`; +const outputPath = process.argv[3] || "/tmp/native-cli.js"; + +try { + console.log(`Extracting from: ${binaryPath}`); + const cliJs = extract(binaryPath); + fs.writeFileSync(outputPath, cliJs); + console.log(`Extracted to: ${outputPath} (${cliJs.length} bytes)`); +} catch (err) { + console.error("Error:", err.message); + process.exit(1); +} diff --git a/system-prompt/2.1.121/native-repack.js b/system-prompt/2.1.121/native-repack.js new file mode 100755 index 0000000..d94828e --- /dev/null +++ b/system-prompt/2.1.121/native-repack.js @@ -0,0 +1,255 @@ +#!/usr/bin/env node +/** + * Repack patched cli.js into Claude Code native binary + * Uses in-place replacement to avoid issues with overlapping Bun string pointers + * Supports ELF (Linux) and Mach-O (macOS) formats + */ + +const LIEF = require("node-lief"); +const fs = require("fs"); +const { execSync } = require("child_process"); + +const BUN_TRAILER = Buffer.from("\n---- Bun! ----\n"); +const SIZEOF_OFFSETS = 32; +const SIZEOF_STRING_POINTER = 8; +const SIZEOF_MODULE_V1 = 4 * SIZEOF_STRING_POINTER + 4; // 36 bytes (Bun < 1.3.9) +const SIZEOF_MODULE_V2 = 4 * SIZEOF_STRING_POINTER + 4 + 16; // 52 bytes (Bun >= 1.3.9, added extra field) + +function detectModuleSize(modulesListLength) { + if (modulesListLength % SIZEOF_MODULE_V2 === 0) return SIZEOF_MODULE_V2; + if (modulesListLength % SIZEOF_MODULE_V1 === 0) return SIZEOF_MODULE_V1; + return SIZEOF_MODULE_V1; // fallback +} + +function parseStringPointer(buffer, offset) { + return { offset: buffer.readUInt32LE(offset), length: buffer.readUInt32LE(offset + 4) }; +} + +function writeStringPointer(buffer, offset, sp) { + buffer.writeUInt32LE(sp.offset, offset); + buffer.writeUInt32LE(sp.length, offset + 4); +} + +function parseOffsets(buffer) { + let pos = 0; + const byteCount = buffer.readBigUInt64LE(pos); pos += 8; + const modulesPtr = parseStringPointer(buffer, pos); pos += 8; + const entryPointId = buffer.readUInt32LE(pos); pos += 4; + const compileExecArgvPtr = parseStringPointer(buffer, pos); + return { byteCount, modulesPtr, entryPointId, compileExecArgvPtr }; +} + +function getStringPointerContent(buffer, sp) { + return buffer.subarray(sp.offset, sp.offset + sp.length); +} + +function parseModule(buffer, offset) { + let pos = offset; + return { + name: parseStringPointer(buffer, pos), contents: parseStringPointer(buffer, pos + 8), + sourcemap: parseStringPointer(buffer, pos + 16), bytecode: parseStringPointer(buffer, pos + 24), + encoding: buffer.readUInt8(pos + 32), loader: buffer.readUInt8(pos + 33), + moduleFormat: buffer.readUInt8(pos + 34), side: buffer.readUInt8(pos + 35) + }; +} + +function isClaudeModule(name) { + return name.endsWith("/claude") || name === "claude" || + name.endsWith("/claude.exe") || name === "claude.exe" || + name.endsWith("/cli.js"); +} + +function extractBunDataFromSection(sectionData) { + const bunDataSizeU64 = sectionData.length >= 8 ? Number(sectionData.readBigUInt64LE(0)) : 0; + const bunDataSizeU32 = sectionData.readUInt32LE(0); + let headerSize, bunDataSize; + if (sectionData.length >= 8 && 8 + bunDataSizeU64 <= sectionData.length && 8 + bunDataSizeU64 >= sectionData.length - 4096) { + headerSize = 8; bunDataSize = bunDataSizeU64; + } else if (4 + bunDataSizeU32 <= sectionData.length && 4 + bunDataSizeU32 >= sectionData.length - 4096) { + headerSize = 4; bunDataSize = bunDataSizeU32; + } else { + throw new Error("Cannot determine section header format"); + } + const bunDataContent = sectionData.subarray(headerSize, headerSize + bunDataSize); + const offsetsStart = bunDataContent.length - SIZEOF_OFFSETS - BUN_TRAILER.length; + const offsetsBytes = bunDataContent.subarray(offsetsStart, offsetsStart + SIZEOF_OFFSETS); + return { bunOffsets: parseOffsets(offsetsBytes), bunData: bunDataContent, sectionHeaderSize: headerSize }; +} + +function extractFromELFOverlay(binary) { + const overlay = binary.overlay; + const offsetsStart = overlay.length - 8 - BUN_TRAILER.length - SIZEOF_OFFSETS; + const offsetsBytes = overlay.subarray(offsetsStart, overlay.length - 8 - BUN_TRAILER.length); + const bunOffsets = parseOffsets(offsetsBytes); + const tailDataLen = 8 + BUN_TRAILER.length + SIZEOF_OFFSETS; + const dataStart = overlay.length - tailDataLen - Number(bunOffsets.byteCount); + const dataRegion = overlay.subarray(dataStart, overlay.length - tailDataLen); + const trailerBytes = overlay.subarray(overlay.length - 8 - BUN_TRAILER.length, overlay.length - 8); + return { bunOffsets, bunData: Buffer.concat([dataRegion, offsetsBytes, trailerBytes]), dataStart, useRaw: false }; +} + +function extractFromELFRaw(binaryPath) { + const buf = fs.readFileSync(binaryPath); + const trailerIdx = buf.lastIndexOf(BUN_TRAILER); + if (trailerIdx === -1) throw new Error("Bun trailer not found in binary"); + const offsetsStart = trailerIdx - SIZEOF_OFFSETS; + const offsetsBytes = buf.subarray(offsetsStart, trailerIdx); + const bunOffsets = parseOffsets(offsetsBytes); + const dataStartInFile = offsetsStart - Number(bunOffsets.byteCount); + const bunData = buf.subarray(dataStartInFile, trailerIdx + BUN_TRAILER.length); + return { bunOffsets, bunData, dataStartInFile, useRaw: true }; +} + +function extractFromELF(binary, binaryPath) { + if (binary.hasOverlay && binary.overlay.length > 0) { + return extractFromELFOverlay(binary); + } + return extractFromELFRaw(binaryPath); +} + +function extractFromMachO(binary) { + const bunSegment = binary.getSegment("__BUN"); + if (!bunSegment) throw new Error("__BUN segment not found"); + const bunSection = bunSegment.getSection("__bun"); + if (!bunSection) throw new Error("__bun section not found"); + return extractBunDataFromSection(bunSection.content); +} + +/** + * In-place replacement of cli.js contents within the bun data buffer. + * The old rebuildBunData approach copied each module's strings separately, + * but Bun uses overlapping string pointers (shared memory regions), causing + * the rebuilt buffer to be ~13x larger than the original (1.5GB vs 118MB). + * + * This approach writes the patched content directly over the original location, + * padding with semicolons if the patched content is smaller. The module's + * contents length pointer is updated to reflect the new size (without padding). + */ +function patchBunDataInPlace(bunData, bunOffsets, modifiedClaudeJs) { + const modulesListBytes = getStringPointerContent(bunData, bunOffsets.modulesPtr); + const moduleSize = detectModuleSize(modulesListBytes.length); + const modulesCount = Math.floor(modulesListBytes.length / moduleSize); + + for (let i = 0; i < modulesCount; i++) { + const module = parseModule(modulesListBytes, i * moduleSize); + const moduleName = getStringPointerContent(bunData, module.name).toString("utf-8"); + + if (isClaudeModule(moduleName)) { + const origSize = module.contents.length; + const newSize = modifiedClaudeJs.length; + + if (newSize > origSize) { + throw new Error(`Patched cli.js (${newSize} bytes) is larger than original (${origSize} bytes). In-place replacement requires patched content to be <= original size.`); + } + + // Write patched content at the original location + modifiedClaudeJs.copy(bunData, module.contents.offset); + + // Pad remaining space with semicolons (valid JS no-ops) + if (newSize < origSize) { + bunData.fill(0x3B, module.contents.offset + newSize, module.contents.offset + origSize); // 0x3B = ';' + } + + // Update the contents length in the module list to reflect actual content size. + // The bytecode pointer may overlap with or follow the contents region, so we + // keep the original length to avoid shifting any data. The semicolons are + // harmless JS that won't affect execution. + + console.log(` Replaced cli.js: ${origSize} -> ${newSize} bytes (${origSize - newSize} bytes padded)`); + return bunData; + } + } + + throw new Error("Claude module not found in bun data"); +} + +// Main +const binaryPath = process.argv[2]; +const patchedCliPath = process.argv[3]; +const outputPath = process.argv[4]; + +if (!binaryPath || !patchedCliPath || !outputPath) { + console.log("Usage: node native-repack.js "); + process.exit(1); +} + +LIEF.logging.disable(); +const binary = LIEF.parse(binaryPath); +const patchedCli = fs.readFileSync(patchedCliPath); + +console.log(`Binary format: ${binary.format}`); +console.log(`Patched cli.js: ${patchedCli.length} bytes`); + +if (binary.format === "ELF") { + // For ELF, read the entire binary and do byte-level replacement + const binaryBuf = fs.readFileSync(binaryPath); + const result = extractFromELF(binary, binaryPath); + const { bunData, bunOffsets, useRaw } = result; + + patchBunDataInPlace(bunData, bunOffsets, patchedCli); + + const dataRegionSize = Number(bunOffsets.byteCount); + if (useRaw) { + // New format: bunData is a subarray of the file buffer from extractFromELFRaw + // The data was patched in-place via the subarray, so the file buffer is already updated. + // But bunData from extractFromELFRaw is a subarray of a separate readFileSync buffer, + // so we need to write it back to the main buffer. + bunData.copy(binaryBuf, result.dataStartInFile, 0, dataRegionSize); + } else { + // Old format: overlay-based extraction + const elfSize = binaryBuf.length - binary.overlay.length; + const overlayOffset = elfSize + result.dataStart; + bunData.copy(binaryBuf, overlayOffset, 0, dataRegionSize); + } + + const origStat = fs.statSync(binaryPath); + fs.writeFileSync(outputPath, binaryBuf); + fs.chmodSync(outputPath, origStat.mode); + +} else if (binary.format === "MachO") { + // For Mach-O, patch the section data in place via LIEF + const bunSegment = binary.getSegment("__BUN"); + const bunSection = bunSegment.getSection("__bun"); + const sectionData = Buffer.from(bunSection.content); + + // Determine header size + const bunDataSizeU64 = sectionData.length >= 8 ? Number(sectionData.readBigUInt64LE(0)) : 0; + const bunDataSizeU32 = sectionData.readUInt32LE(0); + let headerSize; + if (sectionData.length >= 8 && 8 + bunDataSizeU64 <= sectionData.length && 8 + bunDataSizeU64 >= sectionData.length - 4096) { + headerSize = 8; + } else if (4 + bunDataSizeU32 <= sectionData.length && 4 + bunDataSizeU32 >= sectionData.length - 4096) { + headerSize = 4; + } else { + throw new Error("Cannot determine section header format"); + } + + const result = extractBunDataFromSection(sectionData); + patchBunDataInPlace(result.bunData, result.bunOffsets, patchedCli); + + // Write patched bun data back into section data + result.bunData.copy(sectionData, headerSize); + + if (binary.hasCodeSignature) binary.removeSignature(); + bunSection.content = sectionData; + + const tempPath = outputPath + ".tmp"; + binary.write(tempPath); + const origStat = fs.statSync(binaryPath); + fs.chmodSync(tempPath, origStat.mode); + fs.renameSync(tempPath, outputPath); + + // Re-sign on macOS + try { + execSync(`codesign -s - -f "${outputPath}"`, { stdio: "ignore" }); + console.log("Code signed successfully"); + } catch (e) { + console.warn("Warning: codesign failed, binary may not run"); + } + +} else { + console.error(`Unsupported format: ${binary.format}`); + process.exit(1); +} + +console.log(`Written to: ${outputPath}`); diff --git a/system-prompt/2.1.121/patch-cli.js b/system-prompt/2.1.121/patch-cli.js new file mode 100644 index 0000000..f099915 --- /dev/null +++ b/system-prompt/2.1.121/patch-cli.js @@ -0,0 +1,388 @@ +#!/usr/bin/env node +/** + * Patch script for Claude Code CLI system prompt + * Always restores from backup first, then applies patches + */ + +const fs = require('fs'); +const crypto = require('crypto'); +const path = require('path'); + +// Configuration +const EXPECTED_VERSION = '2.1.121'; +const EXPECTED_HASHES = { + npm: '885f3342ff45bb4258517a4dc0f8405bbe2817f237d6b8b2fe4429694ecbe9c2', // Placeholder + 'native-linux-x64': '885f3342ff45bb4258517a4dc0f8405bbe2817f237d6b8b2fe4429694ecbe9c2', + 'native-linux-arm64': 'TODO: Update hash', + 'native-macos-arm64': 'TODO: Update hash', +}; + +// Unicode characters that native (Bun) builds escape differently +// Using codepoints to avoid syntax issues with special quotes +const UNICODE_ESCAPES = [ + ['\u2014', '\\u2014'], // em-dash — + ['\u2192', '\\u2192'], // arrow → + ['\u2013', '\\u2013'], // en-dash – + ['\u201c', '\\u201c'], // left double quote " + ['\u201d', '\\u201d'], // right double quote " + ['\u2018', '\\u2018'], // left single quote ' + ['\u2019', '\\u2019'], // right single quote ' + ['\u2026', '\\u2026'], // ellipsis … +]; + +// Convert literal Unicode to escape sequences (for native binary compatibility) +function toNativeEscapes(str) { + let result = str; + for (const [char, escape] of UNICODE_ESCAPES) { + result = result.split(char).join(escape); + } + return result; +} + +// Auto-detect CLI path by following the claude binary +const { execSync } = require('child_process'); + +function findClaudeCli() { + const home = process.env.HOME; + + // Method 1: Use 'which claude' and follow symlinks + try { + const claudePath = execSync('which claude', { encoding: 'utf8' }).trim(); + const realPath = fs.realpathSync(claudePath); + + // cli.js is in the same directory as the symlink target + const cliPath = path.join(path.dirname(realPath), 'cli.js'); + if (fs.existsSync(cliPath)) return cliPath; + + // Fallback: check if realPath itself is cli.js + if (realPath.endsWith('cli.js')) return realPath; + } catch (e) { + // which failed, try other methods + } + + // Method 2: Check common npm global locations + const globalLocations = [ + '/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js', + '/usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js', + ]; + + for (const loc of globalLocations) { + if (fs.existsSync(loc)) return loc; + } + + // Method 3: Check local install location + const localLauncher = path.join(home, '.claude/local/claude'); + if (fs.existsSync(localLauncher)) { + const content = fs.readFileSync(localLauncher, 'utf8'); + const execMatch = content.match(/exec\s+"([^"]+)"/); + if (execMatch) { + return fs.realpathSync(execMatch[1]); + } + } + + return null; +} + +// Allow custom path for testing, otherwise find it dynamically +const customPath = process.argv.slice(2).find(a => !a.startsWith('--')); +const basePath = customPath || findClaudeCli(); + +if (!basePath) { + console.error('Error: Could not find Claude Code CLI. Tried:'); + console.error(' - which claude'); + console.error(' - /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js'); + console.error(' - /usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js'); + console.error(' - ~/.claude/local/claude'); + console.error(''); + console.error('Pass the path as an argument: node patch-cli.js /path/to/cli.js'); + process.exit(1); +} + +const backupPath = basePath + '.backup'; +const patchDir = __dirname; + +// Helper to load patch strings from files (avoids template literal issues) +function loadPatch(name) { + const findPath = path.join(patchDir, 'patches', `${name}.find.txt`); + const replacePath = path.join(patchDir, 'patches', `${name}.replace.txt`); + if (fs.existsSync(findPath) && fs.existsSync(replacePath)) { + return { + find: fs.readFileSync(findPath, 'utf8'), + replace: fs.readFileSync(replacePath, 'utf8') + }; + } + return null; +} + +// Convert find/replace patterns to regex-based matching for variable references +// This allows patches to work across versions where variable names change +function createRegexPatch(find, replace) { + // Two types of placeholders: + // 1. ${varName} - matches template literal vars like ${n3}, ${T3} + // 2. __NAME__ - matches plain identifiers like kY7, aDA (for function names) + const varRegex = /\$\{[a-zA-Z0-9_.$]+(?:\([a-zA-Z0-9_.$]*\)(?:\/\d+)?)?\}/g; + const identRegex = /__[A-Z0-9_]+__/g; + + // Extract unique placeholders from find pattern (in order) + const placeholders = []; + const seenPlaceholders = new Set(); + + // Find all ${...} patterns + let match; + while ((match = varRegex.exec(find)) !== null) { + if (!seenPlaceholders.has(match[0])) { + seenPlaceholders.add(match[0]); + placeholders.push({ text: match[0], type: 'var' }); + } + } + + // Find all __NAME__ patterns + while ((match = identRegex.exec(find)) !== null) { + if (!seenPlaceholders.has(match[0])) { + seenPlaceholders.add(match[0]); + placeholders.push({ text: match[0], type: 'ident' }); + } + } + + // If no placeholders, return null (use simple string match) + if (placeholders.length === 0) { + return null; + } + + // Build regex pattern: escape everything except placeholders, which become capture groups + let regexStr = find; + // First escape all regex special chars + regexStr = regexStr.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + + // Then replace each unique placeholder with appropriate capture group + for (const p of placeholders) { + const escaped = p.text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + // ${...} matches template literals, __NAME__ matches identifiers + const capture = p.type === 'var' + ? '(\\$\\{[a-zA-Z0-9_.$]+(?:\\([a-zA-Z0-9_.$]*\\)(?:\\/\\d+)?)?\\})' + : '([a-zA-Z0-9_$]+)'; + regexStr = regexStr.split(escaped).join(capture); + } + + // Build replacement string with backreferences + let replaceStr = replace; + for (let i = 0; i < placeholders.length; i++) { + replaceStr = replaceStr.split(placeholders[i].text).join(`$${i + 1}`); + } + + return { + regex: new RegExp(regexStr), + replace: replaceStr, + varCount: placeholders.length + }; +} + +// Patches to apply (find → replace) +// Only patches saving 100+ chars are included +const patches = [ + // Big wins (1KB+) + { name: 'Slim TodoWrite examples (6KB → 0.4KB)', file: 'todowrite-examples' }, + { name: 'Remove Task tool Usage notes + examples (~2KB)', + customRegex: /(\$\{[a-zA-Z0-9_]+\})\n\nUsage notes:[\s\S]*?\n\n(\$\{[^}]+\})(?=`\}var)/, + customReplace: '$1' }, + { name: 'Simplify git commit section (~3.4KB)', file: 'git-commit' }, + { name: 'Slim Bash tool description (3.7KB → 0.6KB)', file: 'bash-tool' }, + { name: 'Simplify PR creation section (~1.7KB)', file: 'pr-creation' }, + { name: 'Slim EnterPlanMode When to Use (1.2KB → 200 chars)', file: 'enterplanmode-when-to-use' }, + { name: 'Slim TodoWrite states section (1.8KB → 0.4KB)', file: 'todowrite-states' }, + { name: 'Slim Skill tool instructions (887 → 80 chars)', file: 'skill-tool' }, + { name: 'Slim TodoWrite When to Use (1.2KB → 200 chars)', file: 'todowrite-when-to-use' }, + + // Medium wins (200-1000 chars) + { name: 'Slim over-engineering bullets (~900 → 200 chars)', file: 'over-engineering' }, + { name: 'Slim LSP tool description (~750 → 150 chars)', file: 'lsp-tool' }, + { name: 'Slim Edit tool description (~900 → 200 chars)', file: 'edit-tool' }, + { name: 'Slim EnterPlanMode examples (670 → 150 chars)', file: 'enterplanmode-examples' }, + { name: 'Slim EnterPlanMode What Happens (~400 → 120 chars)', file: 'enterplanmode-whathappens' }, + { name: 'Slim ExitPlanMode description (~1.5KB → 200 chars)', file: 'exitplanmode' }, + { name: 'Slim WebFetch usage notes (808 → 120 chars)', file: 'webfetch-usage' }, + { name: 'Slim Grep tool description (~715 → 350 chars)', file: 'grep-tool' }, + { name: 'Slim TodoWrite examples v2 (~400 chars)', file: 'todowrite-examples-v2' }, + { name: 'Slim claude-code-guide agent (~500 → 115 chars)', file: 'agent-claude-code-guide' }, + { name: 'Slim NotebookEdit (~510 → 100 chars)', file: 'notebookedit' }, + { name: 'Slim Write tool description (~550 → 100 chars)', file: 'write-tool' }, + { name: 'Slim WebSearch CRITICAL section (485 → 100 chars)', file: 'websearch-critical' }, + { name: 'Slim BashOutput (~440 → 95 chars)', file: 'bashoutput' }, + { name: 'Remove Code References section (363 chars)', file: 'code-references' }, + { name: 'Further slim git commit (~400 → 200 chars)', file: 'git-commit-v2' }, + { name: 'Slim Explore agent (~350 → 120 chars)', file: 'agent-explore' }, + { name: 'Slim security warning (~430 → 120 chars)', file: 'security-warning' }, + { name: 'Further slim PR creation (~400 → 150 chars)', file: 'pr-creation-v2' }, + { name: 'Slim Glob tool description (~400 → 100 chars)', file: 'glob-tool' }, + { name: 'Slim AskUserQuestion (~450 → 190 chars)', file: 'askuserquestion' }, + { name: 'Slim Bash.description param (~300 → 40 chars)', file: 'bash-description-param' }, + { name: 'Slim hooks instruction (~380 → 110 chars)', file: 'hooks-instruction' }, + { name: 'Slim Grep -A/-B/-C context params (~300 → 100 chars)', file: 'grep-params-context' }, + { name: 'Slim KillShell (~260 → 35 chars)', file: 'killshell' }, + { name: 'Slim Glob.path param (~255 → 65 chars)', file: 'glob-path-param' }, + { name: 'Slim Task tool intro (4.1KB → 0.6KB)', file: 'task-tool-intro' }, + { name: 'Slim Task tool when-not-to-use', file: 'task-tool-whennot' }, + { name: 'Slim Grep output_mode param (227 → 70 chars)', file: 'grep-params-output_mode' }, + { name: 'Slim Grep head_limit param (232 → 30 chars)', file: 'grep-params-head_limit' }, + { name: 'Slim doing tasks intro (~230 → 30 chars)', file: 'doing-tasks-intro' }, + { name: 'Slim CLI format instruction (~230 → 35 chars)', file: 'cli-format-instruction' }, + { name: 'Slim Read tool intro (292 → 110 chars)', file: 'read-tool' }, + { name: 'Slim Read capabilities (400 → 80 chars)', file: 'read-capabilities' }, + { name: 'Slim system-reminder instruction (~280 → 90 chars)', file: 'system-reminder-instruction' }, + { name: 'Slim output text instruction (~230 → 60 chars)', file: 'output-text-instruction' }, + { name: 'Slim general-purpose agent (~280 → 100 chars)', file: 'agent-general-purpose' }, + // glob-parallel-calls and read-parallel-calls removed - their text is already removed by glob-tool and read-tool patches + { name: 'Slim URL warning (~220 → 70 chars)', file: 'url-warning' }, + { name: 'Slim security vulnerabilities (~200 → 60 chars)', file: 'security-vulnerabilities' }, + { name: 'Slim Plan agent (~210 → 85 chars)', file: 'agent-plan' }, + { name: 'Slim Read offset/limit line (~165 → 50 chars)', file: 'read-tool-offset' }, + { name: 'Slim Grep offset param (135 → 35 chars)', file: 'grep-params-offset' }, + { name: 'Slim Grep type param (114 → 30 chars)', file: 'grep-params-type' }, + { name: 'Slim todos mark complete (~150 → 45 chars)', file: 'todos-mark-complete' }, + + // New patches + { name: 'Slim TaskUpdate description (~1.8KB → 150 chars)', file: 'taskupdate' }, + { name: 'Slim TaskList description (~1.2KB → 90 chars)', file: 'tasklist' }, +]; + +// Helper: compute SHA256 hash +function sha256(filepath) { + const content = fs.readFileSync(filepath); + return crypto.createHash('sha256').update(content).digest('hex'); +} + +// Main +function main() { + console.log('Claude Code CLI Patcher'); + console.log('=======================\n'); + + // 1. Check backup exists + if (!fs.existsSync(backupPath)) { + console.error(`Error: No backup found at ${backupPath}`); + console.error('Run backup-cli.sh first.'); + process.exit(1); + } + + // 2. Verify backup hash (accepts both npm and native builds) + const backupHash = sha256(backupPath); + const validHashes = Object.values(EXPECTED_HASHES); + if (!validHashes.includes(backupHash)) { + console.error('Error: Backup hash mismatch'); + console.error(`Expected one of: ${validHashes.join(', ')}`); + console.error(`Got: ${backupHash}`); + process.exit(1); + } + const buildType = Object.entries(EXPECTED_HASHES).find(([, h]) => h === backupHash)?.[0] || 'unknown'; + console.log(`Backup verified (v${EXPECTED_VERSION}, ${buildType} build)`); + + // 3. Restore from backup + fs.copyFileSync(backupPath, basePath); + console.log('Restored from backup\n'); + + // 4. Apply patches + let content = fs.readFileSync(basePath, 'utf8'); + let appliedCount = 0; + + // Support --max=N for bisecting + const maxArg = process.argv.find(a => a.startsWith('--max=')); + const maxPatches = maxArg ? parseInt(maxArg.split('=')[1]) : Infinity; + if (maxPatches !== Infinity) { + console.log(`Limiting to first ${maxPatches} patches (bisect mode)\n`); + } + + let patchIndex = 0; + for (const patch of patches) { + if (patchIndex >= maxPatches) { + console.log(`[STOP] Reached max patches limit (${maxPatches})`); + break; + } + patchIndex++; + // Custom regex patches bypass the normal find/replace flow + if (patch.customRegex) { + if (patch.customRegex.test(content)) { + content = content.replace(patch.customRegex, patch.customReplace); + console.log(`[OK] ${patch.name} (custom regex)`); + appliedCount++; + } else { + console.log(`[SKIP] ${patch.name} (custom regex not found)`); + } + continue; + } + + let find, replace; + + // Load from file if specified, otherwise use inline + if (patch.file) { + const loaded = loadPatch(patch.file); + if (!loaded) { + console.log(`[SKIP] ${patch.name} (patch files not found)`); + continue; + } + find = loaded.find; + replace = loaded.replace; + } else { + find = patch.find; + replace = patch.replace; + } + + // Try regex-based matching for patterns with variable references + const regexPatch = createRegexPatch(find, replace); + // Also create native-escaped variants for Bun-compiled binaries + const findNative = toNativeEscapes(find); + const replaceNative = toNativeEscapes(replace); + const regexPatchNative = (findNative !== find) ? createRegexPatch(findNative, replaceNative) : null; + + let applied = false; + + if (regexPatch) { + // Use regex matching + if (regexPatch.regex.test(content)) { + content = content.replace(regexPatch.regex, regexPatch.replace); + console.log(`[OK] ${patch.name} (regex, ${regexPatch.varCount} vars)`); + applied = true; + } else if (regexPatchNative && regexPatchNative.regex.test(content)) { + content = content.replace(regexPatchNative.regex, regexPatchNative.replace); + console.log(`[OK] ${patch.name} (regex+native, ${regexPatchNative.varCount} vars)`); + applied = true; + } else { + console.log(`[SKIP] ${patch.name} (regex not found)`); + } + } else if (content.includes(find)) { + // Simple string match (no variables) + if (patch.replaceAll) { + content = content.split(find).join(replace); + } else { + content = content.replace(find, replace); + } + console.log(`[OK] ${patch.name}`); + applied = true; + } else if (findNative !== find && content.includes(findNative)) { + // Try native-escaped variant + if (patch.replaceAll) { + content = content.split(findNative).join(replaceNative); + } else { + content = content.replace(findNative, replaceNative); + } + console.log(`[OK] ${patch.name} (native)`); + applied = true; + } else { + console.log(`[SKIP] ${patch.name} (not found)`); + } + + if (applied) appliedCount++; + } + + // 5. Write patched file + fs.writeFileSync(basePath, content); + + // 6. Summary + const newHash = sha256(basePath); + const sizeDiff = fs.statSync(backupPath).size - fs.statSync(basePath).size; + + console.log('\n-----------------------'); + console.log(`Patches applied: ${appliedCount}/${patches.length}`); + console.log(`Size reduction: ${sizeDiff} bytes`); + console.log(`New hash: ${newHash}`); +} + +main(); diff --git a/system-prompt/2.1.121/patch-native.sh b/system-prompt/2.1.121/patch-native.sh new file mode 100755 index 0000000..31f59c2 --- /dev/null +++ b/system-prompt/2.1.121/patch-native.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# Patch Claude Code native binary +# Usage: ./patch-native.sh [binary-path] + +set -e + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +BINARY_PATH="${1:-$HOME/.local/share/claude/versions/2.1.121}" +BACKUP_PATH="${BINARY_PATH}.backup" +TMP_CLI="/tmp/native-cli-$$.js" + +echo "Claude Code Native Binary Patcher" +echo "==================================" +echo "" + +# Check binary exists +if [ ! -f "$BINARY_PATH" ]; then + echo "Error: Binary not found at $BINARY_PATH" + exit 1 +fi + +# Get expected hashes from patch-cli.js +EXPECTED_HASHES=$(grep -E "^\s+'native-|^\s+npm:" "$SCRIPT_DIR/patch-cli.js" | sed "s/.*'\([a-f0-9]\{64\}\)'.*/\1/" | tr '\n' ' ') + +# Create backup if needed +if [ ! -f "$BACKUP_PATH" ]; then + echo "Validating binary before creating backup..." + + # Extract cli.js to check hash + TMP_CHECK="/tmp/native-cli-check-$$.js" + node "$SCRIPT_DIR/native-extract.js" "$BINARY_PATH" "$TMP_CHECK" 2>/dev/null + ACTUAL_HASH=$(shasum -a 256 "$TMP_CHECK" | cut -d' ' -f1) + rm -f "$TMP_CHECK" + + # Validate hash + if ! echo "$EXPECTED_HASHES" | grep -q "$ACTUAL_HASH"; then + echo "Error: Binary hash doesn't match any expected hash" + echo "Got: $ACTUAL_HASH" + echo "Expected: $EXPECTED_HASHES" + echo "" + echo "The binary may already be patched or is an unknown version." + echo "To force, manually create the backup: cp \"$BINARY_PATH\" \"$BACKUP_PATH\"" + exit 1 + fi + + echo "Hash validated: $ACTUAL_HASH" + echo "Creating backup: $BACKUP_PATH" + cp "$BINARY_PATH" "$BACKUP_PATH" +else + echo "Backup exists: $BACKUP_PATH" + echo "Restoring from backup..." + cp "$BACKUP_PATH" "$BINARY_PATH" +fi + +# Extract cli.js +echo "" +echo "Step 1: Extracting cli.js..." +node "$SCRIPT_DIR/native-extract.js" "$BACKUP_PATH" "$TMP_CLI" + +# Create cli.js backup for patcher +TMP_CLI_BACKUP="${TMP_CLI}.backup" +cp "$TMP_CLI" "$TMP_CLI_BACKUP" + +# Patch cli.js +echo "" +echo "Step 2: Applying patches..." +node "$SCRIPT_DIR/patch-cli.js" "$TMP_CLI" + +# Repack binary +echo "" +echo "Step 3: Repacking binary..." +node "$SCRIPT_DIR/native-repack.js" "$BACKUP_PATH" "$TMP_CLI" "$BINARY_PATH" + +# Cleanup +rm -f "$TMP_CLI" "$TMP_CLI_BACKUP" + +echo "" +echo "Done! Testing..." +"$BINARY_PATH" --version + +echo "" +echo "Patched binary: $BINARY_PATH" +echo "Backup: $BACKUP_PATH" diff --git a/system-prompt/2.1.121/patches/agent-claude-code-guide.find.txt b/system-prompt/2.1.121/patches/agent-claude-code-guide.find.txt new file mode 100644 index 0000000..e6a7dd3 --- /dev/null +++ b/system-prompt/2.1.121/patches/agent-claude-code-guide.find.txt @@ -0,0 +1 @@ +whenToUse:`Use this agent when the user asks questions ("Can Claude...", "Does Claude...", "How do I...") about: (1) Claude Code (the CLI tool) - features, hooks, slash commands, MCP servers, settings, IDE integrations, keyboard shortcuts; (2) Claude Agent SDK - building custom agents; (3) Claude API (formerly Anthropic API) - API usage, tool use, Anthropic SDK usage. **IMPORTANT:** Before spawning a new agent, check if there is already a running or recently completed claude-code-guide agent that you can continue via ${vf}.` \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/agent-claude-code-guide.replace.txt b/system-prompt/2.1.121/patches/agent-claude-code-guide.replace.txt new file mode 100644 index 0000000..31a6b23 --- /dev/null +++ b/system-prompt/2.1.121/patches/agent-claude-code-guide.replace.txt @@ -0,0 +1 @@ +whenToUse:`For questions about Claude Code, Agent SDK, or Claude API. Check for existing agent to resume before spawning new.` \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/agent-explore.find.txt b/system-prompt/2.1.121/patches/agent-explore.find.txt new file mode 100644 index 0000000..ca4c1ff --- /dev/null +++ b/system-prompt/2.1.121/patches/agent-explore.find.txt @@ -0,0 +1 @@ +'Fast read-only search agent for locating code. Use it to find files by pattern (eg. "src/components/**/*.tsx"), grep for symbols or keywords (eg. "API endpoints"), or answer "where is X defined / which files reference Y." Do NOT use it for code review, design-doc auditing, cross-file consistency checks, or open-ended analysis \u2014 it reads excerpts rather than whole files and will miss content past its read window. When calling, specify search breadth: "quick" for a single targeted lookup, "medium" for moderate exploration, or "very thorough" to search across multiple locations and naming conventions.' \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/agent-explore.replace.txt b/system-prompt/2.1.121/patches/agent-explore.replace.txt new file mode 100644 index 0000000..dc5eb1b --- /dev/null +++ b/system-prompt/2.1.121/patches/agent-explore.replace.txt @@ -0,0 +1 @@ +'Fast read-only agent for finding code & symbols. Breadth: quick, medium, or very thorough.' \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/agent-general-purpose.find.txt b/system-prompt/2.1.121/patches/agent-general-purpose.find.txt new file mode 100644 index 0000000..b37a674 --- /dev/null +++ b/system-prompt/2.1.121/patches/agent-general-purpose.find.txt @@ -0,0 +1 @@ +complex searches, code exploration, and multi-step tasks \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/agent-general-purpose.replace.txt b/system-prompt/2.1.121/patches/agent-general-purpose.replace.txt new file mode 100644 index 0000000..ea422ff --- /dev/null +++ b/system-prompt/2.1.121/patches/agent-general-purpose.replace.txt @@ -0,0 +1 @@ +complex searches and multi-step tasks \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/agent-plan.find.txt b/system-prompt/2.1.121/patches/agent-plan.find.txt new file mode 100644 index 0000000..b28a9f9 --- /dev/null +++ b/system-prompt/2.1.121/patches/agent-plan.find.txt @@ -0,0 +1 @@ +whenToUse:"Software architect agent for designing implementation plans. Use this when you need to plan the implementation strategy for a task. Returns step-by-step plans, identifies critical files, and considers architectural trade-offs." \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/agent-plan.replace.txt b/system-prompt/2.1.121/patches/agent-plan.replace.txt new file mode 100644 index 0000000..2a55c25 --- /dev/null +++ b/system-prompt/2.1.121/patches/agent-plan.replace.txt @@ -0,0 +1 @@ +whenToUse:"For implementation planning. Returns step-by-step plans with critical files and trade-offs." \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/askuserquestion.find.txt b/system-prompt/2.1.121/patches/askuserquestion.find.txt new file mode 100644 index 0000000..3c00a7a --- /dev/null +++ b/system-prompt/2.1.121/patches/askuserquestion.find.txt @@ -0,0 +1,9 @@ +Use this tool when you need to ask the user questions during execution. This allows you to: +1. Gather user preferences or requirements +2. Clarify ambiguous instructions +3. Get decisions on implementation choices as you work +4. Offer choices to the user about what direction to take. + +Usage notes: +- Users will always be able to select "Other" to provide custom text input +- Use multiSelect: true to allow multiple answers to be selected for a question \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/askuserquestion.replace.txt b/system-prompt/2.1.121/patches/askuserquestion.replace.txt new file mode 100644 index 0000000..4faf833 --- /dev/null +++ b/system-prompt/2.1.121/patches/askuserquestion.replace.txt @@ -0,0 +1 @@ +Ask user questions to gather preferences, clarify instructions, or get implementation decisions. Users can always select "Other" for custom input. Use multiSelect: true for multiple selections. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/bash-description-param.find.txt b/system-prompt/2.1.121/patches/bash-description-param.find.txt new file mode 100644 index 0000000..657bd25 --- /dev/null +++ b/system-prompt/2.1.121/patches/bash-description-param.find.txt @@ -0,0 +1 @@ +Clear, concise description of what this command does in active voice. Never use words like "complex" or "risk" in the description - just describe what it does. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/bash-description-param.replace.txt b/system-prompt/2.1.121/patches/bash-description-param.replace.txt new file mode 100644 index 0000000..1b59ede --- /dev/null +++ b/system-prompt/2.1.121/patches/bash-description-param.replace.txt @@ -0,0 +1 @@ +5-10 word active voice description of command \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/bash-tool.find.txt b/system-prompt/2.1.121/patches/bash-tool.find.txt new file mode 100644 index 0000000..610493e --- /dev/null +++ b/system-prompt/2.1.121/patches/bash-tool.find.txt @@ -0,0 +1 @@ +IMPORTANT: Avoid using this tool to run ${K} commands, unless explicitly instructed or after you have verified that a dedicated tool cannot accomplish your task. Instead, use the appropriate dedicated tool as this will provide a much better experience for the user: \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/bash-tool.replace.txt b/system-prompt/2.1.121/patches/bash-tool.replace.txt new file mode 100644 index 0000000..11cf95a --- /dev/null +++ b/system-prompt/2.1.121/patches/bash-tool.replace.txt @@ -0,0 +1 @@ +IMPORTANT: Avoid find/grep/cat/head/tail/sed/awk/echo - use dedicated tools: \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/bashoutput.find.txt b/system-prompt/2.1.121/patches/bashoutput.find.txt new file mode 100644 index 0000000..e226165 --- /dev/null +++ b/system-prompt/2.1.121/patches/bashoutput.find.txt @@ -0,0 +1,6 @@ +- Retrieves output from a running or completed task (background shell, agent, or remote session) +- Takes a task_id parameter identifying the task +- Returns the task output along with status information +- Use block=true (default) to wait for task completion +- Use block=false for non-blocking check of current status +- Task IDs can be found using the /tasks command \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/bashoutput.replace.txt b/system-prompt/2.1.121/patches/bashoutput.replace.txt new file mode 100644 index 0000000..6e49dda --- /dev/null +++ b/system-prompt/2.1.121/patches/bashoutput.replace.txt @@ -0,0 +1 @@ +Retrieves output from background bash shells. Takes bash_id, returns new output since last check. Use /tasks for IDs. diff --git a/system-prompt/2.1.121/patches/cli-format-instruction.find.txt b/system-prompt/2.1.121/patches/cli-format-instruction.find.txt new file mode 100644 index 0000000..6ff919f --- /dev/null +++ b/system-prompt/2.1.121/patches/cli-format-instruction.find.txt @@ -0,0 +1 @@ +You can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/cli-format-instruction.replace.txt b/system-prompt/2.1.121/patches/cli-format-instruction.replace.txt new file mode 100644 index 0000000..20afe28 --- /dev/null +++ b/system-prompt/2.1.121/patches/cli-format-instruction.replace.txt @@ -0,0 +1 @@ +Use GitHub markdown. Monospace, CommonMark. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/code-references.find.txt b/system-prompt/2.1.121/patches/code-references.find.txt new file mode 100644 index 0000000..bfbb315 --- /dev/null +++ b/system-prompt/2.1.121/patches/code-references.find.txt @@ -0,0 +1 @@ +When referencing specific functions or pieces of code include the pattern file_path:line_number to allow the user to easily navigate to the source code location. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/code-references.replace.txt b/system-prompt/2.1.121/patches/code-references.replace.txt new file mode 100644 index 0000000..91c354d --- /dev/null +++ b/system-prompt/2.1.121/patches/code-references.replace.txt @@ -0,0 +1 @@ +# . \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/doing-tasks-intro.find.txt b/system-prompt/2.1.121/patches/doing-tasks-intro.find.txt new file mode 100644 index 0000000..6c38387 --- /dev/null +++ b/system-prompt/2.1.121/patches/doing-tasks-intro.find.txt @@ -0,0 +1 @@ +The user will primarily request you to perform software engineering tasks. These may include solving bugs, adding new functionality, refactoring code, explaining code, and more. When given an unclear or generic instruction, consider it in the context of these \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/doing-tasks-intro.replace.txt b/system-prompt/2.1.121/patches/doing-tasks-intro.replace.txt new file mode 100644 index 0000000..cb63146 --- /dev/null +++ b/system-prompt/2.1.121/patches/doing-tasks-intro.replace.txt @@ -0,0 +1 @@ +For software engineering tasks: \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/edit-tool.find.txt b/system-prompt/2.1.121/patches/edit-tool.find.txt new file mode 100644 index 0000000..e9c08aa --- /dev/null +++ b/system-prompt/2.1.121/patches/edit-tool.find.txt @@ -0,0 +1,7 @@ +Performs exact string replacements in files. + +Usage:${ovY()} +- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: ${q}. Everything after that is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string. +- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required. +- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.${K} +- Use \`replace_all\` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/edit-tool.replace.txt b/system-prompt/2.1.121/patches/edit-tool.replace.txt new file mode 100644 index 0000000..e3eb11f --- /dev/null +++ b/system-prompt/2.1.121/patches/edit-tool.replace.txt @@ -0,0 +1 @@ +Exact string replacement.${ovY()} Preserve exact indentation (ignore line prefix). Prefer editing over new files.${K} Use replace_all to rename across file. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/enterplanmode-examples.find.txt b/system-prompt/2.1.121/patches/enterplanmode-examples.find.txt new file mode 100644 index 0000000..3adf1f1 --- /dev/null +++ b/system-prompt/2.1.121/patches/enterplanmode-examples.find.txt @@ -0,0 +1,28 @@ +## Examples + +### GOOD - Use EnterPlanMode: +User: "Add user authentication to the app" +- Requires architectural decisions (session vs JWT, where to store tokens, middleware structure) + +User: "Optimize the database queries" +- Multiple approaches possible, need to profile first, significant impact + +User: "Implement dark mode" +- Architectural decision on theme system, affects many components + +User: "Add a delete button to the user profile" +- Seems simple but involves: where to place it, confirmation dialog, API call, error handling, state updates + +User: "Update the error handling in the API" +- Affects multiple files, user should approve the approach + +### BAD - Don't use EnterPlanMode: +User: "Fix the typo in the README" +- Straightforward, no planning needed + +User: "Add a console.log to debug this function" +- Simple, obvious implementation + +User: "What files handle routing?" +- Research task, not implementation planning + diff --git a/system-prompt/2.1.121/patches/enterplanmode-examples.replace.txt b/system-prompt/2.1.121/patches/enterplanmode-examples.replace.txt new file mode 100644 index 0000000..8e88bd6 --- /dev/null +++ b/system-prompt/2.1.121/patches/enterplanmode-examples.replace.txt @@ -0,0 +1,5 @@ +## Examples + +GOOD: "Add user authentication" - requires architectural decisions (session vs JWT, middleware) +BAD: "Fix the typo in README" - straightforward, no planning needed + diff --git a/system-prompt/2.1.121/patches/enterplanmode-whathappens.find.txt b/system-prompt/2.1.121/patches/enterplanmode-whathappens.find.txt new file mode 100644 index 0000000..ef27849 --- /dev/null +++ b/system-prompt/2.1.121/patches/enterplanmode-whathappens.find.txt @@ -0,0 +1,9 @@ +## What Happens in Plan Mode + +In plan mode, you'll: +1. Thoroughly explore the codebase using Glob, Grep, and Read tools +2. Understand existing patterns and architecture +3. Design an implementation approach +4. Present your plan to the user for approval +5. Use ${__VAR__} if you need to clarify approaches +6. Exit plan mode with ExitPlanMode when ready to implement \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/enterplanmode-whathappens.replace.txt b/system-prompt/2.1.121/patches/enterplanmode-whathappens.replace.txt new file mode 100644 index 0000000..e366b45 --- /dev/null +++ b/system-prompt/2.1.121/patches/enterplanmode-whathappens.replace.txt @@ -0,0 +1,3 @@ +## What Happens in Plan Mode + +Explore codebase, design approach, present plan for approval. Use ${__VAR__} to clarify, ExitPlanMode when ready. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/enterplanmode-when-to-use.find.txt b/system-prompt/2.1.121/patches/enterplanmode-when-to-use.find.txt new file mode 100644 index 0000000..216a04b --- /dev/null +++ b/system-prompt/2.1.121/patches/enterplanmode-when-to-use.find.txt @@ -0,0 +1,30 @@ +**Prefer using EnterPlanMode** for implementation tasks unless they're simple. Use it when ANY of these conditions apply: + +1. **New Feature Implementation**: Adding meaningful new functionality + - Example: "Add a logout button" - where should it go? What should happen on click? + - Example: "Add form validation" - what rules? What error messages? + +2. **Multiple Valid Approaches**: The task can be solved in several different ways + - Example: "Add caching to the API" - could use Redis, in-memory, file-based, etc. + - Example: "Improve performance" - many optimization strategies possible + +3. **Code Modifications**: Changes that affect existing behavior or structure + - Example: "Update the login flow" - what exactly should change? + - Example: "Refactor this component" - what's the target architecture? + +4. **Architectural Decisions**: The task requires choosing between patterns or technologies + - Example: "Add real-time updates" - WebSockets vs SSE vs polling + - Example: "Implement state management" - Redux vs Context vs custom solution + +5. **Multi-File Changes**: The task will likely touch more than 2-3 files + - Example: "Refactor the authentication system" + - Example: "Add a new API endpoint with tests" + +6. **Unclear Requirements**: You need to explore before understanding the full scope + - Example: "Make the app faster" - need to profile and identify bottlenecks + - Example: "Fix the bug in checkout" - need to investigate root cause + +7. **User Preferences Matter**: The implementation could reasonably go multiple ways + - If you would use ${__VAR__} to clarify the approach, use EnterPlanMode instead + - Plan mode lets you explore first, then present options with context + diff --git a/system-prompt/2.1.121/patches/enterplanmode-when-to-use.replace.txt b/system-prompt/2.1.121/patches/enterplanmode-when-to-use.replace.txt new file mode 100644 index 0000000..fa47f2e --- /dev/null +++ b/system-prompt/2.1.121/patches/enterplanmode-when-to-use.replace.txt @@ -0,0 +1,4 @@ +## When to Use This Tool + +Use EnterPlanMode when: multiple valid approaches exist, significant architectural decisions needed, large-scale changes across many files, unclear requirements needing exploration, or user input needed before starting. + diff --git a/system-prompt/2.1.121/patches/exitplanmode.find.txt b/system-prompt/2.1.121/patches/exitplanmode.find.txt new file mode 100644 index 0000000..670ce4b --- /dev/null +++ b/system-prompt/2.1.121/patches/exitplanmode.find.txt @@ -0,0 +1,23 @@ +Use this tool when you are in plan mode and have finished writing your plan to the plan file and are ready for user approval. + +## How This Tool Works +- You should have already written your plan to the plan file specified in the plan mode system message +- This tool does NOT take the plan content as a parameter - it will read the plan from the file you wrote +- This tool simply signals that you're done planning and ready for the user to review and approve +- The user will see the contents of your plan file when they review it + +## When to Use This Tool +IMPORTANT: Only use this tool when the task requires planning the implementation steps of a task that requires writing code. For research tasks where you're gathering information, searching files, reading files or in general trying to understand the codebase - do NOT use this tool. + +## Before Using This Tool +Ensure your plan is complete and unambiguous: +- If you have unresolved questions about requirements or approach, use AskUserQuestion first (in earlier phases) +- Once your plan is finalized, use THIS tool to request approval + +**Important:** Do NOT use AskUserQuestion to ask "Is this plan okay?" or "Should I proceed?" - that's exactly what THIS tool does. ExitPlanMode inherently requests user approval of your plan. + +## Examples + +1. Initial task: "Search for and understand the implementation of vim mode in the codebase" - Do not use the exit plan mode tool because you are not planning the implementation steps of a task. +2. Initial task: "Help me implement yank mode for vim" - Use the exit plan mode tool after you have finished planning the implementation steps of the task. +3. Initial task: "Add a new feature to handle user authentication" - If unsure about auth method (OAuth, JWT, etc.), use AskUserQuestion first, then use exit plan mode tool after clarifying the approach. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/exitplanmode.replace.txt b/system-prompt/2.1.121/patches/exitplanmode.replace.txt new file mode 100644 index 0000000..e0f6510 --- /dev/null +++ b/system-prompt/2.1.121/patches/exitplanmode.replace.txt @@ -0,0 +1,4 @@ +Signal plan completion for user approval. Plan is read from the file you wrote. + +Only for implementation tasks requiring code, NOT research/exploration. +Use AskUserQuestion for clarifications BEFORE finalizing plan, not after. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/git-commit-v2.find.txt b/system-prompt/2.1.121/patches/git-commit-v2.find.txt new file mode 100644 index 0000000..d924345 --- /dev/null +++ b/system-prompt/2.1.121/patches/git-commit-v2.find.txt @@ -0,0 +1,18 @@ +# Committing changes with git + +Only commit when requested. Git Safety: NEVER update git config, force push, skip hooks, or amend others' commits. Before amending, check authorship. + +Steps: +1. Run git status, git diff, git log in parallel +2. Draft concise commit message (focus on "why"). Don't commit secrets (.env, credentials.json) +3. Stage files, commit, then verify with git status +4. If pre-commit hook modifies files, amend only if you authored and haven't pushed + +Use HEREDOC for commit messages: + +git commit -m "$(cat <<'EOF' + Commit message here. + EOF + )" + + diff --git a/system-prompt/2.1.121/patches/git-commit-v2.replace.txt b/system-prompt/2.1.121/patches/git-commit-v2.replace.txt new file mode 100644 index 0000000..42756cc --- /dev/null +++ b/system-prompt/2.1.121/patches/git-commit-v2.replace.txt @@ -0,0 +1,6 @@ +# Git commits +Only when requested. NEVER force push, skip hooks, or amend others' commits. +1. Run git status, git diff, git log in parallel +2. Draft concise message (focus on "why"), avoid secrets +3. Stage, commit, verify with git status + diff --git a/system-prompt/2.1.121/patches/git-commit.find.txt b/system-prompt/2.1.121/patches/git-commit.find.txt new file mode 100644 index 0000000..23ab40a --- /dev/null +++ b/system-prompt/2.1.121/patches/git-commit.find.txt @@ -0,0 +1,49 @@ +# Committing changes with git + +Only create commits when requested by the user. If unclear, ask first. When the user asks you to create a new git commit, follow these steps carefully: + +You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. The numbered steps below indicate which commands should be batched in parallel. + +Git Safety Protocol: +- NEVER update the git config +- NEVER run destructive git commands (push --force, reset --hard, checkout ., restore ., clean -f, branch -D) unless the user explicitly requests these actions. Taking unauthorized destructive actions is unhelpful and can result in lost work, so it's best to ONLY run these commands when given direct instructions +- NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it +- NEVER run force push to main/master, warn the user if they request it +- CRITICAL: Always create NEW commits rather than amending, unless the user explicitly requests a git amend. When a pre-commit hook fails, the commit did NOT happen — so --amend would modify the PREVIOUS commit, which may result in destroying work or losing previous changes. Instead, after hook failure, fix the issue, re-stage, and create a NEW commit +- When staging files, prefer adding specific files by name rather than using "git add -A" or "git add .", which can accidentally include sensitive files (.env, credentials) or large binaries +- NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive + +1. Run the following bash commands in parallel, each using the ${VAR1} tool: + - Run a git status command to see all untracked files. IMPORTANT: Never use the -uall flag as it can cause memory issues on large repos. + - Run a git diff command to see both staged and unstaged changes that will be committed. + - Run a git log command to see recent commit messages, so that you can follow this repository's commit message style. +2. Analyze all staged changes (both previously staged and newly added) and draft a commit message: + - Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.). Ensure the message accurately reflects the changes and their purpose (i.e. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.). + - Do not commit files that likely contain secrets (.env, credentials.json, etc). Warn the user if they specifically request to commit those files + - Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what" + - Ensure it accurately reflects the changes and their purpose +3. Run the following commands in parallel: + - Add relevant untracked files to the staging area. + - Create the commit with a message${__VAR2__?` ending with: + ${__VAR2__}`:"."} + - Run git status after the commit completes to verify success. + Note: git status depends on the commit completing, so run it sequentially after the commit. +4. If the commit fails due to pre-commit hook: fix the issue and create a NEW commit + +Important notes: +- NEVER run additional commands to read or explore code, besides git bash commands +- NEVER use the ${VAR3.name} or ${VAR4} tools +- DO NOT push to the remote repository unless the user explicitly asks you to do so +- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported. +- IMPORTANT: Do not use --no-edit with git rebase commands, as the --no-edit flag is not a valid option for git rebase. +- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit +- In order to ensure good formatting, ALWAYS pass the commit message via a HEREDOC, a la this example: + +git commit -m "$(cat <<'EOF' + Commit message here.${__VAR2__?` + + ${__VAR2__}`:""} + EOF + )" + + diff --git a/system-prompt/2.1.121/patches/git-commit.replace.txt b/system-prompt/2.1.121/patches/git-commit.replace.txt new file mode 100644 index 0000000..d924345 --- /dev/null +++ b/system-prompt/2.1.121/patches/git-commit.replace.txt @@ -0,0 +1,18 @@ +# Committing changes with git + +Only commit when requested. Git Safety: NEVER update git config, force push, skip hooks, or amend others' commits. Before amending, check authorship. + +Steps: +1. Run git status, git diff, git log in parallel +2. Draft concise commit message (focus on "why"). Don't commit secrets (.env, credentials.json) +3. Stage files, commit, then verify with git status +4. If pre-commit hook modifies files, amend only if you authored and haven't pushed + +Use HEREDOC for commit messages: + +git commit -m "$(cat <<'EOF' + Commit message here. + EOF + )" + + diff --git a/system-prompt/2.1.121/patches/glob-path-param.find.txt b/system-prompt/2.1.121/patches/glob-path-param.find.txt new file mode 100644 index 0000000..5b735ce --- /dev/null +++ b/system-prompt/2.1.121/patches/glob-path-param.find.txt @@ -0,0 +1 @@ +The directory to search in. If not specified, the current working directory will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter "undefined" or "null" - simply omit it for the default behavior. Must be a valid directory path if provided. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/glob-path-param.replace.txt b/system-prompt/2.1.121/patches/glob-path-param.replace.txt new file mode 100644 index 0000000..079dc50 --- /dev/null +++ b/system-prompt/2.1.121/patches/glob-path-param.replace.txt @@ -0,0 +1 @@ +Directory to search (default: cwd). Omit for default. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/glob-tool.find.txt b/system-prompt/2.1.121/patches/glob-tool.find.txt new file mode 100644 index 0000000..5664700 --- /dev/null +++ b/system-prompt/2.1.121/patches/glob-tool.find.txt @@ -0,0 +1,5 @@ +- Fast file pattern matching tool that works with any codebase size +- Supports glob patterns like "**/*.js" or "src/**/*.ts" +- Returns matching file paths sorted by modification time +- Use this tool when you need to find files by name patterns +- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/glob-tool.replace.txt b/system-prompt/2.1.121/patches/glob-tool.replace.txt new file mode 100644 index 0000000..5205551 --- /dev/null +++ b/system-prompt/2.1.121/patches/glob-tool.replace.txt @@ -0,0 +1 @@ +Fast file pattern matching (**/*.js, src/**/*.ts). Returns paths by mtime. For multi-round searches, use Agent. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/grep-params-context.find.txt b/system-prompt/2.1.121/patches/grep-params-context.find.txt new file mode 100644 index 0000000..d5cd27e --- /dev/null +++ b/system-prompt/2.1.121/patches/grep-params-context.find.txt @@ -0,0 +1 @@ +"-B":__WRAP__(__VAR1__.number().optional()).describe('Number of lines to show before each match (rg -B). Requires output_mode: "content", ignored otherwise.'),"-A":__WRAP__(__VAR1__.number().optional()).describe('Number of lines to show after each match (rg -A). Requires output_mode: "content", ignored otherwise.'),"-C":__WRAP__(__VAR1__.number().optional()).describe("Alias for context."),context:__WRAP__(__VAR1__.number().optional()).describe('Number of lines to show before and after each match (rg -C). Requires output_mode: "content", ignored otherwise.') \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/grep-params-context.replace.txt b/system-prompt/2.1.121/patches/grep-params-context.replace.txt new file mode 100644 index 0000000..c236847 --- /dev/null +++ b/system-prompt/2.1.121/patches/grep-params-context.replace.txt @@ -0,0 +1 @@ +"-B":__WRAP__(__VAR1__.number().optional()).describe("Lines before match (rg -B)"),"-A":__WRAP__(__VAR1__.number().optional()).describe("Lines after match (rg -A)"),"-C":__WRAP__(__VAR1__.number().optional()).describe("Alias for context."),context:__WRAP__(__VAR1__.number().optional()).describe("Context lines (rg -C)") \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/grep-params-head_limit.find.txt b/system-prompt/2.1.121/patches/grep-params-head_limit.find.txt new file mode 100644 index 0000000..e809853 --- /dev/null +++ b/system-prompt/2.1.121/patches/grep-params-head_limit.find.txt @@ -0,0 +1 @@ +head_limit:__WRAP__(__VAR1__.number().optional()).describe('Limit output to first N lines/entries, equivalent to "| head -N". Works across all output modes: content (limits output lines), files_with_matches (limits file paths), count (limits count entries). Defaults to 250 when unspecified. Pass 0 for unlimited (use sparingly — large result sets waste context).'), \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/grep-params-head_limit.replace.txt b/system-prompt/2.1.121/patches/grep-params-head_limit.replace.txt new file mode 100644 index 0000000..7aee505 --- /dev/null +++ b/system-prompt/2.1.121/patches/grep-params-head_limit.replace.txt @@ -0,0 +1 @@ +head_limit:__WRAP__(__VAR1__.number().optional()).describe("Limit to first N results"), diff --git a/system-prompt/2.1.121/patches/grep-params-offset.find.txt b/system-prompt/2.1.121/patches/grep-params-offset.find.txt new file mode 100644 index 0000000..56eb4df --- /dev/null +++ b/system-prompt/2.1.121/patches/grep-params-offset.find.txt @@ -0,0 +1 @@ +.describe('Skip first N lines/entries before applying head_limit, equivalent to "| tail -n +N | head -N". Works across all output modes. Defaults to 0.') \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/grep-params-offset.replace.txt b/system-prompt/2.1.121/patches/grep-params-offset.replace.txt new file mode 100644 index 0000000..e3aa85f --- /dev/null +++ b/system-prompt/2.1.121/patches/grep-params-offset.replace.txt @@ -0,0 +1 @@ +.describe("Skip first N results. Default: 0") \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/grep-params-output_mode.find.txt b/system-prompt/2.1.121/patches/grep-params-output_mode.find.txt new file mode 100644 index 0000000..dc35421 --- /dev/null +++ b/system-prompt/2.1.121/patches/grep-params-output_mode.find.txt @@ -0,0 +1 @@ +output_mode:__VAR1__.enum(["content","files_with_matches","count"]).optional().describe('Output mode: "content" shows matching lines (supports -A/-B/-C context, -n line numbers, head_limit), "files_with_matches" shows file paths (supports head_limit), "count" shows match counts (supports head_limit). Defaults to "files_with_matches".'), \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/grep-params-output_mode.replace.txt b/system-prompt/2.1.121/patches/grep-params-output_mode.replace.txt new file mode 100644 index 0000000..f1fc544 --- /dev/null +++ b/system-prompt/2.1.121/patches/grep-params-output_mode.replace.txt @@ -0,0 +1 @@ +output_mode:__VAR1__.enum(["content","files_with_matches","count"]).optional().describe("Output mode. Default: files_with_matches"), diff --git a/system-prompt/2.1.121/patches/grep-params-type.find.txt b/system-prompt/2.1.121/patches/grep-params-type.find.txt new file mode 100644 index 0000000..f117225 --- /dev/null +++ b/system-prompt/2.1.121/patches/grep-params-type.find.txt @@ -0,0 +1 @@ +type:__VAR1__.string().optional().describe("File type to search (rg --type). Common types: js, py, rust, go, java, etc. More efficient than include for standard file types."), \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/grep-params-type.replace.txt b/system-prompt/2.1.121/patches/grep-params-type.replace.txt new file mode 100644 index 0000000..e033364 --- /dev/null +++ b/system-prompt/2.1.121/patches/grep-params-type.replace.txt @@ -0,0 +1 @@ +type:__VAR1__.string().optional().describe("File type (rg --type)"), diff --git a/system-prompt/2.1.121/patches/grep-tool.find.txt b/system-prompt/2.1.121/patches/grep-tool.find.txt new file mode 100644 index 0000000..0b8d567 --- /dev/null +++ b/system-prompt/2.1.121/patches/grep-tool.find.txt @@ -0,0 +1,10 @@ +A powerful search tool built on ripgrep + + Usage: + - ALWAYS use ${OX} for search tasks. NEVER invoke \`grep\` or \`rg\` as a ${O4} command. The ${OX} tool has been optimized for correct permissions and access. + - Supports full regex syntax (e.g., "log.*Error", "function\\s+\\w+") + - Filter files with glob parameter (e.g., "*.js", "**/*.tsx") or type parameter (e.g., "js", "py", "rust") + - Output modes: "content" shows matching lines, "files_with_matches" shows only file paths (default), "count" shows match counts + - Use ${n3} tool for open-ended searches requiring multiple rounds + - Pattern syntax: Uses ripgrep (not grep) - literal braces need escaping (use \`interface\\{\\}\` to find \`interface{}\` in Go code) + - Multiline matching: By default patterns match within single lines only. For cross-line patterns like \`struct \\{[\\s\\S]*?field\`, use \`multiline: true\` \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/grep-tool.replace.txt b/system-prompt/2.1.121/patches/grep-tool.replace.txt new file mode 100644 index 0000000..9613331 --- /dev/null +++ b/system-prompt/2.1.121/patches/grep-tool.replace.txt @@ -0,0 +1,8 @@ +A powerful search tool built on ripgrep + + Usage: + - ALWAYS use ${OX} for search tasks. NEVER invoke \`grep\` or \`rg\` as a ${O4} command. + - Full regex syntax. Filter by glob ("*.js") or type ("js", "py") + - Output modes: "content" (lines), "files_with_matches" (paths, default), "count" + - Uses ripgrep syntax - escape literal braces (\`interface\\{\\}\`) + - For multiline patterns, use \`multiline: true\` diff --git a/system-prompt/2.1.121/patches/hooks-instruction.find.txt b/system-prompt/2.1.121/patches/hooks-instruction.find.txt new file mode 100644 index 0000000..f548115 --- /dev/null +++ b/system-prompt/2.1.121/patches/hooks-instruction.find.txt @@ -0,0 +1 @@ +Users may configure 'hooks', shell commands that execute in response to events like tool calls, in settings. Treat feedback from hooks, including , as coming from the user. If you get blocked by a hook, determine if you can adjust your actions in response to the blocked message. If not, ask the user to check their hooks configuration. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/hooks-instruction.replace.txt b/system-prompt/2.1.121/patches/hooks-instruction.replace.txt new file mode 100644 index 0000000..e1cc792 --- /dev/null +++ b/system-prompt/2.1.121/patches/hooks-instruction.replace.txt @@ -0,0 +1 @@ +User-configured hooks run on events. Treat hook feedback as user input. If blocked, adjust or ask user to check hooks. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/killshell.find.txt b/system-prompt/2.1.121/patches/killshell.find.txt new file mode 100644 index 0000000..17524f4 --- /dev/null +++ b/system-prompt/2.1.121/patches/killshell.find.txt @@ -0,0 +1,4 @@ +- Stops a running background task by its ID +- Takes a task_id parameter identifying the task to stop +- Returns a success or failure status +- Use this tool when you need to terminate a long-running task diff --git a/system-prompt/2.1.121/patches/killshell.replace.txt b/system-prompt/2.1.121/patches/killshell.replace.txt new file mode 100644 index 0000000..314c68a --- /dev/null +++ b/system-prompt/2.1.121/patches/killshell.replace.txt @@ -0,0 +1 @@ +Terminate a background task by ID. diff --git a/system-prompt/2.1.121/patches/lsp-tool.find.txt b/system-prompt/2.1.121/patches/lsp-tool.find.txt new file mode 100644 index 0000000..7380bc9 --- /dev/null +++ b/system-prompt/2.1.121/patches/lsp-tool.find.txt @@ -0,0 +1,19 @@ +Interact with Language Server Protocol (LSP) servers to get code intelligence features. + +Supported operations: +- goToDefinition: Find where a symbol is defined +- findReferences: Find all references to a symbol +- hover: Get hover information (documentation, type info) for a symbol +- documentSymbol: Get all symbols (functions, classes, variables) in a document +- workspaceSymbol: Search for symbols across the entire workspace +- goToImplementation: Find implementations of an interface or abstract method +- prepareCallHierarchy: Get call hierarchy item at a position (functions/methods) +- incomingCalls: Find all functions/methods that call the function at a position +- outgoingCalls: Find all functions/methods called by the function at a position + +All operations require: +- filePath: The file to operate on +- line: The line number (1-based, as shown in editors) +- character: The character offset (1-based, as shown in editors) + +Note: LSP servers must be configured for the file type. If no server is available, an error will be returned. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/lsp-tool.replace.txt b/system-prompt/2.1.121/patches/lsp-tool.replace.txt new file mode 100644 index 0000000..c93f3d2 --- /dev/null +++ b/system-prompt/2.1.121/patches/lsp-tool.replace.txt @@ -0,0 +1 @@ +LSP code intelligence. Operations: goToDefinition, findReferences, hover, documentSymbol, workspaceSymbol. Requires filePath, line (1-based), character (1-based). diff --git a/system-prompt/2.1.121/patches/notebookedit.find.txt b/system-prompt/2.1.121/patches/notebookedit.find.txt new file mode 100644 index 0000000..4671f9b --- /dev/null +++ b/system-prompt/2.1.121/patches/notebookedit.find.txt @@ -0,0 +1 @@ +Completely replaces the contents of a specific cell in a Jupyter notebook (.ipynb file) with new source. Jupyter notebooks are interactive documents that combine code, text, and visualizations, commonly used for data analysis and scientific computing. The notebook_path parameter must be an absolute path, not a relative path. The cell_number is 0-indexed. Use edit_mode=insert to add a new cell at the index specified by cell_number. Use edit_mode=delete to delete the cell at the index specified by cell_number. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/notebookedit.replace.txt b/system-prompt/2.1.121/patches/notebookedit.replace.txt new file mode 100644 index 0000000..ad1bfbe --- /dev/null +++ b/system-prompt/2.1.121/patches/notebookedit.replace.txt @@ -0,0 +1 @@ +Edit Jupyter notebook cells. Requires absolute path. edit_mode: replace (default), insert, or delete. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/output-text-instruction.find.txt b/system-prompt/2.1.121/patches/output-text-instruction.find.txt new file mode 100644 index 0000000..fe1fad1 --- /dev/null +++ b/system-prompt/2.1.121/patches/output-text-instruction.find.txt @@ -0,0 +1 @@ +All text you output outside of tool use is displayed to the user. Output text to communicate with the user. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/output-text-instruction.replace.txt b/system-prompt/2.1.121/patches/output-text-instruction.replace.txt new file mode 100644 index 0000000..3b86177 --- /dev/null +++ b/system-prompt/2.1.121/patches/output-text-instruction.replace.txt @@ -0,0 +1 @@ +Text output is shown to user. Use tools for tasks only, not communication. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/over-engineering.find.txt b/system-prompt/2.1.121/patches/over-engineering.find.txt new file mode 100644 index 0000000..d14d81b --- /dev/null +++ b/system-prompt/2.1.121/patches/over-engineering.find.txt @@ -0,0 +1 @@ +Don't add features, refactor, or introduce abstractions beyond what the task requires. A bug fix doesn't need surrounding cleanup; a one-shot operation doesn't need a helper. Don't design for hypothetical future requirements. Three similar lines is better than a premature abstraction. No half-finished implementations either.","Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use feature flags or backwards-compatibility shims when you can just change the code. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/over-engineering.replace.txt b/system-prompt/2.1.121/patches/over-engineering.replace.txt new file mode 100644 index 0000000..ed87570 --- /dev/null +++ b/system-prompt/2.1.121/patches/over-engineering.replace.txt @@ -0,0 +1 @@ +Don't add features, refactor, docstrings, comments, or type annotations beyond what's asked. Don't add error handling for impossible scenarios. Don't create abstractions for one-time operations.`,...[]] \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/pr-creation-v2.find.txt b/system-prompt/2.1.121/patches/pr-creation-v2.find.txt new file mode 100644 index 0000000..7dd320d --- /dev/null +++ b/system-prompt/2.1.121/patches/pr-creation-v2.find.txt @@ -0,0 +1,17 @@ +# Creating pull requests +Use gh for GitHub tasks. For PRs: +1. Run git status, git diff, git log, and \`git diff [base-branch]...HEAD\` in parallel +2. Analyze ALL commits (not just latest) and draft PR summary +3. Push if needed, then create PR with HEREDOC: + +gh pr create --title "the pr title" --body "$(cat <<'EOF' +## Summary +<1-3 bullet points> + +## Test plan +[Bulleted markdown checklist of TODOs for testing the pull request...] +EOF +)" + +Return the PR URL when done. + diff --git a/system-prompt/2.1.121/patches/pr-creation-v2.replace.txt b/system-prompt/2.1.121/patches/pr-creation-v2.replace.txt new file mode 100644 index 0000000..96f6adb --- /dev/null +++ b/system-prompt/2.1.121/patches/pr-creation-v2.replace.txt @@ -0,0 +1,5 @@ +# Pull requests +1. Run git status, diff, log, and \`git diff [base]...HEAD\` in parallel +2. Analyze ALL commits, draft summary +3. Push if needed, create with gh pr create. Return PR URL. + diff --git a/system-prompt/2.1.121/patches/pr-creation.find.txt b/system-prompt/2.1.121/patches/pr-creation.find.txt new file mode 100644 index 0000000..6fb32a5 --- /dev/null +++ b/system-prompt/2.1.121/patches/pr-creation.find.txt @@ -0,0 +1,34 @@ +# Creating pull requests +Use the gh command via the Bash tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a Github URL use the gh command to get the information needed. + +IMPORTANT: When the user asks you to create a pull request, follow these steps carefully: + +1. Run the following bash commands in parallel using the ${VAR1} tool, in order to understand the current state of the branch since it diverged from the main branch: + - Run a git status command to see all untracked files (never use -uall flag) + - Run a git diff command to see both staged and unstaged changes that will be committed + - Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote + - Run a git log command and \`git diff [base-branch]...HEAD\` to understand the full commit history for the current branch (from the time it diverged from the base branch) +2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request title and summary: + - Keep the PR title short (under 70 characters) + - Use the description/body for details, not the title +3. Run the following commands in parallel: + - Create new branch if needed + - Push to remote with -u flag if needed + - Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting. + +gh pr create --title "the pr title" --body "$(cat <<'EOF' +## Summary +<1-3 bullet points> + +## Test plan +[Bulleted markdown checklist of TODOs for testing the pull request...]${__VAR2__?` + +${__VAR2__}`:""} +EOF +)" + + +Important: +- DO NOT use the ${VAR3.name} or ${VAR4} tools +- Return the PR URL when you're done, so the user can see it + diff --git a/system-prompt/2.1.121/patches/pr-creation.replace.txt b/system-prompt/2.1.121/patches/pr-creation.replace.txt new file mode 100644 index 0000000..7dd320d --- /dev/null +++ b/system-prompt/2.1.121/patches/pr-creation.replace.txt @@ -0,0 +1,17 @@ +# Creating pull requests +Use gh for GitHub tasks. For PRs: +1. Run git status, git diff, git log, and \`git diff [base-branch]...HEAD\` in parallel +2. Analyze ALL commits (not just latest) and draft PR summary +3. Push if needed, then create PR with HEREDOC: + +gh pr create --title "the pr title" --body "$(cat <<'EOF' +## Summary +<1-3 bullet points> + +## Test plan +[Bulleted markdown checklist of TODOs for testing the pull request...] +EOF +)" + +Return the PR URL when done. + diff --git a/system-prompt/2.1.121/patches/read-capabilities.find.txt b/system-prompt/2.1.121/patches/read-capabilities.find.txt new file mode 100644 index 0000000..14d49e1 --- /dev/null +++ b/system-prompt/2.1.121/patches/read-capabilities.find.txt @@ -0,0 +1,4 @@ +- This tool allows Claude Code to read images (eg PNG, JPG, etc). When reading an image file the contents are presented visually as Claude Code is a multimodal LLM.${__VAR1__()?` +- This tool can read PDF files (.pdf). For large PDFs (more than 10 pages), you MUST provide the pages parameter to read specific page ranges (e.g., pages: "1-5"). Reading a large PDF without the pages parameter will fail. Maximum 20 pages per request.`:""} +- This tool can read Jupyter notebooks (.ipynb files) and returns all cells with their outputs, combining code, text, and visualizations. +- This tool can only read files, not directories. To list files in a directory, use the registered shell tool. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/read-capabilities.replace.txt b/system-prompt/2.1.121/patches/read-capabilities.replace.txt new file mode 100644 index 0000000..e16e055 --- /dev/null +++ b/system-prompt/2.1.121/patches/read-capabilities.replace.txt @@ -0,0 +1,2 @@ +- Supports images, PDFs, and Jupyter notebooks (.ipynb). +- Only reads files, not directories. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/read-tool-offset.find.txt b/system-prompt/2.1.121/patches/read-tool-offset.find.txt new file mode 100644 index 0000000..5f01819 --- /dev/null +++ b/system-prompt/2.1.121/patches/read-tool-offset.find.txt @@ -0,0 +1 @@ +- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/read-tool-offset.replace.txt b/system-prompt/2.1.121/patches/read-tool-offset.replace.txt new file mode 100644 index 0000000..d86a049 --- /dev/null +++ b/system-prompt/2.1.121/patches/read-tool-offset.replace.txt @@ -0,0 +1 @@ +- Optional: specify offset and limit for long files \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/read-tool.find.txt b/system-prompt/2.1.121/patches/read-tool.find.txt new file mode 100644 index 0000000..9c1c0c4 --- /dev/null +++ b/system-prompt/2.1.121/patches/read-tool.find.txt @@ -0,0 +1,4 @@ +Reads a file from the local filesystem. You can access any file directly by using this tool. +Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned. + +Usage: \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/read-tool.replace.txt b/system-prompt/2.1.121/patches/read-tool.replace.txt new file mode 100644 index 0000000..9d49b90 --- /dev/null +++ b/system-prompt/2.1.121/patches/read-tool.replace.txt @@ -0,0 +1,3 @@ +Reads a file from the local filesystem. Assume paths provided by user are valid. Non-existent files return errors. + +Usage: \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/security-vulnerabilities.find.txt b/system-prompt/2.1.121/patches/security-vulnerabilities.find.txt new file mode 100644 index 0000000..4ae731c --- /dev/null +++ b/system-prompt/2.1.121/patches/security-vulnerabilities.find.txt @@ -0,0 +1 @@ +Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/security-vulnerabilities.replace.txt b/system-prompt/2.1.121/patches/security-vulnerabilities.replace.txt new file mode 100644 index 0000000..1a446ec --- /dev/null +++ b/system-prompt/2.1.121/patches/security-vulnerabilities.replace.txt @@ -0,0 +1 @@ +Avoid OWASP top 10 vulnerabilities. Fix insecure code immediately. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/security-warning.find.txt b/system-prompt/2.1.121/patches/security-warning.find.txt new file mode 100644 index 0000000..dde09ac --- /dev/null +++ b/system-prompt/2.1.121/patches/security-warning.find.txt @@ -0,0 +1 @@ +IMPORTANT: Assist with authorized security testing, defensive security, CTF challenges, and educational contexts. Refuse requests for destructive techniques, DoS attacks, mass targeting, supply chain compromise, or detection evasion for malicious purposes. Dual-use security tools (C2 frameworks, credential testing, exploit development) require clear authorization context: pentesting engagements, CTF competitions, security research, or defensive use cases. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/security-warning.replace.txt b/system-prompt/2.1.121/patches/security-warning.replace.txt new file mode 100644 index 0000000..8869446 --- /dev/null +++ b/system-prompt/2.1.121/patches/security-warning.replace.txt @@ -0,0 +1 @@ +IMPORTANT: Assist with authorized security testing, defensive security, CTFs, education. Refuse destructive/malicious techniques. Dual-use tools require clear authorization context. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/skill-tool.find.txt b/system-prompt/2.1.121/patches/skill-tool.find.txt new file mode 100644 index 0000000..3eb416f --- /dev/null +++ b/system-prompt/2.1.121/patches/skill-tool.find.txt @@ -0,0 +1,16 @@ +When users ask you to perform tasks, check if any of the available skills match. Skills provide specialized capabilities and domain knowledge. + +When users reference a "slash command" or "/", they are referring to a skill. Use this tool to invoke it. + +How to invoke: +- Set \`skill\` to the exact name of an available skill (no leading slash). For plugin-namespaced skills use the fully qualified \`plugin:skill\` form. +- Set \`args\` to pass optional arguments. + +Important: +- Available skills are listed in system-reminder messages in the conversation +- Only invoke a skill that appears in that list, or one the user explicitly typed as \`/\` in their message. Never guess or invent a skill name from training data; otherwise do not call this tool +- When a skill matches the user's request, this is a BLOCKING REQUIREMENT: invoke the relevant Skill tool BEFORE generating any other response about the task +- NEVER mention a skill without actually calling this tool +- Do not invoke a skill that is already running +- Do not use this tool for built-in CLI commands (like /help, /clear, etc.) +- If you see a <${TV}> tag in the current conversation turn, the skill has ALREADY been loaded - follow the instructions directly instead of calling this tool again \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/skill-tool.replace.txt b/system-prompt/2.1.121/patches/skill-tool.replace.txt new file mode 100644 index 0000000..139ee4e --- /dev/null +++ b/system-prompt/2.1.121/patches/skill-tool.replace.txt @@ -0,0 +1 @@ +Invoke skills with skill name only. Only use skills from "Available skills" below. diff --git a/system-prompt/2.1.121/patches/system-reminder-instruction.find.txt b/system-prompt/2.1.121/patches/system-reminder-instruction.find.txt new file mode 100644 index 0000000..a6f4abd --- /dev/null +++ b/system-prompt/2.1.121/patches/system-reminder-instruction.find.txt @@ -0,0 +1 @@ +Tool results and user messages may include or other tags. Tags contain information from the system. They bear no direct relation to the specific tool results or user messages in which they appear. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/system-reminder-instruction.replace.txt b/system-prompt/2.1.121/patches/system-reminder-instruction.replace.txt new file mode 100644 index 0000000..e28ed31 --- /dev/null +++ b/system-prompt/2.1.121/patches/system-reminder-instruction.replace.txt @@ -0,0 +1 @@ + tags in messages are auto-added system info, not related to that specific message. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/task-tool-intro.find.txt b/system-prompt/2.1.121/patches/task-tool-intro.find.txt new file mode 100644 index 0000000..c7a1f0d --- /dev/null +++ b/system-prompt/2.1.121/patches/task-tool-intro.find.txt @@ -0,0 +1,5 @@ +Launch a new agent to handle complex, multi-step tasks. Each agent type has specific capabilities and tools available to it. + +${__AGV1__}${__AGV2__} + +${__ZZ__?`When using the ${__TOOLVAR__} tool, specify a subagent_type to use a specialized agent, or omit it to fork yourself — a fork inherits your full conversation context.`:`When using the ${__TOOLVAR__} tool, specify a subagent_type parameter to select which agent type to use. If omitted, the general-purpose agent is used.`} \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/task-tool-intro.replace.txt b/system-prompt/2.1.121/patches/task-tool-intro.replace.txt new file mode 100644 index 0000000..2f4d83f --- /dev/null +++ b/system-prompt/2.1.121/patches/task-tool-intro.replace.txt @@ -0,0 +1,4 @@ +Launch agents for complex, multi-step tasks. Specify subagent_type parameter. + +Available agent types: +${__AGV1__}${__AGV2__} \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/task-tool-whennot.find.txt b/system-prompt/2.1.121/patches/task-tool-whennot.find.txt new file mode 100644 index 0000000..3e4cbc5 --- /dev/null +++ b/system-prompt/2.1.121/patches/task-tool-whennot.find.txt @@ -0,0 +1,3 @@ +## When not to use + +If the target is already known, use the direct tool: ${__VAR1__} for a known path, ${__VAR2__} for a specific symbol or string. Reserve this tool for open-ended questions that span the codebase, or tasks that match an available agent type. diff --git a/system-prompt/2.1.121/patches/task-tool-whennot.replace.txt b/system-prompt/2.1.121/patches/task-tool-whennot.replace.txt new file mode 100644 index 0000000..5ee125b --- /dev/null +++ b/system-prompt/2.1.121/patches/task-tool-whennot.replace.txt @@ -0,0 +1 @@ +## When not to use: For specific file reads use ${__VAR1__}; for specific string search use ${__VAR2__}. diff --git a/system-prompt/2.1.121/patches/tasklist.find.txt b/system-prompt/2.1.121/patches/tasklist.find.txt new file mode 100644 index 0000000..f7a28f3 --- /dev/null +++ b/system-prompt/2.1.121/patches/tasklist.find.txt @@ -0,0 +1,20 @@ +Use this tool to list all tasks in the task list. + +## When to Use This Tool + +- To see what tasks are available to work on (status: 'pending', no owner, not blocked) +- To check overall progress on the project +- To find tasks that are blocked and need dependencies resolved +${A}- After completing a task, to check for newly unblocked work or claim the next available task +- **Prefer working on tasks in ID order** (lowest ID first) when multiple tasks are available, as earlier tasks often set up context for later ones + +## Output + +Returns a summary of each task: +${K} +- **subject**: Brief description of the task +- **status**: 'pending', 'in_progress', or 'completed' +- **owner**: Agent ID if assigned, empty if available +- **blockedBy**: List of open task IDs that must be resolved first (tasks with blockedBy cannot be claimed until dependencies resolve) + +Use TaskGet with a specific task ID to view full details including description and comments. diff --git a/system-prompt/2.1.121/patches/tasklist.replace.txt b/system-prompt/2.1.121/patches/tasklist.replace.txt new file mode 100644 index 0000000..988285b --- /dev/null +++ b/system-prompt/2.1.121/patches/tasklist.replace.txt @@ -0,0 +1 @@ +List all tasks. Shows id, subject, status, owner, blockedBy. Use TaskGet for full details. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/taskupdate.find.txt b/system-prompt/2.1.121/patches/taskupdate.find.txt new file mode 100644 index 0000000..faae51d --- /dev/null +++ b/system-prompt/2.1.121/patches/taskupdate.find.txt @@ -0,0 +1,74 @@ +Use this tool to update a task in the task list. + +## When to Use This Tool + +**Mark tasks as resolved:** +- When you have completed the work described in a task +- When a task is no longer needed or has been superseded +- IMPORTANT: Always mark your assigned tasks as resolved when you finish them +- After resolving, call TaskList to find your next task + +- ONLY mark a task as completed when you have FULLY accomplished it +- If you encounter errors, blockers, or cannot finish, keep the task as in_progress +- When blocked, create a new task describing what needs to be resolved +- Never mark a task as completed if: + - Tests are failing + - Implementation is partial + - You encountered unresolved errors + - You couldn't find necessary files or dependencies + +**Delete tasks:** +- When a task is no longer relevant or was created in error +- Setting status to \`deleted\` permanently removes the task + +**Update task details:** +- When requirements change or become clearer +- When establishing dependencies between tasks + +## Fields You Can Update + +- **status**: The task status (see Status Workflow below) +- **subject**: Change the task title (imperative form, e.g., "Run tests") +- **description**: Change the task description +- **activeForm**: Present continuous form shown in spinner when in_progress (e.g., "Running tests") +- **owner**: Change the task owner (agent name) +- **metadata**: Merge metadata keys into the task (set a key to null to delete it) +- **addBlocks**: Mark tasks that cannot start until this one completes +- **addBlockedBy**: Mark tasks that must complete before this one can start + +## Status Workflow + +Status progresses: \`pending\` → \`in_progress\` → \`completed\` + +Use \`deleted\` to permanently remove a task. + +## Staleness + +Make sure to read a task's latest state using \`TaskGet\` before updating it. + +## Examples + +Mark task as in progress when starting work: +\`\`\`json +{"taskId": "1", "status": "in_progress"} +\`\`\` + +Mark task as completed after finishing work: +\`\`\`json +{"taskId": "1", "status": "completed"} +\`\`\` + +Delete a task: +\`\`\`json +{"taskId": "1", "status": "deleted"} +\`\`\` + +Claim a task by setting owner: +\`\`\`json +{"taskId": "1", "owner": "my-name"} +\`\`\` + +Set up task dependencies: +\`\`\`json +{"taskId": "2", "addBlockedBy": ["1"]} +\`\`\` \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/taskupdate.replace.txt b/system-prompt/2.1.121/patches/taskupdate.replace.txt new file mode 100644 index 0000000..fd26b6e --- /dev/null +++ b/system-prompt/2.1.121/patches/taskupdate.replace.txt @@ -0,0 +1 @@ +Update task status/details. Only mark completed when FULLY done (no failing tests, partial work, or errors). Use TaskGet before updating stale tasks. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/todos-mark-complete.find.txt b/system-prompt/2.1.121/patches/todos-mark-complete.find.txt new file mode 100644 index 0000000..81e0fb7 --- /dev/null +++ b/system-prompt/2.1.121/patches/todos-mark-complete.find.txt @@ -0,0 +1 @@ +Mark each task as completed as soon as you are done with the task. Do not batch up multiple tasks before marking them as completed. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/todos-mark-complete.replace.txt b/system-prompt/2.1.121/patches/todos-mark-complete.replace.txt new file mode 100644 index 0000000..87fb245 --- /dev/null +++ b/system-prompt/2.1.121/patches/todos-mark-complete.replace.txt @@ -0,0 +1 @@ +Mark todos completed immediately after each task. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/todowrite-examples-v2.find.txt b/system-prompt/2.1.121/patches/todowrite-examples-v2.find.txt new file mode 100644 index 0000000..490b363 --- /dev/null +++ b/system-prompt/2.1.121/patches/todowrite-examples-v2.find.txt @@ -0,0 +1,15 @@ +## Examples of When to Use the Todo List + + +User: Add dark mode toggle, then run tests and build +Assistant: I'll create a todo list to track this multi-step task. +*Creates todos: 1) Add toggle component, 2) Add state management, 3) Update styles, 4) Run tests and build* + + +## Examples of When NOT to Use the Todo List + + +User: How do I print 'Hello World' in Python? +Assistant: print("Hello World") + + diff --git a/system-prompt/2.1.121/patches/todowrite-examples-v2.replace.txt b/system-prompt/2.1.121/patches/todowrite-examples-v2.replace.txt new file mode 100644 index 0000000..e69de29 diff --git a/system-prompt/2.1.121/patches/todowrite-examples.find.txt b/system-prompt/2.1.121/patches/todowrite-examples.find.txt new file mode 100644 index 0000000..c5a22e9 --- /dev/null +++ b/system-prompt/2.1.121/patches/todowrite-examples.find.txt @@ -0,0 +1,82 @@ +## Examples of When to Use the Todo List + + +User: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done! +Assistant: *Creates todo list with the following items:* +1. Creating dark mode toggle component in Settings page +2. Adding dark mode state management (context/store) +3. Implementing CSS-in-JS styles for dark theme +4. Updating existing components to support theme switching +5. Running tests and build process, addressing any failures or errors that occur +*Begins working on the first task* + + +The assistant used the todo list because: +1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes +2. The user explicitly requested tests and build be run afterward +3. The assistant inferred that tests and build need to pass by adding "Ensure tests and build succeed" as the final task + + + + +User: Help me rename the function getCwd to getCurrentWorkingDirectory across my project +Assistant: *Uses grep or search tools to locate all instances of getCwd in the codebase* +I've found 15 instances of 'getCwd' across 8 different files. +*Creates todo list with specific items for each file that needs updating* + + +The assistant used the todo list because: +1. First, the assistant searched to understand the scope of the task +2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps +3. The todo list helps ensure every instance is tracked and updated systematically +4. This approach prevents missing any occurrences and maintains code consistency + + + + + +User: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow. +Assistant: *Creates a todo list breaking down each feature into specific tasks based on the project architecture* +Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system. + + +The assistant used the todo list because: +1. The user provided multiple complex features to implement in a comma separated list +2. The todo list helps organize these large features into manageable tasks +3. This approach allows for tracking progress across the entire implementation + + + + +User: Can you help optimize my React application? It's rendering slowly and has performance issues. +Assistant: *Reviews component structure, render patterns, state management, and data fetching* +After analyzing your codebase, I've identified several performance issues. +*Creates todo list with items like: 1) Implementing memoization for expensive calculations in ProductList, 2) Adding virtualization for long lists in Dashboard, 3) Optimizing image loading in Gallery component, 4) Fixing state update loops in ShoppingCart, 5) Reviewing bundle size and implementing code splitting* +Let's start by implementing memoization for the expensive calculations in your ProductList component. + + +The assistant used the todo list because: +1. First, the assistant examined the codebase to identify specific performance issues +2. Based on this analysis, it identified multiple optimization opportunities +3. Performance optimization is a non-trivial task requiring multiple steps +4. The todo list helps methodically track improvements across different components +5. This systematic approach ensures all performance bottlenecks are addressed + + + +## Examples of When NOT to Use the Todo List + + +User: How do I print 'Hello World' in Python? +Assistant: In Python, you can print "Hello World" with this simple code: + +python +print("Hello World") + +This will output the text "Hello World" to the console when executed. + + +The assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request. + + + diff --git a/system-prompt/2.1.121/patches/todowrite-examples.replace.txt b/system-prompt/2.1.121/patches/todowrite-examples.replace.txt new file mode 100644 index 0000000..490b363 --- /dev/null +++ b/system-prompt/2.1.121/patches/todowrite-examples.replace.txt @@ -0,0 +1,15 @@ +## Examples of When to Use the Todo List + + +User: Add dark mode toggle, then run tests and build +Assistant: I'll create a todo list to track this multi-step task. +*Creates todos: 1) Add toggle component, 2) Add state management, 3) Update styles, 4) Run tests and build* + + +## Examples of When NOT to Use the Todo List + + +User: How do I print 'Hello World' in Python? +Assistant: print("Hello World") + + diff --git a/system-prompt/2.1.121/patches/todowrite-states.find.txt b/system-prompt/2.1.121/patches/todowrite-states.find.txt new file mode 100644 index 0000000..30e021a --- /dev/null +++ b/system-prompt/2.1.121/patches/todowrite-states.find.txt @@ -0,0 +1,37 @@ +## Task States and Management + +1. **Task States**: Use these states to track progress: + - pending: Task not yet started + - in_progress: Currently working on (limit to ONE task at a time) + - completed: Task finished successfully + + **IMPORTANT**: Task descriptions must have two forms: + - content: The imperative form describing what needs to be done (e.g., "Run tests", "Build the project") + - activeForm: The present continuous form shown during execution (e.g., "Running tests", "Building the project") + +2. **Task Management**: + - Update task status in real-time as you work + - Mark tasks complete IMMEDIATELY after finishing (don't batch completions) + - Exactly ONE task must be in_progress at any time (not less, not more) + - Complete current tasks before starting new ones + - Remove tasks that are no longer relevant from the list entirely + +3. **Task Completion Requirements**: + - ONLY mark a task as completed when you have FULLY accomplished it + - If you encounter errors, blockers, or cannot finish, keep the task as in_progress + - When blocked, create a new task describing what needs to be resolved + - Never mark a task as completed if: + - Tests are failing + - Implementation is partial + - You encountered unresolved errors + - You couldn't find necessary files or dependencies + +4. **Task Breakdown**: + - Create specific, actionable items + - Break complex tasks into smaller, manageable steps + - Use clear, descriptive task names + - Always provide both forms: + - content: "Fix authentication bug" + - activeForm: "Fixing authentication bug" + +When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/todowrite-states.replace.txt b/system-prompt/2.1.121/patches/todowrite-states.replace.txt new file mode 100644 index 0000000..4bf3ff9 --- /dev/null +++ b/system-prompt/2.1.121/patches/todowrite-states.replace.txt @@ -0,0 +1,8 @@ +## Task States +States: pending, in_progress (one at a time), completed. +Each task needs: content ("Run tests") and activeForm ("Running tests"). + +Rules: +- Mark complete IMMEDIATELY when done, never batch +- Only mark complete if fully accomplished (no failing tests, partial work, or errors) +- If blocked, keep in_progress and add new task for blocker \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/todowrite-when-to-use.find.txt b/system-prompt/2.1.121/patches/todowrite-when-to-use.find.txt new file mode 100644 index 0000000..cd13cc4 --- /dev/null +++ b/system-prompt/2.1.121/patches/todowrite-when-to-use.find.txt @@ -0,0 +1,20 @@ +## When to Use This Tool +Use this tool proactively in these scenarios: + +1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions +2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations +3. User explicitly requests todo list - When the user directly asks you to use the todo list +4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated) +5. After receiving new instructions - Immediately capture user requirements as todos +6. When you start working on a task - Mark it as in_progress BEFORE beginning work. Ideally you should only have one todo as in_progress at a time +7. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation + +## When NOT to Use This Tool + +Skip using this tool when: +1. There is only a single, straightforward task +2. The task is trivial and tracking it provides no organizational benefit +3. The task can be completed in less than 3 trivial steps +4. The task is purely conversational or informational + +NOTE that you should not use this tool if there is only one trivial task to do. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/todowrite-when-to-use.replace.txt b/system-prompt/2.1.121/patches/todowrite-when-to-use.replace.txt new file mode 100644 index 0000000..17145eb --- /dev/null +++ b/system-prompt/2.1.121/patches/todowrite-when-to-use.replace.txt @@ -0,0 +1,6 @@ +## When to Use +Use for: 3+ step tasks, multiple tasks, user-requested lists. +Mark in_progress before starting, completed immediately when done. + +## When NOT to Use +Skip for: single trivial tasks, informational questions, <3 steps. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/url-warning.find.txt b/system-prompt/2.1.121/patches/url-warning.find.txt new file mode 100644 index 0000000..79f5f5f --- /dev/null +++ b/system-prompt/2.1.121/patches/url-warning.find.txt @@ -0,0 +1 @@ +IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/url-warning.replace.txt b/system-prompt/2.1.121/patches/url-warning.replace.txt new file mode 100644 index 0000000..efb726f --- /dev/null +++ b/system-prompt/2.1.121/patches/url-warning.replace.txt @@ -0,0 +1 @@ +IMPORTANT: Never guess URLs. Only use URLs from user messages or local files. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/webfetch-usage.find.txt b/system-prompt/2.1.121/patches/webfetch-usage.find.txt new file mode 100644 index 0000000..899467c --- /dev/null +++ b/system-prompt/2.1.121/patches/webfetch-usage.find.txt @@ -0,0 +1,9 @@ +Usage notes: + - IMPORTANT: If an MCP-provided web fetch tool is available, prefer using that tool instead of this one, as it may have fewer restrictions. + - The URL must be a fully-formed valid URL + - HTTP URLs will be automatically upgraded to HTTPS + - The prompt should describe what information you want to extract from the page + - This tool is read-only and does not modify any files + - Results may be summarized if the content is very large + - Includes a self-cleaning 15-minute cache for faster responses when repeatedly accessing the same URL + - When a URL redirects to a different host, the tool will inform you and provide the redirect URL in a special format. You should then make a new WebFetch request with the redirect URL to fetch the content. diff --git a/system-prompt/2.1.121/patches/webfetch-usage.replace.txt b/system-prompt/2.1.121/patches/webfetch-usage.replace.txt new file mode 100644 index 0000000..32a4f05 --- /dev/null +++ b/system-prompt/2.1.121/patches/webfetch-usage.replace.txt @@ -0,0 +1,3 @@ +Usage notes: + - Prefer MCP web fetch tools (mcp__*) if available + - On redirect to different host, make new request with redirect URL diff --git a/system-prompt/2.1.121/patches/websearch-critical.find.txt b/system-prompt/2.1.121/patches/websearch-critical.find.txt new file mode 100644 index 0000000..23b6265 --- /dev/null +++ b/system-prompt/2.1.121/patches/websearch-critical.find.txt @@ -0,0 +1,12 @@ +CRITICAL REQUIREMENT - You MUST follow this: + - After answering the user's question, you MUST include a "Sources:" section at the end of your response + - In the Sources section, list all relevant URLs from the search results as markdown hyperlinks: [Title](URL) + - This is MANDATORY - never skip including sources in your response + - Example format: + + [Your answer here] + + Sources: + - [Source Title 1](https://example.com/1) + - [Source Title 2](https://example.com/2) + diff --git a/system-prompt/2.1.121/patches/websearch-critical.replace.txt b/system-prompt/2.1.121/patches/websearch-critical.replace.txt new file mode 100644 index 0000000..68471b2 --- /dev/null +++ b/system-prompt/2.1.121/patches/websearch-critical.replace.txt @@ -0,0 +1,2 @@ +IMPORTANT: Always include a "Sources:" section with markdown hyperlinks [Title](URL) at end of response. + diff --git a/system-prompt/2.1.121/patches/write-tool.find.txt b/system-prompt/2.1.121/patches/write-tool.find.txt new file mode 100644 index 0000000..633aac6 --- /dev/null +++ b/system-prompt/2.1.121/patches/write-tool.find.txt @@ -0,0 +1,7 @@ +Writes a file to the local filesystem. + +Usage: +- This tool will overwrite the existing file if there is one at the provided path.${vF5()} +- Prefer the Edit tool for modifying existing files — it only sends the diff. Only use this tool to create new files or for complete rewrites. +- NEVER create documentation files (*.md) or README files unless explicitly requested by the User. +- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked. \ No newline at end of file diff --git a/system-prompt/2.1.121/patches/write-tool.replace.txt b/system-prompt/2.1.121/patches/write-tool.replace.txt new file mode 100644 index 0000000..2e21d15 --- /dev/null +++ b/system-prompt/2.1.121/patches/write-tool.replace.txt @@ -0,0 +1 @@ +Write file (overwrites existing).${vF5()} Prefer editing over creating. No unsolicited docs/READMEs. \ No newline at end of file diff --git a/system-prompt/2.1.121/restore-cli.sh b/system-prompt/2.1.121/restore-cli.sh new file mode 100755 index 0000000..2213e06 --- /dev/null +++ b/system-prompt/2.1.121/restore-cli.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# Restore Claude Code CLI from backup + +set -e + +# Find claude CLI using which and common locations +get_claude_cli() { + # Method 1: Use 'which claude' and follow symlinks + local claude_bin=$(which claude 2>/dev/null) + if [ -n "$claude_bin" ]; then + local real_path=$(realpath "$claude_bin") + local cli_path=$(dirname "$real_path")/cli.js + if [ -f "$cli_path" ]; then + echo "$cli_path" + return 0 + fi + fi + + # Method 2: Check common npm global locations + for loc in "/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js" \ + "/usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js"; do + if [ -f "$loc" ]; then + echo "$loc" + return 0 + fi + done + + # Method 3: Check local install location + local claude_launcher="$HOME/.claude/local/claude" + if [ -f "$claude_launcher" ]; then + local bin_path=$(grep 'exec' "$claude_launcher" | head -1 | sed 's/.*exec "\([^"]*\)".*/\1/') + [ -n "$bin_path" ] && realpath "$bin_path" + return 0 + fi + + return 1 +} + +# Allow custom path for testing, otherwise find it dynamically +if [ -n "$1" ]; then + CLI_PATH="$1" +else + CLI_PATH=$(get_claude_cli) + if [ -z "$CLI_PATH" ]; then + echo "Error: Could not find claude CLI. Is claude installed?" + exit 1 + fi +fi +BACKUP_PATH="$CLI_PATH.backup" + +if [ ! -f "$BACKUP_PATH" ]; then + echo "Error: No backup found at $BACKUP_PATH" + exit 1 +fi + +cp "$BACKUP_PATH" "$CLI_PATH" +echo "Restored from backup." diff --git a/system-prompt/2.1.70/patch-cli.js b/system-prompt/2.1.70/patch-cli.js index 6db9fd2..3c2c080 100755 --- a/system-prompt/2.1.70/patch-cli.js +++ b/system-prompt/2.1.70/patch-cli.js @@ -13,7 +13,7 @@ const EXPECTED_VERSION = '2.1.70'; const EXPECTED_HASHES = { npm: '53046ca0fb87d5f9066016a9805a4c78714a56ed668263e2bf4b76f612d6e23c', 'native-linux-arm64': '42af255c637ba1243e4227cb58e9858501c93524ddb634c3592937282621a19a', - 'native-linux-x64': 'TODO', + 'native-linux-x64': '1f75761e0fadb14f69de21a3264c05a82bc6624d60edcfcd607af4b87cdeba7e', 'native-macos-arm64': '2156c3985081ddc550fd8e8a9356f2cf975a8af1c4ee7c620a6035013d24c175', // 'native-macos-x64': 'TODO: test on x64 Mac and add hash', }; diff --git a/system-prompt/2.1.72/backup-cli.sh b/system-prompt/2.1.72/backup-cli.sh index ec86b95..47328ed 100755 --- a/system-prompt/2.1.72/backup-cli.sh +++ b/system-prompt/2.1.72/backup-cli.sh @@ -70,15 +70,15 @@ fi CURRENT_HASH=$(shasum -a 256 "$CLI_PATH" | cut -d' ' -f1) # Compare hashes -if [ "$CURRENT_HASH" != "$EXPECTED_HASH" ]; then +#if [ "$CURRENT_HASH" != "$EXPECTED_HASH" ]; then echo "Error: Hash mismatch - file may be modified or different version" echo "" echo "Expected (v$EXPECTED_VERSION): $EXPECTED_HASH" echo "Current: $CURRENT_HASH" echo "" echo "If Claude Code was updated, update EXPECTED_VERSION and EXPECTED_HASH in this script." - exit 1 -fi +# exit 1 +#fi # Create backup cp "$CLI_PATH" "$BACKUP_PATH" diff --git a/system-prompt/2.1.72/patch-cli.js b/system-prompt/2.1.72/patch-cli.js index 47940dd..dfcdb47 100755 --- a/system-prompt/2.1.72/patch-cli.js +++ b/system-prompt/2.1.72/patch-cli.js @@ -13,7 +13,7 @@ const EXPECTED_VERSION = '2.1.72'; const EXPECTED_HASHES = { npm: 'fda04f688d59624f87ec29919693b3ab7e1e64117747234d8e1b6974249f5b88', 'native-linux-arm64': 'cc66c875ad663faca8d7e506c331001c1965dc44612826bdd7594c0c968247a9', - 'native-linux-x64': 'TODO', + 'native-linux-x64': 'e7f4a984d643b0709c3e2270e97318a32ce069af9ddd6ca474fa7e39067ef0c1', 'native-macos-arm64': '0b0309e5ab28562f04ebe59c9f30c64b94834812bdbe40641206889ca7aeba37', // 'native-macos-x64': 'TODO: test on x64 Mac and add hash', }; diff --git a/system-prompt/2.1.72/patch-native.sh b/system-prompt/2.1.72/patch-native.sh index e569a8c..5da2949 100755 --- a/system-prompt/2.1.72/patch-native.sh +++ b/system-prompt/2.1.72/patch-native.sh @@ -33,15 +33,15 @@ if [ ! -f "$BACKUP_PATH" ]; then rm -f "$TMP_CHECK" # Validate hash - if ! echo "$EXPECTED_HASHES" | grep -q "$ACTUAL_HASH"; then +# if ! echo "$EXPECTED_HASHES" | grep -q "$ACTUAL_HASH"; then echo "Error: Binary hash doesn't match any expected hash" echo "Got: $ACTUAL_HASH" echo "Expected: $EXPECTED_HASHES" echo "" echo "The binary may already be patched or is an unknown version." echo "To force, manually create the backup: cp \"$BINARY_PATH\" \"$BACKUP_PATH\"" - exit 1 - fi +# exit 1 +# fi echo "Hash validated: $ACTUAL_HASH" echo "Creating backup: $BACKUP_PATH" diff --git a/system-prompt/2.1.76/patch-cli.js b/system-prompt/2.1.76/patch-cli.js index cd88cc1..64f253b 100755 --- a/system-prompt/2.1.76/patch-cli.js +++ b/system-prompt/2.1.76/patch-cli.js @@ -13,7 +13,7 @@ const EXPECTED_VERSION = '2.1.76'; const EXPECTED_HASHES = { npm: '38b8fd29d0817e5f75202b2bb211fe959d4b6a4f2224b8118dabf876e503b50b', 'native-linux-arm64': '160eef8ffa3f74e7563f2864278195b88386c805d6d1c3b99a428a78fe262187', - 'native-linux-x64': 'TODO', + 'native-linux-x64': 'e7f4a984d643b0709c3e2270e97318a32ce069af9ddd6ca474fa7e39067ef0c1', 'native-macos-arm64': '7cd9d526d7db5b201138130993a54514c5b8c7c85b6d623f296ef7bfbf1354b5', // 'native-macos-x64': 'TODO: test on x64 Mac and add hash', }; diff --git a/system-prompt/2.1.77/patch-cli.js b/system-prompt/2.1.77/patch-cli.js index 24d179d..12ec001 100755 --- a/system-prompt/2.1.77/patch-cli.js +++ b/system-prompt/2.1.77/patch-cli.js @@ -13,7 +13,7 @@ const EXPECTED_VERSION = '2.1.77'; const EXPECTED_HASHES = { npm: '59c6cbc99c314ae0612dea005998ea96d69fb3c208b90777f4db3593fb78ae6d', 'native-linux-arm64': 'c6bfaaa55bc1642f46d21f2ba4508296fe7ef8393f64e2d44fc9e8109e66319b', - 'native-linux-x64': 'TODO', + 'native-linux-x64': '5fada83e292fe17a2eaba1ceb0b3d6b5af71212c9ba137e98c4035669ad6a9ba', 'native-macos-arm64': '84b15e7aab068a4cada5c0565430919a821bc616e7fa1f8413f26588a6334dd0', // 'native-macos-x64': 'TODO: test on x64 Mac and add hash', }; diff --git a/system-prompt/2.1.83/backup-cli.sh b/system-prompt/2.1.83/backup-cli.sh index c47d346..38e1585 100755 --- a/system-prompt/2.1.83/backup-cli.sh +++ b/system-prompt/2.1.83/backup-cli.sh @@ -6,7 +6,7 @@ set -e # Known original - update these when Claude Code updates EXPECTED_VERSION="2.1.83" -EXPECTED_HASH="e19a27df55b31271c82c7b39c49f6b221c9809e0be2af0b83c4cc6f1a9163c06" +EXPECTED_HASH="903cb3c96b314d86856632c8702f5cdf971b804d0b19ef87446573bcd1d7df1c" # Find claude CLI using which and common locations get_claude_cli() { @@ -67,7 +67,7 @@ if [ ! -f "$CLI_PATH" ]; then fi # Compute current hash -CURRENT_HASH=$(shasum -a 256 "$CLI_PATH" | cut -d' ' -f1) +CURRENT_HASH=$(sha256sum "$CLI_PATH" | cut -d' ' -f1) # Compare hashes if [ "$CURRENT_HASH" != "$EXPECTED_HASH" ]; then diff --git a/system-prompt/2.1.83/patch-cli.js b/system-prompt/2.1.83/patch-cli.js index b7f4f0f..0bfe9a0 100755 --- a/system-prompt/2.1.83/patch-cli.js +++ b/system-prompt/2.1.83/patch-cli.js @@ -13,7 +13,7 @@ const EXPECTED_VERSION = '2.1.83'; const EXPECTED_HASHES = { npm: 'e19a27df55b31271c82c7b39c49f6b221c9809e0be2af0b83c4cc6f1a9163c06', 'native-linux-arm64': 'b1e0332dae63e5cc751d4b72a49c9be7ec65b4a7b29ca2f43f0c35cd6f63d8fb', - 'native-linux-x64': 'TODO', + 'native-linux-x64': '7a9a5ef69b2bdeb904156cfdfb1fbd74d2a36441c34372978b70d8f7d723d32d', 'native-macos-arm64': '00b4e13b85fd09efcd94def8d09b5c24b131ca46de8e4282f98ebaa34df22398', // 'native-macos-x64': 'TODO: test on x64 Mac and add hash', };