Skip to main content

Profile 对象

Profile 是 Huoban 的墨方:它不改变活字本身,但决定能力在某个项目、团队或场景里的判断重点。 AGENTS.md、CLAUDE.md 和 Cursor Rules 是 profile file;Huoban Profile 是 profile object。

语义

Profile 用于表达:
  • 项目上下文。
  • 团队习惯。
  • 架构约束。
  • 验证命令。
  • 风险偏好。
  • 领域术语。

spec 字段

字段要求说明
layers必填分层上下文数组。
layers[].name必填layer 名称,例如 stylearchitecturecommands
layers[].data可选结构化字段,供 validator、merge、policy 使用。
layers[].content可选自然语言上下文,供 agent 使用。
merge可选合并策略,例如 append、replace、override。
policyRefs可选关联的 Policy,但不内联权限规则。

最小示例

apiVersion: huoban.dev/v1alpha1
kind: Profile
metadata:
  name: project-profile
spec:
  layers:
    - name: style
      data:
        preferSmallChanges: true
        testFirstForBugfixes: true
      content: |
        Prefer surgical changes. Do not refactor unrelated code.
    - name: commands
      data:
        testCommand: npm test
      content: |
        Run npm test before finalizing changes.

合并规则

推荐默认规则:
  • profileRefs 顺序应用。
  • 后者覆盖前者的同名 scalar 字段。
  • list 默认 append,除非声明 replace。
  • 同名 layer 合并。
  • 冲突写入 status.conditions

status

常见 conditions:
  • ProfileImported
  • ProfileResolved
  • ProfileConflictDetected
  • ImportNeedsReview
最终 effective Profile 必须可解释、可 hash、可进入 Run snapshot。