This is using ChatGPT to generate for almost all of the repository. Including the README.md, except this line.A lightweight, terminal-based chat interface using Ollama as the AI model backend, sqlite3 for persistent chat storage, and Markdown for readable session logs.
- Chat with local LLMs via Ollama (
http://localhost:11434) - Chats stored in SQLite database and automatically exported to Markdown
- Organized by folder & filename (e.g.
chats/default/chat-1.md) - Supports switching models mid-conversation (
/switch) - Timezone-aware timestamps in messages
- Command-line menu interface
- Python 3.9+
- Ollama installed and running
- A model pulled via Ollama (e.g.
llama3,mistral, etc.)
git clone https://github.com/Corfliss/local-memory-ollama-cli-chat.git
cd local-memory-ollama-cli-chat
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtExample of requirements.txt:
requests
python-dotenvCreate a .env file in the root directory to customize the settings:
OLLAMA_MODEL=llama3
OLLAMA_HOST=http://localhost:11434
DB_PATH=database/app.db
TZ_OFFSET=7OLLAMA_MODEL: Default model name (e.g., mistral, llama3)OLLAMA_HOST: Ollama server URLDB_PATH: Path to SQLite DB fileTZ_OFFSET: Timezone offset from GMT (e.g., 7 for GMT+7)
Use the CLI menu to interact on /scripts:
python run.py1. Start new chat
2. List existing chats
3. Continue a chat
4. Export all chats to markdown
5. Exit/switch <model>— switch model mid-chat. Example:/switch mistralexitorquit— end the chat
ollama-cli-chat/
├── chats/ # Markdown logs organized by folder
│ └── default/
│ └── chat-1.md
├── database/ # SQLite DB location (default path)
│ └── app.db
├── chat.py # Core chat logic
├── db.py # Database logic
├── export.py # Markdown export utility
├── interface.py # CLI menu (formerly run.py)
├── requirements.txt
└── README.mdStarted: 2025.07.14 23:45:02 +0700
How do I write a recursive function in Python?
A recursive function is one that calls itself. Here's an example...
- All messages are stored in the database and reflected in Markdown in real time
- Changing models mid-conversation updates both markdown and database with model info