Today, we're introducing Mods, an agent-friendly way to extend and adapt the Letta Code harness. Mods let an agent modify the runtime it executes in — adding tools, commands, and UI, or changing how context is fed into the model — so that the harness itself becomes something an agent can learn.
Just like context, agents can learn a better harness. Agents are already very adept at generating code, and can extend their own capabilities through learning skills that can include custom code and CLIs. Recent work like MetaHarness shows that agents can automatically adapt harnesses to improve performance on tasks. Mods allow agents to extend the Letta Code harness directly, adapting how Letta Code itself feeds context into the agent, in addition to adding customized features. This allows agents to adapt their behavior both through optimization of context and the harness.
Adapting memory & context
Context, like the parameters of the model, can be learned and optimized through learning in token-space. MemGPT was the first example of an agent self-modifying, editing its own system prompt through memory tools. ACE added more structure to in-context memory by enforcing a "cheatsheet" format. DSPy and GEPA automate prompt optimization, and skill learning shows that skills, too, can be optimized to improve an agent's performance.
Letta Code agents are designed to self-adapt through context using skill and system-prompt learning. Every agent has a built-in MemFS that versions and stores all of the context available to it, including prompts and skills. Both background memory agents and the agent itself can revise this context, so the agent learns and improves with experience and feedback.
Adapting the harness
LLMs are now extremely adept at writing code, enabling agents themselves to modify the code that they run in. A popular example of this is Pi’s extension system, where the agent (or developer) can use the extension system to modify the harness to implement features like plan mode or custom TUI features. Recent work on meta-harnesses proposes creating an outer loop outside of the harness to optimize harness code based on past trajectories.
Harness-level modifications let an agent self-improve in ways that learned context alone cannot:
- Learning to modify context: An agent that keeps losing track of time in a use case that depends on it can modify the harness to attach a timestamp to every user message — rather than trying to infer or remember the current time on each turn.
- Learning to extend capabilities: Instead of (or alongside) learning a skill, the agent can add new tools to the harness, or add features like automated secret scanning or plan mode.
- Learning to compact: The agent can change the method or prompt used for compaction so that it better fits the environment it runs in.
So far, learning through code has mostly meant skill learning — custom CLIs or scripts an agent writes to help with future tasks. Most harnesses today have only limited support for learned context, let alone a learned harness.
Mods: Harness-level adaptation
Mods bring harness-level modification into Letta Code. A mod can adapt the agent's own behavior — including how context is assembled and fed to the model — and can also customize the experience around it with custom UIs (like a status bar), commands, and tools. Mods take direct inspiration from Pi's extension system, where agents programmatically modify the harness they run inside. Together with learned context, they let an agent adapt along two axes: optimizing what it knows, and optimizing the runtime that wires that knowledge into the model.
Some mods we've already added to Letta Code:
- Image understanding for text-only models (e.g. GLM 5.2)
- Support for semantic search over MemFS
- Plan mode
You can see the full list of trusted mods on GitHub, or see our catalog of community mods.
Creating a mod
You can create a mod by simply asking your agent. Every Letta Code agent is now bundled with a skill for creating mods. We designed mods to be agent-first, rather than developer-first: mods are designed to be created by agents themselves, while developers, or users of Letta Code in general, have the ability to enable or disable mods.
Enabling and disabling mods
To enable a mod, you can hot-reload the harness with /reload. Mods located in ~/.letta/mods/ are enabled, so can be moved in or out of the directory to enable or disable mods.
Mod learning
In addition to asking agents to generate mods, you can also ask them to learn one from feedback. To learn a mod, first have your agent generate an environment based on some targeted behavior:
/mods generate-env Always cite memory sources inline using the Wikipedia-style format [[path]] whenever you use a memory file for a responseYou can then run the mod learning process using the generated environment:
/mods learn --env=docs/examples/mods/learning/memory-citations.env.jsonIn the future, we anticipate that Letta agents will automatically determine whether an improvement should be made through context or through a mod.
Next steps
Upgrade to the latest version of Letta Code to try out mods:
npm install -g @letta-ai/letta-codeand join our Discord if you have any feedback.
If you’re interested in working on agents that self-adapt and learn, we are also hiring.

