Skip to main content

💬 zk-chat: AI-Powered Chat for Your Zettelkasten

Transform your Zettelkasten into an intelligent knowledge assistant. zk-chat lets you have natural conversations with your notes using AI—whether you run models locally with Ollama or use OpenAI's cloud API.

PyPI Python Version Documentation License

🎯 Why zk-chat?

  • 🔒 Privacy First: Run everything locally with Ollama—no data leaves your machine
  • 🤖 AI-Powered RAG: Semantic search with vector embeddings finds exactly what you need
  • 📊 Visual Analysis: Analyze diagrams, charts, and images in your notes
  • 🔗 Graph Traversal: Discover connections through wikilinks, backlinks, and forward links
  • 🧠 Smart Memory: AI remembers context across conversations
  • 🔌 Extensible: MCP server support and plugin architecture
  • ⚡ Fast: Efficient local indexing and incremental updates
  • 💻 CLI & GUI: Choose your interface—powerful command-line or experimental GUI

📚 Documentation

Full documentation: https://vetzal.com/zk-chat/

🚀 Quick Start

Installation

# Install with pipx (recommended)
pipx install zk-chat

# Install Ollama and a model
brew install ollama
ollama pull qwen3:8b

# For visual analysis (optional)
ollama pull gemma3:27b

Your First Chat

# Start interactive session
zk-chat interactive --vault /path/to/your/notes

# Ask a question
zk-chat query "What are my main ideas about productivity?"

# Single query with visual model
zk-chat query "Analyze diagram.png" --visual-model gemma3:27b

✨ Key Features

🔍 Intelligent Search & Retrieval

  • Semantic Search: Vector embeddings find conceptually similar content
  • Excerpt Retrieval: Extract relevant passages from your documents
  • Full Document Access: AI can read complete notes when needed
  • Graph Traversal: Explore connections via wikilinks, backlinks, and forward links
  • Link Path Finding: Discover how concepts connect through your knowledge graph

🤖 AI Capabilities

  • RAG (Retrieval Augmented Generation): AI answers using your actual notes
  • Smart Memory: Persistent context across conversations
  • Visual Analysis: Understand diagrams, charts, and images
  • Multi-Model Support: Choose from dozens of Ollama models or use OpenAI
  • Autonomous Agent Mode: AI can plan and execute complex multi-step tasks

🛠️ Content Management

  • Read-Only by Default: Safe exploration of your knowledge base
  • Optional Writing: Enable --unsafe mode for AI-assisted content creation
  • Git Integration: Track all AI changes with automatic commits
  • Wikilink Support: Full understanding of [[wikilink]] syntax
  • Markdown Native: Works seamlessly with Obsidian and other markdown tools

🔌 Extensibility

  • MCP Server Support: Connect external tools via Model Context Protocol
  • Plugin Architecture: Extend with custom Python plugins
  • Available Plugins:

📦 What's New in v3.5.0

🔖 Bookmark Management

# List all vault bookmarks
zk-chat bookmarks list

# Remove a bookmark
zk-chat bookmarks remove /path/to/vault

🔍 Index Diagnostics

# Check index health
zk-chat diagnose index

# Run test query to verify search
zk-chat diagnose index --query "test"

🔌 MCP Server Integration

# Register external tools
zk-chat mcp register figma stdio "figma-mcp"

# List and verify servers
zk-chat mcp list
zk-chat mcp verify

🤖 Updated Model Recommendations (2025)

Choose based on your RAM:

RAM Available Text Model Visual Model
64GB+ gpt-oss:120b, qwen3:32b gemma3:27b
36-48GB gpt-oss:20b, qwen3:14b gemma3:27b
16-32GB qwen3:8b, qwen2.5:7b gemma3:9b
8-16GB qwen3:1.5b, qwen2.5:3b gemma3:2b

See the Model Selection Guide for detailed recommendations by task and hardware.

💡 Usage Examples

Interactive Chat

# Start a conversation
zk-chat interactive

# With specific model
zk-chat interactive --model qwen3:14b

# Allow AI to edit files (with git tracking)
zk-chat interactive --unsafe --git

# With visual analysis
zk-chat interactive --visual-model gemma3:27b

Single Queries

# Direct question
zk-chat query "What are my thoughts on AI?"

# From file or stdin
cat question.txt | zk-chat query

# Complex multi-step query
zk-chat query "Find all notes about productivity and create a summary"

Bookmark Management

# Save current vault
zk-chat interactive --vault ~/notes --save

# List bookmarks
zk-chat bookmarks list

# Remove bookmark
zk-chat bookmarks remove ~/old-notes

Index Management

# Quick incremental update
zk-chat index update

# Full rebuild
zk-chat index update --full

# Check status
zk-chat index status

Visual Analysis

Ask natural questions about images in your vault:

  • "What's in the diagram at architecture.png?"
  • "Describe the chart in sales-data.jpg"
  • "Extract text from screenshot.png"

🎛️ Command-Line Options

Common Options (All Commands)

  • --vault PATH or -v - Path to your Zettelkasten
  • --gateway {ollama,openai} or -g - Choose AI provider
  • --model NAME or -m - Specify chat model
  • --visual-model NAME - Specify visual analysis model
  • --save - Bookmark the current vault
  • --no-index - Skip indexing on startup (faster start)

Agent Mode Options

  • --unsafe - Allow AI to create/edit files ⚠️
  • --git - Enable git integration (recommended with --unsafe)
  • --store-prompt / --no-store-prompt - Control system prompt storage
  • --reset-memory - Clear smart memory

⚠️ Safety: The --unsafe flag allows AI to modify your notes. Always use with --git for tracking changes.

🔧 Requirements

For Local AI (Ollama)

  • Ollama installed and running
  • Sufficient RAM for your chosen model (8GB minimum, 16GB+ recommended)
  • Compatible with macOS (M1/M2/M3 recommended), Linux, and Windows

For Cloud AI (OpenAI)

  • OpenAI API key set in OPENAI_API_KEY environment variable
  • Internet connection
  • API credits

Your Zettelkasten

  • Markdown notes (.md files)
  • Works with Obsidian, Logseq, or any markdown-based system
  • Supports wikilinks ([[Note Name]])

🏗️ Architecture

zk-chat uses a modern RAG architecture:

  1. Indexing: Creates vector embeddings of your notes using ChromaDB
  2. Retrieval: Semantic search finds relevant content for queries
  3. Generation: LLM generates responses using retrieved context
  4. Tools: AI can use 15+ tools to explore and interact with your vault

The AI agent has access to:

  • Document search and retrieval
  • Wikilink graph traversal
  • Visual analysis (with vision models)
  • Smart memory storage
  • Git version control
  • External tools via MCP servers

🔌 Plugin Development

Create custom tools for your specific needs:

from zk_chat.services import ZkChatPlugin, ServiceProvider

class MyPlugin(ZkChatPlugin):
    def __init__(self, service_provider: ServiceProvider):
        super().__init__(service_provider)

    def run(self, input_text: str) -> str:
        # Access zk-chat services
        fs = self.filesystem_gateway
        zk = self.zettelkasten
        llm = self.llm_broker

        # Your plugin logic
        return result

See the Plugin Development Guide for complete documentation.

📊 Performance Tips

For Faster Responses

  • Use smaller models (qwen3:1.5b, qwen2.5:3b)
  • Increase concurrency: export OLLAMA_NUM_PARALLEL=4
  • Skip indexing on startup: --no-index

For Better Quality

  • Use larger models (gpt-oss:20b, qwen3:14b)
  • Increase context window: export OLLAMA_NUM_CTX=16384
  • Enable visual analysis for image-heavy vaults

Resource Management

# Check running models
ollama ps

# Monitor system resources
htop  # or Activity Monitor on Mac

# Remove unused models
ollama list
ollama rm unused-model

🗂️ Storage

zk-chat stores its data in your vault:

  • .zk_chat - Configuration file
  • .zk_chat_db/ - Vector database (ChromaDB)
  • ZkSystemPrompt.md - System prompt (customizable)

Add these to .gitignore:

.zk_chat_db/
.zk_chat

🆘 Troubleshooting

Ollama Connection Issues

# Start Ollama
ollama serve

# Verify model installed
ollama list

Index Problems

# Diagnose index health
zk-chat diagnose index

# Force full rebuild
zk-chat index update --full

Performance Issues

  • Try a smaller model
  • Close other applications
  • Increase system resources
  • Use OpenAI instead of local models

🤝 Contributing

Contributions welcome! Please see CONTRIBUTING.md for guidelines.

📜 License

MIT License - Copyright (c) 2024-2025 Stacey Vetzal

🔗 Links

⭐ Star History

If you find zk-chat useful, please consider starring the repository on GitHub!


Made with ❤️ for the Zettelkasten community

🧹 Linting and Auto-fixing

This project uses Ruff for linting and auto-fixes (including removing unused imports/variables and sorting imports).

Install dev tools

python -m pip install -e ".[dev]"

Check for issues (no changes written)

# Lint with Ruff (fails on errors; uses pyproject.toml configuration)
ruff check zk_chat

Auto-fix common issues (writes changes)

# Apply safe fixes (remove unused imports/variables, sort imports, etc.)
ruff check zk_chat --fix

Optional formatting (if desired):

# Ruff can also format code
ruff format zk_chat

Notes:

  • Line length is enforced at 120 characters via Ruff (pyproject.toml).
  • CI runs Ruff in the validation workflow; Flake8 and Autoflake are no longer used.

Metadata

Release files for zk-chat 3.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zk-chat 3.5.1
File Size Uploaded Provenance
zk_chat-3.5.1.tar.gz 92.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for zk-chat 3.5.1
File Interpreter ABI Platform
zk_chat-3.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 217.7 kB

Release files / zk_chat-3.5.1.tar.gz

Download URL zk_chat-3.5.1.tar.gz
Size 92.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d6974988a450c80cd7b66049344b5f3452da9ded414727bd09d2e357eac81e5f
BLAKE2b-256 checksum
How to use checksums
3310b77f76f783792389a4aa9f4d722fdb790aa7359e4bd48be42cf1e4e8034a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2025.

Transparency log

Release files / zk_chat-3.5.1-py3-none-any.whl

Download URL zk_chat-3.5.1-py3-none-any.whl
Size 125.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfeef025eb919c15a38bd577fcc784d55fad455393be2ac38df004a13643cea0
BLAKE2b-256 checksum
How to use checksums
c8a9db5b85a274f3c62bfe1d1ae195e322ce590fb4f7be56e6559ce80e7cc3c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2025.

Transparency log

Security for zk-chat 3.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for zk_chat-3.5.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page