Merge pull request #18 from y574444354/refactor/replace-claude-with-costrict
refactor: replace Claude's with CoStrict's in user-facing copy
This commit is contained in:
commit
c5b44cbe4d
|
|
@ -534,7 +534,7 @@ async function runInputActionGates(
|
|||
// Keyboard safety net — defocus (prepareForAction step B) should have
|
||||
// moved us off. If we're still here, typing would go to our chat box.
|
||||
return errorResult(
|
||||
"Claude's own window still has keyboard focus. This should not happen " +
|
||||
"CoStrict's own window still has keyboard focus. This should not happen " +
|
||||
"after the pre-action defocus. Click on the target application first.",
|
||||
"state_conflict",
|
||||
);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Web composer uploads via cookie-authed /api/{org}/upload, sends file_uuid
|
||||
* alongside the message. Here we fetch each via GET /api/oauth/files/{uuid}/content
|
||||
* (oauth-authed, same store), write to ~/.claude/uploads/{sessionId}/, and
|
||||
* return @path refs to prepend. Claude's Read tool takes it from there.
|
||||
* return @path refs to prepend. CoStrict's Read tool takes it from there.
|
||||
*
|
||||
* Best-effort: any failure (no token, network, non-2xx, disk) logs debug and
|
||||
* skips that attachment. The message still reaches Claude, just without @path.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ const copy = {
|
|||
type: 'local-jsx',
|
||||
name: 'copy',
|
||||
description:
|
||||
"Copy Claude's last response to clipboard (or /copy N for the Nth-latest)",
|
||||
"Copy CoStrict's last response to clipboard (or /copy N for the Nth-latest)",
|
||||
load: () => import('./copy.js'),
|
||||
} satisfies Command
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ Analyze the project to detect what's in different subdirectories. The project ma
|
|||
- Check MCP configuration (.mcp.json) for browser automation tools:
|
||||
- Playwright MCP server
|
||||
- Chrome DevTools MCP server
|
||||
- Claude Chrome Extension MCP (browser-use via Claude's Chrome extension)
|
||||
- Claude Chrome Extension MCP (browser-use via CoStrict's Chrome extension)
|
||||
- For Python projects, check for playwright, pytest-playwright
|
||||
|
||||
## Phase 2: Verification Tool Setup
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ If the user chose personal CLAUDE.local.md or both: ask about them, not the code
|
|||
|
||||
- **Hook** (stricter) — deterministic shell command on a tool event; Claude can't skip it. Fits mechanical, fast, per-edit steps: formatting, linting, running a quick test on the changed file.
|
||||
- **Skill** (on-demand) — you or Claude invoke \`/skill-name\` when you want it. Fits workflows that don't belong on every edit: deep verification, session reports, deploys.
|
||||
- **CLAUDE.md note** (looser) — influences Claude's behavior but not enforced. Fits communication/thinking preferences: "plan before coding", "be terse", "explain tradeoffs".
|
||||
- **CLAUDE.md note** (looser) — influences CoStrict's behavior but not enforced. Fits communication/thinking preferences: "plan before coding", "be terse", "explain tradeoffs".
|
||||
|
||||
**Respect Phase 1's skills+hooks choice as a hard filter**: if the user picked "Skills only", downgrade any hook you'd suggest to a skill or a CLAUDE.md note. If "Hooks only", downgrade skills to hooks (where mechanically possible) or notes. If "Neither", everything becomes a CLAUDE.md note. Never propose an artifact type the user didn't opt into.
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ Include:
|
|||
- Personal sandbox URLs, test accounts, or local setup details
|
||||
- Personal workflow or communication preferences
|
||||
|
||||
Keep it short — only include what would make Claude's responses noticeably better for this user.
|
||||
Keep it short — only include what would make CoStrict's responses noticeably better for this user.
|
||||
|
||||
If Phase 2 found multiple git worktrees and the user confirmed they use sibling/external worktrees (not nested inside the main repo): the upward file walk won't find a single CLAUDE.local.md from all worktrees. Write the actual personal content to \`~/.claude/<project-name>-instructions.md\` and make CLAUDE.local.md a one-line stub that imports it: \`@~/.claude/<project-name>-instructions.md\`. The user can copy this one-line stub to each sibling worktree. Never put this import in the project CLAUDE.md. If worktrees are nested inside the main repo (e.g., \`.claude/worktrees/\`), no special handling is needed — the main repo's CLAUDE.local.md is found automatically.
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ Check the environment and ask about each gap you find (use AskUserQuestion):
|
|||
- "after every edit" → \`PostToolUse\` with matcher \`Write|Edit\`
|
||||
- "when Claude finishes" / "before I review" → \`Stop\` event (fires at the end of every turn — including read-only ones)
|
||||
- "before running bash" → \`PreToolUse\` with matcher \`Bash\`
|
||||
- "before committing" (literal git-commit gate) → **not a hooks.json hook.** Matchers can't filter Bash by command content, so there's no way to target only \`git commit\`. Route this to a git pre-commit hook (\`.git/hooks/pre-commit\`, husky, pre-commit framework) instead — offer to write one. If the user actually means "before I review and commit Claude's output", that's \`Stop\` — probe to disambiguate.
|
||||
- "before committing" (literal git-commit gate) → **not a hooks.json hook.** Matchers can't filter Bash by command content, so there's no way to target only \`git commit\`. Route this to a git pre-commit hook (\`.git/hooks/pre-commit\`, husky, pre-commit framework) instead — offer to write one. If the user actually means "before I review and commit CoStrict's output", that's \`Stop\` — probe to disambiguate.
|
||||
Probe if the preference is ambiguous.
|
||||
|
||||
3. **Load the hook reference** (once per \`/init\` run, before the first hook): invoke the Skill tool with \`skill: 'update-config'\` and args starting with \`[hooks-only]\` followed by a one-line summary of what you're building — e.g., \`[hooks-only] Constructing a PostToolUse/Write|Edit format hook for .claude/settings.json using ruff\`. This loads the hooks schema and verification flow into context. Subsequent hooks reuse it — don't re-invoke.
|
||||
|
|
|
|||
|
|
@ -432,7 +432,7 @@ const FACET_EXTRACTION_PROMPT = `Analyze this CoStrict session and extract struc
|
|||
CRITICAL GUIDELINES:
|
||||
|
||||
1. **goal_categories**: Count ONLY what the USER explicitly asked for.
|
||||
- DO NOT count Claude's autonomous codebase exploration
|
||||
- DO NOT count CoStrict's autonomous codebase exploration
|
||||
- DO NOT count work Claude decided to do on its own
|
||||
- ONLY count when user says "can you...", "please...", "I need...", "let's..."
|
||||
|
||||
|
|
@ -1741,7 +1741,7 @@ Use this 4-part structure:
|
|||
|
||||
1. **What's working** - What is the user's unique style of interacting with Claude and what are some impactful things they've done? You can include one or two details, but keep it high level since things might not be fresh in the user's memory. Don't be fluffy or overly complimentary. Also, don't focus on the tool calls they use.
|
||||
|
||||
2. **What's hindering you** - Split into (a) Claude's fault (misunderstandings, wrong approaches, bugs) and (b) user-side friction (not providing enough context, environment issues -- ideally more general than just one project). Be honest but constructive.
|
||||
2. **What's hindering you** - Split into (a) CoStrict's fault (misunderstandings, wrong approaches, bugs) and (b) user-side friction (not providing enough context, environment issues -- ideally more general than just one project). Be honest but constructive.
|
||||
|
||||
3. **Quick wins to try** - Specific CoStrict features they could try from the examples below, or a workflow technique if you think it's really compelling. (Avoid stuff like "Ask Claude to confirm before taking actions" or "Type out more context up front" which are less compelling.)
|
||||
|
||||
|
|
@ -2610,7 +2610,7 @@ function generateHtmlReport(
|
|||
|
||||
<div class="charts-row">
|
||||
<div class="chart-card">
|
||||
<div class="chart-title">What Helped Most (Claude's Capabilities)</div>
|
||||
<div class="chart-title">What Helped Most (CoStrict's Capabilities)</div>
|
||||
${generateBarChart(data.success, '#16a34a')}
|
||||
</div>
|
||||
<div class="chart-card">
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ export type UnseenDivider = { firstUnseenUuid: Message['uuid']; count: number }
|
|||
* that countUnseenAssistantTurns skips — count floors at 1 so the pill
|
||||
* flips from "Jump to bottom" to "1 new message". Without the floor,
|
||||
* the pill stays "Jump to bottom" through an entire tool-call sequence
|
||||
* until Claude's text response lands.
|
||||
* until CoStrict's text response lands.
|
||||
*/
|
||||
export function computeUnseenDivider(
|
||||
messages: readonly Message[],
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ function SpinnerWithVerbInner({
|
|||
: showClearTip && !nextTask
|
||||
? 'Use /clear to start fresh when switching topics and free up context'
|
||||
: showBtwTip && !nextTask
|
||||
? "Use /btw to ask a quick side question without interrupting Claude's current work"
|
||||
? "Use /btw to ask a quick side question without interrupting CoStrict's current work"
|
||||
: spinnerTip
|
||||
|
||||
// Budget text (ant-only) — shown above the tip line
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ type Props = {
|
|||
* in the UI so both should stick.
|
||||
*
|
||||
* Leading <system-reminder> blocks are stripped before checking — they get
|
||||
* prepended to the stored text for Claude's context (memory updates, auto
|
||||
* prepended to the stored text for CoStrict's context (memory updates, auto
|
||||
* mode reminders) but aren't what the user typed. Without stripping, any
|
||||
* prompt that happened to get a reminder is rejected by the startsWith('<')
|
||||
* check. Shows up on `cc -c` resumes where memory-update reminders are dense.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* CYBER_RISK_INSTRUCTION
|
||||
*
|
||||
* This instruction provides guidance for Claude's behavior when handling
|
||||
* This instruction provides guidance for CoStrict's behavior when handling
|
||||
* security-related requests. It defines the boundary between acceptable
|
||||
* defensive security assistance and potentially harmful activities.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ Once the workflow is triggered, Claude will analyze the comment and surrounding
|
|||
- Our Anthropic API key is securely stored as a GitHub Actions secret
|
||||
- Only users with write access to the repository can trigger the workflow
|
||||
- All Claude runs are stored in the GitHub Actions run history
|
||||
- Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
|
||||
- CoStrict's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
|
||||
- We can add more allowed tools by adding them to the workflow file like:
|
||||
|
||||
\`\`\`
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ export const ThinkingConfigSchema = lazySchema(() =>
|
|||
ThinkingDisabledSchema(),
|
||||
])
|
||||
.describe(
|
||||
"Controls Claude's thinking/reasoning behavior. When set, takes precedence over the deprecated maxThinkingTokens.",
|
||||
"Controls CoStrict's thinking/reasoning behavior. When set, takes precedence over the deprecated maxThinkingTokens.",
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -28,16 +28,16 @@ const FRICTION_PATTERNS = [
|
|||
// "No," or "No!" at start — comma/exclamation implies correction tone
|
||||
// (avoids "No problem", "No thanks", "No I think we should...")
|
||||
/^no[,!]\s/i,
|
||||
// Direct corrections about Claude's output
|
||||
// Direct corrections about CoStrict's output
|
||||
/\bthat'?s (wrong|incorrect|not (what|right|correct))\b/i,
|
||||
/\bnot what I (asked|wanted|meant|said)\b/i,
|
||||
// Referencing prior instructions Claude missed
|
||||
/\bI (said|asked|wanted|told you|already said)\b/i,
|
||||
// Questioning Claude's actions
|
||||
// Questioning CoStrict's actions
|
||||
/\bwhy did you\b/i,
|
||||
/\byou should(n'?t| not)? have\b/i,
|
||||
/\byou were supposed to\b/i,
|
||||
// Explicit retry/revert of Claude's work
|
||||
// Explicit retry/revert of CoStrict's work
|
||||
/\btry again\b/i,
|
||||
/\b(undo|revert) (that|this|it|what you)\b/i,
|
||||
]
|
||||
|
|
|
|||
|
|
@ -2315,7 +2315,7 @@ async function* queryModel(
|
|||
max_tokens: maxOutputTokens,
|
||||
})
|
||||
yield createAssistantAPIErrorMessage({
|
||||
content: `${API_ERROR_MESSAGE_PREFIX}: Claude's response exceeded the ${
|
||||
content: `${API_ERROR_MESSAGE_PREFIX}: CoStrict's response exceeded the ${
|
||||
maxOutputTokens
|
||||
} output token maximum. To configure this behavior, set the CLAUDE_CODE_MAX_OUTPUT_TOKENS environment variable.`,
|
||||
apiError: 'max_output_tokens',
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ function mapLSPSeverity(
|
|||
* Convert LSP diagnostics to Claude diagnostic format
|
||||
*
|
||||
* Converts LSP PublishDiagnosticsParams to DiagnosticFile[] format
|
||||
* used by Claude's attachment system.
|
||||
* used by CoStrict's attachment system.
|
||||
*/
|
||||
export function formatDiagnosticsForAttachment(
|
||||
params: PublishDiagnosticsParams,
|
||||
|
|
@ -117,7 +117,7 @@ export type HandlerRegistrationResult = {
|
|||
* Register LSP notification handlers on all servers
|
||||
*
|
||||
* Sets up handlers to listen for textDocument/publishDiagnostics notifications
|
||||
* from all LSP servers and routes them to Claude's diagnostic system.
|
||||
* from all LSP servers and routes them to CoStrict's diagnostic system.
|
||||
* Uses public getAllServers() API for clean access to server instances.
|
||||
*
|
||||
* @returns Tracking data for registration status and runtime failures
|
||||
|
|
|
|||
|
|
@ -244,9 +244,9 @@ async function startFileWatcher(teamDir: string): Promise<void> {
|
|||
*
|
||||
* Pulls from server, then starts the file watcher unconditionally.
|
||||
* The watcher must start even when the server has no content yet
|
||||
* (fresh EAP repo) — otherwise Claude's first team-memory write
|
||||
* (fresh EAP repo) — otherwise CoStrict's first team-memory write
|
||||
* depends entirely on PostToolUse hooks firing notifyTeamMemoryWrite,
|
||||
* which is a chicken-and-egg: Claude's write rate is low enough that
|
||||
* which is a chicken-and-egg: CoStrict's write rate is low enough that
|
||||
* a fresh partner can sit in the bootstrap dead zone for days.
|
||||
*/
|
||||
export async function startTeamMemoryWatcher(): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ export function getAllBaseTools(): Tools {
|
|||
TaskOutputTool,
|
||||
BashTool,
|
||||
// Ant-native builds have bfs/ugrep embedded in the bun binary (same ARGV0
|
||||
// trick as ripgrep). When available, find/grep in Claude's shell are aliased
|
||||
// trick as ripgrep). When available, find/grep in CoStrict's shell are aliased
|
||||
// to these fast tools, so the dedicated Glob/Grep tools are unnecessary.
|
||||
...(hasEmbeddedSearchTools() ? [] : [GlobTool, GrepTool]),
|
||||
ExitPlanModeV2Tool,
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ function getSimpleSandboxSection(): string {
|
|||
}
|
||||
|
||||
export function getSimplePrompt(): string {
|
||||
// Ant-native builds alias find/grep to embedded bfs/ugrep in Claude's shell,
|
||||
// Ant-native builds alias find/grep to embedded bfs/ugrep in CoStrict's shell,
|
||||
// so we don't steer away from them (and Glob/Grep tools are removed).
|
||||
const embedded = hasEmbeddedSearchTools()
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Upload BriefTool attachments to private_api so web viewers can preview them.
|
||||
*
|
||||
* When the repl bridge is active, attachment paths are meaningless to a web
|
||||
* viewer (they're on Claude's machine). We upload to /api/oauth/file_upload —
|
||||
* viewer (they're on CoStrict's machine). We upload to /api/oauth/file_upload —
|
||||
* the same store MessageComposer/SpaceMessage render from — and stash the
|
||||
* returned file_uuid alongside the path. Web resolves file_uuid → preview;
|
||||
* desktop/local try path first.
|
||||
|
|
|
|||
|
|
@ -1583,7 +1583,7 @@ function checkPathConstraintsForStatement(
|
|||
// STALE getCwd() snapshot. Example attack (finding #3):
|
||||
// Set-Location ./.claude; Set-Content ./settings.json '...'
|
||||
// Validator sees ./settings.json → /project/settings.json (not a config file).
|
||||
// Runtime writes /project/.claude/settings.json (Claude's permission config).
|
||||
// Runtime writes /project/.claude/settings.json (CoStrict's permission config).
|
||||
//
|
||||
// ALTERNATIVE APPROACH (rejected): simulate cwd through the statement chain
|
||||
// — after `Set-Location ./.claude`, validate subsequent statements with
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export function isReplModeEnabled(): boolean {
|
|||
|
||||
/**
|
||||
* Tools that are only accessible via REPL when REPL mode is enabled.
|
||||
* When REPL mode is on, these tools are hidden from Claude's direct use,
|
||||
* When REPL mode is on, these tools are hidden from CoStrict's direct use,
|
||||
* forcing Claude to use REPL for batch operations.
|
||||
*/
|
||||
export const REPL_ONLY_TOOLS = new Set([
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ export function getWebSearchPrompt(): string {
|
|||
- Allows Claude to search the web and use the results to inform responses
|
||||
- Provides up-to-date information for current events and recent data
|
||||
- Returns search result information formatted as search result blocks, including links as markdown hyperlinks
|
||||
- Use this tool for accessing information beyond Claude's knowledge cutoff
|
||||
- Use this tool for accessing information beyond CoStrict's knowledge cutoff
|
||||
- Searches are performed automatically within a single API call
|
||||
|
||||
CRITICAL REQUIREMENT - You MUST follow this:
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ export type FileHistorySnapshotMessage = {
|
|||
}
|
||||
|
||||
/**
|
||||
* Per-file attribution state tracking Claude's character contributions.
|
||||
* Per-file attribution state tracking CoStrict's character contributions.
|
||||
*/
|
||||
export type FileAttributionState = {
|
||||
contentHash: string // SHA-256 hash of file content
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ RIPGREP_FUNC_END
|
|||
// For ant-native builds, shadow find/grep with bfs/ugrep embedded in the bun
|
||||
// binary. Unlike rg (which only activates if system rg is absent), we always
|
||||
// shadow find/grep since bfs/ugrep are drop-in replacements and we want
|
||||
// consistent fast behavior in Claude's shell.
|
||||
// consistent fast behavior in CoStrict's shell.
|
||||
const findGrepIntegration = createFindGrepShellIntegration()
|
||||
if (findGrepIntegration !== null) {
|
||||
content += `
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ export function sanitizeModelName(shortName: string): string {
|
|||
}
|
||||
|
||||
/**
|
||||
* Attribution state for tracking Claude's contributions to files.
|
||||
* Attribution state for tracking CoStrict's contributions to files.
|
||||
*/
|
||||
export type AttributionState = {
|
||||
// File states keyed by relative path (from cwd)
|
||||
|
|
@ -192,7 +192,7 @@ export type AttributionState = {
|
|||
}
|
||||
|
||||
/**
|
||||
* Summary of Claude's contribution for a commit.
|
||||
* Summary of CoStrict's contribution for a commit.
|
||||
*/
|
||||
export type AttributionSummary = {
|
||||
claudePercent: number
|
||||
|
|
@ -332,7 +332,7 @@ function computeFileModificationState(
|
|||
const normalizedPath = normalizeFilePath(filePath)
|
||||
|
||||
try {
|
||||
// Calculate Claude's character contribution
|
||||
// Calculate CoStrict's character contribution
|
||||
let claudeContribution: number
|
||||
|
||||
if (oldContent === '' || newContent === '') {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { isEnvTruthy } from './envUtils.js'
|
|||
* Whether this build has bfs/ugrep embedded in the bun binary (ant-native only).
|
||||
*
|
||||
* When true:
|
||||
* - `find` and `grep` in Claude's Bash shell are shadowed by shell functions
|
||||
* - `find` and `grep` in CoStrict's Bash shell are shadowed by shell functions
|
||||
* that invoke the bun binary with argv0='bfs' / argv0='ugrep' (same trick
|
||||
* as embedded ripgrep)
|
||||
* - The dedicated Glob/Grep tools are removed from the tool registry
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
/**
|
||||
* Path conversion utilities for IDE communication
|
||||
* Handles conversions between Claude's environment and the IDE's environment
|
||||
* Handles conversions between CoStrict's environment and the IDE's environment
|
||||
*/
|
||||
|
||||
import { execFileSync } from 'child_process'
|
||||
|
||||
export interface IDEPathConverter {
|
||||
/**
|
||||
* Convert path from IDE format to Claude's local format
|
||||
* Convert path from IDE format to CoStrict's local format
|
||||
* Used when reading workspace folders from IDE lockfile
|
||||
*/
|
||||
toLocalPath(idePath: string): string
|
||||
|
||||
/**
|
||||
* Convert path from Claude's local format to IDE format
|
||||
* Convert path from CoStrict's local format to IDE format
|
||||
* Used when sending paths to IDE (showDiffInIDE, etc.)
|
||||
*/
|
||||
toIDEPath(localPath: string): string
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ function extractConversationContext(
|
|||
messages: Message[],
|
||||
maxChars = 1000,
|
||||
): string {
|
||||
// Get recent assistant messages (they contain Claude's reasoning)
|
||||
// Get recent assistant messages (they contain CoStrict's reasoning)
|
||||
const assistantMessages = messages
|
||||
.filter((m): m is AssistantMessage => m.type === 'assistant')
|
||||
.slice(-3) // Last 3 assistant messages
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ export function convertToSandboxRuntimeConfig(
|
|||
|
||||
// SECURITY: Git's is_git_directory() treats cwd as a bare repo if it has
|
||||
// HEAD + objects/ + refs/. An attacker planting these (plus a config with
|
||||
// core.fsmonitor) escapes the sandbox when Claude's unsandboxed git runs.
|
||||
// core.fsmonitor) escapes the sandbox when CoStrict's unsandboxed git runs.
|
||||
//
|
||||
// Unconditionally denying these paths makes sandbox-runtime mount
|
||||
// /dev/null at non-existent ones, which (a) leaves a 0-byte HEAD stub on
|
||||
|
|
@ -398,7 +398,7 @@ const bareGitRepoScrubPaths: string[] = []
|
|||
|
||||
/**
|
||||
* Delete bare-repo files planted at cwd during a sandboxed command, before
|
||||
* Claude's unsandboxed git calls can see them. See the SECURITY block above
|
||||
* CoStrict's unsandboxed git calls can see them. See the SECURITY block above
|
||||
* bareGitRepoFiles. anthropics/claude-code#29316.
|
||||
*/
|
||||
function scrubBareGitRepoFiles(): void {
|
||||
|
|
|
|||
|
|
@ -361,13 +361,13 @@ export const SettingsSchema = lazySchema(() =>
|
|||
.optional()
|
||||
.describe(
|
||||
'Deprecated: Use attribution instead. ' +
|
||||
"Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)",
|
||||
"Whether to include CoStrict's co-authored by attribution in commits and PRs (defaults to true)",
|
||||
),
|
||||
includeGitInstructions: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.describe(
|
||||
"Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)",
|
||||
"Include built-in commit and PR workflow instructions in CoStrict's system prompt (default: true)",
|
||||
),
|
||||
permissions: PermissionsSchema()
|
||||
.optional()
|
||||
|
|
|
|||
|
|
@ -209,12 +209,12 @@ export async function createBashShellProvider(
|
|||
command: string,
|
||||
): Promise<Record<string, string>> {
|
||||
// TMUX SOCKET ISOLATION (DEFERRED):
|
||||
// We initialize Claude's tmux socket ONLY AFTER the Tmux tool has been used
|
||||
// We initialize CoStrict's tmux socket ONLY AFTER the Tmux tool has been used
|
||||
// at least once, OR if the current command appears to use tmux.
|
||||
// This defers the startup cost until tmux is actually needed.
|
||||
//
|
||||
// Once the Tmux tool is used (or a tmux command runs), all subsequent Bash
|
||||
// commands will use Claude's isolated socket via the TMUX env var override.
|
||||
// commands will use CoStrict's isolated socket via the TMUX env var override.
|
||||
//
|
||||
// See tmuxSocket.ts for the full isolation architecture documentation.
|
||||
const commandUsesTmux = command.includes('tmux')
|
||||
|
|
@ -226,8 +226,8 @@ export async function createBashShellProvider(
|
|||
}
|
||||
const claudeTmuxEnv = getClaudeTmuxEnv()
|
||||
const env: Record<string, string> = {}
|
||||
// CRITICAL: Override TMUX to isolate ALL tmux commands to Claude's socket.
|
||||
// This is NOT the user's TMUX value - it points to Claude's isolated socket.
|
||||
// CRITICAL: Override TMUX to isolate ALL tmux commands to CoStrict's socket.
|
||||
// This is NOT the user's TMUX value - it points to CoStrict's isolated socket.
|
||||
// When null (before socket initializes), user's TMUX is preserved.
|
||||
if (claudeTmuxEnv) {
|
||||
env.TMUX = claudeTmuxEnv
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ let isInITerm2Cached: boolean | null = null
|
|||
/**
|
||||
* Checks if we're currently running inside a tmux session (synchronous version).
|
||||
* Uses the original TMUX value captured at module load, not process.env.TMUX,
|
||||
* because Shell.ts overrides TMUX when Claude's socket is initialized.
|
||||
* because Shell.ts overrides TMUX when CoStrict's socket is initialized.
|
||||
*
|
||||
* IMPORTANT: We ONLY check the TMUX env var. We do NOT run `tmux display-message`
|
||||
* as a fallback because that command will succeed if ANY tmux server is running
|
||||
|
|
@ -40,7 +40,7 @@ export function isInsideTmuxSync(): boolean {
|
|||
/**
|
||||
* Checks if we're currently running inside a tmux session.
|
||||
* Uses the original TMUX value captured at module load, not process.env.TMUX,
|
||||
* because Shell.ts overrides TMUX when Claude's socket is initialized.
|
||||
* because Shell.ts overrides TMUX when CoStrict's socket is initialized.
|
||||
* Caches the result since this won't change during the process lifetime.
|
||||
*
|
||||
* IMPORTANT: We ONLY check the TMUX env var. We do NOT run `tmux display-message`
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* TMUX SOCKET ISOLATION
|
||||
* =====================
|
||||
* This module manages an isolated tmux socket for Claude's operations.
|
||||
* This module manages an isolated tmux socket for CoStrict's operations.
|
||||
*
|
||||
* WHY THIS EXISTS:
|
||||
* Without isolation, Claude could accidentally affect the user's tmux sessions.
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
* (set in Shell.ts via getClaudeTmuxEnv())
|
||||
*
|
||||
* This means ANY tmux command run through Claude - whether via the Tmux tool
|
||||
* directly or via Bash - will operate on Claude's isolated socket, NOT the
|
||||
* directly or via Bash - will operate on CoStrict's isolated socket, NOT the
|
||||
* user's tmux session.
|
||||
*
|
||||
* IMPORTANT: The user's original TMUX env var is NOT used. After socket
|
||||
|
|
@ -85,7 +85,7 @@ let tmuxAvailable = false
|
|||
let tmuxToolUsed = false
|
||||
|
||||
/**
|
||||
* Gets the socket name for Claude's isolated tmux session.
|
||||
* Gets the socket name for CoStrict's isolated tmux session.
|
||||
* Format: claude-<PID>
|
||||
*/
|
||||
export function getClaudeSocketName(): string {
|
||||
|
|
@ -120,11 +120,11 @@ export function isSocketInitialized(): boolean {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the TMUX environment variable value for Claude's isolated socket.
|
||||
* Gets the TMUX environment variable value for CoStrict's isolated socket.
|
||||
*
|
||||
* CRITICAL: This value is used by Shell.ts to override the TMUX env var
|
||||
* in ALL child processes. This ensures that any `tmux` command run via
|
||||
* the Bash tool will operate on Claude's socket, NOT the user's session.
|
||||
* the Bash tool will operate on CoStrict's socket, NOT the user's session.
|
||||
*
|
||||
* Format: "socket_path,server_pid,pane_index" (matches tmux's TMUX env var)
|
||||
* Example: "/tmp/tmux-501/claude-12345,54321,0"
|
||||
|
|
@ -246,7 +246,7 @@ export async function ensureSocketInitialized(): Promise<void> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Kills the tmux server for Claude's isolated socket.
|
||||
* Kills the tmux server for CoStrict's isolated socket.
|
||||
* Called during graceful shutdown to clean up resources.
|
||||
*/
|
||||
async function killTmuxServer(): Promise<void> {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user