Claude Runtime Best Practices
Apply when writing code that invokes Claude (subprocess, SDK, or MCP).
Rules
TAO engine (
src/tao/) is stub scaffolding. It is not used by the web server. All intelligence is delegated toclaude -psubprocess viastream-jsonoutput. Parse events:system,assistant(text +tool_use),tool_result,result.claude -psubprocess requires Claude Code CLI in PATH. In cloud (Railway), the CLI is NOT available — cloud deployments must useANTHROPIC_API_KEY+claude_agent_sdk. CheckTAO_USE_AGENT_SDKenv var to switch paths.MCP SDK subpath imports are required. Use
@modelcontextprotocol/sdk/server/mcp.jsand@modelcontextprotocol/sdk/server/stdio.js. The top-level@modelcontextprotocol/sdkimport does NOT exportMcpServerdirectly.claude_agent_sdkis the chosen Python SDK path. Managed Agents API (client.beta.agents) was rejected — 0 successful PoC cycles, schema blocker onconfig.setup_commands. See.harness/agents/sdk-migration-plan.md.