Expand description
Gate wire protocol — versioned, env-var-keyed.
Design: [docs/design.md §3.3, §7]. The schema version is held in the
KLASP_GATE_SCHEMA environment variable exported by the generated hook
script, not in the JSON stdin payload — this defends against a
malicious agent that crafts a tool_input field claiming an arbitrary
schema version.
Versioning is independent of klasp’s semver: most binary releases will not bump the schema. Bumping is reserved for genuine wire-format changes (renamed fields, required-field additions, exit-code semantics).
Structs§
- Gate
Input - The Claude Code
PreToolUsepayload klasp consumes from stdin. - Gate
Protocol - Tool
Input - The subset of Claude Code’s
tool_inputklasp inspects. Only theBashtool’scommandfield matters in v0.1; future fields can be added behind#[serde(default)]without bumping the schema.
Enums§
Constants§
- GATE_
SCHEMA_ VERSION - Wire-protocol schema version. Bump only when the JSON shape, exit-code semantics, or env-var contract changes — never for cosmetic releases.
- KLASP_
OUTPUT_ SCHEMA klasp gate --format jsonoutput schema version.- PLUGIN_
PROTOCOL_ VERSION - Plugin subprocess protocol version. Separate from
GATE_SCHEMA_VERSIONso plugin upgrades and gate upgrades evolve independently.