engineering-intelligence 0.8.0 → 1.0.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/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +6 -4
- package/dist/adapters/index.js.map +1 -1
- package/dist/cli/index.js +20 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +2 -10
- package/dist/installer/index.js.map +1 -1
- package/dist/manifest/index.d.ts +1 -1
- package/dist/manifest/index.js +1 -1
- package/dist/templates.d.ts +3 -2
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +24 -1
- package/dist/templates.js.map +1 -1
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +2 -11
- package/dist/validation/index.js.map +1 -1
- package/dist/visualizer/index.d.ts.map +1 -1
- package/dist/visualizer/index.js +100 -5
- package/dist/visualizer/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/canonical/agents/engineering-orchestrator.md +21 -2
- package/templates/canonical/skills/codebase-discovery-engine/SKILL.md +428 -0
- package/templates/canonical/skills/convention-detector/SKILL.md +199 -0
- package/templates/canonical/skills/debugging-engine/SKILL.md +189 -0
- package/templates/canonical/skills/engineering-intelligence-skill/SKILL.md +4 -1
- package/templates/canonical/skills/git-intelligence-engine/SKILL.md +146 -0
- package/templates/canonical/skills/graph-engine/SKILL.md +30 -5
- package/templates/canonical/skills/greenfield-architect/SKILL.md +287 -0
- package/templates/canonical/skills/impact-analysis-engine/SKILL.md +12 -4
- package/templates/canonical/skills/incremental-sync-engine/SKILL.md +17 -0
- package/templates/canonical/skills/ongoing-learning-engine/SKILL.md +175 -0
- package/templates/canonical/skills/performance-analysis-engine/SKILL.md +156 -0
- package/templates/canonical/skills/pr-intelligence-engine/SKILL.md +127 -0
- package/templates/canonical/skills/security-audit-engine/SKILL.md +165 -0
- package/templates/canonical/skills/staleness-detector/SKILL.md +185 -0
- package/templates/canonical/workflows/create-project.md +63 -0
- package/templates/canonical/workflows/discover-codebase.md +60 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: greenfield-architect
|
|
3
|
+
description: Interview-based skill for new greenfield projects. Conducts a structured requirements interview (7-12 questions), generates architecture recommendations with tech stack selection, and scaffolds a complete project with pre-filled knowledge base, memory, context, configuration, CI/CD, and environment setup.
|
|
4
|
+
version: 3.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Greenfield Architect
|
|
8
|
+
|
|
9
|
+
Guide a developer from zero to a fully scaffolded, opinionated project with engineering intelligence pre-configured. This skill operates in three phases: requirements interview, architecture generation, and scaffold output.
|
|
10
|
+
|
|
11
|
+
## Inputs
|
|
12
|
+
|
|
13
|
+
- Project name
|
|
14
|
+
- Optional: partial requirements (if the user already knows some answers)
|
|
15
|
+
- Optional: preferred tech stack constraints (e.g., "must use Python", "no React")
|
|
16
|
+
|
|
17
|
+
## Phase 1: Requirements Interview (7–12 Questions)
|
|
18
|
+
|
|
19
|
+
Ask questions in this order. Skip questions the user has already answered. Present sensible defaults where possible so the user can simply confirm.
|
|
20
|
+
|
|
21
|
+
### 1.1 Core Questions (Always Ask)
|
|
22
|
+
|
|
23
|
+
| # | Question | Why It Matters | Default |
|
|
24
|
+
|---|---|---|---|
|
|
25
|
+
| 1 | **What are you building?** Describe the product in 2-3 sentences. | Determines domain, complexity, core features | — |
|
|
26
|
+
| 2 | **Who are the users?** (internal team, B2B, B2C, developers/API consumers) | Determines auth complexity, UI needs, scale expectations | B2C web app |
|
|
27
|
+
| 3 | **What are the 3-5 core features?** List the must-have capabilities for v1. | Scopes the architecture, identifies bounded contexts | — |
|
|
28
|
+
| 4 | **What scale do you expect?** (hobby, startup MVP, growth stage, enterprise) | Determines infrastructure complexity, database choice, caching needs | Startup MVP |
|
|
29
|
+
| 5 | **Where will this run?** (Vercel, AWS, GCP, Azure, self-hosted, edge) | Determines deployment strategy, serverless vs containers | Vercel |
|
|
30
|
+
| 6 | **Solo developer or team?** How many developers, what experience levels? | Determines convention strictness, CI complexity, review process | Solo |
|
|
31
|
+
| 7 | **Any hard tech constraints?** (must use language X, must integrate with Y, must comply with Z) | Constrains tech stack selection | None |
|
|
32
|
+
|
|
33
|
+
### 1.2 Conditional Questions (Ask Based on Answers)
|
|
34
|
+
|
|
35
|
+
| # | Condition | Question | Default |
|
|
36
|
+
|---|---|---|---|
|
|
37
|
+
| 8 | Users = B2C or B2B | **Auth requirements?** (email/password, social login, SSO, MFA) | Email/password + social |
|
|
38
|
+
| 9 | Scale ≥ growth | **Real-time features?** (WebSockets, SSE, live updates) | No |
|
|
39
|
+
| 10 | Features include payments | **Payment provider preference?** (Stripe, PayPal, custom) | Stripe |
|
|
40
|
+
| 11 | Team > 1 | **Monorepo or polyrepo?** | Monorepo if > 2 services |
|
|
41
|
+
| 12 | Features include content | **CMS needs?** (headless CMS, built-in, markdown) | Markdown/MDX |
|
|
42
|
+
|
|
43
|
+
### Interview Rules
|
|
44
|
+
|
|
45
|
+
- Present each question with the default value: "I'd suggest X because Y — does that work?"
|
|
46
|
+
- Allow batch answers: the user can answer multiple questions at once
|
|
47
|
+
- If the user provides a project brief, extract answers from it before asking remaining questions
|
|
48
|
+
- Never ask more than 12 questions total
|
|
49
|
+
- Confirm the full requirements summary before proceeding to Phase 2
|
|
50
|
+
|
|
51
|
+
## Phase 2: Architecture Generation
|
|
52
|
+
|
|
53
|
+
Based on interview answers, generate architecture recommendations.
|
|
54
|
+
|
|
55
|
+
### 2.1 Tech Stack Selection
|
|
56
|
+
|
|
57
|
+
Use this decision matrix to recommend a tech stack:
|
|
58
|
+
|
|
59
|
+
| Requirement | Next.js | Vite+React | Solid.js | Express | FastAPI | Django | Spring Boot |
|
|
60
|
+
|---|---|---|---|---|---|---|---|
|
|
61
|
+
| SSR/SSG needed | ✅ Best | ❌ SPA only | ⚠️ SolidStart | N/A | N/A | ✅ Templates | N/A |
|
|
62
|
+
| API-only backend | ❌ Overkill | N/A | N/A | ✅ Best | ✅ Best | ✅ Good | ✅ Best |
|
|
63
|
+
| Full-stack | ✅ Best | ⚠️ Need backend | ⚠️ Emerging | ⚠️ Need frontend | ⚠️ Need frontend | ✅ Good | ⚠️ Need frontend |
|
|
64
|
+
| Real-time | ⚠️ Via API routes | ⚠️ Need backend | ⚠️ Need backend | ✅ Socket.io | ✅ WebSockets | ⚠️ Channels | ✅ WebSocket |
|
|
65
|
+
| Enterprise/Java team | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ Best |
|
|
66
|
+
| Python team | ❌ | ❌ | ❌ | ❌ | ✅ Best | ✅ Best | ❌ |
|
|
67
|
+
| Rapid prototyping | ✅ Good | ✅ Good | ⚠️ Smaller ecosystem | ✅ Good | ✅ Best | ✅ Good | ❌ Slower |
|
|
68
|
+
| Edge deployment | ✅ Best | ✅ Good | ✅ Good | ⚠️ Node only | ❌ | ❌ | ❌ |
|
|
69
|
+
|
|
70
|
+
Present the recommendation with reasoning: "I recommend X because [reasons based on your answers]."
|
|
71
|
+
|
|
72
|
+
### 2.2 Database Selection
|
|
73
|
+
|
|
74
|
+
| Requirement | PostgreSQL | MySQL | MongoDB | SQLite | DynamoDB |
|
|
75
|
+
|---|---|---|---|---|---|
|
|
76
|
+
| Relational data | ✅ Best | ✅ Good | ❌ | ✅ Good | ❌ |
|
|
77
|
+
| Document-heavy | ⚠️ JSONB | ⚠️ JSON | ✅ Best | ❌ | ✅ Good |
|
|
78
|
+
| Hobby/MVP | ✅ Good | ✅ Good | ✅ Good | ✅ Best | ⚠️ Overkill |
|
|
79
|
+
| Enterprise scale | ✅ Best | ✅ Good | ✅ Good | ❌ | ✅ Best |
|
|
80
|
+
| Serverless | ⚠️ Need pooling | ⚠️ Need pooling | ✅ Atlas | ✅ Turso/Litestream | ✅ Native |
|
|
81
|
+
|
|
82
|
+
### 2.3 Folder Structure Generation
|
|
83
|
+
|
|
84
|
+
Generate an opinionated folder structure based on the selected stack. Example for Next.js:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
project-root/
|
|
88
|
+
├── src/
|
|
89
|
+
│ ├── app/ # Next.js App Router pages
|
|
90
|
+
│ │ ├── (auth)/ # Auth route group
|
|
91
|
+
│ │ ├── (dashboard)/ # Dashboard route group
|
|
92
|
+
│ │ ├── api/ # API routes
|
|
93
|
+
│ │ ├── layout.tsx
|
|
94
|
+
│ │ └── page.tsx
|
|
95
|
+
│ ├── components/
|
|
96
|
+
│ │ ├── ui/ # Reusable UI primitives
|
|
97
|
+
│ │ └── features/ # Feature-specific components
|
|
98
|
+
│ ├── lib/ # Shared utilities
|
|
99
|
+
│ ├── server/ # Server-only code
|
|
100
|
+
│ │ ├── db/ # Database client & queries
|
|
101
|
+
│ │ ├── auth/ # Auth configuration
|
|
102
|
+
│ │ └── services/ # Business logic
|
|
103
|
+
│ └── types/ # Shared type definitions
|
|
104
|
+
├── prisma/
|
|
105
|
+
│ └── schema.prisma
|
|
106
|
+
├── tests/
|
|
107
|
+
│ ├── unit/
|
|
108
|
+
│ ├── integration/
|
|
109
|
+
│ └── e2e/
|
|
110
|
+
├── .github/
|
|
111
|
+
│ └── workflows/
|
|
112
|
+
├── knowledge-base/ # Pre-filled engineering intelligence
|
|
113
|
+
├── .engineering-intelligence/
|
|
114
|
+
│ ├── memory/
|
|
115
|
+
│ ├── context/
|
|
116
|
+
│ ├── events/
|
|
117
|
+
│ ├── graph/
|
|
118
|
+
│ └── reports/
|
|
119
|
+
├── engineering.config.json
|
|
120
|
+
├── .env.example
|
|
121
|
+
└── ...config files
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 2.4 ADR Generation
|
|
125
|
+
|
|
126
|
+
Generate initial Architectural Decision Records for key choices:
|
|
127
|
+
|
|
128
|
+
| ADR | Content |
|
|
129
|
+
|---|---|
|
|
130
|
+
| `ADR-001-tech-stack.md` | Why this framework/language was chosen |
|
|
131
|
+
| `ADR-002-database.md` | Why this database and ORM were chosen |
|
|
132
|
+
| `ADR-003-auth.md` | Why this auth strategy was chosen |
|
|
133
|
+
| `ADR-004-deployment.md` | Why this deployment target was chosen |
|
|
134
|
+
| `ADR-005-testing.md` | Why this testing strategy was chosen |
|
|
135
|
+
| `ADR-006-project-structure.md` | Why this folder structure was chosen |
|
|
136
|
+
|
|
137
|
+
Each ADR follows the format:
|
|
138
|
+
```markdown
|
|
139
|
+
# ADR-NNN: <Title>
|
|
140
|
+
|
|
141
|
+
## Status: Accepted
|
|
142
|
+
## Date: <date>
|
|
143
|
+
|
|
144
|
+
## Context
|
|
145
|
+
<what prompted this decision>
|
|
146
|
+
|
|
147
|
+
## Decision
|
|
148
|
+
<what was decided>
|
|
149
|
+
|
|
150
|
+
## Consequences
|
|
151
|
+
<positive and negative impacts>
|
|
152
|
+
|
|
153
|
+
## Alternatives Considered
|
|
154
|
+
<what else was evaluated and why it was rejected>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 2.5 CI/CD Generation
|
|
158
|
+
|
|
159
|
+
Generate CI/CD configuration based on deployment target:
|
|
160
|
+
|
|
161
|
+
| Deployment | CI/CD Tool | Pipeline Stages |
|
|
162
|
+
|---|---|---|
|
|
163
|
+
| Vercel | GitHub Actions + Vercel | Lint → Type Check → Test → Preview Deploy → Prod Deploy |
|
|
164
|
+
| AWS | GitHub Actions + AWS CDK/SAM | Lint → Test → Build → Staging Deploy → Prod Deploy |
|
|
165
|
+
| GCP | GitHub Actions + Cloud Build | Lint → Test → Build → Cloud Run Deploy |
|
|
166
|
+
| Self-hosted | GitHub Actions + Docker | Lint → Test → Build Image → Push → Deploy |
|
|
167
|
+
|
|
168
|
+
### 2.6 Testing Strategy
|
|
169
|
+
|
|
170
|
+
| Test Type | Tool | What to Test | Coverage Target |
|
|
171
|
+
|---|---|---|---|
|
|
172
|
+
| Unit | Jest/Vitest/pytest | Business logic, utilities, pure functions | 80% |
|
|
173
|
+
| Integration | Supertest/httpx/Spring Test | API endpoints, database queries, auth flows | Key paths |
|
|
174
|
+
| E2E | Playwright/Cypress | Critical user journeys (signup, core feature, payment) | Happy paths |
|
|
175
|
+
| Component | Testing Library/Storybook | UI components in isolation | Key components |
|
|
176
|
+
|
|
177
|
+
## Phase 3: Scaffold Output
|
|
178
|
+
|
|
179
|
+
Generate all files for the new project.
|
|
180
|
+
|
|
181
|
+
### 3.1 Configuration Files
|
|
182
|
+
|
|
183
|
+
| File | Content |
|
|
184
|
+
|---|---|
|
|
185
|
+
| `engineering.config.json` | Project metadata, tech stack, conventions, sync settings |
|
|
186
|
+
| `.env.example` | All required environment variables with placeholder values and comments |
|
|
187
|
+
| `tsconfig.json` / `pyproject.toml` / etc. | Language-appropriate config with strict settings |
|
|
188
|
+
| `.eslintrc` / `ruff.toml` / etc. | Linter config matching conventions |
|
|
189
|
+
| `.prettierrc` / etc. | Formatter config |
|
|
190
|
+
| `.gitignore` | Comprehensive gitignore for the selected stack |
|
|
191
|
+
|
|
192
|
+
### 3.2 Pre-filled Knowledge Base
|
|
193
|
+
|
|
194
|
+
Generate starter versions of all knowledge base documents (00–16) with:
|
|
195
|
+
- Architecture decisions from Phase 2 as content
|
|
196
|
+
- `**Not yet implemented**` for areas that will be built
|
|
197
|
+
- Evidence citations pointing to generated config files
|
|
198
|
+
- Conventions from Phase 2 decisions pre-populated in `16-conventions.md`
|
|
199
|
+
|
|
200
|
+
### 3.3 Pre-filled Memory
|
|
201
|
+
|
|
202
|
+
| Memory File | Pre-filled Content |
|
|
203
|
+
|---|---|
|
|
204
|
+
| `architecture-decisions.md` | ADRs from Phase 2 |
|
|
205
|
+
| `technology-decisions.md` | Tech stack rationale |
|
|
206
|
+
| `coding-patterns.md` | Conventions chosen during scaffold |
|
|
207
|
+
| `project-constraints.md` | Scale, deployment, team constraints from interview |
|
|
208
|
+
| `business-rules.md` | Core features and domain concepts from interview |
|
|
209
|
+
|
|
210
|
+
### 3.4 Pre-filled Context
|
|
211
|
+
|
|
212
|
+
| Context File | Pre-filled Content |
|
|
213
|
+
|---|---|
|
|
214
|
+
| `module-map.md` | Planned module structure from folder layout |
|
|
215
|
+
| `critical-paths.md` | Core feature flows identified in interview |
|
|
216
|
+
|
|
217
|
+
### 3.5 Event Guidance
|
|
218
|
+
|
|
219
|
+
Generate starter event guidance files with generic templates appropriate for the chosen stack.
|
|
220
|
+
|
|
221
|
+
### 3.6 Engineering Config
|
|
222
|
+
|
|
223
|
+
```json
|
|
224
|
+
{
|
|
225
|
+
"project": "<name>",
|
|
226
|
+
"version": "0.1.0",
|
|
227
|
+
"stack": {
|
|
228
|
+
"language": "<primary language>",
|
|
229
|
+
"framework": "<framework>",
|
|
230
|
+
"database": "<database>",
|
|
231
|
+
"orm": "<orm>",
|
|
232
|
+
"auth": "<auth solution>",
|
|
233
|
+
"deployment": "<deployment target>"
|
|
234
|
+
},
|
|
235
|
+
"conventions": {
|
|
236
|
+
"naming": "<chosen naming convention>",
|
|
237
|
+
"testing": "<chosen test strategy>",
|
|
238
|
+
"branching": "<chosen git strategy>"
|
|
239
|
+
},
|
|
240
|
+
"intelligence": {
|
|
241
|
+
"initialized": true,
|
|
242
|
+
"initializedAt": "<timestamp>",
|
|
243
|
+
"method": "greenfield-architect"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Procedure
|
|
249
|
+
|
|
250
|
+
1. **Greet and assess** — Check if the user has provided any upfront context. Extract answers from any provided brief.
|
|
251
|
+
2. **Run interview** — Ask Phase 1 questions, skipping any already answered. Present defaults.
|
|
252
|
+
3. **Summarize requirements** — Present a complete requirements summary and get confirmation.
|
|
253
|
+
4. **Select tech stack** — Apply Phase 2 decision matrices. Present recommendation with reasoning.
|
|
254
|
+
5. **Get stack approval** — Allow the user to override any recommendation.
|
|
255
|
+
6. **Generate folder structure** — Create the directory layout based on approved stack.
|
|
256
|
+
7. **Generate ADRs** — Write ADR documents for each major decision.
|
|
257
|
+
8. **Generate CI/CD** — Create pipeline configuration for the deployment target.
|
|
258
|
+
9. **Generate configs** — Create all configuration files (linter, formatter, tsconfig, etc.).
|
|
259
|
+
10. **Generate knowledge base** — Pre-fill all knowledge base documents.
|
|
260
|
+
11. **Generate memory** — Pre-fill memory with decisions and constraints.
|
|
261
|
+
12. **Generate context** — Pre-fill context with planned module structure.
|
|
262
|
+
13. **Generate event guidance** — Create starter event guidance templates.
|
|
263
|
+
14. **Write engineering.config.json** — Create the project configuration file.
|
|
264
|
+
15. **Create .env.example** — List all required environment variables.
|
|
265
|
+
16. **Report** — Summarize everything generated and list next steps for the developer.
|
|
266
|
+
|
|
267
|
+
## Quality Gates
|
|
268
|
+
|
|
269
|
+
- [ ] Requirements interview asked between 7 and 12 questions
|
|
270
|
+
- [ ] Requirements summary was confirmed before architecture generation
|
|
271
|
+
- [ ] Tech stack recommendation includes reasoning tied to interview answers
|
|
272
|
+
- [ ] At least 5 ADRs are generated for major decisions
|
|
273
|
+
- [ ] Folder structure matches the selected framework's conventions
|
|
274
|
+
- [ ] CI/CD pipeline includes at minimum: lint, test, build, deploy stages
|
|
275
|
+
- [ ] `.env.example` lists all required environment variables with descriptions
|
|
276
|
+
- [ ] Knowledge base documents (00–16) are pre-filled with scaffolded content
|
|
277
|
+
- [ ] Memory files contain only durable decisions (not transient implementation details)
|
|
278
|
+
- [ ] `engineering.config.json` exists with complete project metadata
|
|
279
|
+
- [ ] Testing strategy is defined with tool selection and coverage targets
|
|
280
|
+
- [ ] All generated files use evidence citations pointing to other generated files
|
|
281
|
+
|
|
282
|
+
## Cross-References
|
|
283
|
+
|
|
284
|
+
- Uses: `codebase-discovery-engine` (for post-scaffold verification)
|
|
285
|
+
- Feeds into: `initialize-intelligence-skill` (provides the initial knowledge baseline)
|
|
286
|
+
- Consumed by: `engineering-intelligence-skill`, `engineering-orchestrator`
|
|
287
|
+
- Related: `convention-detector` (validates conventions after initial development)
|
|
@@ -32,9 +32,13 @@ Determine what can break before changing code. Produce a reusable impact report
|
|
|
32
32
|
- Services communicating with changed services (from service-graph)
|
|
33
33
|
- Runtime flows passing through changed code (from runtime-graph)
|
|
34
34
|
- Business processes affected (from business-flow-graph)
|
|
35
|
+
- Data pipelines affected (from data-flow-graph)
|
|
35
36
|
- Test suites covering affected code
|
|
37
|
+
- Cross-reference with git change coupling data from `git-intelligence-engine` for hidden dependencies
|
|
36
38
|
|
|
37
|
-
5. **
|
|
39
|
+
5. **Trace Transitive Impact** — Follow 2nd and 3rd order effects through the graph. Identify files that are indirectly affected by consumers of the directly affected modules. Walk the dependency chain until impact attenuates or reaches a service boundary.
|
|
40
|
+
|
|
41
|
+
6. **Score Risk** — Assign risk based on:
|
|
38
42
|
|
|
39
43
|
| Factor | Low | Medium | High | Critical |
|
|
40
44
|
|---|---|---|---|---|
|
|
@@ -43,8 +47,9 @@ Determine what can break before changing code. Produce a reusable impact report
|
|
|
43
47
|
| **Auth impact** | None | UI changes | Permission logic | Auth flow |
|
|
44
48
|
| **API contract** | None | Additive | Deprecated | Breaking |
|
|
45
49
|
| **Test coverage** | Well-tested | Partial | Sparse | None |
|
|
50
|
+
| **Change coupling** | None | Low (1-2 coupled files) | Medium (3-5 coupled files) | High (6+ coupled files) |
|
|
46
51
|
|
|
47
|
-
|
|
52
|
+
7. **Identify Validation Needs** — Map impact to required validation:
|
|
48
53
|
|
|
49
54
|
| Impact Area | Validation Required |
|
|
50
55
|
|---|---|
|
|
@@ -55,7 +60,9 @@ Determine what can break before changing code. Produce a reusable impact report
|
|
|
55
60
|
| UI change | Visual regression, accessibility |
|
|
56
61
|
| Infrastructure | Deploy to staging, smoke test |
|
|
57
62
|
|
|
58
|
-
|
|
63
|
+
8. **Map Intelligence Artifacts** — Determine which intelligence artifacts need synchronization after the change is implemented.
|
|
64
|
+
|
|
65
|
+
> **Surprise Impact Detection**: Flag any dependency discovered during analysis that is NOT in the current graph — these are surprise impacts that should be added to the graph. Surprise impacts indicate missing edges or nodes and must be reported in the Unknowns section of the impact report.
|
|
59
66
|
|
|
60
67
|
## Output Format
|
|
61
68
|
|
|
@@ -129,6 +136,7 @@ Write `.engineering-intelligence/reports/IMP-XXX-<slug>.md`:
|
|
|
129
136
|
|
|
130
137
|
## Cross-References
|
|
131
138
|
|
|
132
|
-
- Depends on: `change-detection-engine`, `graph-engine`
|
|
139
|
+
- Depends on: `change-detection-engine`, `graph-engine`, `git-intelligence-engine`
|
|
140
|
+
- Consults: `data-flow-graph.json` (for data pipeline impact)
|
|
133
141
|
- Used by: `engineering-intelligence-skill`, `incremental-sync-engine`, `analyze-impact` workflow
|
|
134
142
|
- Consumed by: `engineering-change-review`, `testing-intelligence-engine`
|
|
@@ -30,6 +30,8 @@ Use this matrix to determine which artifact types need updating based on the cha
|
|
|
30
30
|
| Refactor (no behavior change) | — | `coding-patterns.md` | affected maps | — | dependency-graph | — |
|
|
31
31
|
| Test changes only | — | — | — | — | — | — |
|
|
32
32
|
| Config/env changes | `09-infrastructure.md` | `project-constraints.md` | — | — | — | — |
|
|
33
|
+
| Convention changed | `16-conventions.md` | `coding-patterns.md` | — | — | — | — |
|
|
34
|
+
| Security concern detected | `20-security-assessment.md` | — | — | — | — | — |
|
|
33
35
|
|
|
34
36
|
## Procedure
|
|
35
37
|
|
|
@@ -62,6 +64,20 @@ Use this matrix to determine which artifact types need updating based on the cha
|
|
|
62
64
|
|
|
63
65
|
8. **Update Impact Report** — Add a synchronization notes section to the original impact report recording what was synced.
|
|
64
66
|
|
|
67
|
+
9. **Check Freshness** — After sync, update freshness metadata on all modified documents. If any document freshness score drops below 40, flag for full re-verification using `staleness-detector`.
|
|
68
|
+
|
|
69
|
+
## Confidence Decay
|
|
70
|
+
|
|
71
|
+
Confidence scores decrease over time without re-verification:
|
|
72
|
+
|
|
73
|
+
| Changes Since Last Verification | Confidence Level |
|
|
74
|
+
|---|---|
|
|
75
|
+
| 0–9 changes | Maintains current confidence |
|
|
76
|
+
| 10–24 changes | Drops from `verified` to `inferred` |
|
|
77
|
+
| 25+ changes | Drops to `unknown` |
|
|
78
|
+
|
|
79
|
+
During sync, check how many changes have occurred since each artifact was last verified. Apply decay rules and flag artifacts that have dropped confidence for re-verification.
|
|
80
|
+
|
|
65
81
|
## Rules
|
|
66
82
|
|
|
67
83
|
- **Incremental only**: Update only artifacts identified by the impact report — never regenerate unrelated content
|
|
@@ -84,3 +100,4 @@ Use this matrix to determine which artifact types need updating based on the cha
|
|
|
84
100
|
- Depends on: `change-detection-engine`, `impact-analysis-engine`, `graph-engine`
|
|
85
101
|
- Used by: `engineering-intelligence-skill`, `sync-engineering-intelligence` workflow
|
|
86
102
|
- Delegates to: `knowledge-sync-engine`, `memory-sync-engine`, `context-sync-engine`
|
|
103
|
+
- Integrates with: `staleness-detector` (freshness checks), `convention-detector` (convention sync)
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ongoing-learning-engine
|
|
3
|
+
description: Handles post-initialization continuous learning by detecting uncertainty, logging learning events, triggering targeted re-discovery, updating memory with newly learned patterns, tracking knowledge freshness scores, and enforcing staleness detection rules.
|
|
4
|
+
version: 3.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Ongoing Learning Engine
|
|
8
|
+
|
|
9
|
+
Continuously maintain and improve the AI's understanding of a codebase after initial discovery. This engine activates whenever the AI encounters areas it does not understand, when code changes invalidate existing knowledge, or when knowledge freshness degrades below acceptable thresholds.
|
|
10
|
+
|
|
11
|
+
This capability does not modify product code.
|
|
12
|
+
|
|
13
|
+
## Inputs
|
|
14
|
+
|
|
15
|
+
- Current task context (what the AI is trying to do when uncertainty is encountered)
|
|
16
|
+
- Repository root path
|
|
17
|
+
- Existing knowledge base, memory, and context documents
|
|
18
|
+
- Optional: specific module or area to re-learn
|
|
19
|
+
- Optional: trigger event (uncertainty, staleness, explicit request)
|
|
20
|
+
|
|
21
|
+
## Trigger Conditions
|
|
22
|
+
|
|
23
|
+
The ongoing learning engine activates under these conditions:
|
|
24
|
+
|
|
25
|
+
| Trigger | Condition | Action |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| **Uncertainty encountered** | AI cannot confidently answer a question about the codebase | Log uncertainty event, initiate targeted re-discovery |
|
|
28
|
+
| **Staleness threshold** | Knowledge freshness score drops below 60 for a module | Trigger incremental re-scan of the stale module |
|
|
29
|
+
| **Code change detected** | Files in a module changed since last knowledge update | Queue module for freshness re-evaluation |
|
|
30
|
+
| **Explicit request** | User asks to re-learn or refresh understanding of an area | Full re-discovery of specified scope |
|
|
31
|
+
| **Convention drift** | Detected patterns deviate from documented conventions | Log drift event, update conventions |
|
|
32
|
+
| **New dependency** | A new package/dependency is added to the project | Scan and document the new dependency |
|
|
33
|
+
|
|
34
|
+
## Procedure
|
|
35
|
+
|
|
36
|
+
1. **Detect uncertainty** — Monitor for these uncertainty signals during any task:
|
|
37
|
+
- Unable to locate a file or module referenced in knowledge base
|
|
38
|
+
- Code structure does not match documented architecture
|
|
39
|
+
- An import path or API endpoint has changed
|
|
40
|
+
- A function signature or behavior differs from documentation
|
|
41
|
+
- A convention violation is found in new code (drift vs intentional change)
|
|
42
|
+
- Business logic encountered that has no corresponding documentation
|
|
43
|
+
|
|
44
|
+
2. **Log uncertainty event** — Write to `.engineering-intelligence/events/uncertainty-log.md`:
|
|
45
|
+
|
|
46
|
+
```markdown
|
|
47
|
+
## <timestamp> — Uncertainty Event
|
|
48
|
+
|
|
49
|
+
- **Trigger**: <what the AI was doing>
|
|
50
|
+
- **Area**: <module/file/concept>
|
|
51
|
+
- **Type**: missing | outdated | contradictory | ambiguous
|
|
52
|
+
- **Severity**: low | medium | high | critical
|
|
53
|
+
- **Description**: <what is uncertain and why>
|
|
54
|
+
- **Current knowledge**: <what the existing docs say>
|
|
55
|
+
- **Observed reality**: <what the code actually shows>
|
|
56
|
+
- **Resolution**: pending | resolved | deferred
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
3. **Classify the uncertainty** — Determine the appropriate response:
|
|
60
|
+
|
|
61
|
+
| Type | Description | Response |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| **Missing** | No documentation exists for this area | Trigger targeted re-discovery |
|
|
64
|
+
| **Outdated** | Documentation exists but is stale | Trigger incremental sync of affected documents |
|
|
65
|
+
| **Contradictory** | Documentation contradicts code evidence | Flag for human review, update with code-as-truth |
|
|
66
|
+
| **Ambiguous** | Multiple interpretations are plausible | Log both interpretations, ask for clarification |
|
|
67
|
+
|
|
68
|
+
4. **Execute targeted re-discovery** — For the specific area of uncertainty:
|
|
69
|
+
- Re-scan only the affected module/directory (not the full repository)
|
|
70
|
+
- Compare new findings against existing documentation
|
|
71
|
+
- Identify what changed and what is new
|
|
72
|
+
- Use `codebase-discovery-engine` scanning techniques but scoped to the specific area
|
|
73
|
+
|
|
74
|
+
5. **Update knowledge** — Apply changes to the appropriate knowledge documents:
|
|
75
|
+
- Update knowledge base documents with corrected information
|
|
76
|
+
- Add `Last updated:` timestamp to modified sections
|
|
77
|
+
- Preserve evidence citations — update with new file paths/line numbers
|
|
78
|
+
- Record the update in the uncertainty log as `resolved`
|
|
79
|
+
|
|
80
|
+
6. **Durability check** — Before writing any new pattern or fact to memory, apply these filters:
|
|
81
|
+
- **Will this still be relevant after 5+ more changes?** If no → do not store in memory
|
|
82
|
+
- **Is this a project-wide pattern or a local implementation detail?** If local → do not store in memory
|
|
83
|
+
- **Does this duplicate existing memory?** If yes → merge rather than add
|
|
84
|
+
- **Is this a transient state or a durable decision?** If transient → log in events, not memory
|
|
85
|
+
|
|
86
|
+
7. **Track knowledge freshness** — Maintain freshness scores per module:
|
|
87
|
+
|
|
88
|
+
```markdown
|
|
89
|
+
## Knowledge Freshness Tracker
|
|
90
|
+
|
|
91
|
+
| Module | Last Scanned | Last Code Change | Freshness Score | Status |
|
|
92
|
+
|---|---|---|---|---|
|
|
93
|
+
| auth/ | 2024-01-15 | 2024-01-20 | 45 | 🔴 Stale |
|
|
94
|
+
| api/ | 2024-01-18 | 2024-01-18 | 95 | 🟢 Fresh |
|
|
95
|
+
| ... | ... | ... | ... | ... |
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Freshness score calculation:**
|
|
99
|
+
- Start at 100 when a module is scanned
|
|
100
|
+
- Subtract 5 points per day since last scan if code has changed
|
|
101
|
+
- Subtract 2 points per day since last scan if code has NOT changed (knowledge can still drift)
|
|
102
|
+
- Subtract 10 points per file changed in module since last scan
|
|
103
|
+
- Floor at 0, cap at 100
|
|
104
|
+
|
|
105
|
+
8. **Staleness detection** — Apply these rules continuously:
|
|
106
|
+
|
|
107
|
+
| Rule | Threshold | Action |
|
|
108
|
+
|---|---|---|
|
|
109
|
+
| Module freshness < 60 | Score drops below 60 | Queue for targeted re-discovery |
|
|
110
|
+
| Module freshness < 30 | Score drops below 30 | Flag as critical, prioritize re-discovery |
|
|
111
|
+
| No scan in 30 days | 30 days elapsed | Flag for freshness check regardless of score |
|
|
112
|
+
| >10 files changed since scan | File change count | Trigger immediate re-scan |
|
|
113
|
+
| Architecture document stale | Any architecture doc with freshness < 50 | Trigger full architecture re-assessment |
|
|
114
|
+
|
|
115
|
+
9. **Generate learning summary** — Periodically (or on request) produce a learning summary:
|
|
116
|
+
|
|
117
|
+
```markdown
|
|
118
|
+
## Learning Summary — <date range>
|
|
119
|
+
|
|
120
|
+
### Uncertainty Events
|
|
121
|
+
- Total events: <N>
|
|
122
|
+
- Resolved: <N>
|
|
123
|
+
- Pending: <N>
|
|
124
|
+
- Deferred: <N>
|
|
125
|
+
|
|
126
|
+
### Knowledge Updates
|
|
127
|
+
- Documents updated: <list>
|
|
128
|
+
- Memory entries added: <N>
|
|
129
|
+
- Memory entries revised: <N>
|
|
130
|
+
- Memory entries retired: <N>
|
|
131
|
+
|
|
132
|
+
### Freshness Overview
|
|
133
|
+
- Modules scanned: <N>
|
|
134
|
+
- Average freshness: <score>
|
|
135
|
+
- Stale modules (< 60): <list>
|
|
136
|
+
- Critical modules (< 30): <list>
|
|
137
|
+
|
|
138
|
+
### Patterns Learned
|
|
139
|
+
- <new patterns discovered this period>
|
|
140
|
+
|
|
141
|
+
### Open Questions
|
|
142
|
+
- <questions that need human input>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Output Files
|
|
146
|
+
|
|
147
|
+
| File | Purpose |
|
|
148
|
+
|---|---|
|
|
149
|
+
| `.engineering-intelligence/events/uncertainty-log.md` | Append-only log of all uncertainty events |
|
|
150
|
+
| `.engineering-intelligence/reports/FRESHNESS-report.md` | Current freshness scores per module (shared with `staleness-detector`) |
|
|
151
|
+
| Updated knowledge base documents | Corrected or expanded knowledge |
|
|
152
|
+
| Updated memory documents | New durable patterns and decisions |
|
|
153
|
+
|
|
154
|
+
## Quality Gates
|
|
155
|
+
|
|
156
|
+
- [ ] Every uncertainty event is logged before any re-discovery begins
|
|
157
|
+
- [ ] Uncertainty events include type, severity, and description
|
|
158
|
+
- [ ] Targeted re-discovery scopes to the affected module only (not full repo)
|
|
159
|
+
- [ ] Durability check is applied before any memory write
|
|
160
|
+
- [ ] Knowledge freshness scores are calculated using the defined formula
|
|
161
|
+
- [ ] Staleness thresholds trigger appropriate actions
|
|
162
|
+
- [ ] Updated documents preserve evidence citation format
|
|
163
|
+
- [ ] Learning summary is accurate and reflects actual events
|
|
164
|
+
- [ ] No transient implementation details are stored in memory
|
|
165
|
+
- [ ] Contradictory findings are flagged for human review (not silently resolved)
|
|
166
|
+
|
|
167
|
+
## Cross-References
|
|
168
|
+
|
|
169
|
+
- Depends on: `codebase-discovery-engine` (for targeted re-discovery techniques)
|
|
170
|
+
- Uses: `staleness-detector` (for freshness scoring), `incremental-sync-engine` (for knowledge updates)
|
|
171
|
+
- Consumed by: `engineering-intelligence-skill`, `engineering-orchestrator`
|
|
172
|
+
- Feeds into: `.engineering-intelligence/events/uncertainty-log.md`, all knowledge base documents
|
|
173
|
+
- Related: `convention-detector` (for convention drift detection)
|
|
174
|
+
|
|
175
|
+
This capability does not modify product code.
|