SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2409.16120 · 2024

MOSS: Enabling Code-Driven Evolution and Context Management for AI Agents

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 2 violated it and 0 have no contract verdict; 4 failures of our instrument; 1 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2409.16120.json · badge: /api/ran/2409.16120.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
ghost-in-moss/ghostos canonical (classifier label)
classifier basis: census
6 ran · 1 no recorded run
FunctionStatusWhere it lives
get_bootstrap_config Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ghost-in-moss/ghostos/libs/ghostos/ghostos/bootstrap.py
code served (permissive licence) · get_code("698b0fcf3929c793")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned BootstrapConfig. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import yaml
from typing import List, Optional, Tuple, Union
from os.path import dirname, join, exists, abspath, isdir
from pydantic import BaseModel, Field
import tempfile
import os

# Create a minimal test setup
DEFAULT_WORKSPACE_DIR = 'ghostos_ws'
WORKSPACE_STUB = 'workspace_stub'

def expect_workspace_dir() -> Tuple[str, bool]:
    expect_dir = abspath(DEFAULT_WORKSPACE_DIR)
    return (expect_dir, exists(expect_dir) and isdir(expect_dir))

def workspace_stub_dir() -> str:
    return join(dirname(__file__), WORKSPACE_STUB)

def find_workspace_dir() -> str:
    expected, ok = expect_workspace_dir()
    if ok:
        return expected
    return workspace_stub_dir()

class BootstrapConfig(BaseModel):
    workspace_dir: str = Field(default=DEFAULT_WORKSPACE_DIR, description='ghostos relative workspace directory')
    dotenv_file_path: str = Field('.env', description='ghostos workspace .env file')
    workspace_configs_dir: str = Field('configs', description='ghostos workspace relative path for configs directory')
    workspace_runtime_dir: str = Field('runtime', description='ghostos workspace relative path for runtime directory')
    python_paths: List[str] = Field(default_factory=list, description='load the python path to sys.path')
    app_container_maker: Union[str, None] = Field(default=None, description='import path to generate ghostos app container, Callable[[], Container]')
    __from_file__: str = ''

    @staticmethod
    def abs_ghostos_dir() -> str:
        return dirname(dirname(__file__))

    def abs_workspace_dir(self) -> str:
        app_dir = abspath(self.workspace_dir)
        if exists(app_dir) and isdir(app_dir):
            return app_dir
        return find_workspace_dir()

    def abs_runtime_dir(self) -> str:
        workspace_dir = self.abs_workspace_dir()
        return join(workspace_dir, 'runtime')

    def abs_assets_dir(self) -> str:
        workspace_dir = self.abs_workspace_dir()
        return join(workspace_dir, 'assets')

    def env_file(self) -> str:
        workspace_dir = self.abs_workspace_dir()
        return join(workspace_dir, self.dotenv_file_path)

    def env_example_file(self) -> str:
        workspace_dir = self.abs_workspace_dir()
        return join(workspace_dir, '.example.env')

    def save(self, dir_path: str=None) -> str:
        if dir_path is None:
            filename = join(abspath('.ghostos.yml'))
        else:
            filename = join(dir_path, '.ghostos.yml')
        content = yaml.dump(self.model_dump())
        with open(filename, 'w') as f:
            f.write(content)
        return filename

def get_bootstrap_config(local: bool=True) -> BootstrapConfig:
    expect_file = abspath('.ghostos.yml')
    if local and exists(expect_file):
        with open(expect_file) as f:
            content = f.read()
            data = yaml.safe_load(content)
            conf = BootstrapConfig(**data)
            conf.__from_file__ = expect_file
            return conf
    else:
        return BootstrapConfig()

ARGS = {
    'local': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
ghostos_common, pydantic, yaml — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type BootstrapConfig — a BootstrapConfig output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a BootstrapConfig output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_caller_info Ran
ran; our contract draft was wrong, not the code
ghost-in-moss/ghostos/libs/container/src/ghostos_container.py
code served (permissive licence) · get_code("3483f33e04b939df")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import inspect

def get_caller_info(backtrace: int=1, with_full_file: bool=True) -> str:
    stack = inspect.stack()
    if backtrace > len(stack) - 1:
        backtrace = len(stack) - 1
    caller_frame_record = stack[backtrace]
    frame = caller_frame_record[0]
    info = inspect.getframeinfo(frame)
    filename = info.filename
    if not with_full_file:
        filename = filename.split('/')[-1]
    return f'{filename}:{info.lineno}'

ARGS = {
    'backtrace': 1,
    'with_full_file': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
is_entity_type Ran
ran, violated the contract we drafted
ghost-in-moss/ghostos/libs/common/src/ghostos_common/entity.py
code served (permissive licence) · get_code("43b9d8378eac16e9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn


# Create a test class that HAS the __to_entity_meta__ attribute
class EntityWithMeta:
    def __init__(self):
        self.__to_entity_meta__ = {}


# Create a test class that does NOT have the __to_entity_meta__ attribute
class NotEntity:
    def __init__(self):
        pass


# Test with an instance that has the attribute
entity_instance = EntityWithMeta()

ARGS = {
    "value": entity_instance
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
is_streamlit_renderable Ran
ran, violated the contract we drafted
ghost-in-moss/ghostos/libs/ghostos/ghostos/streamlit.py
code served (permissive licence) · get_code("0e6a1ec20c210281")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from typing import Optional, NamedTuple, Any
from abc import ABC, abstractmethod

class Rendered(NamedTuple):
    value: Any
    changed: bool

class StreamlitObject(ABC):

    @abstractmethod
    def __streamlit_render__(self) -> Optional[Rendered]:
        pass

def is_streamlit_renderable(obj):
    return isinstance(obj, StreamlitObject) or hasattr(obj, '__streamlit_render__')


# Create test objects
class ConcreteStreamlitObject(StreamlitObject):
    def __streamlit_render__(self) -> Optional[Rendered]:
        return Rendered(value="test", changed=True)

class ObjectWithRenderMethod:
    def __streamlit_render__(self) -> Optional[Rendered]:
        return Rendered(value=42, changed=False)

class PlainObject:
    pass

# Test instances
renderable_streamlit_obj = ConcreteStreamlitObject()
renderable_duck_typed_obj = ObjectWithRenderMethod()
non_renderable_obj = PlainObject()

ARGS = {
    "obj": renderable_streamlit_obj
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
render_streamlit_object Ran
ran; our contract draft was wrong, not the code
ghost-in-moss/ghostos/libs/ghostos/ghostos/streamlit.py
code served (permissive licence) · get_code("27ca710bf5e6c91d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Rendered. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from typing import Optional, NamedTuple, Any

class Rendered(NamedTuple):
    value: Any
    changed: bool

class StreamlitObject:
    def __streamlit_render__(self) -> Optional[Rendered]:
        return Rendered(value="test_value", changed=True)

class CustomStreamlitObj:
    def __streamlit_render__(self) -> Optional[Rendered]:
        return Rendered(value=42, changed=False)

class NonRenderableObject:
    pass

torch.manual_seed(0)

# Create test objects
streamlit_obj = StreamlitObject()
custom_obj = CustomStreamlitObj()
non_renderable_obj = NonRenderableObject()

ARGS = {
    "obj": streamlit_obj
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Rendered — a Rendered output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Rendered output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
text_completion Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ghost-in-moss/ghostos/libs/ghostos/ghostos/facade/_model_funcs_facade.py
code served (permissive licence) · get_code("41b7fe757e91e851")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from unittest.mock import Mock, patch
import sys

# Create a minimal stand-in for the TextCompletion class that the function imports
class TextCompletion:
    def __init__(self, text: str):
        self.text = text
    
    def run(self) -> str:
        # Simulate text completion by returning the input text with some suffix
        return self.text + " [completed]"

# Mock the ghostos module structure
sys.modules['ghostos'] = Mock()
sys.modules['ghostos.core'] = Mock()
sys.modules['ghostos.core.model_funcs'] = Mock()
sys.modules['ghostos.core.model_funcs.llms_model_funcs'] = Mock()

# Patch the import so it uses our TextCompletion class
sys.modules['ghostos.core.model_funcs.llms_model_funcs'].TextCompletion = TextCompletion

# Define arguments for the function
ARGS = {
    "text": "The quick brown fox jumps over the"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
ghostos, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
file_reader Not yet run
unverified (harvested, no recorded run)
ghost-in-moss/ghostos/libs/ghostos/ghostos/facade/_model_funcs_facade.py
code served (permissive licence) · get_code("e70a2d98564549dc")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Developing AI agents powered by large language models (LLMs) faces significant challenges in achieving true Turing completeness and adaptive, code-driven evolution. Current approaches often generate code independently of its runtime context, relying heavily on the LLM's memory, which results in inefficiencies and limits adaptability. Manual protocol development in sandbox environments further constrains the agent's autonomous adaptability. Crucially, achieving consistency in code and context across multi-turn interactions and ensuring isolation of local variables within each interaction remains an unsolved problem. We introduce MOSS (llM-oriented Operating System Simulation), a novel framework that addresses these challenges by integrating code generation with a dynamic context management system. MOSS ensures consistency and adaptability by using a mechanism that maintains the Python context across interactions, including isolation of local variables and preservation of runtime integrity. At its core, the framework employs an Inversion of Control (IoC) container in conjunction with decorators to enforce the least knowledge principle, allowing agents to focus on abstract interfaces rather than concrete implementations. This facilitates seamless integration of new tools and libraries, enables runtime instance replacement, and reduces prompt complexity, providing a "what you see is what you get" environment for the agent. Through a series of case studies, we show how this framework can enhance the efficiency and capabilities of agent development and highlight its advantages in moving towards Turing-complete agents capable of evolving through code.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2409.16120")
get_code_for_paper("2409.16120")
have("2409.16120")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2409.16120.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2409.16120.svg)](https://syntology.ai/paper/2409.16120)

Connect an agent — have() is free.