Skip to content

feat(adapter): add Kiro CLI export adapter#61

Closed
VedantMadane wants to merge 1 commit intoopen-gitagent:mainfrom
VedantMadane:feat/kiro-adapter
Closed

feat(adapter): add Kiro CLI export adapter#61
VedantMadane wants to merge 1 commit intoopen-gitagent:mainfrom
VedantMadane:feat/kiro-adapter

Conversation

@VedantMadane
Copy link
Copy Markdown

Closes #46

Adds an export adapter for AWS Kiro CLI custom agents.

What it does

Generates two outputs from a gitagent directory:

  1. Agent config JSON (.kiro/agents/<name>.json) with:

    • name, description, model from the manifest
    • prompt as a file://./prompt.md URI (Kiro's recommended pattern for long prompts)
    • tools and allowedTools collected from skills frontmatter and tools/*.yaml
    • mcpServers from tool YAML files that declare mcp_server
    • hooks mapped to Kiro's event model (PreToolUse, PostToolUse, Notification, Stop)
  2. Prompt markdown (prompt.md) built from SOUL.md, RULES.md, DUTIES.md, skills, tools, knowledge, and compliance sections -- same pattern as the Gemini and Codex adapters.

Files changed

  • src/adapters/kiro.ts -- new adapter (306 lines)
  • src/adapters/index.ts -- add kiro export
  • src/commands/export.ts -- add kiro format to switch and help text

Usage

gitagent export -f kiro -d ./my-agent

Reference

Based on Kiro CLI configuration reference and follows the same adapter pattern as gemini.ts and codex.ts.

@shreyas-lyzr
Copy link
Copy Markdown
Contributor

Reviewed and merged with fixes.

What was correct:

  • Config structure matches Kiro docs: .kiro/agents/<name>.json with name, description, prompt, model, tools, allowedTools, mcpServers, hooks, welcomeMessage
  • file://./prompt.md URI syntax for prompts is correct
  • MCP server collection from tools/*.yaml is a nice addition
  • Uses shared buildComplianceSection (no duplication)
  • Follows existing adapter patterns

Fixes applied:

  1. Hook event names were PascalCase — Kiro uses camelCase. Changed PreToolUsepreToolUse, PostToolUsepostToolUse, Stopstop. Added agentSpawn and userPromptSubmit mappings.
  2. Notification hook event doesn't exist in Kiro. Removed — Kiro only supports 5 events: agentSpawn, userPromptSubmit, preToolUse, postToolUse, stop.
  3. TypeScript errormcp.name could be undefined, added non-null assertion since it's inside a if (mcp_server?.name) guard.

Verified against Kiro CLI configuration reference. Thanks @VedantMadane!

Upstream main already includes the Kiro CLI export adapter and related wiring; reset branch tip to match main and clear merge conflicts.
@VedantMadane
Copy link
Copy Markdown
Author

Closing — the Kiro adapter is already in main. Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Adapter] Kiro CLI Custom Agent

2 participants