@pencil-agent/nano-pencil 1.11.43 → 1.11.45

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 (149) hide show
  1. package/README.md +267 -267
  2. package/dist/builtin-extensions.js +6 -5
  3. package/dist/cli/args.js +140 -140
  4. package/dist/core/export-html/AGENT.md +11 -11
  5. package/dist/core/export-html/CLAUDE.md +11 -11
  6. package/dist/core/export-html/template.css +971 -971
  7. package/dist/core/export-html/template.html +54 -54
  8. package/dist/core/export-html/template.js +1586 -1586
  9. package/dist/core/export-html/vendor/highlight.min.js +1212 -1212
  10. package/dist/core/export-html/vendor/marked.min.js +6 -6
  11. package/dist/core/i18n/slash-commands.d.ts +1 -0
  12. package/dist/core/i18n/slash-commands.js +1 -0
  13. package/dist/core/i18n/slash-commands.zh.d.ts +1 -0
  14. package/dist/core/i18n/slash-commands.zh.js +1 -0
  15. package/dist/core/index.d.ts +2 -0
  16. package/dist/core/index.js +3 -0
  17. package/dist/core/mcp/figma-auth.js +20 -20
  18. package/dist/core/mcp/mcp-guidance.js +44 -44
  19. package/dist/core/messages.js +7 -7
  20. package/dist/core/prompt/system-prompt.js +103 -103
  21. package/dist/core/runtime/agent-session.d.ts +4 -0
  22. package/dist/core/runtime/agent-session.js +3 -3
  23. package/dist/core/runtime/event-bus.js +2 -1
  24. package/dist/core/runtime/pencil-agent.d.ts +149 -0
  25. package/dist/core/runtime/pencil-agent.js +247 -0
  26. package/dist/core/runtime/sdk.d.ts +21 -0
  27. package/dist/core/runtime/sdk.js +27 -9
  28. package/dist/core/runtime/turn-context.d.ts +32 -0
  29. package/dist/core/runtime/turn-context.js +39 -0
  30. package/dist/core/session/compaction/branch-summarization.js +30 -30
  31. package/dist/core/session/compaction/compaction.js +81 -81
  32. package/dist/core/session/compaction/utils.js +2 -2
  33. package/dist/core/slash-commands.js +1 -0
  34. package/dist/core/tools/source.js +3 -4
  35. package/dist/extensions/defaults/AGENT.md +51 -46
  36. package/dist/extensions/defaults/CLAUDE.md +51 -46
  37. package/dist/extensions/defaults/grub/README.md +25 -25
  38. package/dist/extensions/defaults/grub/index.js +16 -16
  39. package/dist/extensions/defaults/interview/index.js +30 -30
  40. package/dist/extensions/defaults/link-world/internet-search/internet-search.md +65 -65
  41. package/dist/extensions/defaults/link-world/linkworld.md +313 -313
  42. package/dist/extensions/defaults/loop/README.md +49 -49
  43. package/dist/extensions/defaults/mcp/figma-design.md +68 -68
  44. package/dist/extensions/defaults/mcp/mcp-management.md +85 -85
  45. package/dist/extensions/defaults/sal/README.md +65 -65
  46. package/dist/extensions/defaults/sal/anchors.d.ts +1 -1
  47. package/dist/extensions/defaults/sal/anchors.js +14 -2
  48. package/dist/extensions/defaults/sal/eval/index.d.ts +18 -0
  49. package/dist/extensions/defaults/sal/eval/index.js +56 -0
  50. package/dist/extensions/defaults/sal/eval/insforge-sink.d.ts +32 -0
  51. package/dist/extensions/defaults/sal/eval/insforge-sink.js +245 -0
  52. package/dist/extensions/defaults/sal/eval/jsonl-sink.d.ts +25 -0
  53. package/dist/extensions/defaults/sal/eval/jsonl-sink.js +80 -0
  54. package/dist/extensions/defaults/sal/eval/noop-sink.d.ts +8 -0
  55. package/dist/extensions/defaults/sal/eval/noop-sink.js +12 -0
  56. package/dist/extensions/defaults/sal/eval/types.d.ts +50 -0
  57. package/dist/extensions/defaults/sal/eval/types.js +21 -0
  58. package/dist/extensions/defaults/sal/index.d.ts +6 -4
  59. package/dist/extensions/defaults/sal/index.js +343 -35
  60. package/dist/extensions/defaults/security-audit/README.md +289 -289
  61. package/dist/extensions/defaults/security-audit/engine/interceptor.js +26 -26
  62. package/dist/extensions/defaults/security-audit/engine/logger.js +63 -63
  63. package/dist/extensions/defaults/subagent/subagent-parser.js +14 -14
  64. package/dist/extensions/defaults/team/AGENT.md +87 -87
  65. package/dist/extensions/defaults/team/CLAUDE.md +87 -87
  66. package/dist/extensions/defaults/team/TESTING.md +247 -247
  67. package/dist/extensions/defaults/team/team-parser.js +20 -20
  68. package/dist/extensions/optional/AGENT.md +10 -10
  69. package/dist/extensions/optional/CLAUDE.md +10 -10
  70. package/dist/extensions/optional/simplify/index.js +50 -50
  71. package/dist/index.d.ts +2 -0
  72. package/dist/index.js +3 -0
  73. package/dist/main.js +34 -34
  74. package/dist/modes/interactive/components/index.d.ts +1 -0
  75. package/dist/modes/interactive/components/index.js +1 -0
  76. package/dist/modes/interactive/components/raw-text.d.ts +19 -0
  77. package/dist/modes/interactive/components/raw-text.js +28 -0
  78. package/dist/modes/interactive/interactive-mode.d.ts +5 -0
  79. package/dist/modes/interactive/interactive-mode.js +224 -67
  80. package/dist/modes/interactive/theme/dark.json +85 -85
  81. package/dist/modes/interactive/theme/light.json +84 -84
  82. package/dist/modes/interactive/theme/theme-schema.json +335 -335
  83. package/dist/modes/interactive/theme/warm.json +81 -81
  84. package/dist/nanopencil-defaults.js +21 -21
  85. package/dist/node_modules/@pencil-agent/agent-core/proxy.js +1 -2
  86. package/dist/node_modules/@pencil-agent/ai/cli.js +13 -13
  87. package/dist/node_modules/@pencil-agent/ai/models.generated.d.ts +139 -51
  88. package/dist/node_modules/@pencil-agent/ai/models.generated.js +150 -64
  89. package/dist/node_modules/@pencil-agent/ai/utils/oauth/openai-codex.js +10 -10
  90. package/dist/node_modules/@pencil-agent/tui/tui.d.ts +4 -0
  91. package/dist/node_modules/@pencil-agent/tui/tui.js +40 -10
  92. package/dist/packages/mem-core/cli.js +18 -18
  93. package/dist/packages/mem-core/engine-scoring-v2.d.ts +6 -6
  94. package/dist/packages/mem-core/engine-scoring-v2.js +9 -8
  95. package/dist/packages/mem-core/full-insights-html.js +268 -268
  96. package/dist/packages/mem-core/human-insights.js +49 -49
  97. package/dist/packages/mem-core/i18n.js +244 -244
  98. package/dist/packages/mem-core/insights-html.js +204 -204
  99. package/dist/packages/mem-core/turn-context.d.ts +20 -0
  100. package/dist/packages/mem-core/turn-context.js +19 -0
  101. package/docs/ACP/345/215/217/350/256/256/351/233/206/346/210/220/345/274/200/345/217/221/346/226/207/346/241/243.md +851 -0
  102. package/docs/API/345/257/206/351/222/245/344/277/256/345/244/215/346/200/273/347/273/223.md +147 -147
  103. package/docs/API/345/257/206/351/222/245/345/221/275/344/273/244.md +66 -66
  104. package/docs/API/345/257/206/351/222/245/346/214/207/345/215/227.md +292 -292
  105. package/docs/ARK/347/274/226/347/240/201/350/256/241/345/210/222.md +51 -51
  106. package/docs/AgentTeam/351/207/215/346/236/204/346/226/271/346/241/210.md +446 -446
  107. package/docs/Agent/350/257/204/346/265/213/350/277/201/347/247/273/346/211/247/350/241/214/344/273/273/345/212/241/346/226/207/346/241/243-InsForge/347/211/210.md +124 -0
  108. package/docs/Insight /346/264/236/345/257/237/346/212/245/345/221/212.md" +352 -352
  109. package/docs/InterviewRegression.md +122 -122
  110. package/docs/MCP/345/277/253/351/200/237/345/217/202/350/200/203.md +113 -113
  111. package/docs/MCP/351/233/206/346/210/220/346/214/207/345/215/227.md +255 -255
  112. package/docs/Persona/345/210/207/346/215/242.md +97 -97
  113. package/docs/SAL/345/256/236/351/252/214/350/276/271/347/225/214/344/270/216/345/220/216/347/273/255/346/234/272/345/210/266/350/267/257/347/272/277.md +305 -305
  114. package/docs/SAL/345/257/271/346/257/224/350/257/225/351/252/214/350/256/276/350/256/241.md +667 -667
  115. package/docs/SAL/347/273/223/346/236/204/351/224/232/347/202/271/345/256/232/344/275/215/346/226/271/346/241/210.md +851 -851
  116. package/docs/SDK-TESTING.md +364 -0
  117. package/docs/SDK.md +439 -0
  118. package/docs/Simplify/346/211/251/345/261/225.md +277 -277
  119. package/docs/debug-logging.md +148 -148
  120. package/docs/eval-migration/00-/344/272/244/344/273/230/347/211/251/346/270/205/345/215/225.md +140 -0
  121. package/docs/eval-migration/01-/344/272/213/344/273/266/345/215/217/350/256/256/346/226/207/346/241/243.md +305 -0
  122. package/docs/eval-migration/02-InsForge/346/225/260/346/215/256/346/250/241/345/236/213.md +349 -0
  123. package/docs/eval-migration/03-Pencil-Evaluate-API/350/256/276/350/256/241.md +380 -0
  124. package/docs/eval-migration/04-/350/277/201/347/247/273/344/270/216/345/233/236/346/273/232/346/226/207/346/241/243.md +307 -0
  125. package/docs/eval-migration/05-/351/252/214/346/224/266/346/212/245/345/221/212.md +245 -0
  126. package/docs/mem-core/346/212/200/346/234/257/346/226/207/346/241/243.md +593 -0
  127. package/docs//345/206/205/347/275/256MCP/345/267/245/345/205/267.md +326 -326
  128. package/docs//345/215/203/345/270/206/347/274/226/347/240/201/350/256/241/345/210/222.md +52 -52
  129. package/docs//345/215/225/344/275/223/344/273/223/345/272/223/350/207/252/350/277/260.md +189 -189
  130. package/docs//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 +232 -232
  131. package/docs//345/217/221/345/270/203/346/214/207/345/215/227.md +129 -129
  132. package/docs//345/217/230/346/233/264/346/200/273/347/273/223.md +138 -138
  133. package/docs//345/217/230/346/233/264/346/227/245/345/277/227.md +50 -50
  134. package/docs//345/267/245/345/205/267/347/256/241/347/220/206/345/231/250/344/274/230/345/214/226.md +208 -208
  135. package/docs//345/276/252/347/216/257/345/221/275/344/273/244/350/256/241/345/210/222.md +56 -56
  136. package/docs//346/226/207/346/241/243/344/270/255/345/277/203.md +130 -130
  137. package/docs//346/236/266/346/236/204/344/274/230/345/214/226.md +404 -404
  138. package/docs//346/236/266/346/236/204/346/274/224/350/277/233.md +228 -228
  139. package/docs//347/211/210/346/234/2542.md +198 -198
  140. package/docs//347/272/263/350/257/272/350/256/260/345/277/206/350/257/273/345/206/231.md +352 -352
  141. package/docs//347/273/223/346/236/204.md +339 -339
  142. package/docs//350/256/241/345/210/222.md +43 -43
  143. package/docs//350/256/244/347/237/245/345/234/260/345/233/276.md +47 -0
  144. package/docs//350/256/244/347/237/245/345/234/260/345/233/276/346/236/266/346/236/204/350/215/211/346/241/210.md +600 -600
  145. package/docs//350/256/260/345/277/206/347/263/273/347/273/237.md +236 -236
  146. package/docs//350/277/201/347/247/273/346/200/273/347/273/223.md +204 -204
  147. package/docs//351/207/215/346/236/204/344/273/273/345/212/241.md +181 -181
  148. package/docs//351/207/215/346/236/204/350/256/241/345/210/222.md +592 -592
  149. package/package.json +126 -126
package/README.md CHANGED
@@ -1,267 +1,267 @@
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-GPL--3.0-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 install -g @pencil-agent/nano-pencil
121
- ```
122
-
123
- ### First Run
124
-
125
- ```bash
126
- nanopencil
127
- ```
128
-
129
- 1. **Select your model** — Choose from available providers
130
- 2. **Enter API key** — Securely stored in `~/.nanopencil/agent/auth.json`
131
- 3. **Start coding** — Just type what you want to build
132
-
133
- ### Example Session
134
-
135
- ```
136
- You: Create a JWT authentication middleware for Express
137
-
138
- AI: [Analyzing project structure...]
139
- [Creating auth.middleware.ts...]
140
- [Adding TypeScript types...]
141
- [Writing tests...]
142
-
143
- ✅ Done! Created:
144
- - src/middleware/auth.middleware.ts
145
- - src/types/auth.d.ts
146
- - tests/auth.middleware.test.ts
147
-
148
- Features:
149
- • JWT verification with RS256
150
- • Refresh token rotation
151
- • Role-based access control
152
- • Rate limiting integration
153
- ```
154
-
155
- ---
156
-
157
- ## 🎮 Usage
158
-
159
- ### Interactive Mode
160
-
161
- ```bash
162
- nanopencil # Start new session
163
- nanopencil -c # Continue last session
164
- nanopencil -r # Resume from history
165
- nanopencil -m qwen-max # Use specific model
166
- ```
167
-
168
- ### Print Mode (Scripts)
169
-
170
- ```bash
171
- # Single query
172
- nanopencil -p "Refactor this to use async/await"
173
-
174
- # Pipe input
175
- cat bug-report.md | nanopencil -p "Analyze this bug"
176
-
177
- # Chain commands
178
- nanopencil -p "Generate API" | nanopencil -p "Write tests for it"
179
- ```
180
-
181
- ### Slash Commands
182
-
183
- | Command | Description |
184
- |---------|-------------|
185
- | `/model` | Switch AI model |
186
- | `/thinking` | Adjust reasoning depth |
187
- | `/fork` | Branch conversation |
188
- | `/tree` | Browse session history |
189
- | `/memory` | View project memories |
190
- | `/soul` | Check AI personality |
191
- | `/settings` | Configure preferences |
192
- | `/export` | Save as HTML |
193
-
194
- ---
195
-
196
- ## 📊 Comparison
197
-
198
- | Feature | NanoPencil | Cursor | Claude Code | Aider |
199
- |---------|:----------:|:------:|:-----------:|:-----:|
200
- | Terminal Native | ✅ | ❌ | ✅ | ✅ |
201
- | Persistent Memory | ✅ | ❌ | ❌ | ❌ |
202
- | AI Personality | ✅ | ❌ | ❌ | ❌ |
203
- | Session Branching | ✅ | ✅ | ✅ | ❌ |
204
- | Multi-Model | ✅ | ✅ | ❌ | ✅ |
205
- | MCP Support | ✅ | ❌ | ✅ | ❌ |
206
- | Offline Mode | ✅ | ❌ | ❌ | ✅ |
207
- | Chinese Optimized | ✅ | ❌ | ❌ | ❌ |
208
-
209
- ---
210
-
211
- ## 🏗️ Architecture Philosophy
212
-
213
- NanoPencil is built on three pillars:
214
-
215
- ```
216
- ┌─────────────────────────────────────────┐
217
- │ 🧠 COGNITIVE LAYER │
218
- │ (Memory + Personality + Context) │
219
- ├─────────────────────────────────────────┤
220
- │ 🔧 TOOL LAYER │
221
- │ (File Ops + Bash + Search + MCP) │
222
- ├─────────────────────────────────────────┤
223
- │ 🎨 INTERFACE LAYER │
224
- │ (TUI + Themes + Keybindings) │
225
- └─────────────────────────────────────────┘
226
- ```
227
-
228
- **Design Principles:**
229
- - **Terminal First** — No Electron, no browser, pure terminal
230
- - **Privacy First** — Local storage, no telemetry, your data stays yours
231
- - **Extensible** — Plugin system for tools, themes, and behaviors
232
- - **Fast** — Sub-second startup, instant response
233
-
234
- ---
235
-
236
- ## 📚 Documentation
237
-
238
- - [Installation Guide](docs/INSTALL.md)
239
- - [Configuration](docs/CONFIG.md)
240
- - [Memory System](docs/记忆系统.md)
241
- - [MCP Guide](docs/MCP集成指南.md)
242
- - [Keybindings](docs/KEYBINDINGS.md)
243
- - [Extensions](docs/EXTENSIONS.md)
244
-
245
- ---
246
-
247
- ## 🌍 Community
248
-
249
- - 💬 [Discussions](https://github.com/pencil-agent/nano-pencil/discussions)
250
- - 🐛 [Issues](https://github.com/pencil-agent/nano-pencil/issues)
251
- - 📝 [Changelog](CHANGELOG.md)
252
-
253
- ---
254
-
255
- ## 📄 License
256
-
257
- MIT © [Pencil Agent](https://github.com/pencil-agent)
258
-
259
- ---
260
-
261
- <div align="center">
262
-
263
- **[⬆ Back to Top](#-nanopencil)**
264
-
265
- <sub>Built with ❤️ for terminal dwellers everywhere</sub>
266
-
267
- </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-GPL--3.0-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 install -g @pencil-agent/nano-pencil
121
+ ```
122
+
123
+ ### First Run
124
+
125
+ ```bash
126
+ nanopencil
127
+ ```
128
+
129
+ 1. **Select your model** — Choose from available providers
130
+ 2. **Enter API key** — Securely stored in `~/.nanopencil/agent/auth.json`
131
+ 3. **Start coding** — Just type what you want to build
132
+
133
+ ### Example Session
134
+
135
+ ```
136
+ You: Create a JWT authentication middleware for Express
137
+
138
+ AI: [Analyzing project structure...]
139
+ [Creating auth.middleware.ts...]
140
+ [Adding TypeScript types...]
141
+ [Writing tests...]
142
+
143
+ ✅ Done! Created:
144
+ - src/middleware/auth.middleware.ts
145
+ - src/types/auth.d.ts
146
+ - tests/auth.middleware.test.ts
147
+
148
+ Features:
149
+ • JWT verification with RS256
150
+ • Refresh token rotation
151
+ • Role-based access control
152
+ • Rate limiting integration
153
+ ```
154
+
155
+ ---
156
+
157
+ ## 🎮 Usage
158
+
159
+ ### Interactive Mode
160
+
161
+ ```bash
162
+ nanopencil # Start new session
163
+ nanopencil -c # Continue last session
164
+ nanopencil -r # Resume from history
165
+ nanopencil -m qwen-max # Use specific model
166
+ ```
167
+
168
+ ### Print Mode (Scripts)
169
+
170
+ ```bash
171
+ # Single query
172
+ nanopencil -p "Refactor this to use async/await"
173
+
174
+ # Pipe input
175
+ cat bug-report.md | nanopencil -p "Analyze this bug"
176
+
177
+ # Chain commands
178
+ nanopencil -p "Generate API" | nanopencil -p "Write tests for it"
179
+ ```
180
+
181
+ ### Slash Commands
182
+
183
+ | Command | Description |
184
+ |---------|-------------|
185
+ | `/model` | Switch AI model |
186
+ | `/thinking` | Adjust reasoning depth |
187
+ | `/fork` | Branch conversation |
188
+ | `/tree` | Browse session history |
189
+ | `/memory` | View project memories |
190
+ | `/soul` | Check AI personality |
191
+ | `/settings` | Configure preferences |
192
+ | `/export` | Save as HTML |
193
+
194
+ ---
195
+
196
+ ## 📊 Comparison
197
+
198
+ | Feature | NanoPencil | Cursor | Claude Code | Aider |
199
+ |---------|:----------:|:------:|:-----------:|:-----:|
200
+ | Terminal Native | ✅ | ❌ | ✅ | ✅ |
201
+ | Persistent Memory | ✅ | ❌ | ❌ | ❌ |
202
+ | AI Personality | ✅ | ❌ | ❌ | ❌ |
203
+ | Session Branching | ✅ | ✅ | ✅ | ❌ |
204
+ | Multi-Model | ✅ | ✅ | ❌ | ✅ |
205
+ | MCP Support | ✅ | ❌ | ✅ | ❌ |
206
+ | Offline Mode | ✅ | ❌ | ❌ | ✅ |
207
+ | Chinese Optimized | ✅ | ❌ | ❌ | ❌ |
208
+
209
+ ---
210
+
211
+ ## 🏗️ Architecture Philosophy
212
+
213
+ NanoPencil is built on three pillars:
214
+
215
+ ```
216
+ ┌─────────────────────────────────────────┐
217
+ │ 🧠 COGNITIVE LAYER │
218
+ │ (Memory + Personality + Context) │
219
+ ├─────────────────────────────────────────┤
220
+ │ 🔧 TOOL LAYER │
221
+ │ (File Ops + Bash + Search + MCP) │
222
+ ├─────────────────────────────────────────┤
223
+ │ 🎨 INTERFACE LAYER │
224
+ │ (TUI + Themes + Keybindings) │
225
+ └─────────────────────────────────────────┘
226
+ ```
227
+
228
+ **Design Principles:**
229
+ - **Terminal First** — No Electron, no browser, pure terminal
230
+ - **Privacy First** — Local storage, no telemetry, your data stays yours
231
+ - **Extensible** — Plugin system for tools, themes, and behaviors
232
+ - **Fast** — Sub-second startup, instant response
233
+
234
+ ---
235
+
236
+ ## 📚 Documentation
237
+
238
+ - [Installation Guide](docs/INSTALL.md)
239
+ - [Configuration](docs/CONFIG.md)
240
+ - [Memory System](docs/记忆系统.md)
241
+ - [MCP Guide](docs/MCP集成指南.md)
242
+ - [Keybindings](docs/KEYBINDINGS.md)
243
+ - [Extensions](docs/EXTENSIONS.md)
244
+
245
+ ---
246
+
247
+ ## 🌍 Community
248
+
249
+ - 💬 [Discussions](https://github.com/pencil-agent/nano-pencil/discussions)
250
+ - 🐛 [Issues](https://github.com/pencil-agent/nano-pencil/issues)
251
+ - 📝 [Changelog](CHANGELOG.md)
252
+
253
+ ---
254
+
255
+ ## 📄 License
256
+
257
+ MIT © [Pencil Agent](https://github.com/pencil-agent)
258
+
259
+ ---
260
+
261
+ <div align="center">
262
+
263
+ **[⬆ Back to Top](#-nanopencil)**
264
+
265
+ <sub>Built with ❤️ for terminal dwellers everywhere</sub>
266
+
267
+ </div>
@@ -64,11 +64,12 @@ function findPackageRoot(startDir) {
64
64
  */
65
65
  export function getBuiltinExtensionPaths() {
66
66
  const paths = [];
67
- // === SAL extension (Structural Anchor Localization, default-on) ===
68
- // MUST load before NanoMem so SAL sets globalThis.__salAnchor
69
- // before mem-core reads it during before_agent_start scoring.
70
- // Pluggable: when --nosal is set, the extension is a runtime no-op.
71
- // Deleting this directory + this block must leave the system fully functional.
67
+ // === SAL extension (Structural Anchor Localization, default-on, experimental) ===
68
+ // Loaded ahead of NanoMem because turn-context producers must publish before
69
+ // turn-context consumers read. SAL is a producer of structuralAnchor; NanoMem
70
+ // is a consumer. Both speak only to core/runtime/turn-context neither names
71
+ // the other. Deleting this directory + this block leaves the system fully
72
+ // functional (NanoMem's structural boost just becomes a no-op).
72
73
  if (existsSync(BUNDLED_SAL_EXTENSION)) {
73
74
  paths.push(BUNDLED_SAL_EXTENSION);
74
75
  }