Kiro Power
Kiro Power
Preflight can be installed directly as a Kiro Power, in
addition to the npm-based install (npm install -g @newrelic/preflight +
preflight setup) described in the main README. Both paths
are valid — the Power is an additional distribution channel, not a
replacement.
The Power gives you the nr_observe_* MCP tools with nothing pre-installed.
Automatic tool-call capture is the one part that still needs the global
install, because the hook binary runs on every single tool call and can’t be
routed through npx — see
Enable automatic tool-call capture.
kiro-power/ uses Kiro’s current
Agent Plugins format (plugin.json + mcp.json
skills/) rather than the legacyPOWER.mdformat — this is a requirement, not a preference: Kiro’s own submission page for the curated kiro.dev/powers/ directory states plainly, “Please create your power using the Agent Plugins format… If your power is a good fit for our registry, we will reach out.” The legacy format still installs fine via a direct folder/GitHub-URL import, but isn’t eligible for that curated listing at all.
What you get
- MCP tools — all
nr_observe_*tools (session stats, cost breakdown, anti-patterns, recommendations, etc.). - Two Agent Skills —
setup(first-run onboarding: verify dependencies, wire up hooks, choose local/cloud mode) andobservability(documents thenr_observe_*tools so Kiro’s agent reaches for them when relevant).
Activation is contextual, not always-on
Kiro’s docs are explicit about this for the Agent Plugins format:
“MCP servers are managed internally by Kiro… They activate and
deactivate with the power,” and “powers activate dynamically based on
keywords in your conversation.” So nr_observe_* tools aren’t necessarily
available the instant this Power is installed — they become available once
the conversation touches on something in plugin.json’s keywords list
(cost, efficiency, observability, anti-patterns, etc.), or once the setup
skill has run. If you ask something entirely unrelated first, don’t be
surprised if the tools aren’t there yet — mention Preflight or ask about
session cost/efficiency to trigger activation.
This does not affect tool-call capture — once
.kiro/hooks/preflight-observability.json exists (see below), Kiro fires it
on every tool call independent of whether this Power is currently “active.”
What this doesn’t do automatically
Kiro Powers can’t bundle hooks or executables — plugin.json’s schema has
no hooks field, and Kiro’s own directory-tree example for a complete Power
(plugin.json + mcp.json + skills/) has no hooks file anywhere. So
installing this Power alone does not give you automatic
PreToolUse/PostToolUse capture — that’s a one-time manual step, covered by the
setup skill (kiro-power/skills/setup/SKILL.md) and summarized again below.
Install
For local testing / peer-to-peer sharing (no review):
- Clone this repo (or download it) so you have a local copy of
kiro-power/. - In Kiro, open the Powers panel → Add Custom Power → Import power
from a folder → select the
kiro-power/directory. - Restart Kiro (or reconnect MCP servers from Kiro’s MCP panel). Ask Kiro’s
agent to run Preflight setup (or mention cost/observability) to trigger
the
setupskill’s onboarding — including wiring hooks for full tool-call capture (see below).
No prior install is needed for the MCP tools: mcp.json fetches the package
on demand with npx. Automatic tool-call capture is separate and does still
need a global install — see below.
Kiro also supports importing a Power directly from a GitHub repository URL.
Whether that flow supports pointing at a subdirectory of a larger repo (like
kiro-power/ here) isn’t documented, so the folder-import path above is the
one to rely on until that’s confirmed.
For the curated kiro.dev/powers/ directory: submit the public GitHub
repo URL via kiro.dev/powers/submit/.
Kiro’s stated requirements include: the power is complete/tested/working;
plugin.json includes $schema/name/version/description/author/
keywords/license (all present in kiro-power/plugin.json); any MCP
server used isn’t in beta/preview status; and the repo’s README includes a
privacy policy link and a support contact. This repo’s top-level README
doesn’t currently have either of those last two — worth adding before
submitting.
Enable automatic tool-call capture
This is Step 2 of the setup skill (kiro-power/skills/setup/SKILL.md) —
Kiro’s agent should walk you through it, but you can also do it by hand:
-
Confirm
preflight-collectorresolves onPATH:command -v preflight-collector(or runkiro-power/skills/setup/scripts/validate-deps.sh). If it doesn’t, runnpm install -g @newrelic/preflight, then re-check. Do this before creating the hook file below — kiro.dev/docs/hooks marksPreToolUseas a blocking trigger, so a hook command missing fromPATHwould block every tool call in the session, not just skip Preflight’s own observability. -
Add
.kiro/hooks/preflight-observability.jsonin your project (not insidekiro-power/— hooks are workspace-scoped):{"version": "v1","hooks": [{"name": "Preflight: pre tool call","trigger": "PreToolUse","action": { "type": "command", "command": "MCP_CLIENT=kiro preflight-collector" },"timeout": 10},{"name": "Preflight: post tool call","trigger": "PostToolUse","action": { "type": "command", "command": "MCP_CLIENT=kiro preflight-collector" },"timeout": 10}]}The
MCP_CLIENT=kiroprefix is required, not decorative: Kiro spawns this hook command as a process separate from the Power’s MCP server, so it never inheritsNEW_RELIC_AI_PLATFORM: "kiro"frommcp.json’senvblock — that’s scoped to the MCP server subprocess only. Without an explicit stamp on the command itself,collector-script.tshas no confirmed ambient signal to fall back on for this subprocess, the same reasoning the Copilot, Droid, Gemini CLI, Codex, opencode, Kilo Code, and Antigravity adapters document in ADAPTERS.md for their own hook commands.kiro.dev/docs/hooks/confirmsaction.commandruns as a real shell command, so the leadingVAR=valueassignment is parsed normally — it is not a literal program name.Both entries run the same command —
preflight-collectortells pre- from post-call apart from the hook payload’s ownhook_event_namefield, not a CLI argument (src/hooks/collector-script.ts). Neither sets amatcher; per kiro.dev/docs/hooks, omitting it defaults to always-match. -
Restart Kiro. Tool calls now land in
~/.newrelic-preflight/buffer-*.jsonland feed thenr_observe_*tools above the same way they do for Claude Code, Amazon Q, and Kiro’s otherfull-hookspeers — see ADAPTERS.md.
Skipping this step silently downgrades the install to MCP-tool-only
visibility — nr_observe_health still succeeds, so it can look like
everything is working while most of the session goes unobserved.
Cloud mode
This Power’s mcp.json sets NR_AI_MODE: "local" explicitly, so it works
with no New Relic account (dashboard at http://127.0.0.1:7777, nothing
leaves the machine). To send telemetry to New Relic instead, edit
kiro-power/mcp.json’s own env block — add NEW_RELIC_LICENSE_KEY and
NEW_RELIC_ACCOUNT_ID, and change NR_AI_MODE to cloud or both. Edit
the file directly rather than exporting shell variables: it’s the config
Kiro actually reads to launch this server, whereas whether Kiro’s launcher
also layers in the host shell environment on top isn’t documented. Never
commit real credentials into a shared copy of mcp.json — keep source
control on local mode with no credentials, same as this repo’s copy. See
ADVANCED.md for the full field reference.
Optional feature flags
A handful of nr_observe_* tools stay inert (or error outright) until specific
fields are set. All of these go in the same mcp.json env block as
NR_AI_MODE/NEW_RELIC_LICENSE_KEY above — add only the ones you actually
want; everything below is optional and independent of the others.
| Env var | Unlocks | Notes |
|---|---|---|
NEW_RELIC_AI_SESSION_BUDGET_USD |
Non-null budgetUsd/remainingUsd/pctUsed and 50/80/100% threshold alerts in nr_observe_get_budget_status, scoped to one session |
A positive USD number, e.g. "5". Works in local mode — no NR account needed for this one. |
NEW_RELIC_AI_DAILY_BUDGET_USD |
Same, scoped to the local calendar day | |
NEW_RELIC_AI_WEEKLY_BUDGET_USD |
Same, scoped to the ISO week | |
NEW_RELIC_AI_TEAM_ID |
Tags every event with a team identifier; required (together with NEW_RELIC_API_KEY) for nr_observe_get_team_summary to be available at all |
Any string you choose. For team-wide aggregation to mean anything, every teammate’s mcp.json needs the same value and NR_AI_MODE: "cloud" or "both" — local mode never reaches the shared NR account this tool queries. |
NEW_RELIC_API_KEY |
Required (together with NEW_RELIC_AI_TEAM_ID) for nr_observe_get_team_summary |
A NerdGraph User key (NRAK-...) — generated in the New Relic UI (profile menu → API keys → Create a key → User), not the same as the ingest NEW_RELIC_LICENSE_KEY. |
NEW_RELIC_AI_ORG_ID |
Tags every event with an org identifier | No default; omitted from events if unset. |
NEW_RELIC_AI_PROJECT_ID |
Tags every event with a project identifier | Auto-derived from the git remote (org/repo) if omitted — only set this to override that. |
NEW_RELIC_AI_MCP_DEVELOPER |
Developer identity used to facet cross-session/team tools (nr_observe_get_team_summary, nr_observe_get_personal_insights, etc.) |
Defaults to $USER/$USERNAME, falling back to git config user.name, then "unknown" — only set this to override that. |
Restart Kiro after editing mcp.json — none of these are hot-reloaded.
Why NEW_RELIC_AI_PLATFORM is set
mcp.json also pins NEW_RELIC_AI_PLATFORM: "kiro". This is load-bearing,
not decoration: Kiro exposes no ambient environment variable identifying
itself to a child process (a Power’s MCP server gets 16 variables, none of
them Kiro-specific), so KiroAdapter.isSupported() cannot detect it and
PlatformRegistry.detect() falls through to the generic MCP adapter.
The failure that causes is quiet and easy to miss. Session resolution and the
raw tool-call count still work, so the install looks healthy — but Kiro’s tool
names (read_file, str_replace, execute_bash) are never mapped to
Preflight’s normalized vocabulary, and every metric keyed on a normalized name
reports zero: unique_files_read, unique_files_modified,
bash_commands_run, and the anti-pattern and cost-per-file analyses built on
them. Check nr_observe_get_config reports platform: "kiro" if those
numbers ever look implausibly empty.
Packaging
kiro-power/ ships no precompiled hook script and needs no bundle step — a
Power can’t carry a hooks file or an executable at all, so there’s nothing
to bundle; Enable automatic tool-call capture
reuses the already-published preflight-collector bin instead.
kiro-power/mcp.json fetches the package on demand
(npx -y @newrelic/preflight@latest --stdio) rather than requiring a global
install, so the nr_observe_* tools work on a first-time machine.
That was not always safe, and the reason is worth recording. npx does not
run the server directly — it execs an npm exec process which then runs the
server, so the server’s parent is that wrapper rather than Kiro. Preflight
resolves its session_id by matching its own parent PID against a breadcrumb
the hook collector writes at its parent PID, and the wrapper broke that
match: session_id never resolved, and every session-scoped tool failed while
the MCP connection itself looked perfectly healthy. Kiro’s working-directory
fallback can’t rescue it either, because a Power’s server runs with cwd set
to the Power’s install directory and never sees the workspace path.
src/hooks/process-ancestry.ts fixes this by walking a few levels up the
server’s own ancestry instead of checking only its immediate parent, so the
breadcrumb one level above the wrapper is found. This config therefore
depends on that fix being present in the published package — pinning
@latest is what ties the two together. If you ever see session_id: null
on Kiro, check the installed version actually contains the ancestor walk
before looking anywhere else.
kiro-power/ ships:
kiro-power/plugin.json— the Power manifest.kiro-power/mcp.json— the MCP server declaration.kiro-power/skills/setup/— thesetupAgent Skill (SKILL.md+scripts/validate-deps.sh+references/troubleshooting.md).kiro-power/skills/observability/— theobservabilityAgent Skill (SKILL.md), documenting thenr_observe_*tools.
Note: the release PR writes
plugin.json’sversionalong withpackage.json’s (npm run version-packages), so don’t bump it by hand. See Changesets.