[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78BVAB24Q6ZM95MCJNZ4DF2":3,"skill-same:01M78BVAB24Q6ZM95MCJNZ4DF2":235},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M78BVAB24Q6ZM95MCJNZ4DF2","create-agent-tui",null,"Scaffolds a complete agent TUI in TypeScript using @openrouter\u002Fagent — like create-react-app for terminal agents. Generates a customizable terminal interface with three input styles, four tool display modes, ASCII banners, streaming output, session persistence, and configurable tools. Use when building an agent, creating a TUI, scaffolding an agent project, or building a coding assistant.","Solizardking\u002Fskillhub-main","Solizardking","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F108096810?v=4","01M786KDB10AYV042N0F9BD5B5","Clawd","01M786NYYXSZK1D05WM8JQPC48",0,"MIT","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: create-agent-tui\ndescription: Scaffolds a complete agent TUI in TypeScript using @openrouter\u002Fagent — like create-react-app for terminal agents. Generates a customizable terminal interface with three input styles, four tool display modes, ASCII banners, streaming output, session persistence, and configurable tools. Use when building an agent, creating a TUI, scaffolding an agent project, or building a coding assistant.\n---\n\n# Create Agent TUI\n\nScaffolds a complete agent TUI in TypeScript targeting OpenRouter. The generated project uses `@openrouter\u002Fagent` for the inner loop (model calls, tool execution, stop conditions) and provides the outer shell: a customizable terminal interface, configuration, session management, tool definitions, and an entry point.\n\nArchitecture draws from three production agent systems:\n- **pi-mono\u002Fcoding-agent** — three-layer separation, JSONL sessions, pluggable tool operations\n- **Clawd Code** — tool metadata (read-only, destructive, approval), system prompt composition\n- **Codex CLI** — layered config, approval flow with session caching, structured logging\n\n## Prerequisites\n\n- Node.js 18+\n- `OPENROUTER_API_KEY` from [openrouter.ai\u002Fsettings\u002Fkeys](https:\u002F\u002Fopenrouter.ai\u002Fsettings\u002Fkeys)\n- For full SDK reference, see the `openrouter-typescript-sdk` skill\n\n---\n\n## Decision Tree\n\n| User wants to... | Action |\n|---|---|\n| Build a new agent from scratch | Present checklist below → follow Generation Workflow |\n| Add tools to an existing harness | Read [references\u002Ftools.md](references\u002Ftools.md), present tool checklist only |\n| Add a harness module | Read [references\u002Fmodules.md](references\u002Fmodules.md), generate the module |\n| Add an API server entry point | Read [references\u002Fserver-entry-points.md](references\u002Fserver-entry-points.md) |\n\n---\n\n## Interactive Tool Checklist\n\nPresent this as a multi-select checklist. Items marked **ON** are pre-selected defaults.\n\n### OpenRouter Server Tools (server-side, zero implementation)\n\n| Tool | Type string | Default | Config |\n|------|------------|---------|--------|\n| Web Search | `openrouter:web_search` | ON | engine, max_results, domain filtering |\n| Datetime | `openrouter:datetime` | ON | timezone |\n| Image Generation | `openrouter:image_generation` | OFF | model, quality, size, format |\n\nServer tools go in the `tools` array alongside user-defined tools. No client code needed — OpenRouter executes them.\n\n### User-Defined Tools (client-side, generated into src\u002Ftools\u002F)\n\n| Tool | Default | Description |\n|------|---------|-------------|\n| File Read | ON | Read files with offset\u002Flimit, detect images |\n| File Write | ON | Write\u002Fcreate files, auto-create directories |\n| File Edit | ON | Search-and-replace with diff validation |\n| Glob\u002FFind | ON | File discovery by glob pattern |\n| Grep\u002FSearch | ON | Content search by regex |\n| Directory List | ON | List directory contents |\n| Shell\u002FBash | ON | Execute commands with timeout and output capture |\n| JS REPL | OFF | Persistent Node.js environment |\n| Sub-agent Spawn | OFF | Delegate tasks to child agents |\n| Plan\u002FTodo | OFF | Track multi-step task progress |\n| Request User Input | OFF | Structured multiple-choice questions |\n| Web Fetch | OFF | Fetch and extract text from web pages |\n| View Image | OFF | Read local images as base64 |\n| Custom Tool Template | ON | Empty skeleton for domain-specific tools |\n\n### Harness Modules (architectural components)\n\n| Module | Default | Description |\n|--------|---------|-------------|\n| Session Persistence | ON | JSONL append-only conversation log |\n| ASCII Logo Banner | OFF | Custom ASCII art banner on startup — ask for project name |\n| Context Compaction | OFF | Summarize older messages when context is long |\n| System Prompt Composition | OFF | Assemble instructions from static + dynamic context |\n| Tool Permissions \u002F Approval | OFF | Gate dangerous tools behind user confirmation |\n| Structured Event Logging | OFF | Emit events for tool calls, API requests, errors |\n| `@`-file References | OFF | `@filename` to attach file content to next message |\n| `!` Shell Shortcut | OFF | `!command` to run shell and inject output into context |\n| Multi-line Input | OFF | Shift+Enter for multi-line (requires raw terminal mode) |\n\n### Slash Commands (user-facing REPL commands)\n\n| Command | Default | Description |\n|---------|---------|-------------|\n| `\u002Fmodel` | ON | Switch model via OpenRouter API |\n| `\u002Fnew` | ON | Start a fresh conversation |\n| `\u002Fhelp` | ON | List available commands |\n| `\u002Fcompact` | OFF | Manually trigger context compaction |\n| `\u002Fsession` | OFF | Show session metadata and token usage |\n| `\u002Fexport` | OFF | Save conversation as Markdown |\n\nWhen slash commands are enabled, generate `src\u002Fcommands.ts` with a command registry. See [references\u002Fslash-commands.md](references\u002Fslash-commands.md) for specs.\n\n### Visual Customization (present as single-select for each)\n\n**Input style** — how the prompt looks. See [references\u002Finput-styles.md](references\u002Finput-styles.md):\n\n| Style | Default | Description |\n|-------|---------|-------------|\n| `block` | ON | Full-width background box with `›` prompt, adapts to terminal theme |\n| `bordered` | | Horizontal `─` lines above and below input |\n| `plain` | | Simple `> ` readline prompt, no escape sequences |\n| Other | | User describes what they want — implement a custom input style |\n\n**Tool display** — how tool calls appear during execution. See [references\u002Ftool-display.md](references\u002Ftool-display.md):\n\n| Style | Default | Description |\n|-------|---------|-------------|\n| `grouped` | ON | Bold action labels with tree-branch output |\n| `emoji` | | Per-call `⚡`\u002F`✓` markers with args and timing |\n| `minimal` | | Aggregated one-liner summaries |\n| `hidden` | | No tool output |\n| Other | | User describes what they want — implement a custom display |\n\n**Loader animation** — shown while waiting for model response. See [references\u002Floader.md](references\u002Floader.md):\n\n| Style | Default | Description |\n|-------|---------|-------------|\n| `spinner` | ON | Braille dot spinner (⠋⠙⠹…) to the left of the text |\n| `gradient` | | Scrolling color shimmer over the loader text |\n| `minimal` | | Trailing dots (`Working···`) |\n| Other | | User describes what they want — implement a custom animation |\n\nAlso ask for the **loader text** (default: `\"Working\"`).\n\n---\n\n## Generation Workflow\n\nAfter getting checklist selections, follow this workflow:\n\n```\n- [ ] Generate package.json with dependencies\n- [ ] Generate src\u002Fconfig.ts (add showBanner field if ASCII Logo Banner is ON)\n- [ ] Generate src\u002Ftools\u002Findex.ts wiring selected tools + server tools\n- [ ] Generate selected tool files in src\u002Ftools\u002F (see Tool Pattern below, specs in references\u002Ftools.md)\n- [ ] Generate src\u002Fagent.ts (core runner)\n- [ ] Generate selected harness modules (specs in references\u002Fmodules.md)\n- [ ] Generate src\u002Fterminal-bg.ts (adaptive input background — see references\u002Ftui.md)\n- [ ] Generate input style functions in src\u002Fcli.ts (block\u002Fbordered\u002Fplain — see references\u002Finput-styles.md)\n- [ ] Generate src\u002Frenderer.ts (tool display — see references\u002Ftool-display.md)\n- [ ] Generate src\u002Floader.ts (loader animation — see references\u002Floader.md)\n- [ ] If slash commands selected: generate src\u002Fcommands.ts (see references\u002Fslash-commands.md)\n- [ ] If ASCII Logo Banner is ON: generate src\u002Fbanner.ts (see ASCII Logo Banner section below)\n- [ ] Generate src\u002Fcli.ts entry point (or src\u002Fserver.ts — see references\u002Fserver-entry-points.md)\n- [ ] Generate .env.example with OPENROUTER_API_KEY=\n- [ ] Verify: run npx tsc --noEmit to check types\n```\n\n---\n\n## Tool Pattern\n\nAll user-defined tools follow this pattern using `@openrouter\u002Fagent\u002Ftool`. Here is one complete example — all other tools in [references\u002Ftools.md](references\u002Ftools.md) follow the same shape:\n\n```typescript\nimport { tool } from '@openrouter\u002Fagent\u002Ftool';\nimport { z } from 'zod';\nimport { readFile, stat } from 'fs\u002Fpromises';\n\nexport const fileReadTool = tool({\n  name: 'file_read',\n  description: 'Read the contents of a file at the given path',\n  inputSchema: z.object({\n    path: z.string().describe('Absolute path to the file'),\n    offset: z.number().optional().describe('Start reading from this line (1-indexed)'),\n    limit: z.number().optional().describe('Maximum number of lines to return'),\n  }),\n  execute: async ({ path, offset, limit }) => {\n    try {\n      const content = await readFile(path, 'utf-8');\n      const lines = content.split('\\n');\n\n      const start = offset ? offset - 1 : 0;\n      const end = limit ? start + limit : lines.length;\n      const slice = lines.slice(start, end);\n\n      return {\n        content: slice.join('\\n'),\n        totalLines: lines.length,\n        ...(end \u003C lines.length && { truncated: true, nextOffset: end + 1 }),\n      };\n    } catch (err: any) {\n      if (err.code === 'ENOENT') return { error: `File not found: ${path}` };\n      if (err.code === 'EACCES') return { error: `Permission denied: ${path}` };\n      return { error: err.message };\n    }\n  },\n});\n```\n\nFor specs of all other tools, see [references\u002Ftools.md](references\u002Ftools.md).\n\n---\n\n## Core Files\n\nThese files are always generated. The agent adapts them based on checklist selections.\n\n### package.json\n\nInitialize the project and install dependencies at their latest versions:\n\n```bash\nnpm init -y\nnpm pkg set type=module\nnpm pkg set scripts.start=\"tsx src\u002Fcli.ts\"\nnpm pkg set scripts.dev=\"tsx watch src\u002Fcli.ts\"\nnpm install @openrouter\u002Fagent glob zod\nnpm install -D tsx typescript @types\u002Fnode\n```\n\n### tsconfig.json\n\n```json\n{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"module\": \"Node16\",\n    \"moduleResolution\": \"Node16\",\n    \"outDir\": \"dist\",\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"skipLibCheck\": true\n  },\n  \"include\": [\"src\"]\n}\n```\n\n### src\u002Fconfig.ts\n\n```typescript\nimport { readFileSync, existsSync } from 'fs';\nimport { resolve } from 'path';\n\nexport interface DisplayConfig {\n  toolDisplay: 'emoji' | 'grouped' | 'minimal' | 'hidden';\n  reasoning: boolean;\n  inputStyle: 'block' | 'bordered' | 'plain';\n}\n\nexport interface AgentConfig {\n  apiKey: string;\n  model: string;\n  systemPrompt: string;\n  maxSteps: number;\n  maxCost: number;\n  sessionDir: string;\n  showBanner: boolean;\n  display: DisplayConfig;\n  slashCommands: boolean;\n}\n\nconst DEFAULTS: AgentConfig = {\n  apiKey: '',\n  model: 'anthropic\u002Fclaude-opus-4.7',\n  systemPrompt: [\n    'You are a coding assistant with access to tools for reading, writing, editing, and searching files, and running shell commands.',\n    '',\n    'Current working directory: {cwd}',\n    '',\n    'Guidelines:',\n    '- Use your tools proactively. Explore the codebase to find answers instead of asking the user.',\n    '- Keep working until the task is fully resolved before responding.',\n    '- Do not guess or make up information — use your tools to verify.',\n    '- Be concise and direct.',\n    '- Show file paths clearly when working with files.',\n    '- Prefer grep and glob tools over shell commands for file search.',\n    '- When editing code, make minimal targeted changes consistent with the existing style.',\n  ].join('\\n'),\n  maxSteps: 20,\n  maxCost: 1.0,\n  sessionDir: '.sessions',\n  showBanner: false,\n  display: { toolDisplay: 'grouped', reasoning: false, inputStyle: 'block' },\n  slashCommands: true,\n};\n\nexport function loadConfig(overrides: Partial\u003CAgentConfig> = {}): AgentConfig {\n  let config = { ...DEFAULTS };\n\n  const configPath = resolve('agent.config.json');\n  if (existsSync(configPath)) {\n    const file = JSON.parse(readFileSync(configPath, 'utf-8'));\n    if (file.display) {\n      config.display = { ...config.display, ...file.display };\n    }\n    config = { ...config, ...file, display: config.display };\n  }\n\n  if (process.env.OPENROUTER_API_KEY) config.apiKey = process.env.OPENROUTER_API_KEY;\n  if (process.env.AGENT_MODEL) config.model = process.env.AGENT_MODEL;\n  if (process.env.AGENT_MAX_STEPS) config.maxSteps = Number(process.env.AGENT_MAX_STEPS);\n  if (process.env.AGENT_MAX_COST) config.maxCost = Number(process.env.AGENT_MAX_COST);\n\n  if (overrides.display) {\n    config.display = { ...config.display, ...overrides.display };\n  }\n  config = { ...config, ...overrides, display: config.display };\n  if (!config.apiKey) throw new Error('OPENROUTER_API_KEY is required.');\n  return config;\n}\n```\n\n### src\u002Ftools\u002Findex.ts\n\nAdapt imports based on checklist selections. This example includes all default-ON tools:\n\n```typescript\nimport { serverTool } from '@openrouter\u002Fagent';\nimport { fileReadTool } from '.\u002Ffile-read.js';\nimport { fileWriteTool } from '.\u002Ffile-write.js';\nimport { fileEditTool } from '.\u002Ffile-edit.js';\nimport { globTool } from '.\u002Fglob.js';\nimport { grepTool } from '.\u002Fgrep.js';\nimport { listDirTool } from '.\u002Flist-dir.js';\nimport { shellTool } from '.\u002Fshell.js';\n\nexport const tools = [\n  \u002F\u002F User-defined tools — executed client-side\n  fileReadTool,\n  fileWriteTool,\n  fileEditTool,\n  globTool,\n  grepTool,\n  listDirTool,\n  shellTool,\n\n  \u002F\u002F Server tools — executed by OpenRouter, no client implementation needed\n  serverTool({ type: 'openrouter:web_search' }),\n  serverTool({ type: 'openrouter:datetime', parameters: { timezone: 'UTC' } }),\n];\n```\n\n### src\u002Fagent.ts\n\n```typescript\nimport { OpenRouter } from '@openrouter\u002Fagent';\nimport type { Item } from '@openrouter\u002Fagent';\nimport { stepCountIs, maxCost } from '@openrouter\u002Fagent\u002Fstop-conditions';\nimport type { AgentConfig } from '.\u002Fconfig.js';\nimport { tools } from '.\u002Ftools\u002Findex.js';\n\nexport type ChatMessage = { role: 'user' | 'assistant' | 'system'; content: string };\n\nexport type AgentEvent =\n  | { type: 'text'; delta: string }\n  | { type: 'tool_call'; name: string; callId: string; args: Record\u003Cstring, unknown> }\n  | { type: 'tool_result'; name: string; callId: string; output: string }\n  | { type: 'reasoning'; delta: string };\n\nexport async function runAgent(\n  config: AgentConfig,\n  input: string | ChatMessage[],\n  options?: { onEvent?: (event: AgentEvent) => void; signal?: AbortSignal },\n) {\n  const client = new OpenRouter({ apiKey: config.apiKey });\n\n  const result = client.callModel({\n    model: config.model,\n    instructions: config.systemPrompt.replace('{cwd}', process.cwd()),\n    input: input as string | Item[],\n    tools,\n    stopWhen: [stepCountIs(config.maxSteps), maxCost(config.maxCost)],\n  });\n\n  if (options?.onEvent) {\n    let lastTextLen = 0;\n    const callNames = new Map\u003Cstring, string>();\n\n    for await (const item of result.getItemsStream()) {\n      if (options?.signal?.aborted) break;\n      if (item.type === 'message') {\n        const text = item.content\n          ?.filter((c): c is { type: 'output_text'; text: string } => 'text' in c)\n          .map((c) => c.text)\n          .join('') ?? '';\n        if (text.length > lastTextLen) {\n          options.onEvent({ type: 'text', delta: text.slice(lastTextLen) });\n          lastTextLen = text.length;\n        }\n      } else if (item.type === 'function_call') {\n        callNames.set(item.callId, item.name);\n        if (item.status === 'completed') {\n          const args = (() => { try { return item.arguments ? JSON.parse(item.arguments) : {}; } catch { return {}; } })();\n          options.onEvent({ type: 'tool_call', name: item.name, callId: item.callId, args });\n        }\n      } else if (item.type === 'function_call_output') {\n        const out = typeof item.output === 'string' ? item.output : JSON.stringify(item.output);\n        options.onEvent({\n          type: 'tool_result',\n          name: callNames.get(item.callId) ?? 'unknown',\n          callId: item.callId,\n          output: out.length > 200 ? out.slice(0, 200) + '…' : out,\n        });\n      } else if (item.type === 'reasoning') {\n        const text = item.summary?.map((s: { text: string }) => s.text).join('') ?? '';\n        if (text) options.onEvent({ type: 'reasoning', delta: text });\n      }\n    }\n  }\n\n  const response = await result.getResponse();\n  return { text: response.outputText ?? '', usage: response.usage, output: response.output };\n}\n\nexport async function runAgentWithRetry(\n  config: AgentConfig,\n  input: string | ChatMessage[],\n  options?: { onEvent?: (event: AgentEvent) => void; signal?: AbortSignal; maxRetries?: number },\n) {\n  for (let attempt = 0, max = options?.maxRetries ?? 3; attempt \u003C= max; attempt++) {\n    try { return await runAgent(config, input, options); }\n    catch (err: any) {\n      const s = err?.status ?? err?.statusCode;\n      if (!(s === 429 || (s >= 500 && s \u003C 600)) || attempt === max) throw err;\n      await new Promise((r) => setTimeout(r, Math.min(1000 * 2 ** attempt, 30000)));\n    }\n  }\n  throw new Error('Unreachable');\n}\n```\n\n### src\u002Fcli.ts\n\nThree input styles are supported: `block` (background box), `bordered` (horizontal lines), and `plain` (simple caret). See [references\u002Finput-styles.md](references\u002Finput-styles.md) for full implementations of `styledReadLine()`, `borderedReadLine()`, and the `getInput()` dispatcher.\n\n```typescript\nimport { createInterface } from 'readline';\nimport { loadConfig } from '.\u002Fconfig.js';\nimport { runAgentWithRetry, type AgentEvent } from '.\u002Fagent.js';\nimport { detectBg } from '.\u002Fterminal-bg.js';\n\u002F\u002F import { styledReadLine, borderedReadLine } from ... — see references\u002Finput-styles.md\n\nconst DIM = '\\x1b[2m';\nconst RESET = '\\x1b[0m';\nconst BOLD = '\\x1b[1m';\nconst CYAN = '\\x1b[36m';\nconst GREEN = '\\x1b[32m';\nconst YELLOW = '\\x1b[33m';\nconst GRAY = '\\x1b[90m';\n\nfunction formatTokens(n: number): string {\n  return n >= 1000 ? `${(n \u002F 1000).toFixed(1)}k` : String(n);\n}\n\nfunction summarizeArgs(name: string, args: Record\u003Cstring, unknown>): string {\n  const key = { shell: 'command', file_read: 'path', file_write: 'path',\n    file_edit: 'path', glob: 'pattern', grep: 'pattern', web_search: 'query',\n  }[name] ?? Object.keys(args)[0];\n  if (!key || !(key in args)) return '';\n  const val = String(args[key]);\n  return `${key}=${val.length > 40 ? val.slice(0, 40) + '…' : val}`;\n}\n\nasync function main() {\n  const config = loadConfig();\n  const BG_INPUT = config.display.inputStyle === 'block' ? await detectBg() : '';\n\n  \u002F\u002F Banner\n  const width = Math.min(process.stdout.columns || 60, 60);\n  const line = GRAY + '─'.repeat(width) + RESET;\n  console.log(`\\n${line}`);\n  console.log(`  ${BOLD}My Agent${RESET}  ${DIM}v0.1.0${RESET}`);\n  console.log(`  ${DIM}model${RESET}  ${CYAN}${config.model}${RESET}`);\n  if (config.slashCommands) console.log(`  ${DIM}\u002Fmodel to change${RESET}`);\n  console.log(`${line}\\n`);\n\n  const rl = createInterface({ input: process.stdin, output: process.stdout, prompt: `${GREEN}>${RESET} ` });\n\n  async function getInput(): Promise\u003Cstring> {\n    switch (config.display.inputStyle) {\n      case 'block': return styledReadLine(BG_INPUT);\n      case 'bordered': return borderedReadLine();\n      case 'plain':\n      default:\n        return new Promise((r) => { rl.prompt(); rl.once('line', r); });\n    }\n  }\n\n  while (true) {\n    const input = await getInput();\n    const trimmed = input.trim();\n    if (!trimmed) continue;\n\n    if (config.display.inputStyle !== 'plain') {\n      const cwd = process.cwd().replace(process.env.HOME ?? '', '~');\n      process.stdout.write(`\\x1b[K  ${DIM}${cwd}${RESET}\\n`);\n    }\n\n    if (trimmed.toLowerCase() === 'exit') { process.exit(0); }\n\n    console.log();\n    let streaming = false, started = false;\n    const toolStart = new Map\u003Cstring, number>();\n    const dots = ['·', '··', '···'];\n    let di = 0;\n    const spin = setInterval(() => {\n      if (!started) process.stdout.write(`\\r${DIM}${dots[di++ % 3]}${RESET}`);\n    }, 300);\n\n    const handleEvent = (event: AgentEvent) => {\n      if (!started) { started = true; process.stdout.write('\\r\\x1b[K'); }\n      if (event.type === 'text') { streaming = true; process.stdout.write(event.delta); }\n      else if (event.type === 'tool_call') {\n        if (streaming) { process.stdout.write('\\n'); streaming = false; }\n        toolStart.set(event.callId, Date.now());\n        const args = summarizeArgs(event.name, event.args);\n        console.log(`  ${YELLOW}⚡${RESET} ${DIM}${event.name}${args ? ' ' + args : ''}${RESET}`);\n      } else if (event.type === 'tool_result') {\n        const ms = Date.now() - (toolStart.get(event.callId) ?? Date.now());\n        console.log(`  ${GREEN}✓${RESET} ${DIM}${event.name} (${(ms \u002F 1000).toFixed(1)}s)${RESET}`);\n        started = false;\n      }\n    };\n\n    try {\n      const result = await runAgentWithRetry(config, trimmed, { onEvent: handleEvent });\n      clearInterval(spin);\n      if (streaming) process.stdout.write(RESET);\n      const inT = result.usage?.inputTokens ?? 0;\n      const outT = result.usage?.outputTokens ?? 0;\n      console.log(`\\n${GRAY}  ${formatTokens(inT)} in · ${formatTokens(outT)} out${RESET}\\n`);\n    } catch (err: any) {\n      clearInterval(spin);\n      if (streaming) process.stdout.write(RESET);\n      console.log(`\\n${YELLOW}  Error: ${err.message}${RESET}\\n`);\n    }\n  }\n}\n\nmain();\n```\n\n---\n\n## ASCII Logo Banner\n\nWhen `ASCII Logo Banner` is selected, ask the user for their project name, then generate `src\u002Fbanner.ts` with ASCII art of that name. Use a block-letter style with the `█` character for the art. The banner should fit in a 60-column terminal.\n\n### src\u002Fbanner.ts\n\nGenerate ASCII art for the user's project name. Example for a project called \"ACME\":\n\n```typescript\nconst RESET = '\\x1b[0m';\nconst BOLD = '\\x1b[1m';\nconst DIM = '\\x1b[2m';\nconst CYAN = '\\x1b[36m';\n\nconst LOGO = `\n   █████╗  ██████╗███╗   ███╗███████╗\n  ██╔══██╗██╔════╝████╗ ████║██╔════╝\n  ███████║██║     ██╔████╔██║█████╗\n  ██╔══██║██║     ██║╚██╔╝██║██╔══╝\n  ██║  ██║╚██████╗██║ ╚═╝ ██║███████╗\n  ╚═╝  ╚═╝ ╚═════╝╚═╝     ╚═╝╚══════╝`;\n\nexport function printBanner(model: string): void {\n  console.log(CYAN + BOLD + LOGO + RESET);\n  console.log(`  ${DIM}model  ${RESET}${model}\\n`);\n}\n```\n\nAdapt the ASCII art to the user's actual project name. Keep it to one or two short words that fit in 60 columns.\n\n### Wire into src\u002Fcli.ts\n\nAdd at the top of `main()`, before the text banner, when `showBanner` is selected:\n\n```typescript\nimport { printBanner } from '.\u002Fbanner.js';\n\n\u002F\u002F In main(), replace the text banner with:\nif (config.showBanner) {\n  printBanner(config.model);\n} else {\n  \u002F\u002F fall back to the text banner from the cli.ts template above\n}\n```\n\nAdd `showBanner: boolean` to `AgentConfig` (default `false`). Enable via `agent.config.json` or `loadConfig({ showBanner: true })`.\n\n---\n\n## Reference Files\n\nFor content beyond the core files:\n\n- **[references\u002Ftools.md](references\u002Ftools.md)** — Specs for all user-defined tools: file-read, file-write, file-edit, glob, grep, list-dir, shell, js-repl, sub-agent, plan, request-input, web-fetch, view-image, custom template\n- **[references\u002Fmodules.md](references\u002Fmodules.md)** — Harness modules: session persistence, context compaction, system prompt composition, tool approval, structured logging\n- **[references\u002Ftui.md](references\u002Ftui.md)** — Terminal background detection, adaptive input background\n- **[references\u002Ftool-display.md](references\u002Ftool-display.md)** — Tool display styles: emoji, grouped, minimal; TuiRenderer class, per-tool colors, formatters\n- **[references\u002Finput-styles.md](references\u002Finput-styles.md)** — Input styles: block (background box), bordered (horizontal lines), plain (simple caret)\n- **[references\u002Floader.md](references\u002Floader.md)** — Loader animations: gradient (scrolling shimmer), spinner (braille dots), minimal (trailing dots)\n- **[references\u002Fslash-commands.md](references\u002Fslash-commands.md)** — Slash command registry: \u002Fmodel, \u002Fnew, \u002Fhelp, \u002Fcompact, \u002Fsession, \u002Fexport\n- **[references\u002Fsystem-prompt.md](references\u002Fsystem-prompt.md)** — Default system prompt, buildSystemPrompt(), customization guide\n- **[references\u002Fserver-entry-points.md](references\u002Fserver-entry-points.md)** — Express\u002FHono API server entry point with SSE streaming, plus extension points (MCP, WebSocket, dynamic models)\n","# Create Agent TUI\n\nScaffolds a complete agent TUI in TypeScript targeting OpenRouter. The generated project uses `@openrouter\u002Fagent` for the inner loop (model calls, tool execution, stop conditions) and provides the outer shell: a customizable terminal interface, configuration, session management, tool definitions, and an entry point.\n\nArchitecture draws from three production agent systems:\n- **pi-mono\u002Fcoding-agent** — three-layer separation, JSONL sessions, pluggable tool operations\n- **Clawd Code** — tool metadata (read-only, destructive, approval), system prompt composition\n- **Codex CLI** — layered config, approval flow with session caching, structured logging\n\n## Prerequisites\n\n- Node.js 18+\n- `OPENROUTER_API_KEY` from [openrouter.ai\u002Fsettings\u002Fkeys](https:\u002F\u002Fopenrouter.ai\u002Fsettings\u002Fkeys)\n- For full SDK reference, see the `openrouter-typescript-sdk` skill\n\n---\n\n## Decision Tree\n\n| User wants to... | Action |\n|---|---|\n| Build a new agent from scratch | Present checklist below → follow Generation Workflow |\n| Add tools to an existing harness | Read [references\u002Ftools.md](references\u002Ftools.md), present tool checklist only |\n| Add a harness module | Read [references\u002Fmodules.md](references\u002Fmodules.md), generate the module |\n| Add an API server entry point | Read [references\u002Fserver-entry-points.md](references\u002Fserver-entry-points.md) |\n\n---\n\n## Interactive Tool Checklist\n\nPresent this as a multi-select checklist. Items marked **ON** are pre-selected defaults.\n\n### OpenRouter Server Tools (server-side, zero implementation)\n\n| Tool | Type string | Default | Config |\n|------|------------|---------|--------|\n| Web Search | `openrouter:web_search` | ON | engine, max_results, domain filtering |\n| Datetime | `openrouter:datetime` | ON | timezone |\n| Image Generation | `openrouter:image_generation` | OFF | model, quality, size, format |\n\nServer tools go in the `tools` array alongside user-defined tools. No client code needed — OpenRouter executes them.\n\n### User-Defined Tools (client-side, generated into src\u002Ftools\u002F)\n\n| Tool | Default | Description |\n|------|---------|-------------|\n| File Read | ON | Read files with offset\u002Flimit, detect images |\n| File Write | ON | Write\u002Fcreate files, auto-create directories |\n| File Edit | ON | Search-and-replace with diff validation |\n| Glob\u002FFind | ON | File discovery by glob pattern |\n| Grep\u002FSearch | ON | Content search by regex |\n| Directory List | ON | List directory contents |\n| Shell\u002FBash | ON | Execute commands with timeout and output capture |\n| JS REPL | OFF | Persistent Node.js environment |\n| Sub-agent Spawn | OFF | Delegate tasks to child agents |\n| Plan\u002FTodo | OFF | Track multi-step task progress |\n| Request User Input | OFF | Structured multiple-choice questions |\n| Web Fetch | OFF | Fetch and extract text from web pages |\n| View Image | OFF | Read local images as base64 |\n| Custom Tool Template | ON | Empty skeleton for domain-specific tools |\n\n### Harness Modules (architectural components)\n\n| Module | Default | Description |\n|--------|---------|-------------|\n| Session Persistence | ON | JSONL append-only conversation log |\n| ASCII Logo Banner | OFF | Custom ASCII art banner on startup — ask for project name |\n| Context Compaction | OFF | Summarize older messages when context is long |\n| System Prompt Composition | OFF | Assemble instructions from static + dynamic context |\n| Tool Permissions \u002F Approval | OFF | Gate dangerous tools behind user confirmation |\n| Structured Event Logging | OFF | Emit events for tool calls, API requests, errors |\n| `@`-file References | OFF | `@filename` to attach file content to next message |\n| `!` Shell Shortcut | OFF | `!command` to run shell and inject output into context |\n| Multi-line Input | OFF | Shift+Enter for multi-line (requires raw terminal mode) |\n\n### Slash Commands (user-facing REPL commands)\n\n| Command | Default | Description |\n|---------|---------|-------------|\n| `\u002Fmodel` | ON | Switch model via OpenRouter API |\n| `\u002Fnew` | ON | Start a fresh conversation |\n| `\u002Fhelp` | ON | List available commands |\n| `\u002Fcompact` | OFF | Manually trigger context compaction |\n| `\u002Fsession` | OFF | Show session metadata and token usage |\n| `\u002Fexport` | OFF | Save conversation as Markdown |\n\nWhen slash commands are enabled, generate `src\u002Fcommands.ts` with a command registry. See [references\u002Fslash-commands.md](references\u002Fslash-commands.md) for specs.\n\n### Visual Customization (present as single-select for each)\n\n**Input style** — how the prompt looks. See [references\u002Finput-styles.md](references\u002Finput-styles.md):\n\n| Style | Default | Description |\n|-------|---------|-------------|\n| `block` | ON | Full-width background box with `›` prompt, adapts to terminal theme |\n| `bordered` | | Horizontal `─` lines above and below input |\n| `plain` | | Simple `> ` readline prompt, no escape sequences |\n| Other | | User describes what they want — implement a custom input style |\n\n**Tool display** — how tool calls appear during execution. See [references\u002Ftool-display.md](references\u002Ftool-display.md):\n\n| Style | Default | Description |\n|-------|---------|-------------|\n| `grouped` | ON | Bold action labels with tree-branch output |\n| `emoji` | | Per-call `⚡`\u002F`✓` markers with args and timing |\n| `minimal` | | Aggregated one-liner summaries |\n| `hidden` | | No tool output |\n| Other | | User describes what they want — implement a custom display |\n\n**Loader animation** — shown while waiting for model response. See [references\u002Floader.md](references\u002Floader.md):\n\n| Style | Default | Description |\n|-------|---------|-------------|\n| `spinner` | ON | Braille dot spinner (⠋⠙⠹…) to the left of the text |\n| `gradient` | | Scrolling color shimmer over the loader text |\n| `minimal` | | Trailing dots (`Working···`) |\n| Other | | User describes what they want — implement a custom animation |\n\nAlso ask for the **loader text** (default: `\"Working\"`).\n\n---\n\n## Generation Workflow\n\nAfter getting checklist selections, follow this workflow:\n\n```\n- [ ] Generate package.json with dependencies\n- [ ] Generate src\u002Fconfig.ts (add showBanner field if ASCII Logo Banner is ON)\n- [ ] Generate src\u002Ftools\u002Findex.ts wiring selected tools + server tools\n- [ ] Generate selected tool files in src\u002Ftools\u002F (see Tool Pattern below, specs in references\u002Ftools.md)\n- [ ] Generate src\u002Fagent.ts (core runner)\n- [ ] Generate selected harness modules (specs in references\u002Fmodules.md)\n- [ ] Generate src\u002Fterminal-bg.ts (adaptive input background — see references\u002Ftui.md)\n- [ ] Generate input style functions in src\u002Fcli.ts (block\u002Fbordered\u002Fplain — see references\u002Finput-styles.md)\n- [ ] Generate src\u002Frenderer.ts (tool display — see references\u002Ftool-display.md)\n- [ ] Generate src\u002Floader.ts (loader animation — see references\u002Floader.md)\n- [ ] If slash commands selected: generate src\u002Fcommands.ts (see references\u002Fslash-commands.md)\n- [ ] If ASCII Logo Banner is ON: generate src\u002Fbanner.ts (see ASCII Logo Banner section below)\n- [ ] Generate src\u002Fcli.ts entry point (or src\u002Fserver.ts — see references\u002Fserver-entry-points.md)\n- [ ] Generate .env.example with OPENROUTER_API_KEY=\n- [ ] Verify: run npx tsc --noEmit to check types\n```\n\n---\n\n## Tool Pattern\n\nAll user-defined tools follow this pattern using `@openrouter\u002Fagent\u002Ftool`. Here is one complete example — all other tools in [references\u002Ftools.md](references\u002Ftools.md) follow the same shape:\n\n```typescript\nimport { tool } from '@openrouter\u002Fagent\u002Ftool';\nimport { z } from 'zod';\nimport { readFile, stat } from 'fs\u002Fpromises';\n\nexport const fileReadTool = tool({\n  name: 'file_read',\n  description: 'Read the contents of a file at the given path',\n  inputSchema: z.object({\n    path: z.string().describe('Absolute path to the file'),\n    offset: z.number().optional().describe('Start reading from this line (1-indexed)'),\n    limit: z.number().optional().describe('Maximum number of lines to return'),\n  }),\n  execute: async ({ path, offset, limit }) => {\n    try {\n      const content = await readFile(path, 'utf-8');\n      const lines = content.split('\\n');\n\n      const start = offset ? offset - 1 : 0;\n      const end = limit ? start + limit : lines.length;\n      const slice = lines.slice(start, end);\n\n      return {\n        content: slice.join('\\n'),\n        totalLines: lines.length,\n        ...(end \u003C lines.length && { truncated: true, nextOffset: end + 1 }),\n      };\n    } catch (err: any) {\n      if (err.code === 'ENOENT') return { error: `File not found: ${path}` };\n      if (err.code === 'EACCES') return { error: `Permission denied: ${path}` };\n      return { error: err.message };\n    }\n  },\n});\n```\n\nFor specs of all other tools, see [references\u002Ftools.md](references\u002Ftools.md).\n\n---\n\n## Core Files\n\nThese files are always generated. The agent adapts them based on checklist selections.\n\n### package.json\n\nInitialize the project and install dependencies at their latest versions:\n\n```bash\nnpm init -y\nnpm pkg set type=module\nnpm pkg set scripts.start=\"tsx src\u002Fcli.ts\"\nnpm pkg set scripts.dev=\"tsx watch src\u002Fcli.ts\"\nnpm install @openrouter\u002Fagent glob zod\nnpm install -D tsx typescript @types\u002Fnode\n```\n\n### tsconfig.json\n\n```json\n{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"module\": \"Node16\",\n    \"moduleResolution\": \"Node16\",\n    \"outDir\": \"dist\",\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"skipLibCheck\": true\n  },\n  \"include\": [\"src\"]\n}\n```\n\n### src\u002Fconfig.ts\n\n```typescript\nimport { readFileSync, existsSync } from 'fs';\nimport { resolve } from 'path';\n\nexport interface DisplayConfig {\n  toolDisplay: 'emoji' | 'grouped' | 'minimal' | 'hidden';\n  reasoning: boolean;\n  inputStyle: 'block' | 'bordered' | 'plain';\n}\n\nexport interface AgentConfig {\n  apiKey: string;\n  model: string;\n  systemPrompt: string;\n  maxSteps: number;\n  maxCost: number;\n  sessionDir: string;\n  showBanner: boolean;\n  display: DisplayConfig;\n  slashCommands: boolean;\n}\n\nconst DEFAULTS: AgentConfig = {\n  apiKey: '',\n  model: 'anthropic\u002Fclaude-opus-4.7',\n  systemPrompt: [\n    'You are a coding assistant with access to tools for reading, writing, editing, and searching files, and running shell commands.',\n    '',\n    'Current working directory: {cwd}',\n    '',\n    'Guidelines:',\n    '- Use your tools proactively. Explore the codebase to find answers instead of asking the user.',\n    '- Keep working until the task is fully resolved before responding.',\n    '- Do not guess or make up information — use your tools to verify.',\n    '- Be concise and direct.',\n    '- Show file paths clearly when working with files.',\n    '- Prefer grep and glob tools over shell commands for file search.',\n    '- When editing code, make minimal targeted changes consistent with the existing style.',\n  ].join('\\n'),\n  maxSteps: 20,\n  maxCost: 1.0,\n  sessionDir: '.sessions',\n  showBanner: false,\n  display: { toolDisplay: 'grouped', reasoning: false, inputStyle: 'block' },\n  slashCommands: true,\n};\n\nexport function loadConfig(overrides: Partial\u003CAgentConfig> = {}): AgentConfig {\n  let config = { ...DEFAULTS };\n\n  const configPath = resolve('agent.config.json');\n  if (existsSync(configPath)) {\n    const file = JSON.parse(readFileSync(configPath, 'utf-8'));\n    if (file.display) {\n      config.display = { ...config.display, ...file.display };\n    }\n    config = { ...config, ...file, display: config.display };\n  }\n\n  if (process.env.OPENROUTER_API_KEY) config.apiKey = process.env.OPENROUTER_API_KEY;\n  if (process.env.AGENT_MODEL) config.model = process.env.AGENT_MODEL;\n  if (process.env.AGENT_MAX_STEPS) config.maxSteps = Number(process.env.AGENT_MAX_STEPS);\n  if (process.env.AGENT_MAX_COST) config.maxCost = Number(process.env.AGENT_MAX_COST);\n\n  if (overrides.display) {\n    config.display = { ...config.display, ...overrides.display };\n  }\n  config = { ...config, ...overrides, display: config.display };\n  if (!config.apiKey) throw new Error('OPENROUTER_API_KEY is required.');\n  return config;\n}\n```\n\n### src\u002Ftools\u002Findex.ts\n\nAdapt imports based on checklist selections. This example includes all default-ON tools:\n\n```typescript\nimport { serverTool } from '@openrouter\u002Fagent';\nimport { fileReadTool } from '.\u002Ffile-read.js';\nimport { fileWriteTool } from '.\u002Ffile-write.js';\nimport { fileEditTool } from '.\u002Ffile-edit.js';\nimport { globTool } from '.\u002Fglob.js';\nimport { grepTool } from '.\u002Fgrep.js';\nimport { listDirTool } from '.\u002Flist-dir.js';\nimport { shellTool } from '.\u002Fshell.js';\n\nexport const tools = [\n  \u002F\u002F User-defined tools — executed client-side\n  fileReadTool,\n  fileWriteTool,\n  fileEditTool,\n  globTool,\n  grepTool,\n  listDirTool,\n  shellTool,\n\n  \u002F\u002F Server tools — executed by OpenRouter, no client implementation needed\n  serverTool({ type: 'openrouter:web_search' }),\n  serverTool({ type: 'openrouter:datetime', parameters: { timezone: 'UTC' } }),\n];\n```\n\n### src\u002Fagent.ts\n\n```typescript\nimport { OpenRouter } from '@openrouter\u002Fagent';\nimport type { Item } from '@openrouter\u002Fagent';\nimport { stepCountIs, maxCost } from '@openrouter\u002Fagent\u002Fstop-conditions';\nimport type { AgentConfig } from '.\u002Fconfig.js';\nimport { tools } from '.\u002Ftools\u002Findex.js';\n\nexport type ChatMessage = { role: 'user' | 'assistant' | 'system'; content: string };\n\nexport type AgentEvent =\n  | { type: 'text'; delta: string }\n  | { type: 'tool_call'; name: string; callId: string; args: Record\u003Cstring, unknown> }\n  | { type: 'tool_result'; name: string; callId: string; output: string }\n  | { type: 'reasoning'; delta: string };\n\nexport async function runAgent(\n  config: AgentConfig,\n  input: string | ChatMessage[],\n  options?: { onEvent?: (event: AgentEvent) => void; signal?: AbortSignal },\n) {\n  const client = new OpenRouter({ apiKey: config.apiKey });\n\n  const result = client.callModel({\n    model: config.model,\n    instructions: config.systemPrompt.replace('{cwd}', process.cwd()),\n    input: input as string | Item[],\n    tools,\n    stopWhen: [stepCountIs(config.maxSteps), maxCost(config.maxCost)],\n  });\n\n  if (options?.onEvent) {\n    let lastTextLen = 0;\n    const callNames = new Map\u003Cstring, string>();\n\n    for await (const item of result.getItemsStream()) {\n      if (options?.signal?.aborted) break;\n      if (item.type === 'message') {\n        const text = item.content\n          ?.filter((c): c is { type: 'output_text'; text: string } => 'text' in c)\n          .map((c) => c.text)\n          .join('') ?? '';\n        if (text.length > lastTextLen) {\n          options.onEvent({ type: 'text', delta: text.slice(lastTextLen) });\n          lastTextLen = text.length;\n        }\n      } else if (item.type === 'function_call') {\n        callNames.set(item.callId, item.name);\n        if (item.status === 'completed') {\n          const args = (() => { try { return item.arguments ? JSON.parse(item.arguments) : {}; } catch { return {}; } })();\n          options.onEvent({ type: 'tool_call', name: item.name, callId: item.callId, args });\n        }\n      } else if (item.type === 'function_call_output') {\n        const out = typeof item.output === 'string' ? item.output : JSON.stringify(item.output);\n        options.onEvent({\n          type: 'tool_result',\n          name: callNames.get(item.callId) ?? 'unknown',\n          callId: item.callId,\n          output: out.length > 200 ? out.slice(0, 200) + '…' : out,\n        });\n      } else if (item.type === 'reasoning') {\n        const text = item.summary?.map((s: { text: string }) => s.text).join('') ?? '';\n        if (text) options.onEvent({ type: 'reasoning', delta: text });\n      }\n    }\n  }\n\n  const response = await result.getResponse();\n  return { text: response.outputText ?? '', usage: response.usage, output: response.output };\n}\n\nexport async function runAgentWithRetry(\n  config: AgentConfig,\n  input: string | ChatMessage[],\n  options?: { onEvent?: (event: AgentEvent) => void; signal?: AbortSignal; maxRetries?: number },\n) {\n  for (let attempt = 0, max = options?.maxRetries ?? 3; attempt \u003C= max; attempt++) {\n    try { return await runAgent(config, input, options); }\n    catch (err: any) {\n      const s = err?.status ?? err?.statusCode;\n      if (!(s === 429 || (s >= 500 && s \u003C 600)) || attempt === max) throw err;\n      await new Promise((r) => setTimeout(r, Math.min(1000 * 2 ** attempt, 30000)));\n    }\n  }\n  throw new Error('Unreachable');\n}\n```\n\n### src\u002Fcli.ts\n\nThree input styles are supported: `block` (background box), `bordered` (horizontal lines), and `plain` (simple caret). See [references\u002Finput-styles.md](references\u002Finput-styles.md) for full implementations of `styledReadLine()`, `borderedReadLine()`, and the `getInput()` dispatcher.\n\n```typescript\nimport { createInterface } from 'readline';\nimport { loadConfig } from '.\u002Fconfig.js';\nimport { runAgentWithRetry, type AgentEvent } from '.\u002Fagent.js';\nimport { detectBg } from '.\u002Fterminal-bg.js';\n\u002F\u002F import { styledReadLine, borderedReadLine } from ... — see references\u002Finput-styles.md\n\nconst DIM = '\\x1b[2m';\nconst RESET = '\\x1b[0m';\nconst BOLD = '\\x1b[1m';\nconst CYAN = '\\x1b[36m';\nconst GREEN = '\\x1b[32m';\nconst YELLOW = '\\x1b[33m';\nconst GRAY = '\\x1b[90m';\n\nfunction formatTokens(n: number): string {\n  return n >= 1000 ? `${(n \u002F 1000).toFixed(1)}k` : String(n);\n}\n\nfunction summarizeArgs(name: string, args: Record\u003Cstring, unknown>): string {\n  const key = { shell: 'command', file_read: 'path', file_write: 'path',\n    file_edit: 'path', glob: 'pattern', grep: 'pattern', web_search: 'query',\n  }[name] ?? Object.keys(args)[0];\n  if (!key || !(key in args)) return '';\n  const val = String(args[key]);\n  return `${key}=${val.length > 40 ? val.slice(0, 40) + '…' : val}`;\n}\n\nasync function main() {\n  const config = loadConfig();\n  const BG_INPUT = config.display.inputStyle === 'block' ? await detectBg() : '';\n\n  \u002F\u002F Banner\n  const width = Math.min(process.stdout.columns || 60, 60);\n  const line = GRAY + '─'.repeat(width) + RESET;\n  console.log(`\\n${line}`);\n  console.log(`  ${BOLD}My Agent${RESET}  ${DIM}v0.1.0${RESET}`);\n  console.log(`  ${DIM}model${RESET}  ${CYAN}${config.model}${RESET}`);\n  if (config.slashCommands) console.log(`  ${DIM}\u002Fmodel to change${RESET}`);\n  console.log(`${line}\\n`);\n\n  const rl = createInterface({ input: process.stdin, output: process.stdout, prompt: `${GREEN}>${RESET} ` });\n\n  async function getInput(): Promise\u003Cstring> {\n    switch (config.display.inputStyle) {\n      case 'block': return styledReadLine(BG_INPUT);\n      case 'bordered': return borderedReadLine();\n      case 'plain':\n      default:\n        return new Promise((r) => { rl.prompt(); rl.once('line', r); });\n    }\n  }\n\n  while (true) {\n    const input = await getInput();\n    const trimmed = input.trim();\n    if (!trimmed) continue;\n\n    if (config.display.inputStyle !== 'plain') {\n      const cwd = process.cwd().replace(process.env.HOME ?? '', '~');\n      process.stdout.write(`\\x1b[K  ${DIM}${cwd}${RESET}\\n`);\n    }\n\n    if (trimmed.toLowerCase() === 'exit') { process.exit(0); }\n\n    console.log();\n    let streaming = false, started = false;\n    const toolStart = new Map\u003Cstring, number>();\n    const dots = ['·', '··', '···'];\n    let di = 0;\n    const spin = setInterval(() => {\n      if (!started) process.stdout.write(`\\r${DIM}${dots[di++ % 3]}${RESET}`);\n    }, 300);\n\n    const handleEvent = (event: AgentEvent) => {\n      if (!started) { started = true; process.stdout.write('\\r\\x1b[K'); }\n      if (event.type === 'text') { streaming = true; process.stdout.write(event.delta); }\n      else if (event.type === 'tool_call') {\n        if (streaming) { process.stdout.write('\\n'); streaming = false; }\n        toolStart.set(event.callId, Date.now());\n        const args = summarizeArgs(event.name, event.args);\n        console.log(`  ${YELLOW}⚡${RESET} ${DIM}${event.name}${args ? ' ' + args : ''}${RESET}`);\n      } else if (event.type === 'tool_result') {\n        const ms = Date.now() - (toolStart.get(event.callId) ?? Date.now());\n        console.log(`  ${GREEN}✓${RESET} ${DIM}${event.name} (${(ms \u002F 1000).toFixed(1)}s)${RESET}`);\n        started = false;\n      }\n    };\n\n    try {\n      const result = await runAgentWithRetry(config, trimmed, { onEvent: handleEvent });\n      clearInterval(spin);\n      if (streaming) process.stdout.write(RESET);\n      const inT = result.usage?.inputTokens ?? 0;\n      const outT = result.usage?.outputTokens ?? 0;\n      console.log(`\\n${GRAY}  ${formatTokens(inT)} in · ${formatTokens(outT)} out${RESET}\\n`);\n    } catch (err: any) {\n      clearInterval(spin);\n      if (streaming) process.stdout.write(RESET);\n      console.log(`\\n${YELLOW}  Error: ${err.message}${RESET}\\n`);\n    }\n  }\n}\n\nmain();\n```\n\n---\n\n## ASCII Logo Banner\n\nWhen `ASCII Logo Banner` is selected, ask the user for their project name, then generate `src\u002Fbanner.ts` with ASCII art of that name. Use a block-letter style with the `█` character for the art. The banner should fit in a 60-column terminal.\n\n### src\u002Fbanner.ts\n\nGenerate ASCII art for the user's project name. Example for a project called \"ACME\":\n\n```typescript\nconst RESET = '\\x1b[0m';\nconst BOLD = '\\x1b[1m';\nconst DIM = '\\x1b[2m';\nconst CYAN = '\\x1b[36m';\n\nconst LOGO = `\n   █████╗  ██████╗███╗   ███╗███████╗\n  ██╔══██╗██╔════╝████╗ ████║██╔════╝\n  ███████║██║     ██╔████╔██║█████╗\n  ██╔══██║██║     ██║╚██╔╝██║██╔══╝\n  ██║  ██║╚██████╗██║ ╚═╝ ██║███████╗\n  ╚═╝  ╚═╝ ╚═════╝╚═╝     ╚═╝╚══════╝`;\n\nexport function printBanner(model: string): void {\n  console.log(CYAN + BOLD + LOGO + RESET);\n  console.log(`  ${DIM}model  ${RESET}${model}\\n`);\n}\n```\n\nAdapt the ASCII art to the user's actual project name. Keep it to one or two short words that fit in 60 columns.\n\n### Wire into src\u002Fcli.ts\n\nAdd at the top of `main()`, before the text banner, when `showBanner` is selected:\n\n```typescript\nimport { printBanner } from '.\u002Fbanner.js';\n\n\u002F\u002F In main(), replace the text banner with:\nif (config.showBanner) {\n  printBanner(config.model);\n} else {\n  \u002F\u002F fall back to the text banner from the cli.ts template above\n}\n```\n\nAdd `showBanner: boolean` to `AgentConfig` (default `false`). Enable via `agent.config.json` or `loadConfig({ showBanner: true })`.\n\n---\n\n## Reference Files\n\nFor content beyond the core files:\n\n- **[references\u002Ftools.md](references\u002Ftools.md)** — Specs for all user-defined tools: file-read, file-write, file-edit, glob, grep, list-dir, shell, js-repl, sub-agent, plan, request-input, web-fetch, view-image, custom template\n- **[references\u002Fmodules.md](references\u002Fmodules.md)** — Harness modules: session persistence, context compaction, system prompt composition, tool approval, structured logging\n- **[references\u002Ftui.md](references\u002Ftui.md)** — Terminal background detection, adaptive input background\n- **[references\u002Ftool-display.md](references\u002Ftool-display.md)** — Tool display styles: emoji, grouped, minimal; TuiRenderer class, per-tool colors, formatters\n- **[references\u002Finput-styles.md](references\u002Finput-styles.md)** — Input styles: block (background box), bordered (horizontal lines), plain (simple caret)\n- **[references\u002Floader.md](references\u002Floader.md)** — Loader animations: gradient (scrolling shimmer), spinner (braille dots), minimal (trailing dots)\n- **[references\u002Fslash-commands.md](references\u002Fslash-commands.md)** — Slash command registry: \u002Fmodel, \u002Fnew, \u002Fhelp, \u002Fcompact, \u002Fsession, \u002Fexport\n- **[references\u002Fsystem-prompt.md](references\u002Fsystem-prompt.md)** — Default system prompt, buildSystemPrompt(), customization guide\n- **[references\u002Fserver-entry-points.md](references\u002Fserver-entry-points.md)** — Express\u002FHono API server entry point with SSE streaming, plus extension points (MCP, WebSocket, dynamic models)\n",{"name":5,"description":7},"main","be3de0244dc1a57e323d8160787ebb40fb64930e","skills\u002Fcreate-agent-tui","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main","https:\u002F\u002Fskills.x402.wtf","https:\u002F\u002Fgithub.com\u002FSolizardking","https:\u002F\u002Fmusebook.trade","Got a mile high and never came down","2026-10-08 23:20:13",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add Solizardking\u002Fskillhub-main --skill create-agent-tui",{"tool":39,"command":40},"bunx","bunx skills add Solizardking\u002Fskillhub-main --skill create-agent-tui",{"tool":42,"command":43},"pnpm","pnpm dlx skills add Solizardking\u002Fskillhub-main --skill create-agent-tui","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002FSKILL.md",true,[47,53,57,61,65,69,73,77,81,85,89,93,99,103,107,113,117,121,125,129,133,137,141,145,149,155,159,163,167,171,175,179,183,187,191,195,199,203,207,211,215,219,223,227,231],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"metadata.json","REFERENCE","参考文档",571,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fmetadata.json",{"path":54,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":55,"sourceHtmlUrl":56},"README.md",9041,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002FREADME.md",{"path":58,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":59,"sourceHtmlUrl":60},"references\u002Finput-styles.md",7898,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Freferences\u002Finput-styles.md",{"path":62,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":63,"sourceHtmlUrl":64},"references\u002Floader.md",3807,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Freferences\u002Floader.md",{"path":66,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Fmodules.md",13151,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Freferences\u002Fmodules.md",{"path":70,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Fserver-entry-points.md",6244,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Freferences\u002Fserver-entry-points.md",{"path":74,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Fslash-commands.md",6527,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Freferences\u002Fslash-commands.md",{"path":78,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":79,"sourceHtmlUrl":80},"references\u002Fsystem-prompt.md",3308,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Freferences\u002Fsystem-prompt.md",{"path":82,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":83,"sourceHtmlUrl":84},"references\u002Ftool-display.md",9981,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Freferences\u002Ftool-display.md",{"path":86,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Ftools.md",7086,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Freferences\u002Ftools.md",{"path":90,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":91,"sourceHtmlUrl":92},"references\u002Ftui.md",3838,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Freferences\u002Ftui.md",{"path":94,"resourceType":95,"resourceTypeDesc":96,"sizeBytes":97,"sourceHtmlUrl":98},"sample\u002F.gitignore","OTHER","其他",51,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002F.gitignore",{"path":100,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":101,"sourceHtmlUrl":102},"sample\u002Fpackage-lock.json",11424,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fpackage-lock.json",{"path":104,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":105,"sourceHtmlUrl":106},"sample\u002Fpackage.json",595,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fpackage.json",{"path":108,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":111,"sourceHtmlUrl":112},"sample\u002Fscreenshots\u002Fbanner.png","ASSET","资产文件",16058,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fscreenshots\u002Fbanner.png",{"path":114,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":115,"sourceHtmlUrl":116},"sample\u002Fscreenshots\u002Finput-style-block.png",15799,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fscreenshots\u002Finput-style-block.png",{"path":118,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":119,"sourceHtmlUrl":120},"sample\u002Fscreenshots\u002Finput-style-bordered.png",15817,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fscreenshots\u002Finput-style-bordered.png",{"path":122,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":123,"sourceHtmlUrl":124},"sample\u002Fscreenshots\u002Finput-style-plain.png",15907,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fscreenshots\u002Finput-style-plain.png",{"path":126,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":127,"sourceHtmlUrl":128},"sample\u002Fscreenshots\u002Floader-gradient.png",26635,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fscreenshots\u002Floader-gradient.png",{"path":130,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":131,"sourceHtmlUrl":132},"sample\u002Fscreenshots\u002Floader-minimal.png",26601,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fscreenshots\u002Floader-minimal.png",{"path":134,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":135,"sourceHtmlUrl":136},"sample\u002Fscreenshots\u002Floader-spinner.png",26620,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fscreenshots\u002Floader-spinner.png",{"path":138,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":139,"sourceHtmlUrl":140},"sample\u002Fscreenshots\u002Ftool-display-emoji.png",66241,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fscreenshots\u002Ftool-display-emoji.png",{"path":142,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":143,"sourceHtmlUrl":144},"sample\u002Fscreenshots\u002Ftool-display-grouped.png",64468,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fscreenshots\u002Ftool-display-grouped.png",{"path":146,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":147,"sourceHtmlUrl":148},"sample\u002Fscreenshots\u002Ftool-display-minimal.png",62522,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fscreenshots\u002Ftool-display-minimal.png",{"path":150,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":153,"sourceHtmlUrl":154},"sample\u002Fsrc\u002Fagent.ts","SCRIPT","脚本",3417,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Fagent.ts",{"path":156,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":157,"sourceHtmlUrl":158},"sample\u002Fsrc\u002Fbanner.ts",1567,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Fbanner.ts",{"path":160,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":161,"sourceHtmlUrl":162},"sample\u002Fsrc\u002Fcli.ts",12043,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Fcli.ts",{"path":164,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":165,"sourceHtmlUrl":166},"sample\u002Fsrc\u002Fcommands.ts",2981,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Fcommands.ts",{"path":168,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":169,"sourceHtmlUrl":170},"sample\u002Fsrc\u002Fconfig.ts",2779,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Fconfig.ts",{"path":172,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":173,"sourceHtmlUrl":174},"sample\u002Fsrc\u002Floader.ts",1713,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Floader.ts",{"path":176,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":177,"sourceHtmlUrl":178},"sample\u002Fsrc\u002Frenderer.ts",7982,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Frenderer.ts",{"path":180,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":181,"sourceHtmlUrl":182},"sample\u002Fsrc\u002Fscreenshot-demos.ts",2055,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Fscreenshot-demos.ts",{"path":184,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":185,"sourceHtmlUrl":186},"sample\u002Fsrc\u002Fsession.ts",1337,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Fsession.ts",{"path":188,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":189,"sourceHtmlUrl":190},"sample\u002Fsrc\u002Fterminal-bg.ts",2198,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Fterminal-bg.ts",{"path":192,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":193,"sourceHtmlUrl":194},"sample\u002Fsrc\u002Ftools\u002Fcustom.ts",344,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Ftools\u002Fcustom.ts",{"path":196,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":197,"sourceHtmlUrl":198},"sample\u002Fsrc\u002Ftools\u002Ffile-edit.ts",1628,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Ftools\u002Ffile-edit.ts",{"path":200,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":201,"sourceHtmlUrl":202},"sample\u002Fsrc\u002Ftools\u002Ffile-read.ts",1199,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Ftools\u002Ffile-read.ts",{"path":204,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":205,"sourceHtmlUrl":206},"sample\u002Fsrc\u002Ftools\u002Ffile-write.ts",714,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Ftools\u002Ffile-write.ts",{"path":208,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":209,"sourceHtmlUrl":210},"sample\u002Fsrc\u002Ftools\u002Fglob.ts",846,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Ftools\u002Fglob.ts",{"path":212,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":213,"sourceHtmlUrl":214},"sample\u002Fsrc\u002Ftools\u002Fgrep.ts",1623,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Ftools\u002Fgrep.ts",{"path":216,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":217,"sourceHtmlUrl":218},"sample\u002Fsrc\u002Ftools\u002Findex.ts",610,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Ftools\u002Findex.ts",{"path":220,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":221,"sourceHtmlUrl":222},"sample\u002Fsrc\u002Ftools\u002Flist-dir.ts",770,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Ftools\u002Flist-dir.ts",{"path":224,"resourceType":151,"resourceTypeDesc":152,"sizeBytes":225,"sourceHtmlUrl":226},"sample\u002Fsrc\u002Ftools\u002Fshell.ts",1353,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Fsrc\u002Ftools\u002Fshell.ts",{"path":228,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":229,"sourceHtmlUrl":230},"sample\u002Ftest-tui.md",4470,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Ftest-tui.md",{"path":232,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":233,"sourceHtmlUrl":234},"sample\u002Ftsconfig.json",254,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fcreate-agent-tui\u002Fsample\u002Ftsconfig.json",[236,243,250,257,264,272],{"skillNo":237,"name":238,"nameZh":6,"description":239,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":240,"categories":241,"keywords":242,"publishedAt":19},"01M78E0TGCAMNPS207BA3G07S7","zkrouter","Self-hosted OpenAI-compatible LLM router — smart tier-based routing, ZK-stamped routing decisions, mode overrides, free OpenRouter at install via the Birth bot. Save 60-80% on inference costs by routing to the cheapest capable model across 12+ OpenRouter models.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzkrouter\u002FSKILL.md",[],[],{"skillNo":244,"name":245,"nameZh":6,"description":246,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":247,"categories":248,"keywords":249,"publishedAt":19},"01M78E0R1Z8BDT6EDTHY17MTNB","zk","For custom ZK Solana programs and privacy-preserving applications to prevent double spending. Guide to integrate rent-free nullifier PDAs for double-spend prevention.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzk\u002FSKILL.md",[],[],{"skillNo":251,"name":252,"nameZh":6,"description":253,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":254,"categories":255,"keywords":256,"publishedAt":19},"01M78E0P3ZTZ1YWF8MD5MM23QE","zk-omni-messaging","Zero-knowledge omnichain messaging between Robinhood Chain and Solana using CheshireZkOmniMessenger (msgType 4) with nullifier anti-replay and the zk-omni-relayer service.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzk-omni-messaging\u002FSKILL.md",[],[],{"skillNo":258,"name":259,"nameZh":6,"description":260,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":261,"categories":262,"keywords":263,"publishedAt":19},"01M78E0JXZ2PNB1896VXAGDBWD","zerion-wallet-data","Use when the user asks to check a wallet's portfolio, token balances, DeFi positions, PnL, transaction history, or NFTs. Provides interpreted on-chain data across 40+ EVM chains and Solana via x402 pay-per-request or API key — no raw RPC decoding needed.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzerion-wallet-data\u002FSKILL.md",[],[],{"skillNo":265,"name":266,"nameZh":6,"description":267,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":268,"sourceHtmlUrl":269,"categories":270,"keywords":271,"publishedAt":19},"01M78E0G14FH9GRRTQYMKD5E59","youtube-clipper","YouTube 视频智能剪辑工具。下载视频和字幕，AI 分析生成精细章节（几分钟级别）， 用户选择片段后自动剪辑、翻译字幕为中英双语、烧录字幕到视频，并生成总结文案。 使用场景：当用户需要剪辑 YouTube 视频、生成短视频片段、制作双语字幕版本时。 关键词：视频剪辑、YouTube、字幕翻译、双语字幕、视频下载、clip video","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube-clipper\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube-clipper\u002FSKILL.md",[],[],{"skillNo":273,"name":274,"nameZh":6,"description":275,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":276,"categories":277,"keywords":278,"publishedAt":19},"01M78E0C2ZYA99CFFDNB7ZMK5S","yield-optimization","Multi-chain yield optimization via yield.xyz (StakeKit). Discover 2,988+ yield opportunities across 75+ blockchains, build deposit\u002Fwithdrawal transactions with shell scripts, and sign them with a MoonPay wallet. Use when the user wants to earn yield, find the best lending or staking rate, enter\u002Fexit a position, or check portfolio balances.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fyield-optimization\u002FSKILL.md",[],[]]