Capability-Driven Recursive Self-Improvement for Multimodal Agents
The Trinity Research Team
English ยท ็ฎไฝไธญๆ
![]() Overview Full video (1:46) ยท Download |
![]() Task examples Full video (1:57) ยท Download |
![]() Trinity Studio Full video (1:43) ยท Download |
- Nov 24, 2026 ยท ๐ฅ v2 full open-source release includes Trinity Studio, the runnable iter4 Harness, the Capability-Aware Harness Router, 34 benchmark integrations, and 44 built-in simulation instances. The earlier code release is available as v1.
- Oct 30, 2026: ๐ฅ Codes released!
- Oct 26, 2026: ๐ค Paper release! The Trinity reached #1 on Hugging Face Daily Papers.
Extending recursive self-improvement (RSI) to long-horizon multimodal agents faces two bottlenecks: constructing heterogeneous, verifiable environments is costly, and manual Harness iteration cannot keep pace with task complexity. Yet automating per-task refinement does not guarantee cumulative improvement. How should experience be organized? Task-specific refinement overfits and limits transfer, while a unified Harness suffers interference across heterogeneous demands. How should improvements evolve? Existing gains must be retained, inherited, and refined across iterations rather than diluted by increasing task volume. We argue that scalable RSI requires agentโenvironment co-evolution, coupling adaptive worlds with Harness updates, and shared capability requirements, organizing dispersed feedback into transferable learning signals.
We introduce The Trinity, an RSI framework coupling world generation with Harness evolution through Creator, Explorer, and Evolver. From verified trajectories, Evolver reorganizes tasks into a hierarchical capability tree based on shared requirements. Through Capability-Driven Real2Sim2Real, Creator abstracts node-level requirements into simplified, verifiable simulated worlds for capability learning, while original-task evaluation measures transfer. Along this tree, Explorer selectively inherits and refines reusable modules, forming a specialized Harness tree that accumulates validated improvements within a fixed topology. A Capability-Aware Harness Router selects compatible module configurations using public task information and verified experience. We further introduce Trinity Studio, an open-source platform enabling user-defined capability nodes, tree structures, and verifiable environments for customizable RSI workflows.
Our evolved Harnesses improve mean performance by 34 points across 28 training benchmarks and 26 points across 18 unseen benchmarks, including two real-world embodied tasks.
We advocate capability-driven self-improvement: co-evolving verifiable worlds and specialized Harnesses along shared capability requirements so improvements accumulate, inherit, and transfer across tasks.
Run Trinity Studio locally to create and preview worlds, inspect capability trees, and replay runs. Quick start
The release includes task discovery and splitting, trajectory analysis and capability induction, CreatorโExplorer training, Harness routing, and accounting. Benchmark-specific dependencies and external resources are installed as needed.
| Path | Purpose |
|---|---|
| cli.mjs, src/ | Integrated commands and cross-stage handoffs |
| pipeline/ | Stage 1: evidence-backed task discovery, taxonomy, and train/unseen split |
| stage2/ | Stage 2: trajectory analysis, capability induction, and training export |
| harness/ | Environment generation, module evolution, evaluation, and routing |
| environments/ | Task definitions, drivers, scoring, and resource manifests for 34 benchmark integrations |
| iter4-harness/ | Runnable iter4 Harness built from the included source |
| level-api-44/ | 44 built-in curriculum instances and their local rendering API |
| trinity-studio/ | Local web interface for design, learning, and replay |
| stage2/trinity_stage2/providers.json | Default model-provider presets for v2 |
| paper/, assets/ | Technical report and project figures |
- Node.js 22 or later. The core CLI uses built-in Node APIs. Studio and the Level API use Playwright and Chromium. Browser setup
- Python 3.10 or later. Stage 2 declares
anthropic>=2.0,<3. Install its package as shown below. - Model access compatible with the configured provider transport. Stage 1 additionally needs working web search. Model names and API versions in the presets must be supported by your account.
- For full training: Linux with
/usr/bin/bwrap(Bubblewrap), usable user namespaces, and/bin/bash. The Creator sandbox requires these facilities; WSL must satisfy the same requirements. See creator-sandbox.mjs. - For PDF source extraction:
pdftotextor Python withpypdf. Scanned PDFs require an external OCR workflow. - Task-specific software, data, and access for the benchmarks you run. The runtime manifest records the tested Linux x86-64 dependencies.
The commands below use Bash and run from the repository root:
git clone https://github.com/InfRec-Cardinal/The-Trinity.git
cd The-Trinity
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e ./stage2
export TRINITY_PYTHON="$PWD/.venv/bin/python"
node cli.mjs stage2 --helpThe core CLI is ready after the steps above. TRINITY_PYTHON defaults to python3 and can point to .venv\Scripts\python.exe on Windows. Full Creator training requires the Linux sandbox described above. Studio and benchmark setup
Configure a provider through environment variables. Replace the placeholders with values supported by your account:
export TRINITY_PROVIDER=anthropic
export ANTHROPIC_API_KEY='your-api-key'
export TRINITY_MODEL='account-available-model'
export TRINITY_API_VERSION='supported-api-version'
export PIPELINE_DATA_DIR="$PWD/runs/stage1/data"
export PIPELINE_EXPORT_DIR="$PWD/runs/stage1/exports"The code does not automatically load .env files. Keep credentials in your environment. The built-in transport uses the Anthropic Messages protocol, streaming, adaptive thinking, and tools; an arbitrary chat-completions endpoint is not interchangeable. Provider presets are configuration defaults, not a guarantee that a service or model is available.
To run a bundled benchmark, list the tasks with node iter4-harness/run.mjs --list-tasks and see the quick start for dependencies. The pipeline walkthrough below uses a custom environment adapter for exploration and training. Commands that invoke models, search, or benchmarks consume the corresponding resources. Use a new output directory for each explore, train, and route run.
node cli.mjs stage1 connect-test
node cli.mjs stage1 search
node cli.mjs stage1 statusconnect-test makes real model and search requests. A completed search automatically exports a task tree and handoff. Check that search status is done and the split has no gaps or errors; an incomplete result may still exit successfully. Select the actual dated export:
export HANDOFF="$PWD/runs/stage1/exports/stage2-handoff-YYYYMMDD.json"An interrupted search resumes with stage1 search. If its budget is exhausted, use node cli.mjs stage1 budget --turns 80 --searches 32 before resuming. Running search after a completed search starts a new search. search --new resets the current search state.
node cli.mjs explore \
--handoff "$HANDOFF" \
--adapter local/adapter.json \
--out runs/explore-trainThis collects five episodes per training task with frozen initial instances and exports canonical trajectories, runs.json, and an execution ledger. The adapter supplies the environment and action budget.
node cli.mjs stage2 all \
--handoff "$HANDOFF" \
--runs runs/explore-train/runs.json \
--out runs/stage2all imports training records, builds digests, analyses and reviews failures, induces capabilities, assigns tasks, and writes trees. Its training workflow does not use unseen exploration records. Individual commands are listed by node cli.mjs stage2 --help.
The optional prepare command exports the validated training configuration:
node cli.mjs prepare \
--stage2 runs/stage2 --adapter local/adapter.json \
--out runs/training-config.jsonThe output file must not already exist. train rebuilds the configuration from Stage 2 and the adapter; it does not read the file exported by prepare.
node cli.mjs train \
--stage2 runs/stage2 --adapter local/adapter.json \
--out runs/trainTraining performs Creator construction and audits, local module evolution, and evaluation. Successful completion writes training-complete.json and routing-candidates.json, alongside checkpoints and execution evidence.
Create local/routing-plan.json for your benchmark environments. Training exports the candidate pool, but does not generate a complete routing plan. The plan requires schema trinity-routing-plan-v1, a protocolId, split (train or unseen), candidates, and ordered tasks. Each task supplies taskId, benchmarkId, world, publicTask, positive integer budget, and positive integer modelCallBudget.
Use the frozen candidate records from runs/train/routing-candidates.json. Public task context must exclude private capability labels and evaluation outcomes. Before the first evaluation of each benchmark/Harness pair, supply exactly five preparationWorlds, or provide a valid previously frozen skill artifact through skillDirectory. See the full routing plan contract and evaluation skill preparation.
node cli.mjs route \
--plan local/routing-plan.json --adapter local/adapter.json \
--training-run runs/train --out runs/routenode cli.mjs metrics \
runs/stage1/data runs/explore-train runs/stage2 runs/train runs/route \
> runs/metrics.jsonThe report aggregates recorded model usage, episode costs, benchmark scores, routing results, and accounting warnings. Monetary cost is not calculated; monetaryCost is null. Check accountingComplete and warnings before comparing runs.
Collect unseen records only after the referenced training run has completed:
node cli.mjs explore \
--handoff "$HANDOFF" --adapter local/adapter.json \
--cohort unseen --training-run runs/train --out runs/explore-unseenThe completion record must match the handoff and unseen cohort. These records support post-training analysis and evaluation; they are not additional training inputs. Unseen routing uses a plan with split: "unseen" and the completed training run. See protocol-state.mjs for the enforced bindings.
Create your own local/adapter.json and local/driver.mjs. A minimal configuration shape is:
{
"driverModule": "./driver.mjs",
"driverOptions": {},
"actionBudget": 4
}driverModule resolves relative to the adapter JSON. The module must export createDriver(options), returning your driver. The action budget above is an example; choose the budget required by your experiment. A configuration file alone does not implement an environment.
| Driver member | Required behavior |
|---|---|
loadBenchmark(task) |
Load a benchmark and return a serializable world descriptor. |
fingerprint(world) |
Return stable evidence identifying the environment build. |
instanceManifest(world, trials) |
Return exactly trials reproducible instance descriptors. |
reset(world, instance) |
Start a session containing observation and actionSchema; support reset without an instance for audits. |
initialState(session) |
Return stable initial-state evidence for matched execution. |
step(session, action) |
Return boolean done and success, observation, and finite nonnegative cost; optional score and reward must be finite. Success requires a terminal receipt. |
close(session) |
Optional session cleanup. |
designContract, buildContract |
Define the Creator design and build output contracts for training. |
validateDesign(design, node) |
Validate a proposed design before construction. |
materialize(design, proposal, context) |
Build a world from the Creator workspace and proposal. |
inspect(world, design, buildDigest) |
Provide native inspection evidence for the built environment. |
creatorAuditPlan(world, design) |
Provide executable audit plans used to verify Creator worlds. |
The first seven members cover exploration and environment execution; full training also requires the Creator members. Consult integration.mjs, explorer.mjs, creator-coding.mjs, and creator-audits.mjs for exact contracts. Environments must support reproducible resets and host-verifiable outcomes.
The default agent backend uses the configured provider. Advanced integrations can set agentCommand and agentOptions in the adapter to use the command-agent protocol.
| Setting | Meaning |
|---|---|
TRINITY_PROVIDER |
Provider preset from the v2 configuration, which includes anthropic and custom. |
TRINITY_API_KEY |
Fallback API key; provider-specific key variables take precedence. |
TRINITY_MODEL, TRINITY_API_VERSION |
Override the model and API version for the active provider. |
TRINITY_BASE_URL, TRINITY_AUTH |
Override endpoint and authentication (x-api-key or bearer). |
TRINITY_WEB_SEARCH, TRINITY_EFFORT |
Search mode and reasoning effort supported by the provider. |
TRINITY_PROVIDERS_FILE |
Load an alternate provider configuration. The v1 presets remain available as an explicit override. Use a transport and search mode supported by both v2 and your provider. |
TRINITY_PYTHON, TRINITY_NODE |
Python executable used by the integrated Stage 2 command, and Node executable used for Stage 2 protocol verification. |
PIPELINE_DATA_DIR, PIPELINE_EXPORT_DIR |
Stage 1 state and export locations; defaults are pipeline/data and pipeline/exports. |
PIPELINE_PDFTOTEXT, PIPELINE_PDF_PYTHON |
Optional executable overrides for PDF extraction. |
Stage 1 currently excludes audio task inputs. Its default unseen fraction is 18/46, applied per direction with provenance eligibility and at least one training task retained; discovered task counts are not fixed. To change a completed library's split, run node cli.mjs stage1 split --unseen-fraction 0.4 followed by node cli.mjs stage1 export before downstream work.
Training settings such as iterations, action budget, build attempts, and screening are read from the adapter with defaults in harness/config/defaults.json. Training and validation each require five episodes.
| Output directory | Main contents |
|---|---|
runs/stage1/data, runs/stage1/exports |
Search state, captured evidence, checkpoints, task trees, and dated handoffs |
runs/explore-train |
runs.json, canonical records/, frozen instances, and events.jsonl |
runs/stage2 |
Analyses, reviewed capability catalogue, assignments, and trees |
runs/train |
Checkpoints, Creator evidence, summary, routing candidates, and completion record |
runs/route |
Frozen plan, evaluation skills, execution ledger, and hashed routing predictions |
Preserve the complete run directories: later stages verify source ledgers and artifact hashes, not just copied summary files.
The Trinity: Capability-Driven Recursive Self-Improvement for Multimodal Agents
The Trinity Research Team, 2026.
Read the technical report ยท Visit the project page
@misc{tang2026trinity,
title={The Trinity: Capability-Driven Recursive Self-Improvement for Multimodal Agents},
author={Tang, Weidong and Wang, Ruiheng and Zhang, Jingxuan and Wang, Hexin and Chen, Haoyuan and Zhang, Zhengfeiyang and Ma, Yixing and Jiang, Zichen and Guo, Ziyu and Li, Haodong and Jiao, Zhengbo and Cui, Zhiqing and Yin, Xinxiang and Liang, Shuo and Wan, Zhenglin and Lin, Hongzhan and Zhao, Wangbo and Zhang, Kaipeng and Zhou, Pengfei and Zhang, Odin and You, Yang},
year={2026},
eprint={2610.36077},
archivePrefix={arXiv},
primaryClass={cs.AI},
doi={10.48550/arXiv.2610.36077},
url={https://arxiv.org/abs/2610.36077}
}The Trinityโs own source code is released under the MIT License. Third-party code, benchmark materials, data, and dependencies remain subject to their respective licenses and terms. Third-party licenses and notices




