feat(kiro): add Kiro CLI host support - #707
Open
revagomes wants to merge 5 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class Kiro CLI “hook host” support alongside existing Claude/Codex/Copilot/Qoder integrations, enabling session activation, mode switching, and subagent ruleset injection via Kiro hook configs.
Changes:
- Add Kiro host detection and Kiro-specific state directory + stdout output behavior in the shared hook runtime.
- Suppress Claude-only statusline setup nudge when running under Kiro.
- Add Kiro hook configuration files/templates and update docs/README for install/uninstall guidance.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents Kiro CLI install steps and updates uninstall/commands notes for Kiro. |
| hooks/ponytail-runtime.js | Introduces isKiro, Kiro state dir selection, and raw-stdout hook output behavior. |
| hooks/ponytail-activate.js | Gates “OK” output and statusline nudge to exclude Kiro sessions. |
| hooks/kiro-hooks.json | Adds a reference hook template using PONYTAIL_DIR placeholders for non-repo-root installs. |
| docs/agent-portability.md | Updates Kiro row to include hook-based “full support” paths. |
| .kiro/hooks/ponytail-activate.json | Adds per-project/global Kiro SessionStart hook config. |
| .kiro/hooks/ponytail-mode-tracker.json | Adds Kiro UserPromptSubmit hook config for /ponytail ... mode switching. |
| .kiro/hooks/ponytail-subagent.json | Adds Kiro PreToolUse hook config for subagent ruleset injection. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
21
to
+24
| const isCodex = !isCopilot && Boolean(process.env.PLUGIN_DATA); | ||
| const isQoder = !isCopilot && !isCodex && Boolean(process.env.QODER_SESSION_ID); | ||
| const isKiro = !isCopilot && !isCodex && !isQoder && | ||
| (process.env.PONYTAIL_HOST || '').toLowerCase() === 'kiro'; |
Comment on lines
+86
to
+90
| // Kiro: raw stdout is forwarded as context for SessionStart and | ||
| // UserPromptSubmit hooks (exit 0). Same semantics as native Claude Code. | ||
| if (isKiro) { | ||
| process.stdout.write(context); | ||
| return; |
| | Devin CLI | `devin plugins remove ponytail` | | ||
| | Grok Build | `grok plugin uninstall ponytail` | | ||
| | Pi agent | `pi uninstall ponytail` | | ||
| | Kiro | Delete `.kiro/hooks/ponytail-*.json` and `.kiro/steering/ponytail.md` | |
…t limitations. Kiro's PreToolUse stdout is for permission decisions, not context injection. The subagent hook was silently broken. Removed it and documented that subagent injection awaits a future Kiro trigger. Also noted Windows limitation (inline env var syntax requires POSIX shell) and added _note fields to shipped hook files clarifying relative path assumption.
…t, and host collision.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Kiro CLI hook support
Revives the work from PR #223 (closed due to merge conflicts), rebased onto current
mainand updated to match Kiro's current v2 hook API.What this adds
isKiroinponytail-runtime.js, detected viaPONYTAIL_HOST=kiro(set inside the hook command). State written toKIRO_HOMEor~/.kiro/.SessionStartandUserPromptSubmithooks, same semantics as native Claude Code — no JSON wrapping needed..kiro/hooks/):ponytail-activate.json—SessionStart: activates default mode, emits rulesetponytail-mode-tracker.json—UserPromptSubmit: tracks/ponytail lite|full|ultra|offcommandshooks/kiro-hooks.json): for users installing from a checkout into their own projects (same pattern ashooks/qoder-hooks.json).~/.kiro/,KIRO_HOME), raw stdout output, mode switching, off mode, and host-collision safety (Codex wins).What Kiro gets
/ponytail lite|full|ultra|off*Kiro's
PreToolUsestdout is for permission decisions, not context injection. Subagent injection awaits a future Kiro trigger (e.g.,SubagentStartor a context-injection field inPreToolUse).Host-collision safety
isKirois detected viaPONYTAIL_HOST=kiro, set inside the hook command itself (robust regardless of Kiro's environment). The detection chain (isCopilot → isCodex → isQoder → isKiro) ensures no collision with other hosts. Test coverage confirms Codex wins when bothPLUGIN_DATAandPONYTAIL_HOST=kiroare set.Platform support
Hook commands use inline env var syntax (
PONYTAIL_HOST=kiro node ...), which requires a POSIX shell (Linux/macOS). Kiro CLI currently targets these platforms. Windows support depends on Kiro adding per-platform command fields to v2 hooks.Install
The steering file (
.kiro/steering/ponytail.md) remains as an instruction-only fallback.Tests
pandas-dependent CSV correctness test).node scripts/check-rule-copies.jspasses.tests/hooks.test.js: isKiro detection,~/.kirostate, raw stdout, mode switch, off mode,KIRO_HOMEoverride, host collision.Docs
### Kiro CLIinstall section, added Kiro to uninstall table, updated commands note.docs/agent-portability.md: updated Kiro row with hook files and limitations.Closes the gap identified in #223.