Skip to content

A command-line tool to save local Ollama AI conversations directly to your Obsidian vault. Built for MacOS.

License

Notifications You must be signed in to change notification settings

k-hurl-e/ai2obsidian

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI2Obsidian

A command-line tool to save local Ollama AI conversations directly to your Obsidian vault. Built for MacOS.

Prerequisites

Installation

  1. Create the necessary directory:
sudo mkdir -p /usr/local/lib/ai2obsidian
  1. Copy the Python script:
sudo cp ollama_to_obsidian.py /usr/local/lib/ai2obsidian/
sudo chmod +x /usr/local/lib/ai2obsidian/ollama_to_obsidian.py
  1. Install the command-line tool:
sudo cp ai2ob /usr/local/bin/
sudo chmod +x /usr/local/bin/ai2ob
  1. Configure obsidian-cli by setting your default vault:
obsidian-cli set-default "your-vault-name"

Usage

Basic usage:

ai2ob "Your prompt here"

With custom filename:

ai2ob "Your prompt here" my_custom_filename

With different Ollama model:

ai2ob -m mistral "Your prompt here"

Combined options:

ai2ob -m mistral "Your prompt here" my_custom_filename

Options

  • -m <model>: Specify which Ollama model to use (default: llama3.1:8b)
  • -h: Show help message

File Structure

The conversations will be saved in your Obsidian vault with the following structure:

Your-Vault/
└── AI_Conversations/
    └── your_conversation.md

Each file includes:

  • YAML frontmatter with:
    • Creation date
    • Year
    • Type: ai_conversation
  • The original prompt
  • The AI's response in markdown format

Features

  • Automatically opens the new note in Obsidian after creation
  • Includes the original prompt in the saved note
  • Organizes conversations by date and time if no filename is specified
  • Supports all Ollama models

Troubleshooting

If the command is not found:

which ai2ob

Should return /usr/local/bin/ai2ob. If not, ensure /usr/local/bin is in your PATH.

If you get permission errors when saving files:

sudo chown -R $(whoami) /usr/local/lib/ai2obsidian

License

MIT License

About

A command-line tool to save local Ollama AI conversations directly to your Obsidian vault. Built for MacOS.

Topics

Resources

License

Stars

Watchers

Forks