Fold is an Effect-native, provider-agnostic, isomorphic agent core with an optional opinionated coding agent, CLI, and TUI. It supports multiple model providers (including openai/anthropic-compatible and subscription-backed providers for Codex, Grok, and OpenCode Zen), subagents, and RLM-like orchestration patterns.
npm install -g @humanlayer/fold
foldcode # open the interactive TUI
foldcode --prompt "fix the tests"# noninteractive; framed assistant output goes to stdout; useful for CI
foldcode auth --help # configure and manage authenticationfoldcode auth ... handles provider authentication. The separately published @humanlayer/fold-cli package is an optional Node/headless CLI; it does not provide the TUI.
fold: skeleton package for CLI distributionfold-core: the isomorphic core with log-based state, tool support, hook support, subagents and skill facades, event streaming, auto-compaction, session managementfold-agent: opinionated agent with built-in profiles, filesystem tools (read,write+editfor claude models /apply_patchfor codex ones,bash,skill,agent,web_searchandweb_fetch); sane hook configurationfold-cli: CLI & TUI packagefold-codex: effect codex providerfold-opencode: effect opencode zen providerfold-tui-theme: theme tokens and example appfold-xai: effect XAI provider
The ergonomic API is descriptor-based: define an agent, then run it against a session backend. No Effect Layer, Toolkit, or runtime wiring is exposed.
import{anthropicModel,defineAgent,startSession}from'@humanlayer/fold-core'import{Config,Effect}from'effect'exportconstask=(prompt: string)=>Effect.gen(function*(){constapiKey=yield*Config.redacted('ANTHROPIC_API_KEY')constagent=defineAgent({name: 'assistant',model: anthropicModel({model: 'claude-sonnet-4-6', apiKey }),systemPrompt: 'Be concise and helpful.',})constsession=yield*startSession({ agent })// in-memory by defaultreturnyield*session.send(prompt)}).pipe(Effect.scoped)defineTool, model descriptors, and event-log descriptors use the same data-first API, so hosts can supply browser, worker, or filesystem implementations without changing the agent definition.
Compose fold-agent's platform tools and JSONL backend with the same fold-core API. codingTools({ cwd }) installs the complete tool union; fold-core selects the advertised tools from the active model on every request: Claude gets write/edit, while GPT/Codex gets apply_patch. Switching models reselects the tools automatically.
import{codingTools,jsonlEventLog}from'@humanlayer/fold-agent'import{anthropicModel,defineAgent,startSession}from'@humanlayer/fold-core'import{Config,Effect}from'effect'constprogram=Effect.gen(function*(){constapiKey=yield*Config.redacted('ANTHROPIC_API_KEY')constcwd='.'constagent=defineAgent({name: 'reviewer',model: anthropicModel({model: 'claude-sonnet-4-6', apiKey }),systemPrompt: 'Review the project. Make changes only when explicitly asked.',tools: codingTools({ cwd }),autoCompact: {enabled: true},})constsession=yield*startSession({ agent, cwd,log: jsonlEventLog('.fold/review.jsonl')})returnyield*session.send('Find the highest-risk code in this project.')}).pipe(Effect.scoped)