@serticode/thoth 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +153 -0
  2. package/dist/index.js +3209 -0
  3. package/package.json +51 -0
package/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # Thoth
2
+
3
+ Identity Preserving Publishing Engine — a CLI that builds voice, knowledge, and publication profiles from your writing, then generates articles that sound like you.
4
+
5
+ > Thoth is the technical proving ground for [Cadence](https://cadence.sh).
6
+
7
+ ---
8
+
9
+ ## Quick Start
10
+
11
+ ```bash
12
+ # 1. Initialize
13
+ thoth init
14
+
15
+ # 2. Import your writing
16
+ thoth import voice ~/notes ~/essays
17
+ thoth import knowledge ~/architecture ~/repos
18
+ thoth import publications ~/articles
19
+
20
+ # 3. Generate identity profiles
21
+ thoth generate_profile
22
+ thoth profile_status
23
+
24
+ # 4. Research a topic
25
+ thoth research "offline-first mobile architecture"
26
+
27
+ # 5. Generate an article in your voice
28
+ thoth generate_article --topic "offline-first mobile architecture"
29
+
30
+ # 6. Export
31
+ thoth export_article <id>
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ npm install -g @serticode/thoth
40
+ ```
41
+
42
+ ### Prerequisites
43
+
44
+ - **Node.js 22+**
45
+ - **C++ build tools** — `better-sqlite3` and `sqlite-vec` are native C++ modules:
46
+ - **macOS:** Xcode CLI tools (`xcode-select --install`)
47
+ - **Linux:** `build-essential` (or equivalent)
48
+ - **Windows:** Visual Studio Build Tools with C++ workload
49
+
50
+ If you don't have a C++ compiler, the install will fail with a `node-gyp` error. Install your platform's build tools and try again.
51
+
52
+ ### Optional: Ollama (no API key needed)
53
+
54
+ ```bash
55
+ ollama pull qwen2.5:7b
56
+ ollama pull nomic-embed-text
57
+ ```
58
+
59
+ With Ollama running locally, Thoth works with zero API keys.
60
+
61
+ ---
62
+
63
+ ## Configuration
64
+
65
+ API keys are read from environment variables. Set at least one:
66
+
67
+ ```bash
68
+ export OPENAI_API_KEY=sk-... # best quality, tried first
69
+ export GROQ_API_KEY=gsk_... # fast inference
70
+ export GEMINI_API_KEY=AIza... # free tier available
71
+ export ANTHROPIC_API_KEY=sk-ant-... # Claude models
72
+ ```
73
+
74
+ No keys? Ollama is always available as a local fallback.
75
+
76
+ All models are overridable:
77
+
78
+ ```bash
79
+ export OPENAI_CHAT_MODEL=gpt-4o
80
+ export OLLAMA_CHAT_MODEL=qwen2.5:7b
81
+ export OLLAMA_EMBEDDING_MODEL=nomic-embed-text
82
+ ```
83
+
84
+ See `thoth.json` for project-level overrides and the [full config docs](https://thoth.cadence.sh/docs).
85
+
86
+ ---
87
+
88
+ ## Commands
89
+
90
+ | Command | Description |
91
+ | ------------------------------------------ | ---------------------------------------------------- |
92
+ | `thoth init` | Create database and run migrations |
93
+ | `thoth import voice <path>` | Import voice sources (journals, essays, notes) |
94
+ | `thoth import knowledge <path>` | Import knowledge sources (architecture, repos, docs) |
95
+ | `thoth import publications <path>` | Import publication sources (articles, blog posts) |
96
+ | `thoth generate_profile` | Generate all identity profiles via AI |
97
+ | `thoth profile_status` | Show ready/missing status for each profile |
98
+ | `thoth research "<topic>"` | Research a topic with vector-search + AI synthesis |
99
+ | `thoth generate_article --topic "<topic>"` | Generate an article in your voice |
100
+ | `thoth list_articles` | List all generated articles |
101
+ | `thoth get_article <id>` | Show article content |
102
+ | `thoth create_series <name>` | Create a new article series |
103
+ | `thoth list_series` | List all series |
104
+ | `thoth add_to_series <series> <article>` | Add an article to a series |
105
+ | `thoth get_series <id>` | Show series with all articles |
106
+ | `thoth export_article <id>` | Export article (md, html, txt, rss) |
107
+ | `thoth export_series <id>` | Export entire series |
108
+
109
+ Output goes to `~/Documents/Thoth/singles/` and `~/Documents/Thoth/series/`.
110
+
111
+ ---
112
+
113
+ ## AI Provider Chain
114
+
115
+ Thoth chains through AI providers in quality-priority order. Each provider is gated by its API key — if the key isn't set, it's skipped.
116
+
117
+ | Provider | Chat Model | Embedding Model | Key Required |
118
+ | ------------- | -------------------- | ------------------------ | ------------------- |
119
+ | **OpenAI** | `gpt-4o-mini` | `text-embedding-3-small` | `OPENAI_API_KEY` |
120
+ | **Groq** | `mixtral-8x7b-32768` | — | `GROQ_API_KEY` |
121
+ | **Gemini** | `gemini-1.5-flash` | `text-embedding-004` | `GEMINI_API_KEY` |
122
+ | **Anthropic** | `claude-3-haiku` | — | `ANTHROPIC_API_KEY` |
123
+ | **Ollama** | `qwen2.5:7b` | `nomic-embed-text` | none (local) |
124
+
125
+ Each provider has a 15-second timeout. If one fails, the next is tried automatically.
126
+
127
+ ---
128
+
129
+ ## Architecture
130
+
131
+ ```text
132
+ src/
133
+ ├── domain/ # Pure TypeScript — entities, repository interfaces, Result<T>
134
+ ├── application/ # Use cases — import, generate profiles, research, articles, series
135
+ ├── infrastructure/ # Adapters — SQLite, OpenAI SDK, file system, logging
136
+ └── cli/ # Commander.js — thin delegation to use cases
137
+ ```
138
+
139
+ Clean Architecture with strict layer separation. Domain has zero external dependencies. Infrastructure implements domain interfaces. CLI depends on application use cases.
140
+
141
+ ---
142
+
143
+ ## Privacy
144
+
145
+ All data stays local. Voice profiles, knowledge profiles, embeddings, research notes, and generated articles are stored in `~/.thoth/thoth.db` (SQLite). Nothing is sent to any server except the AI provider you configure. Medium publishing is draft-only and requires explicit user action.
146
+
147
+ ---
148
+
149
+ ## Links
150
+
151
+ - [Full CLI Reference](https://thoth.cadence.sh/docs)
152
+ - [Changelog](CHANGELOG.md)
153
+ - [Release Plan](V1_RELEASE.md)