mdkg 0.3.8 → 0.4.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.
@@ -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:
@@ -96,9 +96,9 @@ Read `AGENT_START.md` first when this repo includes it.
96
96
 
97
97
  ## Pack Profiles
98
98
 
99
- - `--pack-profile standard`: full body (current default behavior)
100
- - `--pack-profile concise`: summary body with code stripped by default
101
- - `--pack-profile headers`: metadata-only body (`none`)
99
+ - `--profile standard`: full body (current default behavior)
100
+ - `--profile concise`: summary body with code stripped by default
101
+ - `--profile headers`: metadata-only body (`none`)
102
102
 
103
103
  `--max-tokens` is a heuristic limit based on `chars / 4`.
104
104
 
@@ -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.4.0",
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",
@@ -61,7 +66,12 @@
61
66
  {
62
67
  "path": ".mdkg/README.md",
63
68
  "category": "mdkg_doc",
64
- "sha256": "e876acfbf3e9de411cd45eb86e7e9bff821f8a5dd6dc933bd6da4ac88a9686e6"
69
+ "sha256": "faaf4bb697eded7c6baf6cb44a2a6c04feabfc250cac3bcb4be6b95e7a3bb02a"
70
+ },
71
+ {
72
+ "path": ".mdkg/skills/author-mdkg-skill/SKILL.md",
73
+ "category": "default_skill",
74
+ "sha256": "9ea196cb778e6a777c945b3bba9d51c7574602f413e9a1d5e01e2b95918c0873"
65
75
  },
66
76
  {
67
77
  "path": ".mdkg/skills/build-pack-and-execute-task/SKILL.md",
@@ -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