mdkg 0.0.7 → 0.0.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.
- package/CHANGELOG.md +56 -0
- package/CONTRIBUTING.md +124 -0
- package/README.md +33 -10
- package/dist/cli.js +80 -32
- package/dist/commands/checkpoint.js +19 -2
- package/dist/commands/event.js +12 -0
- package/dist/commands/new.js +50 -4
- package/dist/commands/pack.js +14 -0
- package/dist/commands/query_output.js +2 -0
- package/dist/commands/search.js +8 -0
- package/dist/commands/show.js +7 -0
- package/dist/commands/skill.js +80 -12
- package/dist/commands/task.js +41 -4
- package/dist/commands/validate.js +31 -3
- package/dist/commands/workspace.js +105 -13
- package/dist/core/config.js +217 -22
- package/dist/core/migrate.js +39 -5
- package/dist/core/workspace_path.js +41 -0
- package/dist/graph/agent_file_types.js +392 -0
- package/dist/graph/edges.js +13 -10
- package/dist/graph/frontmatter.js +33 -0
- package/dist/graph/indexer.js +1 -0
- package/dist/graph/node.js +21 -5
- package/dist/graph/skills_indexer.js +14 -1
- package/dist/graph/validate_graph.js +302 -2
- package/dist/init/AGENT_START.md +13 -0
- package/dist/init/CLI_COMMAND_MATRIX.md +43 -1
- package/dist/init/README.md +7 -0
- package/dist/init/skills/default/verify-close-and-checkpoint/SKILL.md +1 -1
- package/dist/init/templates/default/dispute.md +31 -0
- package/dist/init/templates/default/feedback.md +27 -0
- package/dist/init/templates/default/proposal.md +35 -0
- package/dist/init/templates/default/receipt.md +31 -0
- package/dist/init/templates/default/spec.md +43 -0
- package/dist/init/templates/default/work.md +44 -0
- package/dist/init/templates/default/work_order.md +32 -0
- package/dist/pack/export_json.js +3 -0
- package/dist/pack/export_md.js +9 -0
- package/dist/pack/export_xml.js +9 -0
- package/dist/pack/order.js +7 -0
- package/dist/pack/pack.js +1 -0
- package/dist/util/argparse.js +1 -0
- package/dist/util/id.js +19 -0
- package/package.json +9 -2
- package/scripts/postinstall.js +89 -0
|
@@ -9,7 +9,7 @@ function pushError(errors, message) {
|
|
|
9
9
|
}
|
|
10
10
|
throw new Error(message);
|
|
11
11
|
}
|
|
12
|
-
function validateEdgeTargets(index, allowMissing, errors) {
|
|
12
|
+
function validateEdgeTargets(index, allowMissing, knownSkillSlugs, errors) {
|
|
13
13
|
const nodes = index.nodes;
|
|
14
14
|
for (const [qid, node] of Object.entries(nodes)) {
|
|
15
15
|
const edges = node.edges;
|
|
@@ -33,6 +33,12 @@ function validateEdgeTargets(index, allowMissing, errors) {
|
|
|
33
33
|
for (const [edgeKey, values] of edgeLists) {
|
|
34
34
|
for (const value of values) {
|
|
35
35
|
if (!nodes[value]) {
|
|
36
|
+
if (edgeKey === "relates" &&
|
|
37
|
+
node.type === "proposal" &&
|
|
38
|
+
node.attributes.proposal_kind === "skill_update" &&
|
|
39
|
+
validateSkillRef(qid, edgeKey, value, knownSkillSlugs, allowMissing, errors)) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
36
42
|
if (allowMissing) {
|
|
37
43
|
continue;
|
|
38
44
|
}
|
|
@@ -42,6 +48,25 @@ function validateEdgeTargets(index, allowMissing, errors) {
|
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
}
|
|
51
|
+
const SKILL_DOT_REF_RE = /^skill\.([a-z0-9]+(?:-[a-z0-9]+)*)$/;
|
|
52
|
+
function skillSlugFromDotRef(value) {
|
|
53
|
+
const localValue = value.includes(":") ? value.split(":").pop() ?? value : value;
|
|
54
|
+
return SKILL_DOT_REF_RE.exec(localValue)?.[1];
|
|
55
|
+
}
|
|
56
|
+
function validateSkillRef(qid, field, value, knownSkillSlugs, allowMissing, errors) {
|
|
57
|
+
const slug = skillSlugFromDotRef(value);
|
|
58
|
+
if (!slug) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
if (knownSkillSlugs === undefined || knownSkillSlugs.has(slug)) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
if (allowMissing) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
pushError(errors, `${qid}: ${field} references missing skill ${value}`);
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
45
70
|
function validatePrevNextSymmetry(index, _allowMissing, errors) {
|
|
46
71
|
const nodes = index.nodes;
|
|
47
72
|
for (const [qid, node] of Object.entries(nodes)) {
|
|
@@ -66,6 +91,274 @@ function validatePrevNextSymmetry(index, _allowMissing, errors) {
|
|
|
66
91
|
}
|
|
67
92
|
}
|
|
68
93
|
}
|
|
94
|
+
function normalizeDocPath(value) {
|
|
95
|
+
return value.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
96
|
+
}
|
|
97
|
+
function pathEndsWithContractRef(nodePath, contractRef) {
|
|
98
|
+
const normalizedNodePath = normalizeDocPath(nodePath);
|
|
99
|
+
const normalizedContractRef = normalizeDocPath(contractRef);
|
|
100
|
+
return (normalizedNodePath === normalizedContractRef ||
|
|
101
|
+
normalizedNodePath.endsWith(`/${normalizedContractRef}`));
|
|
102
|
+
}
|
|
103
|
+
function validateAgentWorkflowSpecWorkContracts(index, allowMissing, errors) {
|
|
104
|
+
const workNodesByWorkspace = {};
|
|
105
|
+
for (const node of Object.values(index.nodes)) {
|
|
106
|
+
if (node.type !== "work") {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (!workNodesByWorkspace[node.ws]) {
|
|
110
|
+
workNodesByWorkspace[node.ws] = [];
|
|
111
|
+
}
|
|
112
|
+
workNodesByWorkspace[node.ws].push({
|
|
113
|
+
qid: node.qid,
|
|
114
|
+
path: node.path,
|
|
115
|
+
agentId: typeof node.attributes.agent_id === "string" ? node.attributes.agent_id : undefined,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
for (const [qid, node] of Object.entries(index.nodes)) {
|
|
119
|
+
if (node.type !== "spec") {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const workContracts = node.attributes.work_contracts;
|
|
123
|
+
if (!Array.isArray(workContracts)) {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const workspaceWorkNodes = workNodesByWorkspace[node.ws] ?? [];
|
|
127
|
+
for (const [indexValue, value] of workContracts.entries()) {
|
|
128
|
+
if (typeof value !== "string") {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
const matches = workspaceWorkNodes.filter((workNode) => pathEndsWithContractRef(workNode.path, value));
|
|
132
|
+
if (matches.length === 0) {
|
|
133
|
+
if (allowMissing) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
pushError(errors, `${qid}: work_contracts[${indexValue}] references missing WORK.md ${value}`);
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (matches.length > 1) {
|
|
140
|
+
pushError(errors, `${qid}: work_contracts[${indexValue}] ambiguously matches ${matches
|
|
141
|
+
.map((match) => match.qid)
|
|
142
|
+
.sort()
|
|
143
|
+
.join(", ")}`);
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
const matchedWorkNode = matches[0];
|
|
147
|
+
if (matchedWorkNode.agentId !== undefined && matchedWorkNode.agentId !== node.id) {
|
|
148
|
+
pushError(errors, `${qid}: work_contracts[${indexValue}] references ${matchedWorkNode.qid} owned by agent_id ${matchedWorkNode.agentId}, not ${node.id}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function validateAgentWorkflowWorkOrderWorkRefs(index, allowMissing, errors) {
|
|
154
|
+
const workNodesByWorkspaceAndId = {};
|
|
155
|
+
for (const node of Object.values(index.nodes)) {
|
|
156
|
+
if (node.type !== "work") {
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (!workNodesByWorkspaceAndId[node.ws]) {
|
|
160
|
+
workNodesByWorkspaceAndId[node.ws] = {};
|
|
161
|
+
}
|
|
162
|
+
workNodesByWorkspaceAndId[node.ws][node.id] = {
|
|
163
|
+
qid: node.qid,
|
|
164
|
+
version: typeof node.attributes.version === "string" ? node.attributes.version : undefined,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
for (const [qid, node] of Object.entries(index.nodes)) {
|
|
168
|
+
if (node.type !== "work_order") {
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
const workId = node.attributes.work_id;
|
|
172
|
+
if (typeof workId !== "string") {
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
const workNode = workNodesByWorkspaceAndId[node.ws]?.[workId];
|
|
176
|
+
if (!workNode) {
|
|
177
|
+
if (allowMissing) {
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
pushError(errors, `${qid}: work_id references missing WORK.md ${workId}`);
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
const workVersion = node.attributes.work_version;
|
|
184
|
+
if (typeof workVersion === "string" &&
|
|
185
|
+
workNode.version !== undefined &&
|
|
186
|
+
workVersion !== workNode.version) {
|
|
187
|
+
pushError(errors, `${qid}: work_version ${workVersion} does not match ${workNode.qid} version ${workNode.version}`);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function validateAgentWorkflowReceiptWorkOrderRefs(index, allowMissing, errors) {
|
|
192
|
+
const workOrderIdsByWorkspace = {};
|
|
193
|
+
for (const node of Object.values(index.nodes)) {
|
|
194
|
+
if (node.type !== "work_order") {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (!workOrderIdsByWorkspace[node.ws]) {
|
|
198
|
+
workOrderIdsByWorkspace[node.ws] = new Set();
|
|
199
|
+
}
|
|
200
|
+
workOrderIdsByWorkspace[node.ws].add(node.id);
|
|
201
|
+
}
|
|
202
|
+
for (const [qid, node] of Object.entries(index.nodes)) {
|
|
203
|
+
if (node.type !== "receipt") {
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
const workOrderId = node.attributes.work_order_id;
|
|
207
|
+
if (typeof workOrderId !== "string") {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
if (workOrderIdsByWorkspace[node.ws]?.has(workOrderId)) {
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
if (allowMissing) {
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
pushError(errors, `${qid}: work_order_id references missing WORK_ORDER.md ${workOrderId}`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function buildSpecRolesByWorkspace(index) {
|
|
220
|
+
const specRolesByWorkspace = {};
|
|
221
|
+
for (const node of Object.values(index.nodes)) {
|
|
222
|
+
if (node.type !== "spec") {
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
if (!specRolesByWorkspace[node.ws]) {
|
|
226
|
+
specRolesByWorkspace[node.ws] = {};
|
|
227
|
+
}
|
|
228
|
+
specRolesByWorkspace[node.ws][node.id] = {
|
|
229
|
+
qid: node.qid,
|
|
230
|
+
role: typeof node.attributes.role === "string" ? node.attributes.role : undefined,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
return specRolesByWorkspace;
|
|
234
|
+
}
|
|
235
|
+
function validateAgentWorkflowSubagentRefs(index, allowMissing, errors) {
|
|
236
|
+
const specRolesByWorkspace = buildSpecRolesByWorkspace(index);
|
|
237
|
+
for (const [qid, node] of Object.entries(index.nodes)) {
|
|
238
|
+
if (node.type !== "spec" && node.type !== "work") {
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
const subagentRefs = node.attributes.subagent_refs;
|
|
242
|
+
if (!Array.isArray(subagentRefs)) {
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
for (const [indexValue, value] of subagentRefs.entries()) {
|
|
246
|
+
if (typeof value !== "string") {
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
const specNode = specRolesByWorkspace[node.ws]?.[value];
|
|
250
|
+
if (!specNode) {
|
|
251
|
+
if (allowMissing) {
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
pushError(errors, `${qid}: subagent_refs[${indexValue}] references missing SPEC.md ${value}`);
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
if (specNode.role !== undefined && specNode.role !== "subagent") {
|
|
258
|
+
pushError(errors, `${qid}: subagent_refs[${indexValue}] references ${specNode.qid} with role ${specNode.role}, not subagent`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
function validateAgentWorkflowDisputeRefs(index, allowMissing, errors) {
|
|
264
|
+
const workOrderIdsByWorkspace = {};
|
|
265
|
+
const receiptNodesByWorkspaceAndId = {};
|
|
266
|
+
for (const node of Object.values(index.nodes)) {
|
|
267
|
+
if (node.type === "work_order") {
|
|
268
|
+
if (!workOrderIdsByWorkspace[node.ws]) {
|
|
269
|
+
workOrderIdsByWorkspace[node.ws] = new Set();
|
|
270
|
+
}
|
|
271
|
+
workOrderIdsByWorkspace[node.ws].add(node.id);
|
|
272
|
+
}
|
|
273
|
+
if (node.type === "receipt") {
|
|
274
|
+
if (!receiptNodesByWorkspaceAndId[node.ws]) {
|
|
275
|
+
receiptNodesByWorkspaceAndId[node.ws] = {};
|
|
276
|
+
}
|
|
277
|
+
receiptNodesByWorkspaceAndId[node.ws][node.id] = {
|
|
278
|
+
qid: node.qid,
|
|
279
|
+
workOrderId: typeof node.attributes.work_order_id === "string"
|
|
280
|
+
? node.attributes.work_order_id
|
|
281
|
+
: undefined,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
for (const [qid, node] of Object.entries(index.nodes)) {
|
|
286
|
+
if (node.type !== "dispute") {
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
const workOrderId = node.attributes.work_order_id;
|
|
290
|
+
if (typeof workOrderId !== "string") {
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
if (!workOrderIdsByWorkspace[node.ws]?.has(workOrderId) && !allowMissing) {
|
|
294
|
+
pushError(errors, `${qid}: work_order_id references missing WORK_ORDER.md ${workOrderId}`);
|
|
295
|
+
}
|
|
296
|
+
const receiptId = node.attributes.receipt_id;
|
|
297
|
+
if (typeof receiptId !== "string") {
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
const receiptNode = receiptNodesByWorkspaceAndId[node.ws]?.[receiptId];
|
|
301
|
+
if (!receiptNode) {
|
|
302
|
+
if (allowMissing) {
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
pushError(errors, `${qid}: receipt_id references missing RECEIPT.md ${receiptId}`);
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
if (receiptNode.workOrderId !== undefined && receiptNode.workOrderId !== workOrderId) {
|
|
309
|
+
pushError(errors, `${qid}: receipt_id ${receiptId} belongs to work_order_id ${receiptNode.workOrderId}, not ${workOrderId}`);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
function buildNodeIdsByWorkspace(index) {
|
|
314
|
+
const nodeIdsByWorkspace = {};
|
|
315
|
+
for (const node of Object.values(index.nodes)) {
|
|
316
|
+
if (!nodeIdsByWorkspace[node.ws]) {
|
|
317
|
+
nodeIdsByWorkspace[node.ws] = new Set();
|
|
318
|
+
}
|
|
319
|
+
nodeIdsByWorkspace[node.ws].add(node.id);
|
|
320
|
+
}
|
|
321
|
+
return nodeIdsByWorkspace;
|
|
322
|
+
}
|
|
323
|
+
function validateAgentWorkflowNodeIdRef(qid, ws, field, value, nodeIdsByWorkspace, allowSkillRef, knownSkillSlugs, allowMissing, errors) {
|
|
324
|
+
if (nodeIdsByWorkspace[ws]?.has(value)) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
if (allowSkillRef &&
|
|
328
|
+
validateSkillRef(qid, field, value, knownSkillSlugs, allowMissing, errors)) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (allowMissing) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
pushError(errors, `${qid}: ${field} references missing node ${value}`);
|
|
335
|
+
}
|
|
336
|
+
function validateAgentWorkflowFeedbackProposalRefs(index, allowMissing, knownSkillSlugs, errors) {
|
|
337
|
+
const nodeIdsByWorkspace = buildNodeIdsByWorkspace(index);
|
|
338
|
+
for (const [qid, node] of Object.entries(index.nodes)) {
|
|
339
|
+
if (node.type !== "feedback" && node.type !== "proposal") {
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
const targetId = node.attributes.target_id;
|
|
343
|
+
if (typeof targetId === "string") {
|
|
344
|
+
const allowSkillTarget = node.type === "proposal" && node.attributes.proposal_kind === "skill_update";
|
|
345
|
+
validateAgentWorkflowNodeIdRef(qid, node.ws, "target_id", targetId, nodeIdsByWorkspace, allowSkillTarget, knownSkillSlugs, allowMissing, errors);
|
|
346
|
+
}
|
|
347
|
+
if (node.type !== "proposal") {
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
const evidenceRefs = node.attributes.evidence_refs;
|
|
351
|
+
if (!Array.isArray(evidenceRefs)) {
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
for (const [indexValue, value] of evidenceRefs.entries()) {
|
|
355
|
+
if (typeof value !== "string") {
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
validateAgentWorkflowNodeIdRef(qid, node.ws, `evidence_refs[${indexValue}]`, value, nodeIdsByWorkspace, true, knownSkillSlugs, allowMissing, errors);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
69
362
|
function detectPrevNextCycles(index, errors) {
|
|
70
363
|
const nodes = index.nodes;
|
|
71
364
|
const seen = new Set();
|
|
@@ -102,8 +395,15 @@ function detectPrevNextCycles(index, errors) {
|
|
|
102
395
|
function collectGraphErrors(index, options = {}) {
|
|
103
396
|
const errors = [];
|
|
104
397
|
const allowMissing = options.allowMissing ?? false;
|
|
105
|
-
|
|
398
|
+
const knownSkillSlugs = options.knownSkillSlugs;
|
|
399
|
+
validateEdgeTargets(index, allowMissing, knownSkillSlugs, errors);
|
|
106
400
|
validatePrevNextSymmetry(index, allowMissing, errors);
|
|
401
|
+
validateAgentWorkflowSpecWorkContracts(index, allowMissing, errors);
|
|
402
|
+
validateAgentWorkflowWorkOrderWorkRefs(index, allowMissing, errors);
|
|
403
|
+
validateAgentWorkflowReceiptWorkOrderRefs(index, allowMissing, errors);
|
|
404
|
+
validateAgentWorkflowSubagentRefs(index, allowMissing, errors);
|
|
405
|
+
validateAgentWorkflowDisputeRefs(index, allowMissing, errors);
|
|
406
|
+
validateAgentWorkflowFeedbackProposalRefs(index, allowMissing, knownSkillSlugs, errors);
|
|
107
407
|
detectPrevNextCycles(index, errors);
|
|
108
408
|
return errors;
|
|
109
409
|
}
|
package/dist/init/AGENT_START.md
CHANGED
|
@@ -15,6 +15,19 @@ Trust order:
|
|
|
15
15
|
- relevant skills
|
|
16
16
|
- chat history
|
|
17
17
|
|
|
18
|
+
Agent operating prompt:
|
|
19
|
+
- You are working in a repository that uses mdkg for deterministic project memory.
|
|
20
|
+
- Prefer `mdkg pack <id>` over ad-hoc file lists when a work item is known.
|
|
21
|
+
- Treat mdkg rules, EDDs, DECs, PRDs, and work nodes as more authoritative than chat memory.
|
|
22
|
+
- Use `mdkg show <id>` for direct inspection and `mdkg show <id> --meta` for card-only inspection.
|
|
23
|
+
- Use `mdkg search "..."` and `mdkg next` to discover current work.
|
|
24
|
+
- Use `mdkg skill list`, `mdkg skill search`, and `mdkg skill show <slug>` for skill discovery.
|
|
25
|
+
- Use `mdkg task start/update/done` for structured task, bug, and test lifecycle fields.
|
|
26
|
+
- Keep nuanced summaries, body text, and manual parent closeout edits in markdown.
|
|
27
|
+
- Use `mdkg event enable` only if `events.jsonl` is missing and provenance should be restored.
|
|
28
|
+
- Use `CLI_COMMAND_MATRIX.md` for the canonical command and flag surface.
|
|
29
|
+
- Run `mdkg validate` before marking work done.
|
|
30
|
+
|
|
18
31
|
If the active task is known:
|
|
19
32
|
- `mdkg pack <id>`
|
|
20
33
|
- `mdkg task start <id>` when durable work begins
|
|
@@ -17,6 +17,47 @@ Primary commands:
|
|
|
17
17
|
- `mdkg task`
|
|
18
18
|
- `mdkg validate`
|
|
19
19
|
|
|
20
|
+
Validation commands:
|
|
21
|
+
- `mdkg validate [--out <path>] [--quiet] [--json]`
|
|
22
|
+
|
|
23
|
+
Node creation commands:
|
|
24
|
+
- `mdkg new <type> "<title>" [options] [--json]`
|
|
25
|
+
|
|
26
|
+
Agent workflow file type creation:
|
|
27
|
+
- `mdkg new spec "<title>" [options] [--json]`
|
|
28
|
+
- `mdkg new work "<title>" [options] [--json]`
|
|
29
|
+
- `mdkg new work_order "<title>" [options] [--json]`
|
|
30
|
+
- `mdkg new receipt "<title>" [options] [--json]`
|
|
31
|
+
- `mdkg new feedback "<title>" [options] [--json]`
|
|
32
|
+
- `mdkg new dispute "<title>" [options] [--json]`
|
|
33
|
+
- `mdkg new proposal "<title>" [options] [--json]`
|
|
34
|
+
- `mdkg new spec "image worker" --id agent.image-worker`
|
|
35
|
+
- `mdkg new work "generate image" --id work.generate-image`
|
|
36
|
+
|
|
37
|
+
Agent workflow notes:
|
|
38
|
+
- `--id <portable-id>` is only for agent workflow file types.
|
|
39
|
+
- `spec` and `work` scaffold as validation-clean standalone docs.
|
|
40
|
+
- `work_order`, `receipt`, `feedback`, `dispute`, and `proposal` need real refs before strict `mdkg validate` passes.
|
|
41
|
+
|
|
42
|
+
Workspace registry commands:
|
|
43
|
+
- `mdkg workspace ls [--json]`
|
|
44
|
+
- `mdkg workspace add <alias> <path> [--mdkg-dir <dir>] [--json]`
|
|
45
|
+
- `mdkg workspace rm <alias> [--json]`
|
|
46
|
+
- `mdkg workspace enable <alias> [--json]`
|
|
47
|
+
- `mdkg workspace disable <alias> [--json]`
|
|
48
|
+
|
|
49
|
+
Event log commands:
|
|
50
|
+
- `mdkg event enable [--ws <alias>] [--json]`
|
|
51
|
+
- `mdkg event append --kind <kind> --status <ok|error|retry|skipped> --refs <id,...> [options] [--json]`
|
|
52
|
+
|
|
53
|
+
Task mutation commands:
|
|
54
|
+
- `mdkg task start <id-or-qid> [--ws <alias>] [--run-id <id>] [--note "<text>"] [--json]`
|
|
55
|
+
- `mdkg task update <id-or-qid> [options] [--json]`
|
|
56
|
+
- `mdkg task done <id-or-qid> [--checkpoint "<title>"] [options] [--json]`
|
|
57
|
+
|
|
58
|
+
Checkpoint commands:
|
|
59
|
+
- `mdkg checkpoint new <title> [--ws <alias>] [--json]`
|
|
60
|
+
|
|
20
61
|
Agent bootstrap:
|
|
21
62
|
- `mdkg init --llm`
|
|
22
63
|
- `mdkg init --agent`
|
|
@@ -27,7 +68,8 @@ Skill discovery:
|
|
|
27
68
|
- `mdkg skill list --tags stage:plan --json`
|
|
28
69
|
- `mdkg skill search "<query>" --json`
|
|
29
70
|
- `mdkg skill show <slug> --json`
|
|
30
|
-
- `mdkg skill
|
|
71
|
+
- `mdkg skill validate [<slug>] [--json]`
|
|
72
|
+
- `mdkg skill sync [--force] [--json]`
|
|
31
73
|
|
|
32
74
|
Discovery/show export flags:
|
|
33
75
|
- `--json`
|
package/dist/init/README.md
CHANGED
|
@@ -21,6 +21,13 @@ mdkg pack <id>
|
|
|
21
21
|
mdkg validate
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
Agent workflow docs can use semantic ids:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
mdkg new spec "image worker" --id agent.image-worker
|
|
28
|
+
mdkg new work "generate image" --id work.generate-image
|
|
29
|
+
```
|
|
30
|
+
|
|
24
31
|
Read `AGENT_START.md` first when this repo includes it.
|
|
25
32
|
|
|
26
33
|
## Pack Profiles
|
|
@@ -4,7 +4,7 @@ description: Verify code and mdkg state, attach evidence, and close work cleanly
|
|
|
4
4
|
tags: [stage:review, writer:orchestrator, mdkg, validation, release]
|
|
5
5
|
version: 0.1.0
|
|
6
6
|
authors: [mdkg]
|
|
7
|
-
links: [README.md,
|
|
7
|
+
links: [README.md, AGENT_START.md]
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# Goal
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: {{id}}
|
|
3
|
+
type: dispute
|
|
4
|
+
title: {{title}}
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
work_order_id: order.example
|
|
7
|
+
receipt_id: receipt.example
|
|
8
|
+
dispute_status: open
|
|
9
|
+
severity: medium
|
|
10
|
+
tags: []
|
|
11
|
+
owners: []
|
|
12
|
+
links: []
|
|
13
|
+
artifacts: []
|
|
14
|
+
relates: []
|
|
15
|
+
refs: []
|
|
16
|
+
aliases: []
|
|
17
|
+
created: {{created}}
|
|
18
|
+
updated: {{updated}}
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Dispute
|
|
22
|
+
|
|
23
|
+
Capture the dispute or report summary.
|
|
24
|
+
|
|
25
|
+
# Evidence
|
|
26
|
+
|
|
27
|
+
List evidence references without secrets.
|
|
28
|
+
|
|
29
|
+
# Resolution
|
|
30
|
+
|
|
31
|
+
Record review outcome when available.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: {{id}}
|
|
3
|
+
type: feedback
|
|
4
|
+
title: {{title}}
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
target_id: work.example
|
|
7
|
+
sentiment: neutral
|
|
8
|
+
feedback_status: new
|
|
9
|
+
source_ref: user.example
|
|
10
|
+
tags: []
|
|
11
|
+
owners: []
|
|
12
|
+
links: []
|
|
13
|
+
artifacts: []
|
|
14
|
+
relates: []
|
|
15
|
+
refs: []
|
|
16
|
+
aliases: []
|
|
17
|
+
created: {{created}}
|
|
18
|
+
updated: {{updated}}
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Feedback
|
|
22
|
+
|
|
23
|
+
Capture high-signal feedback without raw secrets.
|
|
24
|
+
|
|
25
|
+
# Evidence
|
|
26
|
+
|
|
27
|
+
List supporting references and artifacts.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: {{id}}
|
|
3
|
+
type: proposal
|
|
4
|
+
title: {{title}}
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
target_id: work.example
|
|
7
|
+
proposal_status: proposed
|
|
8
|
+
proposal_kind: work_update
|
|
9
|
+
evidence_refs: []
|
|
10
|
+
tags: []
|
|
11
|
+
owners: []
|
|
12
|
+
links: []
|
|
13
|
+
artifacts: []
|
|
14
|
+
relates: []
|
|
15
|
+
refs: []
|
|
16
|
+
aliases: []
|
|
17
|
+
created: {{created}}
|
|
18
|
+
updated: {{updated}}
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Summary
|
|
22
|
+
|
|
23
|
+
Summarize the improvement proposal.
|
|
24
|
+
|
|
25
|
+
# Evidence
|
|
26
|
+
|
|
27
|
+
List feedback, receipts, disputes, or other evidence.
|
|
28
|
+
|
|
29
|
+
# Proposed Change
|
|
30
|
+
|
|
31
|
+
Describe the proposed update to a SPEC.md, WORK.md, or SKILL.md.
|
|
32
|
+
|
|
33
|
+
# Review
|
|
34
|
+
|
|
35
|
+
Capture review status and next decision points.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: {{id}}
|
|
3
|
+
type: receipt
|
|
4
|
+
title: {{title}}
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
work_order_id: order.example
|
|
7
|
+
receipt_status: recorded
|
|
8
|
+
outcome: success
|
|
9
|
+
cost_ref: cost.redacted
|
|
10
|
+
tags: []
|
|
11
|
+
owners: []
|
|
12
|
+
links: []
|
|
13
|
+
artifacts: []
|
|
14
|
+
relates: []
|
|
15
|
+
refs: []
|
|
16
|
+
aliases: []
|
|
17
|
+
created: {{created}}
|
|
18
|
+
updated: {{updated}}
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Outcome
|
|
22
|
+
|
|
23
|
+
Record the result and proof summary.
|
|
24
|
+
|
|
25
|
+
# Artifacts
|
|
26
|
+
|
|
27
|
+
List committed artifact references.
|
|
28
|
+
|
|
29
|
+
# Notes
|
|
30
|
+
|
|
31
|
+
Capture non-secret execution notes.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: {{id}}
|
|
3
|
+
type: spec
|
|
4
|
+
title: {{title}}
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
role: subagent
|
|
7
|
+
runtime_mode: room_orchestrated
|
|
8
|
+
work_contracts: []
|
|
9
|
+
requested_capabilities: []
|
|
10
|
+
skill_refs: []
|
|
11
|
+
tool_refs: []
|
|
12
|
+
model_refs: []
|
|
13
|
+
wasm_component_refs: []
|
|
14
|
+
runtime_image_refs: []
|
|
15
|
+
subagent_refs: []
|
|
16
|
+
resource_profile: builder
|
|
17
|
+
update_policy: manual
|
|
18
|
+
tags: []
|
|
19
|
+
owners: []
|
|
20
|
+
links: []
|
|
21
|
+
artifacts: []
|
|
22
|
+
relates: []
|
|
23
|
+
refs: []
|
|
24
|
+
aliases: []
|
|
25
|
+
created: {{created}}
|
|
26
|
+
updated: {{updated}}
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
# Purpose
|
|
30
|
+
|
|
31
|
+
Define the agent, package, or runtime specification.
|
|
32
|
+
|
|
33
|
+
# Runtime
|
|
34
|
+
|
|
35
|
+
Describe role, runtime mode, resource profile, and update policy.
|
|
36
|
+
|
|
37
|
+
# Work Contracts
|
|
38
|
+
|
|
39
|
+
List related WORK.md contracts.
|
|
40
|
+
|
|
41
|
+
# Capabilities
|
|
42
|
+
|
|
43
|
+
List requested capabilities and relevant constraints.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: {{id}}
|
|
3
|
+
type: work
|
|
4
|
+
title: {{title}}
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
agent_id: agent.example
|
|
7
|
+
kind: generic
|
|
8
|
+
pricing_model: quoted
|
|
9
|
+
required_capabilities: []
|
|
10
|
+
skill_refs: []
|
|
11
|
+
tool_refs: []
|
|
12
|
+
model_refs: []
|
|
13
|
+
wasm_component_refs: []
|
|
14
|
+
runtime_image_refs: []
|
|
15
|
+
subagent_refs: []
|
|
16
|
+
inputs: [request:text:required]
|
|
17
|
+
outputs: [result:text:required]
|
|
18
|
+
receipt_required: true
|
|
19
|
+
tags: []
|
|
20
|
+
owners: []
|
|
21
|
+
links: []
|
|
22
|
+
artifacts: []
|
|
23
|
+
relates: []
|
|
24
|
+
refs: []
|
|
25
|
+
aliases: []
|
|
26
|
+
created: {{created}}
|
|
27
|
+
updated: {{updated}}
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
# Capability
|
|
31
|
+
|
|
32
|
+
Describe the reusable capability contract.
|
|
33
|
+
|
|
34
|
+
# Inputs
|
|
35
|
+
|
|
36
|
+
Document input descriptors and validation expectations.
|
|
37
|
+
|
|
38
|
+
# Outputs
|
|
39
|
+
|
|
40
|
+
Document output descriptors and artifact expectations.
|
|
41
|
+
|
|
42
|
+
# Receipt
|
|
43
|
+
|
|
44
|
+
Describe required receipt evidence.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: {{id}}
|
|
3
|
+
type: work_order
|
|
4
|
+
title: {{title}}
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
work_id: work.example
|
|
7
|
+
work_version: 0.1.0
|
|
8
|
+
requester: user.example
|
|
9
|
+
order_status: submitted
|
|
10
|
+
request_ref: request.example
|
|
11
|
+
tags: []
|
|
12
|
+
owners: []
|
|
13
|
+
links: []
|
|
14
|
+
artifacts: []
|
|
15
|
+
relates: []
|
|
16
|
+
refs: []
|
|
17
|
+
aliases: []
|
|
18
|
+
created: {{created}}
|
|
19
|
+
updated: {{updated}}
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# Request
|
|
23
|
+
|
|
24
|
+
Capture the concrete request against a WORK.md version.
|
|
25
|
+
|
|
26
|
+
# Inputs
|
|
27
|
+
|
|
28
|
+
Record committed input references without secrets.
|
|
29
|
+
|
|
30
|
+
# Constraints
|
|
31
|
+
|
|
32
|
+
Capture relevant policy, budget, and artifact constraints.
|