For AI agents: the complete documentation index is available at https://scriptedalchemy.github.io/agent-bundle/llms.txt, the full documentation bundle is available at https://scriptedalchemy.github.io/agent-bundle/llms-full.txt, and this page is available as Markdown at https://scriptedalchemy.github.io/agent-bundle/reference/configuration.md.
  • English
  • Configuration

    The conceptual model — what config owns versus what the src/ conventions own — is in Configuration model. This page is the field contract.

    import { 
    const defineConfig: (config: AgentBundleConfig | ConfigFactory) => AgentBundleConfig | ConfigFactory
    defineConfig
    } from 'agent-bundle/config';
    export default
    function defineConfig(config: AgentBundleConfig | ConfigFactory): AgentBundleConfig | ConfigFactory
    defineConfig
    ({
    AgentBundleConfig.plugin: AgentBundlePluginConfig
    plugin
    : {
    AgentBundlePluginConfig.description?: string | undefined
    description
    : 'Evidence-backed project tools.',
    AgentBundlePluginConfig.name: string
    name
    : 'my-plugin' },
    AgentBundleConfig.targets?: string[] | undefined
    targets
    : ['portable', 'codex', 'claude'],
    });

    Top-level fields

    FieldTypeDefault
    plugin{ name, description?, logo?, ... }Required.
    targetsstring[]Adapter-selected.
    skillsstring[]The src/skills/* convention.
    hooksPartial<Record<CanonicalHookEvent, ...>>The src/hooks/* convention.
    mcp{ servers: Record<string, ...> }The src/mcp/* convention.
    scriptsRecord<string, string | { entry, targets? }>The src/scripts/* convention.
    assetsstring[]The root assets/ convention.
    binfalse | Record<string, string | { entry }>The src/cli.ts convention.
    libfalse | string | { entry, dts? }The src/index.ts convention.
    routesRoute-graph policyConvention-derived.
    output{ distPath? }artifact from the CLI; dist from build() without packageOutputs.
    runtime{ node }Node 22.12.
    payloadRecord<string, string | { source, targets? }>None.
    statefalseThe src/state.ts convention.
    marketplacebooleanAdapter-selected.
    dev{ agentApi?, contracts?, runtime? }None.
    evals{ include?, runsDir?, semanticGrader? }See below.
    tools{ rsbuild?, rspack? }None.

    Host-scoped extension keys (claude, codex, cursor, portable) are contributed by target adapters through declaration merging on AgentBundleConfigExtensions. Extension values must be strict finite JSON (AB4500), and host-specific values stay in their adapter rather than in compiler core. The field-by-field list of every adapter-owned key is in Host-scoped declarations.

    Generated type definitions

    The config is a TypeScript contract, not a runtime schema: defineConfig accepts an AgentBundleConfig (or a factory returning one), and validateSource enforces the rules on this page with structured diagnostics. The exact shapes below are generated from the package source by TypeDoc on every documentation build, so they cannot drift from the published types.

    plugin

    FieldRule
    nameRequired. The host-native plugin slug, never the npm package name.
    descriptionOne sentence written into generated manifests.
    logoProject-relative image path. Missing, non-file, or outside the project reports AB4012; missing from the built artifact or escaping the deploy tree reports AB6025.
    versionDeprecated.

    package.json is authoritative for release identity. Declare the release version only there: a plugin.version that disagrees with package.json reports the AB4008 warning, and a release build with no version anywhere is refused with AB4013 rather than shipping the 0.0.0-dev.<short-revision> development fallback. The field remains only for compatibility and will be removed under the normal breaking-change policy.

    hooks

    Keys are the seven canonical events: sessionStart, beforeTool, afterTool, stop, agentStart, agentStop, workspaceOpen. A value is one entry, or an array of entries, each either a module path or { handler, tools?, targets?, timeout?, args? }. How each canonical event and tool selector lowers to a host-native event and matcher is the generated Event and hook matrix.

    The hook result contract is documented in full in Hooks. One field is worth repeating because it is easy to get wrong: reason is a non-empty string that is valid only when denying a beforeTool, stop, or agentStop hook, and denying one of those without a reason fails.

    output and runtime

    output.distPath is the artifact output directory relative to the project root. The CLI (build, prepack, dev) defaults it to artifact, because the CLI also runs the package build and that owns dist/; the programmatic build() defaults to dist unless packageOutputs: true. The per-invocation --output flag wins, but is subject to the same project-root containment check; an output path that is absolute or external, has an invalid shape, or lands in a reserved compiler namespace is unsupported (AB4707AB4709).

    runtime.node is a minimum Node.js version in major.minor[.patch] form. It can only raise the default floor for generated executables, never lower it, and the selected floor is recorded as runtime.node in the artifact manifest. The floor itself is described in Configuration model.

    payload

    Keys are artifact-root destination directories — one safe path segment outside the compiler-owned namespaces — and values are already-built source directories. Payload trees are copied byte-for-byte and are opaque to the compiler, which cannot rewrite their internal sibling references, so stable names are the correctness contract. Integrity stays content-addressed through the artifact manifest.

    evals

    Accepts exactly three keys; anything else is rejected.

    FieldDefaultRule
    include['evals/**/*.eval.ts']A non-empty array of relative patterns that never escape the project root.
    runsDir.agent-bundle/runsA relative child directory of the project root.
    semanticGradernoneMust contain exactly harness and model. harness must be 'claude'; model must be a safe model identifier, not a path.

    Provider credential material in the evals block is rejected outright (EVAL_CREDENTIAL_REJECTED) — Agent Bundle reuses the host CLI's existing signed-in session. See Security.

    import { 
    const defineConfig: (config: AgentBundleConfig | ConfigFactory) => AgentBundleConfig | ConfigFactory
    defineConfig
    } from 'agent-bundle/config';
    export default
    function defineConfig(config: AgentBundleConfig | ConfigFactory): AgentBundleConfig | ConfigFactory
    defineConfig
    ({
    evals: {
        include: string[];
        runsDir: string;
        semanticGrader: {
            harness: string;
            model: string;
        };
    }
    evals
    : {
    include: string[]
    include
    : ['evals/**/*.eval.ts'],
    runsDir: string
    runsDir
    : '.agent-bundle/runs',
    semanticGrader: {
        harness: string;
        model: string;
    }
    semanticGrader
    : {
    harness: string
    harness
    : 'claude',
    model: string
    model
    : 'claude-sonnet-4-5' },
    },
    AgentBundleConfig.plugin: AgentBundlePluginConfig
    plugin
    : {
    AgentBundlePluginConfig.description?: string | undefined
    description
    : 'Evidence-backed project tools.',
    AgentBundlePluginConfig.name: string
    name
    : 'my-plugin' },
    AgentBundleConfig.targets?: string[] | undefined
    targets
    : ['portable', 'claude'],
    });

    dev

    Development-only settings that never become part of a built artifact.

    FieldMeaning
    dev.agentApiExposes the authenticated, loopback-only Agent API from agent-bundle dev. The --agent-api / --no-agent-api flags override it.
    dev.contracts.fixturesRequired when dev.contracts is set. Project-relative module whose default export maps route ids to contract fixtures. Declaring dev.contracts switches agent-bundle dev from adopting every epoch directly to gating host-facing adoption on the development contract matrix: an epoch whose checks fail still publishes to the Workbench playground, but live host connections and development installs keep the last passing epoch (AB7211). A malformed block, a fixtures module that escapes the project root, cannot load, or exports the wrong shape is AB7210.
    dev.contracts.serverThe MCP server the matrix checks. Optional only when the project compiles exactly one server.
    dev.runtime.providerThe development runtime provider module.

    tools

    The single bundler escape hatch. Both fragments merge last-but-bounded into every bundler config the framework synthesizes, and the artifact invariant assertions still run after the merge, so a hatch value that breaks an artifact contract is a hard diagnostic rather than a silent override (AB472x).

    The hatch executes under two bundler engine copies: artifact scripts, MCP entries, hooks, and the package build compile through Rslib's nested Rsbuild/Rspack, while MCP App views compile through the workspace-pinned @rsbuild/core. Never construct plugins or perform instanceof checks against an imported @rspack/core — use the utils argument passed to tools.rspack mutator functions ((config, { rspack }) => ...), which always hands you the executing engine's own rspack object.