Add your own features to MADRE.
A module adds something to MADRE, like a new command, a tool for your agents or an integration. It all fits in a single file. You can ask an agent for it with /module or write it yourself. You don’t compile anything, it installs no packages and it doesn’t ask you to sign up.
In short
- A module adds something to MADRE: a command, a tool for your agents or an integration. It is one file.
- You do not have to write it: type
/moduleand what you want, and an agent writes it. - Nothing installs on its own. MADRE shows you what it does and what it touches, and you decide.
- If the module has a mistake, MADRE tells you instead of installing it halfway.
Let an agent write it
Ask an agent with /module.
Type /module and what you want it to do. MADRE hands the agent the guide and the example, and it writes the module. Your part is reviewing it and installing it.
#2 is the Create permission, /module is the request and @opencode, who makes it.You ask
Type
/moduleand what you need, like “a /todos command that lists the project’s TODOs”.You give permission
It needs the
#2Create permission. If it’s off, MADRE asks you for it and keeps your request. Typing the command never turns it on for you.The agent writes it
Just one file,
<id>.module.mjs, in its draft folder. It never installs it on its own.You install it
MADRE puts a card in the conversation with INSTALL FOR EVERY PROJECT or INSTALL FOR THIS PROJECT. You look it over, pick with one click and turn it on in Modules.
What it can do
What your module can do.
You declare each one in the module’s file, and MADRE wires it into your projects.
Commands in the project. Make your own
/commands. They answer with a card that you and your agents read.Tools for the agents. Give an agent extra tools (MCP servers) for its turn only, and MADRE tells it what it got.
Settings without designing anything. Declare selects, switches and fields. MADRE draws them on the card and keeps what you pick.
Your own addresses. Your module can answer on its own web addresses, always under
/api/x/your-module/.Listen to the project. It gets every message and every turn in the project, and it can react to them.
Versions kept current. If your module uses an outside program, MADRE keeps an eye on its version and shows you the update command before running it.
Diagnostics. Teach Diagnostics to spot new problems and how to fix them on each system.
Share it in the Market. Send it to the community Market. I read it, sign it and it shows up in everyone’s Market. Whoever installs it first sees what it declares: where it connects, which keys it asks for and what it adds.
Common mistakes
MADRE warns you before something breaks.
If you or an agent get something wrong in a module, MADRE tells you instead of installing it half-broken.
A misspelled field. Write
sumaryinstead ofsummaryand MADRE tells you which field it doesn’t know. It won’t install it with an empty card.An import that won’t work. Modules don’t use imports. MADRE hands yours what it needs. If you copy the
importfrom a built-in module, the error tells you what to do instead.Removing it is one click. Every module of yours has UNINSTALL on its own card. It deletes the file and takes it out of the project, no restart needed.
If you’d rather write it yourself
Write your first module.
Copy the file
Put it in
~/.pulse/modules/to have it in all your projects, or in.madre/modules/inside a project so it only works there.Reload
In Modules, open “Create your module” and hit Reload modules. If something fails, it shows you the exact file and line right there.
Use it
Flip its switch and type
/your-command. Changed the file? Reload and you’re done. No need to restart the project.
export default {
id: 'hello', // kebab-case
name: 'HELLO',
summary: 'What it does, in one sentence.',
settings: { enabled: false, greeting: 'hola' },
async status(ctx) {
return { status: { installed: Boolean(ctx.settings.enabled), detail: ctx.settings.enabled ? 'on' : 'off' } };
},
slash: [{
name: 'hello',
usage: '/hello [name]',
summary: 'Says hello.',
async execute(ctx, args) {
return { ok: true, title: 'HELLO', text: `${ctx.settings.greeting}, ${args[0] ?? 'crew'}` };
},
}],
};
/hello command. No import, because MADRE hands it everything it needs. See hello-module.mjsThe card
MADRE builds your module’s card.
Every card in Modules has the same five parts, always in the same order. So your module’s card reads just like the ones that come with MADRE.
Who it is
Its name, whether it’s on or off, who made it, the version and the button to look for a newer one.
What it does
One sentence.
What it touches
What it writes and what it needs to work.
Settings
Your selects, switches and fields.
The switch
Install, turn on or off. It’s always at the bottom. Your own modules also have UNINSTALL.
Since 1.1
One file, the sdk: 2 contract and the Market.
A module says which SDK contract it is written for. With sdk: 2 it is a single file that imports nothing from MADRE, and you can share it with everyone in the Market.
What MADRE gives you.
ctx.tgives you your words in the project’s language,ctx.services.ollama.generatethe local AI, and your routes get their own settings.It’s read before it’s installed. In the Market, people see what your module declares before installing it, and the same file they read is the one installed.
Signed for everyone. You send it to the community Market; once I’ve read it, I sign it and it reaches every copy of MADRE that asks for it.
House rules
How a good module behaves.
It doesn’t connect without telling you. If your module talks to a service, its card says so, and it only does it when the person asks.
No credentials. It uses the sessions already on the computer. It keeps no keys.
It doesn’t write to the project. That’s what the agents’ permissions are for. If it installs something, it shows you the command before running it.
If it fails, it doesn’t break the turn. The error shows up on the module’s card and the project keeps going.
It talks like MADRE. Short, clear words, in the person’s language: with
sdk: 2,ctx.tgives you your words in the project’s language.It uninstalls from its card. Your own modules uninstall. The ones that come with MADRE only switch off.
Your say
What’s missing for your module?
If the SDK doesn’t let you do something you need, like a field, an event or a tool for the agents, tell me. It doesn’t ask for an account and it gives you a private link where you see the reply.
Heads up
A module runs with your permissions.
MADRE checks that it loads properly and stays inside its own space. What its code actually does, only you can check. Only install modules you’ve read, or ones from someone you trust.
- Its addresses live under /api/x/<id>/.
- If one tries to use another, it doesn’t load. None can pass itself off as MADRE.
- It doesn’t take someone else’s name.
- Not a built-in module’s, and not one that’s already installed.
- It doesn’t make up messages.
- It can’t invent turns or messages from the agents.
- It gets no credentials.
- Like MADRE, it uses the computer’s sessions.