Kiro

Make a project follow an instruction in Kiro: add two hooks by hand, or a steering file, and a new version arrives at your next prompt. The same setup for other tools, and how each one takes a new version, is on Other coding agents.

At a glance

How it followshooks
A new version arrivesat your next prompt
Set upby hand
Checked againstKiro's documentation
SystemsWherever the tool and Node.js 20.19 or later run

What you need: Node.js 20.19 or later, the instruction.md package (npm i -g instruction.md, 0.11.0 or later) and @instruction.md/agents 0.4.1 or later, which instruction agents … runs. Every instruction agents … command also runs, without installing anything, as npx -y @instruction.md/agents …, and every instruction … command as npx -y instruction.md ….

Set up

In your project's folder, signed in (instruction login), run:

Shell
instruction agents follow instruction://acme/support-agent@stable --host kiro --write

Its hook files aren't documented well enough for the command to write them. So it writes .instruction/follow.json and .instruction/.gitignore, and prints what to add by hand:

What the command prints
Kiro: add two hooks (Agent hooks → +, or a file in .kiro/hooks/) whose action runs a command:
  on Agent Spawn / SessionStart: npx -y @instruction.md/agents hook kiro --event SessionStart
  on Prompt Submit:              npx -y @instruction.md/agents hook kiro --event PromptSubmit
Kiro adds what the command prints to the agent's context. Without hooks, a steering file it always includes:
  npx -y @instruction.md/agents watch --out .kiro/steering/instruction-md.md   (git-ignore it)
Kiro's two hooks, added by hand.

What happens

Kiro adds what a hook's command prints to the agent's context. A session gets the instruction's whole text when it starts, and a new version at your next prompt. The hook answers in plain text, and prints nothing while the version is current.

Without hooks, a steering file that Kiro always includes works too. Kiro reads it at a session's start:

Shell
instruction watch instruction://acme/support-agent@stable --out .kiro/steering/instruction-md.md --url https://instruction.md/mcp

The MCP server

Kiro reaches instruction.md through the instruction command's stdio server. instruction connect --host kiro <uri> prints:

.kiro/settings/mcp.json
// .kiro/settings/mcp.json — Kiro reaches instruction.md through this CLI's stdio server
{
  "mcpServers": {
    "instruction-md": {
      "command": "npx",
      "args": [
        "-y",
        "instruction.md",
        "mcp",
        "--follow",
        "instruction://acme/support-agent@stable",
        "--url",
        "https://instruction.md/mcp"
      ]
    }
  }
}
// sign the bridge in once: npx -y instruction.md login
// a steering file Kiro always includes, kept current (git-ignore it): npx -y instruction.md watch instruction://acme/support-agent@stable --out .kiro/steering/instruction-md.md --url https://instruction.md/mcp
// or, with hooks: npx -y @instruction.md/agents connect --host kiro instruction://acme/support-agent@stable --with-hooks --write (it says how to add them)

Caveats and what isn't verified

  • Not yet verified: stdin fields; hook file keys. Each command names its event with --event, so the hook doesn't depend on them.

Check it worked

Run the hook by hand, as the tool would at that event. It prints what the tool receives: the instruction's whole text the first time, and nothing when you run it again right away, because a session gets each version once.

Shell
echo '{}' | npx -y @instruction.md/agents hook kiro --event SessionStart --dir .

Then start a new session and ask which instructions it follows. Once a session has read it, .instruction/current.md holds the copy the hooks keep, and the instruction's Agents card counts the follower under this tool.

Stop following

  • Delete the two hooks in Kiro (or their files in .kiro/hooks/).
  • Delete .instruction/follow.json, or the whole .instruction/ folder.

If it doesn't work

What you seeWhyWhat to do
Running the hook by hand prints nothingNo .instruction/follow.json in the folder or above it, up to the repository's root; or it gave this version moments agoRun the setup in the project's folder, or pass --dir. A version the session already has isn't given again: nothing is wrong
instruction.md: couldn't read …; this session goes on without itOffline, not signed in, or the address is wrong, and there is no copy yetinstruction login, then check the address in .instruction/follow.json
instruction.md: a newer version of … is held (…)The new version's signature doesn't check out, and the follow file asks for oneNothing to do on this machine: the session keeps the version it has. See How following works
A private instruction isn't readThe command isn't signed ininstruction login (--device on a machine without a browser)
Still stuckAsk us

Last checked against the product:

Was this page helpful? Report a problem