- Name: Recursim
- Type: Product Specification
- Status: Draft v3
- Scope: Recurgent simulator for self-contained system growth
Recursim exists to provide evidence, not anecdotes, that Recurgent can:
- Survive real evolutionary pressure without harness breakage.
- Produce reliable emergence where local generation is stochastic but global outcomes are predictable.
Recursim is the controlled laboratory where Tool Builders, Tools, and Workers can evolve under repeatable conditions with measurable outcomes.
Recurgent currently demonstrates promising behavior in live examples, but example-driven confidence is insufficient.
Missing today:
- A simulation harness that repeatedly exercises full lifecycle behavior.
- A formal definition of reliable emergence and how to measure it.
- A progression model from simple closed domains to open and networked systems.
Without Recursim, regressions hide in ad hoc runs, and evolution claims are not falsifiable.
- Validate harness robustness under long-running, adversarial, and edge-case evolutionary loops.
- Validate reliable emergence for self-contained systems as the first milestone.
- Produce reproducible simulation traces and scorecards that can be compared across commits.
- Accelerate discovery of architecture faults before they appear in interactive demos.
- Provide a canonical benchmark suite for Recurgent evolution quality.
- Create reusable scenario infrastructure for future simulation classes.
- Replacing runtime integration tests.
- Proving performance for distributed/networked Recurgent systems.
- Implementing autonomous internet-scale multi-agent networking.
- Hardcoding domain tools in runtime internals.
Recursim supports four system classes over time.
- Self-contained systems. Examples: calculator, debate panel.
- Inter-connected systems. Examples: daily news purveyor integrating multiple sources.
- Interactive systems. Examples: personal assistant with human-in-the-loop corrections.
- Networked Recurgents. Examples: federated Recurgents exchanging reusable tools.
V1 targets class 1 only.
Recursim uses three first-class roles.
- Learner. The Recurgent under growth. Formerly called Subject.
- Examiner. Generates curriculum and adversarial probes for each epoch. Formerly called Challenge/Challenger.
- Analyst. Evaluates traces and scores, then emits next-epoch recommendations.
Role mapping to Recurgent UL:
- Learner runs Tool Builder/Tool/Worker behavior inside the harness.
- Examiner defines pressure, not implementation.
- Analyst observes and recommends; it does not directly mutate runtime internals.
Calculator growth curriculum.
- Core arithmetic: add, subtract, multiply, divide.
- Input handling: integers, floats, negative values, whitespace tolerance.
- Error discipline: typed failures (for example divide by zero, invalid expression).
- Composition: expression evaluation with precedence and parentheses.
- Scientific extension: constants and unary functions.
- Closed-world correctness oracle is simple and objective.
- High signal-to-noise ratio for harness defects.
- Enables many edge cases without external dependencies.
- Fast simulation cycles enable broad seed sweeps.
Recursim adheres to Recurgent tenets.
- Agent-first mental model. All simulator entities are modeled in Tool Builder/Tool/Worker language.
- Tolerant interfaces by default. Scoring and validation use tolerant boundary checks before terminal classification.
- Runtime ergonomics and clarity before constraints. Recursim observes and pressures behavior; it does not hardcode domain logic.
- Ubiquitous language aligned to Agent cognition. Reports and telemetry use the same vocabulary as runtime prompts and ADRs.
Reliable emergence means:
- Local behavior can vary by seed.
- Global outcomes converge within pre-defined tolerance bands.
Defaults are explicit for implementation and CI gating.
- Local seed count
N_local = 8. - CI seed count
N_ci = 24. - Epoch threshold
E = 20. - Correctness median >=
0.95by epochE. - Repair depth p90 <=
3by epochE. - Contract violation rate in epochs 16..20 is at least 40% lower than epochs 1..5.
- Reuse ratio in epochs 16..20 is at least 0.25 higher than epochs 1..5.
- Terminal architecture integrity violations =
0.
Recursim must support scenario packs with:
- System class.
- Curriculum stages.
- Golden input/output cases.
- Adversarial cases.
- Evolution pressure profile.
- Termination criteria.
V1 Examiner behavior is deterministic and curriculum-driven.
- Invocations are selected from scripted scenario packs.
- Selection is seeded and replayable.
- Adaptive invocation generation is deferred to V2.
- V2 may allow Examiner to be a Recurgent role.
V1 uses epoch-gated curriculum pressure to remove ambiguity about stage exposure.
- Epochs 1..4: stages A1..A2 only.
- Epochs 5..10: stages A1..A4.
- Epochs 11..14: stages A1..A5.
- Epochs 15..20: stages A1..A8.
- Canary cases run in every epoch and are stage-independent.
Recursim must execute simulations as epochs.
Each epoch includes:
- Invocation generation by Examiner.
- Tool selection/generation path in Learner.
- Validation-first pre-execution checks.
- Execution and delegated contract validation.
- Inline repair lane.
- Metrics capture.
- Artifact persistence and selection updates.
- Analyst lane trigger (when configured).
Recursim must support deterministic fault injection classes:
- Provider response defects.
- Guardrail policy violations.
- Contract drift/mismatch.
- Method/interface drift.
- Runtime execution exceptions.
Recursim must compute and persist normalized scores in range [0.0, 1.0].
- Correctness score.
Formula:
correct_outcomes / oracle_evaluable_calls. Higher is better. - Utility score.
Formula:
useful_outcomes / utility_evaluable_calls. Useful means task-intent assertions pass, not only shape checks. Higher is better. - Contract adherence score.
Formula:
contract_validation_passes / contract_validation_attempts. Higher is better. - Reuse score.
Formula:
artifact_hits / (artifact_hits + fresh_generations). Higher is better. - Repair efficiency score.
Formula:
successful_repairs / max(repair_attempts, 1). Higher is better. - Robustness score.
Formula:
1 - (terminal_failures / total_calls). Higher is better. - Emergence reliability score.
Formula:
seeds_meeting_all_bands / total_seeds. Higher is better.
Operational cost telemetry must also be captured (not normalized as a score):
api_calls_count.provider_input_tokens.provider_output_tokens.estimated_cost_usd.
Analyst responsibilities are explicit.
Inputs:
epoch_ledgerevents.- Tool health telemetry.
- Pattern memory snapshots.
- Guardrail and contract violation metadata.
- User-correction style signals, when present.
Outputs:
- Scorecard deltas and trend annotations.
- Recommendations with typed categories:
tighten_contract,split_tool_boundary,merge_duplicate_tools,promote_tool,quarantine_tool,adjust_examiner_pressure. - Next-epoch pressure adjustments for Examiner.
Analyst does not directly patch generated code.
V1 recommendation application policy:
adjust_examiner_pressuremay be auto-applied within scenario bounds.- Tool-ecosystem recommendations (
split_tool_boundary,merge_duplicate_tools,promote_tool,quarantine_tool,tighten_contract) are advisory by default and require explicit promotion.
Recursim must provide:
- Baseline comparison across commits.
- Machine-readable run summaries.
- Human-readable run narratives for diagnosis.
- Two replay modes: Deterministic-replay mode: provider responses are stubbed/recorded, trace-level determinism expected. Seeded-live mode: live provider responses are allowed to vary; equivalence is scorecard-level within configured tolerance bands.
Each run must include canaries.
- Pass canary: a known-easy case that must pass.
- Fail canary: a known-bad case that must fail with a typed error.
If canaries do not behave as expected, the entire run is invalid.
flowchart LR
Config[Scenario Config + Seed] --> Examiner[Examiner]
Examiner --> Runner[Epoch Runner]
Runner --> Learner[Recurgent Learner]
Learner --> Signals[Telemetry Collector]
Signals --> Inline[Inline Scoring]
Signals --> Analyst[Analyst]
Inline --> Ledger[Run Ledger]
Analyst --> Ledger
Ledger --> Report[Scorecard + Diagnostics]
Ledger --> Gate[Pass/Fail Gates]
sim_idscenario_idclassseedepoch_countruntime_versionprompt_versionstarted_atended_atstatusmode(deterministic_replayorseeded_live)
epoch_indexstagecalls_totaltool_creationstool_reusescontract_violationsguardrail_recoveriesrepair_attemptsuser_correction_signalsscoresanalyst_recommendationsapi_calls_countprovider_input_tokensprovider_output_tokensestimated_cost_usd
correctnessutilitycontract_adherencerobustnessreuserepair_efficiencyemergence_reliabilityregressionsrecommendationsapi_calls_countprovider_input_tokensprovider_output_tokensestimated_cost_usd
- Deterministic-replay mode. Recorded/stubbed provider responses, fixed seeds, trace-level deterministic behavior.
- Seeded-live mode. Fixed seeds for inputs and fault injection, live provider responses, scorecard-level equivalence checks.
- Variance mode. Seed sweep to evaluate convergence spread.
- Stress mode. Higher fault rates and adversarial curriculum cases.
- Soak mode. Long epoch runs for stability and memory/toolstore behavior.
Recursim V1 is complete when:
- Self-contained calculator scenario pack is executable end-to-end.
- Deterministic-replay mode reproduces identical scorecard and canary outcomes for same commit+seed.
- Seeded-live mode reproduces scorecards within configured tolerance bands.
- Seed sweep report shows convergence metrics and variance bounds.
- At least one intentional harness regression is detected by Recursim hard gate.
- Artifacts and reports are stored in a stable, documented location.
Hard gates:
- Correctness below threshold.
- Terminal architecture integrity violations > 0.
- Canary mismatch.
Soft diagnostics:
- Reuse score regression.
- Utility score drift.
- Repair efficiency drift.
- Analyst recommendation churn.
Recursim must emit:
run_manifest.jsonepoch_ledger.jsonlscorecard.jsondiagnostic_summary.md- Optional trace pointers into runtime observability logs.
- Scenario schema.
- Examiner + epoch runner.
- Deterministic-replay support.
- Basic scorecard.
- Canary pipeline.
- Stage definitions.
- Golden/adversarial corpus.
- Scoring thresholds.
- Baseline fixture generation.
- Seed sweep automation.
- Convergence and variance reports.
- CI hard/soft gate implementation.
- Fault injection packs.
- Soak mode.
- Analyst recommendation policies.
- Risk: Overfitting simulator to calculator. Mitigation: Keep scenario API class-agnostic and add second class after V1 stabilization.
- Risk: False confidence from narrow metrics. Mitigation: Include both correctness and architecture-health metrics.
- Risk: Excessive complexity in v1 simulator core. Mitigation: Start deterministic and minimal, add lanes incrementally.
- Risk: Runtime and simulator vocabulary divergence. Mitigation: Enforce UL glossary and shared naming in reports.
Decisions:
- Packaging: standalone script first, runtime subcommand later.
- Replay semantics: support both deterministic-replay and seeded-live modes.
- CI gates: correctness + architecture integrity + canaries are hard gates; all others are soft diagnostics.
Remaining open questions:
- Default seed sweep size for fast local runs versus full CI runs beyond initial defaults.
- Which token-to-cost schedule should be canonical when providers/models change over time.
| Stage | Capability | Example Inputs | Expected Class |
|---|---|---|---|
| A1 | add/subtract | 2+2, 9-12 |
correct numeric result |
| A2 | multiply/divide | 7*8, 10/2 |
correct numeric result |
| A3 | error handling | 10/0, abc+1 |
typed non-retriable errors |
| A4 | expression parsing | 2 + 3 * 4, (2+3)*4 |
precedence-correct evaluation |
| A5 | tolerance | whitespace, negatives, floats | correct result + stable contracts |
| A6 | scientific functions | sqrt(9), sin(0) |
correct numeric result |
| A7 | constants | pi, e, sin(pi/2) |
correct numeric result |
| A8 | composed scientific expressions | sin(pi/4) * sqrt(2), log(e^2) |
correct numeric result + reusable tooling |