obsidian-digest
Superpower your notes with Gemini 2
🧠 obsidian-digest is a tool to superpower your Obsidian notes with LLM-based suggestions and considerations on style and contents!
✅ Pre-requisites
- (mandatory) an Obsidian account and the Desktop application installed
- (mandatory)
gittoolset - (mandatory) A Gemini API key
- (optional) [
python] 3.10 or following versions - (optional)
condapackage manager - (optional)
dockeranddocker compose - (optional) Discord and a Discord account
🤝 Common Steps for Installation
Clone this GitHub repository and access it:
git clone https://github.com/AstraBert/obsidian-digest.git
cd obsidian-digest
Move .env.example to .env and fill in the variables there contained according to what reported in your preferred installation procedure:
mv .env.example .env
📦 1. Python Package
Pre-requistes:
python3.10 or following versions
If you wish to install obsidian-digest as a Python package, you can do so just by running:
python3 -m pip install obsidian_digest
When the installation is complete, you can use the CLI tool following these instructions:
usage: obsidian_digest [-h] -d DIRECTORY [-a] -k APIKEY [-s]
options:
-h, --help show this help message and exit
-d DIRECTORY, --directory DIRECTORY
Directory containing Obsidian notes for which to produce the digest
-a, --allfiles Produce the digest for all the files in the directory, and not only for those modified in the last hour
-k APIKEY, --apikey APIKEY
Provide your Google Gemini API key either as a path to your .env file containing the
GOOGLE_API_KEY variable, the name of the environmental variable under which the key is stored
or the key itself (the first two methods are suggested)
-s, --save Save the digest as a Markdown File in your Obsidia vault
Example usages could be:
# Get the digest for all files, save the digests and pass the API key as a .env file
obsidian_digest -k ./envs/.env -d obsidian/notes/ -a -s
# Get the digest only for the files you modified in the last hour, pass the API key as an environmental variable, do not save the digests
obsidia_digest -k GEMINI_API -d obsidian/notes/
We advise to use the .env file template from this repository, filling in only the variable GOOGLE_API_KEY with your API key.
🤖 2. Discord Bot - Native Code
Pre-requistes:
python3.10 or following versions orcondapackage manager
From the repository that you cloned, you can create a python virtual environment and install all the dependencies in requirements.txt:
python3 -m venv virtualenv
source virtualenv/bin/activate
python3 -m pip install -r requirements.txt
Alternatively, if you have conda, you can create a conda environment named obsidian-digest from the conda_environment.yaml configuration file in this repository:
conda env create -f conda_environment.yaml
conda activate obsidian-digest
Now you should modify your .env file filling all the variables. If you don't know how to create a Discord bot and get its token and the channel ID, here is a quick breakdown:
- Go to Discord and create an account (or log into yours, if you already have one)
- Create a new server by clicking on "Add a server" (a big green "+" button) and name it as you want
- Go to Discord developers portal and click on "New application"
- Name your application, than save the changes and click on "Bot", on the left
- There you will get the chance to name your bot and copy its token: paste it under the
discord_botfield in your.envfile. - After that, go on OAuth2 > URL generator and generate a URL that you will paste in your navigation bar, to add the bot to your newly created server.
- In the
channel_idfield in your.envfile, insert the last number that is displayed in your server's #general channel url when you open it on the web.
Once you are done with all the set-up, simply run (from inside the virtual environment or from inside the conda environment):
python3 scripts/native/bot.py
The bot will send a digest for all the files you modified in the hour before its activation, and it will keep sending hourly digest on the channel it was linked to.
🐋 3. Discord Bot - Docker Compose
Using docker compose can make deployment easier, because it does not need any environment-setting steps, apart from setting the variables in the .env file as in option 2.
You can now run:
docker compose up
And an image with all the required dependencies and scripts will be built on the fly and used as a base for a container, in which our Discord bot will run. On the user side, the bot works in the same way as the one built from native code.
⚙️ How does it work?
The overall workflow is pretty simple:
- obsidian-digest finds the notes you worked on in the last hour under your vault path that you specified either as an option to the CLI tool or from the
NOTES_PATHin the .env file - These files are uploaded to Gemini API, along with a prompt that asks Gemini to create a JSON answer, that contains style suggestions, content suggestions and overall considerations
- Gemini's response is parsed and reconstructed into a message for each file
- The final digest is then streamlined to the terminal (if you used the CLI tool) or to Discord (if you used one of the two Discord bot solutions)
🎁 Contributing
Contributions are always welcome!
Find contribution guidelines at CONTRIBUTING.md
💜 License and Funding
This project is open-source and is provided under an MIT License.
If you found it useful, please consider funding it.
Metadata
Release files for obsidian-digest 0.0.0.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| obsidian_digest-0.0.0.post1.tar.gz | 10.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| obsidian_digest-0.0.0.post1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.9 kB
Release files / obsidian_digest-0.0.0.post1.tar.gz
| Download URL | obsidian_digest-0.0.0.post1.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0ffb22714e3646926632f9e9aa626d3cbe5bc1f0ad6a91e4bbe22df5ddce4c84
|
|
BLAKE2b-256 checksum How to use checksums |
009a7a5b34124d2b36b2b03b91b705c6f185bbb15235fb5c16254331126edc0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.11
|
Release files / obsidian_digest-0.0.0.post1-py3-none-any.whl
| Download URL | obsidian_digest-0.0.0.post1-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc679b110a2d5c481bbd9f604d25f3c2b163035f83e16df1ec574accef4425a8
|
|
BLAKE2b-256 checksum How to use checksums |
6238275ada8942b66fd9bfa2b877e05be5a0a122e40d6a622e123c12f6dd0995
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.11
|