Bootstrapping

bootstrap is the only builtin — a ToolFn registered as a programmatic tool before any invocation. It receives config overrides as args and:

  1. Computes initial config values: cwd (from args or by walking up from process.cwd() to find the project root), library (from args or import.meta.url), workspace (from args or default ./workspace).
  2. Stores them on ctx.globals.config along with initial paths: [cwd, { external: library }, { ignore: "dist" }, { ignore: "node_modules" }, { ignore: ".git" }, { ignore: ".cache" }].
  3. Finds the main skill by walking up from cwd. Scans all skill files in each directory for one with role: main or metadata.main: true.
  4. If found: reads its raw frontmatter, stores the name on globals.config.mainTool, clears the authority cache, and seeds auth/email config on globals.internals.
  5. Calls ctx.manager.next().

bootstrap does NOT discover tools, scan directories, inject implicit inherit values, resolve the cascade, interpolate strings, or initialize MCP servers. All of that happens per-invocation: the orchestrator resolves metadata through the cascade and builds the middleware chain, and config middleware populates ctx.locals.config.

Everything except bootstrap is a real tool on disk. The boundary is absolute.

Ask AI