@svashevchenko/ez-know 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/README.md +91 -0
- package/dist/cli.js +4709 -0
- package/dist/cli.js.map +7 -0
- package/dist/guides/business-rules.md +47 -0
- package/dist/guides/capabilities.md +41 -0
- package/dist/guides/conflicts.md +16 -0
- package/dist/guides/constraints.md +35 -0
- package/dist/guides/domains.md +17 -0
- package/dist/guides/entities.md +44 -0
- package/dist/guides/evidence.md +16 -0
- package/dist/guides/features.md +43 -0
- package/dist/guides/questions.md +17 -0
- package/dist/guides/rationales.md +17 -0
- package/dist/guides/relationships.md +19 -0
- package/dist/public/assets/index-BvKMODjW.js +331 -0
- package/dist/public/assets/index-CzQmD36n.css +1 -0
- package/dist/public/index.html +17 -0
- package/dist/reference/ez-know-extract-knowledge-from-code/SKILL.md +339 -0
- package/dist/reference/ez-know-update-knowledge-base/SKILL.md +312 -0
- package/dist/rest/server.js +3237 -0
- package/dist/rest/server.js.map +7 -0
- package/dist/server.js +3357 -0
- package/dist/server.js.map +7 -0
- package/package.json +73 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ez-know-extract-knowledge-from-code
|
|
3
|
+
description: Extract AS-IS product knowledge from a codebase into the ez-know product-knowledge-base. Use when the user wants to start knowledge extraction from existing code.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ez-know-extract-knowledge-from-code
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Use this skill to extract AS-IS product knowledge from a codebase into the ez-know product knowledge base.
|
|
11
|
+
|
|
12
|
+
The goal is product meaning, not a dependency map, ownership map, hotspot report, bus-factor report, or file catalog.
|
|
13
|
+
|
|
14
|
+
## Core Principles
|
|
15
|
+
|
|
16
|
+
- Work incrementally;
|
|
17
|
+
- Keep the analysis scope small;
|
|
18
|
+
- Inspect scope boundaries before finalizing conclusions;
|
|
19
|
+
- Prefer evidence over assumptions;
|
|
20
|
+
- Do not write large knowledge batches at once;
|
|
21
|
+
- Maintain domain-oriented knowledge structure;
|
|
22
|
+
- Every meaningful statement needs evidence.
|
|
23
|
+
- Use questions when confidence is low or intent is unclear.
|
|
24
|
+
- Treat conflicts as first-class objects instead of merging uncertain meanings.
|
|
25
|
+
- Search existing records with `ez-know` MCP to avoid duplication and increase consistency.
|
|
26
|
+
|
|
27
|
+
## Required ez-know MCP Resource Loading Pattern
|
|
28
|
+
|
|
29
|
+
Before working with any object type, load the corresponding resources from MCP:
|
|
30
|
+
|
|
31
|
+
1. object schema;
|
|
32
|
+
2. extraction instruction for that object type.
|
|
33
|
+
|
|
34
|
+
Perform analysis, candidate detection, ID drafting, duplicate checks, using the loaded MCP resources as references.
|
|
35
|
+
Do not keep all resources in context by default. Load only what is needed for the current phase.
|
|
36
|
+
|
|
37
|
+
If a required resource is unavailable:
|
|
38
|
+
|
|
39
|
+
- do not invent its schema;
|
|
40
|
+
- do not finalize objects of that type;
|
|
41
|
+
- continue only with object types whose resources are available;
|
|
42
|
+
- explicitly report the missing resource.
|
|
43
|
+
|
|
44
|
+
## Patch Workflow
|
|
45
|
+
|
|
46
|
+
Write extraction results through the knowledge patch workflow rather than by mutating canonical knowledge files directly.
|
|
47
|
+
|
|
48
|
+
Recommended flow:
|
|
49
|
+
|
|
50
|
+
1. Create or reuse a draft patch with `knowledge_patch`.
|
|
51
|
+
2. Add ordered semantic operations for the extracted objects with `knowledge_patch`.
|
|
52
|
+
3. Validate the patch with `knowledge_patch` and keep the returned validation fingerprint.
|
|
53
|
+
4. Apply the patch with `knowledge_patch_apply` only after explicit approval and only with the latest validation fingerprint.
|
|
54
|
+
5. Re-check the updated knowledge store after apply when the patch changes existing records or resolves conflicts.
|
|
55
|
+
|
|
56
|
+
If validation fails, the fingerprint becomes stale, or approval is missing, stop and report the blocker rather than guessing or forcing the write.
|
|
57
|
+
|
|
58
|
+
When creating or updating patch metadata, set `rootFolder` to the repository directory that is being analyzed for extraction.
|
|
59
|
+
|
|
60
|
+
Before the validation step is treated as final, run a duplicate audit over all proposed `create` operations against the effective knowledge state and earlier pending patches.
|
|
61
|
+
Patch validation is necessary but not sufficient because it protects against ID and reference issues more reliably than semantic duplication.
|
|
62
|
+
|
|
63
|
+
## Stable ID Strategy
|
|
64
|
+
|
|
65
|
+
Use this pattern for knowledge items ids:
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
<object-type>.<domain-slug>.<object-slug>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Examples:
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
domain.orders
|
|
75
|
+
entity.orders.order
|
|
76
|
+
rel.orders.order-has-items
|
|
77
|
+
cap.orders.order-lifecycle
|
|
78
|
+
feature.orders.cancel-order
|
|
79
|
+
rule.orders.paid-orders-cannot-be-cancelled
|
|
80
|
+
constraint.orders.erp-sync-one-way
|
|
81
|
+
why.orders.refund-required-for-paid-order
|
|
82
|
+
ev.orders.cancel-disabled-paid
|
|
83
|
+
q.orders.paid-cancel-rationale
|
|
84
|
+
conflict.orders.invoice-domain-boundary
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Default convention:
|
|
88
|
+
|
|
89
|
+
- domains: `domain.<domain-slug>`;
|
|
90
|
+
- other objects: `<object-type>.<domain-slug>.<object-slug>`.
|
|
91
|
+
|
|
92
|
+
## Domain-Based Storage Model
|
|
93
|
+
|
|
94
|
+
Top-level grouping is always by domain.
|
|
95
|
+
Each domain owns its folder, for example:
|
|
96
|
+
|
|
97
|
+
```text
|
|
98
|
+
ez-know/orders/
|
|
99
|
+
ez-know/billing/
|
|
100
|
+
ez-know/payments/
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
If an object belongs to multiple domains, store it in its owning domain and reference it from the others by stable ID.
|
|
104
|
+
|
|
105
|
+
## Core Knowledge Hierarchy
|
|
106
|
+
|
|
107
|
+
Always organize extracted knowledge as:
|
|
108
|
+
|
|
109
|
+
```text
|
|
110
|
+
Domain
|
|
111
|
+
-> Entity
|
|
112
|
+
-> Entity Relationship
|
|
113
|
+
-> Capability
|
|
114
|
+
-> Feature
|
|
115
|
+
-> Business Rule
|
|
116
|
+
-> Constraint
|
|
117
|
+
-> Rationale
|
|
118
|
+
-> Evidence
|
|
119
|
+
-> Question
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
This hierarchy is conceptual. JSON files can still be normalized by object type.
|
|
123
|
+
|
|
124
|
+
## Duplicate Prevention
|
|
125
|
+
|
|
126
|
+
Before creating any object:
|
|
127
|
+
|
|
128
|
+
1. Search existing knowledge through `ez-know`.
|
|
129
|
+
2. Reuse the existing ID when the meaning matches.
|
|
130
|
+
3. Add aliases, evidence, relationships, rules, or confidence updates to the existing object instead of duplicating it.
|
|
131
|
+
4. Create a conflict when evidence supports incompatible interpretations.
|
|
132
|
+
5. Create a new object only when lookup does not find a matching record.
|
|
133
|
+
|
|
134
|
+
Use the effective knowledge state as the duplicate-check base, not only canonical files.
|
|
135
|
+
This means duplicate checks must consider:
|
|
136
|
+
|
|
137
|
+
- canonical knowledge already loaded in the store;
|
|
138
|
+
- earlier pending draft patches that are part of the effective read state;
|
|
139
|
+
- other newly proposed objects in the current draft patch.
|
|
140
|
+
|
|
141
|
+
Treat these as mandatory duplicate triggers that require comparison before any `create` is finalized:
|
|
142
|
+
|
|
143
|
+
- same or near-identical name;
|
|
144
|
+
- same core noun phrase in `business_definition`, `purpose`, or `description`;
|
|
145
|
+
- same external system, runtime surface, or data store described from another scope;
|
|
146
|
+
- same relationships, features, rules, or evidence cluster pointing at the same concept;
|
|
147
|
+
- a domain-local object that appears to restate an existing cross-domain concept.
|
|
148
|
+
|
|
149
|
+
When a duplicate trigger fires:
|
|
150
|
+
|
|
151
|
+
1. Query matching records through `ez-know` MCP.
|
|
152
|
+
2. Compare purpose, evidence, connected objects, and scope.
|
|
153
|
+
3. Resolve the candidate in exactly one way:
|
|
154
|
+
- reuse the existing object and switch to `update`;
|
|
155
|
+
- keep `create` because the concept is genuinely distinct;
|
|
156
|
+
- create a conflict;
|
|
157
|
+
- stop and report unresolved duplicate risk.
|
|
158
|
+
|
|
159
|
+
Do not justify a new object only by ID uniqueness or successful patch validation.
|
|
160
|
+
|
|
161
|
+
## Evidence-First Rule
|
|
162
|
+
|
|
163
|
+
Every meaningful statement must reference evidence.
|
|
164
|
+
|
|
165
|
+
Evidence can come from code, type/interface names, API paths, route names, tests, UI text, translation strings, validation schemas, comments, documentation, repository search results, or human confirmation.
|
|
166
|
+
|
|
167
|
+
Evidence means: this source supports this product statement.
|
|
168
|
+
|
|
169
|
+
## Scope Boundary Discovery
|
|
170
|
+
|
|
171
|
+
After selecting a narrow scope, inspect the first-order references that leave it before finalizing extracted objects.
|
|
172
|
+
|
|
173
|
+
Look for:
|
|
174
|
+
|
|
175
|
+
- imports or exports that target files outside the selected area;
|
|
176
|
+
- referenced URLs, routes, commands, schemas, generated clients, or configuration inputs;
|
|
177
|
+
- entrypoints, adapters, registries, or wiring code that connect the scope to another subsystem / module;
|
|
178
|
+
- tests or documentation that describe interactions beyond the current area.
|
|
179
|
+
|
|
180
|
+
Boundary discovery is not a request to build a dependency map.
|
|
181
|
+
Its purpose is to confirm or reject cross-scope relationships that affect product meaning, externally visible behavior, access paths, data flow, or operational constraints.
|
|
182
|
+
|
|
183
|
+
Do not continue traversing the whole repository by default.
|
|
184
|
+
Inspect only the immediate external targets needed to understand the boundary.
|
|
185
|
+
|
|
186
|
+
During boundary discovery, explicitly enumerate the first-order runtime data providers and sinks for each user-visible entity or feature in scope.
|
|
187
|
+
This includes direct API reads, route-backed queries, store reads, emitted commands, and other immediate delivery paths required for the visible behavior to work.
|
|
188
|
+
|
|
189
|
+
Do not turn that enumeration into a full dependency graph.
|
|
190
|
+
Use it only to decide whether a cross-scope relationship, constraint, or question is required.
|
|
191
|
+
|
|
192
|
+
## Cross-Scope Evidence Rule
|
|
193
|
+
|
|
194
|
+
If files in the selected scope clearly reference another subsystem, inspect that counterpart before finalizing relationships, capabilities, features, rules, or constraints that may depend on it.
|
|
195
|
+
|
|
196
|
+
Use the counterpart inspection to answer questions such as:
|
|
197
|
+
|
|
198
|
+
- Is the external reference part of how a user-visible capability is delivered or accessed?
|
|
199
|
+
- Does it establish a real interaction, ownership, dependency, or data flow between product-relevant objects?
|
|
200
|
+
- Does it impose a constraint or explain why a visible behavior exists?
|
|
201
|
+
- Is the object still able to perform its main runtime behavior if that external subsystem is absent?
|
|
202
|
+
|
|
203
|
+
Do not promote raw implementation dependencies into knowledge objects unless they support a product-relevant statement with evidence.
|
|
204
|
+
|
|
205
|
+
If a user-visible entity or feature cannot perform its main runtime behavior without an external subsystem, create a cross-scope relationship unless direct evidence shows that the dependency belongs only to a narrower sub-object.
|
|
206
|
+
|
|
207
|
+
Prefer:
|
|
208
|
+
|
|
209
|
+
- `depends_on` when the source object requires the target for runtime delivery of its visible behavior;
|
|
210
|
+
- `references` when the source object can point to, display, or project the target without requiring it to function.
|
|
211
|
+
|
|
212
|
+
If the counterpart cannot be inspected within the current scope budget, lower confidence and create a question instead of silently omitting the possible link.
|
|
213
|
+
|
|
214
|
+
## Certainty And Confidence
|
|
215
|
+
|
|
216
|
+
Every object must include certainty and confidence.
|
|
217
|
+
|
|
218
|
+
Use certainty:
|
|
219
|
+
|
|
220
|
+
- `confirmed` - explicitly confirmed by human or authoritative documentation
|
|
221
|
+
- `direct_evidence` - directly supported by code/tests/UI/docs
|
|
222
|
+
- `inferred` - inferred from multiple signals
|
|
223
|
+
- `weak_inference` - plausible but uncertain
|
|
224
|
+
- `unknown` - captured as question only
|
|
225
|
+
|
|
226
|
+
Use confidence:
|
|
227
|
+
|
|
228
|
+
- `0.90-1.00` confirmed or explicit direct evidence
|
|
229
|
+
- `0.70-0.89` strong direct evidence
|
|
230
|
+
- `0.50-0.69` plausible inference
|
|
231
|
+
- `0.00-0.49` weak inference, requires human clarification
|
|
232
|
+
|
|
233
|
+
If confidence is below `0.70`, generate a question.
|
|
234
|
+
|
|
235
|
+
## Required Agent Behavior
|
|
236
|
+
|
|
237
|
+
Use cautious language in all generated fields.
|
|
238
|
+
|
|
239
|
+
Prefer:
|
|
240
|
+
|
|
241
|
+
- appears to
|
|
242
|
+
- suggests
|
|
243
|
+
- likely exists because
|
|
244
|
+
- is inferred from
|
|
245
|
+
|
|
246
|
+
Avoid:
|
|
247
|
+
|
|
248
|
+
- was designed to
|
|
249
|
+
- business requires
|
|
250
|
+
- the intended behavior is
|
|
251
|
+
|
|
252
|
+
unless confirmed.
|
|
253
|
+
|
|
254
|
+
## Your extraction workflow tasks:
|
|
255
|
+
|
|
256
|
+
Analyze each selected area in this order:
|
|
257
|
+
|
|
258
|
+
1. **Scope selection**
|
|
259
|
+
Select a narrow code or documentation area. Avoid whole-project analysis unless the user explicitly requests it.
|
|
260
|
+
|
|
261
|
+
2. **Boundary discovery**
|
|
262
|
+
Inspect first-order references that leave the selected area. Use them to identify the minimum adjacent context required to understand externally visible behavior.
|
|
263
|
+
|
|
264
|
+
3. **Domain detection**
|
|
265
|
+
Identify the likely business domain or bounded context.
|
|
266
|
+
|
|
267
|
+
4. **Entity extraction**
|
|
268
|
+
Extract core business objects, actors, aggregate-like concepts, external systems, and persistent domain nouns.
|
|
269
|
+
|
|
270
|
+
5. **Duplicate audit**
|
|
271
|
+
Compare every proposed `create` against the effective knowledge state, earlier pending patches, and other proposed objects in the current patch. Resolve each candidate by reuse, update, distinct-create, conflict, or explicit stop.
|
|
272
|
+
|
|
273
|
+
6. **Relationship extraction**
|
|
274
|
+
Connect known entities before deriving higher-level behavior. Capture ownership, dependency, lifecycle, data flow, and interaction relationships.
|
|
275
|
+
|
|
276
|
+
7. **Feature extraction**
|
|
277
|
+
Identify user-visible or system-visible features that implement capabilities.
|
|
278
|
+
|
|
279
|
+
8. **Capability extraction**
|
|
280
|
+
Identify business abilities supported by the area. Capabilities should be based on entities, relationships, and features.
|
|
281
|
+
|
|
282
|
+
9. **Rule and constraint extraction**
|
|
283
|
+
Extract business rules, validations, invariants, limits, permissions, and process constraints.
|
|
284
|
+
|
|
285
|
+
10. **Rationale extraction**
|
|
286
|
+
Capture rationale only when there is evidence. Do not speculate about intent.
|
|
287
|
+
|
|
288
|
+
11. **Question and conflict extraction**
|
|
289
|
+
Record unresolved questions, ambiguities, contradictions, and weak assumptions.
|
|
290
|
+
|
|
291
|
+
Capabilities or features may be noted earlier as candidates, but they should be finalized only after the relevant entities and relationships are understood.
|
|
292
|
+
|
|
293
|
+
## Self-Validation Before Final Output
|
|
294
|
+
|
|
295
|
+
Before returning a final knowledge output, check:
|
|
296
|
+
|
|
297
|
+
- required MCP schema and instruction resources were loaded for each object type;
|
|
298
|
+
- every object has evidence or is clearly marked as a question/hypothesis;
|
|
299
|
+
- obvious first-order references leaving the scope were checked or explicitly deferred;
|
|
300
|
+
- every user-visible entity and feature has its external runtime data providers accounted for as relationships, constraints, or explicit open questions;
|
|
301
|
+
- object IDs follow the current ID convention;
|
|
302
|
+
- relationships point to known or proposed objects;
|
|
303
|
+
- each proposed `create` was compared against semantically similar records in the effective knowledge state;
|
|
304
|
+
- earlier pending draft patches were included in duplicate checks;
|
|
305
|
+
- same-name or same-purpose records in other domains were explicitly reviewed before finalizing creates;
|
|
306
|
+
- every possible duplicate was resolved by reuse, update, conflict, distinct-create justification, or explicit stop;
|
|
307
|
+
- uncertain claims are not written as facts;
|
|
308
|
+
|
|
309
|
+
## Completion Criteria
|
|
310
|
+
|
|
311
|
+
The extraction is complete when:
|
|
312
|
+
|
|
313
|
+
- entities are extracted with business definitions, aliases, and terminology notes;
|
|
314
|
+
- entity relationships are extracted;
|
|
315
|
+
- features are extracted as atomic business functions;
|
|
316
|
+
- capabilities group related features where grouping is useful;
|
|
317
|
+
- business rules are captured as observable behavior and product rules;
|
|
318
|
+
- constraints are captured with type, cause, impact, workaround/removability where known;
|
|
319
|
+
- rationales are captured where possible;
|
|
320
|
+
- every major statement has evidence;
|
|
321
|
+
- every important uncertain point has a question;
|
|
322
|
+
- confidence and certainty are present everywhere;
|
|
323
|
+
- every `create` operation was checked against the effective knowledge state through `ez-know`;
|
|
324
|
+
- cross-patch duplicates were resolved before the task was treated as complete;
|
|
325
|
+
- no new object remained justified only by unique ID or patch validation success;
|
|
326
|
+
- extraction changes were written through the patch workflow and not by direct canonical file edits;
|
|
327
|
+
- updates are written into domain-oriented JSON files under `ez-know/<domain-slug>/`.
|
|
328
|
+
|
|
329
|
+
## Stop Conditions
|
|
330
|
+
|
|
331
|
+
Stop expanding the analysis when:
|
|
332
|
+
|
|
333
|
+
- the scope becomes too broad;
|
|
334
|
+
- required MCP resources are missing;
|
|
335
|
+
- evidence is insufficient;
|
|
336
|
+
- duplication risk is high;
|
|
337
|
+
- the model would need to guess business intent.
|
|
338
|
+
|
|
339
|
+
When stopped, return a partial result and a clear list of what remains unresolved.
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ez-know-update-knowledge-base
|
|
3
|
+
description: Analyze staged changes, a commit, or a commit range and propose validated ez-know draft patches that update the knowledge model from those code changes. Use when the user wants knowledge maintenance driven by git diffs rather than full codebase extraction.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# update-knowledge-from-git
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Use this skill to maintain the ez-know product knowledge base from an increment of code change.
|
|
11
|
+
|
|
12
|
+
The increment may be:
|
|
13
|
+
|
|
14
|
+
- staged changes;
|
|
15
|
+
- a single commit;
|
|
16
|
+
- a commit range.
|
|
17
|
+
|
|
18
|
+
The goal is to update product knowledge affected by the increment, not to restate the whole domain model.
|
|
19
|
+
|
|
20
|
+
## Core Principles
|
|
21
|
+
|
|
22
|
+
- Work from the git increment as the source boundary.
|
|
23
|
+
- Prefer small, coherent knowledge updates over broad speculative rewrites.
|
|
24
|
+
- Inspect changed scope boundaries before finalizing semantic updates.
|
|
25
|
+
- Use commit messages as hints only, never as authoritative facts.
|
|
26
|
+
- Prefer evidence from diffs, tests, routes, schemas, docs, and UI text.
|
|
27
|
+
- Ignore pure churn when it does not change product meaning.
|
|
28
|
+
- Reuse and update existing knowledge whenever possible.
|
|
29
|
+
- Create validated draft patches immediately.
|
|
30
|
+
- Do not apply patches without explicit approval.
|
|
31
|
+
|
|
32
|
+
## Supported Inputs
|
|
33
|
+
|
|
34
|
+
Support these modes:
|
|
35
|
+
|
|
36
|
+
- `staged` - analyze staged changes only;
|
|
37
|
+
- `commit <sha>` - analyze a single commit;
|
|
38
|
+
- `range <from>..<to>` - analyze a commit range.
|
|
39
|
+
|
|
40
|
+
For commit and range modes, commit messages may help explain likely intent, but all final knowledge updates must be justified by the actual diff and related evidence.
|
|
41
|
+
|
|
42
|
+
## Required ez-know MCP Resource Loading Pattern
|
|
43
|
+
|
|
44
|
+
Before working with any object type, load the corresponding resources from MCP:
|
|
45
|
+
|
|
46
|
+
1. object schema;
|
|
47
|
+
2. extraction instruction for that object type.
|
|
48
|
+
|
|
49
|
+
Load only the resources needed for the current batch and current stage.
|
|
50
|
+
|
|
51
|
+
If a required resource is unavailable:
|
|
52
|
+
|
|
53
|
+
- do not invent its schema;
|
|
54
|
+
- do not finalize objects of that type;
|
|
55
|
+
- continue only with object types whose resources are available;
|
|
56
|
+
- explicitly report the missing resource.
|
|
57
|
+
|
|
58
|
+
## Patch Workflow
|
|
59
|
+
|
|
60
|
+
Write results through the knowledge patch workflow rather than by mutating canonical knowledge files directly.
|
|
61
|
+
|
|
62
|
+
Required flow:
|
|
63
|
+
|
|
64
|
+
1. Create draft patch records immediately for the detected semantic batches.
|
|
65
|
+
2. Add ordered semantic operations with `knowledge_patch`.
|
|
66
|
+
3. Validate each draft patch with `knowledge_patch`.
|
|
67
|
+
4. Keep each returned validation fingerprint.
|
|
68
|
+
5. Apply patches with `knowledge_patch_apply` only after explicit approval and only with the latest validation fingerprint.
|
|
69
|
+
|
|
70
|
+
If validation fails, keep the draft patch, report the diagnostics, and stop short of apply.
|
|
71
|
+
|
|
72
|
+
## Evidence Rules
|
|
73
|
+
|
|
74
|
+
Every meaningful statement must reference evidence.
|
|
75
|
+
|
|
76
|
+
Preferred evidence sources for this skill:
|
|
77
|
+
|
|
78
|
+
- `git_diff` for changed behavior, removed behavior, renamed behavior, and modified constraints;
|
|
79
|
+
- `increment_description` for commit subject/body hints;
|
|
80
|
+
- `code`, `test`, `api`, `route`, `schema`, `documentation`, `ui_text`, or `comment` when the diff points to them.
|
|
81
|
+
|
|
82
|
+
Evidence rules:
|
|
83
|
+
|
|
84
|
+
- keep excerpts short;
|
|
85
|
+
- do not store large code blocks;
|
|
86
|
+
- use commit messages only as secondary support;
|
|
87
|
+
- when the diff is ambiguous, capture a question or conflict instead of asserting intent.
|
|
88
|
+
|
|
89
|
+
## Changed Scope Boundary Discovery
|
|
90
|
+
|
|
91
|
+
After identifying the changed files in a batch, inspect the first-order references that leave the changed area before finalizing semantic updates.
|
|
92
|
+
|
|
93
|
+
Look for:
|
|
94
|
+
|
|
95
|
+
- changed imports or exports that target files outside the diff cluster;
|
|
96
|
+
- referenced URLs, routes, commands, schemas, generated clients, or configuration inputs;
|
|
97
|
+
- entrypoints, adapters, registries, or wiring code that connect the changed area to another subsystem;
|
|
98
|
+
- tests or documentation touched by the increment that clarify interactions beyond the edited files.
|
|
99
|
+
|
|
100
|
+
Boundary discovery is not a request to reconstruct the full architecture.
|
|
101
|
+
Its purpose is to confirm or reject cross-scope relationships, access paths, data flow, externally visible behavior, or operational constraints that are affected by the increment.
|
|
102
|
+
|
|
103
|
+
Do not expand arbitrarily through the repository.
|
|
104
|
+
Inspect only the immediate external targets needed to understand the changed boundary.
|
|
105
|
+
|
|
106
|
+
## Cross-Scope Update Rule
|
|
107
|
+
|
|
108
|
+
If the increment clearly references another subsystem, inspect that counterpart before finalizing updates to relationships, capabilities, features, rules, constraints, rationales, or deletes that may depend on it.
|
|
109
|
+
|
|
110
|
+
Use the counterpart inspection to answer questions such as:
|
|
111
|
+
|
|
112
|
+
- Does the change alter how a user-visible capability is delivered or accessed?
|
|
113
|
+
- Does it establish, remove, or modify a real interaction, ownership, dependency, or data flow between product-relevant objects?
|
|
114
|
+
- Does it add, remove, or clarify a constraint that is only visible when the adjacent subsystem is checked?
|
|
115
|
+
|
|
116
|
+
Do not promote raw implementation dependencies into knowledge objects unless they support a product-relevant statement with evidence.
|
|
117
|
+
|
|
118
|
+
If the counterpart cannot be inspected within the current batch budget, lower confidence and create a question or conflict instead of silently omitting the possible link or asserting a delete.
|
|
119
|
+
|
|
120
|
+
## Stable ID Strategy
|
|
121
|
+
|
|
122
|
+
Use this pattern for knowledge item ids:
|
|
123
|
+
|
|
124
|
+
```text
|
|
125
|
+
<object-type>.<domain-slug>.<object-slug>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Examples:
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
domain.orders
|
|
132
|
+
entity.orders.order
|
|
133
|
+
rel.orders.order-has-items
|
|
134
|
+
cap.orders.order-lifecycle
|
|
135
|
+
feature.orders.cancel-order
|
|
136
|
+
rule.orders.paid-orders-cannot-be-cancelled
|
|
137
|
+
constraint.orders.erp-sync-one-way
|
|
138
|
+
why.orders.refund-required-for-paid-order
|
|
139
|
+
ev.orders.orders-diff-cancel-flow
|
|
140
|
+
q.orders.cancel-flow-removal-meaning
|
|
141
|
+
conflict.orders.checkout-removal-interpretation
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Automatic Batching
|
|
145
|
+
|
|
146
|
+
If the increment is too large or semantically mixed for reliable single-pass reasoning, decompose it automatically before drafting operations.
|
|
147
|
+
|
|
148
|
+
Batching priority:
|
|
149
|
+
|
|
150
|
+
1. semantic coherence;
|
|
151
|
+
2. domain coherence;
|
|
152
|
+
3. file clustering;
|
|
153
|
+
4. commit clustering.
|
|
154
|
+
|
|
155
|
+
Examples of separate batches:
|
|
156
|
+
|
|
157
|
+
- orders lifecycle behavior updates;
|
|
158
|
+
- billing rule changes;
|
|
159
|
+
- explicit removals;
|
|
160
|
+
- ambiguous changes that should become questions or conflicts.
|
|
161
|
+
|
|
162
|
+
Do not ask the user to approve the batching plan before creating draft patches. The skill must proceed automatically.
|
|
163
|
+
|
|
164
|
+
## Large Increment Strategy
|
|
165
|
+
|
|
166
|
+
For large staged diffs or ranges, use a two-phase workflow:
|
|
167
|
+
|
|
168
|
+
1. inventory the whole increment;
|
|
169
|
+
2. classify likely semantic changes, likely non-semantic churn, and ambiguous areas;
|
|
170
|
+
3. create semantic batches;
|
|
171
|
+
4. process each batch independently;
|
|
172
|
+
5. validate each draft patch independently;
|
|
173
|
+
6. return one patch or many depending on coherence.
|
|
174
|
+
|
|
175
|
+
Never require the model to reason over the entire raw diff in one pass when safe batching is possible.
|
|
176
|
+
|
|
177
|
+
## Update Policy
|
|
178
|
+
|
|
179
|
+
Before creating any object:
|
|
180
|
+
|
|
181
|
+
1. search existing knowledge through `ez-know`;
|
|
182
|
+
2. reuse the existing id when the meaning matches;
|
|
183
|
+
3. update existing records when the increment modifies known behavior;
|
|
184
|
+
4. create a new object only when the meaning is genuinely new;
|
|
185
|
+
5. create a conflict when evidence supports incompatible interpretations.
|
|
186
|
+
|
|
187
|
+
Prefer `update` over `create` when the change appears to refine or replace an existing concept.
|
|
188
|
+
|
|
189
|
+
Use the effective knowledge state as the duplicate-check base, not only canonical files.
|
|
190
|
+
This means duplicate checks must consider:
|
|
191
|
+
|
|
192
|
+
- canonical knowledge already loaded in the store;
|
|
193
|
+
- earlier pending draft patches that are part of the effective read state;
|
|
194
|
+
- other newly proposed objects in the current draft patch or draft patch batch.
|
|
195
|
+
|
|
196
|
+
Treat these as mandatory duplicate triggers that require comparison before any `create` is finalized:
|
|
197
|
+
|
|
198
|
+
- same or near-identical name;
|
|
199
|
+
- same core noun phrase in `business_definition`, `purpose`, `description`, or `statement`;
|
|
200
|
+
- same external system, runtime surface, or data store described from another changed scope;
|
|
201
|
+
- same relationships, features, rules, or evidence cluster pointing at the same concept;
|
|
202
|
+
- a domain-local object that appears to restate an existing cross-domain concept.
|
|
203
|
+
|
|
204
|
+
When a duplicate trigger fires:
|
|
205
|
+
|
|
206
|
+
1. query matching records through `ez-know` MCP;
|
|
207
|
+
2. compare purpose, evidence, connected objects, and changed scope;
|
|
208
|
+
3. resolve the candidate in exactly one way:
|
|
209
|
+
- reuse the existing object and switch to `update`;
|
|
210
|
+
- keep `create` because the concept is genuinely distinct;
|
|
211
|
+
- create a conflict;
|
|
212
|
+
- stop and report unresolved duplicate risk.
|
|
213
|
+
|
|
214
|
+
Do not justify a new object only by ID uniqueness or successful patch validation.
|
|
215
|
+
|
|
216
|
+
## Delete Policy
|
|
217
|
+
|
|
218
|
+
Delete operations are allowed, but use a stricter threshold than create or update.
|
|
219
|
+
|
|
220
|
+
Use replacement-first delete handling:
|
|
221
|
+
|
|
222
|
+
- if knowledge was renamed, narrowed, reframed, or moved, prefer `update` or create-and-relink;
|
|
223
|
+
- emit `delete` only when the diff clearly removes the product meaning itself;
|
|
224
|
+
- if removal is plausible but uncertain, do not delete;
|
|
225
|
+
- instead create a question, conflict, or lower-confidence update.
|
|
226
|
+
|
|
227
|
+
When removals and clean updates are mixed, prefer separate draft patches so deletes do not contaminate unrelated updates.
|
|
228
|
+
|
|
229
|
+
## Extraction Focus
|
|
230
|
+
|
|
231
|
+
Analyze each batch in this order:
|
|
232
|
+
|
|
233
|
+
1. scope the affected domain or semantic area;
|
|
234
|
+
2. inspect first-order references that leave the changed area;
|
|
235
|
+
3. identify changed or newly relevant entities;
|
|
236
|
+
4. run a duplicate audit over every proposed `create` against the effective knowledge state, earlier pending patches, and other proposed objects in the batch;
|
|
237
|
+
5. identify changed relationships;
|
|
238
|
+
6. identify changed features;
|
|
239
|
+
7. identify changed capabilities;
|
|
240
|
+
8. identify changed rules and constraints;
|
|
241
|
+
9. identify supported rationales when evidence exists;
|
|
242
|
+
10. identify questions and conflicts for unresolved meaning;
|
|
243
|
+
11. decide whether any explicit deletes are justified.
|
|
244
|
+
|
|
245
|
+
Do not re-extract unaffected parts of the domain just because they are nearby in code.
|
|
246
|
+
|
|
247
|
+
## Certainty And Confidence
|
|
248
|
+
|
|
249
|
+
Every object must include certainty and confidence.
|
|
250
|
+
|
|
251
|
+
Use certainty:
|
|
252
|
+
|
|
253
|
+
- `confirmed` - explicitly confirmed by human or authoritative documentation
|
|
254
|
+
- `direct_evidence` - directly supported by diff, code, tests, UI, or docs
|
|
255
|
+
- `inferred` - inferred from multiple signals in the increment
|
|
256
|
+
- `weak_inference` - plausible but uncertain
|
|
257
|
+
- `unknown` - captured as question only
|
|
258
|
+
|
|
259
|
+
Use confidence:
|
|
260
|
+
|
|
261
|
+
- `0.90-1.00` explicit and strong direct evidence
|
|
262
|
+
- `0.70-0.89` strong direct evidence with limited ambiguity
|
|
263
|
+
- `0.50-0.69` plausible inference
|
|
264
|
+
- `0.00-0.49` weak inference, requires clarification
|
|
265
|
+
|
|
266
|
+
If confidence is below `0.70`, generate a question.
|
|
267
|
+
|
|
268
|
+
## Stop Conditions
|
|
269
|
+
|
|
270
|
+
Stop expanding a batch when:
|
|
271
|
+
|
|
272
|
+
- evidence is insufficient;
|
|
273
|
+
- the increment becomes too ambiguous;
|
|
274
|
+
- required MCP resources are missing;
|
|
275
|
+
- duplicate risk is high;
|
|
276
|
+
- the model would need to guess product intent.
|
|
277
|
+
|
|
278
|
+
When stopped:
|
|
279
|
+
|
|
280
|
+
- keep the draft patch if useful;
|
|
281
|
+
- report unresolved areas clearly;
|
|
282
|
+
- prefer partial validated output over speculative completion.
|
|
283
|
+
|
|
284
|
+
## Completion Criteria
|
|
285
|
+
|
|
286
|
+
The skill is complete when:
|
|
287
|
+
|
|
288
|
+
- the input increment was analyzed from `staged`, `commit`, or `range`;
|
|
289
|
+
- semantic batches were created automatically when needed;
|
|
290
|
+
- one or more draft patches were created immediately;
|
|
291
|
+
- each draft patch contains only semantically coherent operations;
|
|
292
|
+
- each patch was validated independently;
|
|
293
|
+
- obvious first-order references leaving the changed area were checked or explicitly deferred;
|
|
294
|
+
- diffs that carry no product meaning were skipped or reported as churn;
|
|
295
|
+
- deletes were emitted only when removal was clear;
|
|
296
|
+
- ambiguous changes became questions or conflicts instead of unsupported facts;
|
|
297
|
+
- every `create` operation was checked against the effective knowledge state through `ez-know`;
|
|
298
|
+
- cross-patch duplicates were resolved before any batch was treated as complete;
|
|
299
|
+
- no new object remained justified only by unique ID or patch validation success;
|
|
300
|
+
- no patch was applied without explicit approval.
|
|
301
|
+
|
|
302
|
+
## Expected Output
|
|
303
|
+
|
|
304
|
+
Return a compact summary containing:
|
|
305
|
+
|
|
306
|
+
- source analyzed;
|
|
307
|
+
- commits and files reviewed when relevant;
|
|
308
|
+
- detected batches;
|
|
309
|
+
- created draft patch ids;
|
|
310
|
+
- scope of each patch;
|
|
311
|
+
- validation result of each patch;
|
|
312
|
+
- unresolved ambiguities, skipped churn, and delete rationale where relevant.
|