mdkg 0.3.8 → 0.3.9

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.
@@ -3,6 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DEFAULT_SKILL_MIRROR_TARGETS = void 0;
7
+ exports.defaultCustomizationConfig = defaultCustomizationConfig;
6
8
  exports.validateConfigSchema = validateConfigSchema;
7
9
  exports.loadConfig = loadConfig;
8
10
  const fs_1 = __importDefault(require("fs"));
@@ -30,6 +32,7 @@ const DEFAULT_ARCHIVE_LARGE_CACHE_WARNING_BYTES = 26214400;
30
32
  const DEFAULT_SQLITE_COMMIT_WARNING_BYTES = 52428800;
31
33
  const DEFAULT_LOCK_TIMEOUT_MS = 10000;
32
34
  const DEFAULT_SUBGRAPH_MAX_STALE_SECONDS = 3600;
35
+ exports.DEFAULT_SKILL_MIRROR_TARGETS = [".agents/skills", ".claude/skills"];
33
36
  const DEFAULT_PROJECT_DB_CONFIG = {
34
37
  enabled: false,
35
38
  schema_version: project_db_1.PROJECT_DB_CONFIG_SCHEMA_VERSION,
@@ -41,6 +44,20 @@ const DEFAULT_PROJECT_DB_CONFIG = {
41
44
  receipts_path: project_db_1.PROJECT_DB_RECEIPTS_DIR,
42
45
  migration_table: project_db_1.PROJECT_DB_MIGRATION_TABLE,
43
46
  };
47
+ function defaultCustomizationConfig() {
48
+ return {
49
+ standards: {
50
+ profile: "default",
51
+ refs: [],
52
+ },
53
+ core_docs: {
54
+ custom_paths: [],
55
+ },
56
+ skill_mirrors: {
57
+ targets: [...exports.DEFAULT_SKILL_MIRROR_TARGETS],
58
+ },
59
+ };
60
+ }
44
61
  function isObject(value) {
45
62
  return typeof value === "object" && value !== null && !Array.isArray(value);
46
63
  }
@@ -171,6 +188,35 @@ function requireKnownLowercaseUniqueStringArray(value, path, allowed, errors, al
171
188
  }
172
189
  return items;
173
190
  }
191
+ function requireUniqueStringArray(value, path, errors, allowEmpty = false) {
192
+ const items = requireStringArray(value, path, errors);
193
+ if (items === undefined) {
194
+ return undefined;
195
+ }
196
+ if (items.length === 0) {
197
+ if (!allowEmpty) {
198
+ errors.push(`${path} must not be empty`);
199
+ }
200
+ return items;
201
+ }
202
+ const seen = new Set();
203
+ for (let i = 0; i < items.length; i += 1) {
204
+ const item = items[i];
205
+ if (item.trim().length === 0) {
206
+ errors.push(`${path}[${i}] must not be empty`);
207
+ continue;
208
+ }
209
+ if (item !== item.trim()) {
210
+ errors.push(`${path}[${i}] must not include surrounding whitespace`);
211
+ }
212
+ if (seen.has(item)) {
213
+ errors.push(`${path} must not contain duplicate value "${item}"`);
214
+ continue;
215
+ }
216
+ seen.add(item);
217
+ }
218
+ return items;
219
+ }
174
220
  function requireObject(value, path, errors) {
175
221
  if (!isObject(value)) {
176
222
  errors.push(`${path} must be an object`);
@@ -213,6 +259,33 @@ function requireContainedPath(value, path, errors) {
213
259
  return undefined;
214
260
  }
215
261
  }
262
+ function requireContainedPathArray(value, path, errors, allowEmpty = true) {
263
+ if (!Array.isArray(value)) {
264
+ errors.push(`${path} must be an array of relative paths`);
265
+ return undefined;
266
+ }
267
+ if (value.length === 0) {
268
+ if (!allowEmpty) {
269
+ errors.push(`${path} must not be empty`);
270
+ }
271
+ return [];
272
+ }
273
+ const items = [];
274
+ const seen = new Set();
275
+ for (let i = 0; i < value.length; i += 1) {
276
+ const normalized = requireContainedPath(value[i], `${path}[${i}]`, errors);
277
+ if (!normalized) {
278
+ continue;
279
+ }
280
+ if (seen.has(normalized)) {
281
+ errors.push(`${path} must not contain duplicate path "${normalized}"`);
282
+ continue;
283
+ }
284
+ seen.add(normalized);
285
+ items.push(normalized);
286
+ }
287
+ return items;
288
+ }
216
289
  function requireSqlIdentifier(value, path, errors) {
217
290
  const raw = requireString(value, path, errors);
218
291
  if (raw === undefined) {
@@ -266,6 +339,10 @@ function validateConfigSchema(raw) {
266
339
  ? { output_dir: ".mdkg/bundles", default_profile: "private" }
267
340
  : requireObject(raw.bundles, "bundles", errors);
268
341
  const dbRaw = raw.db === undefined ? DEFAULT_PROJECT_DB_CONFIG : requireObject(raw.db, "db", errors);
342
+ const customizationDefaults = defaultCustomizationConfig();
343
+ const customizationRaw = raw.customization === undefined
344
+ ? customizationDefaults
345
+ : requireObject(raw.customization, "customization", errors);
269
346
  if (raw.bundle_imports !== undefined && raw.subgraphs !== undefined) {
270
347
  errors.push("config must not define both subgraphs and legacy bundle_imports");
271
348
  }
@@ -370,6 +447,60 @@ function validateConfigSchema(raw) {
370
447
  };
371
448
  }
372
449
  }
450
+ let customization;
451
+ if (customizationRaw) {
452
+ const standardsRaw = customizationRaw.standards === undefined
453
+ ? customizationDefaults.standards
454
+ : requireObject(customizationRaw.standards, "customization.standards", errors);
455
+ const coreDocsRaw = customizationRaw.core_docs === undefined
456
+ ? customizationDefaults.core_docs
457
+ : requireObject(customizationRaw.core_docs, "customization.core_docs", errors);
458
+ const skillMirrorsRaw = customizationRaw.skill_mirrors === undefined
459
+ ? customizationDefaults.skill_mirrors
460
+ : requireObject(customizationRaw.skill_mirrors, "customization.skill_mirrors", errors);
461
+ const standardsProfile = standardsRaw
462
+ ? standardsRaw.profile === undefined
463
+ ? customizationDefaults.standards.profile
464
+ : requireString(standardsRaw.profile, "customization.standards.profile", errors)
465
+ : undefined;
466
+ const standardsRefs = standardsRaw
467
+ ? standardsRaw.refs === undefined
468
+ ? customizationDefaults.standards.refs
469
+ : requireUniqueStringArray(standardsRaw.refs, "customization.standards.refs", errors, true)
470
+ : undefined;
471
+ const coreDocPaths = coreDocsRaw
472
+ ? coreDocsRaw.custom_paths === undefined
473
+ ? customizationDefaults.core_docs.custom_paths
474
+ : requireContainedPathArray(coreDocsRaw.custom_paths, "customization.core_docs.custom_paths", errors, true)
475
+ : undefined;
476
+ const mirrorTargets = skillMirrorsRaw
477
+ ? skillMirrorsRaw.targets === undefined
478
+ ? customizationDefaults.skill_mirrors.targets
479
+ : requireContainedPathArray(skillMirrorsRaw.targets, "customization.skill_mirrors.targets", errors, true)
480
+ : undefined;
481
+ if (standardsProfile !== undefined) {
482
+ if (standardsProfile.trim().length === 0) {
483
+ errors.push("customization.standards.profile must not be empty");
484
+ }
485
+ if (standardsProfile !== standardsProfile.trim()) {
486
+ errors.push("customization.standards.profile must not include surrounding whitespace");
487
+ }
488
+ }
489
+ if (standardsProfile && standardsRefs && coreDocPaths && mirrorTargets) {
490
+ customization = {
491
+ standards: {
492
+ profile: standardsProfile,
493
+ refs: standardsRefs,
494
+ },
495
+ core_docs: {
496
+ custom_paths: coreDocPaths,
497
+ },
498
+ skill_mirrors: {
499
+ targets: mirrorTargets,
500
+ },
501
+ };
502
+ }
503
+ }
373
504
  const packLimitsRaw = packRaw ? requireObject(packRaw.limits, "pack.limits", errors) : undefined;
374
505
  const pack = packRaw
375
506
  ? {
@@ -605,6 +736,7 @@ function validateConfigSchema(raw) {
605
736
  capabilities: capabilities,
606
737
  bundles: bundles,
607
738
  db: db,
739
+ customization: customization,
608
740
  subgraphs,
609
741
  pack: pack,
610
742
  templates: templates,
@@ -6,14 +6,15 @@ mdkg is pre-v1 public alpha software. Treat generated graph, cache, bundle, and
6
6
 
7
7
  Read these files in order:
8
8
  1. `.mdkg/core/SOUL.md` if it exists
9
- 2. `.mdkg/core/HUMAN.md` if it exists
10
- 3. `.mdkg/README.md`
11
- 4. `CLI_COMMAND_MATRIX.md`
9
+ 2. `.mdkg/core/COLLABORATION.md` if it exists
10
+ 3. `.mdkg/core/HUMAN.md` if it exists as a legacy alias
11
+ 4. `.mdkg/README.md`
12
+ 5. `CLI_COMMAND_MATRIX.md`
12
13
 
13
14
  Trust order:
14
15
  - source code
15
16
  - mdkg rules, design docs, decisions, and work nodes
16
- - SOUL/HUMAN collaboration anchors
17
+ - SOUL/COLLABORATION anchors and legacy HUMAN notes
17
18
  - relevant skills
18
19
  - chat history
19
20
 
@@ -177,7 +177,7 @@ Checkpoint commands:
177
177
  Agent bootstrap:
178
178
  - `mdkg init --agent`
179
179
  - published bootstrap config is root-only by default
180
- - `mdkg init --agent` creates the complete startup docs, wrapper docs, default mdkg skills, event log, registry, and skill mirrors
180
+ - `mdkg init --agent` creates the complete startup docs, wrapper docs, `SOUL.md` / `COLLABORATION.md` core docs, legacy `HUMAN.md`, default mdkg skills, event log, registry, and configured skill mirrors
181
181
  - removed flags `--llm`, `--agents`, `--claude`, and `--omni` fail before mutation with guidance to use `mdkg init --agent`
182
182
 
183
183
  Upgrade:
@@ -32,6 +32,21 @@
32
32
  "receipts_path": ".mdkg/db/receipts",
33
33
  "migration_table": "mdkg_schema_migration"
34
34
  },
35
+ "customization": {
36
+ "standards": {
37
+ "profile": "default",
38
+ "refs": []
39
+ },
40
+ "core_docs": {
41
+ "custom_paths": []
42
+ },
43
+ "skill_mirrors": {
44
+ "targets": [
45
+ ".agents/skills",
46
+ ".claude/skills"
47
+ ]
48
+ }
49
+ },
35
50
  "subgraphs": {},
36
51
  "pack": {
37
52
  "default_depth": 2,
@@ -0,0 +1,45 @@
1
+ ---
2
+ id: rule-7
3
+ type: rule
4
+ title: collaboration profile and operator preferences
5
+ tags: [collaboration, preferences, operator]
6
+ owners: []
7
+ links: []
8
+ artifacts: []
9
+ relates: [rule-human]
10
+ refs: [dec-53]
11
+ aliases: [collaboration, operator-profile]
12
+ created: 2026-06-27
13
+ updated: 2026-06-27
14
+ ---
15
+
16
+ # Purpose
17
+
18
+ Capture stable collaboration preferences, operating boundaries, and repo-specific
19
+ human expectations so agents can work with less ambiguity.
20
+
21
+ # Scope
22
+
23
+ Applies to planning, implementation, review, release, and handoff interactions in
24
+ this repository.
25
+
26
+ # Compatibility
27
+
28
+ `COLLABORATION.md` is canonical. `HUMAN.md` remains a one-release legacy alias for
29
+ repos and agent prompts that still reference it; read `COLLABORATION.md` first and
30
+ then use `HUMAN.md` only for compatibility notes not yet migrated.
31
+
32
+ # Requirements
33
+
34
+ - Keep top goals, boundaries, and style preferences current.
35
+ - Include ask-before-doing constraints for risky or high-impact actions.
36
+ - Record preferred environment assumptions and validation commands.
37
+ - Preserve local operator customizations during `mdkg upgrade --apply`.
38
+
39
+ # Notes
40
+
41
+ Suggested prompts:
42
+ - What are your top 3 goals in this repo right now?
43
+ - What should never happen without confirmation?
44
+ - What coding/review style should the agent prefer?
45
+ - What OS/runtime/test commands should be assumed?
@@ -10,9 +10,15 @@ relates: []
10
10
  refs: []
11
11
  aliases: [human]
12
12
  created: 2026-03-10
13
- updated: 2026-03-10
13
+ updated: 2026-06-27
14
14
  ---
15
15
 
16
+ # Compatibility
17
+
18
+ `HUMAN.md` is a one-release legacy alias. Read
19
+ `.mdkg/core/COLLABORATION.md` first when it exists, then use this file only for
20
+ older local notes that have not yet moved to the canonical collaboration profile.
21
+
16
22
  # Purpose
17
23
 
18
24
  Capture stable collaboration preferences and boundaries so agents can work with less ambiguity.
@@ -4,6 +4,7 @@
4
4
  # This list is included by `mdkg pack --verbose`.
5
5
 
6
6
  rule-soul
7
+ rule-7
7
8
  rule-human
8
9
  rule-1
9
10
  rule-2
@@ -92,6 +92,9 @@ Reserved rule IDs allowed by contract:
92
92
  - `rule-soul`
93
93
  - `rule-human`
94
94
 
95
+ `rule-7` is the current canonical collaboration profile. `rule-human` remains a
96
+ one-release legacy alias through `HUMAN.md`.
97
+
95
98
  Examples:
96
99
  - `task-183`
97
100
  - `edd-14`
@@ -114,20 +114,20 @@ If a user provides an unqualified ID and it is ambiguous globally:
114
114
  - `llms.txt`
115
115
  - `CLI_COMMAND_MATRIX.md`
116
116
  - `.mdkg/core/SOUL.md` (`id: rule-soul`)
117
- - `.mdkg/core/HUMAN.md` (`id: rule-human`)
117
+ - `.mdkg/core/COLLABORATION.md` (`id: rule-7`)
118
+ - `.mdkg/core/HUMAN.md` (`id: rule-human`, one-release legacy alias)
118
119
  - seeded canonical skills:
119
120
  - `.mdkg/skills/select-work-and-ground-context/SKILL.md`
120
121
  - `.mdkg/skills/build-pack-and-execute-task/SKILL.md`
121
122
  - `.mdkg/skills/verify-close-and-checkpoint/SKILL.md`
122
123
  - `.mdkg/skills/registry.md`
123
124
  - `.mdkg/work/events/events.jsonl`
124
- - `.agents/skills/`
125
- - `.claude/skills/`
126
- - deterministic `core.md` pin insertion (`rule-soul`, then `rule-human`)
125
+ - configured skill mirror targets, defaulting to `.agents/skills/` and `.claude/skills/`
126
+ - deterministic `core.md` pin insertion (`rule-soul`, then `rule-7`, then `rule-human`)
127
127
  - ignore policy for generated JSON index/temp/lock files, `.mdkg/pack/`, and raw archive source copies under `.mdkg/archive/**/source/`
128
128
  - mirrored skills are append-focused outputs:
129
129
  - `.mdkg/skills/` remains canonical
130
- - unrelated existing folders under `.agents/skills/` and `.claude/skills/` are preserved
130
+ - unrelated existing folders under configured mirror targets are preserved
131
131
  - same-slug collisions fail by default unless explicitly forced through `mdkg skill sync --force`
132
132
 
133
133
  ### Guide
@@ -1,17 +1,22 @@
1
1
  {
2
2
  "schema_version": 1,
3
3
  "tool": "mdkg",
4
- "mdkg_version": "0.3.8",
4
+ "mdkg_version": "0.3.9",
5
5
  "files": [
6
6
  {
7
7
  "path": ".mdkg/config.json",
8
8
  "category": "config",
9
- "sha256": "8055c72aa3c55f8a49d532a735bc29e3baa2e2bf478e9d092b83bec9e46fa78c"
9
+ "sha256": "715e2f55843dc31f66d4b7d333b5f89ea2aeeacc30f5dfaf7d3fd9f2c41e5fb0"
10
+ },
11
+ {
12
+ "path": ".mdkg/core/COLLABORATION.md",
13
+ "category": "core",
14
+ "sha256": "ef60b65b54a57ed54984a49f5ed14453cb4e47170a5660be94eceec26b92b01f"
10
15
  },
11
16
  {
12
17
  "path": ".mdkg/core/core.md",
13
18
  "category": "core",
14
- "sha256": "d87beecf4229535c0d0feea7deae28b97d0681105a1c282d9961e97918f0bbe8"
19
+ "sha256": "7d8a5ee16433ac8057234c84c2603a9d568d538f17f0488572da15f59603ca0f"
15
20
  },
16
21
  {
17
22
  "path": ".mdkg/core/guide.md",
@@ -21,12 +26,12 @@
21
26
  {
22
27
  "path": ".mdkg/core/HUMAN.md",
23
28
  "category": "core",
24
- "sha256": "75d2e015cd5ba61062cb84246017ee4f4221610d4a56e4a0b332271b90694965"
29
+ "sha256": "945fb5cb47945735b9529f2b0a322630b3e8aef1c3e69c4ce85dd2db3e905cca"
25
30
  },
26
31
  {
27
32
  "path": ".mdkg/core/rule-1-mdkg-conventions.md",
28
33
  "category": "core",
29
- "sha256": "15f886e6661046de45ad798c292d74cc1ff3cc14c8cfcc82ed0b8c35635d0477"
34
+ "sha256": "03db1635d170331517efb0ac24351b477a8020a96e51edf5bd67910a49bb5db7"
30
35
  },
31
36
  {
32
37
  "path": ".mdkg/core/rule-2-context-pack-rules.md",
@@ -36,7 +41,7 @@
36
41
  {
37
42
  "path": ".mdkg/core/rule-3-cli-contract.md",
38
43
  "category": "core",
39
- "sha256": "f61b84ff6e5abae91365c4f623ccbd78f25dfcfef09822fefb3abf0119d65739"
44
+ "sha256": "362fb8f22525f51c15ef54d81f63ebef4ab4b1dbaf37bd1415462a204ab78e45"
40
45
  },
41
46
  {
42
47
  "path": ".mdkg/core/rule-4-repo-safety-and-ignores.md",
@@ -63,6 +68,11 @@
63
68
  "category": "mdkg_doc",
64
69
  "sha256": "e876acfbf3e9de411cd45eb86e7e9bff821f8a5dd6dc933bd6da4ac88a9686e6"
65
70
  },
71
+ {
72
+ "path": ".mdkg/skills/author-mdkg-skill/SKILL.md",
73
+ "category": "default_skill",
74
+ "sha256": "9ea196cb778e6a777c945b3bba9d51c7574602f413e9a1d5e01e2b95918c0873"
75
+ },
66
76
  {
67
77
  "path": ".mdkg/skills/build-pack-and-execute-task/SKILL.md",
68
78
  "category": "default_skill",
@@ -71,17 +81,17 @@
71
81
  {
72
82
  "path": ".mdkg/skills/pursue-mdkg-goal/SKILL.md",
73
83
  "category": "default_skill",
74
- "sha256": "2bc888092d95b362e402494af4dbe6909204bd5578613d6159753a84efaae16d"
84
+ "sha256": "0545b011232d6924d84d80ad4b33153e591249d440c55481f125b37923c298d5"
75
85
  },
76
86
  {
77
87
  "path": ".mdkg/skills/select-work-and-ground-context/SKILL.md",
78
88
  "category": "default_skill",
79
- "sha256": "e50fc3b1a2c79a9a3544ca9df1bf4ca9c312e7c3a51d5e4c6f3314341eca268b"
89
+ "sha256": "95faee88875233dd2ed2039e941fbe879e3ccf619e1f9f18e3f2313ac5033409"
80
90
  },
81
91
  {
82
92
  "path": ".mdkg/skills/verify-close-and-checkpoint/SKILL.md",
83
93
  "category": "default_skill",
84
- "sha256": "3e4137b7b6a71f088dee79b5ee2f4743aefa3b43adae07337307db89a24416b6"
94
+ "sha256": "1e3982ad80a0a8b94d43a80e2b7143a938f6e01aa898b86d0410911f61361107"
85
95
  },
86
96
  {
87
97
  "path": ".mdkg/templates/default/archive.md",
@@ -301,7 +311,7 @@
301
311
  {
302
312
  "path": "AGENT_START.md",
303
313
  "category": "startup_doc",
304
- "sha256": "0d3bb2f9ea156f53c1bf68595e591578caadc18d296fa919e71ea1a3d9a968e8"
314
+ "sha256": "91e31ae818b29f62ebe77ac24f7e1a2bd10a4fedfc1684da935f0849aaf6d200"
305
315
  },
306
316
  {
307
317
  "path": "AGENTS.md",
@@ -316,12 +326,12 @@
316
326
  {
317
327
  "path": "CLI_COMMAND_MATRIX.md",
318
328
  "category": "startup_doc",
319
- "sha256": "8f426fd8da402b4b550b71e7ec3882c614ceb2d79d23c47b9c27bca7e39fadb2"
329
+ "sha256": "82c509b91498131304ff2bc94bb7eb2f29c3c207a00bc8bcaf8a6ab52ff9e689"
320
330
  },
321
331
  {
322
332
  "path": "llms.txt",
323
333
  "category": "startup_doc",
324
- "sha256": "8316bb8f634c6fb290ef1591e9c5b9786a2ddc06d25ab7d448fce8f4aebf65b8"
334
+ "sha256": "108ac1feb3e11824c9cfc5116aaa83355cb461ad9b0ec5c4bb244f6a70276f31"
325
335
  }
326
336
  ]
327
337
  }
@@ -4,7 +4,8 @@ Read `AGENT_START.md` first.
4
4
 
5
5
  Key files:
6
6
  - `.mdkg/core/SOUL.md`
7
- - `.mdkg/core/HUMAN.md`
7
+ - `.mdkg/core/COLLABORATION.md`
8
+ - `.mdkg/core/HUMAN.md` (legacy alias for one release)
8
9
  - `.mdkg/README.md`
9
10
  - `CLI_COMMAND_MATRIX.md`
10
11
 
@@ -0,0 +1,211 @@
1
+ ---
2
+ name: author-mdkg-skill
3
+ description: Create or update an mdkg SKILL.md or MANIFEST.md when a repeatable workflow, capability, agent, tool, runtime, API, or projection contract should become durable mdkg-authored knowledge.
4
+ tags: [stage:plan, writer:orchestrator, mdkg, skills, authoring]
5
+ version: 0.2.0
6
+ authors: [mdkg]
7
+ links: [AGENT_START.md, CLI_COMMAND_MATRIX.md, .mdkg/design/edd-5-mdkg-skills-integration-guide-v0-4-agent-skills-standard-and-packs.md]
8
+ ---
9
+
10
+ # Goal
11
+
12
+ Create or update focused mdkg-authored SKILL.md and MANIFEST.md assets that make
13
+ repeatable workflows and durable capabilities explicit without creating
14
+ duplicated procedures or projection-only behavior.
15
+
16
+ ## When To Use
17
+
18
+ - When a repo workflow is repeated often enough to deserve a reusable skill
19
+ - When an existing skill no longer matches the current command surface or docs
20
+ - When a builder asks to codify a procedure for future humans or agents
21
+ - When a capability, agent, tool, runtime image, API, model, or integration
22
+ needs a durable MANIFEST before it is projected into a runtime-specific config
23
+ - When `.codex/agents` or another projection surface contains behavior that
24
+ should be mirrored into durable mdkg/MANIFEST/SKILL state
25
+
26
+ ## Inputs
27
+
28
+ - Repo root
29
+ - Workflow trigger and desired outcome
30
+ - Any existing related skills, docs, or command references
31
+ - Candidate capability, resource, agent, tool, runtime, API, model, or
32
+ integration boundary
33
+ - Source mdkg nodes and intended projection targets, if any
34
+
35
+ ## Required Output Sections
36
+
37
+ For SKILL.md output, include:
38
+
39
+ - Purpose
40
+ - When to use
41
+ - Inputs
42
+ - Outputs
43
+ - Required capabilities
44
+ - Resources touched
45
+ - Steps
46
+ - Validation checks
47
+ - Closeout evidence
48
+ - Failure modes
49
+ - Safety rules
50
+ - Related manifests
51
+ - Projection targets
52
+ - Open questions
53
+
54
+ For MANIFEST.md output, include:
55
+
56
+ - Identity
57
+ - Purpose
58
+ - Scope
59
+ - Non-goals
60
+ - Status
61
+ - Owners
62
+ - Source mdkg nodes
63
+ - Resource URIs
64
+ - Capabilities
65
+ - Inputs
66
+ - Outputs
67
+ - Dependencies
68
+ - Security boundaries
69
+ - Validation checks
70
+ - Closeout evidence
71
+ - Projection targets
72
+ - Versioning
73
+ - Change policy
74
+ - Open questions
75
+
76
+ ## Steps
77
+
78
+ 1. Check for an existing fit first with `mdkg skill list`, `mdkg skill search`, and `mdkg skill show <slug>`.
79
+ 2. If an existing skill already covers the workflow, update it instead of creating a near-duplicate.
80
+ 3. If a manifest already covers the capability, update that MANIFEST or create a
81
+ repair task instead of adding behavior only to a projection file.
82
+ 4. Use existing templates from `.mdkg/templates/skills/` and
83
+ `.mdkg/templates/specs/` before proposing a new template family.
84
+ 5. If the workflow is really task mutation or event provenance, prefer teaching
85
+ `mdkg task ...` and `mdkg event ...` for structured fields while still
86
+ allowing markdown narrative edits where they fit better.
87
+ 6. If a new skill is justified, scaffold it with
88
+ `mdkg skill new <slug> "<name>" --description "..."`.
89
+ 7. Write the description so it says both what the skill does and when to use it.
90
+ 8. Add only the minimum tags needed for discovery, including the correct
91
+ `stage:*` tag and a single `writer:*` tag.
92
+ 9. Keep the body concise and procedural; move detailed reference material into
93
+ `references/` only when needed.
94
+ 10. Distinguish durable source from projection:
95
+ mdkg/MANIFEST/SKILL is source; `.codex/agents`, future runtime manifests, and
96
+ protocol resources are projections.
97
+ 11. Add validation checks and closeout evidence to every authored or revised
98
+ SKILL/MANIFEST.
99
+ 12. If input is incomplete, create repair tasks instead of guessing.
100
+ 13. Validate the new or updated skill with `mdkg skill validate <slug>`.
101
+ 14. If the skill changes the public workflow, update `AGENT_START.md`,
102
+ `CLI_COMMAND_MATRIX.md`, root onboarding docs, and the skill registry in the
103
+ same pass.
104
+ 15. When mirrored skill folders are enabled, run `mdkg skill sync` after broad
105
+ manual changes so every configured `.mdkg/config.json`
106
+ `customization.skill_mirrors.targets` path stays current. The default
107
+ targets are `.agents/skills/` and `.claude/skills/`; other agent-local
108
+ skill roots may be configured by the repo.
109
+
110
+ ## Outputs
111
+
112
+ - One valid `SKILL.md` using the mdkg canonical section shape
113
+ - One valid `MANIFEST.md` when the work is a durable capability, agent, project,
114
+ tool, runtime, API, model, or integration contract
115
+ - Any needed `references/`, `assets/`, or opt-in `scripts/` scaffolding
116
+ - Updated docs and registry entries when the workflow surface changed
117
+ - Repair tasks for weak, missing, ambiguous, projection-only, or unsafe input
118
+ - Validation and closeout evidence sufficient for a future agent to trust the
119
+ asset
120
+
121
+ ## Required Capabilities
122
+
123
+ - mdkg skill discovery
124
+ - mdkg capability discovery
125
+ - Markdown frontmatter and body authoring
126
+ - source/projection boundary review
127
+ - validation and closeout evidence review
128
+
129
+ ## Resources Touched
130
+
131
+ - `.mdkg/skills/<slug>/SKILL.md`
132
+ - `.mdkg/templates/skills/`
133
+ - `.mdkg/templates/specs/`
134
+ - relevant `MANIFEST.md` nodes or template files, with legacy `SPEC.md`
135
+ references retained only for compatibility
136
+ - configured mirrored skill roots only through `mdkg skill sync`
137
+
138
+ ## Validation Checks
139
+
140
+ - `mdkg skill validate <slug>`
141
+ - `mdkg skill sync --json` when mirror targets are present
142
+ - `mdkg capability search "<skill or manifest concept>" --json`
143
+ - `mdkg validate --changed-only --json`
144
+ - `mdkg validate`
145
+ - Template coverage check when template files are changed
146
+ - Projection validation report when `.codex/agents` or another projection
147
+ target is involved
148
+
149
+ ## Closeout Evidence
150
+
151
+ - Changed skill or MANIFEST paths
152
+ - Checks run and results
153
+ - Related mdkg nodes
154
+ - Projection targets reviewed
155
+ - Repair tasks created for incomplete inputs
156
+ - Explicit note that no generator/exporter was implemented unless selected work
157
+ asked for it
158
+
159
+ ## Safety Rules
160
+
161
+ - Do not create skills for one-off tasks or vague advice.
162
+ - Prefer repo truth over chat memory when deciding the skill body and examples.
163
+ - Do not add `scripts/` unless instructions are insufficient and deterministic execution really needs them.
164
+ - Only the durable writer stage should commit the new or updated skill.
165
+ - mdkg indexes and discovers skills, but does not execute skill scripts.
166
+ - Do not treat `.codex/agents`, future runtime manifests, or package exports as
167
+ durable source of truth.
168
+ - Do not create new `SPEC.md` capability docs; use `MANIFEST.md`. Keep legacy
169
+ `SPEC.md` references only when documenting compatibility or migration repair.
170
+ - Do not export secrets, provider credentials, raw auth state, production
171
+ controls, wallet/ledger state, or local-only user paths into templates or
172
+ projections.
173
+ - Do not create a skill-factory-agent until SKILL/MANIFEST templates and projection
174
+ doctrine are stable.
175
+ - Optional `draft_uri` fields are future-facing hints, not finalized protocol
176
+ semantics. Use generic examples such as `capability://repo.inspect` or
177
+ `mdkg://capability/repo.inspect` in canonical mdkg templates.
178
+ - Do not use downstream product names or product-specific URI schemes as public
179
+ mdkg template examples.
180
+
181
+ ## Failure Handling
182
+
183
+ - If the trigger or writer role is unclear, stop and resolve that before authoring the skill.
184
+ - If multiple skills overlap, merge or narrow them instead of creating redundant procedures.
185
+ - If the workflow still feels too broad, split it into smaller skills before finalizing.
186
+ - If durable behavior exists only in a projection file, create or update a MANIFEST
187
+ and record projection repair work.
188
+ - If a requested template family is missing, propose a template backlog task
189
+ before inventing a one-off shape.
190
+ - If validation cannot run, record the exact blocker and keep the work open.
191
+
192
+ ## Related Manifests
193
+
194
+ - Future `agent.*` manifests for Codex and runtime agents
195
+ - Future capability, tool, model, runtime image, integration, and API manifests
196
+ - Root/child project manifests discovered through mdkg capability search
197
+
198
+ ## Projection Targets
199
+
200
+ - `.codex/agents` TOML
201
+ - future runtime agent manifests
202
+ - future workflow/runtime protocol resource and capability objects
203
+ - future workflow/runtime protocol definitions
204
+
205
+ ## Open Questions
206
+
207
+ - Which MANIFEST template families should be promoted into public seeded assets
208
+ first?
209
+ - Which projection fields should be generated versus manually maintained?
210
+ - What validation command should become the canonical MANIFEST template coverage
211
+ check?