Skip to content

配置参考

constitution.yaml + default.json 完整字段说明。

constitution.yaml

Alembic 的治理宪章,定义能力探测、角色权限和行为规则。版本 3.0。

capabilities(能力层)

能力通过真实探测确定,不依赖用户声明。

能力 ID说明探测方式缓存 TTL
git_writeGit 推送权限git push --dry-run86400s

roles(角色层)

角色按最小权限原则分级,developer 需要 git_write 能力验证。

角色名称适用场景关键权限
external_agentExternal AgentIDE AI Agent(Cursor / Copilot / Claude Code)创建候选 · 搜索 · Guard 检查 · Task 管理 · 技能 CRUD · 进化提案
chat_agentChatAgentDashboard 内置 AI 对话读取 Recipe/候选/Guard 规则 · 创建候选
contributorContributor有子仓库但无 push 权限的团队成员只读:Recipe · 候选 · Guard 规则 · 审计日志
visitorVisitor严格模式下的最小权限访客只读:Recipe · Guard 规则
developerDeveloper项目管理员(需 git_write全部权限(*

角色约束

角色约束
external_agent知识提交均进入 pending 状态;可创建进化提案(系统自动执行);不能发布/弃用知识;不能修改 Guard 规则;不能删除数据
chat_agent候选必须包含 reasoning;不能绕过 Guard 检查
contributor不能创建/修改 Recipe;不能修改 Guard 规则
visitor仅可读取,不能执行任何写操作

rules(规则层)

规则 ID说明检查函数
destructive_confirm删除操作需确认destructive_needs_confirmation
content_required创建候选/Recipe 必须包含内容creation_needs_content
ai_no_direct_recipeAI 不能直接创建/批准 Recipeai_cannot_approve_recipe
batch_authorized批量操作需授权batch_needs_authorization

default.json

所有配置项及默认值。用户可在 .asd/config.json 中覆盖。

database

字段类型默认值说明
typestring"sqlite"数据库类型
pathstring"./.asd/alembic.db"SQLite 数据库路径
verbosebooleanfalse输出 SQL 日志

server

字段类型默认值说明
portnumber3000HTTP 服务端口
hoststring"localhost"绑定地址
cors.enabledbooleantrue启用 CORS
cors.originstring"*"允许的来源

cache

字段类型默认值说明
modestring"memory"缓存模式
ttlnumber300缓存 TTL(秒)

monitoring

字段类型默认值说明
enabledbooleantrue启用性能监控
slowRequestThresholdnumber1000慢请求阈值(ms)

logging

字段类型默认值说明
levelstring"info"日志级别
formatstring"json"日志格式
consolebooleantrue输出到控制台
file.enabledbooleantrue写入文件
file.pathstring"./.asd/logs"日志文件目录

constitution

字段类型默认值说明
pathstring"./config/constitution.yaml"宪章文件路径
strictModebooleantrue严格模式(无能力时降级为 visitor)

features

字段类型默认值说明
USE_NEW_GATEWAYbooleantrue启用新网关管线
REASONING_QUALITY_SCOREbooleantrue启用推理链质量评分

ai

字段类型默认值说明
providerstring"openai"AI Provider
modelstring"gpt-4"模型名称
temperaturenumber0.7生成温度
maxTokensnumber2000最大输出 token

vector

字段类型默认值说明
enabledbooleantrue启用向量检索
adapterstring"auto"向量适配器(auto / hnsw / json)
dimensionsnumber768向量维度
indexPathstring"./data/vector-index"索引存储路径
hnsw.Mnumber16HNSW 每节点连接数
hnsw.efConstructnumber200构建时搜索宽度
hnsw.efSearchnumber100查询时搜索宽度
quantizestring"auto"量化模式(auto / sq8 / none)
quantizeThresholdnumber3000启用量化的最小向量数
persistence.formatstring"binary"持久化格式
persistence.flushIntervalMsnumber2000刷盘间隔
persistence.flushBatchSizenumber100刷盘批次大小
hybrid.enabledbooleantrue启用混合检索
hybrid.rrfKnumber60RRF 融合参数 k
hybrid.alphanumber0.5向量/关键词权重比
contextualEnrichbooleanfalse上下文增强嵌入
contextualModelstring"claude-sonnet-4-20250514"上下文增强模型
autoSyncOnCrudbooleantrueCRUD 时自动同步索引
syncDebounceMsnumber2000同步去抖延迟
dimensionGuardbooleantrue维度守卫(防止维度不匹配)

qualityGate

字段类型默认值说明
maxErrorsnumber0允许的最大 error 数
maxWarningsnumber20允许的最大 warning 数
minScorenumber70最低质量评分

guard

字段类型默认值说明
disabledRulesstring[][]禁用的规则 ID 列表
codeLevelThresholds.swift-excessive-force-unwrapnumber5Swift 强制解包阈值
codeLevelThresholds.rust-excessive-unwrapnumber3Rust unwrap 阈值
codeLevelThresholds.rust-excessive-unsafenumber3Rust unsafe 阈值
codeLevelThresholds.dart-excessive-latenumber3Dart late 变量阈值

taskGraph

字段类型默认值说明
decision.staleDaysnumber30决策过期天数
decision.maxActiveInPrimenumber20prime 返回的最大活跃决策数
decision.maxStaleInPrimenumber10prime 返回的最大过期决策数

Released under the MIT License.