A lightweight, terminal-first AI assistant client written in Go.
Scratchpad CLI provides a clean command-line interface for interacting with a locally hosted AI backend. It abstracts backend lifecycle management, session persistence, document ingestion, and streaming AI interactions behind a simple developer-friendly interface.
The project is designed around a thin-client architecture where the CLI is responsible for user interaction and backend orchestration, while all AI-specific functionality remains encapsulated within the Python backend.
+-----------------------+
| Scratchpad CLI |
| Go + Cobra |
+-----------+-----------+
|
HTTP REST Interface
|
+-----------v-----------+
| Python Backend |
| AI Agent Platform |
+-----------+-----------+
|
+-----------------------------+-----------------------------+
| | |
Conversation Memory Knowledge Base AI Agents
(Threads) (RAG) & Tool Calling
The CLI intentionally contains no AI logic.
Its responsibilities are limited to:
The backend is responsible for:
This separation allows both components to evolve independently while keeping the CLI lightweight.
cmd/
└── scratchpad/
└── Application entry point
internals/
├── apiRequests/
│ HTTP client layer
│
├── backend/
│ Backend lifecycle management
│
├── cli/
│ Cobra commands and interactive shell
│
└── envSetup/
Environment bootstrap
├── Python verification
├── Backend download
├── Virtual environment creation
└── Dependency installation
README.md
LICENSE
go.mod
git clone https://github.com/tuhindutta/scratchpad-cli.git
cd scratchpad-cli
go build -o scratchpad
or
go install
Start the backend.
scratchpad start
On first execution Scratchpad automatically performs the following:
Verify Python installation
│
▼
Download backend repository
│
▼
Create Python virtual environment
│
▼
Install backend dependencies
│
▼
Launch backend server
│
▼
Ready for requests
No manual backend installation is required.
Launch the built-in shell.
scratchpad shell
Example session
scratchpad>
start
chat Explain Retrieval Augmented Generation.
thread list
knowledge
exit
| Command | Description |
|---|---|
start |
Download (first run) and start backend |
stop |
Shutdown backend |
chat |
Send prompt to assistant |
knowledge |
Import PDF/TXT documents |
thread list |
List conversation threads |
thread delete |
Delete a conversation thread |
thread clear |
Delete all conversations |
credentials get |
Show current credentials |
credentials set |
Set user/thread IDs |
shell |
Launch interactive shell |
version |
Show application version |
Scratchpad stores the following metadata locally:
This enables persistent conversations across CLI sessions.
If credentials are unavailable, Scratchpad automatically creates a temporary session.
Assistant responses are streamed incrementally as execution progresses.
Example
===== ASSISTANT =====
[Planner]
Node: Planner
Type: assistant
Content:
Planning task...
[Retriever]
Node: Retriever
Type: tool
Tool Name: search_documents
Content:
Searching knowledge base...
[Assistant]
Node: Assistant
Type: assistant
Content:
Final response...
Streaming provides visibility into intermediate execution instead of waiting for the entire workflow to complete.
Scratchpad supports importing external documents into the backend knowledge base.
Supported formats
Once ingested, documents become available to the backend retrieval pipeline for future conversations.
Scratchpad was built around a few core principles.
Go was chosen for the CLI because it provides:
Python powers the backend because of its rich AI ecosystem.
It provides seamless integration with:
Keeping AI functionality inside the backend allows the CLI to remain lightweight and language-agnostic.
Communication between the CLI and backend uses HTTP.
Advantages include:
Planned improvements include
This project is licensed under the MIT License.
See the LICENSE file for details.
Tuhin Kumar Dutta
Portfolio Website: https://www.tuhindutta.com/