Module Structure
Thinkwell exports everything from a single package:
See Agent for the list of supported agent names.
Architecture
Thinkwell follows a layered architecture:-
Agent - Establishes a connection to an AI agent via ACP. Create one with
open(). -
Sessions - Agents support two interaction modes:
- Ephemeral: Use
agent.think()for single-turn interactions - Persistent: Use
agent.createSession()for multi-turn conversations
- Ephemeral: Use
-
Plan - A fluent API for constructing prompts. Chain methods to build content, then call
.run()to execute.
Structured Output with @JSONSchema
Thinkwell uses the@JSONSchema JSDoc tag to define expected AI output structures. The CLI generates JSON Schemas from your TypeScript interfaces at build time:
description fields in the generated schema, helping the AI understand what each field should contain.
