Skip to content
Back to search

splabs

MarketplaceWorks with Claude CodeGitHub

Silicon Psyche Labs: a deterministic gate in front of every action your coding agent takes.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 20 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/SiliconPsycheLabs/gate with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/SiliconPsycheLabs/gate'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/siliconpsychelabs--gate/badge.svg)](/listings/siliconpsychelabs--gate)

HTML

<a href="/listings/siliconpsychelabs--gate"><img src="/api/listings/siliconpsychelabs--gate/badge.svg" alt="findsafeskills safety rating" /></a>

Install

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

pip install "git+https://github.com/SiliconPsycheLabs/gate@v0.1.45"

Requires Python 3.10+. Rules are evaluated with [Cedar](https://www.cedarpolicy.com/) (`cedarpy`); shell commands are parsed with `bashlex`.

This package is the engine: it normalises actions, computes provenance and evaluates Cedar rules. It ships no rules. The maintained rule packs, drawn from what agents actually try, are served by the gate service on [splabs.io](https://splabs.io); on your own machine the engine runs the rules you write.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 25 lines
  1. {
  2. "name": "splabs",
  3. "description": "Silicon Psyche Labs: a deterministic gate in front of every action your coding agent takes.",
  4. "owner": {
  5. "name": "Silicon Psyche Labs",
  6. "url": "https://splabs.io"
  7. },
  8. "plugins": [
  9. {
  10. "name": "splabs-gate",
  11. "source": "./claude-code-plugin",
  12. "description": "Every tool call Claude Code makes checked against fixed rules before it runs: allowed, refused, or held for your approval. Logged and counted on your console.",
  13. "category": "security",
  14. "tags": [
  15. "security",
  16. "guardrails",
  17. "permissions",
  18. "audit"
  19. ]
  20. }
  21. ],
  22. "renames": {
  23. "gate": "splabs-gate"
  24. }
  25. }
README.md · README · 355 lines
  1. # gate
  2. A deterministic gate for the actions of AI agents.
  3. Every action an agent is about to take (run a shell command, write or delete a file, call a URL, push to git,
  4. install a package, change a service) is turned into a structured record, checked against rules you wrote, and
  5. **allowed**, **denied** or **held for a person**. The model gets a fixed reply. Same action, same rules, same answer,
  6. every time.
  7. Built for agents that run on models you own (an open-weights model behind vLLM driven by an agent framework, or a
  8. hand-written loop), where nothing between the model and your shell decides what is allowed.
  9. From [Silicon Psyche Labs](https://splabs.io). Apache-2.0.
  10. ## Machines and business systems (v0.1.56)
  11. A tool call is also read by what its protocol says, not only by the words of its name: Modbus functions and
  12. registers, OPC UA writes and method calls, S7 and other PLC modes, programs and forced I/O, BACnet writes and their
  13. priority, MQTT command topics, G-code lines, ROS 2 topics and services, MAVLink commands, Home Assistant
  14. `domain.service`, breakers and inverters, SAP transaction codes, function modules and OData entity sets, bank fields in
  15. any system (an IBAN is checked by its checksum), postings, filings, payroll, signatures, prices, computer-use clicks and
  16. outbound calls. The record gains `effects` (setpoint, actuate, motion, mode, program, safety, physical_access,
  17. bank_details, ledger_post, money, commitment, filing, pay_change, grant, price, delete, gui_opaque, gui_sensitive,
  18. call), `domain`, `assets`, `values` and `amount_max`.
  19. The owner declares their machines in `Config.assets`:
  20. ```python
  21. Config(assets=[
  22. {"match": "opcua:ns=2;s=Line1.Oven.*", "class": "production", "min": 150, "max": 250},
  23. {"match": ["plc:*Safety*"], "class": "safety"},
  24. {"match": "ros:/cmd_vel", "class": "lab", "max_writes": 20},
  25. ])
  26. ```
  27. and the record says, for each action, which classes it touches, whether a target is undeclared and whether a value is
  28. outside its range. The session remembers a bank-detail change (so a payment after it can be refused) and how many
  29. writes each machine received.
  30. ## Plans read step by step (v0.1.61)
  31. `gate.check_plan(plan, session)` reads a compound shell line (`a && b ; c || d`, several lines) or a list of actions
  32. (`{"type": "plan", "steps": [...], "edges": [[from, to], ...]}`, the tool calls of one model turn) as a graph. Each step
  33. is decided by the same rules, in order, in a copy of the session; `a && b` and `a || b` make b need a, and a file an
  34. earlier step writes that a later step reads, runs or deletes is a data edge. A step that needs a step that did not pass
  35. is `blocked` and never offered on its own; when a shell line as a whole does not pass and no single step shows why, no
  36. step is offered. The answer lists the steps that can run, the ones held, refused and blocked, with one reply line per
  37. step. The session is not changed: send each step that runs through `check()` as usual.
  38. ## Why deterministic
  39. You cannot tell from text alone whether an action is the one you wanted: a planted instruction and a real request
  40. can look exactly the same to any classifier. So the gate does not try to guess intention. It enforces what you
  41. declared: which directories can change, which hosts can be reached, which branches can be pushed, which operations
  42. need a person. Its correctness is measured against your rules, never against what the agent "meant", and it is
  43. not a safety rating.
  44. What it gives you is a ceiling on what an agent can do, and an exact count of how often the agent tried to go past it.
  45. Every input a rule reads is computed deterministically from the action and the session transcript (parsing, path
  46. resolution, string matching for provenance). No model, classifier or probability score feeds a decision: the same
  47. action in the same session always gets the same answer, and an action either passes or it does not.
  48. ## Install
  49. ```bash
  50. pip install "git+https://github.com/SiliconPsycheLabs/gate@v0.1.45"
  51. ```
  52. Requires Python 3.10+. Rules are evaluated with [Cedar](https://www.cedarpolicy.com/) (`cedarpy`); shell commands are
  53. parsed with `bashlex`.
  54. This package is the engine: it normalises actions, computes provenance and evaluates Cedar rules. It ships no rules.
  55. The maintained rule packs, drawn from what agents actually try, are served by the gate service on
  56. [splabs.io](https://splabs.io); on your own machine the engine runs the rules you write.
  57. ## Claude Code
  58. Every action of your Claude Code sessions (shell commands, file writes, web fetches, MCP tool calls) goes to the gate
  59. before it runs. Create a gate-only key in Settings on [splabs.io](https://splabs.io) (it starts with `psa_gate_` and
  60. works only on the gate). Then install it one of two ways; both run the same hook.
  61. **As a Claude Code plugin** (no pip; needs Python 3 on the machine). Inside Claude Code:
  62. ```
  63. /plugin install splabs-gate --marketplace SiliconPsycheLabs/gate
  64. ```
  65. On Claude Code older than 2.1.275, run `/plugin marketplace add SiliconPsycheLabs/gate` and then
  66. `/plugin install splabs-gate@splabs`. Claude Code asks for the key (kept in the system's secure store), the mode
  67. and the hosts the agent may contact without asking; `/config` changes them later. The plugin (folder
  68. `claude-code-plugin/`) ships the hook only: if the service cannot be reached in enforce mode, an action that cannot be
  69. checked is refused. With the package installed too (below) and `GATE_PACKS_DIR` pointing to a directory of rule
  70. packs, the engine decides on your machine instead.
  71. **With pip:**
  72. ```bash
  73. pip install "git+https://github.com/SiliconPsycheLabs/gate@v0.1.45"
  74. gate claude-code install --key psa_gate_...
  75. ```
  76. `gate claude-code status` shows the setup, `gate claude-code uninstall` removes the hook. Options: `--scope project`
  77. (this repository only), `--egress host1,host2` (hosts allowed without asking), `--redact-file` (a `KEY=value` file
  78. whose values are never sent). If both are installed, the plugin's hook stands down and this one decides.
  79. Either way it starts in **shadow mode**: the gate decides and logs, nothing is blocked, and you see on the console what
  80. it would have stopped. When the count looks right, switch to **enforce** (the plugin's Mode option, or the same
  81. command with `--mode enforce`): a refused action is refused in Claude Code with the rule's fixed reply, a held one
  82. becomes Claude Code's normal "allow?" prompt and your answer is logged on the decision. The service's rules protect the hook
  83. itself in enforce mode: an agent's edits to `.claude/settings*.json`, the hooks, `~/.claude/plugins/` and
  84. `~/.splabs-gate` are refused. macOS and Linux.
  85. ## Quick start
  86. ```cedar
  87. // my_rules.cedar
  88. @id("permit-all")
  89. permit (principal, action, resource);
  90. @id("no-force-push")
  91. @reason("force pushes are not allowed.")
  92. forbid (principal, action, resource)
  93. when { context.n.git_force };
  94. ```
  95. ```python
  96. from gate import Gate, Config, PolicySet
  97. gate = Gate(PolicySet.from_paths(["my_rules.cedar"]), Config(workspace="/work/repo"), log_path="gate.jsonl")
  98. session = gate.new_session()
  99. session.observe_user("The tests in tests/test_api.py fail, please fix them.")
  100. d = gate.check({"type": "shell", "command": "pytest -q tests/test_api.py"}, session=session)
  101. d.outcome # "allow"
  102. d = gate.check({"type": "shell", "command": "git push --force origin main"}, session=session)
  103. d.outcome # "deny"
  104. d.reply # "DENIED by rule no-force-push: force pushes are not allowed. ..."
  105. ```
  106. With a directory of rule packs (`common.cedar` plus `coding.cedar`, `ops.cedar`, `strict.cedar`, `harness.cedar`), set
  107. `GATE_PACKS_DIR` or call `gate.set_packs_dir(...)`, then `Gate.from_pack("coding", ...)` loads `common` and `coding`.
  108. Wrap your tool executor so nothing runs without the gate:
  109. ```python
  110. from gate.adapters import action_from_openai_tool_call, guarded
  111. run = guarded(gate, session, execute=my_tool_executor, on_confirm=ask_a_human)
  112. result = run(action_from_openai_tool_call(tool_call)) # executes, or returns the gate's fixed reply
  113. ```
  114. Tell the session what the tools returned, so the gate knows where each value came from:
  115. ```python
  116. session.observe_tool_output("read_1", file_contents)
  117. ```
  118. ## Command line
  119. ```bash
  120. gate check action.json --policies my_rules.cedar --config config.json --transcript transcript.json
  121. gate validate my_rules.cedar
  122. gate replay gate.jsonl --policies my_rules.cedar
  123. gate packs
  124. ```
  125. `check` exits 0 on allow, 1 on deny, 2 on confirm. `validate` checks every rule against the context schema, so a
  126. rule that names a field that does not exist is caught before it runs. `replay` re-runs a decision log against new
  127. rules and reports which decisions would change: it is the tool for writing rules from what your agents actually did.
  128. `--pack` loads packs from `GATE_PACKS_DIR`; `gate packs` lists which are installed. See `examples/`.
  129. ## Actions
  130. | `type` | fields |
  131. |---|---|
  132. | `shell` | `command`, optional `cwd` |
  133. | `file.read`, `file.write`, `file.delete` | `path`, optional `cwd` |
  134. | `http` | `url`, optional `method`, `body` |
  135. | `git`, `package.install`, `service` | `argv` (list), optional `cwd` |
  136. | `tool` | `name`, `arguments` (object or JSON string): a tool that is none of the above, such as an MCP server's tool (`mcp__<server>__<tool>`) or a harness built-in |
  137. An action no rule permits is denied.
  138. A `tool` call is recorded by name: `tool_name`, `tool_server` (the MCP server, empty for a built-in), `tool_verb_class`
  139. (`read` when the name starts with a reading verb such as `get`, `list`, `search`; otherwise `write`; `check` followed by an active test such as `sqli`, `xss`, `ports` or `exploit` is a `write`) and
  140. `tool_targets`, the values of the arguments that name a target (`to`, `cc`, `recipient`, `email`, `owner`, `repo`,
  141. `channel`, `account`, `url`, `webhook`, `assignee` and the like, at any depth). Targets get a provenance like hosts and
  142. paths do.
  143. What a tool call reaches is recorded in the same fields as a shell command or an HTTP request, so the same rules
  144. apply to it. A tool that runs commands (a name with `execute`, `run`, `shell`, `terminal`, `command` and the like, and
  145. a `command`, `cmd` or `script` argument) has its command normalised as a shell command (`tool_shell_command`). A full
  146. URL in a `url`, `endpoint`, `webhook` or similar argument is a network request to that host (`hosts`, `urls`). A read
  147. from a secret store sets `tool_reads_secret`; a call to an MCP server that is not on the agent's own machine sets
  148. `tool_outbound`; a tool named for sending a file to an outside server with a local path in its arguments sets
  149. `tool_uploads_local_file`. The files a tool reads, writes or deletes (`path`, `file`, `source`, `destination` and the
  150. like, at any depth) go to `reads`, `writes` and `deletes`; the hosts in a probe tool's `host`, `target`, `ip`,
  151. `domain` arguments go to `hosts`. An action that moves money sets `moves_money` and `payment_targets`.
  152. Report the tool definitions the agent was given with `Session.observe_tools(definitions, server=...)` at the start
  153. and whenever they are listed again (MCP, OpenAI and Anthropic shapes). The first definition of each tool is its pin;
  154. a call to a tool whose description or parameters no longer match the pin sets the fact `tool_definition_changed`.
  155. `Session.repin(...)` makes the new definition the pin.
  156. Other fields a rule can read: `tool_words` (the words of a tool's name, `deleteRepository` gives `delete`,
  157. `repository`), `invocations` (each program with its first one or two words, `npm publish`, `gh pr merge`), `http_path`
  158. (the path of an HTTP request), `code_calls` (the dotted calls in inline code, lower-cased) and `destructive_sql` (a
  159. destructive statement sent to a database from a client or from code). A tool that installs packages gets the same
  160. package fields as the install command.
  161. Shell commands are parsed and normalised: the commands run (through `sudo`, `env`, `xargs` and other wrappers), pipes,
  162. redirects, substitutions, `cd` changes, paths read, written and deleted, hosts and URLs, git push targets and force
  163. flags, package names, pinning and registries, the verb class of service tools (read, mutate, destroy).
  164. **It fails closed.** A command that does not parse, or that runs hidden code (`eval`, `sh -c`, a sourced script,
  165. piping into an interpreter, decoding then executing), is marked so in the record: the shell is a full language, and
  166. what cannot be normalised is never read as harmless. A rule that errors at evaluation denies the action; it is never
  167. skipped.
  168. ## Rules
  169. Rules are Cedar policies. The request is:
  170. - principal `Agent::"<name>"`, action `Action::"<type>"`, resource `Target::"<type>"`;
  171. - `context.n`: the normalised record (see `gate/normalize.py::default_record` for every field);
  172. - `context.facts`: provenance sets (`from_user`, `from_system`, `from_tool_output`, `from_model`), session facts
  173. (`secret_read_in_session`, `denials_in_session`, `holds_in_session`);
  174. - `context.config`: `workspace`, `egress_hosts`, `environment`, `change_window`, `default_branches`.
  175. Annotations the gate reads:
  176. ```cedar
  177. @id("egress-from-data") // stable id, used in replies and logs (required on forbid)
  178. @outcome("confirm") // on a forbid: hold for a person instead of denying
  179. @reason("this address first appeared in tool output, not in the user's request.")
  180. forbid (principal, action, resource)
  181. when { context.n.network && context.n.hosts.containsAny(context.facts.from_tool_output) };
  182. ```
  183. Nothing is allowed unless a `permit` matches, and a `forbid` always wins over a `permit`.
  184. ### The maintained rules
  185. The rule packs we maintain (`common`, `coding`, `ops`, `strict`, `harness`) are not in this repository. They are
  186. served by the gate service on [splabs.io](https://splabs.io), where each decision names the rule that made it and the
  187. count is shown; your own rules sit on top of them there, or run alone with this engine.
  188. ### Provenance
  189. `Session` records the user's messages and the tool outputs. Each host, URL, path, package name and tool target in an action gets a
  190. source: `user` (named by the user), `system` (in your configuration), `tool_output` (first seen in what a tool
  191. returned) or `model` (appears nowhere before). An attacker who plants text in a web page or a file must plant its own
  192. address or package name too, and that value arrives with `tool_output` provenance however the text is worded. A package is matched by its name: a version, extras or an
  193. index marker attached to it do not change where the name came from.
  194. ## Measured
  195. On 3,000 distinct shell commands from real coding-agent sessions (OpenHands on Python repositories,
  196. `nebius/SWE-rebench-openhands-trajectories`) every command parses. On the 7,587 human-written one-liners of NL2Bash,
  197. 99.7% parse; 20 of the rest are not valid shell as written.
  198. ## Speed
  199. A check is a parse of the action, a provenance lookup and one Cedar evaluation. The policy set is parsed once. Above
  200. 2,000 rules the policies are grouped by the first fact their condition needs (`network` is true, `hosts` is not
  201. empty, `http_method` is `DELETE`) and a check evaluates only the groups whose fact holds on its record; the answer is
  202. the one Cedar gives on the whole set. Provenance is computed incrementally: a check scans only the texts observed
  203. since the previous one. On one core of a cloud container, with 54 rules: about 1 ms per check; with 20,000 added
  204. rules that never match, about 4 ms; with 20,000 copies of real rules, about 31 ms; with 2,000 tool outputs of 300
  205. words in the session, about 4 ms.
  206. ## Log
  207. With `log_path`, every decision is appended as one JSON line (action, normalised record, facts, outcome, rule ids),
  208. flushed to disk at once, as a **hash chain**: each line carries the hash of the line before it and its own, so a line
  209. changed, removed or moved afterwards is found by `gate log verify gate.jsonl` (exit 1, with the first bad line). With
  210. `GATE_LOG_HMAC_KEY` set, each line also carries an HMAC of its hash, so a log rewritten from scratch without the key is
  211. told apart. Use the log to write new rules (`gate replay`) and to count: denials and holds per 100 tasks, per rule, and
  212. how many of them were false blocks on tasks you mark as legitimate.
  213. ## Task contract
  214. `Config(contract={...})` declares what one session's work may touch, before the agent reads any data: `tools` (name
  215. patterns), `hosts` (`*.` matches subdomains), `targets` (recipients, accounts, ids a tool sends to or acts on), `paths`
  216. (directories or patterns the work may write or delete under). What an action touches outside it is the fact
  217. `outside_contract` (`["host:evil.example", "target:drop@x.io"]`), for a rule to hold or refuse. `Gate.approve` on a held
  218. action widens the contract by what it touched, for the rest of the session. A dimension left out constrains nothing; an
  219. unknown dimension is refused. The orchestrator that starts the agent, or the owner, writes the contract from the task.
  220. ## MCP enforcement point
  221. ```bash
  222. gate mcp-proxy --server-name crm --pack coding --config owner.json --task "update Anna's phone" --log gate.jsonl \
  223. -- python crm_server.py
  224. ```
  225. The agent's MCP client starts this instead of the server (stdio). A `tools/call` reaches the server only when the gate
  226. allows it; a refused or held call gets an MCP tool error with the gate's fixed reply; a call the gate cannot check is
  227. refused. `tools/list` results are reported to the session (a tool that changes its definition is seen), tool results
  228. are reported as tool outputs (values taken from them carry that provenance), and `--task` is the session's user message.
  229. Held calls are not run, since stdio has no person to ask: list approved values in the task contract.
  230. ## Signed rule packs
  231. A packs directory can carry `manifest.json` (packs version, the engine version it needs, the SHA-256 of every pack) and
  232. `manifest.sig` (Ed25519). With a manifest, every pack must match it and no unlisted pack may be present; with
  233. `GATE_PACKS_PUBKEY` (base64 of the raw public key) set, a directory without a valid signature is refused. `gate bundle
  234. keygen`, `gate bundle make <dir> --packs-version V` (signs with `GATE_PACKS_PRIVKEY`), `gate bundle verify <dir>`.
  235. Signing and checking signatures need `pip install "splabs-gate[signing]"`.
  236. ## Limits
  237. - The gate checks the action, not what the program it launches does afterwards. Run agents in a sandbox (container,
  238. restricted user, network policy) as well: the gate decides what is attempted, the sandbox limits what an allowed
  239. command can reach.
  240. - Path and host extraction from arbitrary programs is best effort; for unknown programs only path-like arguments and
  241. redirects are seen. Tighten with rules on `context.n.commands`.
  242. - `/tmp` is writable by default (`Config.extra_writable`); set it to `[]` to forbid.
  243. - `~` is the home of the user the gate runs as. When the gate runs on another machine or as another user (a hosted
  244. gate), set `Config.home` to the agent's home.
  245. - `Config.model_paths` lists the directories that hold the models in use (default: the Hugging Face, torch, Ollama
  246. and LM Studio caches under the agent's home); a write, move or deletion under them, or of a weights file anywhere,
  247. sets `writes_model_weights`.
  248. - `Config.workspaces_root`: the directory that holds the workspaces of agents that share a machine.
  249. - `Config.off_limits` (v0.1.64): paths and services the agent must never read or contact (an evaluator's tests, a
  250. harness's logs and control files). A path matches itself and what is under it, also when written as a whole token
  251. in a command or in code; `host:port` and bare host entries match URLs and hosts. Sets `reads_off_limits`. A search
  252. of the whole disk (`find /`, a recursive `grep` on `/`) sets `sweeps_root`.
  253. - Provenance of files (v0.1.70): the session keeps the paths an action reaching the network wrote or named (a
  254. download, a clone, code with a download call) and what was made from them (an archive unpacked, a copy); session
  255. facts `reads_fetched` and `reads_fetched_eval` (an evaluation's tests, solution, grader or expected outputs among
  256. them, record field `eval_artifact_names`), and `reads_unowned_shared` (a file in a writable shared folder such as
  257. `/tmp` that the session neither wrote nor fetched). `reads_outside_scope` (v0.1.69) marks a read outside the
  258. workspace, the writable folders, the contract's folders and the system's read-only folders.
  259. - `ls`, `find`, `du` and `tree` with no path read the current directory: `cd /root && ls` is a look at `/root`.
  260. - Code given inline to an interpreter (`python -c`, `node -e`, a here-document) is scanned for the plain forms of
  261. network access, process start, a read of the whole environment, files removed or written with a path written out,
  262. text decoded and then executed, and statements sent to a database. Code built at run time is out of reach of any
  263. reading of text: keep the sandbox.
  264. - Provenance is string matching. A value the attacker gets the user to type is `user`.
  265. ## Development
  266. ```bash
  267. pip install -e ".[dev]"
  268. pytest -q
  269. ```
  270. `ci/github-actions-test.yml` is the CI workflow (tests on Python 3.10 to 3.13); it goes in `.github/workflows/`.
  271. ## License
  272. Apache-2.0. See `LICENSE`.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.