A functional, Effect-TS-based AI coding assistant CLI with multi-provider support.
Note: This project is heavily inspired by OpenCode, an open-source AI coding agent built for the terminal. Cliq explores similar concepts using Effect-TS for functional programming patterns.
- Interactive Mode by Default: Just run
bun startto enter chat - Slash Commands: Use
/model,/help,/exitinside chat session - Multi-Provider Support: Anthropic, OpenAI, Google (configured via environment variables)
- Effect-TS Architecture: Fully functional with proper Effect patterns
- File Tools: Read, write, edit files with diff preview
- Search Tools: Glob patterns and ripgrep integration
- Session Management: Persistent session and message storage under
~/.cliq/storage - Vercel AI SDK Integration: Uses Vercel's
aipackage with custom Effect-based tool adapters
The full build series, Effect deep dives, tool mechanics, and reference docs are published at:
https://kpritam.github.io/cliq/
Key entry points:
- Build Series Overview:
/docs/build-series/overview - Mechanics Overview:
/docs/mechanics/overview - Effect Deep Dive:
/docs/effect/overview - Reference Index:
/docs/reference/overview
# macOS & Linux
curl -fsSL https://bun.sh/install | bashRestart your terminal so the bun binary is on your PATH.
# Install dependencies
bun install
# Start interactive chat
bun start
# Build
bun run buildCliq targets Bun 1.1+. Porting to Node.js means swapping the Bun platform layer for the Node platform, but the Effect architecture and tooling patterns stay the same.
bun start
The CLI starts directly in interactive chat mode. Type your messages and press Enter.
/model- Change AI model during session/help- Show available commands/exit- Exit the chat
Set environment variables in .env:
# Choose your provider
ANTHROPIC_API_KEY=sk-...
OPENAI_API_KEY=sk-...
GOOGLE_API_KEY=...
# Optional: Override defaults
AI_PROVIDER=anthropic
AI_MODEL=claude-haiku-4-5
AI_TEMPERATURE=0.2
AI_MAX_STEPS=10MainLayer
├── BunContext (FileSystem, Path, Command, Terminal)
├── PlatformStack (Paths)
├── StorageLayer (FileKeyValueStore)
├── ConfigStack (ConfigService)
├── SessionStack (SessionStore)
├── ToolsStack (FileTools, SearchTools, EditTools)
├── VercelStack (VercelAI)
└── RegistryStack (ToolRegistry)
- All side effects wrapped in Effect
- No
anyor type assertions - Pure functions with explicit error handling
- Context.Tag for service definitions
- Layer-based dependency injection
src/
├── cli.ts # Entry point that composes all layers
├── adapters/ # Tool adapters for the Vercel AI SDK
├── chat/ # Chat loop, readline wiring, terminal UI
├── persistence/ # File-based storage and session persistence
├── services/ # Config, tool registry, provider integrations
│ └── config/ # Environment + persistence helpers
├── tools/ # File, search, edit, and directory tools
│ └── search/ # Ripgrep parser utilities
├── types/ # Shared branded types and schemas
└── utils/ # Diff rendering and markdown parsing helpers
Effect-TS best practices:
- Use
Effect.genfor sequential operations - Use
pipefor transformations - Avoid promises/callbacks (use Effect primitives)
- All IO operations return Effects
- Service dependencies via Context.Tag