Extensions

Extensions

Extensions

Extensions are TypeScript files that plug into pi’s extension system. They can register custom tools, inject content into the system prompt, intercept events, and react to the agent’s lifecycle. Extensions are the most powerful way to extend reeboot.


User Extensions

Drop a .ts file into ~/.reeboot/extensions/. It is loaded on startup and on reeboot reload.

// ~/.reeboot/extensions/weather.ts
export default function makeWeatherExtension(pi: any) {
  pi.registerTool({
    name: 'get_weather',
    description: 'Get current weather for a city',
    inputSchema: {
      type: 'object',
      properties: {
        city: { type: 'string', description: 'City name' }
      },
      required: ['city']
    },
    handler: async ({ city }: { city: string }) => {
      // your implementation
      return `Weather in ${city}: sunny, 22°C`;
    }
  });
}

Hot-reload without restart:

reeboot reload

Available Hooks

Extensions can subscribe to lifecycle events:

Hook / APIWhen it firesReturn value
pi.registerTool(def)Call during extension init to register a custom tool— (registration, not a hook)
before_agent_startBefore the LLM is called for a turn{ systemPrompt?: string } — inject content into system prompt
agent_endAfter the agent completes a turnvoid
turn_startAt the start of each retry within a turnvoid
turn_endAt the end of each retry within a turnvoid
session_shutdownWhen the session is closedvoid
after_provider_responseAfter the LLM respondsvoid — access usage/cost data

Injecting system prompt content (use before_agent_start, not turn_start):

pi.on('before_agent_start', async () => {
  return {
    systemPrompt: 'Always respond in Spanish.\n'
  };
});

Core Extensions

Reeboot ships several built-in extensions. All are enabled by default and can be toggled in config:

KeyDefaultDescription
extensions.core.sandboxtrueOS-level bash sandboxing
extensions.core.confirm_destructivetrueConfirm before destructive operations
extensions.core.protected_pathstrueBlock writes to sensitive paths
extensions.core.git_checkpointfalseAuto-commit before destructive ops (opt-in)
extensions.core.session_nametrueHuman-readable session names
extensions.core.custom_compactiontrueSummarise old turns instead of truncating
extensions.core.scheduler_tooltrueschedule_task, timer, heartbeat tools
extensions.core.token_metertrueTrack token/cost usage per turn
extensions.core.mcptrueMCP proxy tool
extensions.core.injection_guardtruePrompt injection detection

Disable a core extension:

{
  "extensions": {
    "core": { "git_checkpoint": true }
  }
}

Community Packages

Extensions can be distributed as npm packages and installed with:

reeboot install npm:reeboot-github-tools

→ See Packages for the full package system reference.


Dev Notes

  • Extensions run in the same process as reeboot — no isolation. Trust your extensions.
  • Extensions loaded from ~/.reeboot/extensions/ are user-scope; extensions bundled inside src/extensions/ are core.
  • The pi object passed to extension factories is pi’s ExtensionAPI. Refer to pi’s documentation for the full API surface.
  • Use require('../db/index.js').getDb() to access the reeboot SQLite database from an extension (same pattern as core extensions).