feat(kiro): document hook architecture and known limitations for the Kiro CLI adapter
- Dominant language
- JavaScript
- Stars
- 26
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
## Context
The Kiro CLI harness adapter (shipped in PR #106) now provides full lifecycle hook support on par with all other adapters. This issue tracks remaining known limitations and future improvements for the Kiro integration.
## What is fully working (as of PR #106)
| Capability | Notes |
|---|---|
| Session-start context injection | `agentSpawn` → stdout injected into agent context |
| Automatic session capture | `stop` → reads `~/.kiro/sessions/cli/.json` |
| Proposal drain | `agentSpawn` async launcher |
| Periodic lint tick | `stop` async launcher |
| Prompt-time knowledge injection | `userPromptSubmit` → stdout injected into context |
| Skill installation | `.kiro/skills/` |
| Memory ingestion | `.kiro/steering/` + `~/.kiro/steering/` |
## Known limitations
### 1. User turns are empty in session captures
Kiro's session JSON (`~/.kiro/sessions/cli/.json`) stores only assistant responses in `user_turn_metadatas`. User message text is referenced only by UUID and is not stored in the session file. All session captures will have empty user turns, degrading curation quality because user intent is absent from the transcript.
**Workaround**: Use `/kk-session-extract` at the end of sessions to capture via the visible context window (which does include user turns) instead of relying on `kk-capture`.
**Fix**: Requires either Kiro exposing user turn text in the session JSON, or a separate API to retrieve full conversation history.
### 2. Hook registration requires a dedicated agent config file
Hooks are registered in `.kiro/agents/kk-hooks.json`. Kiro loads all `.kiro/agents/*.json` files on startup, so this works correctly, but it means kenkeep adds a file to the user's agents directory. This is the only mechanism available in the current Kiro hook architecture.
### 3. v3 hook format (future)
Kiro CLI v3 introduces a standalone `.kiro/hooks/.json` format with a different schema (`version: "v1"`, `hooks: [{name, trigger, action, ...}]`). The current adapter targets the stable CLI (v2) format. A follow-up will be needed to support v3 when it becomes the default.
## Implementation notes for follow-ups
- If Kiro exposes user turn text in a future session format, update `parseKiroTranscript` in `src/harnesses/kiro/transcript.ts`
- If Kiro v3 becomes the default, update `writeKiroHookConfig` in `src/harnesses/kiro/hooks-config.ts` to emit the v3 format
- The `kk-detect-harness.mjs` detector checks `KIRO_SESSION_ID`; if Kiro changes its env var naming, update both `src/harnesses/kiro/index.ts` `detectFromEnv` and `src/templates-source/kenkeep/scripts/kk-detect-harness.mjs`
Contributor guide
Research direction
Start by reviewing the Kiro adapter files named in the issue: src/harnesses/kiro/transcript.ts, src/harnesses/kiro/hooks-config.ts, src/harnesses/kiro/index.ts, and the detector script. Confirm the current v2 behavior and limitations, then identify where this architecture and its follow-ups should be documented. Done means the documentation covers the empty user turns, agent config requirement, v3 format, and detector environment variable dependency.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- cli, documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100