English · 简体中文
Inkwell is a terminal-based AI assistant primarily designed for Kindle but also compatible with other terminal systems.
- Python >= 3.8
- Single-file design, no third-party library dependencies.
- Displays formatted Markdown text in the terminal.
- Summarizes and enables interactive Q&A with Kindle My Clippings (reading highlights and notes).
- Exports conversation history as well-formatted eBooks or sends them via email.
- Supports multiple AI providers: OpenAI, Google, xAI, Anthropic, Mistral, Groq, Perplexity, Alibaba.
- Automatically switch between multiple API keys.
- Automatically switch between multiple API servers.
- Ensure your Kindle is jailbroken and has KUAL and Python3 installed.
- Extract inkwell.zip to the Kindle root directory (
/mnt/us
).
There are two ways to configure Inkwell:
- Open the
config.json
file in the Inkwell directory on your computer, edit the fields, and copy it back to your Kindle. - Select
Inkwell Setup
from the KUAL menu and follow the wizard. Simply press Enter for any unclear steps. You don't need to install Kterm; it's already included in this package.
- provider: AI provider. Supported values:
openai/google/xai/anthropic/mistral/groq/perplexity/alibaba
. - model: The model provided by the chosen AI service.
- api_key: API keys (multiple keys separated by semicolons).
- api_host: Third-party API server addresses (separated by semicolons).
- display_style: Text display mode. Options:
markdown
: Formatted Markdown text.markdown_table
: Formatted Markdown with table support.plaintext
: Plain text.
- chat_type: Chat session mode.
multi_turn
: Standard multi-turn conversation.single_turn
: Simulated multi-turn for APIs that don’t support stateful sessions.
- token_limit: Context token limit (keep reasonable).
- max_history: Maximum number of saved conversation histories (conversation length is unlimited).
- prompt: System prompt for conversations. Options:
default/custom
: Special values.- Others refer to names in
prompts.txt
.
- custom_prompt: Used when
prompt="custom"
. - smtp_sender: Optional, email sender address.
- smtp_host: Optional, SMTP server and port (e.g.,
smtp.gmail.com:587
). - smtp_username: Optional, SMTP username.
- smtp_password: Optional, SMTP password.
- Click the KUAL menu item to enter. There is no need to enable Wi-Fi in advance; the script will automatically turn Wi-Fi on and off when exiting.
- Clicking a menu item labeled with
Clippings
allows you to immediately select book highlights for AI interaction. - Supports sending multiple lines of text. Enter an empty line to trigger sending.
- Enter
?
at any time to open the menu, andq
to exit.
You can send selected reading highlights to the AI for further exploration, gaining deeper insights or understanding.
- Use the
--clippings
startup argument. - Enter
c
in the main interface. - Enter
c
in the menu.
As kterm has limited scrollback and poor long-dialogue handling, Inkwell can export conversations as eBooks for better navigation and readability. Exported eBooks automatically appear in the Kindle library and can be emailed if SMTP settings are configured.
Example commands:
e0: Export current conversation.
e1: Export the first history conversation.
e1-3: Export conversations 1 to 3.
e1,3-5: Export conversations 1, 3, 4, and 5.
0
: Return to the current conversation.1
or higher: Switch to a specific history conversation and continue chatting.c
: Open clippings for AI-assisted Q&A.d
: Delete one or multiple history conversations (e.g.,d0
,d1-3
).e
: Export one or multiple history conversations (e.g.,e0
,e1-3
).m
: Temporarily switch models (add!
to save to configuration).n
: Start a new conversation.p
: Switch prompts (refer to custom prompt section).q
: Exit.?
: Show command help.
Inkwell supports easy switching between prompts:
- Enter a custom prompt during configuration.
- Edit
custom_prompt
in the configuration file and setprompt
tocustom
. - Add prompts to
prompts.txt
in the Inkwell directory. Example format:prompt_name content line1 content line2 ... </> another_prompt_name content line1 ... </>
- Inkwell runs on kterm. Basic kterm operations include two-finger taps for the menu, font scaling, keyboard toggling, and screen rotation.
- For custom keyboard layouts, use the kterm keyboard designer.