Constitutional guardrails (CONSTITUTION.md) for agent supervisor
还没有人认领这个 Issue。
评估
调研方向
Start with the affected crates listed in the issue: terraphim_agent_supervisor, terraphim_types, and terraphim_agent, then inspect the existing rust-embed and zipsign usage. Define the constitution resource, structured validation and signing boundaries, and integration tests for rejected violations. Done means the documented rules are embedded, validated before execution, logged on rejection, and covered by tests.
由索引模型根据 Issue 内容生成。
描述
Summary
Create an immutable set of architectural principles (CONSTITUTION.md) that terraphim agents cannot violate, even when given explicit instructions to do so. Enforced by terraphim_agent_supervisor as a pre-execution validation step.
Motivation
Inspired by Ouroboros BIBLE.md pattern. The agent system crates are incomplete partly because there is no specification of what agents MUST NOT do. A constitution constrains the design space, making it easier to complete the agent layer because boundaries are clear.
Proposed Principles
- Privacy-first: No data leaves the device unless explicitly configured by the user
- Deterministic-first: Prefer Aho-Corasick automata over LLM when deterministic matching suffices
- Type-safe: No
unwrap()in library crates; all errors propagated viaResult - Compile-time checked: Prefer compile-time guarantees over runtime reflection
- Local-first: Offline operation is the default; network is optional
- Auditable: Every agent decision must be traceable to an input and a rule
- Reversible: Agent actions should be reversible where possible; destructive actions require confirmation
Implementation Plan
- Create
CONSTITUTION.mdat repo root with the principles above (editable by maintainers, versioned in git) - Embed as a compile-time resource via
rust-embed(already used interraphim_agentanddesktop) - Add
ConstitutionValidatortoterraphim_agent_supervisor:- Pre-execution hook: check proposed agent action against constitution rules
- Rules encoded as structured checks (not LLM interpretation)
- Violation = action rejected with reason, logged as event
- Cryptographically sign the constitution using existing
zipsigninfrastructure fromterraphim_update - Add integration tests: attempt constitutional violations, verify rejection
Affected Crates
terraphim_agent_supervisor(primary -- add validation)terraphim_types(addConstitutionRuletype)terraphim_agent(embed constitution resource)
Estimated Effort
~2 hours
Part of
Epic #595
- 主要语言
- Rust
- 星标
- 62
- 派生
- 5
- 平均合并
- 2 小时 27 分钟
- 30 天内合并 PR
- 1
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
terraphim/terraphim-ai 的其他 Issue
-
难度 5/5 一周以上 新手友好度 25/100
terraphim/terraphim-ai#885 ·
-
难度 4/5 3-5 天 新手友好度 55/100
terraphim/terraphim-ai#871 ·
-
enhancement
难度 5/5 一周以上 新手友好度 25/100
terraphim/terraphim-ai#810 · 2 条评论 ·
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
terraphim/terraphim-ai#729 ·
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
terraphim/terraphim-ai#728 ·
查看 terraphim/terraphim-ai 的全部 Issue
相似的 Issue
-
bug CLI custom-model
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
rust-bitcoin/rust-bitcoin#6930 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
fulcrumgenomics/ferro-hgvs#2251 ·
-
A-allocators A-docs C-enhancement T-libs
难度 2/5 1-3 小时 新手友好度 75/100