---
title: createVectorBuilder() API reference
description: Create a builder that binds inferred Runtime Configuration and computed Context types to every Vector definition and extension helper.
sidebar:
  label: createVectorBuilder
---

Import `createVectorBuilder()` from `@evilkiwi/vector`.

```ts title="TypeScript"
function createVectorBuilder<Computed extends object>(options: {
  computeContext(input: ComputeContextInput): Computed;
}): VectorBuilder<Record<never, never>, Computed>;

function createVectorBuilder<Schema extends StandardSchemaV1>(options: {
  runtimeConfig: { slug: string; schema: Schema };
}): VectorBuilder<StandardSchemaV1.InferOutput<Schema>>;

function createVectorBuilder<Schema extends StandardSchemaV1, Computed extends object>(options: {
  runtimeConfig: { slug: string; schema: Schema };
  computeContext(input: ComputeContextInput): Computed;
}): VectorBuilder<StandardSchemaV1.InferOutput<Schema>, Computed>;

function createVectorBuilder(): VectorBuilder;
```

`runtimeConfig` contains the filesystem-safe slug and Standard Schema used for every Vector Configuration defined by the builder. The schema output becomes the builder's inferred Runtime Configuration type. Vector captures this metadata when `createVectorBuilder()` runs.

`computeContext` runs once for each plugin activation after Runtime Configuration validation. It receives only the active location fields through `ComputeContextInput`; Runtime Configuration is not available to this callback. Vector merges its returned properties into the Context passed to the bound `defineVector()` and extension callbacks.

The builder exposes bound `defineVector`, `defineAgent`, `defineCatalogProvider`, `defineCommand`, `defineIntegration`, `defineIntegrationMethod`, `defineMCPServer`, `defineModel`, `defineReference`, `defineSkill`, `defineTool`, and `defineWebSearchProvider` helpers. Definitions from one builder share its Runtime Configuration and computed Context types and can be selected by multiple Vector Configurations. Each activation resolves separate runtime values.

Extension helpers do not accept a Runtime Configuration generic. Define extensions through the builder that owns their Runtime Configuration schema.

```ts title="src/extensions/project-summary.ts"
const projectSummary = vector.defineCommand({
  name: 'project-summary',
  build: (context) => ({
    template: `Summarize ${context.projectLabel} for ${context.runtimeConfig.audience}`,
  }),
});
```

The computed result must be a synchronous plain object. Object literals, explicitly typed interfaces, and null-prototype records are accepted. Arrays, dates, class instances, Promise-like values, and the reserved `runtimeConfig`, `cwd`, or `project` keys are rejected. A non-callable `then` property is an ordinary Context property.

Validation, callback execution, and flat merge use one guarded boundary. A violation or a property getter that throws fails activation before the root `build()` callback, extension materialization, or host registration. An `Error` thrown by `computeContext` remains that error; other thrown values receive a safe message.

Calling `createVectorBuilder()` without options provides the same no-config, no-computed-context helpers as the root named helpers. Vector skips Runtime Configuration discovery and supplies a fresh mutable empty object for each activation. See [Context](/api/context) for `Context` and `ComputeContextInput`.
