sdk/packages/core/README.md
@cline/core is the stateful orchestration layer of the Cline SDK. It
connects the agent runtime, provider settings, storage, default tools, and
session lifecycle into a host-ready runtime.
@cline/corenpm install @cline/core
@cline/core: core contracts, shared utilities, and Node/server helpers for building hosts and runtimesMost host apps should start with @cline/core.
import { ClineCore } from "@cline/core";
const cline = await ClineCore.create({});
const result = await cline.start({
config: {
providerId: "anthropic",
modelId: "claude-sonnet-4-6",
apiKey: process.env.ANTHROPIC_API_KEY ?? "",
cwd: process.cwd(),
mode: "act",
enableTools: true,
enableSpawnAgent: false,
enableAgentTeams: false,
systemPrompt: "You are a concise assistant.",
},
prompt: "Summarize this project.",
interactive: false,
});
console.log(result.result?.text);
await cline.dispose();
When both cwd and workspaceRoot are omitted, the execution host places
the session in the shared chat workspace at
<cline-data-dir>/workspaces/chat (by default
~/.cline/data/workspaces/chat), seeded with an AGENTS.md rules file that
tells the agent to treat the session as a chat and only create a named
project folder when the user asks for one.
Read the resolved paths from result.manifest.cwd and
result.manifest.workspace_root.
ClineCore.create(...) also accepts prepare(input).
Use it when a host needs to prepare workspace-scoped runtime state before each
session starts, then apply watcher/extensions/telemetry inputs through
explicit localRuntime bootstrap fields without widening the shared host
contract.
Preparation runs before the execution host resolves an omitted workspace, so
pathless starts expose neither cwd nor workspaceRoot to prepare(input).
Use @cline/core for host-facing runtime assembly:
ClineCore.create(...)createRuntimeHost(...)LocalRuntimeHostHubRuntimeHost and RemoteRuntimeHostDefaultRuntimeBuilderClineCore is the app-facing session API. The lower-level RuntimeHost
boundary uses runtime-primitive names such as startSession and runTurn so
transport adapters stay distinct from product methods like start and send.
Service-style operations such as pending prompt edits, accumulated usage lookup,
and active-session model switching are exposed through ClineCore when the
selected transport supports them rather than being part of the minimal host
primitive vocabulary.
@cline/core owns the built-in host tools and executors:
createBuiltinTools(...)createDefaultTools(...)createDefaultExecutors(...)The package also exports storage and settings helpers such as:
ProviderSettingsManagerCoreSettingsService and createCoreSettingsServicesetMcpServerDisabledSqliteTeamStore@cline/core@cline/agents: stateless agent loop and tool primitives@cline/llms: provider/model configuration and handlers