# Claude Instructions - **Coding Philosophy**: @~/.ccw/workflows/coding-philosophy.md ## CLI Endpoints - **CLI Tools Usage**: @~/.ccw/workflows/cli-tools-usage.md - **CLI Endpoints Config**: @~/.claude/cli-tools.json **Strictly follow the cli-tools.json configuration** Available CLI endpoints are dynamically defined by the config file ### Agent Calls - **Always use `run_in_background: false`** for Agent tool calls: `Agent({ subagent_type: "xxx", prompt: "...", run_in_background: false })` to ensure synchronous execution and immediate result visibility ### CLI Tool Calls (ccw cli) - **Default**: CLI calls (`ccw cli`) default to background execution (`run_in_background: true`): ``` Bash({ command: "ccw cli -p '...' --tool gemini", run_in_background: true // Bash tool parameter, not ccw cli parameter }) ``` - **CRITICAL — Agent-specific instructions ALWAYS override this default.** If an agent's definition file (`.claude/agents/*.md`) specifies `run_in_background: false`, that instruction takes highest priority. Subagents (Agent tool agents) CANNOT receive hook callbacks, so they MUST use `run_in_background: false` for CLI calls that produce required results. - **After CLI call (main conversation only)**: Stop output immediately - let CLI execute in background. **DO NOT use TaskOutput polling** - wait for hook callback to receive results ### CLI Analysis Calls - **Wait for results**: MUST wait for CLI analysis to complete before taking any write action. Do NOT proceed with fixes while analysis is running - **Value every call**: Each CLI invocation is valuable and costly. NEVER waste analysis results: - Aggregate multiple analysis results before proposing solutions ### CLI Auto-Invoke Triggers - **Reference**: See `cli-tools-usage.md` → [Auto-Invoke Triggers](#auto-invoke-triggers) for full specification - **Key scenarios**: Self-repair fails, ambiguous requirements, architecture decisions, pattern uncertainty, critical code paths - **Principles**: Default `--mode analysis`, no confirmation needed, wait for completion, flexible rule selection ## Workflow Session Awareness ### Artifact Locations | Workflow | Directory | Summary File | |----------|-----------|-------------| | `workflow-plan` | `.workflow/active/WFS-*/` | `workflow-session.json` | | `workflow-lite-plan` | `.workflow/.lite-plan/{slug}-{date}/` | `plan.json` | | `analyze-with-file` | `.workflow/.analysis/ANL-*/` | `conclusions.json` | | `multi-cli-plan` | `.workflow/.multi-cli-plan/*/` | `session-state.json` | | `lite-fix` | `.workflow/.lite-fix/*/` | `fix-plan.json` | | Other | `.workflow/.debug/`, `.workflow/.scratchpad/`, `.workflow/archives/` | — | ### Pre-Task Discovery Before starting any workflow skill, scan recent sessions (7 days) to avoid conflicts and reuse prior work: - If overlapping file scope found: warn user, suggest `--continue` or reference prior session - If complementary: feed prior findings into new session context - `memory/MEMORY.md` for cross-session knowledge; `.workflow/` for session-specific artifacts — reference session IDs, don't duplicate ## Code Diagnostics - **Prefer `mcp__ide__getDiagnostics`** for code error checking over shell-based TypeScript compilation