CLI Reference v1.0.0

Identity Preserving Publishing Engine generate articles and series in your authentic voice using AI.

$ npx @serticode/thoth <command> [options]

Installation

Prerequisites: Node.js 22+ and a C++ compiler (required by better-sqlite3 and sqlite-vec native modules). On macOS, Xcode Command Line Tools (xcode-select --install) is sufficient.

npm install -g @serticode/thoth

Or run without installing:

npx @serticode/thoth init

AI Provider Setup (optional)

Set at least one API key environment variable to use cloud AI. Add these to your shell profile (~/.zshrc or ~/.bashrc) so they persist across sessions. If no keys are set, Thoth falls back to local Ollama.

export OPENAI_API_KEY=sk-...     // OpenAI 
export ANTHROPIC_API_KEY=sk-...  // Anthropic Claude
export GEMINI_API_KEY=...        // Gemini (free tier available)
export GROQ_API_KEY=...          // Groq (fast inference)

To run entirely offline with no API keys, install Ollama and pass --local:

thoth --local init

Global Options

Global options apply to every command. --local and --provider can also be set in thoth.json or environment variables.

Option Env Var Example Description
--local THOTH_LOCAL=true thoth --local init Use only local AI (Ollama). No data sent to external providers
--provider <name> THOTH_PROVIDER thoth --provider anthropic research "Flutter" AI provider: openai, groq, gemini, anthropic, ollama
-V, --version thoth --version Print version (1.0.0)
--help thoth --help
thoth import_voice --help
Show help. Use thoth <command> --help for any command

Configuration

Thoth reads config from two locations (merged in order, later wins):

  1. Project config ./thoth.json (current working directory)
  2. User config ~/.thoth/thoth.json (home directory)

Schema

{
  "provider": "openai",        // Default AI provider
  "chatModel": "gpt-4o-mini",  // Override chat model
  "embeddingModel": "text-embedding-3-small", // Override embedding model
  "local": false,              // Force local only mode
  "dbPath": "/path/to/custom.db", // Custom database location
  "logLevel": "error",         // Logging level (error, warn, info, debug)
  "export": {
    "format": "md",            // Default export format
    "outputDir": "./out"       // Default export directory
  }
}

Environment Variables

Variable Overrides Default
THOTH_LOCAL=true local config field false
THOTH_PROVIDER provider config field auto detect
THOTH_DB_PATH dbPath config field ~/.thoth/thoth.db
THOTH_CHAT_MODEL chatModel config field provider dependent
THOTH_EMBEDDING_MODEL embeddingModel config field provider dependent
LOG_LEVEL logLevel config field info

Config Merge Priority

CLI flag > Environment variable > Config file > Default

AI Providers

Thoth supports five AI providers. Each has its own API key env var and default model. Providers are tried in priority order; if one fails, the next is attempted (3 retries with exponential backoff per provider).

Provider Chain

Providers are tried in quality priority order. Each gets 3 retries with exponential backoff before falling through to the next. Ollama is always last as the local fallback.

OpenAI → Groq → Gemini → Anthropic → Ollama
	  (tried in order; Ollama is the always-available last resort)

Provider Reference

Provider Env Var Default Chat Model Default Embedding Model Embeddings Kind
OpenAI OPENAI_API_KEY gpt-4o-mini text-embedding-3-small Yes openai compatible
Groq GROQ_API_KEY mixtral-8x7b-32768 No openai compatible
Gemini GEMINI_API_KEY gemini-1.5-flash text-embedding-004 Yes openai compatible
Anthropic ANTHROPIC_API_KEY claude-sonnet-4-20250514 No anthropic
Ollama (none, localhost) qwen2.5:7b nomic-embed-text Yes openai compatible

Custom Models

Override any provider's default model:

THOTH_CHAT_MODEL=gpt-4o thoth generate_article --topic "My Topic"
THOTH_EMBEDDING_MODEL=text-embedding-ada-002 thoth import_knowledge ./docs

Ollama Configuration

OLLAMA_BASE_URL=http://localhost:11434/v1  // default
OLLAMA_CHAT_MODEL=qwen2.5:7b
OLLAMA_EMBEDDING_MODEL=nomic-embed-text

Privacy

Pass --local (or set THOTH_LOCAL=true or "local": true in config) to restrict Thoth to Ollama only. No source content leaves your machine.

Commands

# thoth init

Initialize Thoth create the SQLite database and run migrations.

thoth init [options]

Creates the database file at ~/.thoth/thoth.db (or THOTH_DB_PATH) and ensures all tables exist. Safe to run multiple times existing data is preserved.

output
$
thoth init
Thoth initialized.
Database: ~/.thoth/thoth.db
Sources: 0 voice, 0 knowledge, 0 publication
 
Privacy notice:
Thoth sends source content to external AI providers
for profile generation and embedding.
Run with --local to use only local AI (Ollama).
 
Next steps: thoth import_voice <path> ...
Errors

If the database directory cannot be created or migrations fail, Thoth exits with code 1.

# thoth import_voice

Import voice sources journals, essays, blog posts, personal writing.

thoth import_voice <path>
Arg Required Description
path Yes File or directory path to import

Reads text files from the given path, chunks them, imports each chunk as a "voice" source, stores a content checksum to prevent duplicates, then generates vector embeddings for semantic search.

output
Importing voice sources from: ./my-journal/
Imported 24 chunks.
Generating embeddings...
Embedding: [████████████████████] 100% | 24/24
Embeddings complete.
 
Import complete. Run `thoth generate_profile`
Errors

Path does not exist: ENOENT: no such file or directory

Embedding failure: nonfatal, logs warning, retry by rerunning

Duplicate content: silently skipped (checksum match)

# thoth import_knowledge

Import knowledge sources technical notes, documentation, repositories.

thoth import_knowledge <path>
Arg Required Description
path Yes File or directory path to import

Same behavior as import_voice but sources are tagged as type knowledge. Used for research retrieval and profile generation.

# thoth import_publications

Import publication sources existing articles, series, published work.

thoth import_publications <path>
Arg Required Description
path Yes File or directory path to import

Same behavior as import_voice but sources are tagged as type publication. Used for publication profile (themes, series structure).

# thoth generate_profile

Generate identity profiles from imported sources.

thoth generate_profile [options]

Analyzes all imported sources across the three categories and generates AI derived profiles:

  • Voice profile tone, pacing, storytelling patterns, vocabulary, sentence structure, transitions, humor, reader engagement
  • Knowledge profile domains of expertise, topics, summary
  • Publication profile themes, series structure, publication summary
output
Generating identity profiles...
Generating voice profile...
Voice profile: vp_abc123def
Summary: Analytical yet approachable...
Generating knowledge profile...
Knowledge profile: kp_def456ghi
Domains: machine learning, distributed systems
Publication profile: pp_789ghi012
Identity profiles generated successfully.
Errors

No sources imported: exits with code 1

Profile generation failure for a type: logs error, continues with remaining types

# thoth profile_status

Show profile generation status and source counts.

thoth profile_status [options]
output
Thoth Status
 
Sources:
Voice: 24 chunks
Knowledge: 15 chunks
Publications: 8 chunks
 
Profiles:
Voice: [ready] Analytical yet approachable...
Knowledge: [ready] machine learning, distributed systems...
Publication: [missing] Not generated

# thoth research

Research a topic using imported knowledge sources.

thoth research <topic>
Arg Required Description
topic Yes Topic to research

Performs semantic search over imported knowledge sources, retrieving the most relevant chunks by embedding similarity, and generates a structured research note with inline citations.

output
Researching: "Vector search performance optimization"
 
Distributed vector search systems face three primary
bottlenecks: index build latency, query throughput under
recall constraints, and memory bandwidth...
 
Sources cited: 4
Research ID: rn_abc123

# thoth generate_article

Generate an article in your authentic voice.

thoth generate_article --topic <topic> [--research <id>]
thoth generate_article --research <id>
Option Required? Description
-t, --topic <topic> Yes (if no --research) Topic to write about
-r, --research <id> Yes (if no --topic) Research note ID to use as source

Generates an article by combining your voice profile with optional research context.

output
Generating article...
Topic: Vector Search Performance Optimization
 
Title: Optimizing Vector Search at Scale
Words: 1850
ID: art_def456
Errors

No topic or research ID: exits with code 1

Research ID not found: Research note not found

# thoth list_articles

List all generated articles.

thoth list_articles [options]
output
Articles:
art_def45 Optimizing Vector Search at Scale (1850 words)
art_78901 Building a Personal Knowledge Base (2200 words)
Empty state

No articles generated yet. Run thoth generate_article --topic "..."

# thoth get_article

Show an article by ID.

thoth get_article <id>
Arg Required Description
id Yes Article ID
output
Title: Optimizing Vector Search at Scale
Words: 1850
Status: draft
Created: 4/15/2026, 2:30:00 PM
Errors

Article not found: Article not found: art_badid

# thoth create_series

Create a new series to group articles.

thoth create_series <name> [--description <text>]
Arg/Option Required Description
name Yes Series name
-d, --description <text> No Series description
output
Series created: Performance Engineering
ID: ser_abc123

# thoth list_series

List all series.

thoth list_series [options]
output
Series:
ser_abc12 Performance Engineering (3 articles)
ser_def45 Distributed Systems (1 article)
Empty state

No series created yet. Run thoth create_series <name>

# thoth add_to_series

Add an article to a series.

thoth add_to_series <series-id> <article-id>
Arg Required Description
series-id Yes Series ID
article-id Yes Article ID
output
Article art_def45 added to series ser_abc12
Errors

Series not found: Series not found

Article not found: Article not found

Article already in series: silently ignored (idempotent)

# thoth get_series

Show series details, including all articles.

thoth get_series <id>
Arg Required Description
id Yes Series ID
output
Series: Performance Engineering
Description: Practical guides to perf analysis
Created: 4/15/2026, 3:00:00 PM
Articles: 2
Errors

Series not found: Series not found: ser_badid

# thoth export_article

Export an article to a file.

thoth export_article <id> [--format <format>] [--output <dir>] [--stdout]
Arg/Option Required Description Default
id Yes Article ID
-f, --format <format> No Output format: md, html, txt md
-o, --output <path> No Output directory ~/Documents/Thoth/singles
--stdout No Print to stdout instead of writing a file false
output
[ok] Article exported.
Title optimizing-vector-search-at-scale
Format html
Path /Users/you/Documents/Thoth/singles/optimizing-vector-search-at-scale.html
Errors

Article not found: Article not found: art_badid

Invalid format: Invalid format. Choose one of: md, html, txt

# thoth export_series

Export a full series to a file.

thoth export_series <id> [--format <format>] [--output <dir>]
Arg/Option Required Description Default
id Yes Series ID
-f, --format <format> No Output format: md, html, rss md
-o, --output <path> No Output directory ~/Documents/Thoth/series
output
[ok] Series exported.
Title performance-engineering
Format html
Path /Users/you/Documents/Thoth/series/performance-engineering.html
Errors

Series not found: Series not found: ser_badid

Invalid format: Invalid format. Choose one of: md, html, rss

End to End Workflow

 1. Initialize           thoth init
 2. Import voice         thoth import_voice ./journals/
 3. Import knowledge     thoth import_knowledge ./notes/
 4. Import publications  thoth import_publications ./articles/
 5. Generate profiles    thoth generate_profile
 6. Check status         thoth profile_status
 7. Research a topic     thoth research "Distributed Systems Design"
 8. Write article        thoth generate_article --topic "..." --research rn_abc123
 9. Create series        thoth create_series "Distributed Systems"
10. Add to series        thoth add_to_series ser_abc123 art_def456
11. Export article       thoth export_article art_def456 --format html
12. Export series        thoth export_series ser_abc123 --format rss

Minimal Workflow (local only, no API keys)

thoth init
thoth import_voice ./my-writing/
thoth generate_profile
thoth generate_article --topic "My First Post"
thoth export_article art_xxx --format html --output ./out

Domain Entity Reference

SourceReference

interface SourceReference {
  id: string;         // unique ID
  type: "voice" | "knowledge" | "publication";
  sourcePath: string; // original file path
  content: string;    // chunked text content
  checksum: string;   // content hash (dedup)
  chunkIndex: number; // position within source file
  createdAt: Date;
}

VoiceProfile

interface VoiceProfile {
  id: string;
  name: string | null;
  traits: {
    tone: string[];
    pacing: string[];
    storytelling: string[];
    vocabulary: string[];
    sentenceStructure: string[];
    transitions: string[];
    humor: string[];
    readerEngagement: string[];
  };
  summary: string | null;
  createdAt: Date;
}

KnowledgeProfile

interface KnowledgeProfile {
  id: string;
  domains: string[];
  topics: string[];
  summary: string | null;
  createdAt: Date;
}

PublicationProfile

interface PublicationProfile {
  id: string;
  themes: string[];
  series: { name: string; articles: ArticleReference[] }[] | null;
  summary: string | null;
  createdAt: Date;
}

ResearchNote

interface ResearchNote {
  id: string;
  topic: string;
  content: string;
  citations: {
    sourceId: string;
    sourcePath: string;
    excerpt: string;
    relevanceScore: number;
  }[];
  createdAt: Date;
}

Article

interface Article {
  id: string;
  title: string;
  content: string;       // markdown body
  voiceProfileId: string; // which voice was used
  researchId: string | null;
  wordCount: number;
  status: "draft" | "published" | "archived";
  createdAt: Date;
  updatedAt: Date;
}

Series

interface Series {
  id: string;
  name: string;
  description: string | null;
  articleIds: string[];   // ordered list of article IDs
  createdAt: Date;
  updatedAt: Date;
}

System Details

  • Database SQLite via better-sqlite3, with sqlite-vec for vector similarity search
  • AI SDK OpenAI SDK (openai compatible providers), Anthropic SDK (Claude)
  • Config validation Zod schema
  • Markdown to HTML marked library
  • Logging Pino structured logger
  • CLI framework Commander.js
  • Token management tiktoken for embedding token counting
  • Export Markdown frontmatter, styled HTML, plain text, RSS 2.0