Skill: dandysuper/openclaw-kirocli-coding-agent (version 1.5.0)

--- name: coding-agent description: Run Codex CLI, Claude Code, Kiro CLI, OpenCode, or Pi Coding Agent via background process for programmatic control. metadata: { "openclaw": { "emoji": "🧩", "requires": { "anyBins": ["claude", "codex", "opencode", "pi", "kiro-cli"] } }, } --- # Coding Agent Launch and manage AI coding agents (Codex, Claude Code, Kiro CLI, OpenCode, Pi) from OpenClaw using bash with background process control. ## PTY Mode Required Coding agents are **interactive terminal applications** that need a pseudo-terminal (PTY). Without it, output breaks or the agent hangs. **Always set `pty:true`:** ```bash # Correct — with PTY bash pty:true command:"codex exec 'Your prompt'" # Wrong — agent may break or hang bash command:"codex exec 'Your prompt'" ``` ## Tool Reference ### Bash Parameters | Parameter | Type | Description | | ------------ | ------- | ----------------------------------------------------------- | | `command` | string | Shell command to run | | `pty` | boolean | Allocate a pseudo-terminal (**required for coding agents**) | | `workdir` | string | Working directory (agent sees only this folder) | | `background` | boolean | Run in background; returns `sessionId` for monitoring | | `timeout` | number | Timeout in seconds (kills process on expiry) | | `elevated` | boolean | Run on host instead of sandbox (if allowed) | ### Process Actions (background sessions) | Action | Description | | ----------- | ---------------------------------------------------- | | `list` | List all running/recent sessions | | `poll` | Check if a session is still running | | `log` | Get session output (optional offset/limit) | | `write` | Send raw data to stdin (no newline) | | `submit` | Send data + newline (like typing and pressing Enter) | | `send-keys` | Send key tokens or hex bytes | | `paste` | Paste text (optional bracketed mode) | | `kill` | Terminate the session | --- ## Quick Start: One-Shot Tasks ```bash # Codex needs a git repo — create a temp one for scratch work SCRATCH=$(mktemp -d) && cd $SCRATCH && git init && codex exec "Your prompt" # Run inside an existing project (with PTY) bash pty:true workdir:~/project command:"codex exec 'Add error handling to the API calls'" ``` --- ## Core Pattern: workdir + background + pty For longer tasks, combine all three: ```bash # 1. Start the agent bash pty:true workdir:~/project background:true command:"codex exec --full-auto 'Build a snake game'" # → returns sessionId # 2. Monitor progress process action:log sessionId:XXX # 3. Check completion process action:poll sessionId:XXX # 4. Send input if the agent asks a question process action:submit sessionId:XXX data:"yes" # text + Enter process action:write sessionId:XXX data:"y" # raw keystroke # 5. Kill if stuck process action:kill sessionId:XXX ``` **Why `workdir`?** The agent starts in a focused directory and won't wander into unrelated files. --- ## Codex CLI **Default model:** `gpt-5.2-codex` (set in `~/.codex/config.toml`) ### Flags | Flag | Effect | | --------------- | -------------------------------------------------- | | `exec "prompt"` | One-shot execution, exits when done | | `--full-auto` | Sandboxed, auto-approves within workspace | | `--yolo` | No sandbox, no approvals (fastest, most dangerous) | ### Building / Creating ```bash # One-shot with auto-approve bash pty:true workdir:~/project command:"codex exec --full-auto 'Build a dark mode toggle'" # Background for longer work bash pty:true workdir:~/project background:true command:"codex --yolo 'Refactor the auth module'" ``` ### Reviewing PRs **Never review PRs in OpenClaw's own project folder.** Clone to a temp directory or use a git worktree. ```bash # Clone to temp REVIEW_DIR=$(mktemp -d) git clone https://github.com/user/repo.git $REVIEW_DIR cd $REVIEW_DIR && gh pr checkout 130 bash pty:true workdir:$REVIEW_DIR command:"codex review --base origin/main" # Or use git worktree (keeps main intact) git worktree add /tmp/pr-130-review pr-130-branch bash pty:true workdir:/tmp/pr-130-review command:"codex review --base main" ``` ### Batch PR Reviews ```bash # Fetch all PR refs git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*' # Launch one Codex per PR (all background + PTY) bash pty:true workdir:~/project background:true command:"codex exec 'Review PR #86. git diff origin/main...origin/pr/86'" bash pty:true workdir:~/project background:true command:"codex exec 'Review PR #87. git diff origin/main...origin/pr/87'" # Monitor process action:list # Post results gh pr comment <PR#> --body "<review content>" ``` --- ## Claude Code ```bash # One-shot bash pty:true workdir:~/project command:"claude 'Your task'" # Background bash pty:true workdir:~/project background:true command:"claude 'Your task'" ``` --- ## Kiro CLI (AWS) AWS AI coding assistant with session persistence, custom agents, skills, hooks, steering, subagents, planning mode, and MCP integration. **Install:** https://kiro.dev/docs/cli/installation ### Basic Usage ```bash kiro-cli # Interactive chat (default) kiro-cli chat "Your question" # Direct question kiro-cli --agent my-agent # Use a specific agent kiro-cli chat --resume # Resume last session (per-directory) kiro-cli chat --resume-picker # Pick from saved sessions kiro-cli chat --list-sessions # List all sessions ``` ### Non-Interactive Mode For scripting and automation — outputs a single response to STDOUT, then exits. ```bash # Single response kiro-cli chat --no-interactive "Show current directory" # Trust all tools (no confirmation prompts) kiro-cli chat --no-interactive --trust-all-tools "Create hello.py" # Trust specific tools only kiro-cli chat --no-interactive --trust-tools "fs_read,fs_write" "Read package.json" ``` **Tool trust:** `--trust-all-tools` for full automation. For untrusted input, use `--trust-tools "fs_read,fs_write,shell"` to limit scope. ### OpenClaw Integration ```bash # Interactive session (background) bash pty:true workdir:~/project background:true command:"kiro-cli" # One-shot query (non-interactive) bash pty:true workdir:~/project command:"kiro-cli chat --no-interactive --trust-all-tools 'List all TODO comments in src/'" # With a specific agent bash pty:true workdir:~/project background:true command:"kiro-cli --agent aws-expert 'Set up Lambda'" # Resume previous session bash pty:true workdir:~/project command:"kiro-cli chat --resume" ``` ### Skills (Agent Skills) Skills are **portable instruction packages** that extend what Kiro knows. When a request matches a skill's description, Kiro automatically loads and follows its instructions — no slash command needed. #### Skill Locations | Location | Scope | Notes | | --- | --- | --- | | `.kiro/skills/<name>/` | Workspace (project) | Shared via version control | | `~/.kiro/skills/<name>/` | Global (all projects) | Personal workflows | Workspace skills take priority when names collide. #### Creating a Skill A skill is a folder with a `SKILL.md` file: ``` my-skill/ ├── SKILL.md # Required — frontmatter + instructions └── references/ # Optional — detailed docs loaded on demand └── guide.md ``` **SKILL.md format:** ````markdown --- name: pr-review description: Review pull requests for code quality, security issues, and test coverage. --- ## Review checklist 1. Check for vulnerabilities, injection risks, exposed secrets 2. Verify edge cases and failure modes are handled 3. Confirm new code has appropriate tests For detailed patterns, see `references/guide.md`. ```` - **`name`** — Unique identifier for the skill. - **`description`** — Determines when Kiro activates the skill. Be specific; include keywords that match how you'd phrase requests. - **Reference files** — Stored in `references/`. Kiro loads them only when the instructions direct it to. #### Skills in Custom Agents The default agent auto-discovers skills. Custom agents need explicit resource declarations: ```json { "name": "my-agent", "resources": [ "skill://.kiro/skills/*/SKILL.md", "skill://~/.kiro/skills/*/SKILL.md" ] } ``` #### Skill Best Practices - **Precise descriptions** — "Review pull requests for security vulnerabilities and test coverage" activates reliably; "Helps with code review" does not. - **Keep SKILL.md actionable** — Put lengthy reference material in `references/` files. - **Right scope** — Global skills for personal workflows; workspace skills for team/project conventions. - **Version control** — Commit `.kiro/skills/` so the team shares the same workflows. - **Check availability** — Use `/context show` to see which skills are loaded in the current session. ### Planning Mode (Plan Agent) Plan Agent is a **built-in read-only agent** for structured planning before execution. It transforms ideas into detailed implementation plans through an interactive workflow. #### When to Use - Complex multi-step features (e.g., "build a user authentication system") - Unclear or evolving requirements that need refinement - Large features that benefit from task breakdown before coding #### When NOT to Use - Simple queries or single-step tasks - User already has clear, specific instructions - Quick fixes or small changes #### How to Enter Planning Mode ```bash # Slash command > /plan # With an immediate prompt > /plan Build a REST API for user authentication # Keyboard shortcut (toggles plan ↔ execution) Shift + Tab ``` When active, the prompt shows a `[plan]` indicator. #### Plan Workflow (4 phases) 1. **Requirements gathering** — Structured multiple-choice questions to refine your idea. Answer with `1=a, 2=b` syntax or free-text. 2. **Research & analysis** — Explores your codebase using code intelligence, grep, and glob tools. 3. **Implementation plan** — Produces a task breakdown with clear objectives, implementation guidance, and demo descriptions for each task. 4. **Approval & handoff** — You review the plan. On approval (`y`), the plan transfers automatically to the execution agent. **Plan Agent is read-only:** it can read files, search code, and research, but cannot write files or execute commands until handoff. #### OpenClaw Integration for Planning Mode For interactive planning sessions, run Kiro in background mode and relay the `/plan` command: ```bash # Start interactive Kiro session bash pty:true workdir:~/project background:true command:"kiro-cli chat --trust-all-tools" # Enter planning mode process action:submit sessionId:XXX data:"/plan Build a REST API for user authentication" # Relay the user's answers to requirement questions process action:submit sessionId:XXX data:"1=a, 2=d I'm using Rust with Axum" # Approve the plan process action:submit sessionId:XXX data:"y" # Monitor output process action:log sessionId:XXX ``` #### Example Planning Session ``` > /plan Add user authentication to my web app [plan] > I understand you want to add user authentication. [1]: What authentication method? a. Email/Password b. OAuth c. Magic Links d. Multi-factor > 1=a [plan] > Great! Email/password it is. [2]: What's your tech stack? a. React + Node.js b. Next.js c. Django/Flask d. Other > 2=d, I'm using Rust with Axum [plan] > Researching Axum authentication patterns... **Implementation Plan — User Authentication System** [Detailed task breakdown...] Does this plan look good? Ready to exit [plan] agent? [y/n]: y [default] > Implement this plan: [Plan transferred] ``` ### Hooks Hooks execute custom commands at specific points during agent lifecycle and tool execution. Defined in the agent configuration file. #### Hook Types | Hook | Trigger | Can Block? | | --- | --- | --- | | `AgentSpawn` | Agent starts | No | | `UserPromptSubmit` | User sends a prompt | No | | `PreToolUse` | Before a tool runs | Yes (exit code 2) | | `PostToolUse` | After a tool runs | No | | `Stop` | Agent finishes a turn | No | #### Exit Codes - **0** — Success. STDOUT captured (added to context for AgentSpawn/UserPromptSubmit). - **2** — (PreToolUse only) Block tool execution; STDERR returned to the LLM. - **Other** — Failure. STDERR shown as warning to user. #### Tool Matching Use the `matcher` field to target specific tools: | Matcher | Matches | | --- | --- | | `"fs_write"` or `"write"` | Write tool | | `"execute_bash"` or `"shell"` | Shell execution | | `"@git"` | All tools from git MCP server | | `"@git/status"` | Specific MCP tool | | `"*"` | All tools (built-in + MCP) | | `"@builtin"` | Built-in tools only | #### Configuration - **`timeout_ms`** — Default 30,000ms (30s). - **`cache_ttl_seconds`** — `0` = no caching (default); `> 0` = cache successful results. AgentSpawn hooks are never cached. See [Agent Configuration Reference](https://kiro.dev/docs/cli/custom-agents/configuration-reference) for full syntax. ### Subagents Kiro can delegate tasks to **subagents** — independent agents with their own context that run autonomously and return results. ```bash > Use the backend agent to refactor the payment module ``` **Key capabilities:** - Autonomous execution with isolated context - Live progress tracking - Parallel execution for multiple tasks - Custom agent configurations for specialized workflows **Available tools in subagents:** read, write, shell, code intelligence, MCP tools. **Not available:** web_search, web_fetch, use_aws, grep, glob, thinking, todo_list. ### Custom Agents Pre-define tool permissions, context resources, and behaviors: ```bash kiro-cli agent list # List available agents kiro-cli agent create my-agent # Create new agent kiro-cli agent edit my-agent # Edit agent config kiro-cli agent validate ./a.json # Validate config file kiro-cli agent set-default my-agent ``` **Benefits:** Pre-approved tool trust, limited tool access, auto-loaded project docs, shareable team configs. ### Steering (Project Context) Provide persistent project knowledge via markdown files: | Path | Scope | | --- | --- | | `.kiro/steering/` | Workspace — this project only | | `~/.kiro/steering/` | Global — all projects | Example structure: ``` .kiro/steering/ ├── product.md # Product overview ├── tech.md # Tech stack ├── structure.md # Project structure └── api-standards.md # API conventions ``` Also supports `AGENTS.md` in the project root or `~/.kiro/steering/`. **In custom agents:** Add `"resources": ["file://.kiro/steering/**/*.md"]` to config. ### MCP Integration Connect external tools and data sources via Model Context Protocol: ```bash kiro-cli mcp add --name my-server --command "node server.js" --scope workspace kiro-cli mcp list [workspace|global] kiro-cli mcp status --name my-server kiro-cli mcp remove --name my-server --scope workspace ``` --- ## OpenCode ```bash bash pty:true workdir:~/project command:"opencode run 'Your task'" ``` --- ## Pi Coding Agent ```bash # Install: npm install -g @mariozechner/pi-coding-agent # Interactive bash pty:true workdir:~/project command:"pi 'Your task'" # Non-interactive (single response) bash pty:true command:"pi -p 'Summarize src/'" # Different provider/model bash pty:true command:"pi --provider openai --model gpt-4o-mini -p 'Your task'" ``` --- ## Parallel Issue Fixing (git worktrees) Fix multiple issues simultaneously using isolated worktrees: ```bash # 1. Create worktrees git worktree add -b fix/issue-78 /tmp/issue-78 main git worktree add -b fix/issue-99 /tmp/issue-99 main # 2. Launch agents (background + PTY) bash pty:true workdir:/tmp/issue-78 background:true command:"pnpm install && codex --yolo 'Fix issue #78: <description>. Commit and push.'" bash pty:true workdir:/tmp/issue-99 background:true command:"pnpm install && codex --yolo 'Fix issue #99: <description>. Commit and push.'" # 3. Monitor process action:list process action:log sessionId:XXX # 4. Create PRs cd /tmp/issue-78 && git push -u origin fix/issue-78 gh pr create --repo user/repo --head fix/issue-78 --title "fix: ..." --body "..." # 5. Clean up git worktree remove /tmp/issue-78 git worktree remove /tmp/issue-99 ``` --- ## Rules 1. **Always use `pty:true`** — Coding agents need a pseudo-terminal. 2. **Respect tool choice** — If the user asks for Kiro, use Kiro; for Codex, use Codex. Do NOT hand-code patches yourself when orchestrating agents. If an agent fails or hangs, respawn it or ask the user — don't silently take over. 3. **Be patient** — Don't kill sessions just because they seem slow. 4. **Monitor with `process:log`** — Check progress without interfering. 5. **Codex auto-approve flags** — Use `--full-auto` (sandboxed) or `--yolo` (no sandbox) for building tasks. 6. **Kiro tool trust** — Use `--trust-all-tools` for automation; `--trust-tools` for restricted scope. 7. **Kiro one-shots** — Use `--no-interactive` for single-response queries. 8. **Parallel is OK** — Run multiple agent processes concurrently for batch work. 9. **Never start agents in `~/clawd/`** — Agents will read system docs and behave unpredictably. 10. **Never checkout branches in `~/Projects/openclaw/`** — That's the live OpenClaw instance. 11. **Suggest Kiro `/plan` for complex tasks** — When requirements are unclear or multi-step, suggest Plan Agent and let the user decide. 12. **Leverage Kiro skills** — If the project has `.kiro/skills/` or the user has `~/.kiro/skills/`, relevant skills activate automatically. No extra flags needed. --- ## Progress Updates When you spawn coding agents in the background, keep the user informed: - **On start** — 1 short message: what's running, where, and which agent. - **On change** — Update only when something happens: - A milestone completes (build finished, tests passed) - The agent asks a question or needs input - An error occurs or user action is needed - The agent finishes (include what changed and where) - **On kill** — Immediately say you killed it and why. --- ## Auto-Notify on Completion For long-running tasks, append a wake trigger so OpenClaw is notified immediately when the agent finishes: ``` ... your task here. When completely finished, run this command to notify me: openclaw gateway wake --text "Done: [brief summary]" --mode now ``` **Example:** ```bash bash pty:true workdir:~/project background:true command:"codex --yolo exec 'Build a REST API for todos. When completely finished, run: openclaw gateway wake --text \"Done: Built todos REST API with CRUD endpoints\" --mode now'" ``` This triggers an immediate wake event instead of waiting for the next heartbeat. --- ## Learnings - **PTY is essential** — Without `pty:true`, output breaks or the agent hangs. - **Git repo required for Codex** — Use `mktemp -d && git init` for scratch work. - **`exec` for one-shots** — `codex exec "prompt"` runs and exits cleanly. - **`submit` vs `write`** — `submit` sends input + Enter; `write` sends raw data without newline. - **Skills activate automatically** — No slash command needed; Kiro matches your request against skill descriptions. - **Plan before complex builds** — `/plan` saves time on multi-step features by clarifying requirements upfront.

path: _meta.json
content: ownerId: kn78900pfs4x1dyejyd8vj121s804aea
slug: openclaw-kirocli-coding-agent
version: 1.0.0
publishedAt: 1771274851998

path: README.md
content: # OpenClaw + Kiro CLI Coding Agent Skill

[中文文档](./README.zh-CN.md)

> Integrate [Kiro CLI](https://kiro.dev/) (AWS AI coding assistant) with [OpenClaw](https://github.com/openclaw/openclaw) for seamless AI-powered coding workflows.

## What is This?

This repository provides a **coding-agent skill** for OpenClaw that enables integration with Kiro CLI and other coding agents (Codex, Claude Code, OpenCode, Pi). The skill teaches OpenClaw how to:

- Launch and manage coding agents in the background
- Handle multi-turn conversations with interactive CLIs
- Monitor progress and capture outputs
- Coordinate coding tasks through chat interfaces (WhatsApp, Discord, Telegram, etc.)

## What is OpenClaw?

[OpenClaw](https://github.com/openclaw/openclaw) is an open-source AI assistant framework that connects to various messaging platforms. It can:

- Run as a personal AI assistant across WhatsApp, Discord, Telegram, Signal, etc.
- Execute shell commands, browse the web, manage files
- Be extended with **skills** — modular instruction sets for specific tasks

## What is Kiro CLI?

[Kiro CLI](https://kiro.dev/) is AWS's AI coding assistant with powerful features:

- Session persistence and conversation resume
- Custom agents with pre-defined tool permissions
- Steering files for project context
- MCP (Model Context Protocol) integration
- Plan Agent for structured task planning

## Installation

### 1. Install OpenClaw

Follow the [OpenClaw installation guide](https://docs.openclaw.ai/).

### 2. Install Kiro CLI

```bash
# macOS / Linux (recommended)
curl -fsSL https://cli.kiro.dev/install | bash

# Or download from https://kiro.dev/
```

After installation, run `kiro-cli login` to authenticate (supports GitHub, Google, AWS Builder ID, or IAM Identity Center).

### 3. Add the Skill

Copy `SKILL.md` to your OpenClaw workspace skills directory:

```bash
mkdir -p ~/.openclaw/workspace/skills/coding-agent
cp SKILL.md ~/.openclaw/workspace/skills/coding-agent/
```

Or clone this repo directly:

```bash
cd ~/.openclaw/workspace/skills
git clone https://github.com/terrificdm/openclaw-kirocli-coding-agent.git coding-agent
```

## Usage

Once installed, you can ask OpenClaw to use Kiro CLI for coding tasks.

> **Note:** Use the magic word **"kiro"** in your message to activate Kiro CLI. For example: "Use **kiro** to..." or "Ask **kiro** to..."

### One-Shot Queries

```
"Use kiro to check what AWS Lambda features were released recently"
"Ask kiro to list all TODO comments in my project"
```

OpenClaw will run:
```bash
kiro-cli chat --no-interactive --trust-all-tools "your query"
```

### Multi-Turn Conversations

```
"Start a conversation with kiro about building a REST API"
"Tell kiro I want to use Python and FastAPI"
"Ask kiro to create the project structure"
```

OpenClaw manages the session using background processes:
```bash
# Start interactive session
exec pty:true background:true command:"kiro-cli chat --trust-all-tools"

# Send messages
process action:paste sessionId:XXX text:"your message"
process action:send-keys sessionId:XXX keys:["Enter"]

# Read responses
process action:log sessionId:XXX
```

### Complex Tasks with Plan Agent

For multi-step features, suggest using Kiro's Plan Agent:

```
"Use kiro's /plan mode to design a user authentication system"
```

Plan Agent will:
1. Gather requirements through structured questions
2. Research your codebase
3. Create a detailed implementation plan
4. Hand off to execution after your approval

## Key Features

| Feature | Description |
|---------|-------------|
| **PTY Support** | Proper terminal emulation for interactive CLIs |
| **Background Sessions** | Long-running tasks don't block the conversation |
| **Multi-Agent Support** | Works with Kiro, Codex, Claude Code, OpenCode, Pi |
| **Session Management** | Monitor, send input, kill sessions as needed |

## Supported Coding Agents

| Agent | Command | Notes |
|-------|---------|-------|
| **Kiro CLI** | `kiro-cli` | AWS AI assistant, recommended |
| Codex | `codex` | OpenAI, requires git repo |
| Claude Code | `claude` | Anthropic |
| OpenCode | `opencode` | Open source |
| Pi | `pi` | Lightweight, multi-provider |

## Important Notes

1. **Always use `pty:true`** — Coding agents need a pseudo-terminal
2. **Use `--trust-all-tools`** — For automation without confirmation prompts
3. **Use `--no-interactive`** — For simple one-shot queries
4. **Set `workdir`** — Keep agents focused on specific projects

## Example Workflow

```
User: "Use kiro to help me refactor the auth module"

OpenClaw: Starting Kiro session for auth refactoring...
         [Launches: kiro-cli chat --trust-all-tools]

User: "I want to switch from JWT to session-based auth"

OpenClaw: [Sends message to Kiro session]
         Kiro says: "I'll help you migrate from JWT to session-based 
         authentication. Let me first analyze your current implementation..."
         
User: "Go ahead with the changes"

OpenClaw: [Sends approval to Kiro]
         Kiro is making changes... I'll notify you when done.
```

## License

MIT

## Links

- [OpenClaw](https://github.com/openclaw/openclaw)
- [Kiro CLI](https://kiro.dev/)
- [OpenClaw Documentation](https://docs.openclaw.ai/)


path: README.zh-CN.md
content: # OpenClaw + Kiro CLI 编程代理技能

[English](./README.md)

> 将 [Kiro CLI](https://kiro.dev/)（AWS AI 编程助手）与 [OpenClaw](https://github.com/openclaw/openclaw) 集成，实现无缝的 AI 编程工作流。

## 这是什么？

本仓库提供了一个用于 OpenClaw 的 **coding-agent skill**，支持与 Kiro CLI 及其他编程代理（Codex、Claude Code、OpenCode、Pi）的集成。该 skill 让 OpenClaw 能够：

- 在后台启动和管理编程代理
- 处理与交互式 CLI 的多轮对话
- 监控进度并捕获输出
- 通过聊天界面（WhatsApp、Discord、Telegram 等）协调编程任务

## 什么是 OpenClaw？

[OpenClaw](https://github.com/openclaw/openclaw) 是一个开源 AI 助手框架，可连接各种消息平台：

- 作为个人 AI 助手运行在 WhatsApp、Discord、Telegram、Signal 等平台
- 执行 shell 命令、浏览网页、管理文件
- 通过 **skills**（技能）扩展功能 — 针对特定任务的模块化指令集

## 什么是 Kiro CLI？

[Kiro CLI](https://kiro.dev/) 是 AWS 的 AI 编程助手，具有强大功能：

- 会话持久化和对话恢复
- 自定义代理，预设工具权限
- Steering 文件提供项目上下文
- MCP（模型上下文协议）集成
- Plan Agent 用于结构化任务规划

## 安装

### 1. 安装 OpenClaw

参考 [OpenClaw 安装指南](https://docs.openclaw.ai/)。

### 2. 安装 Kiro CLI

```bash
# macOS / Linux（推荐）
curl -fsSL https://cli.kiro.dev/install | bash

# 或从 https://kiro.dev/ 下载
```

安装完成后，运行 `kiro-cli login` 进行认证（支持 GitHub、Google、AWS Builder ID 或 IAM Identity Center）。

### 3. 添加 Skill

将 `SKILL.md` 复制到 OpenClaw 工作区的 skills 目录：

```bash
mkdir -p ~/.openclaw/workspace/skills/coding-agent
cp SKILL.md ~/.openclaw/workspace/skills/coding-agent/
```

或直接克隆本仓库：

```bash
cd ~/.openclaw/workspace/skills
git clone https://github.com/terrificdm/openclaw-kirocli-coding-agent.git coding-agent
```

## 使用方法

安装完成后，你可以让 OpenClaw 使用 Kiro CLI 执行编程任务。

> **注意：** 在消息中使用魔法词 **"kiro"** 来激活 Kiro CLI。例如："用 **kiro** 帮我..." 或 "让 **kiro** 查一下..."

### 一次性查询

```
"用 kiro 查一下 AWS Lambda 最近发布了什么新功能"
"让 kiro 列出项目中所有的 TODO 注释"
```

OpenClaw 会运行：
```bash
kiro-cli chat --no-interactive --trust-all-tools "你的查询"
```

### 多轮对话

```
"和 kiro 开始一个关于构建 REST API 的对话"
"告诉 kiro 我想用 Python 和 FastAPI"
"让 kiro 创建项目结构"
```

OpenClaw 使用后台进程管理会话：
```bash
# 启动交互式会话
exec pty:true background:true command:"kiro-cli chat --trust-all-tools"

# 发送消息
process action:paste sessionId:XXX text:"你的消息"
process action:send-keys sessionId:XXX keys:["Enter"]

# 读取回复
process action:log sessionId:XXX
```

### 使用 Plan Agent 处理复杂任务

对于多步骤的功能开发，建议使用 Kiro 的 Plan Agent：

```
"用 kiro 的 /plan 模式来设计一个用户认证系统"
```

Plan Agent 会：
1. 通过结构化问题收集需求
2. 研究你的代码库
3. 创建详细的实施计划
4. 在你批准后交给执行代理

## 核心功能

| 功能 | 描述 |
|------|------|
| **PTY 支持** | 为交互式 CLI 提供正确的终端模拟 |
| **后台会话** | 长时间任务不会阻塞对话 |
| **多代理支持** | 支持 Kiro、Codex、Claude Code、OpenCode、Pi |
| **会话管理** | 监控、发送输入、按需终止会话 |

## 支持的编程代理

| 代理 | 命令 | 备注 |
|------|------|------|
| **Kiro CLI** | `kiro-cli` | AWS AI 助手，推荐使用 |
| Codex | `codex` | OpenAI，需要 git 仓库 |
| Claude Code | `claude` | Anthropic |
| OpenCode | `opencode` | 开源 |
| Pi | `pi` | 轻量级，多供应商支持 |

## 重要注意事项

1. **始终使用 `pty:true`** — 编程代理需要伪终端
2. **使用 `--trust-all-tools`** — 自动化时跳过确认提示
3. **使用 `--no-interactive`** — 用于简单的一次性查询
4. **设置 `workdir`** — 让代理专注于特定项目

## 工作流示例

```
用户: "用 kiro 帮我重构 auth 模块"

OpenClaw: 正在启动 Kiro 会话进行 auth 重构...
         [启动: kiro-cli chat --trust-all-tools]

用户: "我想从 JWT 切换到基于 session 的认证"

OpenClaw: [发送消息到 Kiro 会话]
         Kiro 说: "我来帮你从 JWT 迁移到基于 session 的认证。
         让我先分析一下你当前的实现..."
         
用户: "可以开始修改了"

OpenClaw: [发送批准到 Kiro]
         Kiro 正在进行修改... 完成后我会通知你。
```

## 许可证

MIT

## 链接

- [OpenClaw](https://github.com/openclaw/openclaw)
- [Kiro CLI](https://kiro.dev/)
- [OpenClaw 文档](https://docs.openclaw.ai/)


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: suspicious | SkillSpector: suspicious (HIGH)