Show HN: Stroq – 本地审计你的编码代理做了什么以及为什么
Show HN: Stroq – a local audit of what your coding agent did and why

原始链接: https://github.com/AGGIB/Stroq

Stroq 是面向 Claude Code、Cursor、Codex CLI 等 AI 编码代理的本地安全工具。它挂载到代理中,在执行前评估工具调用,阻止 `curl | sh` 等危险模式以及包含已知密钥的出站请求,并在命令复用代理先前读取的文本前询问。它还可无钩子审计过去会话:`replay` 检查最近会话是否符合策略,`sent` 报告凭据是否出现在命令中或被阻止。CLI 生成你的会话卡片,仅显示密钥名称,值不会超出本地缓存发送或存储。本地控制台位于 127.0.0.1,提供预览、历史记录与确认。命令包括 `init`、`why`、`attack`、`show`、`replay`、`sent`、`console` 和 `uninstall`。`attack` 在沙箱中测试 36 种已知攻击。它需要 Node.js 22+,采用 Apache-2.0 许可证,且不进行外网调用或遥测。它是一个过滤器,而非沙箱,使用文本级匹配并具有代理特定限制。

Show HN 介绍 Stroq,一款用于编程代理会话的本地基于规则的审计工具。它读取会话日志和命令文本,不使用 LLM 或外部调用,且 `stroq init` 可以添加在危险命令执行前进行提示的钩子。创建者将其定位为帮助捕获风险代理操作;评论者讨论审计相比沙箱、用户隔离、路径/网络限制以及 eBPF/gVisor 方法是否来得太晚。一位用户描述了基于 gVisor 的隔离,采用默认拒绝出站和用户审批。其他人建议后台菜单栏扫描器、基于 LLM 的分析(指出成本和易被欺骗性),以及更广泛的对抗性覆盖。创建者承认规则会遗漏一些情况,但强调开源可定制性,并表示 `stroq inspect` 可以在打开文件夹前警告隐藏的 git 钩子。总体而言,Stroq 提供轻量级的本地可见性和执行前提示,而评论者强调更强的隔离边界。
相关文章

原文

Stroq reads your own Claude Code and Codex sessions and shows how many commands came from text your agent read, and which keys left your machine.

The Stroq card in a terminal, on an example machine: Hoo, an orange pixel owl, beside the counts for 30 days of agent sessions (105 commands your agent ran, 1 that came from text it read, 1 key that left the machine, 1 repo that runs code as soon as an agent opens it) and three moments worth a look, each with a stroq show line

An example: a made-up machine with made-up sessions, keys and hosts. Hoo is Stroq's owl. Your card shows your own sessions.

It reads your last 30 days of sessions, your key files and the folders your agent worked in; prints key names, never values; writes nothing but a small cache under ~/.stroq; and sends nothing. No account, no telemetry.

npx @stroq/cli            a card of your own sessions, like the one above
npx @stroq/cli init       stop it next time: guard your agent
npx @stroq/cli why        why an action was stopped
npx @stroq/cli attack     watch Stroq stop 36 known attacks, in a sandbox
npx @stroq/cli uninstall  remove Stroq

Every moment on the card has a stroq show line that prints the evidence behind it (npx @stroq/cli show 1). stroq help --all lists the other commands. Needs Node.js 22 or newer. Apache-2.0.

Stroq is a local security platform for AI coding agents: Claude Code, Cursor, Codex CLI and others. Its hooks judge every tool call before it runs. They deny curl | sh and outbound calls that carry a known secret from your machine, and they ask you first when a command repeats text the agent read, naming that text. The console shows which agents actually ask Stroq, and every decision with its reason. Sessions you already had can be checked too, without installing anything.

npx @stroq/cli console        # the console: a private page on 127.0.0.1
npx @stroq/cli replay --all   # your Claude Code sessions of the last 30 days against the policy; no hooks needed
npx @stroq/cli sent           # did your agent pass your keys on? key names, never values
npx @stroq/cli init           # hook into your agent and guard the next session

Stroq console, Live screen: the last 8 recorded actions, 4 allowed, 1 asked you, 2 denied, 1 flagged, and a denied action opened into what the agent read, what it did, the decision and the rule

A made-up machine: made-up sessions, keys and hosts. Nothing was executed.

The fifth screen is Rules: try an action without running it, turn rules on with a preview and a test, the history with an undo, and the rules reference. Connected means Stroq's hooks are in the agent's settings, not that the agent calls them: Test hook and Live show that.

Screens from a build just before 0.30.0, reading a made-up machine: made-up sessions, keys and hosts. Nothing was executed.

npx @stroq/cli console                            # a private page on 127.0.0.1
npx @stroq/cli console --workspace /path/to/repo  # the project it should look at

Open the whole link it prints: it carries a key that is new each time the console starts. The console reads what Stroq already records on this machine. It changes an agent's settings or Stroq's policy only after you confirm a preview of that change; checks you run are saved under ~/.stroq.

It listens only on 127.0.0.1, needs no account and has no telemetry. Nothing in it starts your agent: Test hook runs the hook once, offline. Adding hooks from the console needs macOS or Linux; on Windows use stroq init. Details and limits: console guide.

From a source checkout:

pnpm install --frozen-lockfile
pnpm --dir console install --ignore-workspace --frozen-lockfile
pnpm platform:build
pnpm platform --workspace /path/to/repo

stroq replay --last on a staged session: a GitHub issue the agent read scores SUSPECT, and two later commands traced to it would be denied, curl to sh by deny-encoded-exec 18 s later and npx of a package named in the issue by deny-origin-suspect 54 s later; four other actions would be allowed

Output of the 0.29.0 CLI on a made-up Claude Code transcript of the same story; the path is shortened.

stroq replay reads the agent's own transcript, so it works on sessions from before Stroq was installed: which content the agent read, and which later actions came out of it. --all goes through every session of the last 30 days and says which to open. Nothing runs and nothing is sent; the verdicts are today's policy's, not a record of what happened at the time.

stroq sent compares your Claude Code, Codex CLI and Cursor sessions with the credentials on your machine and says where each key went: sent to another company, maybe sent, seen by the AI, used with its own service, or blocked before it ran. It prints names and sources, never values. Start with the session secret scan walkthrough (no session yet? try it with a made-up key).

What a stroq sent finding looks like

Made-up keys, the built CLI's output, trimmed:

stroq sent: did your AI agent pass your keys on?

6 of your 6 keys appear in your agent sessions: 2 sent to another company, 1 maybe sent, 1 seen by the AI, 1 used with its own service, 1 blocked before it ran.

Checked 3 sessions (Claude Code 2, Codex 1), 2026-10-02 to 2026-10-19.
Compared with 6 keys: ~/.aws/credentials, ~/.npmrc, ~/work/shop/.env, ~/work/api/.env.

SENT TO ANOTHER COMPANY: rotate these today (2)
 1. STRIPE_SECRET_KEY  from ~/work/shop/.env
    went to  collector.example, in a curl command
    when     2026-10-11 14:02 UTC · Claude Code · ~/work/shop
    do       revoke it at https://dashboard.stripe.com/apikeys, then update ~/work/shop/.env

SEEN BY THE AI: your agent's model saw these keys (1)
 4. aws_secret_access_key  from ~/.aws/credentials
    seen in  the output of a Read of ~/.aws/credentials
    when     2026-10-02 09:42 UTC · Claude Code · ~/work/api
    note     Not ruled out: 2 later commands in that session could reach the network.
    do       your agent's model saw it; rotate it if that matters: https://console.aws.amazon.com/iam/home#/security_credentials

Stroq names a send only when it sees the key in the command that sent it. A script, a file or a variable can carry a key out without showing it.

stroq attack runs 36 attacks, from public reports and synthetic cells, against your policy in a throwaway home: on 0.30.0, 15 are denied, 21 are asked about, 0 pass through.

What it covers and where it stops

  • Before each action. Native hooks for Claude Code, Cursor, Codex, Copilot CLI, Windsurf and Antigravity, a plugin for OpenClaw, and a stdio MCP proxy. Supported outbound calls containing a known secret can be denied; provenance ties later actions to the tool output they repeat. A question about a value copied from text the agent read is asked once per session in Claude Code, unless the session has started something in the background.
  • After the fact. replay and sent read local session records, including sessions from before Stroq was installed. Old, rotated or unknown values may be missed, and a key that did not show in a command may still have left in a script, a file or a variable. A local transcript match does not by itself prove delivery to a model provider.
  • Local. No outbound network calls from the hooks; the hook of an older Task Lock run speaks only to its local parent controller. No telemetry.
  • Limits. A hook sees only what the host sends it, and that differs by agent and version. Matching is text-level, so a command the model writes from scratch does not trace back to a source. It is a filter, not a sandbox. Read the integration limits before relying on a live hook.

Thank you to everyone who contributes code, reports bugs, tests agent integrations, and improves the docs ❤️

Contributors

stroq.dev

联系我们 contact @ memedata.com