A self-extending agent builds and adapts its own tools, skills, and extensions instead of relying entirely on a pre-built integration catalog. The core bet is that models are good at writing and running code: when a capability is missing, show the agent an example and have it build a variant for the task.
This is a design philosophy, not a requirement to avoid SDKs, MCP, or sandboxes. Pi (Coding Agent) is the reference example in this wiki: a small coding surface, inspectable extension files, session trees, and documented APIs let the agent adapt the harness to the user’s workflow.
Earlier architectural claims were too strong
This page previously said Pi’s hot reload was architecturally incompatible with MCP, that MCP necessarily fixed tools at session start, and that self-extension required no extension SDK or unrestricted execution. Pi 1.0 adds native MCP, dynamic tool exposure, virtual models, and transcript-aware prompt changes. Those impossibility claims are withdrawn. The useful principles are accessible authoring, controlled loading, observability, and testing, not a ban on integration protocols or safety boundaries.
The central idea
Instead of accepting a general-purpose extension unchanged, ask the agent to create exactly the capability you need. It writes the instructions or implementation, loads it through the harness’s supported mechanism, tests it, and revises it.
This does not make external integrations obsolete. A maintained MCP server can supply a service connection while a locally authored skill or extension supplies the workflow. The personal capability layer can remain owned and adaptable even when some dependencies are maintained elsewhere.
Discard capabilities that stop being useful. A growing directory is not, by itself, a growing ability to solve problems.
Architectural requirements
The earlier seven-property checklist is better treated as design questions than universal necessary conditions:
- Sufficient authoring tools. Reading, editing, writing, and execution let the agent manipulate the files that define capabilities. Pi’s four core coding operations are enough for much of this work; other exposed tools can supplement them.
- A supported load/reload path. New instructions and executable extensions must enter the running system predictably. Loading a skill is not the same as replacing extension code. Pi provides extension lifecycle APIs and reload; this should not be described as “just rescan the skills directory each turn.”
- Persistence outside transient model context. Capability definitions live in durable files or other explicit storage. Branch-sensitive runtime state needs its own persisted representation. Files are versionable; their contents need not be copied permanently into every prompt.
- An execution environment with adequate permissions. The agent needs access to the tools and dependencies required for its task. An unrestricted host shell is not a prerequisite. A sandbox can still permit authoring, testing, and loading within its boundary; capability limits should be deliberate.
- An accessible extension API. An SDK does not inherently obstruct self-extension. The important questions are whether the agent can read its contracts and examples, author code, and use an authorized loading mechanism. Pi’s TypeScript extension API is an example, not a contradiction of the philosophy.
- Observability. The human can inspect the capability definition, review diffs, see what loaded, and diagnose failures. Dynamic tool and prompt changes should be recorded so the session’s behavior is reconstructable. See Session Observability and Replay.
- Isolation and testing for risky changes. Branching helps keep a side quest out of the main model context. It does not isolate filesystem effects or credentials. Use tests, version control, and real execution boundaries where needed.
Filesystem as extension surface
A useful connection remains between Tool Design for Agent Harnesses and self-extension: the operations used for ordinary coding also let an agent create capability files. It need not acquire an entirely different authoring interface to write a skill, script, or TypeScript extension.
That makes filesystem-based customization convenient and inspectable. It does not prove registered tools are opaque, or that a harness with a plugin runtime cannot be extended by an agent. An accessible runtime can load code the agent authored with the same read/write tools.
Hot reload as a practical capability
Hot reload makes adaptation possible without abandoning the conversation. The details matter: what is replaced, when it becomes active, what state survives, and whether running work still uses the old implementation.
Pi’s skills, executable extensions, and active model tool declarations are separate layers. The extension API can register tools and MCP servers, change the active tool set, and expose virtual models. Reload replaces an extension runtime; old runtime references must not be reused afterward. This is more than a directory rescan.
Pi Durable has its own replacement semantics: a running tool finishes on the implementation it started with, and subsequent calls use the replacement registered under the same name. That is a separate framework’s guarantee, not something to assume for every terminal-agent extension.
Prompt and schema changes
Changing the model-visible tools or instructions can affect caching and historical interpretation. The earlier version of this page treated those costs as unavoidable invalidation and a fundamental barrier to MCP.
The current Pi documentation describes an initial system/tool state plus transcript entries for subsequent changes. Providers that support transitions can preserve the history of those changes; providers that cannot may need a complete checkpoint, with a possible cached-prefix invalidation. This is provider-dependent engineering, not a protocol-level impossibility.
Similarly, a skill’s advertised description consumes context even when the skill uses a fixed Bash schema. “The tool schema did not change” does not mean no prompt content changed or no cache cost exists.
The useful architectural comparison
Compare mechanisms on practical properties rather than “minimal versus maximal” labels:
- Can the agent author a capability using available, authorized tools?
- Can it find the API contracts and a small working example?
- Can it load or replace that capability without losing needed state?
- Are tool exposure and prompt changes recorded?
- Can a human inspect, revoke, and test the result?
A small core can make these easier to reason about. It does not guarantee them, and a larger system need not lack them.
MCP and CLI tools can coexist
Pi’s earlier rejection of MCP was motivated by large tool loadouts, poor composability, and opaque workflow costs. Pi 1.0 brings native MCP together with Codemode and deferred loading.
Instead of showing every server schema upfront, a script can discover and compose tools, filter their results, and return a selected summary. A maintained server handles the connection; a self-authored script or extension shapes the workflow. CLI Tools Pattern offers the analogous composition through shell programs.
Neither mechanism proves safety or lowers every cost automatically. MCP server output must be suitable for composition, CLI scripts need maintenance, and both can execute actions with real effects. See MCP Tools vs Custom Function Tools for the choice.
The skill library versus the skill store
A personal skill library is tuned to recurring work and maintained with the agent. A store or shared repository offers general-purpose starting points and shared maintenance.
These are not mutually exclusive. Fork a good template when that saves time; author locally when the workflow is specific. The deciding factor is whether the capability remains understandable, testable, and useful, not whether it originated in a marketplace.
Software building software
Armin Ronacher describes the fascination of software that builds more software. OpenClaw illustrates how a malleable agent can be connected to a communication surface and respond by writing and running code.
The human’s role can move toward specifying intent and inspecting outcomes, but the engineering decisions do not disappear. A Sufficiently Detailed Spec Is Code is the counterweight: authoring a brief or asking for an extension does not remove the need for sound design and verification.
Risks and discipline
Self-extension expands the failure surface as well as the capability surface:
- Branch before experimenting, but remember branches do not undo external effects.
- Read the relevant docs and examples before authoring against an API.
- Test the extension through the actual load/reload lifecycle.
- Keep changes small, versioned, and reversible where possible.
- Review permission scope and credential access. Extensions run inside the Pi process; trusted loading is not a tool-call sandbox.
- Do not let a capability’s author be its only evidence of correctness.
See Agentic Coding - Risks and Discipline and Agent Security and Threat Model.
Barba Papa software
Lucas Meijer calls this Barba Papa software: a base that can reshape itself to fit the user and the current problem. His framing broadens self-extension from a developer feature to a product philosophy.
The valuable promise is adaptability. It is not that every adaptation is safe, nor that each user should recreate every integration. A minimal base plus inspectable, testable customization can serve different workflows without making all of them part of the core product.
Related
- Pi (Coding Agent): the terminal reference implementation, updated for 1.0.
- Pi Durable: a separate framework whose extension/task model participates in durable execution.
- Tool Design for Agent Harnesses: small interfaces and exposure choices.
- Session Observability and Replay: preserve what the model saw as the harness changes.
- MCP Tools vs Custom Function Tools: native MCP and custom code are compatible choices.
- CLI Tools Pattern: the lightweight shell-based approach.
- Agentic Coding - Risks and Discipline: restraint and verification.
Sources
- Pi: The Minimal Agent Within OpenClaw: the original minimal, malleable design philosophy.
- A love letter to Pi: the practitioner account and Barba Papa framing.
- Pi 1.0: the release that supersedes the old no-MCP assumption. The published Pi 1.0.0 extension/MCP/Codemode documentation was checked during this revision (correction 2026-10-08: earlier wording said “installed”, but Quang’s installed Pi is 0.87.1); no new extension was executed.