@kontextmind/kxm 0.7.92 → 0.7.93
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/.claude-plugin/marketplace.json +1 -1
- package/.kxm/workflows/default.yaml +1 -1
- package/CHANGELOG.md +204 -0
- package/README.md +3 -0
- package/docs/README.md +3 -0
- package/docs/agent-skills.md +123 -60
- package/docs/architecture.md +5 -2
- package/docs/cli-reference.md +3527 -0
- package/docs/config-reference.md +1943 -0
- package/docs/configuration.md +29 -3
- package/docs/continuous-improvement.md +122 -10
- package/docs/contracts/routing.md +95 -11
- package/docs/harness-routing.md +616 -0
- package/docs/kxm-handbook.md +106 -19
- package/docs/templates/README.md +1 -1
- package/docs/test-matrix.md +12 -6
- package/docs/troubleshooting.md +2 -2
- package/examples/project/.kxm/workflows/fix.yaml +1 -1
- package/examples/project/.kxm/workflows/improve.yaml +1 -1
- package/package.json +1 -1
- package/plugins/kxm/.claude-plugin/plugin.json +9 -10
- package/plugins/kxm/README.md +238 -56
- package/plugins/kxm/dist/claude-hook.js +10083 -0
- package/plugins/kxm/dist/cli.js +3068 -2446
- package/plugins/kxm/dist/client.js +64 -0
- package/plugins/kxm/dist/core.js +102 -9
- package/plugins/kxm/dist/extension.js +210 -68
- package/plugins/kxm/dist/mcp-server.js +217 -40
- package/plugins/kxm/dist/runtime-supervisor.js +1628 -157
- package/plugins/kxm/dist/runtime.js +1874 -298
- package/plugins/kxm/dist/server.js +416 -82
- package/plugins/kxm/package.json +1 -1
- package/plugins/kxm/skills/hints.json +1 -1
- package/plugins/kxm/skills/kxm/SKILL.md +48 -24
- package/plugins/kxm/skills/kxm/references/protocol.md +3 -3
- package/plugins/kxm/skills/kxm-context-memory/SKILL.md +61 -21
- package/plugins/kxm/skills/kxm-definitions/SKILL.md +9 -0
- package/plugins/kxm/skills/kxm-harness-auth/SKILL.md +82 -16
- package/plugins/kxm/skills/kxm-harvest/SKILL.md +1 -1
- package/plugins/kxm/skills/kxm-hub-ops/SKILL.md +55 -27
- package/plugins/kxm/skills/kxm-insights/SKILL.md +1 -1
- package/plugins/kxm/skills/kxm-mind/SKILL.md +2 -2
- package/plugins/kxm/skills/{kxm-setup → kxm-mind-setup}/SKILL.md +4 -4
- package/plugins/kxm/skills/kxm-peer/SKILL.md +68 -93
- package/plugins/kxm/skills/kxm-project-setup/SKILL.md +156 -23
- package/plugins/kxm/skills/kxm-projects/SKILL.md +1 -1
- package/plugins/kxm/skills/kxm-protocol/SKILL.md +1 -1
- package/plugins/kxm/skills/kxm-query/SKILL.md +1 -1
- package/plugins/kxm/skills/kxm-routing-improve/SKILL.md +74 -15
- package/plugins/kxm/skills/kxm-runs/SKILL.md +46 -17
- package/plugins/kxm/skills/kxm-session/SKILL.md +64 -36
- package/plugins/kxm/skills/kxm-skill-lifecycle/SKILL.md +44 -15
- package/plugins/kxm/skills/kxm-tasks/SKILL.md +16 -4
- package/plugins/kxm/skills/kxm-triage/SKILL.md +1 -1
- package/plugins/kxm/skills/kxm-work/SKILL.md +1 -1
- package/plugins/kxm/skills/kxm-workflow/SKILL.md +60 -19
- package/plugins/kxm/src/arbiter.ts +67 -22
- package/plugins/kxm/src/autocomplete.ts +1 -1
- package/plugins/kxm/src/claude-hook.ts +192 -0
- package/plugins/kxm/src/cli/project.ts +11 -5
- package/plugins/kxm/src/cli/system.ts +85 -13
- package/plugins/kxm/src/cli/types.ts +4 -1
- package/plugins/kxm/src/cli/workflows.ts +18 -16
- package/plugins/kxm/src/cli.ts +23 -13
- package/plugins/kxm/src/client.ts +15 -4
- package/plugins/kxm/src/commands.ts +19 -9
- package/plugins/kxm/src/config.ts +42 -7
- package/plugins/kxm/src/context-packet.ts +14 -2
- package/plugins/kxm/src/context.ts +16 -5
- package/plugins/kxm/src/dispatch-context.ts +286 -0
- package/plugins/kxm/src/engine-plan.ts +40 -0
- package/plugins/kxm/src/engine.ts +138 -6
- package/plugins/kxm/src/hub-env.ts +17 -1
- package/plugins/kxm/src/hub.ts +92 -29
- package/plugins/kxm/src/improve-sources.ts +228 -0
- package/plugins/kxm/src/improve.ts +325 -140
- package/plugins/kxm/src/local-snapshot.ts +101 -42
- package/plugins/kxm/src/mcp-server.ts +129 -30
- package/plugins/kxm/src/project-config.ts +25 -0
- package/plugins/kxm/src/protocol.ts +11 -0
- package/plugins/kxm/src/relevance.ts +138 -0
- package/plugins/kxm/src/retrospective.ts +16 -10
- package/plugins/kxm/src/runtime-service.ts +8 -1
- package/plugins/kxm/src/runtime-supervisor.ts +16 -2
- package/plugins/kxm/src/session-token-hint.ts +17 -0
- package/plugins/kxm/src/suggest.ts +7 -7
- package/plugins/kxm/src/workflow-manager.ts +80 -78
- package/plugins/kxm/src/workflow.ts +202 -12
- package/scripts/build-runtime.mjs +7 -1
- package/scripts/check-generated.mjs +1 -0
- package/scripts/emit-codex-artifacts.mjs +1 -1
|
@@ -11,6 +11,70 @@ var MAX_AGENT_HOST_CHARS = 64;
|
|
|
11
11
|
var MAX_LEASE_TTL_MS = 10 * 6e4;
|
|
12
12
|
var DEFAULT_LEASE_TTL_MS = 5 * 6e4;
|
|
13
13
|
|
|
14
|
+
// plugins/kxm/src/relevance.ts
|
|
15
|
+
var RELEVANCE_STOPWORDS = Object.freeze(/* @__PURE__ */ new Set([
|
|
16
|
+
"a",
|
|
17
|
+
"an",
|
|
18
|
+
"and",
|
|
19
|
+
"are",
|
|
20
|
+
"as",
|
|
21
|
+
"at",
|
|
22
|
+
"be",
|
|
23
|
+
"been",
|
|
24
|
+
"but",
|
|
25
|
+
"by",
|
|
26
|
+
"can",
|
|
27
|
+
"could",
|
|
28
|
+
"did",
|
|
29
|
+
"do",
|
|
30
|
+
"does",
|
|
31
|
+
"for",
|
|
32
|
+
"from",
|
|
33
|
+
"had",
|
|
34
|
+
"has",
|
|
35
|
+
"have",
|
|
36
|
+
"how",
|
|
37
|
+
"if",
|
|
38
|
+
"in",
|
|
39
|
+
"into",
|
|
40
|
+
"is",
|
|
41
|
+
"it",
|
|
42
|
+
"its",
|
|
43
|
+
"of",
|
|
44
|
+
"on",
|
|
45
|
+
"or",
|
|
46
|
+
"our",
|
|
47
|
+
"should",
|
|
48
|
+
"so",
|
|
49
|
+
"than",
|
|
50
|
+
"that",
|
|
51
|
+
"the",
|
|
52
|
+
"their",
|
|
53
|
+
"them",
|
|
54
|
+
"then",
|
|
55
|
+
"there",
|
|
56
|
+
"these",
|
|
57
|
+
"they",
|
|
58
|
+
"this",
|
|
59
|
+
"those",
|
|
60
|
+
"to",
|
|
61
|
+
"was",
|
|
62
|
+
"we",
|
|
63
|
+
"were",
|
|
64
|
+
"what",
|
|
65
|
+
"when",
|
|
66
|
+
"where",
|
|
67
|
+
"which",
|
|
68
|
+
"while",
|
|
69
|
+
"who",
|
|
70
|
+
"why",
|
|
71
|
+
"will",
|
|
72
|
+
"with",
|
|
73
|
+
"would",
|
|
74
|
+
"you",
|
|
75
|
+
"your"
|
|
76
|
+
]));
|
|
77
|
+
|
|
14
78
|
// plugins/kxm/src/workflow.ts
|
|
15
79
|
function canonicalWorkflowEvidenceKey(value) {
|
|
16
80
|
return value.trim().replace(/\s+/gu, " ").toLowerCase();
|
package/plugins/kxm/dist/core.js
CHANGED
|
@@ -28,6 +28,15 @@ function toAgentRecord(agent, staleAfterMs, now) {
|
|
|
28
28
|
return { ...agent, ...agentPresenceView(agent, staleAfterMs, now) };
|
|
29
29
|
}
|
|
30
30
|
var MAX_SYNC_BATCH_EVENTS = 100;
|
|
31
|
+
var IMPROVEMENT_AREAS = [
|
|
32
|
+
"harness",
|
|
33
|
+
"gates",
|
|
34
|
+
"implementation",
|
|
35
|
+
"workflow",
|
|
36
|
+
"documentation",
|
|
37
|
+
"security",
|
|
38
|
+
"other"
|
|
39
|
+
];
|
|
31
40
|
var ProtocolError = class extends Error {
|
|
32
41
|
statusCode;
|
|
33
42
|
code;
|
|
@@ -877,6 +886,84 @@ import { chmodSync, existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSy
|
|
|
877
886
|
import { homedir } from "node:os";
|
|
878
887
|
import { dirname, join, resolve } from "node:path";
|
|
879
888
|
|
|
889
|
+
// plugins/kxm/src/relevance.ts
|
|
890
|
+
var RELEVANCE_STOPWORDS = Object.freeze(/* @__PURE__ */ new Set([
|
|
891
|
+
"a",
|
|
892
|
+
"an",
|
|
893
|
+
"and",
|
|
894
|
+
"are",
|
|
895
|
+
"as",
|
|
896
|
+
"at",
|
|
897
|
+
"be",
|
|
898
|
+
"been",
|
|
899
|
+
"but",
|
|
900
|
+
"by",
|
|
901
|
+
"can",
|
|
902
|
+
"could",
|
|
903
|
+
"did",
|
|
904
|
+
"do",
|
|
905
|
+
"does",
|
|
906
|
+
"for",
|
|
907
|
+
"from",
|
|
908
|
+
"had",
|
|
909
|
+
"has",
|
|
910
|
+
"have",
|
|
911
|
+
"how",
|
|
912
|
+
"if",
|
|
913
|
+
"in",
|
|
914
|
+
"into",
|
|
915
|
+
"is",
|
|
916
|
+
"it",
|
|
917
|
+
"its",
|
|
918
|
+
"of",
|
|
919
|
+
"on",
|
|
920
|
+
"or",
|
|
921
|
+
"our",
|
|
922
|
+
"should",
|
|
923
|
+
"so",
|
|
924
|
+
"than",
|
|
925
|
+
"that",
|
|
926
|
+
"the",
|
|
927
|
+
"their",
|
|
928
|
+
"them",
|
|
929
|
+
"then",
|
|
930
|
+
"there",
|
|
931
|
+
"these",
|
|
932
|
+
"they",
|
|
933
|
+
"this",
|
|
934
|
+
"those",
|
|
935
|
+
"to",
|
|
936
|
+
"was",
|
|
937
|
+
"we",
|
|
938
|
+
"were",
|
|
939
|
+
"what",
|
|
940
|
+
"when",
|
|
941
|
+
"where",
|
|
942
|
+
"which",
|
|
943
|
+
"while",
|
|
944
|
+
"who",
|
|
945
|
+
"why",
|
|
946
|
+
"will",
|
|
947
|
+
"with",
|
|
948
|
+
"would",
|
|
949
|
+
"you",
|
|
950
|
+
"your"
|
|
951
|
+
]));
|
|
952
|
+
|
|
953
|
+
// plugins/kxm/src/workflow.ts
|
|
954
|
+
var JOURNAL_CATEGORIES = [
|
|
955
|
+
"plan",
|
|
956
|
+
"decision",
|
|
957
|
+
"contradiction",
|
|
958
|
+
"error",
|
|
959
|
+
"lesson",
|
|
960
|
+
"observation",
|
|
961
|
+
"hypothesis",
|
|
962
|
+
"experiment",
|
|
963
|
+
"state-change",
|
|
964
|
+
"skill-candidate"
|
|
965
|
+
];
|
|
966
|
+
|
|
880
967
|
// plugins/kxm/src/client.ts
|
|
881
968
|
var HubHttpError = class extends Error {
|
|
882
969
|
statusCode;
|
|
@@ -1241,7 +1328,7 @@ var AGENT_COMMANDS = [
|
|
|
1241
1328
|
group: "workflow",
|
|
1242
1329
|
verb: "run",
|
|
1243
1330
|
label: "Get workflow run",
|
|
1244
|
-
description: "Get a workflow's stages and journal
|
|
1331
|
+
description: "Get a workflow's stages and its learning journal (plans, decisions, contradictions, errors, lessons, and the other journal categories).",
|
|
1245
1332
|
parameters: {
|
|
1246
1333
|
type: "object",
|
|
1247
1334
|
properties: {
|
|
@@ -1315,20 +1402,24 @@ var AGENT_COMMANDS = [
|
|
|
1315
1402
|
group: "workflow",
|
|
1316
1403
|
verb: "record",
|
|
1317
1404
|
label: "Record workflow journal entry",
|
|
1318
|
-
description: "Record a plan, decision, contradiction, error, or
|
|
1405
|
+
description: "Record a plan, decision, contradiction, error, lesson, observation, hypothesis, experiment, state-change, or skill-candidate for continuous improvement. Pass stageId to bind the entry to that stage: the hub derives the attempt, and area defaults to the stage's declared area. Lessons and skill-candidates require evidence.",
|
|
1319
1406
|
parameters: {
|
|
1320
1407
|
type: "object",
|
|
1321
1408
|
properties: {
|
|
1322
1409
|
runId: { type: "string", description: "Active durable workflow run ID" },
|
|
1323
1410
|
category: {
|
|
1324
1411
|
type: "string",
|
|
1325
|
-
enum: [
|
|
1412
|
+
enum: [...JOURNAL_CATEGORIES],
|
|
1326
1413
|
description: "Category of journal entry"
|
|
1327
1414
|
},
|
|
1328
1415
|
area: {
|
|
1329
1416
|
type: "string",
|
|
1330
|
-
enum: [
|
|
1331
|
-
description: "System area"
|
|
1417
|
+
enum: [...IMPROVEMENT_AREAS],
|
|
1418
|
+
description: "System area; required unless stageId names a stage that declares an area"
|
|
1419
|
+
},
|
|
1420
|
+
stageId: {
|
|
1421
|
+
type: "string",
|
|
1422
|
+
description: "Stage the entry belongs to; the hub binds the attempt from the stage's state"
|
|
1332
1423
|
},
|
|
1333
1424
|
severity: {
|
|
1334
1425
|
type: "string",
|
|
@@ -1351,13 +1442,14 @@ var AGENT_COMMANDS = [
|
|
|
1351
1442
|
description: "Related previous journal entry IDs"
|
|
1352
1443
|
}
|
|
1353
1444
|
},
|
|
1354
|
-
required: ["runId", "category", "
|
|
1445
|
+
required: ["runId", "category", "summary"],
|
|
1355
1446
|
additionalProperties: false
|
|
1356
1447
|
},
|
|
1357
1448
|
async execute(client, args) {
|
|
1358
1449
|
return await client.recordWorkflowEntry(requiredString(args.runId, "runId"), {
|
|
1359
1450
|
category: requiredString(args.category, "category"),
|
|
1360
|
-
area:
|
|
1451
|
+
...optionalString2(args.area) ? { area: optionalString2(args.area) } : {},
|
|
1452
|
+
...optionalString2(args.stageId) ? { stageId: optionalString2(args.stageId) } : {},
|
|
1361
1453
|
...optionalString2(args.severity) ? { severity: optionalString2(args.severity) } : {},
|
|
1362
1454
|
summary: requiredString(args.summary, "summary"),
|
|
1363
1455
|
...optionalString2(args.details) ? { details: optionalString2(args.details) } : {},
|
|
@@ -1434,7 +1526,7 @@ var AGENT_COMMANDS = [
|
|
|
1434
1526
|
group: "workflow",
|
|
1435
1527
|
verb: "improve-report",
|
|
1436
1528
|
label: "Summarize improvement report",
|
|
1437
|
-
description: "Summarize workflow errors, contradictions, and
|
|
1529
|
+
description: "Summarize workflow errors, contradictions, lessons, and skill candidates by improvement area, plus ranked cross-run signals: duplicates merged across runs and scored by frequency x severity x run-attempt cost x evidence confidence, security first, with redacted text.",
|
|
1438
1530
|
parameters: {
|
|
1439
1531
|
type: "object",
|
|
1440
1532
|
properties: {},
|
|
@@ -1488,7 +1580,7 @@ var AGENT_COMMANDS = [
|
|
|
1488
1580
|
group: "context",
|
|
1489
1581
|
verb: "recall",
|
|
1490
1582
|
label: "Recall context metadata",
|
|
1491
|
-
description: "Search durable context records for a project by query; returns bounded metadata
|
|
1583
|
+
description: "Search durable context records for a project by query. Ranks exact-phrase matches first, then token relevance, then id; returns bounded metadata with a numeric relevance per item, never summaries.",
|
|
1492
1584
|
parameters: {
|
|
1493
1585
|
type: "object",
|
|
1494
1586
|
properties: {
|
|
@@ -2032,6 +2124,7 @@ export {
|
|
|
2032
2124
|
DEFAULT_RATE_LIMIT_MAX,
|
|
2033
2125
|
DEFAULT_RATE_LIMIT_WINDOW_MS,
|
|
2034
2126
|
DEFAULT_STALE_AFTER_MS,
|
|
2127
|
+
IMPROVEMENT_AREAS,
|
|
2035
2128
|
LOG_LEVEL_PRIORITY,
|
|
2036
2129
|
MAX_AGENT_HOST_CHARS,
|
|
2037
2130
|
MAX_BODY_BYTES,
|