Skip to content

feat(kiro): add Kiro CLI host support - #707

Open
revagomes wants to merge 5 commits into
DietrichGebert:mainfrom
revagomes:feat/kiro-cli-support
Open

feat(kiro): add Kiro CLI host support#707
revagomes wants to merge 5 commits into
DietrichGebert:mainfrom
revagomes:feat/kiro-cli-support

Conversation

@revagomes

@revagomes revagomes commented Aug 12, 2026

Copy link
Copy Markdown

Add Kiro CLI hook support

Revives the work from PR #223 (closed due to merge conflicts), rebased onto current main and updated to match Kiro's current v2 hook API.

What this adds

  • Host detection: isKiro in ponytail-runtime.js, detected via PONYTAIL_HOST=kiro (set inside the hook command). State written to KIRO_HOME or ~/.kiro/.
  • Raw stdout output: Kiro forwards exit-0 stdout for SessionStart and UserPromptSubmit hooks, same semantics as native Claude Code — no JSON wrapping needed.
  • v2 hook files (.kiro/hooks/):
    • ponytail-activate.jsonSessionStart: activates default mode, emits ruleset
    • ponytail-mode-tracker.jsonUserPromptSubmit: tracks /ponytail lite|full|ultra|off commands
  • Reference template (hooks/kiro-hooks.json): for users installing from a checkout into their own projects (same pattern as hooks/qoder-hooks.json).
  • Statusline nudge suppressed on Kiro (no statusline support).
  • Tests: full coverage of isKiro detection, state dir resolution (~/.kiro/, KIRO_HOME), raw stdout output, mode switching, off mode, and host-collision safety (Codex wins).

What Kiro gets

Feature Before After
Always-on ruleset steering file only hook-injected (filtered to active mode)
Mode switching not supported /ponytail lite|full|ultra|off
Subagent injection not supported not supported (Kiro limitation*)
Slash-command skills not supported not supported (Kiro limitation)
Statusline n/a n/a (correct)

*Kiro's PreToolUse stdout is for permission decisions, not context injection. Subagent injection awaits a future Kiro trigger (e.g., SubagentStart or a context-injection field in PreToolUse).

Host-collision safety

isKiro is detected via PONYTAIL_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 both PLUGIN_DATA and PONYTAIL_HOST=kiro are 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

# Per-project (from a ponytail checkout):
cp .kiro/hooks/ponytail-*.json /path/to/your/project/.kiro/hooks/

# Global (all Kiro sessions):
mkdir -p ~/.kiro/hooks
cp .kiro/hooks/ponytail-*.json ~/.kiro/hooks/

The steering file (.kiro/steering/ponytail.md) remains as an instruction-only fallback.

Tests

  • All existing tests pass (83/84; the 1 failure is the pre-existing pandas-dependent CSV correctness test).
  • node scripts/check-rule-copies.js passes.
  • New Kiro-specific test block in tests/hooks.test.js: isKiro detection, ~/.kiro state, raw stdout, mode switch, off mode, KIRO_HOME override, host collision.

Docs

  • README: added ### Kiro CLI install 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.

Copilot AI lite review requested due to automatic review settings August 12, 2026 08:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread hooks/ponytail-runtime.js
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 thread hooks/ponytail-runtime.js
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;
Comment thread README.md
| 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.
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.

2 participants