feat(ack): add project knowledge guardrails

This commit is contained in:
2026-07-31 21:09:36 +08:00
parent 7d1994cf93
commit ee66dbe9ce
32 changed files with 8353 additions and 139 deletions
+147 -4
View File
@@ -23,13 +23,18 @@
"required": ["name"],
"additionalProperties": true,
"properties": {
"name": { "type": "string" },
"name": { "type": "string", "minLength": 1, "pattern": "\\S" },
"repoPath": { "type": "string" },
"baseUrl": { "type": "string" },
"devWorktree": { "type": "string" },
"overlayFile": {
"type": "string",
"description": "项目覆盖层文件路径,默认 docs/ack/project.md,可自定义"
},
"knowledgeFile": {
"type": "string",
"const": "docs/ack/knowledge.yaml",
"description": "项目知识护栏库的唯一权威路径"
}
}
},
@@ -68,25 +73,155 @@
"required": ["round", "result"],
"additionalProperties": true,
"properties": {
"round": { "type": "integer", "minimum": 1 },
"round": { "type": "integer", "minimum": 1, "maximum": 3 },
"attemptId": {
"type": "string",
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*-A[1-9][0-9]*$",
"description": "稳定逻辑轮次 ID,应为 <task-id>-A<round>;旧轮次可缺省,但作为知识来源前必须补齐"
},
"result": { "type": "string", "enum": ["passed", "failed"] },
"evidence": { "type": "string" }
}
},
"knowledgeRef": {
"type": "string",
"pattern": "^K-[A-Z0-9][A-Z0-9-]*@[1-9][0-9]*$"
},
"knowledgeCandidate": {
"type": "object",
"required": [
"kind",
"title",
"claim",
"scope",
"appliesWhen",
"directive",
"rationale",
"evidenceRefs"
],
"additionalProperties": false,
"properties": {
"kind": {
"type": "string",
"enum": ["guardrail", "pitfall", "verification"]
},
"title": { "type": "string", "minLength": 1 },
"claim": { "type": "string", "minLength": 1 },
"scope": {
"type": "object",
"minProperties": 1,
"additionalProperties": false,
"properties": {
"all": { "type": "boolean" },
"components": {
"type": "array",
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"paths": {
"type": "array",
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"dependencies": {
"type": "array",
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"versions": {
"type": "array",
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"tags": {
"type": "array",
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"symbols": {
"type": "array",
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"errorSignatures": {
"type": "array",
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
}
}
},
"appliesWhen": { "type": "string", "minLength": 1 },
"directive": { "type": "string", "minLength": 1 },
"rationale": { "type": "string", "minLength": 1 },
"evidenceRefs": {
"type": "array",
"minItems": 1,
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"proposedBy": { "type": "string" },
"proposedAt": { "type": "string" }
}
},
"knowledgeApplication": {
"type": "object",
"required": ["ref", "result", "evidence"],
"additionalProperties": false,
"properties": {
"ref": { "$ref": "#/definitions/knowledgeRef" },
"result": {
"type": "string",
"enum": ["applied", "not_applicable"]
},
"evidence": { "type": "string", "minLength": 1 }
}
},
"knowledgeCheck": {
"type": "object",
"required": ["ref", "result", "evidence"],
"additionalProperties": false,
"properties": {
"ref": { "$ref": "#/definitions/knowledgeRef" },
"result": {
"type": "string",
"enum": ["passed", "failed", "not_applicable"]
},
"evidence": { "type": "string", "minLength": 1 },
"checkedBy": { "type": "string" },
"checkedAt": { "type": "string" }
}
},
"task": {
"type": "object",
"required": ["id", "title", "status"],
"additionalProperties": true,
"properties": {
"id": { "type": "string", "minLength": 1 },
"id": { "type": "string", "minLength": 1, "pattern": "\\S" },
"type": { "type": "string" },
"title": { "type": "string", "minLength": 1 },
"title": { "type": "string", "minLength": 1, "pattern": "\\S" },
"priority": { "type": "string" },
"status": { "$ref": "#/definitions/status" },
"assignee": { "type": "string" },
"component": { "type": "string" },
"specRefs": { "type": "array", "items": { "type": "string" } },
"testRefs": { "type": "array", "items": { "type": "string" } },
"knowledgeRefs": {
"type": "array",
"items": { "$ref": "#/definitions/knowledgeRef" },
"uniqueItems": true
},
"knowledgeApplied": {
"type": "array",
"items": { "$ref": "#/definitions/knowledgeApplication" }
},
"knowledgeCandidates": {
"type": "array",
"items": { "$ref": "#/definitions/knowledgeCandidate" }
},
"knowledgeChecks": {
"type": "array",
"items": { "$ref": "#/definitions/knowledgeCheck" }
},
"description": { "type": "string" },
"stepsToReproduce": { "type": "array", "items": { "type": "string" } },
"expected": { "type": "string" },
@@ -124,6 +259,14 @@
"then": {
"properties": {
"resolution": {
"type": "object",
"properties": {
"leftoverReason": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
}
},
"required": ["leftoverReason"]
}
},