@pencil-agent/nano-pencil 1.11.1 → 1.11.2
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 +274 -274
- package/dist/builtin-extensions.d.ts +1 -0
- package/dist/builtin-extensions.js +12 -0
- package/dist/core/config/resource-loader.js +20 -8
- package/dist/core/mcp/mcp-config.js +13 -1
- package/dist/core/persona/persona-manager.d.ts +20 -0
- package/dist/core/persona/persona-manager.js +109 -0
- package/dist/core/runtime/agent-session.d.ts +9 -0
- package/dist/core/runtime/agent-session.js +31 -1
- package/dist/core/runtime/sdk.js +41 -8
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/soul-integration.js +17 -2
- package/dist/extensions/defaults/interview/index.d.ts +15 -0
- package/dist/extensions/defaults/interview/index.js +414 -0
- package/dist/extensions/defaults/soul/index.js +21 -7
- package/dist/modes/interactive/interactive-mode.d.ts +6 -0
- package/dist/modes/interactive/interactive-mode.js +129 -6
- package/docs/{APIKEY_FIX_SUMMARY.md → API/345/257/206/351/222/245/344/277/256/345/244/215/346/200/273/347/273/223.md} +1 -1
- package/docs/{API_KEY_GUIDANCE.md → API/345/257/206/351/222/245/346/214/207/345/215/227.md} +2 -2
- package/docs/Insight /346/264/236/345/257/237/346/212/245/345/221/212.md" +352 -0
- package/docs/{MCP_QUICK_REFERENCE.md → MCP/345/277/253/351/200/237/345/217/202/350/200/203.md} +2 -2
- package/docs/Persona/345/210/207/346/215/242.md +97 -0
- package/docs/Simplify/346/211/251/345/261/225.md +278 -0
- package/docs/{BUILTIN_MCP_TOOLS.md → /345/206/205/347/275/256MCP/345/267/245/345/205/267.md} +1 -1
- package/docs/{MONOREPO_MIGRATION.md → /345/215/225/344/275/223/344/273/223/345/272/223/350/277/201/347/247/273/346/214/207/345/215/227.md} +1 -1
- package/docs/{RELEASE_GUIDE.md → /345/217/221/345/270/203/346/214/207/345/215/227.md} +1 -1
- package/docs/{CHANGES_SUMMARY.md → /345/217/230/346/233/264/346/200/273/347/273/223.md} +7 -7
- package/docs//346/226/207/346/241/243/344/270/255/345/277/203.md +130 -0
- package/docs/{ARCHITECTURE_OPTIMIZATION.md → /346/236/266/346/236/204/344/274/230/345/214/226.md} +2 -2
- package/docs/{ARCHITECTURE_EVOLUTION.md → /346/236/266/346/236/204/346/274/224/350/277/233.md} +1 -1
- package/docs/{STRUCTURE.md → /347/273/223/346/236/204.md} +3 -3
- package/docs/{plan.md → /350/256/241/345/210/222.md} +1 -1
- package/docs/{MIGRATION_SUMMARY.md → /350/277/201/347/247/273/346/200/273/347/273/223.md} +2 -2
- package/docs/{REFACTORING_TASKS.md → /351/207/215/346/236/204/344/273/273/345/212/241.md} +1 -1
- package/docs/{REFACTORING_PLAN.md → /351/207/215/346/236/204/350/256/241/345/210/222.md} +1 -1
- package/package.json +2 -2
- package/docs/README.md +0 -130
- package/docs/long_text_2F8185A2-88D9-4971-A476-A64C9E0A2282.txt +0 -399
- /package/docs/{APIKEY_COMMAND.md → API/345/257/206/351/222/245/345/221/275/344/273/244.md"} +0 -0
- /package/docs/{ARK_CODING_PLAN.md → ARK/347/274/226/347/240/201/350/256/241/345/210/222.md"} +0 -0
- /package/docs/{MCP_GUIDE.md → MCP/351/233/206/346/210/220/346/214/207/345/215/227.md"} +0 -0
- /package/docs/{QIANFAN_CODING_PLAN.md → /345/215/203/345/270/206/347/274/226/347/240/201/350/256/241/345/210/222.md"} +0 -0
- /package/docs/{README.monorepo.md → /345/215/225/344/275/223/344/273/223/345/272/223/350/207/252/350/277/260.md"} +0 -0
- /package/docs/{CHANGELOG.md → /345/217/230/346/233/264/346/227/245/345/277/227.md"} +0 -0
- /package/docs/{TOOLS_MANAGER_OPTIMIZATION.md → /345/267/245/345/205/267/347/256/241/347/220/206/345/231/250/344/274/230/345/214/226.md"} +0 -0
- /package/docs/{LOOP_COMMAND_PLAN.md → /345/276/252/347/216/257/345/221/275/344/273/244/350/256/241/345/210/222.md"} +0 -0
- /package/docs/{v2.md → /347/211/210/346/234/2542.md"} +0 -0
- /package/docs/{NANOMEM_READ_WRITE.md → /347/272/263/350/257/272/350/256/260/345/277/206/350/257/273/345/206/231.md"} +0 -0
- /package/docs/{MEMORY_SYSTEM.md → /350/256/260/345/277/206/347/263/273/347/273/237.md"} +0 -0
package/README.md
CHANGED
|
@@ -1,274 +1,274 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
<pre>
|
|
4
|
-
.-~~~~~~~~~-._ _.-~~~~~~~~~-.
|
|
5
|
-
__.' ~. .~ `.__
|
|
6
|
-
.'// \./ \\`.
|
|
7
|
-
.'// | \\`.
|
|
8
|
-
.'// .-~""""""""""""""-._ | _,-""""""""""""""~-. \\`.
|
|
9
|
-
.'//.-" `-. | .-' "-.\\`.
|
|
10
|
-
.'//______.============-.. \ | / ..-============.______\\`.
|
|
11
|
-
.'______________________________\|/______________________________`.
|
|
12
|
-
</pre>
|
|
13
|
-
|
|
14
|
-
<h1>✎ NanoPencil</h1>
|
|
15
|
-
|
|
16
|
-
<p><strong>The AI Coding Agent That Remembers & Evolves</strong></p>
|
|
17
|
-
|
|
18
|
-
<p>
|
|
19
|
-
<a href="https://www.npmjs.com/package/@pencil-agent/nano-pencil">
|
|
20
|
-
<img src="https://img.shields.io/npm/v/@pencil-agent/nano-pencil.svg?style=flat-square&color=cb3837" alt="npm version">
|
|
21
|
-
</a>
|
|
22
|
-
<a href="https://nodejs.org">
|
|
23
|
-
<img src="https://img.shields.io/node/v/@pencil-agent/nano-pencil.svg?style=flat-square&color=339933" alt="Node.js">
|
|
24
|
-
</a>
|
|
25
|
-
<a href="https://www.npmjs.com/package/@pencil-agent/nano-pencil">
|
|
26
|
-
<img src="https://img.shields.io/npm/dm/@pencil-agent/nano-pencil.svg?style=flat-square&color=cb3837" alt="Downloads">
|
|
27
|
-
</a>
|
|
28
|
-
<img src="https://img.shields.io/badge/TypeScript-5.0+-blue?style=flat-square&color=3178C6" alt="TypeScript">
|
|
29
|
-
<img src="https://img.shields.io/badge/License-MIT-green?style=flat-square&color=brightgreen" alt="License">
|
|
30
|
-
</p>
|
|
31
|
-
|
|
32
|
-
<p>
|
|
33
|
-
<a href="#-why-nanopencil">Why NanoPencil?</a> •
|
|
34
|
-
<a href="#-features">Features</a> •
|
|
35
|
-
<a href="#-quick-start">Quick Start</a> •
|
|
36
|
-
<a href="#-documentation">Docs</a>
|
|
37
|
-
</p>
|
|
38
|
-
|
|
39
|
-
<p>
|
|
40
|
-
<a href="./README.md"><img src="https://img.shields.io/badge/English-Active-blue?style=flat-square" alt="English"></a>
|
|
41
|
-
<a href="./README_CN.md"><img src="https://img.shields.io/badge/中文-切换-orange?style=flat-square" alt="中文"></a>
|
|
42
|
-
</p>
|
|
43
|
-
|
|
44
|
-
</div>
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## 🌟 Why NanoPencil?
|
|
49
|
-
|
|
50
|
-
> **"The only AI coding assistant that truly learns from you"**
|
|
51
|
-
|
|
52
|
-
NanoPencil isn't just another AI coding tool. It's a **terminal-native AI agent** with **persistent memory** and **evolving personality** — designed for developers who live in the terminal.
|
|
53
|
-
|
|
54
|
-
### What Makes It Different?
|
|
55
|
-
|
|
56
|
-
| | Other Tools | NanoPencil |
|
|
57
|
-
|---|---|---|
|
|
58
|
-
| **Memory** | ❌ Starts fresh every session | ✅ Remembers your projects, preferences, and coding style |
|
|
59
|
-
| **Personality** | ❌ Generic responses | ✅ Evolves a unique personality based on your interactions |
|
|
60
|
-
| **Terminal Native** | ❌ GUI wrappers or plugins | ✅ Pure TUI built for terminal workflows |
|
|
61
|
-
| **Model Freedom** | ❌ Vendor lock-in | ✅ 10+ providers, switch instantly |
|
|
62
|
-
| **Offline Ready** | ❌ Cloud dependent | ✅ Local models via Ollama |
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## ✨ Features
|
|
67
|
-
|
|
68
|
-
### 🧠 Persistent Memory (NanoMem)
|
|
69
|
-
Your projects have context. So should your AI.
|
|
70
|
-
|
|
71
|
-
- **Project Knowledge** — API endpoints, database schemas, architecture decisions
|
|
72
|
-
- **Error Patterns** — Remembers bugs and their solutions
|
|
73
|
-
- **User Preferences** — Coding style, naming conventions, framework choices
|
|
74
|
-
- **Smart Retrieval** — Automatically recalls relevant context when needed
|
|
75
|
-
|
|
76
|
-
### 💫 AI Personality Evolution (NanoSoul)
|
|
77
|
-
Your AI assistant develops its own character.
|
|
78
|
-
|
|
79
|
-
- **Big Five Traits** — Openness, Conscientiousness, Extraversion, Agreeableness, Neuroticism
|
|
80
|
-
- **Coding Style** — Verbosity, abstraction level, safety margins
|
|
81
|
-
- **Domain Expertise** — Frontend, Backend, DevOps, AI/ML specializations
|
|
82
|
-
- **Emotional States** — Confidence, curiosity, flow state
|
|
83
|
-
|
|
84
|
-
> *After 50 sessions, your NanoPencil will code differently than anyone else's.*
|
|
85
|
-
|
|
86
|
-
### 🎨 Beautiful TUI
|
|
87
|
-
A terminal interface that feels alive.
|
|
88
|
-
|
|
89
|
-
- **Three Themes** — Dark, Light, and Warm (eye-friendly)
|
|
90
|
-
- **Smooth Animations** — Breathing pencil loader
|
|
91
|
-
- **Intuitive Navigation** — Vim-like keybindings, fuzzy search
|
|
92
|
-
- **Real-time Streaming** — Watch the AI think in real-time
|
|
93
|
-
|
|
94
|
-
### 🔌 MCP Protocol Support
|
|
95
|
-
Extend with the Model Context Protocol.
|
|
96
|
-
|
|
97
|
-
Built-in tools include:
|
|
98
|
-
- 📁 Filesystem operations
|
|
99
|
-
- 🌐 HTTP requests (Fetch)
|
|
100
|
-
- 🎭 Browser automation (Puppeteer)
|
|
101
|
-
- 🗄️ Database queries (SQLite)
|
|
102
|
-
- 🔧 Git operations
|
|
103
|
-
|
|
104
|
-
### 🌐 Multi-Model Support
|
|
105
|
-
Use the best model for each task.
|
|
106
|
-
|
|
107
|
-
- 🇨🇳 **Alibaba DashScope** — Qwen series (optimized for coding)
|
|
108
|
-
- 🤖 **OpenAI** — GPT-4, GPT-3.5
|
|
109
|
-
- 💬 **Anthropic** — Claude 3 Opus/Sonnet/Haiku
|
|
110
|
-
- 🔍 **Google** — Gemini Pro/Ultra
|
|
111
|
-
- 🏠 **Local** — Ollama (Qwen, Llama, Mistral, etc.)
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
## 🚀 Quick Start
|
|
116
|
-
|
|
117
|
-
### Installation
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
# npm
|
|
121
|
-
npm install -g @pencil-agent/nano-pencil
|
|
122
|
-
|
|
123
|
-
# pnpm (recommended)
|
|
124
|
-
pnpm add -g @pencil-agent/nano-pencil
|
|
125
|
-
|
|
126
|
-
# yarn
|
|
127
|
-
yarn global add @pencil-agent/nano-pencil
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### First Run
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
nanopencil
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
1. **Select your model** — Choose from available providers
|
|
137
|
-
2. **Enter API key** — Securely stored in `~/.nanopencil/agent/auth.json`
|
|
138
|
-
3. **Start coding** — Just type what you want to build
|
|
139
|
-
|
|
140
|
-
### Example Session
|
|
141
|
-
|
|
142
|
-
```
|
|
143
|
-
You: Create a JWT authentication middleware for Express
|
|
144
|
-
|
|
145
|
-
AI: [Analyzing project structure...]
|
|
146
|
-
[Creating auth.middleware.ts...]
|
|
147
|
-
[Adding TypeScript types...]
|
|
148
|
-
[Writing tests...]
|
|
149
|
-
|
|
150
|
-
✅ Done! Created:
|
|
151
|
-
- src/middleware/auth.middleware.ts
|
|
152
|
-
- src/types/auth.d.ts
|
|
153
|
-
- tests/auth.middleware.test.ts
|
|
154
|
-
|
|
155
|
-
Features:
|
|
156
|
-
• JWT verification with RS256
|
|
157
|
-
• Refresh token rotation
|
|
158
|
-
• Role-based access control
|
|
159
|
-
• Rate limiting integration
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
## 🎮 Usage
|
|
165
|
-
|
|
166
|
-
### Interactive Mode
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
nanopencil # Start new session
|
|
170
|
-
nanopencil -c # Continue last session
|
|
171
|
-
nanopencil -r # Resume from history
|
|
172
|
-
nanopencil -m qwen-max # Use specific model
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
### Print Mode (Scripts)
|
|
176
|
-
|
|
177
|
-
```bash
|
|
178
|
-
# Single query
|
|
179
|
-
nanopencil -p "Refactor this to use async/await"
|
|
180
|
-
|
|
181
|
-
# Pipe input
|
|
182
|
-
cat bug-report.md | nanopencil -p "Analyze this bug"
|
|
183
|
-
|
|
184
|
-
# Chain commands
|
|
185
|
-
nanopencil -p "Generate API" | nanopencil -p "Write tests for it"
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### Slash Commands
|
|
189
|
-
|
|
190
|
-
| Command | Description |
|
|
191
|
-
|---------|-------------|
|
|
192
|
-
| `/model` | Switch AI model |
|
|
193
|
-
| `/thinking` | Adjust reasoning depth |
|
|
194
|
-
| `/fork` | Branch conversation |
|
|
195
|
-
| `/tree` | Browse session history |
|
|
196
|
-
| `/memory` | View project memories |
|
|
197
|
-
| `/soul` | Check AI personality |
|
|
198
|
-
| `/settings` | Configure preferences |
|
|
199
|
-
| `/export` | Save as HTML |
|
|
200
|
-
|
|
201
|
-
---
|
|
202
|
-
|
|
203
|
-
## 📊 Comparison
|
|
204
|
-
|
|
205
|
-
| Feature | NanoPencil | Cursor | Claude Code | Aider |
|
|
206
|
-
|---------|:----------:|:------:|:-----------:|:-----:|
|
|
207
|
-
| Terminal Native | ✅ | ❌ | ✅ | ✅ |
|
|
208
|
-
| Persistent Memory | ✅ | ❌ | ❌ | ❌ |
|
|
209
|
-
| AI Personality | ✅ | ❌ | ❌ | ❌ |
|
|
210
|
-
| Session Branching | ✅ | ✅ | ✅ | ❌ |
|
|
211
|
-
| Multi-Model | ✅ | ✅ | ❌ | ✅ |
|
|
212
|
-
| MCP Support | ✅ | ❌ | ✅ | ❌ |
|
|
213
|
-
| Offline Mode | ✅ | ❌ | ❌ | ✅ |
|
|
214
|
-
| Chinese Optimized | ✅ | ❌ | ❌ | ❌ |
|
|
215
|
-
|
|
216
|
-
---
|
|
217
|
-
|
|
218
|
-
## 🏗️ Architecture Philosophy
|
|
219
|
-
|
|
220
|
-
NanoPencil is built on three pillars:
|
|
221
|
-
|
|
222
|
-
```
|
|
223
|
-
┌─────────────────────────────────────────┐
|
|
224
|
-
│ 🧠 COGNITIVE LAYER │
|
|
225
|
-
│ (Memory + Personality + Context) │
|
|
226
|
-
├─────────────────────────────────────────┤
|
|
227
|
-
│ 🔧 TOOL LAYER │
|
|
228
|
-
│ (File Ops + Bash + Search + MCP) │
|
|
229
|
-
├─────────────────────────────────────────┤
|
|
230
|
-
│ 🎨 INTERFACE LAYER │
|
|
231
|
-
│ (TUI + Themes + Keybindings) │
|
|
232
|
-
└─────────────────────────────────────────┘
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
**Design Principles:**
|
|
236
|
-
- **Terminal First** — No Electron, no browser, pure terminal
|
|
237
|
-
- **Privacy First** — Local storage, no telemetry, your data stays yours
|
|
238
|
-
- **Extensible** — Plugin system for tools, themes, and behaviors
|
|
239
|
-
- **Fast** — Sub-second startup, instant response
|
|
240
|
-
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
## 📚 Documentation
|
|
244
|
-
|
|
245
|
-
- [Installation Guide](docs/INSTALL.md)
|
|
246
|
-
- [Configuration](docs/CONFIG.md)
|
|
247
|
-
- [Memory System](docs
|
|
248
|
-
- [MCP Guide](docs/
|
|
249
|
-
- [Keybindings](docs/KEYBINDINGS.md)
|
|
250
|
-
- [Extensions](docs/EXTENSIONS.md)
|
|
251
|
-
|
|
252
|
-
---
|
|
253
|
-
|
|
254
|
-
## 🌍 Community
|
|
255
|
-
|
|
256
|
-
- 💬 [Discussions](https://github.com/pencil-agent/nano-pencil/discussions)
|
|
257
|
-
- 🐛 [Issues](https://github.com/pencil-agent/nano-pencil/issues)
|
|
258
|
-
- 📝 [Changelog](CHANGELOG.md)
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
|
-
## 📄 License
|
|
263
|
-
|
|
264
|
-
MIT © [Pencil Agent](https://github.com/pencil-agent)
|
|
265
|
-
|
|
266
|
-
---
|
|
267
|
-
|
|
268
|
-
<div align="center">
|
|
269
|
-
|
|
270
|
-
**[⬆ Back to Top](#-nanopencil)**
|
|
271
|
-
|
|
272
|
-
<sub>Built with ❤️ for terminal dwellers everywhere</sub>
|
|
273
|
-
|
|
274
|
-
</div>
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<pre>
|
|
4
|
+
.-~~~~~~~~~-._ _.-~~~~~~~~~-.
|
|
5
|
+
__.' ~. .~ `.__
|
|
6
|
+
.'// \./ \\`.
|
|
7
|
+
.'// | \\`.
|
|
8
|
+
.'// .-~""""""""""""""-._ | _,-""""""""""""""~-. \\`.
|
|
9
|
+
.'//.-" `-. | .-' "-.\\`.
|
|
10
|
+
.'//______.============-.. \ | / ..-============.______\\`.
|
|
11
|
+
.'______________________________\|/______________________________`.
|
|
12
|
+
</pre>
|
|
13
|
+
|
|
14
|
+
<h1>✎ NanoPencil</h1>
|
|
15
|
+
|
|
16
|
+
<p><strong>The AI Coding Agent That Remembers & Evolves</strong></p>
|
|
17
|
+
|
|
18
|
+
<p>
|
|
19
|
+
<a href="https://www.npmjs.com/package/@pencil-agent/nano-pencil">
|
|
20
|
+
<img src="https://img.shields.io/npm/v/@pencil-agent/nano-pencil.svg?style=flat-square&color=cb3837" alt="npm version">
|
|
21
|
+
</a>
|
|
22
|
+
<a href="https://nodejs.org">
|
|
23
|
+
<img src="https://img.shields.io/node/v/@pencil-agent/nano-pencil.svg?style=flat-square&color=339933" alt="Node.js">
|
|
24
|
+
</a>
|
|
25
|
+
<a href="https://www.npmjs.com/package/@pencil-agent/nano-pencil">
|
|
26
|
+
<img src="https://img.shields.io/npm/dm/@pencil-agent/nano-pencil.svg?style=flat-square&color=cb3837" alt="Downloads">
|
|
27
|
+
</a>
|
|
28
|
+
<img src="https://img.shields.io/badge/TypeScript-5.0+-blue?style=flat-square&color=3178C6" alt="TypeScript">
|
|
29
|
+
<img src="https://img.shields.io/badge/License-MIT-green?style=flat-square&color=brightgreen" alt="License">
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
<p>
|
|
33
|
+
<a href="#-why-nanopencil">Why NanoPencil?</a> •
|
|
34
|
+
<a href="#-features">Features</a> •
|
|
35
|
+
<a href="#-quick-start">Quick Start</a> •
|
|
36
|
+
<a href="#-documentation">Docs</a>
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
<p>
|
|
40
|
+
<a href="./README.md"><img src="https://img.shields.io/badge/English-Active-blue?style=flat-square" alt="English"></a>
|
|
41
|
+
<a href="./README_CN.md"><img src="https://img.shields.io/badge/中文-切换-orange?style=flat-square" alt="中文"></a>
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 🌟 Why NanoPencil?
|
|
49
|
+
|
|
50
|
+
> **"The only AI coding assistant that truly learns from you"**
|
|
51
|
+
|
|
52
|
+
NanoPencil isn't just another AI coding tool. It's a **terminal-native AI agent** with **persistent memory** and **evolving personality** — designed for developers who live in the terminal.
|
|
53
|
+
|
|
54
|
+
### What Makes It Different?
|
|
55
|
+
|
|
56
|
+
| | Other Tools | NanoPencil |
|
|
57
|
+
|---|---|---|
|
|
58
|
+
| **Memory** | ❌ Starts fresh every session | ✅ Remembers your projects, preferences, and coding style |
|
|
59
|
+
| **Personality** | ❌ Generic responses | ✅ Evolves a unique personality based on your interactions |
|
|
60
|
+
| **Terminal Native** | ❌ GUI wrappers or plugins | ✅ Pure TUI built for terminal workflows |
|
|
61
|
+
| **Model Freedom** | ❌ Vendor lock-in | ✅ 10+ providers, switch instantly |
|
|
62
|
+
| **Offline Ready** | ❌ Cloud dependent | ✅ Local models via Ollama |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## ✨ Features
|
|
67
|
+
|
|
68
|
+
### 🧠 Persistent Memory (NanoMem)
|
|
69
|
+
Your projects have context. So should your AI.
|
|
70
|
+
|
|
71
|
+
- **Project Knowledge** — API endpoints, database schemas, architecture decisions
|
|
72
|
+
- **Error Patterns** — Remembers bugs and their solutions
|
|
73
|
+
- **User Preferences** — Coding style, naming conventions, framework choices
|
|
74
|
+
- **Smart Retrieval** — Automatically recalls relevant context when needed
|
|
75
|
+
|
|
76
|
+
### 💫 AI Personality Evolution (NanoSoul)
|
|
77
|
+
Your AI assistant develops its own character.
|
|
78
|
+
|
|
79
|
+
- **Big Five Traits** — Openness, Conscientiousness, Extraversion, Agreeableness, Neuroticism
|
|
80
|
+
- **Coding Style** — Verbosity, abstraction level, safety margins
|
|
81
|
+
- **Domain Expertise** — Frontend, Backend, DevOps, AI/ML specializations
|
|
82
|
+
- **Emotional States** — Confidence, curiosity, flow state
|
|
83
|
+
|
|
84
|
+
> *After 50 sessions, your NanoPencil will code differently than anyone else's.*
|
|
85
|
+
|
|
86
|
+
### 🎨 Beautiful TUI
|
|
87
|
+
A terminal interface that feels alive.
|
|
88
|
+
|
|
89
|
+
- **Three Themes** — Dark, Light, and Warm (eye-friendly)
|
|
90
|
+
- **Smooth Animations** — Breathing pencil loader
|
|
91
|
+
- **Intuitive Navigation** — Vim-like keybindings, fuzzy search
|
|
92
|
+
- **Real-time Streaming** — Watch the AI think in real-time
|
|
93
|
+
|
|
94
|
+
### 🔌 MCP Protocol Support
|
|
95
|
+
Extend with the Model Context Protocol.
|
|
96
|
+
|
|
97
|
+
Built-in tools include:
|
|
98
|
+
- 📁 Filesystem operations
|
|
99
|
+
- 🌐 HTTP requests (Fetch)
|
|
100
|
+
- 🎭 Browser automation (Puppeteer)
|
|
101
|
+
- 🗄️ Database queries (SQLite)
|
|
102
|
+
- 🔧 Git operations
|
|
103
|
+
|
|
104
|
+
### 🌐 Multi-Model Support
|
|
105
|
+
Use the best model for each task.
|
|
106
|
+
|
|
107
|
+
- 🇨🇳 **Alibaba DashScope** — Qwen series (optimized for coding)
|
|
108
|
+
- 🤖 **OpenAI** — GPT-4, GPT-3.5
|
|
109
|
+
- 💬 **Anthropic** — Claude 3 Opus/Sonnet/Haiku
|
|
110
|
+
- 🔍 **Google** — Gemini Pro/Ultra
|
|
111
|
+
- 🏠 **Local** — Ollama (Qwen, Llama, Mistral, etc.)
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## 🚀 Quick Start
|
|
116
|
+
|
|
117
|
+
### Installation
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# npm
|
|
121
|
+
npm install -g @pencil-agent/nano-pencil
|
|
122
|
+
|
|
123
|
+
# pnpm (recommended)
|
|
124
|
+
pnpm add -g @pencil-agent/nano-pencil
|
|
125
|
+
|
|
126
|
+
# yarn
|
|
127
|
+
yarn global add @pencil-agent/nano-pencil
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### First Run
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
nanopencil
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
1. **Select your model** — Choose from available providers
|
|
137
|
+
2. **Enter API key** — Securely stored in `~/.nanopencil/agent/auth.json`
|
|
138
|
+
3. **Start coding** — Just type what you want to build
|
|
139
|
+
|
|
140
|
+
### Example Session
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
You: Create a JWT authentication middleware for Express
|
|
144
|
+
|
|
145
|
+
AI: [Analyzing project structure...]
|
|
146
|
+
[Creating auth.middleware.ts...]
|
|
147
|
+
[Adding TypeScript types...]
|
|
148
|
+
[Writing tests...]
|
|
149
|
+
|
|
150
|
+
✅ Done! Created:
|
|
151
|
+
- src/middleware/auth.middleware.ts
|
|
152
|
+
- src/types/auth.d.ts
|
|
153
|
+
- tests/auth.middleware.test.ts
|
|
154
|
+
|
|
155
|
+
Features:
|
|
156
|
+
• JWT verification with RS256
|
|
157
|
+
• Refresh token rotation
|
|
158
|
+
• Role-based access control
|
|
159
|
+
• Rate limiting integration
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 🎮 Usage
|
|
165
|
+
|
|
166
|
+
### Interactive Mode
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
nanopencil # Start new session
|
|
170
|
+
nanopencil -c # Continue last session
|
|
171
|
+
nanopencil -r # Resume from history
|
|
172
|
+
nanopencil -m qwen-max # Use specific model
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Print Mode (Scripts)
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Single query
|
|
179
|
+
nanopencil -p "Refactor this to use async/await"
|
|
180
|
+
|
|
181
|
+
# Pipe input
|
|
182
|
+
cat bug-report.md | nanopencil -p "Analyze this bug"
|
|
183
|
+
|
|
184
|
+
# Chain commands
|
|
185
|
+
nanopencil -p "Generate API" | nanopencil -p "Write tests for it"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Slash Commands
|
|
189
|
+
|
|
190
|
+
| Command | Description |
|
|
191
|
+
|---------|-------------|
|
|
192
|
+
| `/model` | Switch AI model |
|
|
193
|
+
| `/thinking` | Adjust reasoning depth |
|
|
194
|
+
| `/fork` | Branch conversation |
|
|
195
|
+
| `/tree` | Browse session history |
|
|
196
|
+
| `/memory` | View project memories |
|
|
197
|
+
| `/soul` | Check AI personality |
|
|
198
|
+
| `/settings` | Configure preferences |
|
|
199
|
+
| `/export` | Save as HTML |
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## 📊 Comparison
|
|
204
|
+
|
|
205
|
+
| Feature | NanoPencil | Cursor | Claude Code | Aider |
|
|
206
|
+
|---------|:----------:|:------:|:-----------:|:-----:|
|
|
207
|
+
| Terminal Native | ✅ | ❌ | ✅ | ✅ |
|
|
208
|
+
| Persistent Memory | ✅ | ❌ | ❌ | ❌ |
|
|
209
|
+
| AI Personality | ✅ | ❌ | ❌ | ❌ |
|
|
210
|
+
| Session Branching | ✅ | ✅ | ✅ | ❌ |
|
|
211
|
+
| Multi-Model | ✅ | ✅ | ❌ | ✅ |
|
|
212
|
+
| MCP Support | ✅ | ❌ | ✅ | ❌ |
|
|
213
|
+
| Offline Mode | ✅ | ❌ | ❌ | ✅ |
|
|
214
|
+
| Chinese Optimized | ✅ | ❌ | ❌ | ❌ |
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## 🏗️ Architecture Philosophy
|
|
219
|
+
|
|
220
|
+
NanoPencil is built on three pillars:
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
┌─────────────────────────────────────────┐
|
|
224
|
+
│ 🧠 COGNITIVE LAYER │
|
|
225
|
+
│ (Memory + Personality + Context) │
|
|
226
|
+
├─────────────────────────────────────────┤
|
|
227
|
+
│ 🔧 TOOL LAYER │
|
|
228
|
+
│ (File Ops + Bash + Search + MCP) │
|
|
229
|
+
├─────────────────────────────────────────┤
|
|
230
|
+
│ 🎨 INTERFACE LAYER │
|
|
231
|
+
│ (TUI + Themes + Keybindings) │
|
|
232
|
+
└─────────────────────────────────────────┘
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**Design Principles:**
|
|
236
|
+
- **Terminal First** — No Electron, no browser, pure terminal
|
|
237
|
+
- **Privacy First** — Local storage, no telemetry, your data stays yours
|
|
238
|
+
- **Extensible** — Plugin system for tools, themes, and behaviors
|
|
239
|
+
- **Fast** — Sub-second startup, instant response
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## 📚 Documentation
|
|
244
|
+
|
|
245
|
+
- [Installation Guide](docs/INSTALL.md)
|
|
246
|
+
- [Configuration](docs/CONFIG.md)
|
|
247
|
+
- [Memory System](docs/记忆系统.md)
|
|
248
|
+
- [MCP Guide](docs/MCP集成指南.md)
|
|
249
|
+
- [Keybindings](docs/KEYBINDINGS.md)
|
|
250
|
+
- [Extensions](docs/EXTENSIONS.md)
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## 🌍 Community
|
|
255
|
+
|
|
256
|
+
- 💬 [Discussions](https://github.com/pencil-agent/nano-pencil/discussions)
|
|
257
|
+
- 🐛 [Issues](https://github.com/pencil-agent/nano-pencil/issues)
|
|
258
|
+
- 📝 [Changelog](CHANGELOG.md)
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## 📄 License
|
|
263
|
+
|
|
264
|
+
MIT © [Pencil Agent](https://github.com/pencil-agent)
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
<div align="center">
|
|
269
|
+
|
|
270
|
+
**[⬆ Back to Top](#-nanopencil)**
|
|
271
|
+
|
|
272
|
+
<sub>Built with ❤️ for terminal dwellers everywhere</sub>
|
|
273
|
+
|
|
274
|
+
</div>
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* 管理 NanoPencil 默认加载的内置扩展路径:
|
|
5
5
|
* - NanoMem: 持久化记忆扩展(packages/mem-core/)
|
|
6
6
|
* - Soul: AI 人格进化扩展(extensions/defaults/soul/)
|
|
7
|
+
* - Interview: 模糊需求澄清扩展(extensions/defaults/interview/)
|
|
7
8
|
* - MCP: MCP 工具扩展(extensions/defaults/mcp/)
|
|
8
9
|
* - LinkWorld: 互联网访问扩展(extensions/defaults/link-world/)
|
|
9
10
|
* - SecurityAudit: 安全审计扩展(extensions/defaults/security-audit/)
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* 管理 NanoPencil 默认加载的内置扩展路径:
|
|
5
5
|
* - NanoMem: 持久化记忆扩展(packages/mem-core/)
|
|
6
6
|
* - Soul: AI 人格进化扩展(extensions/defaults/soul/)
|
|
7
|
+
* - Interview: 模糊需求澄清扩展(extensions/defaults/interview/)
|
|
7
8
|
* - MCP: MCP 工具扩展(extensions/defaults/mcp/)
|
|
8
9
|
* - LinkWorld: 互联网访问扩展(extensions/defaults/link-world/)
|
|
9
10
|
* - SecurityAudit: 安全审计扩展(extensions/defaults/security-audit/)
|
|
@@ -24,6 +25,7 @@ const BUNDLED_SIMPLIFY_EXTENSION = join(__dirname, "extensions", "optional", "si
|
|
|
24
25
|
const BUNDLED_LINK_WORLD_EXTENSION = join(__dirname, "extensions", "defaults", "link-world", "index.js");
|
|
25
26
|
const BUNDLED_SECURITY_AUDIT_EXTENSION = join(__dirname, "extensions", "defaults", "security-audit", "index.js");
|
|
26
27
|
const BUNDLED_SOUL_EXTENSION = join(__dirname, "extensions", "defaults", "soul", "index.js");
|
|
28
|
+
const BUNDLED_INTERVIEW_EXTENSION = join(__dirname, "extensions", "defaults", "interview", "index.js");
|
|
27
29
|
const BUNDLED_MCP_EXTENSION = join(__dirname, "extensions", "defaults", "mcp", "index.js");
|
|
28
30
|
const BUNDLED_EXPORT_HTML_EXTENSION = join(__dirname, "extensions", "optional", "export-html", "index.js");
|
|
29
31
|
/** 从当前模块位置向上查找包根(含 package.json 且 name 为 nano-pencil 相关) */
|
|
@@ -124,6 +126,16 @@ export function getBuiltinExtensionPaths() {
|
|
|
124
126
|
if (existsSync(soulTs))
|
|
125
127
|
paths.push(soulTs);
|
|
126
128
|
}
|
|
129
|
+
// === Interview 扩展(需求澄清)===
|
|
130
|
+
// Placed after Soul to ensure Interview probe sees both Mem + Soul style/systemPrompt injections.
|
|
131
|
+
if (existsSync(BUNDLED_INTERVIEW_EXTENSION)) {
|
|
132
|
+
paths.push(BUNDLED_INTERVIEW_EXTENSION);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
const interviewTs = join(__dirname, "extensions", "defaults", "interview", "index.ts");
|
|
136
|
+
if (existsSync(interviewTs))
|
|
137
|
+
paths.push(interviewTs);
|
|
138
|
+
}
|
|
127
139
|
// === MCP 扩展(MCP 工具协议适配) ===
|
|
128
140
|
if (existsSync(BUNDLED_MCP_EXTENSION)) {
|
|
129
141
|
paths.push(BUNDLED_MCP_EXTENSION);
|
|
@@ -3,6 +3,7 @@ import { homedir } from "node:os";
|
|
|
3
3
|
import { join, resolve, sep } from "node:path";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import { CONFIG_DIR_NAME, getAgentDir } from "../../config.js";
|
|
6
|
+
import { getActivePersonaId, getPersonaPencilPath, getPersonaSkillsDir, } from "../persona/persona-manager.js";
|
|
6
7
|
import { loadThemeFromPath } from "../../modes/interactive/theme/theme.js";
|
|
7
8
|
import { createEventBus } from "../runtime/event-bus.js";
|
|
8
9
|
import { createExtensionRuntime, loadExtensionFromFactory, loadExtensions } from "../extensions/loader.js";
|
|
@@ -53,16 +54,23 @@ function loadProjectContextFiles(options = {}) {
|
|
|
53
54
|
contextFiles.push(globalContext);
|
|
54
55
|
seenPaths.add(globalContext.path);
|
|
55
56
|
}
|
|
56
|
-
// Global .PENCIL.md in agent dir (e.g. ~/.nanopencil/agent/.PENCIL.md)
|
|
57
|
+
// Global .PENCIL.md in agent dir (e.g. ~/.nanopencil/agent/.PENCIL.md).
|
|
58
|
+
// If active persona exists and has `PENCIL.md`, use it instead.
|
|
59
|
+
const activePersonaId = getActivePersonaId();
|
|
60
|
+
const personaPencilPath = activePersonaId ? getPersonaPencilPath(activePersonaId) : undefined;
|
|
57
61
|
const agentPencilPath = join(resolvedAgentDir, ".PENCIL.md");
|
|
58
|
-
|
|
62
|
+
const pencilPathToLoad = personaPencilPath && existsSync(personaPencilPath) ? personaPencilPath : agentPencilPath;
|
|
63
|
+
if (!seenPaths.has(pencilPathToLoad) && existsSync(pencilPathToLoad)) {
|
|
59
64
|
try {
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
const pencilFile = {
|
|
66
|
+
path: pencilPathToLoad,
|
|
67
|
+
content: readFileSync(pencilPathToLoad, "utf-8"),
|
|
68
|
+
};
|
|
69
|
+
contextFiles.push(pencilFile);
|
|
70
|
+
seenPaths.add(pencilPathToLoad);
|
|
63
71
|
}
|
|
64
72
|
catch (error) {
|
|
65
|
-
console.error(chalk.yellow(`Warning: Could not read ${
|
|
73
|
+
console.error(chalk.yellow(`Warning: Could not read ${pencilPathToLoad}: ${error}`));
|
|
66
74
|
}
|
|
67
75
|
}
|
|
68
76
|
const ancestorContextFiles = [];
|
|
@@ -290,9 +298,13 @@ export class DefaultResourceLoader {
|
|
|
290
298
|
extensionsResult.errors.push({ path: conflict.path, error: conflict.message });
|
|
291
299
|
}
|
|
292
300
|
this.extensionsResult = this.extensionsOverride ? this.extensionsOverride(extensionsResult) : extensionsResult;
|
|
301
|
+
// Persona-specific skill directory (does not persist into user settings)
|
|
302
|
+
const personaId = getActivePersonaId();
|
|
303
|
+
const personaSkillsDir = personaId && existsSync(getPersonaSkillsDir(personaId)) ? getPersonaSkillsDir(personaId) : undefined;
|
|
304
|
+
const personaSkillPaths = personaSkillsDir ? [personaSkillsDir] : [];
|
|
293
305
|
const skillPaths = this.noSkills
|
|
294
|
-
? this.mergePaths(cliEnabledSkills, this.additionalSkillPaths)
|
|
295
|
-
: this.mergePaths([...enabledSkills, ...cliEnabledSkills], this.additionalSkillPaths);
|
|
306
|
+
? this.mergePaths(cliEnabledSkills, [...this.additionalSkillPaths, ...personaSkillPaths])
|
|
307
|
+
: this.mergePaths([...enabledSkills, ...cliEnabledSkills], [...this.additionalSkillPaths, ...personaSkillPaths]);
|
|
296
308
|
this.lastSkillPaths = skillPaths;
|
|
297
309
|
this.updateSkillsFromPaths(skillPaths);
|
|
298
310
|
const promptPaths = this.noPromptTemplates
|