{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/moss-enabling-code-driven-evolution-and","title":"MOSS: Enabling Code-Driven Evolution and Context Management for AI Agents","arxiv_id":"2409.16120","date":"2024-09-24","proceeding":null,"authors":["Ming Zhu","Yi Zhou"],"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.","url_abs":"https://arxiv.org/abs/2409.16120v1","url_pdf":"https://arxiv.org/pdf/2409.16120v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"moss-enabling-code-driven-evolution-and","repo_url":"https://github.com/ghost-in-moss/ghostos","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"code-generation","task_name":"Code Generation"},{"task_slug":"management","task_name":"Management"}],"methods":[{"method_slug":"focus","method_name":"Focus"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2409.16120","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2409.16120"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ghost-in-moss/ghostos","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":6,"unverified":1},"by_repo_kind":{"official":{"samples":7,"ran":6,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"698b0fcf3929c793","entry":"get_bootstrap_config","repo":"ghost-in-moss/ghostos","repo_kind":"official","path":"libs/ghostos/ghostos/bootstrap.py","file_url":"https://github.com/ghost-in-moss/ghostos/blob/HEAD/libs/ghostos/ghostos/bootstrap.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"698b0fcf3929c793"}},{"code_sha256_prefix":"3483f33e04b939df","entry":"get_caller_info","repo":"ghost-in-moss/ghostos","repo_kind":"official","path":"libs/container/src/ghostos_container.py","file_url":"https://github.com/ghost-in-moss/ghostos/blob/HEAD/libs/container/src/ghostos_container.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3483f33e04b939df"}},{"code_sha256_prefix":"43b9d8378eac16e9","entry":"is_entity_type","repo":"ghost-in-moss/ghostos","repo_kind":"official","path":"libs/common/src/ghostos_common/entity.py","file_url":"https://github.com/ghost-in-moss/ghostos/blob/HEAD/libs/common/src/ghostos_common/entity.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"43b9d8378eac16e9"}},{"code_sha256_prefix":"0e6a1ec20c210281","entry":"is_streamlit_renderable","repo":"ghost-in-moss/ghostos","repo_kind":"official","path":"libs/ghostos/ghostos/streamlit.py","file_url":"https://github.com/ghost-in-moss/ghostos/blob/HEAD/libs/ghostos/ghostos/streamlit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0e6a1ec20c210281"}},{"code_sha256_prefix":"27ca710bf5e6c91d","entry":"render_streamlit_object","repo":"ghost-in-moss/ghostos","repo_kind":"official","path":"libs/ghostos/ghostos/streamlit.py","file_url":"https://github.com/ghost-in-moss/ghostos/blob/HEAD/libs/ghostos/ghostos/streamlit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"27ca710bf5e6c91d"}},{"code_sha256_prefix":"41b7fe757e91e851","entry":"text_completion","repo":"ghost-in-moss/ghostos","repo_kind":"official","path":"libs/ghostos/ghostos/facade/_model_funcs_facade.py","file_url":"https://github.com/ghost-in-moss/ghostos/blob/HEAD/libs/ghostos/ghostos/facade/_model_funcs_facade.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"41b7fe757e91e851"}},{"code_sha256_prefix":"e70a2d98564549dc","entry":"file_reader","repo":"ghost-in-moss/ghostos","repo_kind":"official","path":"libs/ghostos/ghostos/facade/_model_funcs_facade.py","file_url":"https://github.com/ghost-in-moss/ghostos/blob/HEAD/libs/ghostos/ghostos/facade/_model_funcs_facade.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e70a2d98564549dc"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}