@sivori/quixotic 0.1.0 → 0.1.1
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.
- package/README.md +99 -0
- package/art/screenshot.png +0 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# quixotic
|
|
2
|
+
|
|
3
|
+
> Two desktop advisors — **Don Quixote** and **Sancho Panza** — in dialogue at your terminal.
|
|
4
|
+
|
|
5
|
+
Ask a question and receive counsel from both the dreaming knight and his earthy squire. Don Quixote answers first, in soaring idealism; Sancho follows with folk wisdom, a proverb, and a gentle dose of reality. Optionally let them go back and forth, debating your question across multiple rounds.
|
|
6
|
+
|
|
7
|
+
It's a small, single-file CLI built on the [Anthropic Claude API](https://docs.anthropic.com/en/api). The two personalities are nothing more than two system prompts — the "dialogue" emerges by feeding each character what the other just said.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
? Should I quit my job to start a company?
|
|
11
|
+
|
|
12
|
+
Don Quixote
|
|
13
|
+
Ah, traveler! You speak of the noblest of quests — to leave the safe walls of
|
|
14
|
+
the castle and ride out upon the open road in pursuit of a dream...
|
|
15
|
+
|
|
16
|
+
Sancho Panza
|
|
17
|
+
Now, master means well, but as my grandmother used to say, "a bird in the hand
|
|
18
|
+
is worth two in the bush." Before you go tilting at this windmill, ask yourself
|
|
19
|
+
how many months of bread sit in your larder...
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Requirements
|
|
23
|
+
|
|
24
|
+
- **Node.js 18+** (uses native ES modules and `node:readline/promises`)
|
|
25
|
+
- An **Anthropic API key** — get one at [console.anthropic.com](https://console.anthropic.com/)
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
Run it directly without installing:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx @sivori/quixotic "What should I have for dinner?"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or install globally to get the `quixotic` command:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install -g @sivori/quixotic
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Setup
|
|
42
|
+
|
|
43
|
+
Export your API key into the environment (the CLI exits early if it isn't set):
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
**One-shot** — pass your question as arguments and get a single exchange:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
quixotic "Should I take the job in another city?"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Interactive** — run with no question to enter a REPL that remembers the conversation:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
quixotic
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
In interactive mode, the advisors recall your recent exchanges (the last 10), so you can ask follow-ups. Press **Ctrl+D** to depart, or **Ctrl+C** to quit.
|
|
64
|
+
|
|
65
|
+
**Multi-round debate** — let Quixote and Sancho respond to each other:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
quixotic --rounds 3 "Is it foolish to chase a creative passion?"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
After Quixote and Sancho each give their opening counsel, Quixote answers Sancho's objections, Sancho replies again, and so on for the number of rounds you choose.
|
|
72
|
+
|
|
73
|
+
## Configuration
|
|
74
|
+
|
|
75
|
+
| Variable | Default | Description |
|
|
76
|
+
| ------------------- | -------------------- | -------------------------------------------- |
|
|
77
|
+
| `ANTHROPIC_API_KEY` | _(required)_ | Your Anthropic API key. |
|
|
78
|
+
| `MODEL` | `claude-sonnet-4-6` | Which Claude model to use for both advisors. |
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
MODEL=claude-opus-4-8 quixotic "How do I know if I'm on the right path?"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## How it works
|
|
85
|
+
|
|
86
|
+
The entire app lives in [`index.js`](./index.js):
|
|
87
|
+
|
|
88
|
+
- **Two system prompts** (`QUIXOTE_SYSTEM`, `SANCHO_SYSTEM`) define each character's voice and constraints. These are the "soul" of each advisor.
|
|
89
|
+
- **`streamCharacter()`** makes one streaming Messages API call per character and prints the reply live, color-coded (cyan for Quixote, yellow for Sancho).
|
|
90
|
+
- **`ask()`** orchestrates an exchange: Quixote speaks, then Sancho is given the transcript of Quixote's reply so he can respond to it. With `--rounds > 1`, they continue trading responses.
|
|
91
|
+
- **`formatHistory()`** rebuilds conversation memory by concatenating prior exchanges into the prompt — the API itself is stateless, so context is re-sent each turn.
|
|
92
|
+
|
|
93
|
+
### The banner
|
|
94
|
+
|
|
95
|
+
The startup banner in [`art/banner.txt`](./art/banner.txt) is a braille-character rendering of a public-domain [Gustave Doré](https://en.wikipedia.org/wiki/Gustave_Dor%C3%A9) etching of Don Quixote and Sancho Panza (1863). It was generated once at build time with [`ascii-image-converter`](https://github.com/TheZoraiz/ascii-image-converter) (`-W 60 -b -n`) and ships as a static asset, so no image tooling is required to run the CLI.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT © Christopher Sivori
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sivori/quixotic",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Two desktop advisors — Don Quixote and Sancho Panza — in dialogue at your terminal.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"quixotic": "
|
|
7
|
+
"quixotic": "index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"start": "node index.js"
|