@kontextmind/kxm 0.6.0
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 +19 -0
- package/.kxm/README.md +14 -0
- package/.kxm/assets/README.md +5 -0
- package/.kxm/assets/retrospectives/README.md +5 -0
- package/.kxm/config/README.md +5 -0
- package/.kxm/config/agents.json +43 -0
- package/.kxm/config/env.example +56 -0
- package/.kxm/config/update.example.yaml +9 -0
- package/.kxm/config/workflows/fix.json +160 -0
- package/.kxm/config/workflows/jira-development.json +116 -0
- package/.kxm/config/workflows/provenance-quorum.json +150 -0
- package/.kxm/config/workflows/v04-dogfood.json +72 -0
- package/CHANGELOG.md +465 -0
- package/LICENSE +21 -0
- package/README.md +306 -0
- package/SECURITY.md +72 -0
- package/docs/README.md +48 -0
- package/docs/agent-communication-envelopes-and-gates.md +553 -0
- package/docs/architecture.md +242 -0
- package/docs/assignment-runner.md +241 -0
- package/docs/configuration.md +361 -0
- package/docs/continuous-improvement.md +114 -0
- package/docs/getting-started.md +253 -0
- package/docs/kxm-handbook.md +1090 -0
- package/docs/operations.md +205 -0
- package/docs/provenance-gates.md +291 -0
- package/docs/skills.md +45 -0
- package/docs/templates/README.md +95 -0
- package/docs/templates/adr.md +88 -0
- package/docs/templates/architecture.md +120 -0
- package/docs/templates/bug-fix.md +109 -0
- package/docs/templates/feature.md +108 -0
- package/docs/templates/handoff.md +72 -0
- package/docs/templates/postmortem.md +77 -0
- package/docs/templates/research.md +100 -0
- package/docs/templates/review.md +85 -0
- package/docs/templates/runbook.md +73 -0
- package/docs/templates/test-plan.md +87 -0
- package/docs/templates/test-report.md +72 -0
- package/docs/test-matrix.md +121 -0
- package/docs/troubleshooting.md +249 -0
- package/docs/vnext/README.md +62 -0
- package/docs/vnext/architecture.md +185 -0
- package/docs/vnext/effects-and-recovery.md +172 -0
- package/docs/vnext/lifecycles.md +235 -0
- package/docs/vnext/migration.md +220 -0
- package/docs/vnext/routing.md +184 -0
- package/docs/vnext/synchronization.md +172 -0
- package/docs/vnext/terminology.md +240 -0
- package/docs/vnext/validation.md +335 -0
- package/docs/webhook-workflows.md +240 -0
- package/docs/workflow-guide.md +1150 -0
- package/examples/README.md +102 -0
- package/examples/provenance-workflow.json +40 -0
- package/examples/requester.ts +30 -0
- package/examples/reviewer-agent.ts +29 -0
- package/examples/roundtrip.ts +46 -0
- package/examples/vnext/.kxm/agents/coordinator.yaml +16 -0
- package/examples/vnext/.kxm/agents/critic-1.yaml +16 -0
- package/examples/vnext/.kxm/agents/critic-2.yaml +15 -0
- package/examples/vnext/.kxm/agents/critic-3.yaml +15 -0
- package/examples/vnext/.kxm/agents/implementer.yaml +15 -0
- package/examples/vnext/.kxm/agents/planner.yaml +13 -0
- package/examples/vnext/.kxm/agents/reproducer.yaml +15 -0
- package/examples/vnext/.kxm/agents/reviewer.yaml +15 -0
- package/examples/vnext/.kxm/gates.yaml +8 -0
- package/examples/vnext/.kxm/models/critic-claude.yaml +11 -0
- package/examples/vnext/.kxm/models/critic-gemini.yaml +11 -0
- package/examples/vnext/.kxm/models/critic-grok.yaml +12 -0
- package/examples/vnext/.kxm/models/implementation.yaml +14 -0
- package/examples/vnext/.kxm/models/primary.yaml +17 -0
- package/examples/vnext/.kxm/prices.yaml +111 -0
- package/examples/vnext/.kxm/project/env.yaml +7 -0
- package/examples/vnext/.kxm/project.yaml +32 -0
- package/examples/vnext/.kxm/repo/repo.yaml +8 -0
- package/examples/vnext/.kxm/workflows/default.yaml +92 -0
- package/examples/vnext/.kxm/workflows/fix.yaml +376 -0
- package/examples/vnext/.kxm/workflows/improve.yaml +57 -0
- package/examples/vnext/README.md +53 -0
- package/examples/vnext/records/assignment-result-recorded.json +63 -0
- package/examples/vnext/records/assignment-result.json +46 -0
- package/examples/vnext/records/context-candidate.json +42 -0
- package/examples/vnext/records/delivery-manifest.json +66 -0
- package/examples/vnext/records/effect-uncertainty-resolved-sync.json +67 -0
- package/examples/vnext/records/effect-uncertainty-resolved.json +62 -0
- package/examples/vnext/records/run-created.json +54 -0
- package/examples/vnext/records/sync-event.json +65 -0
- package/examples/vnext/repositories/api/.kxm/repo/env.yaml +7 -0
- package/examples/vnext/repositories/api/.kxm/repo/repo.yaml +8 -0
- package/examples/vnext/repositories/web/.kxm/repo/repo.yaml +8 -0
- package/examples/workflow-signal.ts +63 -0
- package/package.json +129 -0
- package/plugins/kxm/.claude-plugin/plugin.json +73 -0
- package/plugins/kxm/.mcp.json +19 -0
- package/plugins/kxm/README.md +93 -0
- package/plugins/kxm/dist/cli.js +42853 -0
- package/plugins/kxm/dist/client.js +416 -0
- package/plugins/kxm/dist/core.js +1823 -0
- package/plugins/kxm/dist/extension.js +3797 -0
- package/plugins/kxm/dist/mcp-server.js +17104 -0
- package/plugins/kxm/dist/runtime.js +23361 -0
- package/plugins/kxm/dist/server.js +13640 -0
- package/plugins/kxm/dist/vnext-runtime-supervisor.js +21109 -0
- package/plugins/kxm/package.json +12 -0
- package/plugins/kxm/skills/kxm/SKILL.md +97 -0
- package/plugins/kxm/skills/kxm/references/protocol.md +103 -0
- package/plugins/kxm/skills/kxm-session/SKILL.md +53 -0
- package/plugins/kxm/src/arbiter.ts +355 -0
- package/plugins/kxm/src/artifacts-exist.ts +62 -0
- package/plugins/kxm/src/autocomplete.ts +236 -0
- package/plugins/kxm/src/cli.ts +3707 -0
- package/plugins/kxm/src/client.ts +614 -0
- package/plugins/kxm/src/commands.ts +1063 -0
- package/plugins/kxm/src/config.ts +290 -0
- package/plugins/kxm/src/context/providers.ts +101 -0
- package/plugins/kxm/src/context-packet.ts +332 -0
- package/plugins/kxm/src/context.ts +499 -0
- package/plugins/kxm/src/core.ts +6 -0
- package/plugins/kxm/src/database.ts +563 -0
- package/plugins/kxm/src/diagnostics.ts +184 -0
- package/plugins/kxm/src/envelope.ts +118 -0
- package/plugins/kxm/src/extension.ts +895 -0
- package/plugins/kxm/src/external-effects.ts +299 -0
- package/plugins/kxm/src/github-watch.ts +255 -0
- package/plugins/kxm/src/hub-binding.ts +160 -0
- package/plugins/kxm/src/hub.ts +2502 -0
- package/plugins/kxm/src/improve.ts +383 -0
- package/plugins/kxm/src/inbox.ts +10 -0
- package/plugins/kxm/src/kxm-install-kind.ts +113 -0
- package/plugins/kxm/src/kxm-update-config.ts +39 -0
- package/plugins/kxm/src/kxm-update.ts +238 -0
- package/plugins/kxm/src/local-snapshot.ts +406 -0
- package/plugins/kxm/src/logger.ts +198 -0
- package/plugins/kxm/src/mcp-server.ts +143 -0
- package/plugins/kxm/src/memory.ts +385 -0
- package/plugins/kxm/src/nous-pi.ts +287 -0
- package/plugins/kxm/src/nous-provider.ts +729 -0
- package/plugins/kxm/src/price-calc.ts +87 -0
- package/plugins/kxm/src/prices.ts +121 -0
- package/plugins/kxm/src/protocol.ts +172 -0
- package/plugins/kxm/src/recovery.ts +211 -0
- package/plugins/kxm/src/redact.ts +26 -0
- package/plugins/kxm/src/retrospective.ts +400 -0
- package/plugins/kxm/src/routing.ts +830 -0
- package/plugins/kxm/src/runtime.ts +9 -0
- package/plugins/kxm/src/server.ts +117 -0
- package/plugins/kxm/src/session-work.ts +571 -0
- package/plugins/kxm/src/session.ts +184 -0
- package/plugins/kxm/src/skills.ts +535 -0
- package/plugins/kxm/src/state.ts +326 -0
- package/plugins/kxm/src/store.ts +637 -0
- package/plugins/kxm/src/studio-layout.ts +268 -0
- package/plugins/kxm/src/suggest.ts +162 -0
- package/plugins/kxm/src/task-manager.ts +244 -0
- package/plugins/kxm/src/telemetry.ts +116 -0
- package/plugins/kxm/src/tui.ts +1046 -0
- package/plugins/kxm/src/vnext-bindings.ts +403 -0
- package/plugins/kxm/src/vnext-config.ts +1646 -0
- package/plugins/kxm/src/vnext-engine-artifacts.ts +86 -0
- package/plugins/kxm/src/vnext-engine-command.ts +533 -0
- package/plugins/kxm/src/vnext-engine-compile.ts +722 -0
- package/plugins/kxm/src/vnext-engine-evidence.ts +273 -0
- package/plugins/kxm/src/vnext-engine-fold.ts +1400 -0
- package/plugins/kxm/src/vnext-engine-gate-records.ts +583 -0
- package/plugins/kxm/src/vnext-engine-plan.ts +717 -0
- package/plugins/kxm/src/vnext-engine.ts +2458 -0
- package/plugins/kxm/src/vnext-gate-hash.ts +10 -0
- package/plugins/kxm/src/vnext-harness.ts +1142 -0
- package/plugins/kxm/src/vnext-init.ts +430 -0
- package/plugins/kxm/src/vnext-migrate.ts +1848 -0
- package/plugins/kxm/src/vnext-oneshot-producer.ts +424 -0
- package/plugins/kxm/src/vnext-permission.ts +936 -0
- package/plugins/kxm/src/vnext-pi-producer.ts +628 -0
- package/plugins/kxm/src/vnext-repair.ts +1094 -0
- package/plugins/kxm/src/vnext-runtime-owner.ts +320 -0
- package/plugins/kxm/src/vnext-runtime-store.ts +1560 -0
- package/plugins/kxm/src/vnext-runtime-supervisor.ts +586 -0
- package/plugins/kxm/src/vnext-runtime.ts +663 -0
- package/plugins/kxm/src/vnext-template.ts +247 -0
- package/plugins/kxm/src/wiki.ts +313 -0
- package/plugins/kxm/src/workflow.ts +1548 -0
- package/schemas/vnext/README.md +46 -0
- package/schemas/vnext/agent.schema.json +40 -0
- package/schemas/vnext/assignment-result.schema.json +66 -0
- package/schemas/vnext/backup-manifest.schema.json +89 -0
- package/schemas/vnext/candidate.schema.json +109 -0
- package/schemas/vnext/common.schema.json +422 -0
- package/schemas/vnext/context-candidate.schema.json +76 -0
- package/schemas/vnext/context-packet.schema.json +192 -0
- package/schemas/vnext/delivery-manifest.schema.json +159 -0
- package/schemas/vnext/environment.schema.json +66 -0
- package/schemas/vnext/gate-registry.schema.json +109 -0
- package/schemas/vnext/handoff-manifest.schema.json +146 -0
- package/schemas/vnext/init-operation.schema.json +61 -0
- package/schemas/vnext/local-repository-bindings.schema.json +30 -0
- package/schemas/vnext/memory-record.schema.json +45 -0
- package/schemas/vnext/migration-decision.schema.json +26 -0
- package/schemas/vnext/migration-plan.schema.json +123 -0
- package/schemas/vnext/migration-receipt.schema.json +52 -0
- package/schemas/vnext/model.schema.json +42 -0
- package/schemas/vnext/permission-diff.schema.json +57 -0
- package/schemas/vnext/prices.schema.json +115 -0
- package/schemas/vnext/project.schema.json +85 -0
- package/schemas/vnext/repository.schema.json +24 -0
- package/schemas/vnext/run-event.schema.json +460 -0
- package/schemas/vnext/session-brief.schema.json +153 -0
- package/schemas/vnext/sync-event.schema.json +234 -0
- package/schemas/vnext/template-provenance.schema.json +38 -0
- package/schemas/vnext/workflow.schema.json +248 -0
- package/scripts/assignment-run.d.mts +354 -0
- package/scripts/assignment-run.mjs +4451 -0
- package/scripts/build-runtime.mjs +56 -0
- package/scripts/check-generated.mjs +77 -0
- package/scripts/check-versions.mjs +34 -0
- package/scripts/emit-codex-artifacts.d.mts +9 -0
- package/scripts/emit-codex-artifacts.mjs +91 -0
- package/scripts/harness-run.d.mts +83 -0
- package/scripts/harness-run.mjs +2095 -0
- package/scripts/kxm-hub.mjs +105 -0
- package/scripts/kxm-publish-npm.mjs +327 -0
- package/scripts/kxm-release-github.mjs +472 -0
- package/scripts/kxm-runtime-supervisor.mjs +7 -0
- package/scripts/kxm-worker.mjs +1127 -0
- package/scripts/kxm.mjs +27 -0
- package/scripts/roster-policy.d.mts +20 -0
- package/scripts/roster-policy.mjs +161 -0
- package/scripts/smoke-multi-pi.mjs +479 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
These examples demonstrate the transport without requiring an AI model. Run them from the repository root after `npm ci`.
|
|
4
|
+
|
|
5
|
+
The [`.kxm/config/workflows/jira-development.json`](../.kxm/config/workflows/jira-development.json) workspace configuration is a production-oriented definition for a long-lived coordinator. It covers reproduction, single-agent or three-agent planning, plan review, implementation, local and repository gates, documentation, push/watch retries, merge, Jira update, and continuous improvement. Follow [Webhook workflows](../docs/webhook-workflows.md) to configure it.
|
|
6
|
+
|
|
7
|
+
The [`workflow-signal.ts`](workflow-signal.ts) sender demonstrates the signed callback that resumes a coordinator after CI, review, merge, or Jira work completes. The webhook guide documents its required environment and arguments.
|
|
8
|
+
|
|
9
|
+
The [`provenance-workflow.json`](provenance-workflow.json) definition is a
|
|
10
|
+
minimal command-first quorum example. It requires two eligible peer replies for
|
|
11
|
+
one exact run, stage, requirement, and attempt, while demonstrating an optional
|
|
12
|
+
admin-approved one-peer degradation. Its tested topology is project
|
|
13
|
+
`provenance-demo`, coordinator `coordinator`, and reviewers `reviewer-claude`
|
|
14
|
+
and `reviewer-grok`. Follow
|
|
15
|
+
[Peer provenance and quorum gates](../docs/provenance-gates.md) for the complete
|
|
16
|
+
runbook and trust boundary.
|
|
17
|
+
|
|
18
|
+
The [`vnext`](vnext/README.md) directory is a machine-validated planned-contract
|
|
19
|
+
fixture for the local-first KXM vNext architecture. Production configuration
|
|
20
|
+
loader tests consume it, but no current Runtime executes its workflows.
|
|
21
|
+
|
|
22
|
+
## Self-contained round trip
|
|
23
|
+
|
|
24
|
+
Start an in-memory hub, connect a planner and reviewer, send an idempotent request, and print the reply:
|
|
25
|
+
|
|
26
|
+
```powershell
|
|
27
|
+
npm run example
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Expected result:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"peers": [
|
|
35
|
+
"example-reviewer",
|
|
36
|
+
"example-planner"
|
|
37
|
+
],
|
|
38
|
+
"status": "replied",
|
|
39
|
+
"reply": "Reviewed: Check the rollout plan"
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The message ID is generated at runtime and is omitted above.
|
|
44
|
+
|
|
45
|
+
## Custom reviewer client
|
|
46
|
+
|
|
47
|
+
With the normal hub running, start a deterministic reviewer:
|
|
48
|
+
|
|
49
|
+
```powershell
|
|
50
|
+
$env:KXM_AUTH_TOKEN = "replace-with-your-token"
|
|
51
|
+
$env:KXM_PROJECT = "example"
|
|
52
|
+
node --experimental-strip-types examples/reviewer-agent.ts
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This sample echoes requests to demonstrate acknowledgement and reply mechanics. It does not perform a real review and should not be used as an approval bot.
|
|
56
|
+
|
|
57
|
+
Send it a request from another terminal:
|
|
58
|
+
|
|
59
|
+
```powershell
|
|
60
|
+
$env:KXM_AUTH_TOKEN = "replace-with-your-token"
|
|
61
|
+
$env:KXM_PROJECT = "example"
|
|
62
|
+
node --experimental-strip-types examples/requester.ts example-reviewer "Check the rollout plan"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Agent use cases
|
|
66
|
+
|
|
67
|
+
### Plan then review
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
Use kxm. Ask planner to produce a bounded implementation plan, then
|
|
71
|
+
ask reviewer to identify correctness and security risks. Verify both responses
|
|
72
|
+
before making changes.
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Implement with separate ownership
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
Use kxm. Give api-builder ownership of src/api only and ui-builder
|
|
79
|
+
ownership of src/ui only. Ask each for changed paths and test results. Do not
|
|
80
|
+
let either agent edit shared configuration.
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Non-blocking delegation
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
Send reviewer a request with kxm_send, retain the message ID, continue the
|
|
87
|
+
independent implementation, then use kxm_get before deciding whether to wait.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Cancel obsolete work
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
If a sent request is no longer relevant, call kxm_cancel with its message ID.
|
|
94
|
+
Do not treat cancellation as rollback: verify whether the peer already changed
|
|
95
|
+
files or external state.
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Retry safely
|
|
99
|
+
|
|
100
|
+
Supply a stable `idempotencyKey` when an automated caller might retry the same
|
|
101
|
+
send after a network failure. Reusing the key with different content returns a
|
|
102
|
+
conflict instead of silently creating ambiguous work.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "provenance-review",
|
|
4
|
+
"source": "generic",
|
|
5
|
+
"project": "provenance-demo",
|
|
6
|
+
"target": "coordinator",
|
|
7
|
+
"secretEnv": "KXM_WORKFLOW_SECRET",
|
|
8
|
+
"delivery": "followUp",
|
|
9
|
+
"promptTemplate": "Review {{task.id}}: {{task.summary}}. Collect independent peer findings, preserve contradictions, and make an evidence-backed decision.",
|
|
10
|
+
"stages": [
|
|
11
|
+
{
|
|
12
|
+
"id": "review",
|
|
13
|
+
"label": "Independent review",
|
|
14
|
+
"instructions": "Ask both eligible reviewers independently with one kxm_fanout call. Set correlationId to the exact run ID, timeoutMs to 120000, and idempotencyKeyPrefix to the deterministic value provenance-review:<runId>:review:<attempt>. The tool call itself must include workflowContext for this run, stage review, requirement independent peer reviews, and the current attempt; stating that context in a plan is not sufficient. Treat every returned messageId as the durable handle immediately. Use kxm_get to verify each stored message has the exact run, stage, requirement, and attempt binding. For every pending reply, call kxm_await with that messageId and timeoutMs 120000; never replace pending work with a new idempotency prefix. On interruption or uncertain delivery, repeat the exact fanout parameters so the hub returns the same messages. Re-read and verify each durable message after it replies. Compare findings, record contradictions and the chosen resolution, then cite only the bound durable replied message IDs.",
|
|
15
|
+
"requiredEvidence": [
|
|
16
|
+
"independent peer reviews",
|
|
17
|
+
"coordinator decision"
|
|
18
|
+
],
|
|
19
|
+
"evidencePolicies": {
|
|
20
|
+
"independent peer reviews": {
|
|
21
|
+
"kind": "peer-reply",
|
|
22
|
+
"minProducers": 2,
|
|
23
|
+
"eligibleAgents": [
|
|
24
|
+
"reviewer-claude",
|
|
25
|
+
"reviewer-grok"
|
|
26
|
+
],
|
|
27
|
+
"acceptedStatuses": [
|
|
28
|
+
"replied"
|
|
29
|
+
],
|
|
30
|
+
"degradation": {
|
|
31
|
+
"minProducers": 1
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"maxAttempts": 3,
|
|
36
|
+
"area": "gates"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { HubClient } from "../plugins/kxm/src/client.ts";
|
|
3
|
+
|
|
4
|
+
const [target, ...contentParts] = process.argv.slice(2);
|
|
5
|
+
if (!target || contentParts.length === 0) {
|
|
6
|
+
throw new Error("usage: requester.ts <target> <request text>");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const authToken = process.env.KXM_AUTH_TOKEN;
|
|
10
|
+
const client = new HubClient({
|
|
11
|
+
serverUrl: process.env.KXM_SERVER_URL ?? "http://127.0.0.1:7331",
|
|
12
|
+
name: process.env.KXM_AGENT_NAME ?? `example-requester-${process.pid}`,
|
|
13
|
+
purpose: process.env.KXM_AGENT_PURPOSE ?? "Sends a request from the command line",
|
|
14
|
+
project: process.env.KXM_PROJECT ?? "example",
|
|
15
|
+
...(authToken ? { authToken } : {}),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
await client.start(() => undefined);
|
|
20
|
+
const request = await client.send({
|
|
21
|
+
target,
|
|
22
|
+
content: contentParts.join(" "),
|
|
23
|
+
idempotencyKey: randomUUID(),
|
|
24
|
+
});
|
|
25
|
+
process.stdout.write(`sent ${request.id}; waiting for ${target}\n`);
|
|
26
|
+
const completed = await client.awaitResponse(request.id);
|
|
27
|
+
process.stdout.write(`${JSON.stringify(completed, null, 2)}\n`);
|
|
28
|
+
} finally {
|
|
29
|
+
await client.stop();
|
|
30
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HubClient } from "../plugins/kxm/src/client.ts";
|
|
2
|
+
|
|
3
|
+
const serverUrl = process.env.KXM_SERVER_URL ?? "http://127.0.0.1:7331";
|
|
4
|
+
const authToken = process.env.KXM_AUTH_TOKEN;
|
|
5
|
+
const project = process.env.KXM_PROJECT ?? "example";
|
|
6
|
+
const client = new HubClient({
|
|
7
|
+
serverUrl,
|
|
8
|
+
name: process.env.KXM_AGENT_NAME ?? "example-reviewer",
|
|
9
|
+
purpose: process.env.KXM_AGENT_PURPOSE ?? "Demonstrates a custom mesh client",
|
|
10
|
+
project,
|
|
11
|
+
...(authToken ? { authToken } : {}),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
await client.start(async (event) => {
|
|
15
|
+
if (event.type !== "message") return;
|
|
16
|
+
await client.acknowledge(event.message.id);
|
|
17
|
+
process.stdout.write(`request from ${event.message.fromName}: ${event.message.content}\n`);
|
|
18
|
+
await client.reply(event.message.id, `Example client received: ${event.message.content}`);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
process.stdout.write(`reviewer connected as ${client.agent!.name} in ${project}\n`);
|
|
22
|
+
|
|
23
|
+
async function shutdown(): Promise<void> {
|
|
24
|
+
await client.stop();
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
process.once("SIGINT", () => void shutdown());
|
|
29
|
+
process.once("SIGTERM", () => void shutdown());
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { HubClient } from "../plugins/kxm/src/client.ts";
|
|
2
|
+
import { createMeshHub } from "../plugins/kxm/src/hub.ts";
|
|
3
|
+
|
|
4
|
+
const token = "local-example-token";
|
|
5
|
+
const hub = createMeshHub({ port: 0, authToken: token, rateLimit: false });
|
|
6
|
+
const address = await hub.start();
|
|
7
|
+
const planner = new HubClient({
|
|
8
|
+
serverUrl: address.url,
|
|
9
|
+
authToken: token,
|
|
10
|
+
name: "example-planner",
|
|
11
|
+
purpose: "Delegates a focused example task",
|
|
12
|
+
project: "example",
|
|
13
|
+
});
|
|
14
|
+
const reviewer = new HubClient({
|
|
15
|
+
serverUrl: address.url,
|
|
16
|
+
authToken: token,
|
|
17
|
+
name: "example-reviewer",
|
|
18
|
+
purpose: "Returns a deterministic example review",
|
|
19
|
+
project: "example",
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
await reviewer.start(async (event) => {
|
|
24
|
+
if (event.type !== "message") return;
|
|
25
|
+
await reviewer.acknowledge(event.message.id);
|
|
26
|
+
await reviewer.reply(event.message.id, `Reviewed: ${event.message.content}`);
|
|
27
|
+
});
|
|
28
|
+
await planner.start(() => undefined);
|
|
29
|
+
const peers = await planner.listAgents();
|
|
30
|
+
const request = await planner.send({
|
|
31
|
+
target: "example-reviewer",
|
|
32
|
+
content: "Check the rollout plan",
|
|
33
|
+
idempotencyKey: "example-roundtrip-1",
|
|
34
|
+
ttlMs: 10_000,
|
|
35
|
+
});
|
|
36
|
+
const completed = await planner.awaitResponse(request.id, 3_000);
|
|
37
|
+
process.stdout.write(`${JSON.stringify({
|
|
38
|
+
peers: peers.map((peer) => peer.name),
|
|
39
|
+
messageId: completed.id,
|
|
40
|
+
status: completed.status,
|
|
41
|
+
reply: completed.reply?.content,
|
|
42
|
+
}, null, 2)}\n`);
|
|
43
|
+
} finally {
|
|
44
|
+
await Promise.allSettled([planner.stop(), reviewer.stop()]);
|
|
45
|
+
await hub.close();
|
|
46
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
schema: kxm.agent.v1
|
|
2
|
+
purpose: Coordinate the pinned workflow and emit only schema-validated commands.
|
|
3
|
+
model:
|
|
4
|
+
profile: primary
|
|
5
|
+
tools:
|
|
6
|
+
preset: coordinator
|
|
7
|
+
defaultRepositoryAccess: read
|
|
8
|
+
repositories:
|
|
9
|
+
control: read
|
|
10
|
+
api: read
|
|
11
|
+
web: read
|
|
12
|
+
network: restricted
|
|
13
|
+
resultSchema: kxm.assignment-result.v1
|
|
14
|
+
session:
|
|
15
|
+
reuse: compatible-run-scope
|
|
16
|
+
maxIdleMs: 1800000
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
schema: kxm.agent.v1
|
|
2
|
+
purpose: First fixed-identity critic for migrated strict producer policies.
|
|
3
|
+
harness: claude
|
|
4
|
+
model:
|
|
5
|
+
profile: critic-claude
|
|
6
|
+
tools:
|
|
7
|
+
preset: read-only
|
|
8
|
+
defaultRepositoryAccess: read
|
|
9
|
+
repositories:
|
|
10
|
+
control: read
|
|
11
|
+
api: read
|
|
12
|
+
web: read
|
|
13
|
+
network: provider-only
|
|
14
|
+
resultSchema: kxm.assignment-result.v1
|
|
15
|
+
session:
|
|
16
|
+
reuse: compatible-run-scope
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
schema: kxm.agent.v1
|
|
2
|
+
purpose: Second fixed-identity critic for migrated strict producer policies.
|
|
3
|
+
model:
|
|
4
|
+
profile: critic-grok
|
|
5
|
+
tools:
|
|
6
|
+
preset: read-only
|
|
7
|
+
defaultRepositoryAccess: read
|
|
8
|
+
repositories:
|
|
9
|
+
control: read
|
|
10
|
+
api: read
|
|
11
|
+
web: read
|
|
12
|
+
network: provider-only
|
|
13
|
+
resultSchema: kxm.assignment-result.v1
|
|
14
|
+
session:
|
|
15
|
+
reuse: compatible-run-scope
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
schema: kxm.agent.v1
|
|
2
|
+
purpose: Third provider-distinct critic used by the vNext MOA target.
|
|
3
|
+
model:
|
|
4
|
+
profile: critic-gemini
|
|
5
|
+
tools:
|
|
6
|
+
preset: read-only
|
|
7
|
+
defaultRepositoryAccess: read
|
|
8
|
+
repositories:
|
|
9
|
+
control: read
|
|
10
|
+
api: read
|
|
11
|
+
web: read
|
|
12
|
+
network: provider-only
|
|
13
|
+
resultSchema: kxm.assignment-result.v1
|
|
14
|
+
session:
|
|
15
|
+
reuse: compatible-run-scope
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
schema: kxm.agent.v1
|
|
2
|
+
purpose: Implement the approved plan in the assignment-owned repository worktree.
|
|
3
|
+
model:
|
|
4
|
+
tag: implementation
|
|
5
|
+
tools:
|
|
6
|
+
preset: workspace-writer
|
|
7
|
+
defaultRepositoryAccess: none
|
|
8
|
+
repositories:
|
|
9
|
+
control: read
|
|
10
|
+
api: write
|
|
11
|
+
web: write
|
|
12
|
+
network: provider-only
|
|
13
|
+
resultSchema: kxm.assignment-result.v1
|
|
14
|
+
session:
|
|
15
|
+
reuse: compatible-run-scope
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
schema: kxm.agent.v1
|
|
2
|
+
purpose: Produce an implementation plan grounded in the pinned repositories and evidence.
|
|
3
|
+
model:
|
|
4
|
+
tag: planning
|
|
5
|
+
tools:
|
|
6
|
+
preset: read-only
|
|
7
|
+
defaultRepositoryAccess: read
|
|
8
|
+
repositories:
|
|
9
|
+
control: read
|
|
10
|
+
api: read
|
|
11
|
+
web: read
|
|
12
|
+
network: provider-only
|
|
13
|
+
resultSchema: kxm.assignment-result.v1
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
schema: kxm.agent.v1
|
|
2
|
+
purpose: Create and execute a production-coupled failing reproduction without changing production code.
|
|
3
|
+
model:
|
|
4
|
+
tag: implementation
|
|
5
|
+
tools:
|
|
6
|
+
preset: tests-writer
|
|
7
|
+
defaultRepositoryAccess: none
|
|
8
|
+
repositories:
|
|
9
|
+
control: read
|
|
10
|
+
api: write
|
|
11
|
+
web: write
|
|
12
|
+
network: provider-only
|
|
13
|
+
resultSchema: kxm.assignment-result.v1
|
|
14
|
+
session:
|
|
15
|
+
reuse: compatible-run-scope
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
schema: kxm.agent.v1
|
|
2
|
+
purpose: Independently review correctness, security, regression risk, and evidence.
|
|
3
|
+
model:
|
|
4
|
+
tag: critic
|
|
5
|
+
tools:
|
|
6
|
+
preset: read-only
|
|
7
|
+
defaultRepositoryAccess: read
|
|
8
|
+
repositories:
|
|
9
|
+
control: read
|
|
10
|
+
api: read
|
|
11
|
+
web: read
|
|
12
|
+
network: provider-only
|
|
13
|
+
resultSchema: kxm.assignment-result.v1
|
|
14
|
+
session:
|
|
15
|
+
reuse: compatible-run-scope
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
schema: kxm.model.v1
|
|
2
|
+
provider: anthropic
|
|
3
|
+
model: claude-sonnet-4-6
|
|
4
|
+
thinking: high
|
|
5
|
+
tags:
|
|
6
|
+
- implementation
|
|
7
|
+
capabilities:
|
|
8
|
+
- tools
|
|
9
|
+
- structured-output
|
|
10
|
+
priority: 100
|
|
11
|
+
limits:
|
|
12
|
+
contextTokens: 200000
|
|
13
|
+
outputTokens: 32000
|
|
14
|
+
timeoutMs: 1800000
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
schema: kxm.model.v1
|
|
2
|
+
provider: xai
|
|
3
|
+
model: grok-4.6
|
|
4
|
+
thinking: high
|
|
5
|
+
tags:
|
|
6
|
+
- primary
|
|
7
|
+
- planning
|
|
8
|
+
capabilities:
|
|
9
|
+
- tools
|
|
10
|
+
- structured-output
|
|
11
|
+
priority: 100
|
|
12
|
+
fallbacks:
|
|
13
|
+
- profile: implementation
|
|
14
|
+
limits:
|
|
15
|
+
contextTokens: 200000
|
|
16
|
+
outputTokens: 32000
|
|
17
|
+
timeoutMs: 1800000
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
schema: kxm.prices.v1
|
|
2
|
+
date: "2026-09-08"
|
|
3
|
+
sha256: 949aac1795e626204a093b7a70a398412c6128e241adf012652ca7abe79018ae
|
|
4
|
+
currency: USD
|
|
5
|
+
models:
|
|
6
|
+
- id: anthropic/claude-3-7-sonnet
|
|
7
|
+
provider: anthropic
|
|
8
|
+
model: claude-3-7-sonnet
|
|
9
|
+
aliases:
|
|
10
|
+
- fable
|
|
11
|
+
- claude-3-7-sonnet-latest
|
|
12
|
+
tiers:
|
|
13
|
+
- upToContextTokens: 200000
|
|
14
|
+
inputPerMillion: 3.00
|
|
15
|
+
outputPerMillion: 15.00
|
|
16
|
+
cacheReadPerMillion: 0.30
|
|
17
|
+
cacheWritePerMillion: 3.75
|
|
18
|
+
|
|
19
|
+
- id: anthropic/claude-3-5-sonnet
|
|
20
|
+
provider: anthropic
|
|
21
|
+
model: claude-3-5-sonnet
|
|
22
|
+
aliases:
|
|
23
|
+
- claude-3-5-sonnet-latest
|
|
24
|
+
tiers:
|
|
25
|
+
- upToContextTokens: 200000
|
|
26
|
+
inputPerMillion: 3.00
|
|
27
|
+
outputPerMillion: 15.00
|
|
28
|
+
cacheReadPerMillion: 0.30
|
|
29
|
+
cacheWritePerMillion: 3.75
|
|
30
|
+
|
|
31
|
+
- id: openai/gpt-5.6-sol
|
|
32
|
+
provider: openai
|
|
33
|
+
model: gpt-5.6-sol
|
|
34
|
+
aliases:
|
|
35
|
+
- gpt-5.6-sol
|
|
36
|
+
- gpt-4o
|
|
37
|
+
tiers:
|
|
38
|
+
- upToContextTokens: 128000
|
|
39
|
+
inputPerMillion: 2.50
|
|
40
|
+
outputPerMillion: 10.00
|
|
41
|
+
cacheReadPerMillion: 1.25
|
|
42
|
+
cacheWritePerMillion: 2.50
|
|
43
|
+
|
|
44
|
+
- id: openai/o3-mini
|
|
45
|
+
provider: openai
|
|
46
|
+
model: o3-mini
|
|
47
|
+
tiers:
|
|
48
|
+
- upToContextTokens: 200000
|
|
49
|
+
inputPerMillion: 1.10
|
|
50
|
+
outputPerMillion: 4.40
|
|
51
|
+
cacheReadPerMillion: 0.55
|
|
52
|
+
cacheWritePerMillion: 1.10
|
|
53
|
+
|
|
54
|
+
- id: xai/grok-4.6
|
|
55
|
+
provider: xai
|
|
56
|
+
model: grok-4.6
|
|
57
|
+
aliases:
|
|
58
|
+
- grok-4.6
|
|
59
|
+
tiers:
|
|
60
|
+
- upToContextTokens: 131072
|
|
61
|
+
inputPerMillion: 2.00
|
|
62
|
+
outputPerMillion: 10.00
|
|
63
|
+
cacheReadPerMillion: 0.50
|
|
64
|
+
cacheWritePerMillion: 2.00
|
|
65
|
+
|
|
66
|
+
- id: xai/grok-2
|
|
67
|
+
provider: xai
|
|
68
|
+
model: grok-2
|
|
69
|
+
tiers:
|
|
70
|
+
- upToContextTokens: 131072
|
|
71
|
+
inputPerMillion: 2.00
|
|
72
|
+
outputPerMillion: 10.00
|
|
73
|
+
cacheReadPerMillion: 0.50
|
|
74
|
+
cacheWritePerMillion: 2.00
|
|
75
|
+
|
|
76
|
+
- id: zhipu/glm-4-plus
|
|
77
|
+
provider: zhipu
|
|
78
|
+
model: glm-4-plus
|
|
79
|
+
aliases:
|
|
80
|
+
- glm-4
|
|
81
|
+
tiers:
|
|
82
|
+
- upToContextTokens: 128000
|
|
83
|
+
inputPerMillion: 1.40
|
|
84
|
+
outputPerMillion: 1.40
|
|
85
|
+
cacheReadPerMillion: 0.14
|
|
86
|
+
cacheWritePerMillion: 1.40
|
|
87
|
+
|
|
88
|
+
- id: moonshot/kimi-k1.5
|
|
89
|
+
provider: moonshot
|
|
90
|
+
model: kimi-k1.5
|
|
91
|
+
aliases:
|
|
92
|
+
- moonshot-v1-128k
|
|
93
|
+
tiers:
|
|
94
|
+
- upToContextTokens: 128000
|
|
95
|
+
inputPerMillion: 1.00
|
|
96
|
+
outputPerMillion: 2.00
|
|
97
|
+
cacheReadPerMillion: 0.20
|
|
98
|
+
cacheWritePerMillion: 1.00
|
|
99
|
+
|
|
100
|
+
- id: alibaba/qwen3-coder-plus
|
|
101
|
+
provider: alibaba
|
|
102
|
+
model: qwen3-coder-plus
|
|
103
|
+
aliases:
|
|
104
|
+
- openrouter/qwen/qwen3-coder-plus
|
|
105
|
+
- qwen/qwen3-coder-plus
|
|
106
|
+
tiers:
|
|
107
|
+
- upToContextTokens: 131072
|
|
108
|
+
inputPerMillion: 1.00
|
|
109
|
+
outputPerMillion: 3.00
|
|
110
|
+
cacheReadPerMillion: 0.20
|
|
111
|
+
cacheWritePerMillion: 1.00
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
schema: kxm.project.v1
|
|
2
|
+
id: prj_01JPROJECT00000000000000000
|
|
3
|
+
name: Payments Platform
|
|
4
|
+
description: Example control project with API and web member repositories.
|
|
5
|
+
defaultWorkflow: default
|
|
6
|
+
defaultExecutor: local
|
|
7
|
+
defaultHarness: pi
|
|
8
|
+
repositories:
|
|
9
|
+
- id: control
|
|
10
|
+
role: control
|
|
11
|
+
required: true
|
|
12
|
+
pathHint: .
|
|
13
|
+
- id: api
|
|
14
|
+
role: member
|
|
15
|
+
required: true
|
|
16
|
+
remoteIdentity: ssh://git.example.test/payments/api.git
|
|
17
|
+
pathHint: repositories/api
|
|
18
|
+
- id: web
|
|
19
|
+
role: member
|
|
20
|
+
required: true
|
|
21
|
+
remoteIdentity: ssh://git.example.test/payments/web.git
|
|
22
|
+
pathHint: repositories/web
|
|
23
|
+
workspace:
|
|
24
|
+
dirtySnapshot:
|
|
25
|
+
untracked: bounded
|
|
26
|
+
maxUntrackedFileBytes: 26214400
|
|
27
|
+
maxUntrackedTotalBytes: 262144000
|
|
28
|
+
dirtySubmodules: fail
|
|
29
|
+
limits:
|
|
30
|
+
maxConcurrentRuns: 4
|
|
31
|
+
maxRunDurationMs: 28800000
|
|
32
|
+
maxAgentTimeMs: 57600000
|