D
dvchinx/countersign
Runtime guardrails for Spring AI agents: policy-enforced, human-approved, signed tool calls (incl.
更新 2026-11-19
在 GitHub 查看 ↗直链 · 无中转页
- ★ 数取值
- 0 ★ · dvchinx/countersign · 取自 GitHub 搜索 API · (2026-11-19 20:00:48 核对)
- 来源明细
- 从该仓库的 GitHub 页面直接读取 · 条目类型:开源项目
- 收录与活跃
- 收录于 2026-11-20 · 最近见到 2026-11-20 · 共见到 1 次 · 被 1 个来源列出
- 评分构成
- 综合分 103 · 1 个来源 · repo
常见问题(答案都来自我们的记录)
它适合谁 / 用来做什么?
我们把它归在这些标签下: 开源项目。标签来自条目自身,不是我们强加的分类。
谁维护它、还在更新吗?
仓库
dvchinx/countersign;我们收录于 2026-11-20;最近见到 2026-11-20。这里没有"官方认证"或"质量评级"——我们只记录来源与时间。README 原文(英文,未翻译) · 在 GitHub 读完整 README →
Countersign
以下摘录自该仓库的 README(片段)
Your agent proposes. Countersign decides.
Runtime guardrails for Spring AI agents: policy-enforced, human-approved, signed tool calls (incl. MCP).
Fail-closed, auditable. One starter dependency, no Python sidecar.
English · Español
In law, a countersignature is the second signature that makes a document valid.
Countersign adds that second signature to your AI agent's actions: every tool call the model
proposes is checked against your policies, sent to a human when it needs one, and recorded in an
Ed25519-signed, hash-chained receipt before anything runs.
Think of it as Spring Security for agent tool calls. It works with Spring AI @Tool methods,
ToolCallbacks and MCP tools, and you don't have to change your tools.
## Demo
> The recorded GIF ships with 0.1.0. This is what the banking-agent example shows:
The model never sees a stack trace. It gets a structured refusal it can explain to the user, and
you get a receipt you can verify later.
## Quickstart
> Pre-alpha: this is the API we are building toward 0.1.0. Watch the repo to know when it lands.
1. Add the starter
xml
io.github.dvchinx
countersign-spring-boot-starter
0.1.0
2. Write a few policies in application.yml
yaml
countersign:
default-decision: deny # fail closed: anything not allowed is blocked
policies:
id: no-destructive-sql
tools: ["db."]
when: "#args['query'] matches '(?i).\\b(drop|truncate|delete)\\b.'"
decision: deny
id: transfers-need-approval
tools: ["payments.transfer"]
when: "#args['amount'] > 1000"
decision: require-approval
3. That's it. Your existing tools are wrapped automatically:
java
@Tool(description = "Transfer money between accounts")
@RequiresApproval(reason = "Moves real money") // optional: per-tool policy as an annotation
public TransferResult transfer(String from, String to, BigDecimal amount) { ... }
On startup you'll see one line telling you Countersign is active and which default it uses.
## What happens on a tool call
1. Build a ToolInvocation: tool name, parsed arguments, principal, conversation id.
2. Evaluate it against your policies, in priority order. The first match wins; if nothing matches, the default (deny) applies.
3. Apply the decision: run the tool, refuse it, ask a human, or redact it.
4. Record a receipt: the decision, the matched policies, a keyed hash (HMAC-SHA256) of the arguments (never the raw values), the previous receipt's hash, and an Ed25519 signature.
5. Publish it to your AuditSink, along with Micrometer metrics and observations.
Enforcement happens where the tool runs, not in the list of tools sent to the model. A tool the
model was never offered, or one it was tricked into calling, still has to pass the policy engine.
## How it compares
Countersign does not filter prompts or model output. It governs actions. Use it alongside a
content filter, not instead of one.
| | Countersign | Prompt / output filters | Python guardrail sidecar | if checks inside each @Tool |
| Enforces at the tool call itself | ✅ | ❌ | ⚠️ depends on wiring | ✅ |
| Runs in your JVM, no extra service | ✅ | ✅ | ❌ | ✅ |
| Covers MCP tools | ✅ | ❌ | ⚠️ | ❌ (not your code) |
| Human approval built in | ✅ | ❌ | ⚠️ | ❌ roll your own |
| Signed, hash-chained audit trail | ✅ | ❌ | ❌ | ❌ |
Runtime guardrails for Spring AI agents: policy-enforced, human-approved, signed tool calls (incl. MCP).
Fail-closed, auditable. One starter dependency, no Python sidecar.
English · Español
In law, a countersignature is the second signature that makes a document valid.
Countersign adds that second signature to your AI agent's actions: every tool call the model
proposes is checked against your policies, sent to a human when it needs one, and recorded in an
Ed25519-signed, hash-chained receipt before anything runs.
Think of it as Spring Security for agent tool calls. It works with Spring AI @Tool methods,
ToolCallbacks and MCP tools, and you don't have to change your tools.
## Demo
> The recorded GIF ships with 0.1.0. This is what the banking-agent example shows:
The model never sees a stack trace. It gets a structured refusal it can explain to the user, and
you get a receipt you can verify later.
## Quickstart
> Pre-alpha: this is the API we are building toward 0.1.0. Watch the repo to know when it lands.
1. Add the starter
xml
io.github.dvchinx
countersign-spring-boot-starter
0.1.0
2. Write a few policies in application.yml
yaml
countersign:
default-decision: deny # fail closed: anything not allowed is blocked
policies:
id: no-destructive-sql
tools: ["db."]
when: "#args['query'] matches '(?i).\\b(drop|truncate|delete)\\b.'"
decision: deny
id: transfers-need-approval
tools: ["payments.transfer"]
when: "#args['amount'] > 1000"
decision: require-approval
3. That's it. Your existing tools are wrapped automatically:
java
@Tool(description = "Transfer money between accounts")
@RequiresApproval(reason = "Moves real money") // optional: per-tool policy as an annotation
public TransferResult transfer(String from, String to, BigDecimal amount) { ... }
On startup you'll see one line telling you Countersign is active and which default it uses.
## What happens on a tool call
1. Build a ToolInvocation: tool name, parsed arguments, principal, conversation id.
2. Evaluate it against your policies, in priority order. The first match wins; if nothing matches, the default (deny) applies.
3. Apply the decision: run the tool, refuse it, ask a human, or redact it.
4. Record a receipt: the decision, the matched policies, a keyed hash (HMAC-SHA256) of the arguments (never the raw values), the previous receipt's hash, and an Ed25519 signature.
5. Publish it to your AuditSink, along with Micrometer metrics and observations.
Enforcement happens where the tool runs, not in the list of tools sent to the model. A tool the
model was never offered, or one it was tricked into calling, still has to pass the policy engine.
## How it compares
Countersign does not filter prompts or model output. It governs actions. Use it alongside a
content filter, not instead of one.
| | Countersign | Prompt / output filters | Python guardrail sidecar | if checks inside each @Tool |
| Enforces at the tool call itself | ✅ | ❌ | ⚠️ depends on wiring | ✅ |
| Runs in your JVM, no extra service | ✅ | ✅ | ❌ | ✅ |
| Covers MCP tools | ✅ | ❌ | ⚠️ | ❌ (not your code) |
| Human approval built in | ✅ | ❌ | ⚠️ | ❌ roll your own |
| Signed, hash-chained audit trail | ✅ | ❌ | ❌ | ❌ |
收录徽章(可选)
想把收录标记放进 README 就复制这行,可选,不影响收录。
[](https://anclum.com/zh/s/dvchinx-countersign/)
- 来源
- github · https://github.com/dvchinx/countersign
- 按领域浏览
- 开源项目
- 收录于
- 今天
更多条目
所属领域与标签
每个标签都能点进去看同类的全部条目。数字是当前库里的真实条数。