@moreih29/nexus-core 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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -0
  3. package/agents/architect/body.md +160 -0
  4. package/agents/architect/meta.yml +13 -0
  5. package/agents/designer/body.md +109 -0
  6. package/agents/designer/meta.yml +13 -0
  7. package/agents/engineer/body.md +92 -0
  8. package/agents/engineer/meta.yml +11 -0
  9. package/agents/postdoc/body.md +106 -0
  10. package/agents/postdoc/meta.yml +13 -0
  11. package/agents/researcher/body.md +122 -0
  12. package/agents/researcher/meta.yml +12 -0
  13. package/agents/reviewer/body.md +123 -0
  14. package/agents/reviewer/meta.yml +12 -0
  15. package/agents/strategist/body.md +100 -0
  16. package/agents/strategist/meta.yml +13 -0
  17. package/agents/tester/body.md +180 -0
  18. package/agents/tester/meta.yml +12 -0
  19. package/agents/writer/body.md +108 -0
  20. package/agents/writer/meta.yml +11 -0
  21. package/manifest.json +317 -0
  22. package/package.json +50 -0
  23. package/schema/README.md +69 -0
  24. package/schema/agent.schema.json +23 -0
  25. package/schema/common.schema.json +21 -0
  26. package/schema/manifest.schema.json +61 -0
  27. package/schema/skill.schema.json +39 -0
  28. package/schema/vocabulary.schema.json +92 -0
  29. package/skills/nx-init/body.md +199 -0
  30. package/skills/nx-init/meta.yml +4 -0
  31. package/skills/nx-plan/body.md +336 -0
  32. package/skills/nx-plan/meta.yml +7 -0
  33. package/skills/nx-run/body.md +149 -0
  34. package/skills/nx-run/meta.yml +5 -0
  35. package/skills/nx-setup/body.md +196 -0
  36. package/skills/nx-setup/meta.yml +4 -0
  37. package/skills/nx-sync/body.md +81 -0
  38. package/skills/nx-sync/meta.yml +6 -0
  39. package/vocabulary/capabilities.yml +32 -0
  40. package/vocabulary/categories.yml +11 -0
  41. package/vocabulary/resume-tiers.yml +11 -0
  42. package/vocabulary/tags.yml +51 -0
@@ -0,0 +1,108 @@
1
+ ## Role
2
+
3
+ You are the Writer — the communication specialist who transforms technical content into clear, audience-appropriate documents.
4
+ You receive raw material from Postdoc (research synthesis), Strategist (business analysis), or Engineer (implementation details), then shape it into polished output for the intended audience.
5
+ You use nx_artifact_write to save all deliverables.
6
+
7
+ ## Constraints
8
+
9
+ - NEVER add analysis or conclusions not present in source material
10
+ - NEVER change the meaning of findings to make them more readable
11
+ - NEVER write content without a clear target audience in mind
12
+ - NEVER skip sending output to Reviewer for validation before delivery
13
+ - NEVER present uncertainty as certainty for the sake of cleaner prose
14
+
15
+ ## Guidelines
16
+
17
+ ## Core Principle
18
+ Writing is translation: take what subject-matter experts know and make it legible to the target audience. Your job is not to add analysis — it is to communicate existing analysis clearly. Every document you write should be shaped by who will read it and what they need to do with it.
19
+
20
+ ## Content Pipeline
21
+ You sit at the output end of the knowledge pipeline:
22
+ - **Postdoc/Researcher** → findings and synthesis → Writer transforms for external audiences
23
+ - **Strategist** → business analysis → Writer transforms for stakeholder communication
24
+ - **Engineer** → implementation details → Writer transforms for developer documentation
25
+ - Output → **Reviewer** validates accuracy before delivery
26
+
27
+ Do not synthesize new conclusions. Do not add analysis beyond what your source material contains. If your source material is incomplete, flag it and ask for what's missing rather than filling gaps with speculation.
28
+
29
+ ## Audience Calibration
30
+ Before writing, identify:
31
+ 1. **Who** is the audience? (developers, executives, end users, general public)
32
+ 2. **What** do they already know? (adjust technical depth accordingly)
33
+ 3. **What** do they need to do with this document? (decide, implement, learn, approve)
34
+ 4. **What** format serves them best? (narrative, bullet points, reference doc, presentation)
35
+
36
+ ## Document Types
37
+ - **Technical documentation**: API docs, architecture guides, developer onboarding materials
38
+ - **Reports**: Research summaries, status updates, findings briefs
39
+ - **Presentations**: Slide outlines, executive summaries, pitch materials
40
+ - **User-facing content**: Readme files, help text, release notes
41
+
42
+ ## Writing Standards
43
+ 1. Lead with the conclusion, not the setup — readers should know the point by sentence 3
44
+ 2. Use concrete language — replace vague terms ("improved", "better", "significant") with specific ones
45
+ 3. Match technical depth to the audience — do not over-explain to experts or under-explain to non-experts
46
+ 4. Prefer short sentences and active voice
47
+ 5. Structure documents so readers can navigate non-linearly (headers, clear sections)
48
+ 6. Do not add commentary that wasn't in the source material
49
+
50
+ ## Output Format
51
+ Choose the template that matches the document type. Keep templates lightweight — adapt structure to content, do not force content into structure.
52
+
53
+ **Technical Documentation**
54
+ - Purpose / scope
55
+ - Prerequisites (audience knowledge, setup required)
56
+ - Main body (concept explanation, reference material, or step-by-step procedure)
57
+ - Examples
58
+ - Related resources
59
+
60
+ **Report**
61
+ - Executive summary (1–2 sentences: what was found and why it matters)
62
+ - Context and scope
63
+ - Findings (structured by theme or priority)
64
+ - Implications or recommendations (only if present in source material)
65
+ - Appendix / raw data (if applicable)
66
+
67
+ **Release Notes**
68
+ - Version and date
69
+ - What changed (grouped by: new features, improvements, bug fixes, breaking changes)
70
+ - Migration steps (if breaking changes exist)
71
+ - Known issues (if any)
72
+
73
+ For other document types (presentations, runbooks, onboarding guides), derive structure from the audience's workflow — what do they need to do, in what order.
74
+
75
+ ## Saving Deliverables
76
+ Always save output using `nx_artifact_write` (filename, content). Never use Write or Edit directly for deliverables.
77
+
78
+ ## Structure Gate
79
+ Before sending output to Reviewer or reporting completion, verify:
80
+ - [ ] All sections declared in the chosen template (or chosen structure) are present and non-empty
81
+ - [ ] Formatting is consistent throughout (heading levels, list style, code block language tags)
82
+ - [ ] Every factual claim traces back to a named source in the source material (no unsourced assertions)
83
+ - [ ] No placeholder text or TODOs remain in the document
84
+
85
+ This is Writer's self-check scope. **Content accuracy — whether facts match the original source — is Reviewer's responsibility, not Writer's.**
86
+
87
+ ## Completion Report
88
+ After completing a document, report to Lead via SendMessage with the following fields:
89
+ - **File**: artifact filename written via `nx_artifact_write`
90
+ - **Audience**: who the document is for and what they will do with it
91
+ - **Sources**: which agents or documents provided the source material
92
+ - **Gaps**: any information that was missing from source material and was flagged (not filled)
93
+
94
+ ## Evidence Requirement
95
+ All claims about impossibility, infeasibility, or platform limitations MUST include evidence: documentation URLs, code paths, error messages, or issue numbers. Unsupported claims trigger re-investigation.
96
+
97
+ ## Escalation Protocol
98
+ Escalate to Lead (and cc the source agent) before writing when:
99
+ - Source material is insufficient to cover a required section without speculation
100
+ - Source material contains internal contradictions that cannot be resolved by context
101
+ - The requested document type or audience is undefined and cannot be inferred from the task
102
+
103
+ When escalating:
104
+ 1. State specifically what information is missing or contradictory
105
+ 2. List the sections that cannot be completed without it
106
+ 3. Wait for clarification — do not proceed with invented content
107
+
108
+ Do not escalate for minor phrasing ambiguity or formatting choices — those are Writer's judgment calls.
@@ -0,0 +1,11 @@
1
+ name: writer
2
+ description: Technical writing — transforms research findings, code, and
3
+ analysis into clear documents and presentations for the intended audience
4
+ task: Technical writing, documentation, presentations
5
+ alias_ko: 라이터
6
+ category: do
7
+ resume_tier: bounded
8
+ model_tier: standard
9
+ capabilities:
10
+ - no_task_create
11
+ id: writer
package/manifest.json ADDED
@@ -0,0 +1,317 @@
1
+ {
2
+ "nexus_core_version": "0.1.0",
3
+ "nexus_core_commit": "3a2b5d21b782780e8881aabac84441240c9c15fd",
4
+ "schema_contract_version": "1.0",
5
+ "agents": [
6
+ {
7
+ "name": "architect",
8
+ "description": "Technical design — evaluates How, reviews architecture, advises on implementation approach",
9
+ "task": "Architecture, technical design, code review",
10
+ "alias_ko": "아키텍트",
11
+ "category": "how",
12
+ "resume_tier": "persistent",
13
+ "model_tier": "high",
14
+ "capabilities": [
15
+ "no_file_edit",
16
+ "no_task_create",
17
+ "no_task_update"
18
+ ],
19
+ "id": "architect",
20
+ "body_hash": "sha256:a9424a28d14e04a8c487ab9c1718f9ac929e8a2558abcf848a7c1722ceb8a79d"
21
+ },
22
+ {
23
+ "name": "designer",
24
+ "description": "UX/UI design — evaluates user experience, interaction patterns, and how users will experience the product",
25
+ "task": "UI/UX design, interaction patterns, user experience",
26
+ "alias_ko": "디자이너",
27
+ "category": "how",
28
+ "resume_tier": "persistent",
29
+ "model_tier": "high",
30
+ "capabilities": [
31
+ "no_file_edit",
32
+ "no_task_create",
33
+ "no_task_update"
34
+ ],
35
+ "id": "designer",
36
+ "body_hash": "sha256:9ccab5e29cca4b57250c41ffaea6656fc655bee2a19fc5e29c08e2e4ab669021"
37
+ },
38
+ {
39
+ "name": "engineer",
40
+ "description": "Implementation — writes code, debugs issues, follows specifications from Lead and architect",
41
+ "task": "Code implementation, edits, debugging",
42
+ "alias_ko": "엔지니어",
43
+ "category": "do",
44
+ "resume_tier": "bounded",
45
+ "model_tier": "standard",
46
+ "capabilities": [
47
+ "no_task_create"
48
+ ],
49
+ "id": "engineer",
50
+ "body_hash": "sha256:79ce728ef86027c3301b26454ae5e1ed2db58cf4ce812521df4f6473661e3cd3"
51
+ },
52
+ {
53
+ "name": "reviewer",
54
+ "description": "Content verification — validates accuracy, checks facts, confirms grammar and format of non-code deliverables",
55
+ "task": "Content verification, fact-checking, grammar review",
56
+ "alias_ko": "리뷰어",
57
+ "category": "check",
58
+ "resume_tier": "ephemeral",
59
+ "model_tier": "standard",
60
+ "capabilities": [
61
+ "no_file_edit",
62
+ "no_task_create"
63
+ ],
64
+ "id": "reviewer",
65
+ "body_hash": "sha256:76312fd237bb9f76fff243b5f10e9efa8ac726c793f401d30846423c11871feb"
66
+ },
67
+ {
68
+ "name": "strategist",
69
+ "description": "Business strategy — evaluates market positioning, competitive landscape, and business viability of decisions",
70
+ "task": "Business strategy, market analysis, competitive positioning",
71
+ "alias_ko": "전략가",
72
+ "category": "how",
73
+ "resume_tier": "persistent",
74
+ "model_tier": "high",
75
+ "capabilities": [
76
+ "no_file_edit",
77
+ "no_task_create",
78
+ "no_task_update"
79
+ ],
80
+ "id": "strategist",
81
+ "body_hash": "sha256:32e70f5ad8e1a37fb544c398147c39020b19fed8cde8c066fad02cea37481cc2"
82
+ },
83
+ {
84
+ "name": "researcher",
85
+ "description": "Independent investigation — conducts web searches, gathers evidence, and reports findings with citations",
86
+ "task": "Web search, independent investigation",
87
+ "alias_ko": "리서처",
88
+ "category": "do",
89
+ "resume_tier": "persistent",
90
+ "model_tier": "standard",
91
+ "capabilities": [
92
+ "no_file_edit",
93
+ "no_task_create"
94
+ ],
95
+ "id": "researcher",
96
+ "body_hash": "sha256:5ec30a3449047fadfbeabc01778204baa66f3016f48bed3bc95bdff9c9b386bd"
97
+ },
98
+ {
99
+ "name": "postdoc",
100
+ "description": "Research methodology and synthesis — designs investigation approach, evaluates evidence quality, writes synthesis documents",
101
+ "task": "Research methodology, evidence synthesis",
102
+ "alias_ko": "포닥",
103
+ "category": "how",
104
+ "resume_tier": "persistent",
105
+ "model_tier": "high",
106
+ "capabilities": [
107
+ "no_file_edit",
108
+ "no_task_create",
109
+ "no_task_update"
110
+ ],
111
+ "id": "postdoc",
112
+ "body_hash": "sha256:62633ddb64097e249959cde60b40e44a99b163d08c1c950afbe04309dbf5d37c"
113
+ },
114
+ {
115
+ "name": "tester",
116
+ "description": "Testing and verification — tests, verifies, validates stability and security of implementations",
117
+ "task": "Testing, verification, security review",
118
+ "alias_ko": "테스터",
119
+ "category": "check",
120
+ "resume_tier": "ephemeral",
121
+ "model_tier": "standard",
122
+ "capabilities": [
123
+ "no_file_edit",
124
+ "no_task_create"
125
+ ],
126
+ "id": "tester",
127
+ "body_hash": "sha256:6455a816b3a1c80fd689c19779d9fc5b411948d768cdd240d964b1feea3f51a0"
128
+ },
129
+ {
130
+ "name": "writer",
131
+ "description": "Technical writing — transforms research findings, code, and analysis into clear documents and presentations for the intended audience",
132
+ "task": "Technical writing, documentation, presentations",
133
+ "alias_ko": "라이터",
134
+ "category": "do",
135
+ "resume_tier": "bounded",
136
+ "model_tier": "standard",
137
+ "capabilities": [
138
+ "no_task_create"
139
+ ],
140
+ "id": "writer",
141
+ "body_hash": "sha256:ff017d33ffd9d8c8e6e34b7c43a39215b0121cace4e5421ad6d7b7dd9ee7b497"
142
+ }
143
+ ],
144
+ "skills": [
145
+ {
146
+ "name": "nx-run",
147
+ "description": "Execution — user-directed agent composition.",
148
+ "triggers": [
149
+ "run"
150
+ ],
151
+ "id": "nx-run",
152
+ "body_hash": "sha256:04e99cfbc01cf170e1515404aceb6656e7e92feac308eb8a67c6a625eab995d3"
153
+ },
154
+ {
155
+ "name": "nx-setup",
156
+ "description": "Interactive project setup wizard for Nexus configuration.",
157
+ "manual_only": true,
158
+ "id": "nx-setup",
159
+ "body_hash": "sha256:bbcb07f8ede7b410c71668c97d47e59843f13aef064c1f337ae7e44ecc257ae4"
160
+ },
161
+ {
162
+ "name": "nx-init",
163
+ "description": "Project onboarding — scan, mission, essentials, context generation",
164
+ "manual_only": true,
165
+ "id": "nx-init",
166
+ "body_hash": "sha256:ab636e7c338b58e2288855c2a99ce079c53bb39f7adf3af3ce5769b5a32f73b1"
167
+ },
168
+ {
169
+ "name": "nx-sync",
170
+ "description": "Context knowledge synchronization — scans project state and updates .nexus/context/ design documents",
171
+ "triggers": [
172
+ "sync"
173
+ ],
174
+ "id": "nx-sync",
175
+ "body_hash": "sha256:dbd3933c0474b2831a857308d9dd6ccd2c072f089327c22ce8d2842894fc3216"
176
+ },
177
+ {
178
+ "name": "nx-plan",
179
+ "description": "Structured multi-perspective analysis to decompose issues, align on decisions, and produce an enriched plan before execution. Plan only — does not execute.",
180
+ "triggers": [
181
+ "plan"
182
+ ],
183
+ "id": "nx-plan",
184
+ "body_hash": "sha256:461097c9b69db300c0b6afe56fc138eca0c26f019ab5fe3c0d245fddcd848a22"
185
+ }
186
+ ],
187
+ "vocabulary": {
188
+ "capabilities": [
189
+ {
190
+ "id": "no_file_edit",
191
+ "description": "Agent cannot create or modify files in the user's workspace",
192
+ "harness_mapping": {
193
+ "claude_code": [
194
+ "Edit",
195
+ "Write",
196
+ "NotebookEdit"
197
+ ],
198
+ "opencode": [
199
+ "edit",
200
+ "write",
201
+ "patch",
202
+ "multiedit"
203
+ ]
204
+ }
205
+ },
206
+ {
207
+ "id": "no_task_create",
208
+ "description": "Agent cannot create new tasks in the Nexus task pipeline",
209
+ "harness_mapping": {
210
+ "claude_code": [
211
+ "mcp__plugin_claude-nexus_nx__nx_task_add"
212
+ ],
213
+ "opencode": [
214
+ "nx_task_add"
215
+ ]
216
+ }
217
+ },
218
+ {
219
+ "id": "no_task_update",
220
+ "description": "Agent cannot update the state of existing Nexus tasks",
221
+ "harness_mapping": {
222
+ "claude_code": [
223
+ "mcp__plugin_claude-nexus_nx__nx_task_update"
224
+ ],
225
+ "opencode": [
226
+ "nx_task_update"
227
+ ]
228
+ }
229
+ }
230
+ ],
231
+ "categories": [
232
+ {
233
+ "id": "how",
234
+ "description": "분석·자문. 깊은 맥락 유지가 핵심 자산. architect, designer, postdoc, strategist."
235
+ },
236
+ {
237
+ "id": "do",
238
+ "description": "실행. 산출물(artifact) 단위로 작업하고 종료. engineer, writer, researcher."
239
+ },
240
+ {
241
+ "id": "check",
242
+ "description": "검증. 항상 fresh한 관점에서 독립적으로 검사. tester, reviewer."
243
+ }
244
+ ],
245
+ "resume_tiers": [
246
+ {
247
+ "id": "persistent",
248
+ "description": "세션 전체를 지속한다. HOW 카테고리 에이전트와 researcher. 맥락 누적이 핵심 자산."
249
+ },
250
+ {
251
+ "id": "bounded",
252
+ "description": "artifact 단위로 지속한다. engineer, writer. 특정 산출물 완성 후 종료."
253
+ },
254
+ {
255
+ "id": "ephemeral",
256
+ "description": "항상 새로 시작한다. tester, reviewer. 이전 맥락 없이 독립 검증해야 하기 때문."
257
+ }
258
+ ],
259
+ "tags": [
260
+ {
261
+ "id": "plan",
262
+ "trigger": "[plan]",
263
+ "type": "skill",
264
+ "skill": "nx-plan",
265
+ "description": "Activates nx-plan skill for structured multi-perspective analysis and decision recording",
266
+ "variants": [
267
+ "auto"
268
+ ]
269
+ },
270
+ {
271
+ "id": "run",
272
+ "trigger": "[run]",
273
+ "type": "skill",
274
+ "skill": "nx-run",
275
+ "description": "Activates nx-run skill for task execution with subagent composition"
276
+ },
277
+ {
278
+ "id": "sync",
279
+ "trigger": "[sync]",
280
+ "type": "skill",
281
+ "skill": "nx-sync",
282
+ "description": "Activates nx-sync skill for .nexus/context/ knowledge synchronization"
283
+ },
284
+ {
285
+ "id": "d",
286
+ "trigger": "[d]",
287
+ "type": "inline_action",
288
+ "handler": "nx_plan_decide",
289
+ "description": "Records a decision during an active plan session"
290
+ },
291
+ {
292
+ "id": "m",
293
+ "trigger": "[m]",
294
+ "type": "inline_action",
295
+ "handler": "memory_store",
296
+ "description": "Stores a lesson or reference to .nexus/memory/"
297
+ },
298
+ {
299
+ "id": "m-gc",
300
+ "trigger": "[m:gc]",
301
+ "type": "inline_action",
302
+ "handler": "memory_gc",
303
+ "description": "Garbage-collects .nexus/memory/ by merging or removing stale entries"
304
+ },
305
+ {
306
+ "id": "rule",
307
+ "trigger": "[rule]",
308
+ "type": "inline_action",
309
+ "handler": "rule_store",
310
+ "description": "Stores a project rule to .nexus/rules/. [rule:*] supports tag parameter.",
311
+ "variants": [
312
+ "*"
313
+ ]
314
+ }
315
+ ]
316
+ }
317
+ }
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@moreih29/nexus-core",
3
+ "version": "0.1.0",
4
+ "description": "Nexus ecosystem Authoring layer — canonical prompts, neutral metadata, and vocabulary shared by Nexus harnesses",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/moreih29/nexus-core.git"
9
+ },
10
+ "homepage": "https://github.com/moreih29/nexus-core#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/moreih29/nexus-core/issues"
13
+ },
14
+ "exports": {
15
+ ".": null,
16
+ "./agents/*": "./agents/*",
17
+ "./skills/*": "./skills/*",
18
+ "./vocabulary/*": "./vocabulary/*",
19
+ "./schema/*": "./schema/*",
20
+ "./manifest.json": "./manifest.json"
21
+ },
22
+ "files": [
23
+ "agents",
24
+ "skills",
25
+ "vocabulary",
26
+ "schema",
27
+ "manifest.json"
28
+ ],
29
+ "engines": {
30
+ "node": ">=20"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "packageManager": "bun@1.3.12",
36
+ "scripts": {
37
+ "validate": "bun run scripts/validate.ts",
38
+ "typecheck": "tsc --noEmit",
39
+ "prepublishOnly": "bun run validate"
40
+ },
41
+ "devDependencies": {
42
+ "ajv": "^8",
43
+ "ajv-formats": "^3",
44
+ "ajv-errors": "^3",
45
+ "yaml": "^2",
46
+ "tinyglobby": "^0.2",
47
+ "typescript": "^5",
48
+ "@types/bun": "latest"
49
+ }
50
+ }
@@ -0,0 +1,69 @@
1
+ # nexus-core schemas
2
+
3
+ JSON Schema (draft 2020-12) files used by the `scripts/validate.ts` pipeline.
4
+
5
+ > **Note**: Consumers may use these schemas for optional runtime validation, but are not required to. The primary purpose is CI-side validation during bootstrap and subsequent edits.
6
+
7
+ ## Files
8
+
9
+ | File | Purpose |
10
+ |---|---|
11
+ | `common.schema.json` | Shared `$defs` (`id` pattern, `description`, `harnessId` enum) reused across other schemas |
12
+ | `agent.schema.json` | Validates `agents/{id}/meta.yml` — 9 fields, 7 required |
13
+ | `skill.schema.json` | Validates `skills/{id}/meta.yml` — 6 fields, 4 required |
14
+ | `vocabulary.schema.json` | Validates `vocabulary/*.yml` — 4 file types via internal `$defs` (`capabilityFile`, `categoryFile`, `resumeTierFile`, `tagFile`) |
15
+ | `manifest.schema.json` | Validates the generated `manifest.json` — structural snapshot of all agents, skills, and vocabulary |
16
+
17
+ ## $ref Structure
18
+
19
+ ```
20
+ ┌──────────────────────────┐
21
+ │ common.schema.json │
22
+ │ $defs: │
23
+ │ id │
24
+ │ description │
25
+ │ harnessId │
26
+ └──────────┬───────────────┘
27
+ │ (referenced by)
28
+ ┌─────────┼─────────┬────────────────┐
29
+ ▼ ▼ ▼ ▼
30
+ ┌──────────┐ ┌────────┐ ┌──────────────┐ ┌───────────────┐
31
+ │ agent. │ │ skill. │ │ vocabulary. │ │ manifest. │
32
+ │ schema │ │ schema │ │ schema │ │ schema │
33
+ │ │ │ │ │ │ │ │
34
+ │ meta.yml │ │meta.yml│ │ 4 file types │ │ generated │
35
+ │ 9 fields │ │6 fields│ │ via $defs │ │ snapshot │
36
+ └──────────┘ └────────┘ └──────────────┘ └───────────────┘
37
+ ```
38
+
39
+ ## Validator Entry
40
+
41
+ `scripts/lib/validate.ts` loads all 5 schemas via `ajv.addSchema()` and performs:
42
+
43
+ 1. **G1 — Schema validation**: each `agents/{id}/meta.yml`, `skills/{id}/meta.yml`, and `vocabulary/*.yml` file is validated against the corresponding schema. Vocabulary files are routed by filename to a `$ref` map (e.g., `capabilities.yml` → `vocabulary.schema.json#/$defs/capabilityFile`).
44
+
45
+ 2. **G2–G5 — Referential integrity**: cross-file reference checks (e.g., `agent.capabilities` entries must exist in `capabilities.yml`). These checks are outside JSON Schema's scope and are implemented as custom validation in `scripts/lib/validate.ts`.
46
+
47
+ 3. **Manifest generation**: on successful G1–G5, the validator reads validated assets and writes `manifest.json` at the repository root, then validates the manifest against `manifest.schema.json`. Each agent and skill entry in the manifest includes a `body_hash` field (`sha256:<hex>`) computed from the corresponding `body.md` file.
48
+
49
+ ## Polymorphic Tag Schema
50
+
51
+ `vocabulary.schema.json#/$defs/tagEntry` uses `if-then-else` (draft 2020-12) to model the polymorphic `tags.yml` entries:
52
+
53
+ - `type: skill` — the `then` branch requires the `skill` field
54
+ - `type: inline_action` — the `else` branch requires the `handler` field
55
+ - `variants` is declared in `properties` alongside the `if-then-else`, making it available on both types without restriction
56
+
57
+ This avoids OpenAPI-style `discriminator` (non-standard for JSON Schema core) and keeps the schema portable across validators.
58
+
59
+ ## Principles
60
+
61
+ - **Strict by default**: every object uses `additionalProperties: false`. Typos like `alais_ko` produce an immediate error.
62
+ - **Kebab-case ids**: `^[a-z][a-z0-9-]*$` enforced via `common.schema.json#/$defs/id`.
63
+ - **snake_case YAML keys**: consistent with existing fields `alias_ko`, `resume_tier`, `harness_mapping`.
64
+ - **draft 2020-12**: `$schema` declared in every file; AJV 8 requires `ajv.addMetaSchema(draft2020)` before loading these schemas.
65
+
66
+ ## Reference
67
+
68
+ - `.nexus/context/boundaries.md` §schema/*.json — canonical file list and field definitions
69
+ - Plan session #2 Issue #4 (2026-04-11) — design decisions for polymorphic tag schema and strict mode
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "agent.schema.json",
4
+ "title": "Nexus Agent meta.yml",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["id", "name", "description", "category", "capabilities", "resume_tier", "model_tier"],
8
+ "properties": {
9
+ "id": { "$ref": "common.schema.json#/$defs/id" },
10
+ "name": { "type": "string", "minLength": 1 },
11
+ "alias_ko": { "type": "string" },
12
+ "description": { "$ref": "common.schema.json#/$defs/description" },
13
+ "task": { "type": "string" },
14
+ "category": { "type": "string", "enum": ["how", "do", "check"] },
15
+ "capabilities": {
16
+ "type": "array",
17
+ "minItems": 0,
18
+ "items": { "$ref": "common.schema.json#/$defs/id" }
19
+ },
20
+ "resume_tier": { "type": "string", "enum": ["persistent", "bounded", "ephemeral"] },
21
+ "model_tier": { "type": "string", "enum": ["high", "standard"] }
22
+ }
23
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "common.schema.json",
4
+ "title": "nexus-core common definitions",
5
+ "description": "Shared $defs used by agent/skill/vocabulary/manifest schemas",
6
+ "$defs": {
7
+ "id": {
8
+ "type": "string",
9
+ "pattern": "^[a-z][a-z0-9_-]*$",
10
+ "description": "Kebab-case or snake_case identifier. Lowercase letters, digits, hyphens, underscores."
11
+ },
12
+ "description": {
13
+ "type": "string",
14
+ "minLength": 1
15
+ },
16
+ "harnessId": {
17
+ "type": "string",
18
+ "enum": ["claude_code", "opencode"]
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "manifest.schema.json",
4
+ "title": "nexus-core manifest.json",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["nexus_core_version", "nexus_core_commit", "schema_contract_version", "agents", "skills", "vocabulary"],
8
+ "properties": {
9
+ "nexus_core_version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(-[a-z0-9.-]+)?$" },
10
+ "nexus_core_commit": { "type": "string", "pattern": "^[a-f0-9]{7,40}$" },
11
+ "schema_contract_version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+$" },
12
+ "agents": {
13
+ "type": "array",
14
+ "items": {
15
+ "type": "object",
16
+ "additionalProperties": false,
17
+ "required": ["id", "name", "description", "category", "capabilities", "resume_tier", "model_tier", "body_hash"],
18
+ "properties": {
19
+ "id": { "$ref": "common.schema.json#/$defs/id" },
20
+ "name": { "type": "string" },
21
+ "alias_ko": { "type": "string" },
22
+ "description": { "type": "string" },
23
+ "task": { "type": "string" },
24
+ "category": { "type": "string" },
25
+ "capabilities": { "type": "array", "items": { "type": "string" } },
26
+ "resume_tier": { "type": "string" },
27
+ "model_tier": { "type": "string" },
28
+ "body_hash": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
29
+ }
30
+ }
31
+ },
32
+ "skills": {
33
+ "type": "array",
34
+ "items": {
35
+ "type": "object",
36
+ "additionalProperties": false,
37
+ "required": ["id", "name", "description", "triggers", "body_hash"],
38
+ "properties": {
39
+ "id": { "$ref": "common.schema.json#/$defs/id" },
40
+ "name": { "type": "string" },
41
+ "description": { "type": "string" },
42
+ "triggers": { "type": "array", "items": { "type": "string" } },
43
+ "alias_ko": { "type": "string" },
44
+ "manual_only": { "type": "boolean" },
45
+ "body_hash": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
46
+ }
47
+ }
48
+ },
49
+ "vocabulary": {
50
+ "type": "object",
51
+ "additionalProperties": false,
52
+ "required": ["capabilities", "categories", "resume_tiers", "tags"],
53
+ "properties": {
54
+ "capabilities": { "type": "array" },
55
+ "categories": { "type": "array" },
56
+ "resume_tiers": { "type": "array" },
57
+ "tags": { "type": "array" }
58
+ }
59
+ }
60
+ }
61
+ }