mdkg 0.1.4 → 0.1.5

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/CHANGELOG.md CHANGED
@@ -6,6 +6,24 @@ This project follows a pragmatic changelog style inspired by Keep a Changelog. V
6
6
 
7
7
  mdkg is pre-v1 public alpha software. Command, graph, cache, bundle, and DAL contracts may change quickly while the project converges on a stable v1 surface.
8
8
 
9
+ ## 0.1.5 - Unreleased
10
+
11
+ ### Added
12
+
13
+ - Added first-class `goal` nodes for recursive long-running objectives with `goal_state`, `goal_condition`, `active_node`, required skills, required checks, iteration limits, stop conditions, and completion evidence.
14
+ - Added `mdkg new goal "<title>"` and the `mdkg goal show/select/current/clear/next/claim/evaluate/pause/resume/done` command family.
15
+ - Added a bundled `goal.md` template so init, upgrade, and template fallback can support goal nodes.
16
+ - Added `scope_refs` for explicit goal ownership roots and recursive goal traversal through epics and features.
17
+ - Added the `pursue-mdkg-goal` skill for skill-guided recursive pursuit with evidence and controlled skill-improvement proposals.
18
+ - Added goal parser, creation, selected-goal, recursive next-selection, claim, pack, and report-only evaluation tests.
19
+
20
+ ### Changed
21
+
22
+ - Normal `mdkg next` continues to select concrete task, bug, test, and feature work; goal-scoped selection lives under `mdkg goal next`.
23
+ - `mdkg goal next` is read-only and may omit the goal id when a selected local goal exists; `mdkg goal claim` is the explicit mutating path for `active_node`.
24
+ - Goal required checks are report-only guidance in this release. Agents run commands themselves and record evidence back into mdkg.
25
+ - Skill self-improvement during goal execution is recorded as candidates or proposal work unless the active node is explicit skill-maintenance.
26
+
9
27
  ## 0.1.4 - Unreleased
10
28
 
11
29
  ### Added
package/README.md CHANGED
@@ -14,7 +14,7 @@ mdkg stays deliberately boring:
14
14
  - first-class rebuildable SQLite cache through built-in `node:sqlite`
15
15
  - no daemon, hosted index, or vector DB
16
16
 
17
- Current package version in source: `0.1.4`
17
+ Current package version in source: `0.1.5`
18
18
 
19
19
  mdkg is still pre-v1 public alpha software. The public package is usable, but graph, cache, bundle, and DAL contracts may continue to change quickly while the project converges on a stable v1 surface.
20
20
 
@@ -77,6 +77,17 @@ Create a task:
77
77
  mdkg new task "bootstrap cli" --status todo --priority 1 --tags cli,build
78
78
  ```
79
79
 
80
+ Create a recursive goal for long-running agent work:
81
+
82
+ ```bash
83
+ mdkg new goal "reach prepublish readiness"
84
+ mdkg goal show goal-1 --json
85
+ mdkg goal next goal-1
86
+ mdkg goal evaluate goal-1 --json
87
+ ```
88
+
89
+ Goal nodes capture a measurable end condition, recursive loop state, required skills, required checks, and completion evidence. They guide agent harnesses through repeated graph-backed progress, while tasks, bugs, tests, and features remain the concrete executable work units. In this release `mdkg goal evaluate` is report-only: it lists required checks and evidence state, but does not execute scripts.
90
+
80
91
  Create an agent workflow document with a semantic portable id:
81
92
 
82
93
  ```bash
@@ -226,6 +237,7 @@ These are the commands new users and agents should learn first:
226
237
  - `mdkg capability`
227
238
  - `mdkg archive`
228
239
  - `mdkg work`
240
+ - `mdkg goal`
229
241
  - `mdkg task`
230
242
  - `mdkg validate`
231
243
 
@@ -305,6 +317,16 @@ Fresh `mdkg init` workspaces default to `index.backend: sqlite`, which writes `.
305
317
 
306
318
  Mutating commands use a workspace mutation lock plus atomic writes. SQLite mode additionally reserves numeric ids in a SQLite transaction before writing Markdown so parallel `mdkg new` and checkpoint calls avoid naming conflicts. Skipped ids after failed writes are acceptable because Markdown remains canonical.
307
319
 
320
+ ## Goal nodes
321
+
322
+ Goal nodes are durable recursive objective contracts. Use `mdkg new goal "<objective>"` when a human or agent needs to keep working across multiple concrete nodes until a measurable end condition is achieved.
323
+
324
+ `goal` is work-like but distinct from `task`: it can have status, priority, graph links, skills, explicit `scope_refs`, and structured goal fields, but normal `mdkg next` does not select goals. Use `mdkg goal select <goal-id>` once, then `mdkg goal next` to choose the next local feature, task, bug, or test inside that goal. `mdkg goal next <goal-id>` remains available for explicit selection. Epics organize goal scope recursively but are not returned as executable work.
325
+
326
+ Use `mdkg goal claim [goal-id] <work-id>` to durably set `active_node` after choosing the next scoped item. `goal next` is read-only. Use `mdkg goal pause|resume|done` to update goal state after review.
327
+
328
+ Required checks are stored as report-only guidance. Agents should run the checks themselves, record evidence in the goal or active work item, then use `mdkg goal evaluate` to summarize the current evidence state. During normal goal execution, skill improvements should be recorded as improvement candidates or proposal nodes; edit `SKILL.md` files only when the active node is explicit skill-maintenance work.
329
+
308
330
  ## Agent workflow files
309
331
 
310
332
  mdkg recognizes a small set of canonical agent workflow documents:
@@ -342,6 +364,7 @@ This release includes:
342
364
  - JSON capability cache for skills, `SPEC.md`, `WORK.md`, core docs, and design docs
343
365
  - SQLite index backend for fresh workspaces using built-in `node:sqlite`
344
366
  - mutation locking and atomic writes for parallel mdkg calls
367
+ - first-class `goal` nodes and `mdkg goal show/next/evaluate/pause/resume/done`
345
368
  - optional `skills: [...]` on work items
346
369
  - pack-time skill inclusion
347
370
  - latest-checkpoint resolver + index hint
package/dist/cli.js CHANGED
@@ -27,6 +27,7 @@ const init_1 = require("./commands/init");
27
27
  const new_1 = require("./commands/new");
28
28
  const guide_1 = require("./commands/guide");
29
29
  const upgrade_1 = require("./commands/upgrade");
30
+ const goal_1 = require("./commands/goal");
30
31
  const event_1 = require("./commands/event");
31
32
  const skill_1 = require("./commands/skill");
32
33
  const task_1 = require("./commands/task");
@@ -65,6 +66,7 @@ function printUsage(log) {
65
66
  log(" bundle Create, list, show, and verify full graph snapshot bundles");
66
67
  log(" subgraph Register and verify read-only child graph snapshots");
67
68
  log(" work Create and update work contracts, orders, receipts, and artifacts");
69
+ log(" goal Inspect and advance recursive goal nodes");
68
70
  log(" task Start, update, and complete task-like nodes");
69
71
  log(" next Suggest the next work item");
70
72
  log(" validate Validate frontmatter + graph");
@@ -126,7 +128,7 @@ function printNewHelp(log) {
126
128
  log("Usage:");
127
129
  log(' mdkg new <type> "<title>" [options] [--json]');
128
130
  log("\nTypes:");
129
- log(" rule prd edd dec prop epic feat task bug checkpoint test");
131
+ log(" rule prd edd dec prop goal epic feat task bug checkpoint test");
130
132
  log("\nAgent workflow file types:");
131
133
  log(" spec work work_order receipt feedback dispute proposal");
132
134
  log(" Use --id <portable-id> with these types for semantic ids like agent.image-worker.");
@@ -545,6 +547,86 @@ function printTaskHelp(log, subcommand) {
545
547
  printGlobalOptions(log);
546
548
  }
547
549
  }
550
+ function printGoalHelp(log, subcommand) {
551
+ switch ((subcommand ?? "").toLowerCase()) {
552
+ case "show":
553
+ log("Usage:");
554
+ log(" mdkg goal show <goal-id-or-qid> [--ws <alias>] [--json]");
555
+ log("\nWhen to use:");
556
+ log(" Inspect a goal condition, current goal state, active node, required skills, and required checks.");
557
+ printGlobalOptions(log);
558
+ return;
559
+ case "next":
560
+ log("Usage:");
561
+ log(" mdkg goal next [goal-id-or-qid] [--ws <alias>] [--json]");
562
+ log("\nWhen to use:");
563
+ log(" Select the next local feature, task, bug, or test inside a recursive goal without mutating active_node.");
564
+ log(" If no goal id is supplied, mdkg uses the selected goal or the unique active goal.");
565
+ printGlobalOptions(log);
566
+ return;
567
+ case "select":
568
+ log("Usage:");
569
+ log(" mdkg goal select <goal-id-or-qid> [--ws <alias>] [--json]");
570
+ log("\nWhen to use:");
571
+ log(" Store a local selected goal so `mdkg goal next` can omit the goal id.");
572
+ printGlobalOptions(log);
573
+ return;
574
+ case "current":
575
+ log("Usage:");
576
+ log(" mdkg goal current [--ws <alias>] [--json]");
577
+ log("\nWhen to use:");
578
+ log(" Inspect the selected goal or unique active goal fallback.");
579
+ printGlobalOptions(log);
580
+ return;
581
+ case "clear":
582
+ log("Usage:");
583
+ log(" mdkg goal clear [--json]");
584
+ log("\nWhen to use:");
585
+ log(" Remove local selected-goal state.");
586
+ printGlobalOptions(log);
587
+ return;
588
+ case "claim":
589
+ log("Usage:");
590
+ log(" mdkg goal claim <work-id-or-qid> [--ws <alias>] [--json]");
591
+ log(" mdkg goal claim <goal-id-or-qid> <work-id-or-qid> [--ws <alias>] [--json]");
592
+ log("\nWhen to use:");
593
+ log(" Write active_node explicitly after accepting a goal-scoped next item.");
594
+ printGlobalOptions(log);
595
+ return;
596
+ case "evaluate":
597
+ log("Usage:");
598
+ log(" mdkg goal evaluate <goal-id-or-qid> [--ws <alias>] [--json]");
599
+ log("\nNotes:");
600
+ log(" Evaluation is report-only; mdkg lists required checks but does not execute scripts.");
601
+ printGlobalOptions(log);
602
+ return;
603
+ case "pause":
604
+ case "resume":
605
+ case "done":
606
+ log("Usage:");
607
+ log(` mdkg goal ${subcommand} <goal-id-or-qid> [--ws <alias>] [--json]`);
608
+ log("\nWhen to use:");
609
+ log(" Update durable goal state after agent or human review.");
610
+ printGlobalOptions(log);
611
+ return;
612
+ default:
613
+ log("Usage:");
614
+ log(" mdkg goal show <goal-id-or-qid> [--json]");
615
+ log(" mdkg goal select <goal-id-or-qid> [--json]");
616
+ log(" mdkg goal current [--json]");
617
+ log(" mdkg goal next [goal-id-or-qid] [--json]");
618
+ log(" mdkg goal claim [goal-id-or-qid] <work-id-or-qid> [--json]");
619
+ log(" mdkg goal evaluate <goal-id-or-qid> [--json]");
620
+ log(" mdkg goal clear [--json]");
621
+ log(" mdkg goal pause|resume|done <goal-id-or-qid> [--json]");
622
+ log("\nNotes:");
623
+ log(" - goals orchestrate recursive progress; features, tasks, bugs, and tests are iterable work units");
624
+ log(" - `mdkg goal next` is read-only; use `mdkg goal claim` to update active_node");
625
+ log(" - goal evaluation is report-only and never executes required_checks");
626
+ log(" - subgraph goal qids are read-only; update the source workspace instead");
627
+ printGlobalOptions(log);
628
+ }
629
+ }
548
630
  function printEventHelp(log, subcommand) {
549
631
  switch ((subcommand ?? "").toLowerCase()) {
550
632
  case "enable":
@@ -665,6 +747,9 @@ function printCommandHelp(log, command, subcommand) {
665
747
  case "task":
666
748
  printTaskHelp(log, subcommand);
667
749
  return;
750
+ case "goal":
751
+ printGoalHelp(log, subcommand);
752
+ return;
668
753
  case "event":
669
754
  printEventHelp(log, subcommand);
670
755
  return;
@@ -1406,6 +1491,92 @@ function runSkillSubcommand(parsed, root) {
1406
1491
  throw new errors_1.UsageError("skill requires new/list/show/search/validate/sync");
1407
1492
  }
1408
1493
  }
1494
+ function runGoalSubcommand(parsed, root) {
1495
+ const subcommand = (parsed.positionals[1] ?? "").toLowerCase();
1496
+ const ws = requireFlagValue("--ws", parsed.flags["--ws"]);
1497
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
1498
+ switch (subcommand) {
1499
+ case "show": {
1500
+ const id = parsed.positionals[2];
1501
+ if (!id || parsed.positionals.length > 3) {
1502
+ throw new errors_1.UsageError("goal show requires <goal-id-or-qid>");
1503
+ }
1504
+ (0, goal_1.runGoalShowCommand)({ root, id, ws, json });
1505
+ return 0;
1506
+ }
1507
+ case "select": {
1508
+ const id = parsed.positionals[2];
1509
+ if (!id || parsed.positionals.length > 3) {
1510
+ throw new errors_1.UsageError("goal select requires <goal-id-or-qid>");
1511
+ }
1512
+ (0, goal_1.runGoalSelectCommand)({ root, id, ws, json });
1513
+ return 0;
1514
+ }
1515
+ case "current":
1516
+ if (parsed.positionals.length > 2) {
1517
+ throw new errors_1.UsageError("goal current does not accept positional arguments");
1518
+ }
1519
+ (0, goal_1.runGoalCurrentCommand)({ root, ws, json });
1520
+ return 0;
1521
+ case "clear":
1522
+ if (parsed.positionals.length > 2) {
1523
+ throw new errors_1.UsageError("goal clear does not accept positional arguments");
1524
+ }
1525
+ (0, goal_1.runGoalClearCommand)({ root, json });
1526
+ return 0;
1527
+ case "next": {
1528
+ const id = parsed.positionals[2];
1529
+ if (parsed.positionals.length > 3) {
1530
+ throw new errors_1.UsageError("goal next accepts at most one goal id");
1531
+ }
1532
+ (0, goal_1.runGoalNextCommand)({ root, id, ws, json });
1533
+ return 0;
1534
+ }
1535
+ case "claim": {
1536
+ const first = parsed.positionals[2];
1537
+ const second = parsed.positionals[3];
1538
+ if (!first || parsed.positionals.length > 4) {
1539
+ throw new errors_1.UsageError("goal claim requires <work-id-or-qid> or <goal-id-or-qid> <work-id-or-qid>");
1540
+ }
1541
+ (0, goal_1.runGoalClaimCommand)({ root, id: second ? first : undefined, workId: second ?? first, ws, json });
1542
+ return 0;
1543
+ }
1544
+ case "evaluate": {
1545
+ const id = parsed.positionals[2];
1546
+ if (!id || parsed.positionals.length > 3) {
1547
+ throw new errors_1.UsageError("goal evaluate requires <goal-id-or-qid>");
1548
+ }
1549
+ (0, goal_1.runGoalEvaluateCommand)({ root, id, ws, json });
1550
+ return 0;
1551
+ }
1552
+ case "pause": {
1553
+ const id = parsed.positionals[2];
1554
+ if (!id || parsed.positionals.length > 3) {
1555
+ throw new errors_1.UsageError("goal pause requires <goal-id-or-qid>");
1556
+ }
1557
+ (0, goal_1.runGoalPauseCommand)({ root, id, ws, json });
1558
+ return 0;
1559
+ }
1560
+ case "resume": {
1561
+ const id = parsed.positionals[2];
1562
+ if (!id || parsed.positionals.length > 3) {
1563
+ throw new errors_1.UsageError("goal resume requires <goal-id-or-qid>");
1564
+ }
1565
+ (0, goal_1.runGoalResumeCommand)({ root, id, ws, json });
1566
+ return 0;
1567
+ }
1568
+ case "done": {
1569
+ const id = parsed.positionals[2];
1570
+ if (!id || parsed.positionals.length > 3) {
1571
+ throw new errors_1.UsageError("goal done requires <goal-id-or-qid>");
1572
+ }
1573
+ (0, goal_1.runGoalDoneCommand)({ root, id, ws, json });
1574
+ return 0;
1575
+ }
1576
+ default:
1577
+ throw new errors_1.UsageError("goal requires show/select/current/clear/next/claim/evaluate/pause/resume/done");
1578
+ }
1579
+ }
1409
1580
  function runTaskSubcommand(parsed, root) {
1410
1581
  const subcommand = (parsed.positionals[1] ?? "").toLowerCase();
1411
1582
  switch (subcommand) {
@@ -1663,6 +1834,8 @@ function runCommand(parsed, root, runtime) {
1663
1834
  return runSubgraphSubcommand(parsed, root);
1664
1835
  case "work":
1665
1836
  return runWorkSubcommand(parsed, root);
1837
+ case "goal":
1838
+ return runGoalSubcommand(parsed, root);
1666
1839
  case "task":
1667
1840
  return runTaskSubcommand(parsed, root);
1668
1841
  case "event":