AGENTS.md
sdk/AGENTS.mdDevelopment reference for the Cline SDK workspace.
AGENTS.md
Quality
89/100
Scores the file, not the repository.Length
676 words
11 headings · 5 code blocksRepository
66k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1234567# Cline SDK — Development Reference89Quick-reference for active development. For onboarding, workspace setup, publishing, and detailed workflow see [CONTRIBUTING.md](./CONTRIBUTING.md). For architecture and runtime flows see [ARCHITECTURE.md](./ARCHITECTURE.md). For API details see [DOC.md](./DOC.md).1011## Repository Scope1213This file applies to the SDK workspace rooted at this directory (`sdk/`). In this repo, "root" means the SDK workspace root unless explicitly stated otherwise. Ignore the legacy repository root for SDK development except for Git operations or repo-wide searches that are explicitly needed.1415Run SDK commands from `sdk/`, not from the legacy repository root. Do not run direct root-level commands such as `bun test sdk/...`; they bypass the SDK workspace setup and can fail to resolve `workspace:*` packages correctly.1617## Package Boundaries1819### Published SDK Packages2021- `@cline/shared`: shared contracts, schemas, path helpers, hook engine, extension registry, low-level utilities22- `@cline/llms`: provider settings/config, model catalogs, provider manifests, gateway contracts, handler creation23- `@cline/agents`: stateless agent loop, tool orchestration, hook/extension runtime, event streaming24- `@cline/core`: stateful orchestration, session lifecycle, storage, config watching, plugin loading, default tools, telemetry. Exposes `@cline/core/hub` for discovery, the detached daemon entry, WebSocket clients, and session/UI client adapters, plus `@cline/core/hub/daemon-entry` for launching the shared daemon2526### Dependency Direction2728```mermaid29flowchart TD30 shared["@cline/shared"] --> llms["@cline/llms"] & agents["@cline/agents"] & core["@cline/core"]31 llms --> agents & core32 agents --> core33 core --> apps["CLI / VS Code / Code App"]34```3536Rules:37- `shared` stays low-level and reusable38- `agents` stays stateless — no session/storage/config concerns39- `core` owns stateful orchestration, including the shared-hub daemon, server, and client adapters under `src/hub/`4041## Change Routing4243Route changes to the package that owns the concern:4445- model/provider schemas or handler behavior: `@cline/llms`46- stateless loop, tool orchestration, streaming, hook/extension runtime: `@cline/agents`47- session lifecycle, storage, config watching, default tools, plugin loading, telemetry, hub runtime services, hub discovery, hub daemon spawn, and session-oriented client helpers (`HubSessionClient`, `HubUIClient`, `connectToHub`): `@cline/core` (hub pieces live under `src/hub/`)48- remote-config schemas, managed instruction materialization, blob upload metadata, and OpenTelemetry config normalization: `@cline/shared/src/remote-config`49- host-specific UX or shell behavior: app package5051## Verifying Changes5253Before testing in a fresh worktree, install SDK dependencies from the SDK workspace root:5455```sh56cd sdk57bun install --frozen-lockfile58```5960SDK package exports resolve sibling packages through compiled `dist/` files. If `dist/` is missing, build the SDK packages before running package tests:6162```sh63bun run build:sdk64```6566SDK-root commands for cross-package confidence:6768```sh69bun run types # typecheck all packages70bun run test # run all tests71bun run check # lint + build + typecheck + check-publish72```7374For focused verification, prefer workspace package scripts from the SDK root:7576```sh77bun -F @cline/shared test78bun -F @cline/llms test79bun -F @cline/agents test80bun -F @cline/core test:unit81bun -F @cline/cli test:unit82```8384If a focused test command fails with a missing `@cline/*` export or missing `dist/` file, build the relevant dependency package or run `bun run build:sdk`, then rerun the same test command. Treat that as a workspace setup issue, not as evidence of a source-code bug.8586If you touch hub/bootstrap/session flows, please update `ARCHITECTURE.md`.8788## Practical Guidance8990### Keep Boundaries Clean9192- Don't move stateful logic down into `agents`93- For `@cline/llms` provider/model routing rules, follow [packages/llms/AGENTS.md](./packages/llms/AGENTS.md).94- Don't put app-specific behavior into `core` unless it is truly shared host behavior95- Keep remote-config primitives generic in `shared`; host-facing session integration belongs in `core`9697### Refactor Standard9899- Prefer direct architectural cleanup over compatibility shims100- Move code to the layer that owns the concern and update all call sites101- If a helper just projects watcher state, keep it with the config layer instead of creating thin runtime wrappers102103## Documentation Responsibilities104105- `README.md`: visitor-facing overview. Update when the repo story or package inventory changes.106- `CONTRIBUTING.md`: onboarding, workflow, publishing. Update when contributor setup or release process changes.107- `AGENTS.md` (this file): development reference. Update when package boundaries, dependency rules, or change routing changes.108- `ARCHITECTURE.md`: design, boundaries, runtime flows. Update when system design or architectural constraints change.109- `DOC.md`: API and behavior reference. Update when exported surfaces, lifecycle semantics, or runtime behavior changes.110
Also in cline/cline
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| cline/cline.clinerules/bun-and-node.md · 66k | Cline rules | setuptestmonorepodo-not | 74/100 | 3 days ago | |
| cline/cline.clinerules/cline-overview.md · 66k | Cline rules | archtypesapi | 54/100 | 3 days ago | |
| cline/cline.clinerules/debug-harness.md · 66k | Cline rules | buildtesttesting-strategysecurity+1 | 85/100 | 3 days ago | |
| cline/cline.clinerules/general.md · 66k | Cline rules | setupbuildstylearch+2 | 86/100 | 3 days ago | |
| cline/cline.clinerules/network.md · 66k | Cline rules | styletesting-strategydependencies | 54/100 | 3 days ago | |
| cline/cline.clinerules/protobuf-development.md · 66k | Cline rules | buildstylearchapi+1 | 74/100 | 3 days ago | |
| cline/cline.clinerules/sdk-migration.md · 66k | Cline rules | style | 59/100 | 3 days ago | |
| cline/cline.clinerules/storage.md · 66k | Cline rules | stylearchdatabasedo-not | 65/100 | 3 days ago | |
| cline/cline.github/copilot-instructions.md · 66k | Copilot instructions | buildteststyleapi+1 | 75/100 | 3 days ago | |
| cline/clineAGENTS.md · 66k | AGENTS.md | buildtestlint-formatstyle+2 | 83/100 | 3 days ago | |
| cline/clinesdk/packages/llms/AGENTS.md · 66k | AGENTS.md | no sections | 45/100 | 3 days ago |
Diff against .clinerules/bun-and-node.md Diff against .clinerules/cline-overview.md Diff against .clinerules/debug-harness.md Diff against .clinerules/general.md Diff against .clinerules/network.md Diff against .clinerules/protobuf-development.md Diff against .clinerules/sdk-migration.md Diff against .clinerules/storage.md Diff against .github/copilot-instructions.md Diff against AGENTS.md Diff against sdk/packages/llms/AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| TryGhost/Ghoste2e/AGENTS.md · 55k | AGENTS.md | setupteststylearch+2 | 100/100 | 3 days ago | |
| SkeneTechnologies/skene-cookbookAGENTS.md · 51 | AGENTS.md | setupbuildtestlint-format+7 | 100/100 | 2 days ago | |
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| aaif-goose/gooseAGENTS.md · 52k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| trick77/agents-md-syncAGENTS.md · 2 | AGENTS.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 67k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 2 days ago |
