structured-context 0.11.0 → 0.13.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 (138) hide show
  1. package/README.md +52 -198
  2. package/dist/api.d.ts +17 -15
  3. package/dist/api.js +12 -9
  4. package/dist/commands/diagram.d.ts +1 -0
  5. package/dist/commands/diagram.js +7 -1
  6. package/dist/commands/docs.js +1 -0
  7. package/dist/commands/dump.d.ts +15 -2
  8. package/dist/commands/dump.js +18 -4
  9. package/dist/commands/providers.d.ts +4 -0
  10. package/dist/commands/providers.js +52 -0
  11. package/dist/commands/render.d.ts +4 -0
  12. package/dist/commands/render.js +64 -9
  13. package/dist/commands/schemas.d.ts +2 -2
  14. package/dist/commands/schemas.js +133 -22
  15. package/dist/commands/show.d.ts +1 -0
  16. package/dist/commands/show.js +7 -1
  17. package/dist/commands/spaces.d.ts +3 -1
  18. package/dist/commands/spaces.js +11 -2
  19. package/dist/commands/validate-file.d.ts +3 -0
  20. package/dist/commands/validate-file.js +24 -6
  21. package/dist/commands/validate.d.ts +4 -0
  22. package/dist/commands/validate.js +79 -23
  23. package/dist/config.d.ts +25 -1
  24. package/dist/config.js +106 -12
  25. package/dist/filter/augment-nodes.d.ts +3 -1
  26. package/dist/filter/augment-nodes.js +12 -7
  27. package/dist/filter/filter-nodes.js +1 -1
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +96 -31
  30. package/dist/judge/context.d.ts +20 -0
  31. package/dist/judge/context.js +105 -0
  32. package/dist/judge/factory.d.ts +44 -0
  33. package/dist/judge/factory.js +148 -0
  34. package/dist/judge/index.d.ts +13 -0
  35. package/dist/judge/index.js +8 -0
  36. package/dist/judge/judge-node.d.ts +27 -0
  37. package/dist/judge/judge-node.js +122 -0
  38. package/dist/judge/prompt.d.ts +10 -0
  39. package/dist/judge/prompt.js +92 -0
  40. package/dist/judge/provider/anthropic.d.ts +17 -0
  41. package/dist/judge/provider/anthropic.js +43 -0
  42. package/dist/judge/provider/fake.d.ts +26 -0
  43. package/dist/judge/provider/fake.js +56 -0
  44. package/dist/judge/provider/jev.d.ts +37 -0
  45. package/dist/judge/provider/jev.js +169 -0
  46. package/dist/judge/provider/openai-decisions.d.ts +21 -0
  47. package/dist/judge/provider/openai-decisions.js +84 -0
  48. package/dist/judge/provider/openai.d.ts +20 -0
  49. package/dist/judge/provider/openai.js +53 -0
  50. package/dist/judge/provider/per-rule.d.ts +10 -0
  51. package/dist/judge/provider/per-rule.js +18 -0
  52. package/dist/judge/trim.d.ts +27 -0
  53. package/dist/judge/trim.js +62 -0
  54. package/dist/judge/types.d.ts +92 -0
  55. package/dist/judge/types.js +9 -0
  56. package/dist/judge/verdicts.d.ts +24 -0
  57. package/dist/judge/verdicts.js +82 -0
  58. package/dist/load-space-graph.d.ts +7 -5
  59. package/dist/load-space-graph.js +19 -8
  60. package/dist/plugins/loader.js +3 -3
  61. package/dist/plugins/markdown/extract-content-links.js +8 -29
  62. package/dist/plugins/markdown/index.js +8 -2
  63. package/dist/plugins/markdown/parse-embedded.d.ts +8 -0
  64. package/dist/plugins/markdown/parse-embedded.js +195 -24
  65. package/dist/plugins/markdown/read-space.js +42 -14
  66. package/dist/plugins/markdown/render-directory.d.ts +11 -0
  67. package/dist/plugins/markdown/render-directory.js +130 -0
  68. package/dist/plugins/markdown/template-sync.js +3 -4
  69. package/dist/plugins/markdown/util.d.ts +26 -5
  70. package/dist/plugins/markdown/util.js +56 -15
  71. package/dist/plugins/mermaid/render-mermaid.js +2 -1
  72. package/dist/plugins/miro/sync.js +7 -6
  73. package/dist/plugins/util.d.ts +39 -1
  74. package/dist/plugins/util.js +139 -0
  75. package/dist/read/resolve-graph-edges.d.ts +1 -1
  76. package/dist/read/resolve-graph-edges.js +46 -27
  77. package/dist/read/wikilink-utils.d.ts +17 -0
  78. package/dist/read/wikilink-utils.js +40 -0
  79. package/dist/render/render.d.ts +3 -1
  80. package/dist/render/render.js +2 -2
  81. package/dist/schema/evaluate-rule.d.ts +33 -2
  82. package/dist/schema/evaluate-rule.js +58 -4
  83. package/dist/schema/gating.d.ts +69 -0
  84. package/dist/schema/gating.js +253 -0
  85. package/dist/schema/meta-schemas.d.ts +13 -0
  86. package/dist/schema/meta-schemas.js +50 -0
  87. package/dist/schema/metadata-contract.d.ts +952 -183
  88. package/dist/schema/metadata-contract.js +177 -33
  89. package/dist/schema/rule-filter.d.ts +12 -0
  90. package/dist/schema/rule-filter.js +46 -0
  91. package/dist/schema/rule-severity.d.ts +13 -0
  92. package/dist/schema/rule-severity.js +33 -0
  93. package/dist/schema/schema.d.ts +14 -8
  94. package/dist/schema/schema.js +308 -199
  95. package/dist/schema/validate-graph.d.ts +2 -1
  96. package/dist/schema/validate-graph.js +40 -23
  97. package/dist/schema/validate-rules.d.ts +16 -3
  98. package/dist/schema/validate-rules.js +91 -29
  99. package/dist/schemas/_knowledge_wiki.json +24 -24
  100. package/dist/schemas/_okf.json +172 -0
  101. package/dist/schemas/_ost_strict.json +17 -8
  102. package/dist/schemas/_sctx_base.json +3 -3
  103. package/dist/schemas/_strategy_general.json +38 -38
  104. package/dist/schemas/generated/0.12.0/_structured_context_schema_meta.json +229 -0
  105. package/dist/schemas/generated/0.13.0/_structured_context_schema_meta.json +400 -0
  106. package/dist/schemas/generated/latest/_structured_context_schema_meta.json +400 -0
  107. package/dist/schemas/knowledge_wiki.json +10 -9
  108. package/dist/schemas/okf.json +8 -0
  109. package/dist/schemas/strategy_general.json +15 -14
  110. package/dist/schemas/strict_ost.json +17 -16
  111. package/dist/space-context.d.ts +5 -2
  112. package/dist/space-context.js +9 -4
  113. package/dist/space-graph.d.ts +9 -7
  114. package/dist/space-graph.js +7 -5
  115. package/dist/testing.d.ts +33 -0
  116. package/dist/testing.js +72 -0
  117. package/dist/types.d.ts +64 -16
  118. package/dist/validate.d.ts +62 -9
  119. package/dist/validate.js +229 -114
  120. package/docs/concepts.md +65 -9
  121. package/docs/config.md +78 -1
  122. package/docs/rules.md +168 -50
  123. package/docs/schemas.md +152 -52
  124. package/package.json +17 -11
  125. package/schemas/_knowledge_wiki.json +24 -24
  126. package/schemas/_okf.json +172 -0
  127. package/schemas/_ost_strict.json +17 -8
  128. package/schemas/_sctx_base.json +3 -3
  129. package/schemas/_strategy_general.json +38 -38
  130. package/schemas/generated/0.12.0/_structured_context_schema_meta.json +229 -0
  131. package/schemas/generated/0.13.0/_structured_context_schema_meta.json +400 -0
  132. package/schemas/generated/latest/_structured_context_schema_meta.json +400 -0
  133. package/schemas/knowledge_wiki.json +10 -9
  134. package/schemas/okf.json +8 -0
  135. package/schemas/strategy_general.json +15 -14
  136. package/schemas/strict_ost.json +17 -16
  137. package/dist/schemas/generated/_structured_context_schema_meta.json +0 -191
  138. package/schemas/generated/_structured_context_schema_meta.json +0 -191
@@ -0,0 +1,172 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/latest/_structured_context_schema_meta.json",
3
+ "$id": "sctx://core/_okf",
4
+ // Open Knowledge Format v0.2 frontmatter families: core, provenance, trust, lifecycle, attested computation.
5
+ // OKF §4.1: consumers MUST NOT reject unknown fields, so every object here allows additional properties.
6
+ // Concept types are not registered centrally (§4.1), so there is deliberately no oneOf over `type` consts:
7
+ // type checking would reject every type not listed. `Attested Computation` is handled with if/then instead.
8
+ // index.md and log.md are reserved bundle files without a `type`; they are reported as excluded during parsing.
9
+ "$metadata": {
10
+ "rules": [
11
+ {
12
+ "id": "okf-description",
13
+ "category": "best-practice",
14
+ "severity": "warning",
15
+ "description": "Concepts should have a one-line description (used by index generators and search snippets)",
16
+ "expression": "$exists(current.description) and $length(current.description) > 0"
17
+ },
18
+ {
19
+ "id": "okf-stale-after-generated",
20
+ "category": "validation",
21
+ "description": "stale_after must be later than generated.at",
22
+ "expression": "$not($exists(current.stale_after)) or $not($exists(current.generated.at)) or $toMillis(current.stale_after) > $toMillis(current.generated.at)"
23
+ },
24
+ {
25
+ "id": "okf-usage-count-window",
26
+ "category": "coherence",
27
+ "severity": "warning",
28
+ "description": "A source's usage_count is only meaningful within a usage_window (on the source or shared at the top level)",
29
+ "expression": "$not($exists(current.sources)) or $count(current.sources[$exists(usage_count) and $not($exists(usage_window)) and $not($exists($$.current.usage_window))]) = 0"
30
+ },
31
+ {
32
+ "id": "okf-computation-present",
33
+ "category": "validation",
34
+ "type": "Attested Computation",
35
+ "description": "An Attested Computation needs its computation: a `computation` path or a body `# Computation` section. Known limitation: the section is found by matching a `# Computation` line in the body text, so such a line inside a code fence also counts",
36
+ "expression": "$exists(current.computation) or $contains(current.content, /^# Computation[ \\t]*$/m)"
37
+ }
38
+ ]
39
+ },
40
+ "$defs": {
41
+ "timestamp": {
42
+ "type": "string",
43
+ "format": "date-time",
44
+ "description": "ISO 8601 datetime with an explicit UTC offset, e.g. 2026-06-30T14:00:00Z (§5)"
45
+ },
46
+ "actor": {
47
+ "type": "string",
48
+ "minLength": 1,
49
+ "description": "<producer>/<version> for agents, human:<id> for people, process:<id> for automated processes (§7)"
50
+ },
51
+ "usageWindow": {
52
+ "type": "object",
53
+ "properties": {
54
+ "from": { "$ref": "#/$defs/timestamp" },
55
+ "to": { "$ref": "#/$defs/timestamp" }
56
+ },
57
+ "required": ["from", "to"]
58
+ },
59
+ "source": {
60
+ "type": "object",
61
+ "properties": {
62
+ "resource": {
63
+ "type": "string",
64
+ "minLength": 1,
65
+ "description": "Followable artifact (URL or path) or a scope descriptor"
66
+ },
67
+ "id": { "type": "string", "description": "Stable key for footnote attribution" },
68
+ "title": { "type": "string" },
69
+ "author": { "$ref": "#/$defs/actor" },
70
+ "usage_count": { "type": "integer", "minimum": 0 },
71
+ "last_modified": { "$ref": "#/$defs/timestamp" },
72
+ "usage_window": { "$ref": "#/$defs/usageWindow" }
73
+ },
74
+ "required": ["resource"]
75
+ },
76
+ "generated": {
77
+ "type": "object",
78
+ "properties": {
79
+ "by": { "$ref": "#/$defs/actor" },
80
+ "at": { "$ref": "#/$defs/timestamp" }
81
+ },
82
+ "required": ["by"]
83
+ },
84
+ "verification": {
85
+ "type": "object",
86
+ "properties": {
87
+ "by": { "$ref": "#/$defs/actor" },
88
+ "at": { "$ref": "#/$defs/timestamp" }
89
+ },
90
+ "required": ["by", "at"]
91
+ },
92
+ "okfProps": {
93
+ "type": "object",
94
+ "properties": {
95
+ "type": {
96
+ "type": "string",
97
+ "minLength": 1,
98
+ "description": "Kind of concept; unregistered and open-ended (§4.1)"
99
+ },
100
+ "title": { "type": "string" },
101
+ "description": { "type": "string" },
102
+ "resource": { "type": "string", "minLength": 1, "description": "URI or path of the underlying asset" },
103
+ "tags": { "type": "array", "items": { "type": "string" } },
104
+ "sources": { "type": "array", "items": { "$ref": "#/$defs/source" } },
105
+ "usage_window": { "$ref": "#/$defs/usageWindow" },
106
+ "generated": { "$ref": "#/$defs/generated" },
107
+ "verified": {
108
+ "description": "One verification event, or a list of them (§5.2: a bare mapping is a one-element list)",
109
+ "anyOf": [
110
+ { "$ref": "#/$defs/verification" },
111
+ { "type": "array", "items": { "$ref": "#/$defs/verification" } }
112
+ ]
113
+ },
114
+ "status": { "type": "string", "enum": ["draft", "stable", "deprecated"], "default": "stable" },
115
+ "stale_after": { "$ref": "#/$defs/timestamp" }
116
+ },
117
+ "required": ["type"]
118
+ },
119
+ "concept": {
120
+ "type": "object",
121
+ "allOf": [
122
+ { "$ref": "#/$defs/okfProps" },
123
+ {
124
+ "if": { "properties": { "type": { "const": "Attested Computation" } }, "required": ["type"] },
125
+ "then": { "$ref": "#/$defs/attestedComputation" }
126
+ }
127
+ ],
128
+ "additionalProperties": true
129
+ },
130
+ "attestedComputation": {
131
+ "type": "object",
132
+ "properties": {
133
+ "runtime": {
134
+ "type": "string",
135
+ "minLength": 1,
136
+ "description": "How to run the computation; defines what `parameters` mean (§10.2)"
137
+ },
138
+ "parameters": {
139
+ "type": "array",
140
+ "items": {
141
+ "type": "object",
142
+ "properties": {
143
+ "name": { "type": "string", "minLength": 1 },
144
+ "type": { "type": "string", "minLength": 1 },
145
+ "required": { "type": "boolean" }
146
+ },
147
+ "required": ["name", "type"]
148
+ }
149
+ },
150
+ "computation": {
151
+ "type": "string",
152
+ "minLength": 1,
153
+ "description": "Path to a file holding the computation, instead of the body fence"
154
+ },
155
+ "executor": {
156
+ "type": "object",
157
+ "properties": {
158
+ "resource": { "type": "string", "minLength": 1 },
159
+ "receipt": { "type": "array", "items": { "type": "string" }, "description": "Fields a run must return" }
160
+ },
161
+ "required": ["resource"]
162
+ },
163
+ "attester": {
164
+ "type": "object",
165
+ "properties": { "resource": { "type": "string", "minLength": 1 } },
166
+ "required": ["resource"]
167
+ }
168
+ },
169
+ "required": ["runtime"]
170
+ }
171
+ }
172
+ }
@@ -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.
@@ -13,28 +13,37 @@
13
13
  "id": "active-outcome-count",
14
14
  "category": "workflow",
15
15
  "description": "Only one outcome should be active at a time",
16
- "scope": "global",
17
- "check": "$count(nodes[resolvedType='outcome' and status='active']) <= 1"
16
+ "global": true,
17
+ "expression": "$count(nodes[resolvedType='outcome' and status='active']) <= 1"
18
18
  },
19
19
  {
20
20
  "id": "active-opportunity-count",
21
21
  "category": "workflow",
22
22
  "description": "Only one target opportunity should be active at a time",
23
- "scope": "global",
24
- "check": "$count(nodes[resolvedType='opportunity' and status='active']) <= 1"
23
+ "global": true,
24
+ "expression": "$count(nodes[resolvedType='opportunity' and status='active']) <= 1"
25
25
  },
26
26
  {
27
27
  "id": "active-node-parent-active",
28
28
  "category": "workflow",
29
29
  "description": "An active node's parent should also be active",
30
- "check": "current.status != 'active' or $exists(parent) = false or parent.status = 'active'"
30
+ "expression": "current.status != 'active' or $exists(parent) = false or parent.status = 'active'"
31
31
  },
32
32
  {
33
33
  "id": "solution-quantity",
34
34
  "category": "best-practice",
35
35
  "description": "Explore multiple candidate solutions (aim for at least three) for the target opportunity",
36
36
  "type": "opportunity",
37
- "check": "(current.status != 'exploring' and current.status != 'active') or $count(nodes[resolvedParentTitle=$$.current.title and resolvedType='solution']) >= 3"
37
+ "expression": "(current.status != 'exploring' and current.status != 'active') or $count(nodes[resolvedParentTitle=$$.current.title and resolvedType='solution']) >= 3"
38
+ },
39
+ {
40
+ "id": "opportunity-customer-voice",
41
+ "category": "best-practice",
42
+ "type": "opportunity",
43
+ "description": "Opportunity must be framed in the customer's voice (something a customer would actually say) as a need or pain point, not a solution or business goal",
44
+ "semantic": {
45
+ "rubric": "Verify that the opportunity is stated from the customer's perspective as a problem, pain point, or desire. It must not be a solution in disguise (e.g. 'build X feature') or a business metric (e.g. 'increase revenue')."
46
+ }
38
47
  }
39
48
  ]
40
49
  },
@@ -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": {
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "content": {
11
11
  "type": "string",
12
- "description": "Body content"
12
+ "description": "Markdown source of the node's body, excluding its own heading or list marker and any nested embedded nodes"
13
13
  },
14
14
  "summary": {
15
15
  "type": "string",
@@ -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" }
@@ -0,0 +1,229 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/0.12.0/_structured_context_schema_meta.json",
4
+ "title": "structured-context schema dialect",
5
+ "description": "Extends JSON Schema 2020-12 with top-level $metadata for imports, hierarchy, relationships, aliases and rules.",
6
+ "type": "object",
7
+ "allOf": [
8
+ {
9
+ "$ref": "https://json-schema.org/draft/2020-12/schema"
10
+ }
11
+ ],
12
+ "properties": {
13
+ "$metadata": {
14
+ "type": "object",
15
+ "properties": {
16
+ "imports": {
17
+ "type": "array",
18
+ "items": {
19
+ "type": "string",
20
+ "minLength": 1
21
+ }
22
+ },
23
+ "hierarchy": {
24
+ "oneOf": [
25
+ {
26
+ "type": "object",
27
+ "properties": {
28
+ "name": {
29
+ "type": "string",
30
+ "minLength": 1
31
+ },
32
+ "override": {
33
+ "type": "boolean"
34
+ },
35
+ "levels": {
36
+ "type": "array",
37
+ "minItems": 1,
38
+ "items": {
39
+ "oneOf": [
40
+ {
41
+ "type": "string",
42
+ "minLength": 1
43
+ },
44
+ {
45
+ "type": "object",
46
+ "properties": {
47
+ "type": {
48
+ "type": "string",
49
+ "minLength": 1
50
+ },
51
+ "field": {
52
+ "type": "string",
53
+ "minLength": 1
54
+ },
55
+ "fieldOn": {
56
+ "enum": ["child", "parent"]
57
+ },
58
+ "multiple": {
59
+ "type": "boolean"
60
+ },
61
+ "templateFormat": {
62
+ "enum": ["heading", "list", "table", "page"]
63
+ },
64
+ "matchers": {
65
+ "type": "array",
66
+ "items": {
67
+ "type": "string",
68
+ "minLength": 1
69
+ },
70
+ "minItems": 1
71
+ },
72
+ "embeddedTemplateFields": {
73
+ "type": "array",
74
+ "items": {
75
+ "type": "string",
76
+ "minLength": 1
77
+ }
78
+ },
79
+ "selfRef": {
80
+ "type": "boolean"
81
+ },
82
+ "selfRefField": {
83
+ "type": "string",
84
+ "minLength": 1
85
+ }
86
+ },
87
+ "required": ["type"],
88
+ "additionalProperties": false
89
+ }
90
+ ]
91
+ }
92
+ },
93
+ "allowSkipLevels": {
94
+ "type": "boolean"
95
+ }
96
+ },
97
+ "required": ["levels"],
98
+ "additionalProperties": false
99
+ },
100
+ {
101
+ "type": "object",
102
+ "properties": {
103
+ "$ref": {
104
+ "type": "string",
105
+ "minLength": 1
106
+ }
107
+ },
108
+ "required": ["$ref"],
109
+ "additionalProperties": false
110
+ }
111
+ ]
112
+ },
113
+ "relationships": {
114
+ "type": "array",
115
+ "items": {
116
+ "type": "object",
117
+ "properties": {
118
+ "parent": {
119
+ "type": "string",
120
+ "minLength": 1
121
+ },
122
+ "type": {
123
+ "type": "string",
124
+ "minLength": 1
125
+ },
126
+ "field": {
127
+ "type": "string",
128
+ "minLength": 1
129
+ },
130
+ "fieldOn": {
131
+ "enum": ["child", "parent"]
132
+ },
133
+ "multiple": {
134
+ "type": "boolean"
135
+ },
136
+ "templateFormat": {
137
+ "enum": ["heading", "list", "table", "page"]
138
+ },
139
+ "matchers": {
140
+ "type": "array",
141
+ "items": {
142
+ "type": "string",
143
+ "minLength": 1
144
+ },
145
+ "minItems": 1
146
+ },
147
+ "embeddedTemplateFields": {
148
+ "type": "array",
149
+ "items": {
150
+ "type": "string",
151
+ "minLength": 1
152
+ }
153
+ },
154
+ "override": {
155
+ "type": "boolean"
156
+ }
157
+ },
158
+ "required": ["parent", "type"],
159
+ "additionalProperties": false
160
+ }
161
+ },
162
+ "aliases": {
163
+ "type": "object",
164
+ "additionalProperties": {
165
+ "oneOf": [
166
+ {
167
+ "type": "string",
168
+ "minLength": 1
169
+ },
170
+ {
171
+ "type": "object",
172
+ "properties": {
173
+ "type": {
174
+ "type": "string",
175
+ "minLength": 1
176
+ },
177
+ "override": {
178
+ "type": "boolean"
179
+ }
180
+ },
181
+ "required": ["type"],
182
+ "additionalProperties": false
183
+ }
184
+ ]
185
+ }
186
+ },
187
+ "rules": {
188
+ "type": "array",
189
+ "items": {
190
+ "type": "object",
191
+ "properties": {
192
+ "id": {
193
+ "type": "string",
194
+ "minLength": 1
195
+ },
196
+ "category": {
197
+ "enum": ["validation", "coherence", "workflow", "best-practice"]
198
+ },
199
+ "severity": {
200
+ "enum": ["error", "warning", "info"]
201
+ },
202
+ "description": {
203
+ "type": "string",
204
+ "minLength": 1
205
+ },
206
+ "check": {
207
+ "type": "string",
208
+ "minLength": 1
209
+ },
210
+ "type": {
211
+ "type": "string",
212
+ "minLength": 1
213
+ },
214
+ "scope": {
215
+ "enum": ["global"]
216
+ },
217
+ "override": {
218
+ "type": "boolean"
219
+ }
220
+ },
221
+ "required": ["id", "category", "description", "check"],
222
+ "additionalProperties": false
223
+ }
224
+ }
225
+ },
226
+ "additionalProperties": false
227
+ }
228
+ }
229
+ }