Kits and slots
A kit is a feature packaged so your app installs it with one entry in its config. It brings the code that does the work, the config that code takes, and a folder of files in your repo that it reads. A slot is an opening a kit leaves so other kits, or your app, can add to it.
Kits are experimental. defineKit, slots and the kit options can change between releases.
If you know plugins
You list a kit in your config and it adds a feature, as a plugin does. The difference is who knows whom. A kit declares typed openings, and another kit fills one by naming it. The kit that owns the opening has never heard of the kit that fills it.
Three kits in a config file
The example is a help desk that adds a team of workers and a coding agent.
import { claudeCode } from "@flow-state-dev/claude-code";
import { createFlowState } from "@flow-state-dev/engine";
import { harnesses } from "@flow-state-dev/harness-manager/kit";
import { localWorkspaceHost } from "@flow-state-dev/workspace";
import { workforce } from "@flow-state-dev/workforce/kit";
import helpDeskFlow from "./src/flows/help-desk/flow";
const repo = process.cwd();
const workspace = localWorkspaceHost({
root: ".fsdev/runs",
remotes: { allow: [] },
localRepositories: [repo],
source: () => ({ kind: "repo", repo }),
});
export default createFlowState({
kits: [
claudeCode(),
workforce({ agent: { model: "openai/gpt-6-luna" } }),
harnesses({ workspace }),
],
flows: [helpDeskFlow],
});
workforce brings a team of workers. harnesses adds a coder flow to it, and claudeCode supplies Claude Code to harnesses. workspace is the one option harnesses requires: where each coding run gets its own checkout of this repo. A flow is a self-contained system inside your app that clients can call, and the kits' flows are served beside help-desk.
You don't have to list kits in the order they need each other. Each step installs the first listed kit whose required kits are already installed, so this app installs workforce, then harnesses, then claudeCode. Two kits that don't require each other can install out of listed order, when the one listed first is waiting on a requirement. A missing kit does matter: delete workforce(...) and keep harnesses({ workspace }), and the app refuses to start, naming the kit harnesses needs. Kits reference has the rule.
What a kit brings
Beside flows, a kit can bring:
- Config. The options your app passes when it calls the kit, checked at that call. The Kits reference lists the checks.
- A folder.
workforcereadsworkforce/, oneWORKER.mdfile per worker, when the app starts. Anything else left in that folder, such as a straynotes.txt, stops the app from starting and is named in the error; the per-path rules say which files count. - Views. A kit's flows bring their views, resources and capabilities with them. Views shows what a screen reads.
A slot
The kit that owns a slot declares it and says what an entry looks like. workforce declares workerFlows. Every entry is checked against that declaration, and the owner receives what was filled in.
A contribution goes in by the slot's key, which you read off the kit instead of typing it: workforce.slots.workerFlows. A kit can fill a slot only if it requires the owner, directly or through another kit, and the requires rule is in the reference.
A kit that fills one can open another
Here is harnesses, cut down to its shape.
import { defineKit, slot } from "@flow-state-dev/core";
import type { WorkspaceHost } from "@flow-state-dev/workspace";
import { workforce } from "@flow-state-dev/workforce/kit";
import { z } from "zod";
import { coderFlow } from "./coder-flow";
import { harnessSchema } from "./harness";
export const harnesses = defineKit({
name: "harnesses",
requires: [workforce],
config: z.object({
workspace: z.custom<WorkspaceHost>((value) => typeof value === "object" && value !== null),
}),
slots: { harnesses: slot.keyed(harnessSchema) },
contributes: ({ config, slots }) => ({
[workforce.slots.workerFlows]: { coder: coderFlow(config, slots.harnesses) },
}),
install: () => ({ flows: [] }),
});
config is the schema the factory checks its argument against, so harnesses() with no workspace throws at the call. requires makes harnesses install after workforce and lets it fill workforce's slots. contributes puts coderFlow's result in workerFlows under the key coder, and workforce serves it as one of its own.
slots opens harnesses' own slot, and slot.keyed makes it keyed: each harness carries an id, and the id becomes its key. Claude Code's is claude-code, and a worker picks a harness by that key. Two entries with the same key stop the app, naming both. coderFlow receives every harness in the slot, by key: claudeCode's, and any your app adds (below). (List slots append every entry instead.)
install returns the flows the kit serves itself. This one returns none: what it brings goes into workforce's slots. The real kit fills two more of them, with a readiness check and a harnesses flow, and Harness runs lists both.
Filling a slot from your app
Say you want Codex beside Claude Code. The slot is the one harnesses opened, and your app fills it from fsdev.config.ts.
import { claudeCode } from "@flow-state-dev/claude-code";
import { codexHarness } from "@flow-state-dev/codex";
import { createFlowState } from "@flow-state-dev/engine";
import { harnesses } from "@flow-state-dev/harness-manager/kit";
import { workforce } from "@flow-state-dev/workforce/kit";
import helpDeskFlow from "./src/flows/help-desk/flow";
// workspace as in the first example
export default createFlowState({
kits: [
claudeCode(),
workforce({ agent: { model: "openai/gpt-6-luna" } }),
harnesses({ workspace }),
],
flows: [helpDeskFlow],
fill: { [harnesses.slots.harnesses]: [codexHarness()] },
});
codexHarness() carries the id codex, so the slot holds claude-code and codex.
To drop what a kit contributes, call without on it: claudeCode().without(harnesses.slots.harnesses, "claude-code") leaves only Codex in the slot. The reference covers the rest of fill and without.
What it gets you
- One entry adds a feature. Listing
workforceserves its flows besidehelp-desk, with no wiring. - Features stack without edits.
harnessesadds a flow toworkforce, andclaudeCodeadds toharnesses. Neither kit underneath changes. - Mistakes stop at start-up. A bad fill throws when
createFlowStateruns, naming the kit and the slot, and the reference lists each error.
How it fits with the others
A capability is a bundle of resources, state and helpers that a block pulls in with uses. If you're packaging something for other apps, ask what it is. Is it a piece several blocks share? Make it a capability. Does it serve its own flows, take config, read a folder or leave openings? Make it a kit. One flow on its own is a flow, listed in flows.
Next
- Views: what a kit's screens read, and how they refresh.
- Kits reference: every
defineKitoption, the slot types and each start-up error.