structured-context 0.9.1 → 0.9.3

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.
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/_structured_context_schema_meta.json",
3
- "$id": "sctx://general",
4
- "title": "Strategy and opportunity ladder",
5
- "description": "Validates frontmatter for space node files",
3
+ "$id": "sctx://_strategy_general",
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.
6
7
  "$metadata": {
7
8
  "hierarchy": {
8
9
  "levels": [
@@ -41,8 +42,8 @@
41
42
  }
42
43
  ]
43
44
  },
44
- "oneOf": [
45
- {
45
+ "$defs": {
46
+ "dashboard": {
46
47
  "type": "object",
47
48
  "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
48
49
  "properties": {
@@ -51,7 +52,7 @@
51
52
  "required": ["type"],
52
53
  "additionalProperties": true
53
54
  },
54
- {
55
+ "ost_on_a_page": {
55
56
  "type": "object",
56
57
  "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
57
58
  "properties": {
@@ -60,7 +61,7 @@
60
61
  "required": ["type"],
61
62
  "additionalProperties": true
62
63
  },
63
- {
64
+ "vision": {
64
65
  "type": "object",
65
66
  "allOf": [
66
67
  { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
@@ -79,7 +80,7 @@
79
80
  }
80
81
  ]
81
82
  },
82
- {
83
+ "mission": {
83
84
  "type": "object",
84
85
  "allOf": [
85
86
  { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
@@ -99,7 +100,7 @@
99
100
  }
100
101
  ]
101
102
  },
102
- {
103
+ "goal": {
103
104
  "type": "object",
104
105
  "allOf": [
105
106
  { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
@@ -121,7 +122,7 @@
121
122
  }
122
123
  ]
123
124
  },
124
- {
125
+ "opportunity": {
125
126
  "type": "object",
126
127
  "allOf": [
127
128
  { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
@@ -154,7 +155,7 @@
154
155
  }
155
156
  ]
156
157
  },
157
- {
158
+ "solution": {
158
159
  "type": "object",
159
160
  "allOf": [
160
161
  { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
@@ -187,7 +188,7 @@
187
188
  }
188
189
  ]
189
190
  },
190
- {
191
+ "experiment": {
191
192
  "type": "object",
192
193
  "allOf": [
193
194
  { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
@@ -212,7 +213,7 @@
212
213
  }
213
214
  ]
214
215
  },
215
- {
216
+ "assumption": {
216
217
  "type": "object",
217
218
  "allOf": [
218
219
  { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
@@ -238,7 +239,7 @@
238
239
  }
239
240
  ]
240
241
  },
241
- {
242
+ "problem_statement": {
242
243
  "type": "object",
243
244
  "allOf": [
244
245
  { "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
@@ -257,5 +258,5 @@
257
258
  }
258
259
  ]
259
260
  }
260
- ]
261
+ }
261
262
  }
@@ -3,243 +3,13 @@
3
3
  "$id": "sctx://knowledge_wiki",
4
4
  "title": "Knowledge Wiki",
5
5
  "description": "Lightweight schema for LLM-maintained knowledge wikis. Supports source pages, concept pages, syntheses, and notes. Designed for compounding knowledge bases where the LLM creates and maintains wiki pages from raw sources.\n\nFlat entity model — no hierarchy, no required parent links. Wikilinks between any pages are valid for arbitrary cross-referencing. The schema validates structure and provenance; it does not constrain meaning.\n\nBased on the pattern described in Karpathy's LLM Wiki (2026).",
6
- "$metadata": {
7
- "aliases": {
8
- "source_summary": "source",
9
- "study": "source",
10
- "article": "source",
11
- "paper": "source",
12
- "research": "source",
13
- "comparison": "synthesis",
14
- "query": "synthesis"
15
- },
16
- "relationships": [
17
- {
18
- "parent": "source",
19
- "type": "source",
20
- "field": "sources",
21
- "fieldOn": "child",
22
- "multiple": true
23
- },
24
- {
25
- "parent": "source",
26
- "type": "synthesis",
27
- "field": "sources",
28
- "fieldOn": "child",
29
- "multiple": true
30
- },
31
- {
32
- "parent": "source",
33
- "type": "entity",
34
- "field": "sources",
35
- "fieldOn": "child",
36
- "multiple": true
37
- },
38
- {
39
- "parent": "concept",
40
- "type": "synthesis",
41
- "field": "concepts",
42
- "fieldOn": "child",
43
- "multiple": true
44
- }
45
- ],
46
- "rules": [
47
- {
48
- "id": "synthesis-references-sources",
49
- "category": "coherence",
50
- "description": "Syntheses should reference at least one contributing source in their sources array",
51
- "type": "synthesis",
52
- "check": "$exists(current.sources) and $count(current.sources) >= 1"
53
- },
54
- {
55
- "id": "concept-has-summary",
56
- "category": "best-practice",
57
- "description": "Concept pages should have a short summary for index discoverability",
58
- "type": "concept",
59
- "check": "$exists(current.summary) and $length(current.summary) > 0"
60
- }
61
- ]
62
- },
6
+ "allOf": [{ "$ref": "sctx://_knowledge_wiki" }],
63
7
  "oneOf": [
64
- {
65
- "type": "object",
66
- "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.",
67
- "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
68
- "properties": {
69
- "type": { "const": "source" },
70
- "summary": {
71
- "$ref": "sctx://_sctx_base#/$defs/summary"
72
- },
73
- "url": {
74
- "type": "string",
75
- "description": "URL of the original source"
76
- },
77
- "local_copy": {
78
- "$ref": "sctx://_sctx_base#/$defs/wikilink",
79
- "description": "Wikilink to a local copy of the source (e.g. a saved PDF or clipped note)"
80
- },
81
- "author": {
82
- "type": "string",
83
- "description": "Author or creator of the source"
84
- },
85
- "book": {
86
- "type": "string",
87
- "description": "Book title and author if the source is a book"
88
- },
89
- "published_date": {
90
- "type": "string",
91
- "format": "date",
92
- "description": "Original publication date"
93
- },
94
- "source_type": {
95
- "type": "string",
96
- "description": "Kind of source material. Free-form — common values include article, paper, book, video, podcast, thread, substack, tweet, website. Not enum-constrained to allow evolving vocabulary."
97
- },
98
- "sources": {
99
- "type": "array",
100
- "items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
101
- "description": "Wikilinks to other source pages that this one references or extends"
102
- }
103
- },
104
- "required": ["type", "url"],
105
- "additionalProperties": true,
106
- "examples": [
107
- {
108
- "type": "source",
109
- "author": "Joe Bloggs",
110
- "url": "https://example.com/design-of-yesterday-things",
111
- "source_type": "book",
112
- "tags": ["design", "ux", "psychology"]
113
- }
114
- ]
115
- },
116
- {
117
- "type": "object",
118
- "description": "A concept or entity 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.",
119
- "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
120
- "properties": {
121
- "type": { "const": "concept" },
122
- "summary": {
123
- "$ref": "sctx://_sctx_base#/$defs/summary"
124
- },
125
- "sources": {
126
- "type": "array",
127
- "items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
128
- "description": "Wikilinks to source pages that contributed to this concept"
129
- },
130
- "related": {
131
- "type": "array",
132
- "items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
133
- "description": "Wikilinks to related concept or synthesis pages"
134
- }
135
- },
136
- "required": ["type"],
137
- "additionalProperties": true,
138
- "examples": [
139
- {
140
- "type": "concept",
141
- "summary": "A property of an object that signals how it can be used, first described by Gibson and popularised in design by Norman",
142
- "tags": ["design", "ux"]
143
- }
144
- ]
145
- },
146
- {
147
- "type": "object",
148
- "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.",
149
- "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
150
- "properties": {
151
- "type": { "const": "entity" },
152
- "summary": {
153
- "$ref": "sctx://_sctx_base#/$defs/summary"
154
- },
155
- "sources": {
156
- "type": "array",
157
- "items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
158
- "description": "Wikilinks to source pages that contributed to this entity page"
159
- },
160
- "related": {
161
- "type": "array",
162
- "items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
163
- "description": "Wikilinks to related entity, concept, or synthesis pages"
164
- }
165
- },
166
- "required": ["type"],
167
- "additionalProperties": true,
168
- "examples": [
169
- {
170
- "type": "entity",
171
- "summary": "AI safety research lab founded by Dario Amodei and Daniela Amodei",
172
- "tags": ["company", "ai", "safety"]
173
- }
174
- ]
175
- },
176
- {
177
- "type": "object",
178
- "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.",
179
- "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
180
- "properties": {
181
- "type": { "const": "synthesis" },
182
- "summary": {
183
- "$ref": "sctx://_sctx_base#/$defs/summary"
184
- },
185
- "sources": {
186
- "type": "array",
187
- "items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
188
- "description": "Wikilinks to source pages this synthesis draws from"
189
- },
190
- "concepts": {
191
- "type": "array",
192
- "items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
193
- "description": "Wikilinks to concept pages this synthesis connects"
194
- }
195
- },
196
- "required": ["type"],
197
- "additionalProperties": true,
198
- "examples": [
199
- {
200
- "type": "synthesis",
201
- "summary": "How Norman's affordance model and feedback principles combine to explain intuitive vs confusing interfaces",
202
- "sources": ["[[The Design of Everyday Things - Don Norman]]"],
203
- "concepts": ["[[Affordance]]", "[[Feedback loop]]"]
204
- }
205
- ]
206
- },
207
- {
208
- "type": "object",
209
- "description": "Personal notes, journal entries, appointments, experiential records. Your own data about your journey — not sourced from external material.",
210
- "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
211
- "properties": {
212
- "type": { "const": "note" },
213
- "date": {
214
- "type": "string",
215
- "format": "date",
216
- "description": "Date this entry was created or relates to"
217
- }
218
- },
219
- "required": ["type"],
220
- "additionalProperties": true,
221
- "examples": [
222
- {
223
- "type": "note",
224
- "date": "2024-03-15",
225
- "tags": ["reading-log"]
226
- }
227
- ]
228
- },
229
- {
230
- "type": "object",
231
- "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.",
232
- "allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
233
- "properties": {
234
- "type": { "const": "index" }
235
- },
236
- "required": ["type"],
237
- "additionalProperties": true,
238
- "examples": [
239
- {
240
- "type": "index"
241
- }
242
- ]
243
- }
8
+ { "$ref": "sctx://_knowledge_wiki#/$defs/source" },
9
+ { "$ref": "sctx://_knowledge_wiki#/$defs/concept" },
10
+ { "$ref": "sctx://_knowledge_wiki#/$defs/entity" },
11
+ { "$ref": "sctx://_knowledge_wiki#/$defs/synthesis" },
12
+ { "$ref": "sctx://_knowledge_wiki#/$defs/note" },
13
+ { "$ref": "sctx://_knowledge_wiki#/$defs/index" }
244
14
  ]
245
15
  }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/_structured_context_schema_meta.json",
3
+ "$id": "sctx://strategy_general",
4
+ "title": "Strategy and opportunity ladder",
5
+ "description": "Validates frontmatter for space node files. Composes strategy_general entities from the bundled partial. Override the hierarchy in $metadata to customize the level structure.",
6
+ "allOf": [{ "$ref": "sctx://_strategy_general" }],
7
+ "oneOf": [
8
+ { "$ref": "sctx://_strategy_general#/$defs/dashboard" },
9
+ { "$ref": "sctx://_strategy_general#/$defs/ost_on_a_page" },
10
+ { "$ref": "sctx://_strategy_general#/$defs/vision" },
11
+ { "$ref": "sctx://_strategy_general#/$defs/mission" },
12
+ { "$ref": "sctx://_strategy_general#/$defs/goal" },
13
+ { "$ref": "sctx://_strategy_general#/$defs/opportunity" },
14
+ { "$ref": "sctx://_strategy_general#/$defs/solution" },
15
+ { "$ref": "sctx://_strategy_general#/$defs/experiment" },
16
+ { "$ref": "sctx://_strategy_general#/$defs/assumption" },
17
+ { "$ref": "sctx://_strategy_general#/$defs/problem_statement" }
18
+ ]
19
+ }
package/dist/types.d.ts CHANGED
@@ -86,6 +86,18 @@ export type SpaceNode = BaseNode & {
86
86
  */
87
87
  resolvedParents: ResolvedParentRef[];
88
88
  };
89
+ export type ParseIssue = {
90
+ /** Source identifier of the file or item (filename or heading title). */
91
+ file: string;
92
+ /** error: prevented the file from producing nodes; warning: file was silently excluded. */
93
+ severity: 'error' | 'warning';
94
+ /** empty: no content; no-type: no type field;
95
+ * parse: parse failure (syntax issue or unexpected content);
96
+ * plugins may choose to provide additional types. */
97
+ type: 'empty' | 'no-type' | 'parse' | string;
98
+ /** Human-readable detail. */
99
+ message?: string;
100
+ };
89
101
  /** Rule categories for organizing executable validation rules */
90
102
  export type RuleCategory = 'validation' | 'coherence' | 'workflow' | 'best-practice';
91
103
  export type { Rule } from './schema/metadata-contract';
@@ -118,8 +130,8 @@ export type SchemaWithMetadata = SchemaObject & {
118
130
  export type ReadSpaceResult = {
119
131
  /** Fully resolved nodes produced by the plugin and enriched by core. */
120
132
  nodes: SpaceNode[];
121
- /** Paths/items the plugin skipped during parsing, for any reason. */
122
- parseIgnored: string[];
133
+ /** Issues encountered while parsing files — excluded files with reason and severity. */
134
+ parseIssues: ParseIssue[];
123
135
  /** Plugin diagnostics: keyed scalar or list values. */
124
136
  diagnostics: Record<string, number | string | string[]>;
125
137
  /** Name of the plugin that produced the nodes. */
package/docs/config.md CHANGED
@@ -20,7 +20,7 @@ A space is a named directory or single file registered in the config. Example:
20
20
  {
21
21
  "name": "ProductX",
22
22
  "path": "/path/to/space",
23
- "schema": "general.json"
23
+ "schema": "strategy_general.json"
24
24
  }
25
25
  ]
26
26
  }
package/docs/schemas.md CHANGED
@@ -20,11 +20,11 @@ Set `schema` in the space config entry:
20
20
  }
21
21
  ```
22
22
 
23
- Resolution order: space `schema` > global `schema` > bundled `schemas/general.json`.
23
+ Resolution order: space `schema` > global `schema`. Schema resolution fails if none is configured.
24
24
 
25
25
  ## Bundled schemas
26
26
 
27
- ### `general.json` (default)
27
+ ### `strategy_general.json`
28
28
 
29
29
  Flexible planning schema spanning strategy + OST-like flow.
30
30
 
@@ -258,8 +258,9 @@ Metadata is composed across the `$ref` graph with deterministic behavior:
258
258
  2. Apply root schema metadata last.
259
259
 
260
260
  Merge rules:
261
- - `hierarchy`: zero or one provider allowed. Multiple providers error.
262
- - `aliases`: shallow merged; later provider wins per key.
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.
263
264
  - `rules`: merged by `id`.
264
265
  - Duplicate rule `id` with different payload errors by default.
265
266
  - A later rule may replace an earlier one only with `"override": true`.
@@ -309,6 +310,8 @@ Imported rules are normalized into one executable flat list before validation.
309
310
  - Local partial `$id` values must not collide with bundled IDs.
310
311
  - `$ref` resolution is transitive across files.
311
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.
312
315
 
313
316
  ## Editor expectations
314
317
 
@@ -328,7 +331,7 @@ For schemas migrating from older metadata structure:
328
331
  3. Move `allowSkipLevels` under `hierarchy`.
329
332
  4. Convert grouped rule containers to flat `rules[]` with per-rule `category`.
330
333
  5. If duplicate rule IDs are intentional, mark later rules with `override: true`.
331
- 6. Re-run `bunx structured-context schemas show --space <name>` and `validate` to confirm merged metadata/rules.
334
+ 6. Re-run `sctx schemas show --space <name>` and `validate` to confirm merged metadata/rules.
332
335
 
333
336
  ## JSON5 support
334
337
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "structured-context",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "Tools for working with Opportunity Solution Tree structures and other product management and strategy frameworks",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",