ai-core-framework 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +21 -0
- package/.codex-plugin/plugin.json +35 -0
- package/.cursor-plugin/plugin.json +22 -0
- package/README.md +173 -0
- package/bin/ai-core-framework.js +110 -0
- package/core/README.md +162 -0
- package/core/agents/README.md +32 -0
- package/core/agents/business-analyst.md +269 -0
- package/core/agents/developer.md +375 -0
- package/core/agents/qa-tester.md +477 -0
- package/core/agents/scrum-master.md +136 -0
- package/core/agents/tech-lead.md +345 -0
- package/core/config/backlog.schema.json +38 -0
- package/core/config/docs-policy.default.json +37 -0
- package/core/config/release.schema.json +120 -0
- package/core/config/ticket.schema.json +253 -0
- package/core/rules/00-global-rules.md +373 -0
- package/core/rules/01-git-workflow.md +388 -0
- package/core/rules/02-code-quality.md +77 -0
- package/core/rules/03-security.md +78 -0
- package/core/rules/04-documentation.md +72 -0
- package/core/rules/05-testing-mandatory.md +374 -0
- package/core/rules/06-approval-gates.md +388 -0
- package/core/rules/07-definition-of-ready.md +112 -0
- package/core/rules/08-definition-of-done.md +149 -0
- package/core/scripts/ai-core.sh +456 -0
- package/core/scripts/generate-views.sh +210 -0
- package/core/scripts/install-codex-prompts.sh +127 -0
- package/core/scripts/log-user-request.sh +113 -0
- package/core/scripts/setup-project.sh +183 -0
- package/core/scripts/sync-platforms.sh +322 -0
- package/core/scripts/validate-audit-log.sh +73 -0
- package/core/scripts/validate-docs.sh +365 -0
- package/core/scripts/validate-permissions.sh +132 -0
- package/core/scripts/validate-state.sh +611 -0
- package/core/scripts/workflow.sh +513 -0
- package/core/skills/README.md +21 -0
- package/core/skills/ai-core-commands/SKILL.md +86 -0
- package/core/skills/brainstorming/SKILL.md +40 -0
- package/core/skills/development-implement-task/SKILL.md +308 -0
- package/core/skills/executing-ticket/SKILL.md +28 -0
- package/core/skills/git-branch-status/SKILL.md +56 -0
- package/core/skills/git-cleanup-branches/SKILL.md +57 -0
- package/core/skills/git-scan-untracked/SKILL.md +50 -0
- package/core/skills/meta-generate-views/SKILL.md +54 -0
- package/core/skills/meta-request-log/SKILL.md +61 -0
- package/core/skills/meta-sprint-report/SKILL.md +59 -0
- package/core/skills/meta-sync-platforms/SKILL.md +53 -0
- package/core/skills/meta-ticket-health/SKILL.md +61 -0
- package/core/skills/meta-validate-audit-log/SKILL.md +42 -0
- package/core/skills/meta-validate-docs/SKILL.md +58 -0
- package/core/skills/meta-validate-permissions/SKILL.md +53 -0
- package/core/skills/meta-validate-state/SKILL.md +58 -0
- package/core/skills/planning-analyze-requirements/SKILL.md +471 -0
- package/core/skills/planning-backlog-status/SKILL.md +57 -0
- package/core/skills/planning-document-existing-requirements/SKILL.md +246 -0
- package/core/skills/planning-estimate-task/SKILL.md +60 -0
- package/core/skills/planning-groom-ticket/SKILL.md +442 -0
- package/core/skills/planning-mark-ready/SKILL.md +111 -0
- package/core/skills/planning-plan-refactor/SKILL.md +66 -0
- package/core/skills/planning-plan-sprint/SKILL.md +112 -0
- package/core/skills/planning-prioritize-backlog/SKILL.md +62 -0
- package/core/skills/planning-write-plan/SKILL.md +68 -0
- package/core/skills/project-detect-stack/SKILL.md +71 -0
- package/core/skills/project-discover-codebase/SKILL.md +74 -0
- package/core/skills/project-setup-project/SKILL.md +113 -0
- package/core/skills/qa-bug-status/SKILL.md +52 -0
- package/core/skills/qa-report-bug/SKILL.md +518 -0
- package/core/skills/qa-smoke-test/SKILL.md +387 -0
- package/core/skills/qa-triage-bug/SKILL.md +62 -0
- package/core/skills/qa-verify-fix/SKILL.md +446 -0
- package/core/skills/release-hotfix/SKILL.md +117 -0
- package/core/skills/release-release/SKILL.md +123 -0
- package/core/skills/release-rollback/SKILL.md +62 -0
- package/core/skills/review-create-pr/SKILL.md +418 -0
- package/core/skills/review-merge-pr/SKILL.md +425 -0
- package/core/skills/review-techlead-review/SKILL.md +547 -0
- package/core/skills/using-ai-core/SKILL.md +72 -0
- package/core/skills/verification-before-done/SKILL.md +35 -0
- package/core/skills/writing-implementation-plan/SKILL.md +45 -0
- package/core/templates/ci/ai-core-governance.yml +112 -0
- package/core/templates/ci/node-pnpm.yml +35 -0
- package/core/templates/pm/retrospective-template.md +47 -0
- package/core/templates/pm/sprint-plan-template.md +45 -0
- package/core/templates/pr/pull-request-template.md +247 -0
- package/core/templates/project/CODEOWNERS +11 -0
- package/core/templates/project/docs-policy.json +3 -0
- package/core/templates/project/project-config.yaml +137 -0
- package/core/templates/project/project-structure.yaml +76 -0
- package/core/templates/qa/bug-report-template.md +371 -0
- package/core/templates/qa/test-plan-template.md +57 -0
- package/core/templates/release/release-record-template.json +67 -0
- package/core/templates/requirements/PRD-template.md +58 -0
- package/core/templates/requirements/user-story-template.md +381 -0
- package/core/templates/technical/ADR-template.md +46 -0
- package/core/templates/technical/refactor-plan-template.md +84 -0
- package/core/templates/technical/tech-design-template.md +71 -0
- package/core/workflows/bug-lifecycle.md +56 -0
- package/core/workflows/feature-lifecycle.md +347 -0
- package/core/workflows/hotfix-lifecycle.md +65 -0
- package/core/workflows/sprint-lifecycle.md +56 -0
- package/lib/install-codex.js +85 -0
- package/package.json +36 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "Ticket",
|
|
4
|
+
"description": "Schema for tickets in project/tickets/",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"id",
|
|
8
|
+
"title",
|
|
9
|
+
"type",
|
|
10
|
+
"status",
|
|
11
|
+
"created_at",
|
|
12
|
+
"created_by",
|
|
13
|
+
"state_history"
|
|
14
|
+
],
|
|
15
|
+
"additionalProperties": true,
|
|
16
|
+
"properties": {
|
|
17
|
+
"id": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"pattern": "^TICKET-\\d{3,}$",
|
|
20
|
+
"description": "Unique ticket ID, e.g. TICKET-001"
|
|
21
|
+
},
|
|
22
|
+
"title": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"minLength": 5,
|
|
25
|
+
"maxLength": 160
|
|
26
|
+
},
|
|
27
|
+
"type": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"enum": [
|
|
30
|
+
"feature",
|
|
31
|
+
"enhancement",
|
|
32
|
+
"bug",
|
|
33
|
+
"tech-debt",
|
|
34
|
+
"spike",
|
|
35
|
+
"chore",
|
|
36
|
+
"hotfix"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"status": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"enum": [
|
|
42
|
+
"DRAFT",
|
|
43
|
+
"GROOMED",
|
|
44
|
+
"READY",
|
|
45
|
+
"IN_PROGRESS",
|
|
46
|
+
"IN_REVIEW",
|
|
47
|
+
"QA",
|
|
48
|
+
"DONE",
|
|
49
|
+
"BLOCKED",
|
|
50
|
+
"CANCELLED"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"priority": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"enum": ["MUST", "SHOULD", "COULD", "WONT"]
|
|
56
|
+
},
|
|
57
|
+
"severity": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"enum": ["SEV-1", "SEV-2", "SEV-3", "SEV-4"]
|
|
60
|
+
},
|
|
61
|
+
"epic": {
|
|
62
|
+
"type": ["string", "null"]
|
|
63
|
+
},
|
|
64
|
+
"user_story": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"required": ["as_a", "i_want", "so_that"],
|
|
67
|
+
"properties": {
|
|
68
|
+
"as_a": { "type": "string", "minLength": 1 },
|
|
69
|
+
"i_want": { "type": "string", "minLength": 1 },
|
|
70
|
+
"so_that": { "type": "string", "minLength": 1 }
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"acceptance_criteria": {
|
|
74
|
+
"type": "array",
|
|
75
|
+
"minItems": 1,
|
|
76
|
+
"items": {
|
|
77
|
+
"type": "object",
|
|
78
|
+
"required": ["scenario", "given", "when", "then"],
|
|
79
|
+
"properties": {
|
|
80
|
+
"scenario": { "type": "string", "minLength": 1 },
|
|
81
|
+
"given": { "type": "string", "minLength": 1 },
|
|
82
|
+
"when": { "type": "string", "minLength": 1 },
|
|
83
|
+
"then": { "type": "string", "minLength": 1 }
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"estimate": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"required": ["story_points", "estimated_by", "estimated_at"],
|
|
90
|
+
"properties": {
|
|
91
|
+
"story_points": { "type": "number", "enum": [1, 2, 3, 5, 8, 13, 21] },
|
|
92
|
+
"estimated_by": { "type": "string" },
|
|
93
|
+
"estimated_at": { "type": "string", "format": "date-time" }
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"sprint_id": {
|
|
97
|
+
"type": ["string", "null"],
|
|
98
|
+
"pattern": "^(SPRINT-\\d{3,}|sprint-[0-9]+|)$"
|
|
99
|
+
},
|
|
100
|
+
"assignee": {
|
|
101
|
+
"type": ["string", "null"]
|
|
102
|
+
},
|
|
103
|
+
"created_at": { "type": "string", "format": "date-time" },
|
|
104
|
+
"created_by": { "type": "string" },
|
|
105
|
+
"updated_at": { "type": "string", "format": "date-time" },
|
|
106
|
+
"started_at": { "type": ["string", "null"], "format": "date-time" },
|
|
107
|
+
"completed_at": { "type": ["string", "null"], "format": "date-time" },
|
|
108
|
+
"branch": { "type": ["string", "null"] },
|
|
109
|
+
"pr_url": { "type": ["string", "null"] },
|
|
110
|
+
"spec_path": {
|
|
111
|
+
"type": ["string", "null"],
|
|
112
|
+
"description": "Human-readable approved requirement/design spec in docs/project/specs/."
|
|
113
|
+
},
|
|
114
|
+
"implementation_plan_path": {
|
|
115
|
+
"type": ["string", "null"],
|
|
116
|
+
"description": "Human-readable implementation plan in docs/project/plans/."
|
|
117
|
+
},
|
|
118
|
+
"dependencies": {
|
|
119
|
+
"type": "object",
|
|
120
|
+
"properties": {
|
|
121
|
+
"blocked_by": {
|
|
122
|
+
"type": "array",
|
|
123
|
+
"items": { "type": "string", "pattern": "^TICKET-\\d{3,}$" }
|
|
124
|
+
},
|
|
125
|
+
"blocks": {
|
|
126
|
+
"type": "array",
|
|
127
|
+
"items": { "type": "string", "pattern": "^TICKET-\\d{3,}$" }
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"documentation": {
|
|
132
|
+
"type": "object",
|
|
133
|
+
"description": "Machine-readable documentation obligations for this ticket.",
|
|
134
|
+
"properties": {
|
|
135
|
+
"required": { "type": "boolean", "default": false },
|
|
136
|
+
"updated": { "type": "boolean", "default": false },
|
|
137
|
+
"paths": {
|
|
138
|
+
"type": "array",
|
|
139
|
+
"items": { "type": "string", "minLength": 1 }
|
|
140
|
+
},
|
|
141
|
+
"api_docs_updated": { "type": "boolean", "default": false },
|
|
142
|
+
"readme_updated": { "type": "boolean", "default": false },
|
|
143
|
+
"changelog_updated": { "type": "boolean", "default": false }
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"adr": {
|
|
147
|
+
"type": "object",
|
|
148
|
+
"description": "ADR requirement and evidence.",
|
|
149
|
+
"properties": {
|
|
150
|
+
"required": { "type": "boolean", "default": false },
|
|
151
|
+
"path": { "type": ["string", "null"] }
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"runbook": {
|
|
155
|
+
"type": "object",
|
|
156
|
+
"description": "Runbook requirement and evidence.",
|
|
157
|
+
"properties": {
|
|
158
|
+
"required": { "type": "boolean", "default": false },
|
|
159
|
+
"path": { "type": ["string", "null"] }
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"qa_evidence": {
|
|
163
|
+
"type": "object",
|
|
164
|
+
"description": "QA verification record used by DoD validation.",
|
|
165
|
+
"properties": {
|
|
166
|
+
"required": { "type": "boolean", "default": true },
|
|
167
|
+
"path": { "type": ["string", "null"] },
|
|
168
|
+
"verified_by": { "type": ["string", "null"] },
|
|
169
|
+
"verified_at": { "type": ["string", "null"], "format": "date-time" }
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"dod_checklist": {
|
|
173
|
+
"type": "object",
|
|
174
|
+
"description": "Machine-readable Definition of Done gates. Required when status is DONE.",
|
|
175
|
+
"properties": {
|
|
176
|
+
"code_complete": { "type": "boolean" },
|
|
177
|
+
"tests_passed": { "type": "boolean" },
|
|
178
|
+
"docs_updated": { "type": "boolean" },
|
|
179
|
+
"review_approved": { "type": "boolean" },
|
|
180
|
+
"qa_verified": { "type": "boolean" },
|
|
181
|
+
"release_notes_updated": { "type": "boolean" },
|
|
182
|
+
"security_checked": { "type": "boolean" },
|
|
183
|
+
"rollback_plan_documented": { "type": "boolean" }
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"state_history": {
|
|
187
|
+
"type": "array",
|
|
188
|
+
"minItems": 1,
|
|
189
|
+
"items": {
|
|
190
|
+
"type": "object",
|
|
191
|
+
"required": [
|
|
192
|
+
"from_state",
|
|
193
|
+
"to_state",
|
|
194
|
+
"at",
|
|
195
|
+
"by_agent",
|
|
196
|
+
"by_command",
|
|
197
|
+
"reason"
|
|
198
|
+
],
|
|
199
|
+
"properties": {
|
|
200
|
+
"from_state": {
|
|
201
|
+
"type": ["string", "null"],
|
|
202
|
+
"enum": [
|
|
203
|
+
null,
|
|
204
|
+
"DRAFT",
|
|
205
|
+
"GROOMED",
|
|
206
|
+
"READY",
|
|
207
|
+
"IN_PROGRESS",
|
|
208
|
+
"IN_REVIEW",
|
|
209
|
+
"QA",
|
|
210
|
+
"DONE",
|
|
211
|
+
"BLOCKED",
|
|
212
|
+
"CANCELLED"
|
|
213
|
+
]
|
|
214
|
+
},
|
|
215
|
+
"to_state": {
|
|
216
|
+
"type": "string",
|
|
217
|
+
"enum": [
|
|
218
|
+
"DRAFT",
|
|
219
|
+
"GROOMED",
|
|
220
|
+
"READY",
|
|
221
|
+
"IN_PROGRESS",
|
|
222
|
+
"IN_REVIEW",
|
|
223
|
+
"QA",
|
|
224
|
+
"DONE",
|
|
225
|
+
"BLOCKED",
|
|
226
|
+
"CANCELLED"
|
|
227
|
+
]
|
|
228
|
+
},
|
|
229
|
+
"at": { "type": "string", "format": "date-time" },
|
|
230
|
+
"by_agent": { "type": "string", "minLength": 1 },
|
|
231
|
+
"by_command": { "type": "string", "pattern": "^/[a-z0-9-]+$" },
|
|
232
|
+
"reason": { "type": "string", "minLength": 1 }
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"comments": {
|
|
237
|
+
"type": "array",
|
|
238
|
+
"items": {
|
|
239
|
+
"type": "object",
|
|
240
|
+
"required": ["author", "at", "text"],
|
|
241
|
+
"properties": {
|
|
242
|
+
"author": { "type": "string" },
|
|
243
|
+
"at": { "type": "string", "format": "date-time" },
|
|
244
|
+
"text": { "type": "string" }
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"labels": {
|
|
249
|
+
"type": "array",
|
|
250
|
+
"items": { "type": "string" }
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
# 🔒 RULE 00: Global Rules (Non-Negotiable)
|
|
2
|
+
|
|
3
|
+
> **Applies 24/7 to EVERY agent, EVERY command, and EVERY session.**
|
|
4
|
+
> These rules have the highest project priority. If a user request conflicts with these rules, the rule wins without exception.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 🎯 Meta-Rules (How to interpret these rules)
|
|
9
|
+
|
|
10
|
+
### M-001: Priority order
|
|
11
|
+
When instructions conflict, follow this priority order exactly:
|
|
12
|
+
1. **Safety** (no secret commits, no data deletion)
|
|
13
|
+
2. **Global rules** (this file)
|
|
14
|
+
3. **Domain-specific rules** (01-09)
|
|
15
|
+
4. **Agent rules** (in the agent file)
|
|
16
|
+
5. **Command rules** (in the command file)
|
|
17
|
+
6. **User request**
|
|
18
|
+
|
|
19
|
+
### M-002: "MUST" / "MUST NOT" are absolute
|
|
20
|
+
If a rule says **MUST** or **MUST NOT**, it is mandatory and has **NO EXCEPTIONS**. If a user insists on violating it, the AI **MUST** refuse and cite the governing rule.
|
|
21
|
+
|
|
22
|
+
### M-003: "SHOULD" is a mandatory default
|
|
23
|
+
**SHOULD** is the required default behavior. It may be bypassed only with a documented, defensible reason, and the AI **MUST** log that reason in the decision log.
|
|
24
|
+
|
|
25
|
+
### M-004: "MAY" is optional
|
|
26
|
+
**MAY** is optional and does not require justification.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 🎫 G-001: No code without ticket
|
|
31
|
+
|
|
32
|
+
**MUST NOT** write or modify production code (files in `src/`, `lib/`, `app/`) unless there is an active ticket in `project/tickets/` with:
|
|
33
|
+
- `status` ∈ `[IN_PROGRESS]`
|
|
34
|
+
- `assignee` = current agent
|
|
35
|
+
|
|
36
|
+
**Allowed exceptions**:
|
|
37
|
+
- Fix typos in comments
|
|
38
|
+
- Fix formatting or lint issues, with a separate commit: `style(chore): ...`
|
|
39
|
+
- Update files in `core/`, which is the meta-framework
|
|
40
|
+
|
|
41
|
+
**If the user requests code without a ticket:**
|
|
42
|
+
```
|
|
43
|
+
❌ Cannot proceed: No active ticket
|
|
44
|
+
→ Suggest: /analyze-requirements to create a ticket
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 📝 G-002: Single source of truth
|
|
50
|
+
|
|
51
|
+
**MUST NOT** duplicate information across files. Every piece of information **MUST** have exactly one canonical location:
|
|
52
|
+
|
|
53
|
+
| Info | Canonical location |
|
|
54
|
+
|------|-------------------|
|
|
55
|
+
| Backlog order and prioritization | `project/backlog/backlog.json` |
|
|
56
|
+
| Ticket details and state history | `project/tickets/TICKET-XXX.json` |
|
|
57
|
+
| Sprint info | `project/sprints/SPRINT-XXX.json` |
|
|
58
|
+
| Bug details | `project/bugs/BUG-XXX.json` |
|
|
59
|
+
| Release records | `project/releases/vX.Y.Z.json` |
|
|
60
|
+
| User request log | `project/user-requests.jsonl` |
|
|
61
|
+
| Project config | `config/project-config.yaml` |
|
|
62
|
+
| Project structure map | `config/project-structure.yaml` |
|
|
63
|
+
| Refactor plans | `docs/runtime/refactor/<name>-refactor-plan.md` |
|
|
64
|
+
| Architecture decisions | `docs/runtime/adr/NNN-title.md` |
|
|
65
|
+
| Agent capabilities | `core/agents/<agent>.md` (frontmatter) |
|
|
66
|
+
| Coverage threshold | `config/project-config.yaml` → `quality.coverage_threshold` |
|
|
67
|
+
|
|
68
|
+
If information is needed in multiple places, **reference** the canonical location. **MUST NOT** copy it.
|
|
69
|
+
|
|
70
|
+
`core/` is framework-only. Project-specific state and configuration MUST live in `project/`, `config/`, `docs/project/`, or `docs/runtime/`.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 🔄 G-003: State machine strict
|
|
75
|
+
|
|
76
|
+
Every ticket **MUST** follow this state machine exactly:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
DRAFT → GROOMED → READY → IN_PROGRESS → IN_REVIEW → QA → DONE
|
|
80
|
+
↓
|
|
81
|
+
BLOCKED (may be entered from any state)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**MUST NOT**:
|
|
85
|
+
- Skip states, for example DRAFT → IN_PROGRESS
|
|
86
|
+
- Move backward, except IN_REVIEW → IN_PROGRESS when changes are requested
|
|
87
|
+
- Modify a ticket in state DONE
|
|
88
|
+
|
|
89
|
+
Every transition **MUST** be performed through the corresponding command. Manual JSON edits are **FORBIDDEN**.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 💬 G-004: Communication protocol
|
|
94
|
+
|
|
95
|
+
### G-004a: Chat-first command interface
|
|
96
|
+
User workflow interaction happens in the AI chat window.
|
|
97
|
+
|
|
98
|
+
When user types `/command ...`, `guide /command ...`, or `next TICKET-XXX`, AI **MUST** treat it as an AI Core workflow request, infer the right agent from command metadata, execute any internal scripts itself when needed, and report the result back in chat.
|
|
99
|
+
|
|
100
|
+
AI **MUST NOT** require the user to type shell wrappers such as `bash core/scripts/ai-core.sh` or environment variables such as `AI_AGENT=...` for normal workflow usage. Those are internal implementation details for AI tooling and CI.
|
|
101
|
+
|
|
102
|
+
### G-004b: Always output the execution plan
|
|
103
|
+
Before executing a complex command, the AI **MUST** output a short plan:
|
|
104
|
+
```
|
|
105
|
+
📋 Plan:
|
|
106
|
+
1. [Step 1]
|
|
107
|
+
2. [Step 2]
|
|
108
|
+
3. [Step 3]
|
|
109
|
+
Proceed? (or proceed autonomously when the command is defined as autonomous)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### G-004c: Handoff format
|
|
113
|
+
When transferring work to another agent, the AI **MUST** use this exact format:
|
|
114
|
+
```
|
|
115
|
+
HANDOFF → <target-agent>
|
|
116
|
+
Context: [brief]
|
|
117
|
+
Action needed: [specific]
|
|
118
|
+
Deadline: [if any]
|
|
119
|
+
Files to look at: [paths]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### G-004d: Escalation format
|
|
123
|
+
When escalating to a human, the AI **MUST** use this exact format:
|
|
124
|
+
```
|
|
125
|
+
🚨 ESCALATION NEEDED
|
|
126
|
+
Reason: [why AI can't proceed]
|
|
127
|
+
Options: [possible choices with pros/cons]
|
|
128
|
+
Recommendation: [AI's suggestion]
|
|
129
|
+
Awaiting: [what decision needed]
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### G-004e: No em dashes
|
|
133
|
+
**MUST NOT** use the em dash character (—) in output. Use commas, parentheses, or line breaks instead.
|
|
134
|
+
|
|
135
|
+
### G-004f: Log every user request
|
|
136
|
+
At the start of handling every user request, the AI **MUST** append a record to `project/user-requests.jsonl` before doing substantive work.
|
|
137
|
+
|
|
138
|
+
The log record **MUST** include:
|
|
139
|
+
- Timestamp
|
|
140
|
+
- Agent name
|
|
141
|
+
- User request text, sanitized for secrets
|
|
142
|
+
- Detected slash command, if any
|
|
143
|
+
- Detected ticket ID, if any
|
|
144
|
+
- Hash chain fields when using `core/scripts/log-user-request.sh`
|
|
145
|
+
|
|
146
|
+
The AI **MUST** use:
|
|
147
|
+
```bash
|
|
148
|
+
bash core/scripts/log-user-request.sh "<user request text>"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
If the script is unavailable, the AI **MUST** still write an equivalent JSONL record manually. If the request contains secrets, credentials, tokens, passwords, customer PII, or payment data, the AI **MUST** redact those values before logging.
|
|
152
|
+
|
|
153
|
+
If the AI cannot write the request log, it **MUST** tell the user and ask whether to proceed without auditability. Silent omission is **FORBIDDEN**.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 🔐 G-005: Security fundamentals
|
|
158
|
+
|
|
159
|
+
### G-005a: Never commit secrets
|
|
160
|
+
**MUST NOT** commit:
|
|
161
|
+
- API keys, tokens, passwords
|
|
162
|
+
- `.env` files, which **MUST** be listed in `.gitignore`
|
|
163
|
+
- Private keys (`.pem`, `.key`)
|
|
164
|
+
- Customer data, PII
|
|
165
|
+
|
|
166
|
+
**Pre-commit check**: Scan the diff for patterns: `api_key=`, `password=`, `token=`, `AKIA[A-Z0-9]{16}`, etc.
|
|
167
|
+
|
|
168
|
+
### G-005b: Never log sensitive data
|
|
169
|
+
**MUST NOT** log:
|
|
170
|
+
- User passwords, including hashed passwords
|
|
171
|
+
- Full credit card numbers
|
|
172
|
+
- SSN, ID numbers
|
|
173
|
+
- Session tokens
|
|
174
|
+
- Email bodies, PII
|
|
175
|
+
|
|
176
|
+
### G-005c: Dependency security
|
|
177
|
+
When adding a new dependency, the AI **MUST**:
|
|
178
|
+
1. Check vulnerability database (npm audit, pip-audit, etc.)
|
|
179
|
+
2. Verify license compatibility
|
|
180
|
+
3. Add it to `package.json` with a pinned version. **MUST NOT** use `*` or `latest`
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## ✅ G-006: Testing mandatory
|
|
185
|
+
|
|
186
|
+
### G-006a: No untested code
|
|
187
|
+
**MUST NOT** merge untested code. See `05-testing-mandatory.md` for mandatory details.
|
|
188
|
+
|
|
189
|
+
### G-006b: Test pyramid
|
|
190
|
+
Required target ratio:
|
|
191
|
+
- 70% Unit tests
|
|
192
|
+
- 20% Integration tests
|
|
193
|
+
- 10% E2E tests
|
|
194
|
+
|
|
195
|
+
### G-006c: Test coverage threshold
|
|
196
|
+
- **Diff coverage** (new code in the PR): ≥ 80%
|
|
197
|
+
- **Overall coverage**: ≥ 70%
|
|
198
|
+
- Configured in `config/project-config.yaml`
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## 📚 G-007: Documentation mandatory
|
|
203
|
+
|
|
204
|
+
### G-007a: Every public API has docs
|
|
205
|
+
Public functions/classes/endpoints **MUST** have:
|
|
206
|
+
- Description
|
|
207
|
+
- Parameters with types
|
|
208
|
+
- Return value
|
|
209
|
+
- Examples, at least 1
|
|
210
|
+
- Error cases
|
|
211
|
+
|
|
212
|
+
### G-007b: ADR for architecture decisions
|
|
213
|
+
Every decision about:
|
|
214
|
+
- Framework/library choice
|
|
215
|
+
- Database schema major change
|
|
216
|
+
- Authentication strategy
|
|
217
|
+
- API versioning
|
|
218
|
+
- Caching strategy
|
|
219
|
+
|
|
220
|
+
**MUST** have an ADR in `docs/runtime/adr/NNN-title.md`.
|
|
221
|
+
|
|
222
|
+
### G-007c: README must be current
|
|
223
|
+
Every package/service **MUST** have a README with:
|
|
224
|
+
- Purpose
|
|
225
|
+
- Setup instructions
|
|
226
|
+
- How to run tests
|
|
227
|
+
- How to contribute
|
|
228
|
+
|
|
229
|
+
If setup changes, the AI **MUST** update the README in the same PR.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## 🎭 G-008: Role boundaries
|
|
234
|
+
|
|
235
|
+
### G-008a: Agents stay in lane
|
|
236
|
+
Every agent **MUST** work only inside the scope defined in frontmatter (`can_invoke_commands`, `write_access`).
|
|
237
|
+
|
|
238
|
+
**Examples**:
|
|
239
|
+
- BA **MUST NOT** write code, including examples
|
|
240
|
+
- Dev **MUST NOT** approve own PR
|
|
241
|
+
- QA **MUST NOT** modify production code to "fix a test"
|
|
242
|
+
|
|
243
|
+
### G-008b: No self-approval
|
|
244
|
+
Agents **MUST NOT** approve their own work:
|
|
245
|
+
- Dev **MUST NOT** review their own PR
|
|
246
|
+
- BA **MUST NOT** approve their own requirement
|
|
247
|
+
- Tech Lead may review, but major changes **MUST** have a second reviewer
|
|
248
|
+
|
|
249
|
+
### G-008c: Separation of concerns
|
|
250
|
+
- **Who decides WHAT**: BA/PM
|
|
251
|
+
- **Who decides HOW**: Tech Lead + Dev
|
|
252
|
+
- **Who decides WHEN**: Scrum Master + PM
|
|
253
|
+
- **Who verifies**: QA
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## 🔀 G-009: Git discipline
|
|
258
|
+
|
|
259
|
+
### G-009a: Conventional Commits
|
|
260
|
+
Mandatory format:
|
|
261
|
+
```
|
|
262
|
+
<type>(<scope>): <subject>
|
|
263
|
+
|
|
264
|
+
[body]
|
|
265
|
+
|
|
266
|
+
[footer]
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`, `build`, `ci`, `revert`.
|
|
270
|
+
|
|
271
|
+
Scope (optional but strongly recommended): `TICKET-XXX` or module name.
|
|
272
|
+
|
|
273
|
+
### G-009b: Branch naming
|
|
274
|
+
```
|
|
275
|
+
<type>/TICKET-<number>-<slug>
|
|
276
|
+
|
|
277
|
+
Types:
|
|
278
|
+
- feature/ (new feature)
|
|
279
|
+
- bugfix/ (bug fix in current sprint)
|
|
280
|
+
- hotfix/ (urgent production fix)
|
|
281
|
+
- chore/ (non-code: docs, deps)
|
|
282
|
+
- refactor/ (code cleanup, no behavior change)
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### G-009c: Protected branches
|
|
286
|
+
**MUST NOT** direct push to: `main`, `master`, `develop`, `release/*`, `staging`.
|
|
287
|
+
|
|
288
|
+
### G-009d: No force push to shared branches
|
|
289
|
+
**MUST NOT** run `git push --force` on a branch where others collaborate. It is allowed only on the agent's own feature branch before review.
|
|
290
|
+
|
|
291
|
+
### G-009e: Atomic commits
|
|
292
|
+
Every commit **MUST** represent exactly 1 logical unit. **MUST NOT**:
|
|
293
|
+
- Mix unrelated changes
|
|
294
|
+
- Commit WIP / broken code
|
|
295
|
+
- Commit commented-out code
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## 🔍 G-010: Transparency
|
|
300
|
+
|
|
301
|
+
### G-010a: No silent failures
|
|
302
|
+
If a command fails, the AI **MUST** surface the exact error clearly. Silent continuation and glossing over failures are **FORBIDDEN**.
|
|
303
|
+
|
|
304
|
+
### G-010b: Log decisions
|
|
305
|
+
Important decisions, for example choosing a library, skipping a test, or deviating from a template, **MUST** be logged in:
|
|
306
|
+
- ADR when architectural
|
|
307
|
+
- Ticket comment when ticket-specific
|
|
308
|
+
- Commit message body when implementation-specific
|
|
309
|
+
|
|
310
|
+
### G-010c: Uncertainty disclosure
|
|
311
|
+
When the AI is not 100% certain, it **MUST** state:
|
|
312
|
+
```
|
|
313
|
+
⚠️ Assumption: [what I'm assuming]
|
|
314
|
+
⚠️ Confidence: [high/medium/low]
|
|
315
|
+
⚠️ Risk if wrong: [impact]
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## 🚫 G-011: Absolute prohibitions
|
|
321
|
+
|
|
322
|
+
AI **MUST NEVER** do any of the following. There are no exceptions:
|
|
323
|
+
|
|
324
|
+
1. **Delete production data** (database records, user files)
|
|
325
|
+
2. **Modify git history** of shared branches (rebase, force push main)
|
|
326
|
+
3. **Bypass security controls** (disable auth, skip validation "for testing")
|
|
327
|
+
4. **Hardcode credentials**, including in tests
|
|
328
|
+
5. **Execute `rm -rf`** without explicit path confirmation
|
|
329
|
+
6. **Disable tests** ("skip for now", `.skip`, `xit`) without ticket justification
|
|
330
|
+
7. **Commit large binary files** (>10MB) without Git LFS
|
|
331
|
+
8. **Expose internal endpoints** without authentication
|
|
332
|
+
9. **Merge their own PR** (self-merge)
|
|
333
|
+
10. **Change DoD/DoR** while a sprint is running
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## 🎯 G-012: Definition of Done alignment
|
|
338
|
+
|
|
339
|
+
Every ticket **MUST** pass the **Definition of Done** (`08-definition-of-done.md`) before it can move to status `DONE`. "Urgent" and "temporary" are not exceptions.
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## 🔁 G-013: Continuous improvement
|
|
344
|
+
|
|
345
|
+
### G-013a: Retrospective actions
|
|
346
|
+
Retrospective action items **MUST** be tracked as normal tickets.
|
|
347
|
+
|
|
348
|
+
### G-013b: Rules evolution
|
|
349
|
+
These rules may be updated only through the controlled process:
|
|
350
|
+
- **MUST** be proposed through a PR
|
|
351
|
+
- **MUST** be discussed in a retrospective
|
|
352
|
+
- **MUST NOT** be bypassed by "editing the rule on the fly"
|
|
353
|
+
|
|
354
|
+
### G-013c: Challenge the rules
|
|
355
|
+
If a rule blocks delivery, an agent **MAY** challenge it through escalation. The rule may be reviewed, but the AI **MUST** follow the current rule until it is officially changed.
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## 📋 Compliance Check
|
|
360
|
+
|
|
361
|
+
Before every response, the AI **MUST** self-check:
|
|
362
|
+
- [ ] Is there an active ticket? (G-001)
|
|
363
|
+
- [ ] Am I writing only in allowed paths? (G-008a)
|
|
364
|
+
- [ ] Am I following the state machine? (G-003)
|
|
365
|
+
- [ ] Did I use the required handoff format? (G-004b)
|
|
366
|
+
- [ ] Did I disclose uncertainty? (G-010c)
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
**Version**: 1.0.0
|
|
371
|
+
**Last updated**: 2026-04-18
|
|
372
|
+
**Next review**: End of each sprint
|
|
373
|
+
**Maintainer**: Tech Lead + Scrum Master
|