mdkg 0.0.4 → 0.0.6

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.
package/README.md CHANGED
@@ -13,8 +13,7 @@ mdkg stays deliberately boring:
13
13
  - zero runtime dependencies
14
14
  - no sqlite, daemon, hosted index, or vector DB
15
15
 
16
- Current package version in this repo: `0.0.4`
17
- Publish status: cut prepared, not yet published
16
+ Current package version in source: `0.0.6`
18
17
 
19
18
  ## The product shape
20
19
 
@@ -50,15 +49,15 @@ Initialize mdkg in a repo:
50
49
  mdkg init --llm
51
50
  ```
52
51
 
53
- This is the generic OSS bootstrap path. It creates `.mdkg/` and updates `.gitignore` / `.npmignore` by default. Use `--no-update-ignores` to opt out.
52
+ This is the generic OSS bootstrap path. It creates `.mdkg/` and updates `.gitignore` / `.npmignore` by default. Use `--no-update-ignores` to opt out of those ignore-file updates.
54
53
 
55
54
  Optional agent-ready scaffold:
56
55
 
57
56
  ```bash
58
- mdkg init --omni
57
+ mdkg init --agent
59
58
  ```
60
59
 
61
- This adds strict-node `SOUL.md` / `HUMAN.md`, a skills scaffold, seeded events JSONL, and core pin updates.
60
+ This adds strict-node `SOUL.md` / `HUMAN.md`, seeds the three default mdkg usage skills, creates `events.jsonl`, updates the skill registry, adds core pin updates, and creates mirrored skill folders under `.agents/skills/` and `.claude/skills/`.
62
61
 
63
62
  Create a task:
64
63
 
@@ -87,7 +86,7 @@ Validate before handoff or commit:
87
86
  mdkg validate
88
87
  ```
89
88
 
90
- Mutate a task-like node without manual markdown editing:
89
+ Update structured task state and evidence while keeping body and narrative edits in markdown:
91
90
 
92
91
  ```bash
93
92
  mdkg task start task-1 --run-id run_local_1
@@ -95,7 +94,7 @@ mdkg task update task-1 --add-artifacts tests://unit.txt --add-tags release
95
94
  mdkg task done task-1 --checkpoint "release readiness milestone"
96
95
  ```
97
96
 
98
- Enable and append baseline event memory:
97
+ Ensure and append baseline event memory:
99
98
 
100
99
  ```bash
101
100
  mdkg event enable
@@ -114,6 +113,7 @@ mdkg skill validate release-readiness
114
113
  ## LLM-readable onboarding artifacts
115
114
 
116
115
  The root docs below are the canonical fast-start set for humans and agents:
116
+ - [`AGENT_START.md`](/Users/nicholasreames/Git/mdkg/AGENT_START.md)
117
117
  - [`llms.txt`](/Users/nicholasreames/Git/mdkg/llms.txt)
118
118
  - [`AGENT_PROMPT_SNIPPET.md`](/Users/nicholasreames/Git/mdkg/AGENT_PROMPT_SNIPPET.md)
119
119
  - [`PACK_EXAMPLES.md`](/Users/nicholasreames/Git/mdkg/PACK_EXAMPLES.md)
@@ -129,6 +129,8 @@ mdkg lives under a hidden root directory:
129
129
  - `.mdkg/work/` tasks, bugs, tests, epics, checkpoints
130
130
  - `.mdkg/templates/` templates used by `mdkg new`
131
131
  - `.mdkg/skills/` Agent Skills packages
132
+ - `.agents/skills/` Codex/OpenAI-facing mirrored skills
133
+ - `.claude/skills/` Claude-facing mirrored skills
132
134
  - `.mdkg/index/` generated cache files
133
135
 
134
136
  ## Primary commands
@@ -165,12 +167,15 @@ Canonical layout:
165
167
 
166
168
  Current source behavior:
167
169
  - skills are indexed into `.mdkg/index/skills.json`
170
+ - `.mdkg/skills/` remains the canonical skill source of truth
171
+ - `.agents/skills/` and `.claude/skills/` are materialized mirrors for agent products
168
172
  - skills have a focused command family:
169
173
  - `mdkg skill new <slug> "<name>" --description "..."`
170
174
  - `mdkg skill list`
171
175
  - `mdkg skill search "<query>"`
172
176
  - `mdkg skill show <slug>`
173
177
  - `mdkg skill validate [<slug>]`
178
+ - `mdkg skill sync`
174
179
  - machine-readable skill discovery is available through:
175
180
  - `mdkg skill list --json`
176
181
  - `mdkg skill search "<query>" --json`
@@ -182,6 +187,8 @@ Current source behavior:
182
187
  - `SKILLS.md` is tolerated on read for compatibility, but validation warns and canonical docs still use `SKILL.md`
183
188
  - if both `SKILL.md` and `SKILLS.md` exist in one skill folder, validation fails
184
189
  - `mdkg skill new` scaffolds `SKILL.md`, `references/`, `assets/`, and `scripts/` only when requested with `--with-scripts`
190
+ - `mdkg skill sync` refreshes the product-specific mirrors from canonical `.mdkg/skills/`
191
+ - mirrored skill folders are append-focused outputs; preserve unrelated existing folders and fail on same-slug collisions unless explicitly forced
185
192
 
186
193
  This repo now dogfoods three internal skills:
187
194
  - `author-mdkg-skill`
@@ -191,19 +198,23 @@ This repo now dogfoods three internal skills:
191
198
 
192
199
  ## Current direction
193
200
 
194
- Current `0.0.4` release polish already includes:
195
- - `init --omni`
196
- - default ignore updates with `--no-update-ignores`
201
+ This release includes:
202
+ - `init --agent`
203
+ - default ignore updates with `--no-update-ignores` for `.mdkg/index/` and `.mdkg/pack/`
197
204
  - skills indexing and search/show/list support
198
205
  - optional `skills: [...]` on work items
199
206
  - pack-time skill inclusion
200
207
  - latest-checkpoint resolver + index hint
201
208
  - events JSONL validation
209
+ - product-specific skill mirrors for Codex/OpenAI and Claude
210
+ - shared `AGENT_START.md` startup guidance
202
211
 
203
- Current `0.0.4` polish direction is:
212
+ Current direction:
204
213
  - keep the OSS story generic around `init --llm`
214
+ - use `init --agent` for deeper AI-agent bootstrap
205
215
  - keep `pack <id>` at the center of the human/agent loop
206
- - make task mutation and event logging guided instead of purely manual
216
+ - use `mdkg task ...` for structured state changes and markdown edits for narrative/body content
217
+ - make event logging guided instead of purely manual
207
218
  - dogfood real skills inside the repo
208
219
  - make skill authoring first-class through `mdkg skill`
209
220
  - make `CLI_COMMAND_MATRIX.md` the single source of truth for the live CLI surface
@@ -218,7 +229,7 @@ mdkg is not a secret store.
218
229
  Use these defaults:
219
230
  - keep `.mdkg/index/` gitignored
220
231
  - keep `.mdkg/pack/` gitignored
221
- - keep `.mdkg/work/events/*.jsonl` gitignored unless you deliberately opt in
232
+ - event logs are committed by default; ignore or delete them manually if a repo wants local-only provenance
222
233
  - do not ship `.mdkg/` into production builds or published packages
223
234
  - if an external orchestrator is writing mdkg state, keep one durable writer per run and batch commits at end-of-run or checkpoint boundaries
224
235
  - do not commit on every tool call
@@ -235,7 +246,7 @@ Suggested local loop:
235
246
  2. inspect truth with `search`, `show`, or `next`
236
247
  3. build context with `pack <id>`
237
248
  4. mutate task state with `mdkg task ...` when durable state changes
238
- 5. enable event logging if provenance should be captured in JSONL
249
+ 5. ensure event logging exists if the JSONL file was deleted or is missing
239
250
  6. implement and test
240
251
  7. run `mdkg validate`
241
252
 
package/dist/cli.js CHANGED
@@ -77,7 +77,7 @@ function printUsage(log) {
77
77
  log(" mdkg skill list --tags stage:plan --json");
78
78
  log(" mdkg validate");
79
79
  log("\nOptional agent-ready bootstrap:");
80
- log(" mdkg init --omni");
80
+ log(" mdkg init --agent");
81
81
  log("\nRun `mdkg help <command>` or `mdkg <command> --help` for details.");
82
82
  printGlobalOptions(log);
83
83
  }
@@ -86,8 +86,8 @@ function printInitHelp(log) {
86
86
  log(" mdkg init [options]");
87
87
  log("\nOptions:");
88
88
  log(" --force Overwrite existing mdkg files");
89
- log(" --llm Create AGENTS.md and CLAUDE.md");
90
- log(" --omni Add SOUL/HUMAN/skills/events scaffolding");
89
+ log(" --llm Create AGENTS.md, CLAUDE.md, llms.txt, and AGENT_START.md");
90
+ log(" --agent Add SOUL/HUMAN/skills/events scaffolding and skill mirrors");
91
91
  log(" --no-update-ignores Skip default .gitignore/.npmignore updates");
92
92
  log(" --update-gitignore Append mdkg ignore entries");
93
93
  log(" --update-npmignore Append mdkg ignore entries");
@@ -234,6 +234,13 @@ function printSkillHelp(log, subcommand) {
234
234
  log(" mdkg skill validate [<slug>]");
235
235
  printGlobalOptions(log);
236
236
  return;
237
+ case "sync":
238
+ log("Usage:");
239
+ log(" mdkg skill sync [--force]");
240
+ log("\nWhen to use:");
241
+ log(" Rebuild .agents/skills and .claude/skills from canonical .mdkg/skills.");
242
+ printGlobalOptions(log);
243
+ return;
237
244
  default:
238
245
  log("Usage:");
239
246
  log(' mdkg skill new <slug> "<name>" --description "<description>" [options]');
@@ -241,6 +248,7 @@ function printSkillHelp(log, subcommand) {
241
248
  log(" mdkg skill show <slug> [--meta] [--json]");
242
249
  log(' mdkg skill search "<query>" [--tags <tag,tag,...>] [--tags-mode any|all] [--json]');
243
250
  log(" mdkg skill validate [<slug>]");
251
+ log(" mdkg skill sync [--force]");
244
252
  log("\nNotes:");
245
253
  log(" Skills are first-class under `mdkg skill ...`.");
246
254
  log(" Use stage tags like `stage:plan`, `stage:execute`, and `stage:review` with --tags.");
@@ -253,7 +261,8 @@ function printTaskHelp(log, subcommand) {
253
261
  log("Usage:");
254
262
  log(' mdkg task start <id-or-qid> [--ws <alias>] [--run-id <id>] [--note "<text>"]');
255
263
  log("\nWhen to use:");
256
- log(" Move a task, bug, or test into progress and emit a baseline event when logging is enabled.");
264
+ log(" Move a task, bug, or test into progress as a structured state change.");
265
+ log(" If `events.jsonl` is missing, mdkg prints a short reminder about `mdkg event enable`.");
257
266
  printGlobalOptions(log);
258
267
  return;
259
268
  case "update":
@@ -263,7 +272,7 @@ function printTaskHelp(log, subcommand) {
263
272
  log(" [--add-skills <slug,...>] [--add-tags <tag,...>] [--add-blocked-by <id,...>]");
264
273
  log(' [--clear-blocked-by] [--run-id <id>] [--note "<text>"]');
265
274
  log("\nWhen to use:");
266
- log(" Update task metadata and evidence without editing markdown manually.");
275
+ log(" Update structured task metadata and evidence while keeping body and narrative edits in markdown.");
267
276
  printGlobalOptions(log);
268
277
  return;
269
278
  case "done":
@@ -272,6 +281,7 @@ function printTaskHelp(log, subcommand) {
272
281
  log(' [--add-refs <id,...>] [--checkpoint "<title>"] [--run-id <id>] [--note "<text>"]');
273
282
  log("\nWhen to use:");
274
283
  log(" Mark a task-like node done, optionally create a checkpoint, and emit a completion event when enabled.");
284
+ log(" Use `--checkpoint` for milestone compression, not every routine task completion.");
275
285
  printGlobalOptions(log);
276
286
  return;
277
287
  default:
@@ -281,6 +291,7 @@ function printTaskHelp(log, subcommand) {
281
291
  log(' mdkg task done <id-or-qid> [--checkpoint "<title>"] [options]');
282
292
  log("\nNotes:");
283
293
  log(" `mdkg task ...` only supports task, bug, and test nodes in this wave.");
294
+ log(" Feat and epic closeout remain checkpoint-first guidance plus manual parent updates.");
284
295
  printGlobalOptions(log);
285
296
  }
286
297
  }
@@ -288,9 +299,9 @@ function printEventHelp(log, subcommand) {
288
299
  switch ((subcommand ?? "").toLowerCase()) {
289
300
  case "enable":
290
301
  log("Usage:");
291
- log(" mdkg event enable [--ws <alias>] [--no-update-gitignore]");
302
+ log(" mdkg event enable [--ws <alias>]");
292
303
  log("\nWhen to use:");
293
- log(" Create the append-only JSONL event log for a workspace.");
304
+ log(" Create or ensure the append-only JSONL event log for a workspace.");
294
305
  printGlobalOptions(log);
295
306
  return;
296
307
  case "append":
@@ -304,7 +315,7 @@ function printEventHelp(log, subcommand) {
304
315
  return;
305
316
  default:
306
317
  log("Usage:");
307
- log(" mdkg event enable [--ws <alias>] [--no-update-gitignore]");
318
+ log(" mdkg event enable [--ws <alias>]");
308
319
  log(" mdkg event append --kind <kind> --status <ok|error|retry|skipped> --refs <id,...> [options]");
309
320
  printGlobalOptions(log);
310
321
  }
@@ -670,8 +681,16 @@ function runSkillSubcommand(parsed, root) {
670
681
  (0, skill_1.runSkillValidateCommand)({ root, slug });
671
682
  return 0;
672
683
  }
684
+ case "sync": {
685
+ if (parsed.positionals.length > 2) {
686
+ throw new errors_1.UsageError("skill sync does not accept positional arguments");
687
+ }
688
+ const force = parseBooleanFlag("--force", parsed.flags["--force"]);
689
+ (0, skill_1.runSkillSyncCommand)({ root, force });
690
+ return 0;
691
+ }
673
692
  default:
674
- throw new errors_1.UsageError("skill requires new/list/show/search/validate");
693
+ throw new errors_1.UsageError("skill requires new/list/show/search/validate/sync");
675
694
  }
676
695
  }
677
696
  function runTaskSubcommand(parsed, root) {
@@ -760,8 +779,7 @@ function runEventSubcommand(parsed, root) {
760
779
  throw new errors_1.UsageError("event enable does not accept positional arguments");
761
780
  }
762
781
  const ws = requireFlagValue("--ws", parsed.flags["--ws"]);
763
- const noUpdateGitignore = parseBooleanFlag("--no-update-gitignore", parsed.flags["--no-update-gitignore"]);
764
- (0, event_1.runEventEnableCommand)({ root, ws, updateGitignore: !noUpdateGitignore });
782
+ (0, event_1.runEventEnableCommand)({ root, ws });
765
783
  return 0;
766
784
  }
767
785
  case "append": {
@@ -808,7 +826,10 @@ function runCommand(parsed, root, runtime) {
808
826
  const createAgents = parseBooleanFlag("--agents", parsed.flags["--agents"]);
809
827
  const createClaude = parseBooleanFlag("--claude", parsed.flags["--claude"]);
810
828
  const createLlm = parseBooleanFlag("--llm", parsed.flags["--llm"]);
811
- const omni = parseBooleanFlag("--omni", parsed.flags["--omni"]);
829
+ if (parsed.flags["--omni"]) {
830
+ throw new errors_1.UsageError("`mdkg init --omni` was removed; use `mdkg init --agent`");
831
+ }
832
+ const agent = parseBooleanFlag("--agent", parsed.flags["--agent"]);
812
833
  const noUpdateIgnores = parseBooleanFlag("--no-update-ignores", parsed.flags["--no-update-ignores"]);
813
834
  const updateGitignore = parseBooleanFlag("--update-gitignore", parsed.flags["--update-gitignore"]);
814
835
  const updateNpmignore = parseBooleanFlag("--update-npmignore", parsed.flags["--update-npmignore"]);
@@ -823,7 +844,7 @@ function runCommand(parsed, root, runtime) {
823
844
  createAgents,
824
845
  createClaude,
825
846
  createLlm,
826
- omni,
847
+ agent,
827
848
  });
828
849
  return 0;
829
850
  }
@@ -7,8 +7,7 @@ const errors_1 = require("../util/errors");
7
7
  function runEventEnableCommand(options) {
8
8
  const result = (0, event_support_1.ensureEventsEnabled)(options);
9
9
  const createdLabel = result.created ? "created" : "already present";
10
- const ignoreLabel = result.gitignoreUpdated ? "updated .gitignore" : "left .gitignore unchanged";
11
- console.log(`event logging enabled: ${result.ws} (${createdLabel}; ${ignoreLabel})`);
10
+ console.log(`event logging enabled: ${result.ws} (${createdLabel})`);
12
11
  }
13
12
  function normalizeEventStatus(value) {
14
13
  const normalized = value.trim().toLowerCase();
@@ -16,27 +16,6 @@ const fs_1 = __importDefault(require("fs"));
16
16
  const path_1 = __importDefault(require("path"));
17
17
  const config_1 = require("../core/config");
18
18
  const errors_1 = require("../util/errors");
19
- function appendIgnoreEntries(filePath, entries) {
20
- const normalizedEntries = entries.map((entry) => entry.trim()).filter(Boolean);
21
- if (normalizedEntries.length === 0) {
22
- return false;
23
- }
24
- let existing = "";
25
- if (fs_1.default.existsSync(filePath)) {
26
- existing = fs_1.default.readFileSync(filePath, "utf8");
27
- }
28
- const existingLines = new Set(existing
29
- .split(/\r?\n/)
30
- .map((line) => line.trim())
31
- .filter(Boolean));
32
- const additions = normalizedEntries.filter((entry) => !existingLines.has(entry));
33
- if (additions.length === 0) {
34
- return false;
35
- }
36
- const next = existing.length === 0 ? `${additions.join("\n")}\n` : `${existing.replace(/\s*$/, "\n")}${additions.join("\n")}\n`;
37
- fs_1.default.writeFileSync(filePath, next, "utf8");
38
- return true;
39
- }
40
19
  function normalizeWorkspaceForEvents(config, raw) {
41
20
  const normalized = (raw ?? "root").toLowerCase();
42
21
  if (normalized === "all") {
@@ -70,20 +49,13 @@ function ensureEventsEnabled(options) {
70
49
  const config = (0, config_1.loadConfig)(options.root);
71
50
  const ws = normalizeWorkspaceForEvents(config, options.ws);
72
51
  const eventsPath = resolveEventsPath(options.root, config, ws);
73
- const updateGitignore = options.updateGitignore !== false;
74
52
  let created = false;
75
53
  if (!fs_1.default.existsSync(eventsPath)) {
76
54
  fs_1.default.mkdirSync(path_1.default.dirname(eventsPath), { recursive: true });
77
55
  fs_1.default.writeFileSync(eventsPath, "", "utf8");
78
56
  created = true;
79
57
  }
80
- let gitignoreUpdated = false;
81
- if (updateGitignore) {
82
- gitignoreUpdated = appendIgnoreEntries(path_1.default.join(options.root, ".gitignore"), [
83
- ".mdkg/work/events/*.jsonl",
84
- ]);
85
- }
86
- return { ws, eventsPath, created, gitignoreUpdated };
58
+ return { ws, eventsPath, created };
87
59
  }
88
60
  function normalizeIdOrIdRef(value) {
89
61
  return value.trim().toLowerCase();
@@ -131,7 +103,7 @@ function appendEvent(options) {
131
103
  }
132
104
  const eventsPath = resolveEventsPath(options.root, config, record.workspace);
133
105
  if (!fs_1.default.existsSync(eventsPath)) {
134
- throw new errors_1.NotFoundError(`event logging is not enabled for workspace ${record.workspace}; run \`mdkg event enable --ws ${record.workspace}\``);
106
+ throw new errors_1.NotFoundError(`events.jsonl is missing for workspace ${record.workspace}; run \`mdkg event enable --ws ${record.workspace}\``);
135
107
  }
136
108
  fs_1.default.appendFileSync(eventsPath, `${JSON.stringify(record)}\n`, "utf8");
137
109
  return record;
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.runInitCommand = runInitCommand;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
+ const config_1 = require("../core/config");
9
10
  const errors_1 = require("../util/errors");
10
11
  const date_1 = require("../util/date");
11
12
  const skill_support_1 = require("./skill_support");
13
+ const skill_mirror_1 = require("./skill_mirror");
12
14
  const DEFAULT_SEED_SUBDIR = path_1.default.resolve(__dirname, "..", "init");
13
15
  const SOUL_PIN_ID = "rule-soul";
14
16
  const HUMAN_PIN_ID = "rule-human";
@@ -84,7 +86,7 @@ function soulTemplate(created) {
84
86
  `id: ${SOUL_PIN_ID}`,
85
87
  "type: rule",
86
88
  "title: agent soul and execution contract",
87
- "tags: [omni, agent, constraints]",
89
+ "tags: [agent, constraints]",
88
90
  "owners: []",
89
91
  "links: []",
90
92
  "artifacts: []",
@@ -167,7 +169,7 @@ function seededInitEvent(nowIso) {
167
169
  status: "ok",
168
170
  refs: ["edd-4"],
169
171
  artifacts: [],
170
- notes: "init omni scaffold target initialized",
172
+ notes: "init agent scaffold target initialized",
171
173
  redacted: true,
172
174
  };
173
175
  return `${JSON.stringify(event)}\n`;
@@ -222,13 +224,18 @@ function runInitCommand(options) {
222
224
  const seedRoot = options.seedRoot ? path_1.default.resolve(options.seedRoot) : DEFAULT_SEED_SUBDIR;
223
225
  const createAgents = Boolean(options.createAgents || options.createLlm);
224
226
  const createClaude = Boolean(options.createClaude || options.createLlm);
227
+ const createStartupDocs = Boolean(options.createLlm || options.agent);
225
228
  const force = Boolean(options.force);
226
229
  const seedConfig = path_1.default.join(seedRoot, "config.json");
227
230
  const seedCore = path_1.default.join(seedRoot, "core");
228
231
  const seedTemplates = path_1.default.join(seedRoot, "templates");
229
232
  const seedAgents = path_1.default.join(seedRoot, "AGENTS.md");
230
233
  const seedClaude = path_1.default.join(seedRoot, "CLAUDE.md");
234
+ const seedLlms = path_1.default.join(seedRoot, "llms.txt");
235
+ const seedAgentStart = path_1.default.join(seedRoot, "AGENT_START.md");
236
+ const seedCliMatrix = path_1.default.join(seedRoot, "CLI_COMMAND_MATRIX.md");
231
237
  const seedReadme = path_1.default.join(seedRoot, "README.md");
238
+ const seedDefaultSkills = path_1.default.join(seedRoot, "skills", "default");
232
239
  if (!fs_1.default.existsSync(seedConfig) || !fs_1.default.existsSync(seedCore) || !fs_1.default.existsSync(seedTemplates)) {
233
240
  throw new errors_1.NotFoundError(`init assets not found at ${seedRoot} (try reinstalling mdkg)`);
234
241
  }
@@ -238,9 +245,21 @@ function runInitCommand(options) {
238
245
  if (createClaude && !fs_1.default.existsSync(seedClaude)) {
239
246
  throw new errors_1.NotFoundError(`init assets missing CLAUDE.md at ${seedRoot}`);
240
247
  }
248
+ if (createStartupDocs && !fs_1.default.existsSync(seedLlms)) {
249
+ throw new errors_1.NotFoundError(`init assets missing llms.txt at ${seedRoot}`);
250
+ }
251
+ if (createStartupDocs && !fs_1.default.existsSync(seedAgentStart)) {
252
+ throw new errors_1.NotFoundError(`init assets missing AGENT_START.md at ${seedRoot}`);
253
+ }
254
+ if (createStartupDocs && !fs_1.default.existsSync(seedCliMatrix)) {
255
+ throw new errors_1.NotFoundError(`init assets missing CLI_COMMAND_MATRIX.md at ${seedRoot}`);
256
+ }
241
257
  if (!fs_1.default.existsSync(seedReadme)) {
242
258
  throw new errors_1.NotFoundError(`init assets missing README.md at ${seedRoot}`);
243
259
  }
260
+ if (options.agent && !fs_1.default.existsSync(seedDefaultSkills)) {
261
+ throw new errors_1.NotFoundError(`init assets missing default skills at ${seedRoot}`);
262
+ }
244
263
  const mdkgDir = path_1.default.join(root, ".mdkg");
245
264
  fs_1.default.mkdirSync(mdkgDir, { recursive: true });
246
265
  fs_1.default.mkdirSync(path_1.default.join(mdkgDir, "work"), { recursive: true });
@@ -256,7 +275,12 @@ function runInitCommand(options) {
256
275
  if (createClaude) {
257
276
  copySeedFile(seedClaude, path_1.default.join(root, "CLAUDE.md"), force, stats);
258
277
  }
259
- if (options.omni) {
278
+ if (createStartupDocs) {
279
+ copySeedFile(seedLlms, path_1.default.join(root, "llms.txt"), force, stats);
280
+ copySeedFile(seedAgentStart, path_1.default.join(root, "AGENT_START.md"), force, stats);
281
+ copySeedFile(seedCliMatrix, path_1.default.join(root, "CLI_COMMAND_MATRIX.md"), force, stats);
282
+ }
283
+ if (options.agent) {
260
284
  const today = (0, date_1.formatDate)(new Date());
261
285
  const soulPath = path_1.default.join(mdkgDir, "core", "SOUL.md");
262
286
  const humanPath = path_1.default.join(mdkgDir, "core", "HUMAN.md");
@@ -266,6 +290,7 @@ function runInitCommand(options) {
266
290
  const eventsPath = path_1.default.join(eventsDir, "events.jsonl");
267
291
  fs_1.default.mkdirSync(skillsDir, { recursive: true });
268
292
  fs_1.default.mkdirSync(eventsDir, { recursive: true });
293
+ copySeedDir(seedDefaultSkills, skillsDir, force, stats);
269
294
  writeFileIfMissing(soulPath, soulTemplate(today), force, stats);
270
295
  writeFileIfMissing(humanPath, humanTemplate(today), force, stats);
271
296
  writeFileIfMissing(registryPath, (0, skill_support_1.registryTemplate)(), force, stats);
@@ -274,6 +299,10 @@ function runInitCommand(options) {
274
299
  }
275
300
  const coreListPath = path_1.default.join(mdkgDir, "core", "core.md");
276
301
  ensureCorePins(coreListPath, [SOUL_PIN_ID, HUMAN_PIN_ID]);
302
+ (0, skill_mirror_1.scaffoldMirrorRoots)(root);
303
+ const config = (0, config_1.loadConfig)(root);
304
+ (0, skill_support_1.refreshSkillsRegistry)(root, config);
305
+ (0, skill_mirror_1.syncSkillMirrors)({ root, config, createRoots: true, force });
277
306
  }
278
307
  const noUpdateIgnores = Boolean(options.noUpdateIgnores);
279
308
  const shouldUpdateGitignore = Boolean(options.updateGitignore || !noUpdateIgnores);
@@ -282,7 +311,6 @@ function runInitCommand(options) {
282
311
  appendIgnoreEntries(path_1.default.join(root, ".gitignore"), [
283
312
  ".mdkg/index/",
284
313
  ".mdkg/pack/",
285
- ".mdkg/work/events/*.jsonl",
286
314
  ]);
287
315
  }
288
316
  if (shouldUpdateNpmignore) {
@@ -293,6 +321,9 @@ function runInitCommand(options) {
293
321
  }
294
322
  console.log(`mdkg init complete: ${stats.created} file(s) created, ${stats.skipped} skipped`);
295
323
  console.log("next:");
324
+ if (createStartupDocs) {
325
+ console.log(" read AGENT_START.md");
326
+ }
296
327
  console.log(' mdkg new task "..." --status todo --priority 1');
297
328
  console.log(' mdkg search "..."');
298
329
  console.log(" mdkg show <id>");
@@ -8,6 +8,7 @@ exports.runSkillListCommand = runSkillListCommand;
8
8
  exports.runSkillShowCommand = runSkillShowCommand;
9
9
  exports.runSkillSearchCommand = runSkillSearchCommand;
10
10
  exports.runSkillValidateCommand = runSkillValidateCommand;
11
+ exports.runSkillSyncCommand = runSkillSyncCommand;
11
12
  const fs_1 = __importDefault(require("fs"));
12
13
  const path_1 = __importDefault(require("path"));
13
14
  const config_1 = require("../core/config");
@@ -18,6 +19,7 @@ const errors_1 = require("../util/errors");
18
19
  const skill_support_1 = require("./skill_support");
19
20
  const query_output_1 = require("./query_output");
20
21
  const event_support_1 = require("./event_support");
22
+ const skill_mirror_1 = require("./skill_mirror");
21
23
  function parseCsvList(raw) {
22
24
  if (!raw) {
23
25
  return [];
@@ -171,6 +173,9 @@ function runSkillNewCommand(options) {
171
173
  fs_1.default.writeFileSync(canonicalPath, content, "utf8");
172
174
  (0, skill_support_1.ensureSkillsRegistry)(root, config);
173
175
  (0, skill_support_1.refreshSkillsRegistry)(root, config);
176
+ if ((0, skill_mirror_1.shouldMaintainSkillMirrors)(root)) {
177
+ (0, skill_mirror_1.syncSkillMirrors)({ root, config, createRoots: true, force });
178
+ }
174
179
  if (config.index.auto_reindex) {
175
180
  const skillsIndex = (0, skills_indexer_1.buildSkillsIndex)(root, config);
176
181
  (0, skills_index_cache_2.writeSkillsIndex)((0, skills_indexer_1.resolveSkillsIndexPath)(root), skillsIndex);
@@ -357,3 +362,13 @@ function runSkillValidateCommand(options) {
357
362
  : 0;
358
363
  console.log(`skill validation ok: ${checkedCount} skill${checkedCount === 1 ? "" : "s"} checked`);
359
364
  }
365
+ function runSkillSyncCommand(options) {
366
+ const config = (0, config_1.loadConfig)(options.root);
367
+ const result = (0, skill_mirror_1.syncSkillMirrors)({
368
+ root: options.root,
369
+ config,
370
+ createRoots: true,
371
+ force: options.force,
372
+ });
373
+ console.log(`skill mirror sync ok: ${result.synced} synced, ${result.pruned} pruned across ${result.targets} target${result.targets === 1 ? "" : "s"}`);
374
+ }