aurict 1.0.6

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 +432 -0
  2. package/bin/aurict +45 -0
  3. package/package.json +49 -0
package/README.md ADDED
@@ -0,0 +1,432 @@
1
+ # Aurict
2
+
3
+ **A terminal-native AI coding assistant built for the way developers actually work.**
4
+
5
+ ```
6
+ ❯ aurict
7
+ ```
8
+
9
+ Aurict runs entirely in your terminal. No browser tabs, no Electron overhead, no clipboard
10
+ juggling between windows. You stay in the environment where you already write code, and the AI
11
+ meets you there — with full access to your files, shell, language servers, and running processes.
12
+
13
+ ---
14
+
15
+ ## Why Aurict?
16
+
17
+ Most AI coding tools are built around a chat interface that happens to have a code block.
18
+ Aurict is built around a **coding environment** that happens to have a chat interface.
19
+
20
+ **It understands your project before you say a word.**
21
+ Aurict scans your repository on startup — framework, language, package manager, config files,
22
+ existing conventions — and injects that context into every request. You don't have to explain
23
+ that you're using Next.js with Tailwind and Drizzle. It already knows.
24
+
25
+ **It works with real tools, not simulated ones.**
26
+ Every file read, shell command, and code edit happens through a typed, permission-controlled
27
+ tool layer. Commands are classified as safe, warning, or dangerous before execution. Risky
28
+ executables run inside an isolated sandbox. You always know what's happening and why.
29
+
30
+ **It thinks in parallel, not in sequence.**
31
+ Long tasks — refactoring a module, writing a test suite, auditing security — are broken into
32
+ subtasks and distributed across a pool of specialized worker agents: code, review, test, docs,
33
+ performance, security, debug, analytics, explore. Results flow back into a shared context.
34
+
35
+ **It speaks your stack's language.**
36
+ 218+ skills cover specific frameworks, tools, and patterns. A skill isn't a prompt template —
37
+ it's a structured context injection that shapes how the AI reasons about your particular
38
+ combination of technologies.
39
+
40
+ **It stays out of your way.**
41
+ The TUI is built on Ink (React for terminals). It renders cleanly, scrolls correctly, handles
42
+ wide output, and gets out of the way when you're not interacting with it. No flickering, no
43
+ full-screen takeovers.
44
+
45
+ **It exposes a local API.**
46
+ Every session is reachable over HTTP with bearer-token auth. Pipe output from scripts, drive
47
+ Aurict from CI, or build your own tooling on top.
48
+
49
+ ---
50
+
51
+ ## Features
52
+
53
+ ### Core Agent
54
+
55
+ | Feature | Description |
56
+ |---|---|
57
+ | **Multi-agent orchestration** | Worker thread isolation, 3+1 coordinator model (explore, code, review, specialist) |
58
+ | **218+ Skills** | Automatic project analysis, framework-specific context injection at startup |
59
+ | **Streaming responses** | Token-level streaming with live reasoning display for extended thinking models |
60
+ | **Session memory** | SQLite-backed persistent conversation history with full restore |
61
+ | **Context compaction** | Automatic summarization before context overflow, configurable thresholds |
62
+ | **Undo** | Roll back the last N agent steps including file edits |
63
+
64
+ ### Tools
65
+
66
+ | Tool | Description |
67
+ |---|---|
68
+ | `bash` | Shell execution with AST-level safe/warning/danger classification |
69
+ | `read` | File reading with line-range support |
70
+ | `write` | Atomic file writes |
71
+ | `edit` | Precise string-replace edits with diff preview |
72
+ | `glob` | Pattern-based file search with 30s timeout protection |
73
+ | `grep` | Regex search across files |
74
+ | `webfetch` | HTTP fetch with automatic HTML stripping |
75
+ | `websearch` | Web search integration |
76
+ | `lsp` | TypeScript/Python language server diagnostics before edits |
77
+ | `todo` | Project-local task tracking, persisted to `.aurict/todos.json` |
78
+ | `apply_patch` | Unified diff patch application |
79
+ | `subagent` | Spawn a typed specialist agent inline |
80
+
81
+ ### Security
82
+
83
+ | Feature | Description |
84
+ |---|---|
85
+ | **Bash classifier** | Three-tier analysis (safe / warning / danger) before any shell command runs |
86
+ | **Sandbox execution** | Risky executables (node, python, ruby, bash, sh scripts) run in Docker isolation |
87
+ | **Permission system** | Per-tool allow/deny rules, wildcard path matching, always-allow list |
88
+ | **JWT auth** | Bearer token on the local HTTP API, auto-generated at `~/.aurict/server-token` |
89
+
90
+ ### Design Agent
91
+
92
+ | Feature | Description |
93
+ |---|---|
94
+ | **150+ Design systems** | Material, Shadcn, Radix, Tailwind, Chakra, Ant Design, and more |
95
+ | **111 Skill templates** | Component generation, layout, theming, accessibility, animation |
96
+ | **TUI wizard** | `/design` opens an interactive project brief → system → skill picker |
97
+ | **Brief analysis** | Fuzzy-matches your description to the most relevant design system |
98
+
99
+ ### Integrations
100
+
101
+ | Feature | Description |
102
+ |---|---|
103
+ | **MCP client** | `claude_desktop_config.json`-compatible MCP server support |
104
+ | **30+ Language LSP** | TypeScript, JavaScript, Python, Go, Rust, Ruby, Java, Kotlin, Dart, C/C++, and more |
105
+ | **Ollama** | Local model support via Ollama API |
106
+ | **OpenRouter** | 200+ models through a single API key |
107
+
108
+ ---
109
+
110
+ ## LLM Robustness Layer
111
+
112
+ Aurict works well even with weaker or cheaper models because reliability logic lives in the framework — not in the model.
113
+
114
+ ### Pattern-Completion Mitigation
115
+
116
+ LLMs sometimes fill in code from training memory rather than from what's actually in the file. Aurict fights this at three levels:
117
+
118
+ **A — Edit failure diagnosis**
119
+ When `edit` fails because `old_string` doesn't match, the error now explicitly tells the model it likely pattern-completed and must re-read the file before retrying. Weak models that guess content without reading are caught and redirected immediately.
120
+
121
+ **B — Re-read gating (10-call staleness window)**
122
+ Every file read or write is tracked with a call-index timestamp. When `edit` is called on a file that hasn't been read in the last 10 tool calls, the current file content is automatically injected into the result — without executing the edit. The model sees actual current content and can retry with a correct `old_string`.
123
+
124
+ **C — Symbol pre-verification**
125
+ Before a write or edit on a TypeScript/JavaScript file, named imports from local modules are extracted and verified. If the file exists but the named export doesn't, the write is blocked with a diagnostic message pointing to the missing symbol. Hallucinated function and type names are caught before they reach the filesystem.
126
+
127
+ ### Additional Robustness Features
128
+
129
+ | Feature | What it does |
130
+ |---|---|
131
+ | **Dual-path TypeScript verification** | `tsc --noEmit` runs automatically after every edit/write on typed files. TypeScript errors in the edited file are appended to the tool result so the model can self-correct without a separate check step. Results cached 8 seconds. |
132
+ | **Stuck detection** | A per-turn failure tracker detects when the same tool+error combination appears twice in a row. A `[SYSTEM]` warning is injected into the next result, forcing the model to change approach. |
133
+ | **Error analysis hints** | Every tool error is inspected by regex. ENOENT, module-not-found, TypeScript errors, port-in-use, permission denied, OOM — each pattern generates a one-line actionable hint appended to the error. |
134
+ | **Output summarization** | Tool outputs over 4 000 chars are automatically summarized before reaching the model. `grep` results: first 50 matches + file/count summary. General output: head 2 500 chars + tail 600 chars with an omission notice. |
135
+ | **Proactive file injection** | File paths mentioned in the user's message are resolved and injected into the system prompt before the model even calls `read`. The model starts with the relevant content already in context. |
136
+ | **Git context freshness** | For Anthropic providers, git status/branch/log is placed in a separate uncached system message block so it reflects the current state on every turn — never stale from the 5-minute prompt cache. |
137
+ | **Structured compaction** | Session summaries are required to output MODIFIED_FILES, DECISIONS, ERRORS, CURRENT_STATE, and NEXT_STEPS with verbatim file paths and error messages. Vague summaries that lose specific values are structurally prevented. |
138
+ | **Memory extraction on compaction** | Before context is compacted, memories (preferences, project facts, patterns) are extracted and stored in SQLite. They are re-injected into every future session without relying on the conversation history. |
139
+
140
+ ---
141
+
142
+ ## Installation
143
+
144
+ ### Compile from source (recommended)
145
+
146
+ Produces a single self-contained binary with the Bun runtime embedded — no runtime dependencies.
147
+
148
+ ```bash
149
+ git clone https://github.com/aurict/aurict
150
+ cd aurict
151
+ bun install
152
+ bun run build
153
+
154
+ # Run
155
+ ./dist/aurict
156
+ ```
157
+
158
+ ### Global install via npm
159
+
160
+ ```bash
161
+ npm install -g @aurict/cli
162
+ aurict
163
+ ```
164
+
165
+ ### Requirements
166
+
167
+ - **Bun** 1.3+ (for building from source)
168
+ - **Node.js** 20+ (for the npm package)
169
+ - An API key for at least one supported provider
170
+
171
+ ---
172
+
173
+ ## Quick Start
174
+
175
+ ```bash
176
+ # Set your API key
177
+ aurict /config set anthropic sk-ant-...
178
+
179
+ # Start the TUI
180
+ aurict
181
+
182
+ # Pipe mode — non-interactive single query
183
+ echo "What does this function do?" | aurict
184
+
185
+ # Open a specific directory
186
+ aurict --workdir ~/projects/myapp
187
+ ```
188
+
189
+ ### CLI Flags
190
+
191
+ ```
192
+ aurict [options]
193
+
194
+ -p, --provider <id> Provider to use (anthropic, openai, openrouter, google, ollama)
195
+ -m, --model <id> Model to use
196
+ -s, --system <text> System prompt override
197
+ -w, --workdir <path> Working directory (default: current directory)
198
+ --undercover Hide AI identity in responses
199
+ -v, --version Print version
200
+ -h, --help Show help
201
+ ```
202
+
203
+ ---
204
+
205
+ ## Providers
206
+
207
+ | Provider | Environment Variable | Notes |
208
+ |---|---|---|
209
+ | **Anthropic** | `ANTHROPIC_API_KEY` | Claude 3.5, Claude 4 (Sonnet, Opus, Haiku) |
210
+ | **OpenAI** | `OPENAI_API_KEY` | GPT-4o, o3, o4-mini |
211
+ | **Google** | `GOOGLE_GENERATIVE_AI_KEY` | Gemini 2.0, 2.5 Flash/Pro |
212
+ | **OpenRouter** | `OPENROUTER_API_KEY` | 200+ models via single endpoint |
213
+ | **Ollama** | `OLLAMA_BASE_URL` | Local models, default: `localhost:11434` |
214
+
215
+ ---
216
+
217
+ ## Slash Commands
218
+
219
+ | Command | Description |
220
+ |---|---|
221
+ | `/help` | List all available commands |
222
+ | `/models` | Open interactive model picker |
223
+ | `/providers` | Show configured providers |
224
+ | `/design` | Open the design agent wizard |
225
+ | `/session` | Show current session info (ID, tokens, message count) |
226
+ | `/sessions` | Browse and restore previous sessions |
227
+ | `/clear` | Clear the current conversation |
228
+ | `/memory` | Manage persistent memory entries |
229
+ | `/ctx` | Analyze current context token usage |
230
+ | `/compact` | Configure or trigger context compaction |
231
+ | `/undo` | Roll back the last N agent steps |
232
+ | `/export` | Export session as Markdown or HTML |
233
+ | `/config` | Get or set API keys and defaults |
234
+ | `/keys` | Show all keyboard shortcuts |
235
+ | `/btw` | Add a background note to the current session |
236
+ | `/skills` | List detected skills for the current project |
237
+ | `/agents` | Show active and recent subagents |
238
+
239
+ ---
240
+
241
+ ## Keyboard Shortcuts
242
+
243
+ | Shortcut | Action |
244
+ |---|---|
245
+ | `Enter` | Send message |
246
+ | `Shift+Enter` | Insert newline |
247
+ | `Ctrl+←` / `Ctrl+→` | Move cursor word by word |
248
+ | `Ctrl+A` / `Ctrl+E` | Jump to start / end of line |
249
+ | `Ctrl+C` | Cancel current operation or exit |
250
+ | `Ctrl+T` | Toggle floating task panel |
251
+ | `Ctrl+S` | Open settings panel |
252
+ | `Ctrl+X` | Toggle subagent view |
253
+ | `Ctrl+O` | Expand collapsed tool output |
254
+ | `Esc` | Close overlay / go back |
255
+
256
+ ---
257
+
258
+ ## MCP Integration
259
+
260
+ Aurict reads MCP server configuration from `.aurict/mcp.json`, using the same format
261
+ as `claude_desktop_config.json`.
262
+
263
+ ```json
264
+ {
265
+ "mcpServers": {
266
+ "filesystem": {
267
+ "command": "npx",
268
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home"]
269
+ },
270
+ "github": {
271
+ "command": "npx",
272
+ "args": ["-y", "@modelcontextprotocol/server-github"],
273
+ "env": {
274
+ "GITHUB_PERSONAL_ACCESS_TOKEN": "<your-token>"
275
+ }
276
+ }
277
+ }
278
+ }
279
+ ```
280
+
281
+ MCP tools appear alongside built-in tools and are subject to the same permission system.
282
+
283
+ ---
284
+
285
+ ## HTTP API
286
+
287
+ Aurict exposes a REST/SSE API on `127.0.0.1:7777`. All endpoints except `/v1/health`
288
+ require bearer-token authentication.
289
+
290
+ ```bash
291
+ # Read the auto-generated token
292
+ TOKEN=$(cat ~/.aurict/server-token)
293
+
294
+ # Health check (no auth required)
295
+ curl http://localhost:7777/v1/health
296
+
297
+ # Create a session
298
+ curl -X POST http://localhost:7777/v1/session \
299
+ -H "Authorization: Bearer $TOKEN" \
300
+ -H "Content-Type: application/json" \
301
+ -d '{"provider":"anthropic","model":"claude-sonnet-4-6"}'
302
+
303
+ # List sessions
304
+ curl http://localhost:7777/v1/sessions \
305
+ -H "Authorization: Bearer $TOKEN"
306
+
307
+ # Send a message (SSE stream)
308
+ curl -N http://localhost:7777/v1/session/<id>/message \
309
+ -H "Authorization: Bearer $TOKEN" \
310
+ -H "Content-Type: application/json" \
311
+ -d '{"content":"refactor the auth module"}'
312
+ ```
313
+
314
+ The token is stored at `~/.aurict/server-token` (mode 600) and regenerated if deleted.
315
+
316
+ ---
317
+
318
+ ## Configuration
319
+
320
+ Aurict stores all configuration in `~/.aurict/`:
321
+
322
+ ```
323
+ ~/.aurict/
324
+ ├── aurict.db # SQLite database (sessions, config, MCP servers)
325
+ ├── server-token # HTTP API bearer token (chmod 600)
326
+ └── todos.json # Project-local task list (per working directory)
327
+ ```
328
+
329
+ To set a default provider and model:
330
+
331
+ ```bash
332
+ aurict /config set default.provider anthropic
333
+ aurict /config set default.model claude-sonnet-4-6
334
+ ```
335
+
336
+ ---
337
+
338
+ ## Development
339
+
340
+ ```bash
341
+ bun install # install dependencies
342
+ bun run dev # start in development mode (hot reload)
343
+ bun run test # run all 145 tests
344
+ bun run typecheck # TypeScript strict check (both packages)
345
+ bun run build # compile to standalone binary → dist/aurict
346
+ ```
347
+
348
+ ### Project Structure
349
+
350
+ ```
351
+ aurict/
352
+ ├── packages/
353
+ │ ├── core/ # Agent engine, tools, providers, storage, server
354
+ │ │ ├── src/
355
+ │ │ │ ├── agent/ # Agent loop, compaction, protocol
356
+ │ │ │ ├── tool/ # Tool registry, built-ins, classifier, sandbox
357
+ │ │ │ ├── provider/ # Anthropic, OpenAI, Google, OpenRouter, Ollama
358
+ │ │ │ ├── server/ # Hono HTTP API, auth middleware
359
+ │ │ │ ├── storage/ # SQLite, Drizzle ORM, schema
360
+ │ │ │ └── design/ # Design systems, skill templates, matcher
361
+ │ │ └── test/ # 92 unit tests
362
+ │ └── cli/ # Ink TUI, commands, keybindings
363
+ │ ├── src/
364
+ │ │ ├── tui/ # React components (Ink)
365
+ │ │ ├── commands/ # Slash command registry
366
+ │ │ └── utils/ # Theme, highlight, token display
367
+ │ └── test/ # 39 TUI component tests
368
+ ├── scripts/
369
+ │ └── build.ts # bun build --compile → dist/aurict
370
+ └── dist/
371
+ └── aurict # Compiled binary (~103 MB, Bun runtime embedded)
372
+ ```
373
+
374
+ ### Running Tests
375
+
376
+ ```bash
377
+ # All tests
378
+ bun run test
379
+
380
+ # Core only
381
+ bun test packages/core/test/*.test.ts
382
+
383
+ # TUI only
384
+ bun test packages/cli/test/*.test.tsx
385
+
386
+ # Single file
387
+ bun test packages/core/test/classifier.test.ts
388
+ ```
389
+
390
+ Test coverage includes: bash classifier, token counting, permission system, context compaction,
391
+ sandbox detection, agent pool, HTTP server auth, and TUI components (Spinner, Markdown,
392
+ StatusBar, StartupBanner).
393
+
394
+ ---
395
+
396
+ ## Documentation
397
+
398
+ | Guide | Description |
399
+ |-------|-------------|
400
+ | [Getting Started](docs/getting-started.md) | Installation, first run, basic usage |
401
+ | [Configuration](docs/configuration.md) | Config file, env vars, CLAUDE.md, GateGuard |
402
+ | [Tools Reference](docs/tools.md) | All built-in tools, parameters, permissions |
403
+ | [Providers](docs/providers.md) | Anthropic, OpenAI, OpenRouter, Google, Ollama, and more |
404
+ | [Skills & Project Detection](docs/skills.md) | Automatic context injection, custom skills |
405
+ | [Multi-Agent Mode](docs/multi-agent.md) | Coordinator, worker types, agent pool |
406
+ | [LLM Robustness Layer](docs/llm-robustness.md) | Pattern-completion mitigation, re-read gating, symbol verification |
407
+ | [Session Compaction](docs/compaction.md) | Strategies, structured summaries, memory extraction |
408
+ | [MCP Servers](docs/mcp.md) | Model Context Protocol integration |
409
+ | [HTTP API](docs/api.md) | REST endpoints, SSE streaming, scripting |
410
+ | [Hook System](docs/hooks.md) | Lifecycle hooks, blocking tools |
411
+
412
+ ---
413
+
414
+ ## Tech Stack
415
+
416
+ | Layer | Technology |
417
+ |---|---|
418
+ | Runtime | Bun 1.3+ |
419
+ | Language | TypeScript 5.8+ strict mode |
420
+ | TUI | Ink 5 (React for terminals) |
421
+ | AI SDK | Vercel AI SDK 4.x |
422
+ | Database | SQLite via `bun:sqlite` + Drizzle ORM |
423
+ | HTTP server | Hono 4 |
424
+ | Token counting | js-tiktoken (model-specific BPE encodings) |
425
+ | MCP | @modelcontextprotocol/sdk |
426
+ | Testing | Bun test runner + ink-testing-library |
427
+
428
+ ---
429
+
430
+ ## License
431
+
432
+ MIT
package/bin/aurict ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+ "use strict"
3
+
4
+ const { execFileSync } = require("node:child_process")
5
+ const path = require("node:path")
6
+ const os = require("node:os")
7
+
8
+ const PLATFORM = os.platform() // 'linux' | 'darwin' | 'win32'
9
+ const ARCH = os.arch() // 'x64' | 'arm64'
10
+
11
+ // Map Node.js arch names to our package suffix
12
+ const ARCH_MAP = { x64: "x64", arm64: "arm64", aarch64: "arm64" }
13
+ const arch = ARCH_MAP[ARCH]
14
+
15
+ const SUPPORTED = ["linux", "darwin", "win32"]
16
+ if (!arch || !SUPPORTED.includes(PLATFORM)) {
17
+ console.error(
18
+ `aurict: unsupported platform ${PLATFORM}/${ARCH}\n` +
19
+ `Supported: linux/x64, linux/arm64, darwin/x64, darwin/arm64, win32/x64\n` +
20
+ `Build from source: https://github.com/aurict-dev/aurict`
21
+ )
22
+ process.exit(1)
23
+ }
24
+
25
+ const pkgName = `@aurict/cli-${PLATFORM}-${arch}`
26
+ const binName = PLATFORM === "win32" ? "aurict.exe" : "aurict"
27
+
28
+ let binPath
29
+ try {
30
+ // Resolve the platform-specific binary from optionalDependencies
31
+ const pkgJson = require.resolve(`${pkgName}/package.json`)
32
+ binPath = path.join(path.dirname(pkgJson), "bin", binName)
33
+ } catch {
34
+ console.error(
35
+ `aurict: could not find platform package "${pkgName}"\n` +
36
+ `Try reinstalling: npm install -g aurict`
37
+ )
38
+ process.exit(1)
39
+ }
40
+
41
+ try {
42
+ execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" })
43
+ } catch (err) {
44
+ process.exit(err.status ?? 1)
45
+ }
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "aurict",
3
+ "version": "1.0.6",
4
+ "description": "Open-source terminal AI coding assistant — 9 specialist agents, 218+ skills, multi-provider (Anthropic, OpenAI, Google, Ollama and more). Claude Code alternative.",
5
+ "keywords": [
6
+ "ai",
7
+ "cli",
8
+ "coding-assistant",
9
+ "terminal-ai",
10
+ "claude",
11
+ "claude-code-alternative",
12
+ "opencode-alternative",
13
+ "terminal",
14
+ "llm",
15
+ "agent",
16
+ "multi-agent",
17
+ "anthropic",
18
+ "openai",
19
+ "developer-tools",
20
+ "ai-tools",
21
+ "open-source"
22
+ ],
23
+ "license": "MIT",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/aurict/aurict.git"
27
+ },
28
+ "homepage": "https://aurict.dev",
29
+ "bugs": {
30
+ "url": "https://github.com/aurict/aurict/issues"
31
+ },
32
+ "bin": {
33
+ "aurict": "./bin/aurict"
34
+ },
35
+ "files": [
36
+ "bin/aurict",
37
+ "README.md"
38
+ ],
39
+ "optionalDependencies": {
40
+ "@aurict/cli-linux-x64": "1.0.6",
41
+ "@aurict/cli-linux-arm64": "1.0.6",
42
+ "@aurict/cli-darwin-x64": "1.0.6",
43
+ "@aurict/cli-darwin-arm64": "1.0.6",
44
+ "@aurict/cli-win32-x64": "1.0.6"
45
+ },
46
+ "engines": {
47
+ "node": ">=20"
48
+ }
49
+ }