Skip to main content

Repertoire Integration (v3.3+)

Repertoire is preferred. Repertoire (@0xray/repertoire@0.2.9 vendored) is the long-term judgment organ. It matches named laws and enriches orchestrator routing through the MemoryRoutingProvider contract. Wear it. Do not treat Station as a substitute.

Not the successor card. Survive compact / host change is Station (Read .xray/state/STATION.md). 0.1.0–0.1.8 were the same judgment organ; 0.2 cut the factory seed to 8 names. Do not pin 0.1.8. Split: Station vs Repertoire 0.1.

When to use Repertoire​

ScenarioSurface
0xRay orchestrator in-process (ExecutionPlanner, thinDispatch)features.json → memory_routing
External LLM host (Hermes, Grok, OpenCode MCP)repertoire-mcp stdio server
Ad-hoc signal queries / ingest pipelineRepertoire CLI (npm run query, pipeline)

Setup​

0xray vendors @0xray/repertoire@0.2.9. Fresh npm install 0xray ships memory_routing.enabled: true. Preferred on. Explicit opt-out only: enabled: false with provider: "repertoire". Station then holds the compact ticket — that is fallback, not the preferred brain. This is not an 8th 0xRay MCP.

Shipped xray/features.json:

"memory_routing": {
"enabled": true,
"provider": "repertoire",
"module_path": "node_modules/@0xray/repertoire/dist/provider/memory-routing-provider.js",
"config": {
"signalsPath": ".xray/state/repertoire/curated_signals.json",
"statePath": ".xray/state/repertoire/inference-state.json",
"feedbackDir": ".xray/state/repertoire/feedback"
}
}

Optional sibling (framework monorepo only):

git clone https://github.com/0xRayAI/repertoire ../repertoire
cd ../repertoire && npm install && npm run build

Grok session-start writes a one-line repertoireResume into .xray/state/session-boot.json (signal count when the registry is readable). Leftover default-off also resolves at runtime in loadMemoryRoutingProvider / getMemoryRoutingConfig when the module is on disk — ExecutionPlanner and thinDispatch then use Repertoire without a features rewrite. Station heat persists working state (not Bedrock primitives) to .xray/state/repertoire-working.json and a Working: line on STATION.md. Compact may ingestFeedback for non-Bedrock matches. Explicit opt-out remains enabled: false + provider: "repertoire".

features.json fields (memory_routing)​

Validated by xray/features.schema.json at load time:

FieldRequiredValuesDescription
enabledyestrue / falseMaster switch
provideryesnull, repertoire, customProvider kind
module_pathwhen enabled + repertoire/custompath stringESM module exporting createMemoryRoutingProvider()
configoptionalobjectPassed to provider factory

Repertoire config keys​

KeyDefaultDescription
dataDirpackage data/ (vendored 0.2)Registry + inference state root
signalsPath.xray/state/repertoire/curated_signals.jsonProject-local registry (factory + stack laws). Dest is named invariants, not hangar repo-* or git slugs.
statePathdata/inference-state.jsonIdempotent ingest cursor
logDirlogs/groover-inferenceEnriched JSONL log directory

Paths resolve relative to the 0xRay package root unless absolute.

What Repertoire enriches in 0xRay​

ExecutionPlanner (v3.3.1 confidence gate)​

When getTaskConfidence() is available on the provider:

  • calculateTaskComplexity() adds complexityBoost from matched signals
  • Trap tasks (ontological-trap, high-confidence primitives) get higher complexity scores
  • selectAgent() receives trap hints via TYPE: ontological-trap in operation text
  • enrichTasks() attaches memorySignals, memorySignalConfidences, memoryComplexityBoost to task metadata

thinDispatch​

  • resolveThinDispatch() may override tier-default agent (e.g. → architect when highConfidenceTrapPresent and score ≥ 26)
  • provenance-failure tag can route to bug-triage-specialist

Researcher (analyze_proposal)​

Module: src/mcps/researcher-confidence.ts

  • Triggers on trap language or high-confidence primitive matches
  • Calls getTaskConfidence() via MemoryRoutingProvider
  • Appends auditable MEMORY_ROUTING: block to governance output

Feedback loop​

Per-task ingestFeedback() (v3.3 — not aggregate-only) records orchestrator outcomes back to Repertoire.

MemoryRoutingProvider contract​

Custom providers export createMemoryRoutingProvider(config) implementing:

MethodPipeline stage
buildRoutingContext(operation)Signal/tag matching
enhanceAgentCapabilities(map)Agent capability enrichment
enrichTasks(tasks)Pre-planning metadata
buildInheritedContext(tasks)→ ExecutionPlan.memoryContext → AsideContext inheritedContext.memoryRouting
selectAgent(...)ExecutionPlanner assignment
resolveThinDispatch(...)thinDispatch score + override
getTaskConfidence?(task)Confidence gate (v3.3.1)
ingestFeedback?(entry)Per-task learning loop

See src/memory-routing/types.ts and Repertoire's docs/MEMORY-ROUTING-PROVIDER.md.

Repertoire MCP server (external hosts)​

Not an 8th 0xRay server. Wear adds a repertoire extra when the module resolves (Hermes / OpenCode / OpenClaw / project .mcp.json / Grok .grok/config.toml).

Server tools are unprefixed so Grok TUI can register them (server__tool → repertoire__get_task_confidence). Hermes/OpenCode see the unprefixed names.

"repertoire": {
"command": "node",
"args": ["node_modules/@0xray/repertoire/dist/mcp/server.js"]
}

In-repo launcher (cwd-proof): scripts/mjs/run-repertoire-mcp.mjs.

MCP tools​

Server nameGrok TUI namePurpose
get_high_confidence_signalsrepertoire__get_high_confidence_signalsList signals above threshold
get_task_confidencerepertoire__get_task_confidenceFull confidence context for a task
search_primitivesrepertoire__search_primitivesText search against registry
ingest_feedbackrepertoire__ingest_feedbackRecord orchestrator outcome

In-process orchestrator code uses getMemoryRoutingProviderSync().

Repertoire CLI​

cd repertoire
npm run ingest -- --source /path/to/groover/logs
npm run pipeline # ingest + meta-inference
npm run query # ad-hoc confidence query
npm run test:e2e # enriched loop regression
npm run test:mcp # stdio MCP smoke

Data model (summary)​

ArtifactRole
data/curated_signals.jsonPrimitive registry with observation_stats
data/inference-state.jsonIngest idempotency cursor
logs/groover-inference/*.jsonlEnriched entries (strict enriched-only ingest)

Confidence values come from observation_stats or explicit task metadata — no text-score fallbacks.

Lessons, mint, and caps​

A passing grade appends one lesson on the named law and stores that line beside the average. The same task id does not step again.

CapValueWhat leaves
LESSON_LINE_CAP20Oldest lesson text, only after its task id is in the ledger
RETAINED_LESSON_ID_CAP20Oldest id, insertion order (not alphabetical)
LEARNED_SIGNAL_CAP24Only proposed signals tagged learned (lowest confidence, then oldest last_seen)

Speech that names no stored signal mints one proposed signal tagged learned. The same speech does not mint twice. Factory signals are not eviction candidates.

A plate is the machine schematic (Plates). The npm package ships docs-site/docs/plates/. Station keeps one pointer line for the plate intent names. Pre-compact and MEMORY_ROUTING inject that one schematic.

Testing​

0xRay framework repo:

npm test -- src/__tests__/unit/memory-routing-integration.test.ts
npm test -- src/__tests__/unit/memory-routing-provider.test.ts
npm test -- src/__tests__/unit/researcher-confidence.test.ts
npm test -- src/__tests__/unit/researcher-repertoire-wiring.test.ts