thinkwell CLI is the primary way to run and build Thinkwell agent scripts.
Usage
Running Scripts (Zero-Config)
The simplest way to run a Thinkwell script is to pass it directly to the CLI:@JSONSchema annotations.
You can pass arguments to your script after the filename:
The run Subcommand
The explicit run subcommand is equivalent to passing a script directly:
Project Setup
thinkwell init
Initialize thinkwell in an existing directory:
- Creates
package.jsonif none exists - Adds
thinkwellandtypescriptdependencies using the detected package manager (pnpm, yarn, or npm)
--yes, -y- Proceed without prompting for confirmation (CI-friendly)
thinkwell new
Create a new project in a new directory:
package.jsonwith thinkwell dependencytsconfig.jsonfor TypeScriptsrc/main.tswith example agent code.gitignore.env.example
Type Checking
thinkwell check
Check a project for type errors:
thinkwell build without writing any output files, which is faster for catching errors during development. In a workspace (pnpm or npm), all TypeScript packages are checked by default.
Exit codes:
0- No type errors1- Type errors found2- Configuration error
Examples
Building Projects
thinkwell build
Compile your TypeScript project using the standard TypeScript compiler with @JSONSchema namespace injection:
tsconfig.json, applying @JSONSchema transformations first. Output (.js, .d.ts, source maps) is written to your configured outDir.
Examples
Configuration via package.json
Control which files receive@JSONSchema transformation:
include (or matched by exclude) are still compiled by TypeScript—they just skip @JSONSchema transformation.
Bundling Executables
thinkwell bundle
Compile your script into a standalone executable that can run without Node.js or Thinkwell installed:
- Node.js 24 runtime with native TypeScript support
- All thinkwell packages
- Your bundled application code
Bundle Options
Target Platforms
Examples
Configuration via package.json
Set bundle defaults in yourpackage.json:
package.json settings.
Binaries are approximately 70-90 MB due to the embedded Node.js runtime. The
--minify flag reduces bundle size, though the Node.js runtime dominates the total size.Environment Variables
The agent environment variables let you swap agents at runtime without modifying code. For example, a script that calls
open('claude') can be run with a different agent:
THINKWELL_AGENT_CMD takes precedence.
