@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 ADDED
@@ -0,0 +1,91 @@
1
+ # ez-know
2
+ !!! Important: early development stage !!!
3
+
4
+ A business knowledge layer for your agents and your team.
5
+
6
+ When do you need it?
7
+ - You have a complex project with lots of entities, features and rules to govern them all;
8
+ - Your agents break your apps when they miss some important spec;
9
+ - Your team have a hard time answering questions like "Did we implement this right", "Does this feature conflict with our rule".
10
+
11
+ ## What's in the box
12
+
13
+ - MCP server + agent skills
14
+ - REST server + UI for easy exploration and validation
15
+
16
+ ## What it gives you
17
+
18
+ As a multiple products dev, I frequently need to
19
+
20
+ ## How to run
21
+
22
+ Install globally with `npm i -g ez-know`, then
23
+
24
+ - `ez-know` for package overview and all important info
25
+ - `ez-know init` prompts for a skills folder and installs the bundled reference skills there
26
+ - `ez-know mcp` starts the MCP server over stdio
27
+ - `ez-know rest` starts the REST service and serves the frontend UI
28
+
29
+ `ez-know init` overwrites matching skill folder contents in the target directory, so rerunning it is safe when you want the bundled skills refreshed.
30
+
31
+ For repo development:
32
+
33
+ - `npm run dev` starts REST and web together
34
+ - `npm run dev:rest` starts only REST
35
+ - `npm run dev:web` starts only the web app
36
+
37
+ Configuration
38
+
39
+ | env| default | desc |
40
+ |----|---|-----|
41
+ |EZ_KNOW_ROOT| ez-know|path relative to PWD where you want to store knowledge data |
42
+ |EZ_KNOW_REST_HOST| |host for the rest service|
43
+ |EZ_KNOW_REST_PORT| |port for the rest service |
44
+
45
+ ## How does it work?
46
+
47
+
48
+ DDD-discovery
49
+ Knowledge engineering
50
+
51
+
52
+
53
+ The built package also exposes the same runtime entrypoints through npm scripts:
54
+
55
+ ## Included Tools
56
+
57
+ - `knowledge_graph_query` executes GraphQL queries against the normalized in-memory knowledge store.
58
+ - `knowledge_patch` manages draft patches with create, list, get, add/update/delete operation, validate, and close actions.
59
+ - `knowledge_patch_apply` mutates canonical knowledge JSON only after explicit approval plus the latest validation fingerprint.
60
+
61
+
62
+ ## Knowledge Patch Workflow
63
+
64
+ Patch drafts live under `EZ_KNOW_ROOT/.patches/<patch-id>/` and contain only:
65
+
66
+ - `patch.json` for patch metadata and lifecycle state
67
+ - `operations.json` for the ordered semantic operations managed by the server
68
+
69
+ Patch operations must use canonical collection names from the extraction registry such as `features`, `business_rules`, and `evidence`. Patch operations do not accept canonical file paths; the server derives target files from the collection type and domain during apply.
70
+
71
+ Suggested flow:
72
+
73
+ 1. Call `knowledge_patch` with `action: "create"` to open a draft patch.
74
+ 2. Use `add_operation`, `update_operation`, and `delete_operation` to manage ordered semantic operations.
75
+ 3. Call `knowledge_patch` with `action: "validate"` and keep the returned `fingerprint`.
76
+ 4. Call `knowledge_patch_apply` with `approval.approved: true` and the latest validation fingerprint.
77
+
78
+ Apply is rejected when approval is missing or false, when validation fails, when the fingerprint is stale, or when the patch is not the first pending draft in sequence. Successful apply rewrites the affected canonical JSON files, reloads the knowledge store from disk, and deletes the patch folder only after reload verification succeeds.
79
+
80
+ Sequential pending patch semantics:
81
+
82
+ - Normal MCP and REST reads use an effective state composed from canonical knowledge plus ordered draft patches.
83
+ - Patch validation uses the same effective base state, excluding the patch currently being validated.
84
+ - Draft ordering is deterministic: `createdAt`, then patch id as a tie-breaker.
85
+ - Canonical JSON remains the persisted source of truth until explicit apply.
86
+ - Later draft patches should be created with the expectation that earlier drafts are part of the current query and validation state.
87
+ - Draft patches must also be applied in order: only the first pending draft can be applied.
88
+
89
+ ## Knowledge Root
90
+
91
+ The server discovers domain folders under `EZ_KNOW_ROOT`, or `./ez-know` when the env var is omitted, loads the canonical JSON files from each domain folder, and combines the results into one in-memory knowledge store. The knowledge schema is defined in `src/reference/ez-know.d.ts` and includes domains, entities, relationships, capabilities, features, business rules, constraints, rationales, evidence, questions, and conflicts.