0xray 4.0.23 → 4.0.25
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/.grok-plugin/plugin.json +1 -1
- package/.xray/features.json +11 -1
- package/.xray/features.schema.json +17 -0
- package/AGENTS-consumer.md +1 -1
- package/AGENTS.md +1 -1
- package/README.md +2 -2
- package/SKILLS.md +1 -1
- package/dist/AGENTS.md +1 -1
- package/dist/CHANGELOG.md +43 -0
- package/dist/README.md +2 -2
- package/dist/SKILLS.md +1 -1
- package/dist/cli/commands/validate.js +3 -0
- package/dist/cli/index.js +131 -100
- package/dist/core/features-config.d.ts +4 -0
- package/dist/core/features-config.js +10 -0
- package/dist/inference/inference-accumulator.d.ts +2 -0
- package/dist/inference/inference-accumulator.js +74 -2
- package/dist/inference/inference-cycle.js +1 -0
- package/dist/inference/inference-proposal-generator.js +65 -7
- package/dist/inference/inference-run-gate.d.ts +8 -0
- package/dist/inference/inference-run-gate.js +10 -0
- package/dist/inference/session-capture.d.ts +27 -0
- package/dist/inference/session-capture.js +277 -1
- package/dist/integrations/cursor/hooks/pre-compact.js +89 -1
- package/dist/integrations/hooks/plates.cjs +165 -0
- package/dist/integrations/hooks/station-hook-runtime.cjs +29 -11
- package/dist/integrations/hooks/station-memory-ingest.mjs +109 -42
- package/dist/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
- package/dist/mcps/researcher-confidence.d.ts +5 -1
- package/dist/mcps/researcher-confidence.js +37 -0
- package/dist/mcps/researcher.server.js +2 -2
- package/dist/memory-routing/plates.d.ts +16 -0
- package/dist/memory-routing/plates.js +71 -0
- package/dist/memory-routing/types.d.ts +2 -0
- package/dist/memory-routing/types.js +2 -1
- package/dist/processors/implementations/inference-improvement-processor.d.ts +5 -0
- package/dist/processors/implementations/inference-improvement-processor.js +101 -2
- package/dist/processors/implementations/storytelling-trigger-processor.js +1 -11
- package/dist/processors/processor-manager.d.ts +1 -1
- package/dist/processors/processor-manager.js +52 -20
- package/docs-site/docs/plates/boot.md +52 -0
- package/docs-site/docs/plates/governance.md +50 -0
- package/docs-site/docs/plates/index.md +16 -0
- package/docs-site/docs/plates/memory-recall.md +49 -0
- package/docs-site/docs/plates/orchestration.md +55 -0
- package/docs-site/docs/plates/processor.md +46 -0
- package/docs-site/docs/plates/reporting.md +42 -0
- package/docs-site/docs/plates/routing.md +49 -0
- package/llms.txt +1 -1
- package/package.json +2 -1
- package/scripts/foundry/assert-packed-dist-cli.mjs +3 -0
- package/scripts/foundry/plant/skills/mill/SKILL.md +1 -1
- package/scripts/node/consumer-install-smoke.mjs +7 -4
- package/src/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
- package/src/mcps/researcher-confidence.ts +56 -3
- package/src/mcps/researcher.server.ts +4 -5
- package/vendor/@0xray/repertoire/README.md +3 -1
- package/vendor/@0xray/repertoire/dist/registry/CuratedSignalsManager.d.ts +23 -3
- package/vendor/@0xray/repertoire/dist/registry/CuratedSignalsManager.d.ts.map +1 -1
- package/vendor/@0xray/repertoire/dist/registry/CuratedSignalsManager.js +119 -16
- package/vendor/@0xray/repertoire/dist/registry/CuratedSignalsManager.js.map +1 -1
- package/vendor/@0xray/repertoire/dist/types.d.ts +1 -1
- package/vendor/@0xray/repertoire/dist/types.d.ts.map +1 -1
- package/vendor/@0xray/repertoire/package.json +1 -1
- package/xray/features.json +11 -1
- package/xray/features.schema.json +17 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Orchestration
|
|
3
|
+
sidebar_label: Orchestration
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Orchestration
|
|
7
|
+
|
|
8
|
+
Multi-step work is planned, run, and closed. Routing picks an agent. This plate is the coordination around that pick.
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
┌────────────────────────────────────────────────────────────┐
|
|
12
|
+
│ INPUT LAYER │
|
|
13
|
+
│ │
|
|
14
|
+
│ ┌────────────────────────────────────────────────────┐ │
|
|
15
|
+
│ │ tasks │ │
|
|
16
|
+
│ │ descriptions · dependencies · type │ │
|
|
17
|
+
│ └──────────────────────────┬─────────────────────────┘ │
|
|
18
|
+
└──────────────────────────────┼────────────────────────────┘
|
|
19
|
+
v
|
|
20
|
+
┌──────────────────────────────┼────────────────────────────┐
|
|
21
|
+
│ PROCESSING LAYER v │
|
|
22
|
+
│ ┌────────────────────────────────────────────────────┐ │
|
|
23
|
+
│ │ analyze-complexity │ │
|
|
24
|
+
│ │ ExecutionPlanner validates and plans │ │
|
|
25
|
+
│ └──────────────────────────┬─────────────────────────┘ │
|
|
26
|
+
│ v │
|
|
27
|
+
│ ┌────────────────────────────────────────────────────┐ │
|
|
28
|
+
│ │ orchestrate-task │ │
|
|
29
|
+
│ │ lead stays on the main thread │ │
|
|
30
|
+
│ └──────────────────────────┬─────────────────────────┘ │
|
|
31
|
+
│ v │
|
|
32
|
+
│ ┌────────────────────────────────────────────────────┐ │
|
|
33
|
+
│ │ spawnAside │ │
|
|
34
|
+
│ │ on orchestrate-task, analyze-complexity, │ │
|
|
35
|
+
│ │ and govern-and-apply │ │
|
|
36
|
+
│ │ observations from the three flows │ │
|
|
37
|
+
│ └──────────────────────────┬─────────────────────────┘ │
|
|
38
|
+
│ v │
|
|
39
|
+
│ ┌────────────────────────────────────────────────────┐ │
|
|
40
|
+
│ │ confidence gate │ │
|
|
41
|
+
│ │ getTaskConfidence when Repertoire is worn │ │
|
|
42
|
+
│ └──────────────────────────┬─────────────────────────┘ │
|
|
43
|
+
│ v │
|
|
44
|
+
│ ┌────────────────────────────────────────────────────┐ │
|
|
45
|
+
│ │ closeAside │ │
|
|
46
|
+
│ └──────────────────────────┬─────────────────────────┘ │
|
|
47
|
+
└──────────────────────────────┼────────────────────────────┘
|
|
48
|
+
v
|
|
49
|
+
┌──────────────────────────────┼────────────────────────────┐
|
|
50
|
+
│ OUTPUT LAYER v │
|
|
51
|
+
│ ┌─────────────────────┐ ┌─────────────────────────┐ │
|
|
52
|
+
│ │ execution result │ │ aside observations │ │
|
|
53
|
+
│ └─────────────────────┘ └─────────────────────────┘ │
|
|
54
|
+
└────────────────────────────────────────────────────────────┘
|
|
55
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Processor
|
|
3
|
+
sidebar_label: Processor
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Processor
|
|
7
|
+
|
|
8
|
+
Three pipelines run in parallel. A is the live suit. B is the legacy processor manager. C is mill, git, and CI. Nothing in A is an input to B or C.
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
┌────────────────────────────────────────────────────────────────────────┐
|
|
12
|
+
│ INPUT LAYER │
|
|
13
|
+
│ │
|
|
14
|
+
│ ┌──────────────────┐ ┌──────────────────┐ ┌────────────────────┐ │
|
|
15
|
+
│ │ tool / session │ │ prompt text │ │ commit / release │ │
|
|
16
|
+
│ └────────┬─────────┘ └────────┬─────────┘ └─────────┬──────────┘ │
|
|
17
|
+
└────────────┼─────────────────────┼──────────────────────┼─────────────┘
|
|
18
|
+
v v v
|
|
19
|
+
┌────────────┼─────────────────────┼──────────────────────┼─────────────┐
|
|
20
|
+
│ PROCESSING LAYER three parallel pipelines │ │
|
|
21
|
+
│ │ │ │ │
|
|
22
|
+
│ ┌─────────┴──────────┐ ┌────────┴─────────┐ ┌──────────┴──────────┐ │
|
|
23
|
+
│ │ A suit (live OS) │ │ B legacy manager │ │ C mill / git / CI │ │
|
|
24
|
+
│ │ │ │ │ │ │ │
|
|
25
|
+
│ │ SessionStart │ │ prompt-security │ │ mint │ │
|
|
26
|
+
│ │ v │ │ v │ │ v │ │
|
|
27
|
+
│ │ PreToolUse │ │ executePre │ │ inspect │ │
|
|
28
|
+
│ │ v │ │ v │ │ v │ │
|
|
29
|
+
│ │ tool runs │ │ work │ │ pre-commit │ │
|
|
30
|
+
│ │ v │ │ v │ │ v │ │
|
|
31
|
+
│ │ PostToolUse │ │ executePost │ │ pre-push │ │
|
|
32
|
+
│ │ v │ │ │ │ v │ │
|
|
33
|
+
│ │ compact heat │ │ │ │ foundry release │ │
|
|
34
|
+
│ │ │ │ │ │ v │ │
|
|
35
|
+
│ │ │ │ │ │ CI quality → docs │ │
|
|
36
|
+
│ └─────────┬──────────┘ └────────┬─────────┘ └──────────┬──────────┘ │
|
|
37
|
+
└────────────┼─────────────────────┼──────────────────────┼────────────┘
|
|
38
|
+
v v v
|
|
39
|
+
┌────────────┴─────────────────────┴──────────────────────┴────────────┐
|
|
40
|
+
│ OUTPUT LAYER │
|
|
41
|
+
│ │
|
|
42
|
+
│ ┌──────────────────┐ ┌──────────────────┐ ┌────────────────────┐ │
|
|
43
|
+
│ │ allow / deny │ │ processor result │ │ gate / tag │ │
|
|
44
|
+
│ └──────────────────┘ └──────────────────┘ └────────────────────┘ │
|
|
45
|
+
└────────────────────────────────────────────────────────────────────────┘
|
|
46
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Reporting
|
|
3
|
+
sidebar_label: Reporting
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Reporting
|
|
7
|
+
|
|
8
|
+
Logs become a report. Session start can also drop a schedule marker. The marker is a side output, not a second chain through the formatter.
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
┌────────────────────────────────────────────────────────────┐
|
|
12
|
+
│ INPUT LAYER │
|
|
13
|
+
│ │
|
|
14
|
+
│ ┌──────────────────┐ ┌──────────────┐ ┌─────────────┐ │
|
|
15
|
+
│ │ activity log │ │ schedule │ │ CLI request │ │
|
|
16
|
+
│ └────────┬─────────┘ └──────┬───────┘ └──────┬──────┘ │
|
|
17
|
+
│ └───────────────────┴────────┬────────┘ │
|
|
18
|
+
└─────────────────────────────────────────┼──────────────────┘
|
|
19
|
+
v
|
|
20
|
+
┌─────────────────────────────────────────┼──────────────────┐
|
|
21
|
+
│ PROCESSING LAYER v │
|
|
22
|
+
│ ┌────────────────────────────────────────────────────┐ │
|
|
23
|
+
│ │ FrameworkReportingSystem │ │
|
|
24
|
+
│ │ collect logs → metrics → formatReport │ │
|
|
25
|
+
│ │ cache a fresh report, then write the file │ │
|
|
26
|
+
│ └──────────────────────────┬─────────────────────────┘ │
|
|
27
|
+
│ │ │
|
|
28
|
+
│ ┌──────────────────────────┼─────────────────────────┐ │
|
|
29
|
+
│ │ SessionStart marker │ │ │
|
|
30
|
+
│ │ autonomous-reporting │ side output │ │
|
|
31
|
+
│ │ scheduled flag │ │ │
|
|
32
|
+
│ └──────────────────────────┼─────────────────────────┘ │
|
|
33
|
+
└──────────────────────────────┼────────────────────────────┘
|
|
34
|
+
v
|
|
35
|
+
┌──────────────────────────────┼────────────────────────────┐
|
|
36
|
+
│ OUTPUT LAYER v │
|
|
37
|
+
│ ┌──────────────────────────┐ ┌─────────────────────┐ │
|
|
38
|
+
│ │ report file │ │ realtime health │ │
|
|
39
|
+
│ │ markdown or json │ │ score and alerts │ │
|
|
40
|
+
│ └──────────────────────────┘ └─────────────────────┘ │
|
|
41
|
+
└────────────────────────────────────────────────────────────┘
|
|
42
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Routing
|
|
3
|
+
sidebar_label: Routing
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Routing
|
|
7
|
+
|
|
8
|
+
Task text becomes an agent. thinDispatch scores the work. Repertoire may adjust the score when the organ is worn.
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
12
|
+
│ INPUT LAYER │
|
|
13
|
+
│ │
|
|
14
|
+
│ ┌──────────────┐ ┌──────────────┐ ┌────────────────┐ │
|
|
15
|
+
│ │ task text │ │ @agent │ │ scoreAndRoute │ │
|
|
16
|
+
│ └──────┬───────┘ └──────┬───────┘ └───────┬────────┘ │
|
|
17
|
+
│ └──────────────────┴─────────┬─────────┘ │
|
|
18
|
+
└────────────────────────────────────────┼─────────────────────┘
|
|
19
|
+
v
|
|
20
|
+
┌────────────────────────────────────────┼─────────────────────┐
|
|
21
|
+
│ PROCESSING LAYER │ │
|
|
22
|
+
│ v │
|
|
23
|
+
│ ┌──────────────────────────────────────────────────────┐ │
|
|
24
|
+
│ │ TaskSkillRouter │ │
|
|
25
|
+
│ │ keyword facade into the route │ │
|
|
26
|
+
│ └──────────────────────────┬───────────────────────────┘ │
|
|
27
|
+
│ v │
|
|
28
|
+
│ ┌──────────────────────────────────────────────────────┐ │
|
|
29
|
+
│ │ thinDispatch │ │
|
|
30
|
+
│ │ ≤15 single agent │ │
|
|
31
|
+
│ │ ≤25 single agent with tools │ │
|
|
32
|
+
│ │ ≤50 multi-agent │ │
|
|
33
|
+
│ │ >50 orchestrator-led │ │
|
|
34
|
+
│ └──────────────────────────┬───────────────────────────┘ │
|
|
35
|
+
│ v │
|
|
36
|
+
│ ┌──────────────────────────────────────────────────────┐ │
|
|
37
|
+
│ │ Repertoire resolveThinDispatch │ │
|
|
38
|
+
│ │ worn organ may change agent and score │ │
|
|
39
|
+
│ │ null provider leaves the score alone │ │
|
|
40
|
+
│ └──────────────────────────┬───────────────────────────┘ │
|
|
41
|
+
└──────────────────────────────┼──────────────────────────────┘
|
|
42
|
+
v
|
|
43
|
+
┌──────────────────────────────┼──────────────────────────────┐
|
|
44
|
+
│ OUTPUT LAYER v │
|
|
45
|
+
│ ┌────────────┐ ┌────────────────┐ ┌────────────────┐ │
|
|
46
|
+
│ │ agent │ │ strategy │ │ adjusted score │ │
|
|
47
|
+
│ └────────────┘ └────────────────┘ └────────────────┘ │
|
|
48
|
+
└──────────────────────────────────────────────────────────────┘
|
|
49
|
+
```
|
package/llms.txt
CHANGED
|
@@ -35,7 +35,7 @@ Registered in `.mcp.json` as `npx -y 0xray mcp <cmd>`:
|
|
|
35
35
|
| `xray-code-review` | Proposal quality |
|
|
36
36
|
| `xray-architect-tools` | System design |
|
|
37
37
|
|
|
38
|
-
Not an 8th `xray-*` server. **Repertoire is preferred** — vendored 0.2.
|
|
38
|
+
Not an 8th `xray-*` server. **Repertoire is preferred** — vendored 0.2.8 ships on (`npx @0xray/repertoire mcp`). Dest is named laws, not hangar `repo-*` or git slugs. Survive compact is **Station** (Read `.xray/state/STATION.md`). Station is the ticket, not a substitute for Repertoire. Do not pin 0.1.8.
|
|
39
39
|
|
|
40
40
|
## Codex 69 (always on)
|
|
41
41
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "0xray",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.25",
|
|
4
4
|
"description": "Multi-agent orchestration and Codex governance for OpenCode, Hermes, Grok Build, and OpenClaw",
|
|
5
5
|
"readme": "README.md",
|
|
6
6
|
"license": "MIT",
|
|
@@ -179,6 +179,7 @@
|
|
|
179
179
|
"src/opencode/workflows/",
|
|
180
180
|
"src/integrations/grok/plugin/0xray/",
|
|
181
181
|
"src/integrations/openclaw/plugin/",
|
|
182
|
+
"docs-site/docs/plates/",
|
|
182
183
|
"src/skills/",
|
|
183
184
|
"src/mcps/",
|
|
184
185
|
".plugin/",
|
|
@@ -28,6 +28,9 @@ export const REQUIRED_PACK_PATHS = [
|
|
|
28
28
|
"dist/integrations/cursor/hooks/pre-tool-use.sh",
|
|
29
29
|
"dist/integrations/cursor/hooks/pre-compact.sh",
|
|
30
30
|
"dist/integrations/cursor/hooks/after-file-edit.sh",
|
|
31
|
+
"dist/integrations/hooks/plates.cjs",
|
|
32
|
+
"docs-site/docs/plates/memory-recall.md",
|
|
33
|
+
"docs-site/docs/plates/processor.md",
|
|
31
34
|
];
|
|
32
35
|
|
|
33
36
|
export function packedFilePaths(files) {
|
|
@@ -11,7 +11,7 @@ The mill **fastens** a suit. Default mill plant is **inspect** (inspecting AI wo
|
|
|
11
11
|
|
|
12
12
|
**Mill-fill:** their keys/files win. Mill plant names they did not overlay stay. JSON always merges.
|
|
13
13
|
|
|
14
|
-
**Factory:** **Repertoire is preferred** (vendored 0.2.
|
|
14
|
+
**Factory:** **Repertoire is preferred** (vendored 0.2.8 ships on; dest = named laws). Seven generated MCP. Constitution (PPE) stays worn. Not a fifth MCP. Not 5.0.
|
|
15
15
|
|
|
16
16
|
**Costume:** `foundry.json` `"costume": true` copies the 45/42 mill costume.
|
|
17
17
|
|
|
@@ -67,6 +67,9 @@ const REQUIRED_TARBALL_DIST = [
|
|
|
67
67
|
"package/dist/cli/index.js",
|
|
68
68
|
"package/dist/mcps/orchestrator.server.js",
|
|
69
69
|
"package/dist/integrations/grok/hooks/session-start.js",
|
|
70
|
+
"package/dist/integrations/hooks/plates.cjs",
|
|
71
|
+
"package/docs-site/docs/plates/memory-recall.md",
|
|
72
|
+
"package/docs-site/docs/plates/processor.md",
|
|
70
73
|
];
|
|
71
74
|
|
|
72
75
|
function assertPackedDistCliInTarball(tarballPath) {
|
|
@@ -78,7 +81,7 @@ function assertPackedDistCliInTarball(tarballPath) {
|
|
|
78
81
|
`packed tarball missing ${missing.join(", ")} (0xray@4.0.13 shipped 0 dist files)`,
|
|
79
82
|
);
|
|
80
83
|
}
|
|
81
|
-
process.stdout.write(" ✅ packed tarball includes dist/cli + MCP + Grok hooks\n");
|
|
84
|
+
process.stdout.write(" ✅ packed tarball includes dist/cli + MCP + Grok hooks + plate stamps\n");
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
function assertOrganRequire(tmpRoot) {
|
|
@@ -92,7 +95,7 @@ function assertOrganRequire(tmpRoot) {
|
|
|
92
95
|
if (organPkg.name !== "@0xray/repertoire") {
|
|
93
96
|
throw new Error(`required organ name ${organPkg.name}`);
|
|
94
97
|
}
|
|
95
|
-
if (organPkg.version !== "0.2.
|
|
98
|
+
if (organPkg.version !== "0.2.8") {
|
|
96
99
|
throw new Error(`required organ version ${organPkg.version}`);
|
|
97
100
|
}
|
|
98
101
|
if (fs.existsSync(path.join(tmpRoot, "vendor"))) {
|
|
@@ -165,8 +168,8 @@ function assertFreshInstallDefaults(tmpRoot, version) {
|
|
|
165
168
|
throw new Error("vendored @0xray/repertoire missing from fresh tarball install");
|
|
166
169
|
}
|
|
167
170
|
const organ = JSON.parse(fs.readFileSync(organPkg, "utf-8"));
|
|
168
|
-
if (organ.version !== "0.2.
|
|
169
|
-
throw new Error(`expected organ 0.2.
|
|
171
|
+
if (organ.version !== "0.2.8") {
|
|
172
|
+
throw new Error(`expected organ 0.2.8, got ${organ.version}`);
|
|
170
173
|
}
|
|
171
174
|
console.log(" ✅ .xray/features.json fresh-install defaults (opt-in off)");
|
|
172
175
|
return { consumerFeaturesPath, features };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { frameworkLogger } from '../core/framework-logger.js';
|
|
2
2
|
import { getMemoryRoutingProvider } from '../memory-routing/index.js';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { recallPlate } from '../memory-routing/plates.js';
|
|
4
|
+
import {
|
|
5
|
+
LESSON_TEXT_CAP,
|
|
6
|
+
type MemoryRoutingContext,
|
|
7
|
+
type MemorySignalLessons,
|
|
8
|
+
type MemoryTaskConfidence,
|
|
6
9
|
} from '../memory-routing/types.js';
|
|
7
10
|
|
|
8
11
|
const TRAP_LANGUAGE = /TYPE:\s*ontological-trap|ontological[- ]trap/i;
|
|
@@ -14,6 +17,10 @@ export interface ResearcherMemoryContext {
|
|
|
14
17
|
matchedSignals: string[];
|
|
15
18
|
recommendedAgent: string | null;
|
|
16
19
|
triggeredBy: 'trap-language' | 'high-confidence-primitives';
|
|
20
|
+
/** Graded lines for signals this task already matched. */
|
|
21
|
+
lessons?: MemorySignalLessons[];
|
|
22
|
+
/** Proposal text used to recall at most one pipeline plate. */
|
|
23
|
+
proposalText?: string;
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
export function shouldQueryRepertoireConfidence(
|
|
@@ -80,6 +87,7 @@ export async function resolveResearcherMemoryContext(input: {
|
|
|
80
87
|
confidence.matchedSignals.length > 0
|
|
81
88
|
? confidence.matchedSignals
|
|
82
89
|
: routingContext.matchedSignals;
|
|
90
|
+
const lessons = lessonsForMatchedSignals(routingContext.lessons, matchedSignals);
|
|
83
91
|
|
|
84
92
|
const context: ResearcherMemoryContext = {
|
|
85
93
|
providerId: provider.id,
|
|
@@ -87,6 +95,8 @@ export async function resolveResearcherMemoryContext(input: {
|
|
|
87
95
|
matchedSignals,
|
|
88
96
|
recommendedAgent: confidence.recommendedAgent,
|
|
89
97
|
triggeredBy: trapLanguageDetected ? 'trap-language' : 'high-confidence-primitives',
|
|
98
|
+
proposalText: taskText,
|
|
99
|
+
...(lessons.length > 0 ? { lessons } : {}),
|
|
90
100
|
};
|
|
91
101
|
|
|
92
102
|
if (confidence.highConfidenceTrapPresent) {
|
|
@@ -122,6 +132,12 @@ export function buildMemoryRoutingEvidence(
|
|
|
122
132
|
lines.push(`Recommended agent for trap handling: ${recommendedAgent}`);
|
|
123
133
|
}
|
|
124
134
|
|
|
135
|
+
for (const line of lessonSpeechLines(context.lessons, matchedSignals)) {
|
|
136
|
+
lines.push(`Lesson: ${line}`);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
appendRecalledPlate(lines, context.proposalText);
|
|
140
|
+
|
|
125
141
|
return lines;
|
|
126
142
|
}
|
|
127
143
|
|
|
@@ -140,5 +156,42 @@ export function formatMemoryRoutingBlock(context: ResearcherMemoryContext): stri
|
|
|
140
156
|
lines.push(` recommendedAgent: ${recommendedAgent}`);
|
|
141
157
|
}
|
|
142
158
|
|
|
159
|
+
for (const line of lessonSpeechLines(context.lessons, matchedSignals)) {
|
|
160
|
+
lines.push(` lesson: ${line}`);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
appendRecalledPlate(lines, context.proposalText);
|
|
164
|
+
|
|
143
165
|
return lines.join('\n');
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function appendRecalledPlate(lines: string[], proposalText: string | undefined): void {
|
|
169
|
+
const plate = recallPlate(proposalText);
|
|
170
|
+
if (!plate) return;
|
|
171
|
+
lines.push(`Plate: ${plate.id}`);
|
|
172
|
+
lines.push(plate.body);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function lessonsForMatchedSignals(
|
|
176
|
+
lessons: MemorySignalLessons[] | undefined,
|
|
177
|
+
matchedSignals: string[],
|
|
178
|
+
): MemorySignalLessons[] {
|
|
179
|
+
const matched = new Set(matchedSignals);
|
|
180
|
+
return (lessons ?? []).filter((lesson) => matched.has(lesson.name));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** Stored lesson text for signals this task matched. Empty text is omitted. */
|
|
184
|
+
function lessonSpeechLines(
|
|
185
|
+
lessons: MemorySignalLessons[] | undefined,
|
|
186
|
+
matchedSignals: string[],
|
|
187
|
+
): string[] {
|
|
188
|
+
const speech: string[] = [];
|
|
189
|
+
for (const lesson of lessonsForMatchedSignals(lessons, matchedSignals)) {
|
|
190
|
+
for (const line of lesson.lines) {
|
|
191
|
+
const text = line.text.trim().slice(0, LESSON_TEXT_CAP);
|
|
192
|
+
if (text.length === 0) continue;
|
|
193
|
+
speech.push(`${lesson.name}: ${text}`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return speech;
|
|
144
197
|
}
|
|
@@ -472,7 +472,7 @@ class XrayLibrarianServer extends XrayKnowledgeSkillBase {
|
|
|
472
472
|
});
|
|
473
473
|
|
|
474
474
|
const enrichedEvidence = [...(evidence || [])];
|
|
475
|
-
if (memoryContext
|
|
475
|
+
if (memoryContext) {
|
|
476
476
|
enrichedEvidence.push(...buildMemoryRoutingEvidence(memoryContext));
|
|
477
477
|
}
|
|
478
478
|
|
|
@@ -491,10 +491,9 @@ class XrayLibrarianServer extends XrayKnowledgeSkillBase {
|
|
|
491
491
|
recommendedAgent: memoryContext?.recommendedAgent,
|
|
492
492
|
});
|
|
493
493
|
|
|
494
|
-
const memoryRoutingBlock =
|
|
495
|
-
memoryContext
|
|
496
|
-
|
|
497
|
-
: "";
|
|
494
|
+
const memoryRoutingBlock = memoryContext
|
|
495
|
+
? `\n${formatMemoryRoutingBlock(memoryContext)}`
|
|
496
|
+
: "";
|
|
498
497
|
|
|
499
498
|
return {
|
|
500
499
|
content: [
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Factory memory organ for [0xRay](https://github.com/0xRayAI/xray): seed primitives, in-process memory routing, extra MCP (not an 8th `xray-*` server).
|
|
4
4
|
|
|
5
|
-
**v0.2.
|
|
5
|
+
**v0.2.8** · 0xRay **4.0** wear. Runtime does **not** depend on `0xray` (optional peer for suit-verify scripts).
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -66,6 +66,8 @@ Override with env:
|
|
|
66
66
|
|
|
67
67
|
Routing confidence is **time-weighted**: excess above the 0.55 gate fades after a 14-day grace (60-day half-life). Factory seed sitting on the gate keeps routing. `npm run signals:hygiene` reports decay on the hydrated project copy under `.xray/state/repertoire/`; it dry-runs in this repo unless `--i-mean-it` (writes the project copy, never the tarball).
|
|
68
68
|
|
|
69
|
+
A grade that passes appends one lesson on the named law and stores that line beside the average. The same task id does not step again. `LESSON_LINE_CAP` is 20: past that window the oldest line leaves only after its task id is in the ledger. `RETAINED_LESSON_ID_CAP` is 20, kept in insertion order (oldest first, not alphabetical). Speech that names no stored signal mints one proposed signal tagged `learned`, and the same speech does not mint twice. `LEARNED_SIGNAL_CAP` is 24 and evicts only `proposed` + `learned` signals. Factory signals stay.
|
|
70
|
+
|
|
69
71
|
## 0xRay memory routing (in-process)
|
|
70
72
|
|
|
71
73
|
In `.xray/features.json` or `xray/features.json`:
|
|
@@ -26,6 +26,19 @@ export declare function lawClauseInText(definition: string, text: string, span?:
|
|
|
26
26
|
export declare function isAboveConfidenceFloor(value: number, gate?: number): boolean;
|
|
27
27
|
/** Hot lines kept on a law. Older lines leave only after their task id is in the ledger. */
|
|
28
28
|
export declare const LESSON_LINE_CAP = 20;
|
|
29
|
+
/**
|
|
30
|
+
* Aged task ids kept so a replay does not step the average.
|
|
31
|
+
* Insertion order, oldest first. Same size as the hot window: past this cap the oldest id leaves.
|
|
32
|
+
* Alphabetical order is not age, so the ledger is not sorted.
|
|
33
|
+
*/
|
|
34
|
+
export declare const RETAINED_LESSON_ID_CAP = 20;
|
|
35
|
+
/**
|
|
36
|
+
* Proposed signals minted from speech (`tags` includes `learned`).
|
|
37
|
+
* One lesson-window of room past the hot lines, so unnamed speech can land and then the
|
|
38
|
+
* lowest confidence leaves, then the oldest last_seen. Factory signals and anything not
|
|
39
|
+
* proposed-and-learned stay.
|
|
40
|
+
*/
|
|
41
|
+
export declare const LEARNED_SIGNAL_CAP = 24;
|
|
29
42
|
export declare const LESSON_TEXT_CAP = 400;
|
|
30
43
|
/**
|
|
31
44
|
* The diary names a law only when it contains the signal id, or the id with
|
|
@@ -92,9 +105,16 @@ export declare class CuratedSignalsManager {
|
|
|
92
105
|
*/
|
|
93
106
|
recordFeedbackOutcome(entry: OrchestratorFeedbackEntry): FeedbackOutcomeResult[];
|
|
94
107
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
|
|
108
|
+
* Shed proposed speech mints past LEARNED_SIGNAL_CAP.
|
|
109
|
+
* Lowest confidence leaves first, then the oldest last_seen. Factory laws stay.
|
|
110
|
+
*/
|
|
111
|
+
private evictSpeechMints;
|
|
112
|
+
private dropLearnedConviction;
|
|
113
|
+
/**
|
|
114
|
+
* Append one graded line. A task id already on the law, or still in the capped
|
|
115
|
+
* ledger, does not move the average and does not append again.
|
|
116
|
+
* Past the hot cap, the oldest line leaves only after its id is in the ledger.
|
|
117
|
+
* Past the ledger cap, the oldest id leaves. Order is recency, not alphabetical.
|
|
98
118
|
*/
|
|
99
119
|
private rememberLesson;
|
|
100
120
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CuratedSignalsManager.d.ts","sourceRoot":"","sources":["../../src/registry/CuratedSignalsManager.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,EAEd,WAAW,EACX,cAAc,EACd,YAAY,EACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,oBAAoB;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED,eAAO,MAAM,gCAAgC,OAAO,CAAC;AACrD,eAAO,MAAM,kCAAkC,IAAI,CAAC;AACpD,4EAA4E;AAC5E,eAAO,MAAM,iCAAiC,MAAM,CAAC;AACrD,eAAO,MAAM,mCAAmC,MAAM,CAAC;AACvD,qFAAqF;AACrF,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,kFAAkF;AAClF,eAAO,MAAM,eAAe,IAAI,CAAC;AAUjC,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,IAAI,SAAmC,GACtC,OAAO,CAET;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAKnD;AAYD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,SAAkB,GACrB,OAAO,CAcT;
|
|
1
|
+
{"version":3,"file":"CuratedSignalsManager.d.ts","sourceRoot":"","sources":["../../src/registry/CuratedSignalsManager.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,EAEd,WAAW,EACX,cAAc,EACd,YAAY,EACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,oBAAoB;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;I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