NeuralTrust controls
Install TrustGuard from the
trustguard-kiro-plugin
repository, from a checkout or through MDM. Kiro hooks are defined per
workspace, so the hook files go into each project you want protected. Configure
TrustGate separately in Kiro’s
mcp.json.
Deployment options
Before you start
Create the policy in Observe mode. Observe records decisions in Activity
without enforcing them. Review the results, then switch the policy to
Enforce. See Policies.
Developers do not need NeuralTrust accounts for the hooks path.
Set up prompt and tool screening (TrustGuard)
Install from a checkout (pilot)
make setup-key writes ~/.trustguard/kiro.json (chmod 600) and sends one
harmless test prompt to /v1/evaluate. It asks for four values:
make install-local WORKSPACE=…:
- Copies the hook runtime (
trustguard-hook.sh,trustguard_hook.py) to~/.trustguard/kiro/ - Writes
trustguard-prompt-submit.json,trustguard-pre-tool.json, andtrustguard-post-tool.jsoninto<workspace>/.kiro/hooks/, with an absolute path to the runtime. Kiro runs hook commands with the workspace as cwd, so relative paths are unreliable
make install-local WORKSPACE=… for every project you want protected;
the runtime is shared. Without make, run scripts/setup-key.sh and
scripts/install.sh /path/to/project.
Deploy under MDM (enterprise)
An MDM deployment consists of three components:
Managed key config.
When the managed file includes
api_key, its data_url, api_key, and
fail_mode cannot be overridden by the user file or environment variables. See
Configuration.
Set up governed tool access (TrustGate)
Kiro treats TrustGate as a remote MCP server: oneurl per MCP application,
and the agent sees the merged toolkit that application is routed to. Copy the
endpoint from the application’s Connect tab:
.kiro/settings/mcp.json (workspace) or ~/.kiro/settings/mcp.json
(user). From the command palette, Kiro: Open workspace MCP config (JSON) and
Kiro: Open user MCP config (JSON) open the two files. When both exist, Kiro
merges them and the workspace file takes precedence.
OAuth applications (recommended). Only url is required:
${…} environment reference:
"X-AG-Gateway-Slug": "<gateway-slug>" to
headers unless the MCP host already scopes the
gateway.
TrustGate tool calls pass through the TrustGuard hooks like any other MCP call.
Verify
Hooks.- In Kiro, open the Agent Hooks panel and confirm
trustguard-prompt-submit,trustguard-pre-tool, andtrustguard-post-toolare listed. - Ask the agent to run a shell command.
- Confirm the event in TrustGuard Activity.
0 means allowed; exit 2 means denied, with the reason on stderr.
MCP.
- Open the MCP servers view in the Kiro panel and confirm TrustGate is connected.
- Ask the agent to use a tool from a toolkit bound to that application.
- Confirm the call in TrustGate Activity.
Reference
Coverage
TrustGuard can evaluate Kiro prompts, commands, file writes, and tool calls from
a local checkout during a pilot or from an MDM deployment.
Session taint. A blocked prompt or a blocked tool result taints the Kiro
chat. Every later tool call in that chat is denied locally, without calling the
API, until the developer starts a new chat. Taint markers live in
~/.trustguard/logs/kiro/taint/.
Prompts. Kiro ignores the exit code of UserPromptSubmit hooks today
(kirodotdev/Kiro#11050), so a
blocked prompt still reaches the model. The plugin enforces the block through
session taint: no tool can run in that chat afterwards.
Ask. The result of an ask verdict depends on the event:
Masking. On a DLP
transform verdict for a tool call, transform_action
decides the outcome: mask (default) runs the tool with the masked input,
ask shows the masked input for approval, and deny blocks. If TrustGuard
returns no masked payload, the call is denied. A prompt cannot be rewritten; the
agent is told not to repeat the sensitive value. On a tool result, a transform
is logged, or taints the session when transform_action is deny.
Limits. Hooks run only in a trusted workspace and only for workspaces with
the hook files installed. Commands the developer types in Kiro’s terminal do not
go through hooks; only agent actions are covered.
A PostToolUse block cannot erase output the tool already produced. The plugin
tells the agent to treat the result as untrusted, not to follow instructions in
it or repeat sensitive values, and taints the session.
The hooks do not evaluate model responses or tool declarations. Use TrustGate to
control which tools are available.
What is evaluated
Every hook calls
POST /v1/evaluate with the
collector tgk_… key, and the policy’s
detectors decide the verdict.
Kiro names MCP tools mcp_<server>_<tool>. When the server is listed in the
workspace or user mcp.json, the plugin strips the server prefix, so
params.name is the <tool> segment; otherwise the full name is sent. Gate on
the short tool name.
Configuration
kiro.json (TrustGuard hooks only). ~/.trustguard/kiro.json (chmod 600;
path overridable with TRUSTGUARD_KIRO_CONFIG). It never holds MCP values.
Precedence: environment > user file > managed file > default. When the managed
file includes
api_key, data_url, api_key, and fail_mode are locked.
mcp.json (TrustGate only). Two scopes:
Deployment ownership.
Attributes
attributes.collector.type = "ide"attributes.source.application = "kiro-plugin"attributes.kiro: the non-content hook fields, such as the event name and cwdattributes.tool.namefor shell commands and tool results; for MCP tool calls the name is on the payload (params.name)consumer_idandattributes.user.emailonly when set inkiro.json. Kiro does not expose the account email to hooks
consumer_id (for example through MDM or TRUSTGUARD_CONSUMER_ID) to get
per-developer attribution in Activity.
Gate on source.application and/or tool.name / tool.command.
Troubleshooting
Logs. The plugin log is
~/.trustguard/logs/kiro/calls.jsonl. By default it
records only blocks, denials, taints, and errors, without content. Set
"debug": true to log every call with its request; this can include the
sensitive data TrustGuard is masking, so turn it off afterwards. The API key is
never logged. Kiro’s own log shows whether hooks fired and what they returned:
~/Library/Application Support/Kiro/logs/<timestamp>/window*/exthost/kiro.kiroAgent/Kiro Logs.log.
Related
- Policies: Gates: Ask and Block configuration
- Evaluate API: requests sent by the hooks
- MCP overview: applications, catalog merging, and upstream authentication
- TrustGate authentication: API key and OAuth2 authentication for MCP applications
- How it works: what each collector can enforce
- Plugin repository: source, install scripts, and tests
- Kiro hooks docs · Kiro MCP docs