
PromptSpeak Governance
io.github.chrbailey由 GitHub 帳號 chrbailey 發布v0.4.1更新於 Oct 24, 2026
Pre-execution governance for AI agents. Validates tool calls before they execute.
概覽
一個本機治理層,在 AI 代理的工具呼叫執行前進行驗證與攔截,並提供人工核准擱置、漂移偵測和稽核日誌。
- 可以做什麼
- 驗證治理框架並批次檢查代理動作,支援在不執行工具的情況下試跑完整流程。管理人工核准擱置:列出待處理操作、帶修改參數核准、拒絕,以及調整擱置觸發條件和統計。控制代理生命週期:讀取代理狀態和系統統計,透過斷路器暫停或恢復代理,重設狀態並檢視漂移歷史。建立、撤銷和列出帶受限權限的父子委派。設定治理規則、信心門檻和功能開關,並匯出或匯入設定。掃描程式碼漏洞並執行攔截、擱置、警告或放行策略,以及讀取稽核記錄。
- 適用情境
- 當你執行會呼叫工具的代理,並希望在意圖與執行之間加入確定性檢查時使用,特別適合生產部署或金融交易等高風險操作。也適合需要記錄每次工具呼叫嘗試並人工核准風險操作的受監管情境。
- 執行需求
- 透過 stdio 在本機執行,通常用 npx 從 npm 套件啟動,或從原始碼建置。需要 Node.js 20 或更新版本;僅從原始碼建置時需要 TypeScript 5.3+。無需外部服務、帳號或 API 金鑰;治理資料儲存在本機 SQLite 中。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 PromptSpeak Governance,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
promptspeak-mcp-server
[CI] [npm version] [License: MIT] [Tests]
Pre-execution governance for AI agents. Blocks dangerous tool calls before they execute.
AI agents call tools (file writes, API requests, shell commands) with no validation layer between intent and execution. A prompt injection, hallucinated argument, or drifting goal can trigger irreversible actions. PromptSpeak intercepts every MCP tool call, validates it against deterministic rules, and blocks or holds risky operations for human approval — in 0.1ms, before anything executes.
When to use this
- You run AI agents that call tools (MCP servers, function calling, tool use) and need a governance layer between the agent and the tools.
- You need human-in-the-loop approval for high-risk operations (production deployments, financial transactions, legal filings).
- You want to detect behavioral drift — an agent gradually shifting away from its assigned task.
- You need an audit trail of every tool call an agent attempted, whether it was allowed or blocked.
- You operate in a regulated domain (legal, financial, healthcare) where agent actions must be deterministically constrained.
Install
Claude Code
Add to ~/.claude/settings.json (or project-level .claude/settings.json):
Restart Claude Code. All 56 governance tools are immediately available.
Claude Desktop
Add to claude_desktop_config.json:
As a library
From source
Usage examples
1. Validate a governance frame
Validate that a PromptSpeak frame is structurally and semantically correct before using it. Frames encode governance constraints as symbol sequences — mode first, then domain, action, and entity.
Invalid frames return actionable suggestions:
2. Hold queue workflow — human-in-the-loop approval
When an agent attempts a risky operation (high drift score, low confidence, security finding), the action is held for human review instead of executing. This is the full hold lifecycle: list, inspect, approve or reject.
Step 1: List pending holds
Step 2: Approve with modifications (or reject)
To reject instead:
3. Security scanning — catch vulnerabilities before execution
Scan code content for security issues before an agent writes it to disk. Critical findings block execution; high-severity findings are held for human review.
Use ps_security_gate instead of ps_security_scan to enforce the policy — it blocks on critical, holds high-severity for human review, and warns on medium:
How it works: 9-stage validation pipeline
Every tool call passes through this pipeline. If any stage fails, execution is blocked.
Stages 1-6 are pre-execution — the tool never runs if any check fails. Stages 8-9 are post-execution — they detect drift and can halt the agent for future calls.
Security scanning
When an agent writes code (write_file, edit_file, create_file, patch_file), the content is scanned against 10 detection patterns before execution. Severity determines enforcement:
What works (tested)
All claims below are backed by passing tests (104 tests across 5 test files):
- Pattern detection works. Each of the 10 patterns is tested for true positives AND false positives. Example:
api_key = "sk-1234567890abcdef"is caught;API_KEY = process.env.API_KEYis not. SQL injection catches\SELECT * FROM users WHERE id = ${id}`but not parameterized queries (db.query("SELECT * FROM users WHERE id = ?", [id])`). - Severity enforcement works. Critical findings block execution. High findings hold for review. Medium findings warn but allow. Tested end-to-end through the interceptor pipeline.
- Only write actions are scanned.
read_fileand other non-write actions pass through without scanning, even if their arguments contain vulnerable code. Tested. - Runtime configuration works. Patterns can be enabled/disabled and severity can be changed at runtime via
ps_security_config. A disabled pattern stops firing immediately. Changing a pattern from medium to critical makes it block instead of warn. Tested end-to-end. - Performance is fine. 100-line file scans complete in under 10ms. Tested.
- Multiple findings in one file work. A file with 6 different vulnerability types correctly classifies each into the right severity bucket. Tested.
What does NOT work yet
No hold queue integration for HIGH findings.FIXED. HIGH-severity security findings now create real holds in HoldManager viasecurity_findingHoldReason. They appear inps_hold_listand can be approved/rejected through the normal hold flow.- No auto-scan on
ps_execute. The security scan only triggers in the interceptor'sintercept()method for direct tool calls. If an agent usesps_execute(the governed execution path), the scan runs only if the inner tool is a write action AND the content is passed as a top-level arg. Nested argument structures may bypass scanning. Why:ps_executewraps tool calls in its own argument schema; the scanner checksproposedArgs.content, not deeply nested fields. - No file-path-based scanning. The scanner only examines content passed as arguments. It cannot scan files already on disk — it doesn't read from the filesystem. Why: The scanner is a pure function that takes a string. Adding filesystem access would change the security model.
- Patterns are regex-based, not AST-aware. The patterns use regular expressions, which means they can't understand code structure. A hardcoded secret inside a test fixture or a SQL injection in a comment will still trigger. False positive rates range from 25-70% depending on the pattern (documented per-pattern). Why: AST parsing would add dependencies and complexity. Regex is fast and good enough for a governance layer that holds for human review rather than silently blocking.
- Partial persistence. Holds and circuit breaker state now persist to SQLite (
data/governance.db) and survive server restarts. However, pattern configuration changes (enable/disable, severity changes viaps_security_config) are still in-memory only and reset on restart. Why: Pattern config is lightweight and rarely changed; full config persistence would need a separate config store.
MCP tools (56)
Core governance
Human-in-the-loop holds
Agent lifecycle
Delegation
Configuration
Symbol registry (entity tracking)
Security enforcement
Audit
Architecture
Performance
PromptSpeak adds governance to every tool call with sub-millisecond overhead. Benchmarked on Apple M2 Pro, Node.js 22, Vitest 4.0:
Latency (pre-execution check, 1000 iterations)
Throughput (concurrent operations)
Stress Tests
Suite
Requirements
- Node.js >= 20.0.0
- TypeScript 5.3+ (build from source)
- No external services required — SQLite for symbols and governance persistence
Related Projects
- deeptrend — Structured AI trend feed for autonomous agents. Curated from 14+ sources, synthesized via LLM Counsel, published every 6h as JSON Feed, RSS, and
llms.txt. Designed as a data source for agent monitoring pipelines.
Privacy Policy
https://promptspeak.admin-as-a-service.com/privacy
PromptSpeak does not collect personal data, has no telemetry, and stores all governance data locally in SQLite. See the full policy at the link above.
Data Processing Terms
https://promptspeak.admin-as-a-service.com/dpa
Standard data processing terms for platform integrations (e.g., Anthropic Connectors). PromptSpeak acts as a data processor; no sub-processors, no external data transmission.
License
MIT
來源:README.md,提交 b9c3698
工具
0版本歷史
1- v0.4.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分