OpenSimula (afterimage.simula)
OpenSimula is an experimental, open implementation of mechanism-design ideas from Simula (Davidson et al., TMLR): factor taxonomies, weighted mix sampling, meta-prompt diversification, requirement critics with refinement, and a double-critic gate for multiple-choice items. It is not affiliated with Google and is not a reference port of internal systems.
For runnable scripts, see the examples/simula/ directory in the repository.
Imports
from afterimage.simula import OpenSimula, SimulaInstructionGeneratorCallback
from afterimage.monitoring import GenerationMonitor
from afterimage.providers import LLMFactory, InMemoryDocumentProvider
Generation monitoring
You can attach the same GenerationMonitor used elsewhere in AfterImage by passing monitor= into OpenSimula (see the Simula / OpenSimula page under API Reference).
When a monitor is set, structured LLM calls across the pipeline call track_generation with duration, success or failure, token counts when available, and metadata that includes:
component:"opensimula"operation: a stable string such asopensimula.taxonomy.propose_factors,opensimula.sampling.infer_strategies,opensimula.meta.generate_scenarios,opensimula.critics.requirement_critique,opensimula.double_critic.probe,opensimula.tasks.single_qa_json, and similar paths for evaluation helpers.
Omit monitor (or pass None) to run without recording metrics.
Always call GenerationMonitor.shutdown() when the run finishes so background metric processing stops cleanly (see Monitoring & observability).
API reference
Module and class reference is generated on the Simula / OpenSimula API page (api/simula in the built site navigation).