structured-context 0.11.0 → 0.12.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.
Files changed (87) hide show
  1. package/README.md +63 -22
  2. package/dist/api.d.ts +7 -5
  3. package/dist/api.js +4 -1
  4. package/dist/commands/diagram.d.ts +1 -0
  5. package/dist/commands/diagram.js +7 -1
  6. package/dist/commands/dump.d.ts +15 -2
  7. package/dist/commands/dump.js +18 -4
  8. package/dist/commands/render.d.ts +4 -0
  9. package/dist/commands/render.js +64 -9
  10. package/dist/commands/schemas.d.ts +2 -2
  11. package/dist/commands/schemas.js +114 -22
  12. package/dist/commands/show.d.ts +1 -0
  13. package/dist/commands/show.js +7 -1
  14. package/dist/commands/spaces.d.ts +3 -1
  15. package/dist/commands/spaces.js +11 -2
  16. package/dist/commands/validate-file.js +7 -4
  17. package/dist/commands/validate.js +38 -21
  18. package/dist/config.d.ts +18 -1
  19. package/dist/config.js +81 -10
  20. package/dist/filter/augment-nodes.d.ts +3 -1
  21. package/dist/filter/augment-nodes.js +12 -7
  22. package/dist/filter/filter-nodes.js +1 -1
  23. package/dist/index.js +39 -15
  24. package/dist/load-space-graph.d.ts +4 -2
  25. package/dist/load-space-graph.js +15 -4
  26. package/dist/plugins/loader.js +2 -2
  27. package/dist/plugins/markdown/extract-content-links.js +8 -29
  28. package/dist/plugins/markdown/index.js +8 -2
  29. package/dist/plugins/markdown/parse-embedded.d.ts +6 -0
  30. package/dist/plugins/markdown/parse-embedded.js +41 -7
  31. package/dist/plugins/markdown/read-space.js +38 -5
  32. package/dist/plugins/markdown/render-directory.d.ts +11 -0
  33. package/dist/plugins/markdown/render-directory.js +130 -0
  34. package/dist/plugins/mermaid/render-mermaid.js +2 -1
  35. package/dist/plugins/miro/sync.js +7 -6
  36. package/dist/plugins/util.d.ts +39 -1
  37. package/dist/plugins/util.js +139 -0
  38. package/dist/read/resolve-graph-edges.d.ts +1 -1
  39. package/dist/read/resolve-graph-edges.js +46 -27
  40. package/dist/read/wikilink-utils.d.ts +17 -0
  41. package/dist/read/wikilink-utils.js +40 -0
  42. package/dist/render/render.d.ts +3 -1
  43. package/dist/render/render.js +2 -2
  44. package/dist/schema/meta-schemas.d.ts +13 -0
  45. package/dist/schema/meta-schemas.js +50 -0
  46. package/dist/schema/metadata-contract.d.ts +343 -187
  47. package/dist/schema/metadata-contract.js +68 -30
  48. package/dist/schema/schema.d.ts +14 -8
  49. package/dist/schema/schema.js +277 -198
  50. package/dist/schema/validate-graph.d.ts +2 -1
  51. package/dist/schema/validate-graph.js +40 -23
  52. package/dist/schema/validate-rules.d.ts +5 -1
  53. package/dist/schema/validate-rules.js +20 -1
  54. package/dist/schemas/_knowledge_wiki.json +20 -20
  55. package/dist/schemas/_ost_strict.json +2 -2
  56. package/dist/schemas/_sctx_base.json +2 -2
  57. package/dist/schemas/_strategy_general.json +38 -38
  58. package/dist/schemas/generated/0.12.0/_structured_context_schema_meta.json +229 -0
  59. package/dist/schemas/generated/latest/_structured_context_schema_meta.json +229 -0
  60. package/dist/schemas/knowledge_wiki.json +10 -9
  61. package/dist/schemas/strategy_general.json +15 -14
  62. package/dist/schemas/strict_ost.json +17 -16
  63. package/dist/space-context.d.ts +3 -0
  64. package/dist/space-context.js +7 -2
  65. package/dist/space-graph.d.ts +9 -7
  66. package/dist/space-graph.js +7 -5
  67. package/dist/testing.d.ts +33 -0
  68. package/dist/testing.js +72 -0
  69. package/dist/types.d.ts +54 -13
  70. package/dist/validate.d.ts +3 -0
  71. package/dist/validate.js +19 -9
  72. package/docs/concepts.md +14 -4
  73. package/docs/config.md +8 -0
  74. package/docs/rules.md +49 -22
  75. package/docs/schemas.md +110 -35
  76. package/package.json +13 -8
  77. package/schemas/_knowledge_wiki.json +20 -20
  78. package/schemas/_ost_strict.json +2 -2
  79. package/schemas/_sctx_base.json +2 -2
  80. package/schemas/_strategy_general.json +38 -38
  81. package/schemas/generated/0.12.0/_structured_context_schema_meta.json +229 -0
  82. package/schemas/generated/latest/_structured_context_schema_meta.json +229 -0
  83. package/schemas/knowledge_wiki.json +10 -9
  84. package/schemas/strategy_general.json +15 -14
  85. package/schemas/strict_ost.json +17 -16
  86. package/dist/schemas/generated/_structured_context_schema_meta.json +0 -191
  87. package/schemas/generated/_structured_context_schema_meta.json +0 -191
package/docs/schemas.md CHANGED
@@ -6,7 +6,7 @@ This document explains schema usage, metadata shape, and composition semantics i
6
6
 
7
7
  A **schema** defines the valid structure for nodes in a `space`: entity types, field constraints, hierarchy behavior, type aliases, and executable rules.
8
8
 
9
- `structured-context` uses JSON Schema Draft-07 plus a custom top-level `$metadata` keyword.
9
+ `structured-context` uses JSON Schema 2020-12 plus a custom top-level `$metadata` keyword.
10
10
 
11
11
  ## Selecting a schema
12
12
 
@@ -20,6 +20,11 @@ Set `schema` in the space config entry:
20
20
  }
21
21
  ```
22
22
 
23
+ A schema can be specified as:
24
+ - **Bundled schema**: simple filename like `strategy_general.json` or `strict_ost.json`.
25
+ - **Local file**: relative path starting with `./` or `../` (resolved against config file directory), or absolute path.
26
+ - **Plugin schema**: prefixed with the plugin name, e.g. `sctx-wardley-mapping/wardley_map.json` or `wardley-mapping/wardley_map.json`. When prefixed, structured-context automatically loads the plugin for that space. Alternatively, if the plugin is already declared under `plugins`, the simple filename (e.g. `wardley_map.json`) resolves directly from that plugin.
27
+
23
28
  Resolution order: space `schema` > global `schema`. Schema resolution fails if none is configured.
24
29
 
25
30
  ## Bundled schemas
@@ -46,7 +51,7 @@ Main types:
46
51
  - `solution`
47
52
  - `assumption_test`
48
53
 
49
- This schema composes shared structural defs and strict metadata/rules from partials.
54
+ This schema reuses shared structural defs from partials via `$ref` and imports its hierarchy and rules from `_ost_strict` via `$metadata.imports`.
50
55
 
51
56
  ## Custom format annotations
52
57
 
@@ -61,7 +66,7 @@ This schema composes shared structural defs and strict metadata/rules from parti
61
66
  `path` and `wikilink` are also available as shared `$ref` definitions in `_sctx_base.json`:
62
67
 
63
68
  ```json
64
- { "$ref": "sctx://_sctx_base#/$defs/wikilink" }
69
+ { "$ref": "sctx://core/_sctx_base#/$defs/wikilink" }
65
70
  ```
66
71
 
67
72
  Using `format` directly is more concise when the full definition isn't needed:
@@ -82,9 +87,12 @@ The markdown plugin automatically coerces `Date` objects to `YYYY-MM-DD` strings
82
87
 
83
88
  ## Metadata dialect
84
89
 
85
- Schemas use this metaschema URL:
90
+ The dialect is JSON Schema 2020-12 plus the top-level `$metadata` keyword. Schemas set `$schema` to the metaschema URL:
91
+
92
+ - `https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/latest/_structured_context_schema_meta.json` follows the newest dialect.
93
+ - `https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/<version>/_structured_context_schema_meta.json` pins the dialect to the structured-context release that first shipped it. Versioned files never change once released. Releases that don't change the dialect add no folder, so a version number only appears when the dialect changed.
86
94
 
87
- - `https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/_structured_context_schema_meta.json`
95
+ Because the dialect is 2020-12, keywords may sit beside `$ref`, and `unevaluatedProperties: false` can close an object composed through `allOf`.
88
96
 
89
97
  Top-level metadata shape:
90
98
 
@@ -120,11 +128,14 @@ Top-level metadata shape:
120
128
 
121
129
  | Field | Type | Notes |
122
130
  |---|---|---|
123
- | `hierarchy` | object | Optional per provider; at most one provider may define it after composition |
131
+ | `imports` | `string[]` | Optional; `$id`s of schemas whose metadata is merged into this one. See [Composition and merge semantics](#composition-and-merge-semantics) |
132
+ | `hierarchy` | object | Optional; declares this schema's hierarchy, or (root schema only) selects the main hierarchy with `{ "$ref": "<schema $id>#/$metadata/hierarchy" }`. See [Multiple hierarchies](#multiple-hierarchies) |
133
+ | `hierarchy.name` | `string` | Optional short name; defaults to the declaring schema's file stem |
134
+ | `hierarchy.override` | `boolean` | Optional; replaces an imported hierarchy with the same name |
124
135
  | `hierarchy.levels` | `(string \| HierarchyLevel)[]` | Ordered root→leaf types |
125
136
  | `hierarchy.allowSkipLevels` | `boolean` | Optional; allows parent to be any ancestor level |
126
- | `relationships` | `Relationship[]` | Optional; defines related node links outside the primary hierarchy |
127
- | `aliases` | `Record<string, string>` | Optional type alias map |
137
+ | `relationships` | `Relationship[]` | Optional; defines related node links outside the primary hierarchy. A relationship may set `override: true` |
138
+ | `aliases` | `Record<string, string \| { type, override }>` | Optional type alias map. Use `{ "type": "goal", "override": true }` to replace an imported alias |
128
139
  | `rules` | `Rule[]` | Optional flat rule array |
129
140
 
130
141
  ### Relationships
@@ -252,37 +263,75 @@ With this config, an application page may include `### capability` with wikilink
252
263
 
253
264
  ## Composition and merge semantics
254
265
 
255
- Metadata is composed across the `$ref` graph with deterministic behavior:
266
+ `$ref` and `$defs` are for **validation only**: a `$ref` to another schema (or to one of its `$defs`) reuses its JSON Schema definitions but brings none of its `$metadata`.
267
+
268
+ Metadata travels only through **`$metadata.imports`**, a list of schema `$id`s:
269
+
270
+ ```json5
271
+ "$metadata": {
272
+ "imports": ["sctx://core/_strategy_general"],
273
+ "rules": [ /* this schema's own rules */ ]
274
+ }
275
+ ```
256
276
 
257
- 1. Traverse external `$ref` graph in DFS order.
258
- 2. Apply root schema metadata last.
277
+ - An import brings the imported schema's whole `$metadata` (hierarchy, relationships, aliases, rules).
278
+ - Imports are transitive: an imported schema's own imports come too.
279
+ - Merge order: imports in the order listed, depth-first, then the schema's own metadata last. Each schema is merged at most once.
280
+ - An unresolvable import `$id` is an error.
259
281
 
260
- Merge rules:
261
- - `hierarchy`: may be defined in partials; **last one wins**. This allows partials to define a default hierarchy that composing schemas can override.
262
- - `aliases`: shallow merged; later file wins per key.
263
- - `relationships`: collected from all files; order preserved.
264
- - `rules`: merged by `id`.
265
- - Duplicate rule `id` with different payload errors by default.
266
- - A later rule may replace an earlier one only with `"override": true`.
282
+ One merge rule applies to every key. **A duplicate is an error unless the later entry sets `"override": true`**, in which case it replaces the earlier entry.
283
+
284
+ | Key | Identity | How to mark `override` |
285
+ |---|---|---|
286
+ | `rules` | `id` | `"override": true` on the rule |
287
+ | `relationships` | `parent` + `type` + `field` (default `"parent"`) | `"override": true` on the relationship |
288
+ | `aliases` | alias name | `{ "type": "<target>", "override": true }` as the alias value |
289
+ | `hierarchy` | `name` | `"override": true` on the hierarchy declaration |
290
+
291
+ Overriding a hierarchy by name is how a schema replaces the levels of an imported hierarchy (declare it with the same `name` and `"override": true`).
267
292
 
268
293
  When no provider defines `hierarchy`, hierarchy-based behavior is disabled (`show` tree shape, hierarchy validation, parent-edge checks). `space_on_a_page` parsing still requires hierarchy and will error without it.
269
294
 
270
- ### Rule imports via `$ref`
295
+ ### Multiple hierarchies
271
296
 
272
- Inside `$metadata.rules`, entries can be inline rules or `$ref` imports:
297
+ A space has several hierarchies when its schema imports several schemas that each declare one. Each schema declares at most one hierarchy.
298
+
299
+ - **Every imported schema contributes its hierarchy.** Each is kept as a separate named hierarchy; levels are never merged.
300
+ - **Naming.** `hierarchy.name` defaults to the declaring schema's file stem (`_ost_strict` for `_ost_strict.json`). A duplicate name is an error unless the later hierarchy sets `"override": true`.
301
+ - **Main hierarchy.**
302
+ - If the root schema declares a hierarchy, it is the main hierarchy.
303
+ - If the root declares none and exactly one hierarchy is imported, that one is the main hierarchy (for example `strict_ost`, which imports `_ost_strict`).
304
+ - If the root declares none and several are imported, the root must select one with `"hierarchy": { "$ref": "<schema $id>#/$metadata/hierarchy" }`, otherwise loading the schema fails.
305
+ - A root that both declares a hierarchy and uses `$ref` is an error.
306
+ - **Each type belongs to at most one hierarchy.** A type claimed by two hierarchies is an error. To change an imported hierarchy's levels, override it by name.
307
+ - **Selections are not imported.** A `hierarchy: { "$ref" }` selection only applies when its schema is the root, so an imported schema stays usable standalone as another space's root.
273
308
 
274
309
  ```json5
275
- "rules": [
276
- { "$ref": "sctx://my-pack#/$defs/workflowRule" },
277
- { "$ref": "sctx://my-pack#/$defs/ruleSet" }
278
- ]
310
+ {
311
+ "$id": "sctx://team",
312
+ "oneOf": [
313
+ { "$ref": "sctx://_work#/$defs/goal" },
314
+ { "$ref": "sctx://_work#/$defs/task" },
315
+ { "$ref": "sctx://_skills#/$defs/skill_area" },
316
+ { "$ref": "sctx://_skills#/$defs/skill" }
317
+ ],
318
+ "$metadata": {
319
+ // _work.json and _skills.json each declare a hierarchy; select the main one.
320
+ "imports": ["sctx://_work", "sctx://_skills"],
321
+ "hierarchy": { "$ref": "sctx://_work#/$metadata/hierarchy" }
322
+ }
323
+ }
279
324
  ```
280
325
 
281
- Import targets may be:
282
- - a single rule object
283
- - an object containing `rules: []`
326
+ How hierarchies are used:
284
327
 
285
- Imported rules are normalized into one executable flat list before validation.
328
+ | Behaviour | Hierarchies used |
329
+ |---|---|
330
+ | Layering, parent-type, skip-level and orphan checks | Each hierarchy, independently. A hierarchy edge whose parent belongs to another hierarchy is an invalid parent. |
331
+ | Relationships | Connect types across hierarchies, as before |
332
+ | `space_on_a_page` parsing, hierarchy embedding, `template-sync` | Main hierarchy |
333
+ | `show`, `diagram`, `render` | Main hierarchy by default; `--hierarchy <name>` selects another |
334
+ | `resolvedParents` | Hierarchy edges carry the `hierarchy` name |
286
335
 
287
336
  ### Override example
288
337
 
@@ -303,22 +352,48 @@ Imported rules are normalized into one executable flat list before validation.
303
352
  }
304
353
  ```
305
354
 
355
+ ## Schema `$id` namespaces
356
+
357
+ Every schema `$id` uses the `sctx://` scheme. The shape of the `$id` says where the schema comes from:
358
+
359
+ | `$id` shape | Source | Example |
360
+ |---|---|---|
361
+ | `sctx://core/<name>` | Bundled with structured-context | `sctx://core/_sctx_base` |
362
+ | `sctx://<plugin>/<name>` | Contributed by a plugin (its short name, without `sctx-`) | `sctx://wardley-mapping/_wardley` |
363
+ | `sctx://<name>` | Local to a space's schema directory — a single name, no path | `sctx://team` |
364
+
365
+ - Two schemas loaded for the same space may not share an `$id`; a collision is an error naming both sources.
366
+ - `core` is reserved: no plugin may use it as its namespace.
367
+ - **Legacy bundled ids:** before 1.0, bundled schemas used `sctx://<name>` (e.g. `sctx://_sctx_base`, `sctx://strategy_general`). References to those ids in `$ref` and `$metadata.imports` still resolve to their `sctx://core/` equivalents with a deprecation warning, and local schemas may not use them as their own `$id`. The aliases will be removed in 1.0.
368
+
306
369
  ## Partials and `$ref`
307
370
 
308
371
  - Files starting with `_` are auto-loaded partials.
309
- - Both bundled partials and local schema-directory partials are registered.
310
- - Local partial `$id` values must not collide with bundled IDs.
372
+ - Bundled partials, local schema-directory partials, and partials from loaded plugins are all registered.
373
+ - `$id` values follow the [namespace rules](#schema-id-namespaces) and must not collide across bundled, plugin and local schemas.
311
374
  - `$ref` resolution is transitive across files.
312
- - Partials with no `$metadata` should prefer `$schema: "http://json-schema.org/draft-07/schema#"` so they validate standalone as plain JSON Schema fragments.
313
- - **Bundled partials as entity libraries**: `_sctx_base.json`, `_strategy_general.json`, `_knowledge_wiki.json`, and `_ost_strict.json` provide reusable entity definitions and metadata. Composing schemas can reference these via `$ref` rather than redefining common entity types.
314
- - **Partials can carry metadata**: Partials may include `$metadata` (hierarchy, aliases, relationships, rules). This makes them self-contained units that bundle both type definitions and behavioral metadata.
375
+ - Partials with no `$metadata` should prefer `$schema: "https://json-schema.org/draft/2020-12/schema"` so they validate standalone as plain JSON Schema fragments.
376
+ - **Bundled partials as entity libraries**: `_sctx_base.json`, `_strategy_general.json`, `_knowledge_wiki.json`, and `_ost_strict.json` provide reusable entity definitions and metadata. Composing schemas can reference their entity types via `$ref` rather than redefining them.
377
+ - **Partials can carry metadata**: Partials may include `$metadata` (hierarchy, aliases, relationships, rules). A schema gets it only by listing the partial in `$metadata.imports`; `$ref` alone brings none.
378
+
379
+ ## Plugin-contributed schemas
380
+
381
+ Plugins contribute schemas and partials by standard directory convention: placing schema files in `<pluginRoot>/schemas/` (or declaring `"sctx": { "schemas": "./path" }` in `package.json`).
382
+
383
+ Because schemas are resolved statically by convention from the filesystem, structured-context does not need to execute plugin JavaScript code during schema validation, context creation, or schema inspection.
384
+
385
+ When a space uses a plugin schema:
386
+ - **Registry registration**: All partials (`_*`) in the plugin's `schemas/` directory are automatically indexed in the schema registry.
387
+ - **Namespace conventions**: Schemas contributed by a plugin must use `sctx://<pluginName>/...` for their `$id` (e.g. `sctx://wardley-mapping/_wardley`), where the prefix is the plugin's short name (without the `sctx-` prefix). See [Schema `$id` namespaces](#schema-id-namespaces).
388
+ - **Collision protection**: If two plugins register schemas with the same `$id`, or a plugin or local schema collides with a bundled schema, schema loading throws an error.
389
+ - **Imports and $ref**: Plugin schemas can `$ref` or `$metadata.imports` bundled schemas (e.g. `sctx://core/_sctx_base`) as well as other partials within their own namespace. Schema composition rules from #122 apply.
315
390
 
316
391
  ## Editor expectations
317
392
 
318
- Use the shipped metaschema URL in `$schema` for best cross-tool behavior.
393
+ Use the shipped metaschema URL in `$schema` for best cross-tool behavior; pin a `<version>` URL if you need the dialect to stay fixed.
319
394
 
320
395
  Notes:
321
- - Custom `$id` values like `sctx://...` are still supported by the CLI registry.
396
+ - `sctx://` `$id`s are resolved by the CLI registry (see [Schema `$id` namespaces](#schema-id-namespaces)).
322
397
  - Some generic editors may not resolve custom URI schemes for `$ref`; CLI behavior is authoritative.
323
398
  - Do not rely on editor-only mappings for runtime correctness.
324
399
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "structured-context",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Keep your content clean and your thinking clear with assistive tools for structured knowledge",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",
@@ -25,13 +25,17 @@
25
25
  "./types": {
26
26
  "types": "./dist/types.d.ts",
27
27
  "default": "./dist/types.js"
28
+ },
29
+ "./testing": {
30
+ "types": "./dist/testing.d.ts",
31
+ "default": "./dist/testing.js"
28
32
  }
29
33
  },
30
34
  "scripts": {
31
35
  "clean": "rm -rf dist",
32
36
  "generate:schema-meta": "bun run scripts/generate-schema-meta.ts",
33
37
  "typecheck": "tsc --noEmit",
34
- "build": "bun run clean && bun run generate:schema-meta && tsc -p tsconfig.build.json && cp -r schemas dist/ && chmod +x dist/index.js",
38
+ "build": "bun run clean && bun run generate:schema-meta && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && cp -r schemas dist/ && chmod +x dist/index.js",
35
39
  "prepublishOnly": "bun run build",
36
40
  "validate": "bun run src/index.ts validate",
37
41
  "diagram": "bun run src/index.ts diagram",
@@ -43,29 +47,30 @@
43
47
  "lint": "biome check",
44
48
  "lint:fix": "biome check --write",
45
49
  "preversion": "bun run generate:schema-meta && bun run lint:fix && bun run test",
46
- "version": "git add -A",
50
+ "version": "bun run generate:schema-meta --release && git add -A",
47
51
  "postversion": "git push --follow-tags"
48
52
  },
49
53
  "devDependencies": {
50
- "@anthropic-ai/claude-agent-sdk": "^0.2.92",
51
- "@biomejs/biome": "^2.4.10",
54
+ "@anthropic-ai/claude-agent-sdk": "^0.3.191",
55
+ "@biomejs/biome": "^2.5.1",
52
56
  "@types/bun": "latest",
53
57
  "@types/js-yaml": "^4.0.9",
54
58
  "json-schema-to-ts": "^3.1.1",
55
- "lefthook": "^2.1.4"
59
+ "lefthook": "^2.1.9",
60
+ "tsc-alias": "^1.9.1"
56
61
  },
57
62
  "peerDependencies": {
58
63
  "typescript": "^5"
59
64
  },
60
65
  "dependencies": {
61
- "ajv": "^8.18.0",
66
+ "ajv": "^8.20.0",
62
67
  "chokidar": "^5.0.0",
63
68
  "commander": "^14.0.3",
64
69
  "fast-glob": "^3.3.3",
65
70
  "gray-matter": "^4.0.3",
66
71
  "js-yaml": "^4.1.1",
67
72
  "json5": "^2.2.3",
68
- "jsonata": "^2.1.0",
73
+ "jsonata": "^2.2.1",
69
74
  "mdast-util-to-string": "^4.0.0",
70
75
  "remark-gfm": "^4.0.1",
71
76
  "remark-parse": "^11.0.0",
@@ -1,6 +1,6 @@
1
1
  {
2
- "$schema": "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/_structured_context_schema_meta.json",
3
- "$id": "sctx://_knowledge_wiki",
2
+ "$schema": "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/latest/_structured_context_schema_meta.json",
3
+ "$id": "sctx://core/_knowledge_wiki",
4
4
  // Shared entity definitions for knowledge wiki schemas.
5
5
  // Provides aliases, relationships, rules, and entity type $defs.
6
6
  // This partial has no hierarchy — wiki entities are flat with no required parent links.
@@ -65,18 +65,18 @@
65
65
  "source": {
66
66
  "type": "object",
67
67
  "description": "A processed summary of a raw source (article, paper, book, video, thread, podcast, etc.). Captures key information from the source in structured form with provenance.",
68
- "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
68
+ "allOf": [{ "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" }],
69
69
  "properties": {
70
70
  "type": { "const": "source" },
71
71
  "summary": {
72
- "$ref": "sctx://_sctx_base#/$defs/summary"
72
+ "$ref": "sctx://core/_sctx_base#/$defs/summary"
73
73
  },
74
74
  "url": {
75
75
  "type": "string",
76
76
  "description": "URL of the original source"
77
77
  },
78
78
  "local_copy": {
79
- "$ref": "sctx://_sctx_base#/$defs/wikilink",
79
+ "$ref": "sctx://core/_sctx_base#/$defs/wikilink",
80
80
  "description": "Wikilink to a local copy of the source (e.g. a saved PDF or clipped note)"
81
81
  },
82
82
  "author": {
@@ -98,7 +98,7 @@
98
98
  },
99
99
  "sources": {
100
100
  "type": "array",
101
- "items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
101
+ "items": { "$ref": "sctx://core/_sctx_base#/$defs/wikilink" },
102
102
  "description": "Wikilinks to other source pages that this one references or extends"
103
103
  }
104
104
  },
@@ -117,20 +117,20 @@
117
117
  "concept": {
118
118
  "type": "object",
119
119
  "description": "A concept page — defines and frames a specific idea, mechanism, or domain term. May draw from multiple sources. The building blocks of the wiki's knowledge graph.",
120
- "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
120
+ "allOf": [{ "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" }],
121
121
  "properties": {
122
122
  "type": { "const": "concept" },
123
123
  "summary": {
124
- "$ref": "sctx://_sctx_base#/$defs/summary"
124
+ "$ref": "sctx://core/_sctx_base#/$defs/summary"
125
125
  },
126
126
  "sources": {
127
127
  "type": "array",
128
- "items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
128
+ "items": { "$ref": "sctx://core/_sctx_base#/$defs/wikilink" },
129
129
  "description": "Wikilinks to source pages that contributed to this concept"
130
130
  },
131
131
  "related": {
132
132
  "type": "array",
133
- "items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
133
+ "items": { "$ref": "sctx://core/_sctx_base#/$defs/wikilink" },
134
134
  "description": "Wikilinks to related concept or synthesis pages"
135
135
  }
136
136
  },
@@ -147,20 +147,20 @@
147
147
  "entity": {
148
148
  "type": "object",
149
149
  "description": "A concrete entity — a person, organisation, product, model, or other named thing. The building blocks of the wiki's knowledge graph alongside concepts. Entities are distinct from concepts: a concept frames an idea or mechanism; an entity is a specific, identifiable thing in the world.",
150
- "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
150
+ "allOf": [{ "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" }],
151
151
  "properties": {
152
152
  "type": { "const": "entity" },
153
153
  "summary": {
154
- "$ref": "sctx://_sctx_base#/$defs/summary"
154
+ "$ref": "sctx://core/_sctx_base#/$defs/summary"
155
155
  },
156
156
  "sources": {
157
157
  "type": "array",
158
- "items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
158
+ "items": { "$ref": "sctx://core/_sctx_base#/$defs/wikilink" },
159
159
  "description": "Wikilinks to source pages that contributed to this entity page"
160
160
  },
161
161
  "related": {
162
162
  "type": "array",
163
- "items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
163
+ "items": { "$ref": "sctx://core/_sctx_base#/$defs/wikilink" },
164
164
  "description": "Wikilinks to related entity, concept, or synthesis pages"
165
165
  }
166
166
  },
@@ -177,20 +177,20 @@
177
177
  "synthesis": {
178
178
  "type": "object",
179
179
  "description": "A synthesis page — connects multiple concepts and sources into a coherent model, framework, or thesis. The highest-value pages in a knowledge wiki. Must reference contributing sources.",
180
- "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
180
+ "allOf": [{ "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" }],
181
181
  "properties": {
182
182
  "type": { "const": "synthesis" },
183
183
  "summary": {
184
- "$ref": "sctx://_sctx_base#/$defs/summary"
184
+ "$ref": "sctx://core/_sctx_base#/$defs/summary"
185
185
  },
186
186
  "sources": {
187
187
  "type": "array",
188
- "items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
188
+ "items": { "$ref": "sctx://core/_sctx_base#/$defs/wikilink" },
189
189
  "description": "Wikilinks to source pages this synthesis draws from"
190
190
  },
191
191
  "concepts": {
192
192
  "type": "array",
193
- "items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
193
+ "items": { "$ref": "sctx://core/_sctx_base#/$defs/wikilink" },
194
194
  "description": "Wikilinks to concept pages this synthesis connects"
195
195
  }
196
196
  },
@@ -208,7 +208,7 @@
208
208
  "note": {
209
209
  "type": "object",
210
210
  "description": "Personal notes, journal entries, talk notes, or rough thoughts not drawn from an external URL.",
211
- "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
211
+ "allOf": [{ "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" }],
212
212
  "properties": {
213
213
  "type": { "const": "note" },
214
214
  "date": {
@@ -230,7 +230,7 @@
230
230
  "index": {
231
231
  "type": "object",
232
232
  "description": "The wiki index — a catalog of all pages with links, summaries, and metadata. Updated by the agent on ingest. Used as the primary navigation entry point.",
233
- "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
233
+ "allOf": [{ "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" }],
234
234
  "properties": {
235
235
  "type": { "const": "index" }
236
236
  },
@@ -1,6 +1,6 @@
1
1
  {
2
- "$schema": "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/_structured_context_schema_meta.json",
3
- "$id": "sctx://_ost_strict",
2
+ "$schema": "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/latest/_structured_context_schema_meta.json",
3
+ "$id": "sctx://core/_ost_strict",
4
4
  // Shared definitions for the strict OST (Opportunity Solution Tree) schema.
5
5
  // This schema follows Teresa Torres' canonical 4-level structure as described in
6
6
  // "Continuous Discovery Habits" (2021) and at producttalk.org.
@@ -1,6 +1,6 @@
1
1
  {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "sctx://_sctx_base",
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sctx://core/_sctx_base",
4
4
  "description": "Shared definitions for structured-context schemas",
5
5
  "$defs": {
6
6
  "title": {
@@ -1,9 +1,9 @@
1
1
  {
2
- "$schema": "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/_structured_context_schema_meta.json",
3
- "$id": "sctx://_strategy_general",
2
+ "$schema": "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/latest/_structured_context_schema_meta.json",
3
+ "$id": "sctx://core/_strategy_general",
4
4
  // Shared entity definitions for strategy-general schemas.
5
- // Provides a default hierarchy, aliases, relationships, and entity type $defs.
6
- // Composing schemas can override the hierarchy by defining their own.
5
+ // Provides a hierarchy, aliases, relationships, and entity type $defs.
6
+ // Schemas that import this partial get its metadata; a $ref to its $defs alone brings none.
7
7
  "$metadata": {
8
8
  "hierarchy": {
9
9
  "levels": [
@@ -45,7 +45,7 @@
45
45
  "$defs": {
46
46
  "dashboard": {
47
47
  "type": "object",
48
- "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
48
+ "allOf": [{ "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" }],
49
49
  "properties": {
50
50
  "type": { "const": "dashboard" }
51
51
  },
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "ost_on_a_page": {
56
56
  "type": "object",
57
- "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
57
+ "allOf": [{ "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" }],
58
58
  "properties": {
59
59
  "type": { "enum": ["ost_on_a_page", "space_on_a_page"] }
60
60
  },
@@ -64,8 +64,8 @@
64
64
  "vision": {
65
65
  "type": "object",
66
66
  "allOf": [
67
- { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
68
- { "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
67
+ { "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" },
68
+ { "$ref": "sctx://core/_sctx_base#/$defs/ostEntityProps" }
69
69
  ],
70
70
  "properties": {
71
71
  "type": { "const": "vision" }
@@ -83,9 +83,9 @@
83
83
  "mission": {
84
84
  "type": "object",
85
85
  "allOf": [
86
- { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
87
- { "$ref": "sctx://_sctx_base#/$defs/parentNodeProps" },
88
- { "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
86
+ { "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" },
87
+ { "$ref": "sctx://core/_sctx_base#/$defs/parentNodeProps" },
88
+ { "$ref": "sctx://core/_sctx_base#/$defs/ostEntityProps" }
89
89
  ],
90
90
  "properties": {
91
91
  "type": { "const": "mission" }
@@ -103,13 +103,13 @@
103
103
  "goal": {
104
104
  "type": "object",
105
105
  "allOf": [
106
- { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
107
- { "$ref": "sctx://_sctx_base#/$defs/parentNodeProps" },
108
- { "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
106
+ { "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" },
107
+ { "$ref": "sctx://core/_sctx_base#/$defs/parentNodeProps" },
108
+ { "$ref": "sctx://core/_sctx_base#/$defs/ostEntityProps" }
109
109
  ],
110
110
  "properties": {
111
111
  "type": { "enum": ["goal", "outcome"] },
112
- "priority": { "$ref": "sctx://_sctx_base#/$defs/priority" }
112
+ "priority": { "$ref": "sctx://core/_sctx_base#/$defs/priority" }
113
113
  },
114
114
  "required": ["type"],
115
115
  "additionalProperties": true,
@@ -125,16 +125,16 @@
125
125
  "opportunity": {
126
126
  "type": "object",
127
127
  "allOf": [
128
- { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
129
- { "$ref": "sctx://_sctx_base#/$defs/parentNodeProps" },
130
- { "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
128
+ { "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" },
129
+ { "$ref": "sctx://core/_sctx_base#/$defs/parentNodeProps" },
130
+ { "$ref": "sctx://core/_sctx_base#/$defs/ostEntityProps" }
131
131
  ],
132
132
  "properties": {
133
133
  "type": { "const": "opportunity" },
134
- "priority": { "$ref": "sctx://_sctx_base#/$defs/priority" },
135
- "impact": { "$ref": "sctx://_sctx_base#/$defs/assessment" },
136
- "feasibility": { "$ref": "sctx://_sctx_base#/$defs/assessment" },
137
- "resources": { "$ref": "sctx://_sctx_base#/$defs/assessment" },
134
+ "priority": { "$ref": "sctx://core/_sctx_base#/$defs/priority" },
135
+ "impact": { "$ref": "sctx://core/_sctx_base#/$defs/assessment" },
136
+ "feasibility": { "$ref": "sctx://core/_sctx_base#/$defs/assessment" },
137
+ "resources": { "$ref": "sctx://core/_sctx_base#/$defs/assessment" },
138
138
  "timeline": {
139
139
  "type": "string",
140
140
  "description": "Timeline estimate (e.g., S-M, M-L)"
@@ -158,16 +158,16 @@
158
158
  "solution": {
159
159
  "type": "object",
160
160
  "allOf": [
161
- { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
162
- { "$ref": "sctx://_sctx_base#/$defs/parentNodeProps" },
163
- { "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
161
+ { "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" },
162
+ { "$ref": "sctx://core/_sctx_base#/$defs/parentNodeProps" },
163
+ { "$ref": "sctx://core/_sctx_base#/$defs/ostEntityProps" }
164
164
  ],
165
165
  "properties": {
166
166
  "type": { "const": "solution" },
167
- "priority": { "$ref": "sctx://_sctx_base#/$defs/priority" },
168
- "impact": { "$ref": "sctx://_sctx_base#/$defs/assessment" },
169
- "feasibility": { "$ref": "sctx://_sctx_base#/$defs/assessment" },
170
- "resources": { "$ref": "sctx://_sctx_base#/$defs/assessment" },
167
+ "priority": { "$ref": "sctx://core/_sctx_base#/$defs/priority" },
168
+ "impact": { "$ref": "sctx://core/_sctx_base#/$defs/assessment" },
169
+ "feasibility": { "$ref": "sctx://core/_sctx_base#/$defs/assessment" },
170
+ "resources": { "$ref": "sctx://core/_sctx_base#/$defs/assessment" },
171
171
  "timeline": {
172
172
  "type": "string",
173
173
  "description": "Timeline estimate (e.g., S-M, M-L)"
@@ -191,9 +191,9 @@
191
191
  "experiment": {
192
192
  "type": "object",
193
193
  "allOf": [
194
- { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
195
- { "$ref": "sctx://_sctx_base#/$defs/parentNodeProps" },
196
- { "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
194
+ { "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" },
195
+ { "$ref": "sctx://core/_sctx_base#/$defs/parentNodeProps" },
196
+ { "$ref": "sctx://core/_sctx_base#/$defs/ostEntityProps" }
197
197
  ],
198
198
  "properties": {
199
199
  "type": { "enum": ["experiment", "assumption_test", "test"] }
@@ -216,9 +216,9 @@
216
216
  "assumption": {
217
217
  "type": "object",
218
218
  "allOf": [
219
- { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
220
- { "$ref": "sctx://_sctx_base#/$defs/parentNodeProps" },
221
- { "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
219
+ { "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" },
220
+ { "$ref": "sctx://core/_sctx_base#/$defs/parentNodeProps" },
221
+ { "$ref": "sctx://core/_sctx_base#/$defs/ostEntityProps" }
222
222
  ],
223
223
  "properties": {
224
224
  "type": { "const": "assumption" },
@@ -242,9 +242,9 @@
242
242
  "problem_statement": {
243
243
  "type": "object",
244
244
  "allOf": [
245
- { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
246
- { "$ref": "sctx://_sctx_base#/$defs/parentNodeProps" },
247
- { "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
245
+ { "$ref": "sctx://core/_sctx_base#/$defs/baseNodeProps" },
246
+ { "$ref": "sctx://core/_sctx_base#/$defs/parentNodeProps" },
247
+ { "$ref": "sctx://core/_sctx_base#/$defs/ostEntityProps" }
248
248
  ],
249
249
  "properties": {
250
250
  "type": { "const": "problem_statement" }