跳到主要内容

Loop 0.5.0 · 2026-10-31

文档对应最新 npm 发布版本,保留英文原文。

Loop coding-agent

A CLI and TypeScript SDK built on the existing Loop Agent. Coding-agent owns model configuration, built-in tools, resources, and persistent sessions. Every prompt creates a fresh Agent with completed history.

Import from index.ts. This private pnpm workspace package owns its dependencies and public SDK/CLI exports. The root @loop-harness/loop distribution bundles it.

Start

Manual context compaction is available through interactive /compact, Web composer / → Compact, or SDK session.compact(). Originals remain saved while the next request uses a summary and recent turns. See compaction for cancellation and recovery.

From the project root, install with pnpm install and configure a model. Then choose a consumer:

pnpm run coding-agent
pnpm run coding-agent --print "Read package.json and explain the scripts."
node --conditions=loop-source --import tsx packages/coding-agent/src/sdk.sample.ts "Hello, what time is it now?"

The CLI is interactive by default. The SDK sample performs one request workflow and exits; it keeps history in memory. Both default to OpenAI GPT-5.5 and support a custom URL through model configuration.

Features

Feature Documentation
Embed Loop and call the public API SDK
Interactive commands and Print mode CLI
Model selection, credentials, custom URLs Models
Configuration files and environment Settings
Queue, reorder, steer, stop and resume inputs Message queue
Create, restore, replace, and save sessions Sessions
Preserve and restore archive membership Session archive
Automatic titles, renaming and regeneration Session titles
On-disk JSONL schema Session format
Stream output and observe run completion Events
Record execution events to local logs Telemetry
Inspect trace event names and business mappings Trace events
Read, bash, edit, and write Tools
Configure MCP servers and discover external tools in the background MCP servers
Discover and call tools through isolated JavaScript Codemode
Install, discover, select and load task workflows Skills
Session permission presets and native file sandboxing Permissions
Request, answer and cancel host approvals Approvals
Run local speech recognition and synthesis Voice runtime
Discover project instructions Context files
Track system permissions and expand selected Skill instructions Runtime context
Trace model messages to complete history and runtime snapshots Model input projection
Check complete model input and reserve response capacity Context budget
Summarize older model input while preserving original history Compaction

Each page covers one feature, with usage first, API or configuration reference, current behavior and limits, and links to source/tests. The README is the entry point, keeping feature details in docs/.

Samples and validation

  • cli.sample.sh: executable CLI usage, custom endpoint flags, and session restore.
  • sdk.sample.ts: model setup, session creation, text subscriptions, prompting, cancellation, and cleanup through public SDK exports.

Samples use real configured models and can execute enabled tools. Tests use local synthetic endpoints and temporary directories; the interactive PTY test requires Python 3.

pnpm exec vitest run packages/coding-agent/src
pnpm run typecheck
pnpm run check

Coding-agent supports Loop's sequential Agent, editable input queue, steering, cancellation, local voice runtime and JSONL history, including manual and automatic context compaction.