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 +18 -0
- package/README.md +24 -1
- package/dist/cli.js +174 -1
- package/dist/commands/goal.js +548 -0
- package/dist/commands/init.js +1 -0
- package/dist/commands/new.js +7 -1
- package/dist/commands/upgrade.js +3 -3
- package/dist/commands/validate.js +33 -1
- package/dist/graph/frontmatter.js +8 -0
- package/dist/graph/goal_scope.js +127 -0
- package/dist/graph/node.js +80 -1
- package/dist/graph/validate_graph.js +41 -0
- package/dist/init/AGENT_START.md +15 -0
- package/dist/init/CLI_COMMAND_MATRIX.md +27 -0
- package/dist/init/README.md +1 -1
- package/dist/init/core/rule-3-cli-contract.md +26 -0
- package/dist/init/core/rule-4-repo-safety-and-ignores.md +6 -1
- package/dist/init/core/rule-6-templates-and-schemas.md +10 -1
- package/dist/init/init-manifest.json +19 -9
- package/dist/init/skills/default/pursue-mdkg-goal/SKILL.md +68 -0
- package/dist/init/skills/default/select-work-and-ground-context/SKILL.md +9 -7
- package/dist/init/skills/default/verify-close-and-checkpoint/SKILL.md +10 -9
- package/dist/init/templates/default/goal.md +91 -0
- package/dist/pack/order.js +2 -1
- package/dist/pack/pack.js +17 -0
- package/package.json +3 -2
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pursue-mdkg-goal
|
|
3
|
+
description: Pursue a selected mdkg goal by repeatedly selecting one scoped work item, executing it with evidence, and evaluating the goal until done, blocked, paused, or budget-limited.
|
|
4
|
+
tags: [stage:execute, writer:orchestrator, mdkg, goal, recursive]
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
authors: [mdkg]
|
|
7
|
+
links: [AGENT_START.md, CLI_COMMAND_MATRIX.md, .mdkg/design/prd-3-mdkg-goal-node-ux-and-agent-harness-contract.md, .mdkg/design/edd-10-mdkg-goal-node-architecture-and-recursive-agent-loop.md]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Goal
|
|
11
|
+
|
|
12
|
+
Move one durable mdkg goal forward without losing scope, evidence, or user intent.
|
|
13
|
+
|
|
14
|
+
## When To Use
|
|
15
|
+
|
|
16
|
+
- A user has selected or named an mdkg goal.
|
|
17
|
+
- A long-running objective needs one concrete next work item at a time.
|
|
18
|
+
- Goal progress should improve the graph while keeping skill changes controlled.
|
|
19
|
+
|
|
20
|
+
## Inputs
|
|
21
|
+
|
|
22
|
+
- Optional goal id or qid.
|
|
23
|
+
- Current selected goal state from `mdkg goal current`.
|
|
24
|
+
- The goal node, scoped work nodes, required skills, and required checks.
|
|
25
|
+
- User constraints, budget, and stop conditions.
|
|
26
|
+
|
|
27
|
+
## Steps
|
|
28
|
+
|
|
29
|
+
1. Resolve the goal:
|
|
30
|
+
- If a goal id is provided, run `mdkg goal select <goal-id>`.
|
|
31
|
+
- Otherwise run `mdkg goal current`.
|
|
32
|
+
- If the result is missing or ambiguous, ask the user to select a goal.
|
|
33
|
+
2. Inspect the goal with `mdkg goal show <goal-id>` and build context with `mdkg pack <goal-id>`.
|
|
34
|
+
3. Run `mdkg goal next` to surface exactly one scoped feature, task, bug, or test.
|
|
35
|
+
4. If `goal next` returns no node, evaluate the goal with `mdkg goal evaluate <goal-id>` and report whether completion, blocker, or new-node creation is needed.
|
|
36
|
+
5. Before coding, run `mdkg goal claim <work-id>` to set `active_node` when the surfaced node is accepted.
|
|
37
|
+
6. Work only the claimed node to completion. Do not expand into unrelated urgent work.
|
|
38
|
+
7. Run the required technical checks yourself. mdkg goal required checks are report-only; mdkg does not execute them.
|
|
39
|
+
8. Record evidence on the active work node, then evaluate the goal with `mdkg goal evaluate <goal-id>`.
|
|
40
|
+
9. Repeat steps 3-8 until the goal condition is achieved, blocked, paused, budget-limited, or the user stops the run.
|
|
41
|
+
|
|
42
|
+
## Skill Improvement Candidates
|
|
43
|
+
|
|
44
|
+
- During normal goal execution, record skill improvement ideas in the goal body or a proposal node.
|
|
45
|
+
- Edit `SKILL.md` files only when the active node is explicitly skill-maintenance work.
|
|
46
|
+
- After intentional skill edits, run `mdkg skill sync`, `mdkg skill validate`, `mdkg index`, and `mdkg validate`.
|
|
47
|
+
|
|
48
|
+
## Outputs
|
|
49
|
+
|
|
50
|
+
- One active scoped work item at a time.
|
|
51
|
+
- Evidence recorded on the active node and summarized on the goal when useful.
|
|
52
|
+
- Required checks reported with pass/fail status.
|
|
53
|
+
- A clear stop reason: continue, achieved, blocked, paused, or budget-limited.
|
|
54
|
+
|
|
55
|
+
## Safety
|
|
56
|
+
|
|
57
|
+
- `mdkg goal next` is read-only; do not treat it as a claim.
|
|
58
|
+
- `mdkg goal claim` is the durable `active_node` mutation.
|
|
59
|
+
- Do not mutate subgraph/imported qids; update the owning source workspace.
|
|
60
|
+
- Do not create missing nodes without evidence that the current goal scope needs them.
|
|
61
|
+
- Do not edit skills opportunistically while pursuing product or code work.
|
|
62
|
+
|
|
63
|
+
## Failure Handling
|
|
64
|
+
|
|
65
|
+
- If selection is ambiguous, ask for a goal instead of guessing.
|
|
66
|
+
- If scoped work is missing, create a proposal or task only after explaining the gap.
|
|
67
|
+
- If checks fail, keep the active node open and record the failure evidence.
|
|
68
|
+
- If repeated attempts hit the same blocker, mark the goal blocked or ask for direction.
|
|
@@ -26,13 +26,15 @@ Choose the correct work item and load the smallest deterministic context needed
|
|
|
26
26
|
## Steps
|
|
27
27
|
|
|
28
28
|
1. If a task id is already known, inspect it with `mdkg show <id>`.
|
|
29
|
-
2. If
|
|
30
|
-
3.
|
|
31
|
-
4.
|
|
32
|
-
5.
|
|
33
|
-
6.
|
|
34
|
-
7. If
|
|
35
|
-
8.
|
|
29
|
+
2. If a goal may be active, run `mdkg goal current`.
|
|
30
|
+
3. If a selected or unique active goal exists, use `mdkg goal next` to surface one scoped feature, task, bug, or test before falling back to global work discovery.
|
|
31
|
+
4. If the task is not known and no goal is active, read `AGENT_START.md` and use `mdkg next` or `mdkg search "<query>"` to narrow candidates.
|
|
32
|
+
5. Use `mdkg show <id> --meta` when you only need the card and link metadata.
|
|
33
|
+
6. Confirm the selected node has the right constraints, related design docs, and current status.
|
|
34
|
+
7. If the task is ambiguous, resolve that before building a pack.
|
|
35
|
+
8. If the chosen task is ready to be claimed in a goal, hand off to `mdkg goal claim <id>` in the writer stage; otherwise hand off to `mdkg task start <id>` for task-like status changes.
|
|
36
|
+
9. If resuming closeout work for a feat or epic, inspect the latest relevant checkpoint before deciding what remains open.
|
|
37
|
+
10. Treat this stage as read-only: inspect and decide, but do not mutate mdkg state or commit.
|
|
36
38
|
|
|
37
39
|
## Outputs
|
|
38
40
|
|
|
@@ -30,15 +30,16 @@ Finish work with evidence, validation, and minimal memory drift.
|
|
|
30
30
|
2. Run `mdkg validate` before closing the task.
|
|
31
31
|
3. For mdkg scaffold or release work, include `mdkg upgrade` dry-run/apply evidence and any package smoke that exercises upgrade behavior.
|
|
32
32
|
4. Use `mdkg task update <id> ...` for additive evidence and structured metadata changes; keep narrative/body edits in markdown.
|
|
33
|
-
5.
|
|
34
|
-
6.
|
|
35
|
-
7.
|
|
36
|
-
8.
|
|
37
|
-
9.
|
|
38
|
-
10.
|
|
39
|
-
11.
|
|
40
|
-
12.
|
|
41
|
-
13. If
|
|
33
|
+
5. When pursuing a goal, record evidence on the active node and summarize goal evidence before running `mdkg goal evaluate <goal-id>`.
|
|
34
|
+
6. Use `mdkg task done <id> --checkpoint "<title>"` when the task should close with milestone compression.
|
|
35
|
+
7. Batch durable mdkg writes at one boundary: task status, artifact refs, optional checkpoint, goal evidence, and commit.
|
|
36
|
+
8. Mark tasks done only after evidence exists.
|
|
37
|
+
9. Create a checkpoint only for milestone-level transitions, not every small step.
|
|
38
|
+
10. For feat or epic closeout, prefer a checkpoint body as the durable narrative summary of what changed and what is next.
|
|
39
|
+
11. Use feat closeout scope as direct children with `parent: <feat-id>` and epic closeout scope as descendant work with `epic: <epic-id>`.
|
|
40
|
+
12. Parent status edits remain manual; do not invent a hidden parent-closeout workflow.
|
|
41
|
+
13. If the latest checkpoint is relevant, use it as durable recall; treat raw events as provenance/debugging, not primary execution context.
|
|
42
|
+
14. If `events.jsonl` is missing, recreate it with `mdkg event enable` before expecting automatic JSONL provenance.
|
|
42
43
|
|
|
43
44
|
## Pre-Publish Release Gate
|
|
44
45
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: {{id}}
|
|
3
|
+
type: goal
|
|
4
|
+
title: {{title}}
|
|
5
|
+
status: {{status}}
|
|
6
|
+
priority: {{priority}}
|
|
7
|
+
goal_state: {{goal_state}}
|
|
8
|
+
goal_condition: {{goal_condition}}
|
|
9
|
+
scope_refs: []
|
|
10
|
+
active_node: {{active_node}}
|
|
11
|
+
required_skills: []
|
|
12
|
+
required_checks: []
|
|
13
|
+
max_iterations: {{max_iterations}}
|
|
14
|
+
blocked_after_attempts: {{blocked_after_attempts}}
|
|
15
|
+
epic: {{epic}}
|
|
16
|
+
parent: {{parent}}
|
|
17
|
+
prev: {{prev}}
|
|
18
|
+
next: {{next}}
|
|
19
|
+
tags: []
|
|
20
|
+
owners: []
|
|
21
|
+
links: []
|
|
22
|
+
artifacts: []
|
|
23
|
+
relates: []
|
|
24
|
+
blocked_by: []
|
|
25
|
+
blocks: []
|
|
26
|
+
refs: []
|
|
27
|
+
aliases: []
|
|
28
|
+
skills: []
|
|
29
|
+
created: {{created}}
|
|
30
|
+
updated: {{updated}}
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
# Objective
|
|
34
|
+
|
|
35
|
+
State the durable objective the agent should pursue.
|
|
36
|
+
|
|
37
|
+
# End Condition
|
|
38
|
+
|
|
39
|
+
Define the exact measurable condition that makes this goal achieved.
|
|
40
|
+
|
|
41
|
+
# Non-Goals
|
|
42
|
+
|
|
43
|
+
- Out-of-scope item
|
|
44
|
+
|
|
45
|
+
# Recursive Algorithm
|
|
46
|
+
|
|
47
|
+
1. Inspect the current goal state, relevant graph nodes, and required skills.
|
|
48
|
+
2. Create missing mdkg nodes only when evidence shows they are needed.
|
|
49
|
+
3. Select one concrete child node and work it to completion.
|
|
50
|
+
4. Run required checks and record evidence.
|
|
51
|
+
5. Re-evaluate the end condition and continue, pause, or close.
|
|
52
|
+
|
|
53
|
+
# Required Skills
|
|
54
|
+
|
|
55
|
+
- Skill slug
|
|
56
|
+
|
|
57
|
+
# Required Checks
|
|
58
|
+
|
|
59
|
+
- Command or verification gate
|
|
60
|
+
|
|
61
|
+
# Acceptance Criteria
|
|
62
|
+
|
|
63
|
+
- Criterion
|
|
64
|
+
|
|
65
|
+
# Definition Of Done
|
|
66
|
+
|
|
67
|
+
- Goal condition is achieved.
|
|
68
|
+
- Required checks have evidence.
|
|
69
|
+
- Completion evidence is recorded in the goal.
|
|
70
|
+
|
|
71
|
+
# Stop Conditions
|
|
72
|
+
|
|
73
|
+
- Goal is blocked beyond the configured attempt limit.
|
|
74
|
+
- Required context or permissions are missing.
|
|
75
|
+
- Budget or safety constraints prevent continued work.
|
|
76
|
+
|
|
77
|
+
# Current State
|
|
78
|
+
|
|
79
|
+
Record the current active node and any relevant state summary.
|
|
80
|
+
|
|
81
|
+
# Iteration Log
|
|
82
|
+
|
|
83
|
+
- No iterations recorded yet.
|
|
84
|
+
|
|
85
|
+
# Skill Improvement Candidates
|
|
86
|
+
|
|
87
|
+
- None yet.
|
|
88
|
+
|
|
89
|
+
# Completion Evidence
|
|
90
|
+
|
|
91
|
+
- Pending.
|
package/dist/pack/order.js
CHANGED
|
@@ -16,13 +16,14 @@ const FALLBACK_TYPES = [
|
|
|
16
16
|
"dispute",
|
|
17
17
|
"proposal",
|
|
18
18
|
"archive",
|
|
19
|
+
"goal",
|
|
19
20
|
"epic",
|
|
20
21
|
"feat",
|
|
21
22
|
"task",
|
|
22
23
|
"bug",
|
|
23
24
|
"checkpoint",
|
|
24
25
|
];
|
|
25
|
-
const WORK_TYPES = ["epic", "feat", "task", "bug", "checkpoint"];
|
|
26
|
+
const WORK_TYPES = ["goal", "epic", "feat", "task", "bug", "checkpoint"];
|
|
26
27
|
function idNumber(id) {
|
|
27
28
|
const match = id.match(/-(\d+)$/);
|
|
28
29
|
if (!match) {
|
package/dist/pack/pack.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildPack = buildPack;
|
|
4
|
+
const goal_scope_1 = require("../graph/goal_scope");
|
|
4
5
|
const node_body_1 = require("../graph/node_body");
|
|
5
6
|
const qid_1 = require("../util/qid");
|
|
6
7
|
const order_1 = require("./order");
|
|
@@ -153,6 +154,22 @@ function buildPack(options) {
|
|
|
153
154
|
const warnings = [];
|
|
154
155
|
const includeLatestCheckpoint = options.includeLatestCheckpoint ?? true;
|
|
155
156
|
const { qids, depths } = collectNodes(options.index, options.rootQid, options.depth, options.edges);
|
|
157
|
+
const rootNode = options.index.nodes[options.rootQid];
|
|
158
|
+
if (rootNode?.type === "goal") {
|
|
159
|
+
const scoped = (0, goal_scope_1.collectGoalScope)(options.index, rootNode);
|
|
160
|
+
for (const qid of scoped.qids) {
|
|
161
|
+
qids.add(qid);
|
|
162
|
+
if (!depths.has(qid)) {
|
|
163
|
+
depths.set(qid, 1);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
for (const missing of scoped.missingRefs) {
|
|
167
|
+
mergeWarnings(warnings, `goal scope ref missing: ${missing}`);
|
|
168
|
+
}
|
|
169
|
+
for (const invalid of scoped.invalidRefs) {
|
|
170
|
+
mergeWarnings(warnings, `goal scope ref unsupported: ${invalid}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
156
173
|
const workspace = checkpointWorkspaceFromQid(options.rootQid);
|
|
157
174
|
const latestCheckpointHint = options.index.meta.latest_checkpoint_qid?.[workspace];
|
|
158
175
|
const latestCheckpointResolved = includeLatestCheckpoint
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdkg",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Markdown Knowledge Graph",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -22,10 +22,11 @@
|
|
|
22
22
|
"smoke:visibility": "npm run build && node scripts/smoke-visibility.js",
|
|
23
23
|
"smoke:sqlite": "npm run build && node scripts/smoke-sqlite.js",
|
|
24
24
|
"smoke:parallel": "npm run build && node scripts/smoke-parallel.js",
|
|
25
|
+
"smoke:goal": "npm run build && node scripts/smoke-goal.js",
|
|
25
26
|
"cli:snapshot": "npm run build && node scripts/cli_help_snapshot.js",
|
|
26
27
|
"cli:check": "npm run build && node scripts/cli_help_snapshot.js --check",
|
|
27
28
|
"prepack": "npm run build && node scripts/assert-publish-ready.js",
|
|
28
|
-
"prepublishOnly": "npm run test && npm run cli:check && node dist/cli.js validate && npm run smoke:consumer && npm run smoke:matrix && npm run smoke:upgrade && npm run smoke:init && npm run smoke:capabilities && npm run smoke:archive-work && npm run smoke:bundle && npm run smoke:subgraph && npm run smoke:visibility && npm run smoke:sqlite && npm run smoke:parallel && node scripts/assert-publish-ready.js",
|
|
29
|
+
"prepublishOnly": "npm run test && npm run cli:check && node dist/cli.js validate && npm run smoke:consumer && npm run smoke:matrix && npm run smoke:upgrade && npm run smoke:init && npm run smoke:capabilities && npm run smoke:archive-work && npm run smoke:bundle && npm run smoke:subgraph && npm run smoke:visibility && npm run smoke:sqlite && npm run smoke:parallel && npm run smoke:goal && node scripts/assert-publish-ready.js",
|
|
29
30
|
"postinstall": "node scripts/postinstall.js",
|
|
30
31
|
"smoke:subgraph": "npm run build && node scripts/smoke-subgraph.js"
|
|
31
32
|
},
|