Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Reasonix Getting Started Tutorial

Reasonix Getting Started Tutorial

Reasonix is an open-source terminal AI coding Agent deeply optimized for DeepSeek; its entire run loop is designed from scratch around DeepSeek's prefix-cache mechanism, aiming to make AI coding cheap enough to leave running all the time.

Reasonix's design philosophy: 'A coding agent that stays cheap enough to leave on.' (a coding Agent cheap enough to leave running all the time).

Who is it for?

Scenario Description
Mainly use DeepSeek for coding tasks Deeply adapted to the DeepSeek API, with a cache hit rate far exceeding general tools
Care about AI usage cost Precisely control costs, supports budget caps and real-time cost statistics
Prefer terminal workflows Terminal-first design, diff in git diff, file tree in ls
Run Agent continuously for long periods Ideal for large codebase analysis, batch refactoring, and similar scenarios

What Reasonix does not do

Reasonix is opinionated; the following are things it deliberately does not do:

Things not done Reason
Flexible switching among multiple providers DeepSeek-exclusive; this is by design, not a limitation
IDE integration Terminal-first, no pursuit of IDE plugins
Hardest reasoning Benchmark Claude Opus still leads on some benchmarks; start with Claude for PhD-level proof problems
Offline / completely free Requires a paid DeepSeek API Key; for offline options see Aider + Ollama

Before using Reasonix you need to obtain a DeepSeek API Key; visit platform.deepseek.com/api_keys, to log in or register an account.

Click Create API key, name it (e.g., reasonix), and copy and save it.

The first time you run reasonix you will be prompted to paste the API Key; after entering it is automatically persisted and you won't need to enter it again.


Installation: CLI and desktop version

Reasonix offers two installation methods, CLI and desktop version, described below.

CLI installation

System requirements: Node.js >= 22, supports macOS, Linux, Windows (PowerShell, Git Bash, Windows Terminal).

Global installation (recommended for daily use):



npm install -g reasonix

Installation-free experience (npx, always uses the latest version):



# Change to the project directory, and run directly using npx

cd my-project

npx reasonix code

Verify and health check, view version number:



reasonix --version

Health check: Node version, API Key reachability, MCP configuration:



reasonix doctor

Upgrade to the latest version:



reasonix update

Complete configuration through an interactive wizard, initializing API Key, language, theme, and other settings.



reasonix setup

Select language:

Select theme:

Enter DeepSeek API key:

Press Enter to save:

Next, enter the project vibe-coding-runoob and you can start using it:



cd vibe-coding-runoob

Enter the following command to start using:

reasonix

Enter / to view supported commands:

Desktop version installation

The desktop version is a native client based on Tauri, with multiple tabs; the right panel shows files the Agent read or edited in this session.

The bottom shows the same cost/cache/Token counters as the CLI top bar. It uses the same DeepSeek API Key and ~/.reasonix configuration.

The desktop version has a built-in Node runtime, no separate npm install needed.

From the official website (https://reasonix.io/#start) download the installer for your platform:

Platform File format
macOS Reasonix_x.x.x_universal.dmg
Windows Reasonix_x.x.x_x64-setup.exe
Linux Reasonix_x.x.x_amd64.AppImage or .deb

After downloading, double-click to install, then enter the API key:

After launch, the desktop also uses the classic left-right layout:

Enter information in the input box to start a conversation:

Click the top-right icon to open the three-column layout:

Three collaboration modes:

Common settings, including theme, appearance, language, plugins, MCP, etc.:

Notes for first launch:

On macOS the first launch triggers a Gatekeeper block. One-time fix: run xattr -dr com.apple.quarantine /Applications/Reasonix.app in the terminal, or right-click -> Open -> Confirm.

Windows: SmartScreen shows 'Unknown publisher', click 'More info -> Run anyway'. Linux: .deb and .AppImage run directly, no extra steps.

The desktop version is currently in Prerelease status; the loop and protocol are identical to the CLI, but the UI is still being polished and the installer is not yet code-signed. The CLI is the main development interface; any feature available in the CLI can be used from the desktop version's input box.


First run

Enter the project directory and start Reasonix coding mode.



cd your-project



# Start programming mode (the following two methods are equivalent)

reasonix code

# Or directly

reasonix

Try sending the first message:



分析这个项目的目录结构,告诉我主要模块的职责

Reasonix will call tools such as list_directory and read_file to scan the project and output a structured analysis.

Headless run (pipeline-friendly)



# Execute once, stream results to stdout

reasonix run "统计 src 目录中每个 .ts 文件的行数,按从多到少排序"



# Use with git diff

git diff HEAD~1 | reasonix run "给这段 diff 写一个 Conventional Commits 格式的 commit message"


Two modes: code and chat

Reasonix provides two run modes for different use cases.

Capability code chat
Filesystem tools + edit_file ✓ —
SEARCH/REPLACE -> /apply review ✓ —
Shell tools (subject to permission control) ✓ —
Plan mode, /todo, /skill new, /mcp add ✓ —
Memory (remember / recall_memory) Project-level + global Global only
MCP servers, web search, ask_choice ✓ ✓
Session scope Isolated by directory Shared default

code is the default mode and the only one with filesystem and shell tools; start here.

chat is a lighter no-disk-access mode - for when you need a thinking partner but don't want AI touching files, or when mounting MCP for information retrieval.

chat mode has a shorter system Prompt and lower Token cost.

Reasonix binds the filesystem tool scope to the startup directory, redirected via --dir. Switching directories mid-session is not supported (memory paths would get confused with the old root path) - exit and restart instead.



# Start code mode in the specified directory

reasonix code --dir /path/to/other-project


Edit gating: SEARCH/REPLACE preview flow

This is Reasonix's most important safety mechanism - AI will never modify files without your knowledge.

Three edit gating modes

Switch via /mode or Shift+Tab:

Mode Behavior
review Every edit shows a preview, confirm block by block with y/n
auto (AUTO) Auto-apply, but you can press u to undo within 5 seconds
yolo Write directly to disk, no confirmation

Typical edit flow (review mode)



1. 你:帮我把 getUserById 函数加上错误处理



2. Reasonix analyzes the code and proposes SEARCH/REPLACE modification solutions:



   ─── src/services/user.ts ───

   - async function getUserById(id: string) {

   -   const user = await db.users.findOne({ id });

   -   return user;

   - }

   + async function getUserById(id: string): Promise {

   +   try {

   +     const user = await db.users.findOne({ id });

   +     return user ?? null;

   +   } catch (error) {

   +     logger.error({ id, error }, 'getUserById failed');

   +     throw new AppError('USER_FETCH_FAILED', 500);

   +   }

   + }



3. 你:/apply        ← 确认应用,文件写盘

        /discard      ← 丢弃不应用

        /walk         ← 逐块 git-add-p 风格审查

Edit history

# 列出本次会话的所有编辑批次

/history



# View the diff of a specific edit

/show 



# Rollback the last /apply

/undo


Plan mode: read-only analysis gate

Plan mode puts Reasonix into a read-only state - AI can only read files, analyze code, and propose plans; it cannot write files or execute commands until you explicitly approve the plan.

Enabling and workflow



/plan                ← 切换 Plan 模式(顶栏出现 PLAN MODE 标记)



你:我想把这个 Express 应用迁移到 Fastify,先给我分析影响范围



Plan to submit after AI analysis:

  ✓ 需要替换 5 个路由文件

  ✓ 3 个中间件需要适配

  ✓ 12 个测试需要更新

  预计改动:43 个文件,约 800 行



plan-confirm 模态框出现

  → Ctrl+P 展开/折叠完整计划详情

  → 批准后 AI 进入执行模式

  → 执行过程中每次修改仍走编辑门控

When to use Plan mode

Scenario Description
Large changes Task affects more than 5 files
Architecture changes Framework migration, database switch, API redesign
Team collaboration Scenarios requiring plan alignment
Uncertain scope Want to preview where AI will make changes first

Model and cost control

Reasonix provides flexible model switching and cost control mechanisms.

Switch presets



# default smart (v4-flash + max inference)

reasonix code



# Quick task, v4-flash + high inference, lowest cost

reasonix code --preset fast



# Complex task, v4-pro + max inference

reasonix code --preset max

Switch during a session:



/preset auto         # 开启自动升级逻辑(flash 优先,失败升级 pro)

/preset flash        # 锁定 flash

/preset pro          # 锁定 pro

/pro single upgrade

The user enters /pro; the next round uses v4-pro, then it is automatically removed. No preset switching, no forgetting to restore.

The active state is shown as a yellow 'pro armed' marker in the top bar.



> /pro

> 解释这段 Rust 异步代码里的生命周期标注为什么必须这样写

# Automatically restore v4-flash after answering

Automatic upgrade on failure

Per-round visible 'flash struggling' events: SEARCH-not-found errors from edit_file/write_file, and ToolCallRepair triggers.

Once the count reaches 3, the rest of the current round automatically switches to v4-pro, announced via a yellow warning line - no silent cost.

Set a session budget cap



# This session limit $0.50

reasonix code --budget 0.50



/budget 0.20                     # 会话中设置 $0.20 上限

/budget off                      # 取消上限

Warn at 80%, reject the next round at 100%.

Context compression and cost query



/compact         # 手动将旧轮次折叠为摘要(缓存安全)

                 # Automatically triggers when context reaches 50%, this is manual trigger



/cost            # 上一轮花费

/cost 这段文字   # 预估发送这段文字的成本

/stats           # 跨会话成本仪表板(今天/本周/本月/所有时间)


Skills: reusable Markdown playbooks

Skills are Markdown playbooks that AI can invoke on demand, with no remote registry - write them directly and they take effect immediately.

Create a skill

# 项目级技能:/.reasonix/skills/code-review.md

/skill new code-review



# Global skill: ~/.reasonix/skills/deploy-check.md

/skill new deploy-check --global

Skill file format

File path: .reasonix/skills/code-review.md



---

description: 对当前改动做系统性代码审查,按 P0-P3 优先级分级

runAs: subagent

tools: [read_file, list_directory, search_content]

---



分析 `git diff HEAD` 中的所有改动。



For each discovered issue, output in the following format:



Severe (Blocks merge): Security vulnerability, logic error, data loss risk

**[P1]** Important (Strongly recommended to fix): Performance issues, missing error handling

General (Suggested fix): Code quality, readability

**[P3]** Improvements (Optional): Best Practices, Future Optimizations



每条包含:文件名和行号 · 问题描述(一句话)· 修复建议。



最后给出总体评估:是否可以合并,以及最重要的三个改进点。

runAs: subagent makes the skill run in an isolated sub-Agent loop, so the main session's context does not grow.

Invocation and management



/skill code-review        # 调用技能

/skill list               # 列出所有可用技能

/skill show code-review   # 查看技能内容

Compatible with Claude-format skills

/.claude/skills//SKILL.md and ~/.claude/skills/ are also read automatically.

Coexists with Reasonix native paths, so tools that output Claude-format skills can be used directly.



# Write to .claude/skills/openspec-*/SKILL.md

npx openspec init --tools claude



# Call directly in Reasonix

/skill openspec-propose 


Memory: cross-session context persistence

Reasonix has four memory types for retaining context across sessions.

Type Scope Purpose
user Global Your preferences, work habits
feedback Global AI's mistakes or successes
project Project-level Project conventions, architecture decisions
reference Configurable Fixed reference materials

Manual write



/remember 这个项目用 pnpm 而不是 npm

/remember 所有 API 错误统一走 AppError 类,不要 throw 原生 Error

/remember Turso 批量写入并发时需要加锁,见 src/db/mutex.ts

Manage memory



/memory list              # 查看所有记忆

/memory show          # 查看某条记忆详情

/memory forget        # 删除某条记忆

/memory clear             # 清空所有记忆

Project memory file (REASONIX.md)

Create REASONIX.md in the project root directory; it is loaded automatically at the start of each session.



# Scan project, automatically generate REASONIX.md baseline

/init



# Force regeneration (overwrite existing files)

/init force

Or create it manually:



# Project: runoob-backend



## 技术栈

- Runtime:Bun 1.2(禁止使用 Node.js 专属 API)

- 框架:Hono

- 数据库:Turso(libSQL)



## Coding Standards

- 所有函数必须有 JSDoc 类型注解

- 错误统一用 AppError 类

- 禁止 any 类型



## Known traps

- Turso 并发写入需要互斥锁,见 src/db/mutex.ts


MCP integration: connect external tools

MCP servers support three transport methods: stdio, SSE, Streamable HTTP.

The same configuration format applies to both config.json and the --mcp command-line argument.

Add dynamically during a session



/mcp                      # 打开 MCP 中心(在线 + 市场标签页)

/mcp add stdio:npx,-y,@modelcontextprotocol/server-github

Command-line mount



# Mount MCP server via command line arguments

reasonix code --mcp stdio:npx,-y,@modelcontextprotocol/server-github

Config file preset (recommended)

File path: ~/.reasonix/config.json

Example

{

 

"mcp"

:

{

   

"servers"

:

{

     

"github"

:

{

       

"transport"

:

"stdio"

,

       

"command"

:

"npx"

,

       

"args"

:

[

"-y"

,

"@modelcontextprotocol/server-github"

]

,

       

"env"

:

{

         

"GITHUB_PERSONAL_ACCESS_TOKEN"

:

"${GITHUB_TOKEN}"

       

}

     

}

,

     

"postgres"

:

{

       

"transport"

:

"stdio"

,

       

"command"

:

"npx"

,

       

"args"

:

[

"-y"

,

"@modelcontextprotocol/server-postgres"

]

,

       

"env"

:

{

         

"POSTGRES_CONNECTION_STRING"

:

"postgresql://localhost/mydb"

       

}

     

}

,

     

"searxng"

:

{

       

"transport"

:

"sse"

,

       

"url"

:

"http://localhost:8080/mcp/sse"

     

}

   

}

 

}

}

Browse MCP tools



/mcp list                 # 列出已连接的服务器

/resource                 # 浏览 MCP 资源

/prompt                   # 浏览 MCP 提示词模板


Hooks: lifecycle automation

Hooks supports four lifecycle events; PreToolUse can intercept tool calls via a non-zero exit code.

Supported events

Hook Trigger Timing Special capabilities
PreToolUse Before tool call Non-zero exit = reject call
PostToolUse After a tool call Logging/formatting
UserPromptSubmit When the user submits a message Inject additional context
Stop When a session ends Summary/cleanup

Configuration example

File path: ~/.reasonix/config.json

Example

{

 

"hooks"

:

{

   

"PostToolUse"

:

[

     

{

       

"matcher"

:

{

"tool"

:

"edit_file"

}

,

       

"command"

:

"npx biome format --write {{file}} 2>/dev/null || true"

,

       

"description"

:

"Auto-format after editing files"

     

}

   

]

,

   

"PreToolUse"

:

[

     

{

       

"matcher"

:

{

"tool"

:

"run_command"

}

,

       

"command"

:

"echo '$(date): {{command}}' >> ~/.reasonix/audit.log"

,

       

"description"

:

"Record all Shell commands to the audit log"

     

}

   

]

,

   

"Stop"

:

[

     

{

       

"command"

:

"reasonix stats --session last >> ~/.reasonix/sessions-log.txt"

,

       

"description"

:

"Save statistics after the session ends"

     

}

   

]

 

}

}

View and Reload



/hooks                    # 列出所有已配置的 hooks

/hooks reload             # 热重载 hooks 配置(无需重启)


Session Management and Checkpoint

Reasonix provides comprehensive session management and file snapshot features.

Session management

Example

List all sessions

reasonix sessions

Open a specified session

reasonix sessions my-project

Delete sessions older than 30 days

reasonix prune-sessions

--days

30

Commands in a session:



/sessions                 # 列出已保存会话(当前标记 ▸)

--session           # 启动时绑定到具名会话

--continue                # Resume the last session in this workspace

--new                     # Force create a new session (even if one already exists).

--no-session              # Temporary run, does not persist any content

Checkpoint (file snapshot)



/checkpoint               # 为本次会话碰过的所有文件创建快照

/checkpoint my-snapshot   # 创建具名快照

/checkpoint list          # 列出所有快照

/checkpoint forget    # 删除快照



/restore my-snapshot      # 恢复到指定快照

Replay a session (for debugging)



# Re-render JSONL conversation history, without calling the model

reasonix replay 



# Compare the cost/cache/Token differences between two sessions

reasonix diff  



# Track event logs for a session

reasonix events 


Semantic Index and Web Search

Reasonix supports building a local vector index for a project, as well as configuring a web search engine.

Semantic Index

Build a local vector index for a project, supporting semantic search without exact keyword matching.



# Build index (requires Ollama or OpenAI compatible Embedding endpoint)

reasonix index

Configuration (~/.reasonix/config.json):

Example

{

 

"index"

:

{

   

"endpoint"

:

"http://localhost:11434/api/embeddings"

,

   

"model"

:

"nomic-embed-text"

 

}

}

Use it in a session after building:



> 找出所有和用户认证相关的代码

# Trigger semantic_search tool, search based on semantics rather than keywords

Web Search

Mojeek is used by default; switch via /search-engine (or /se).



/search-engine mojeek     # 默认,隐私友好

/search-engine searxng    # 自托管 SearXNG 实例

/search-engine metaso     # 秘塔搜索(中文内容优化)

Configure self-hosted SearXNG:

Example

{

 

"search"

:

{

   

"engine"

:

"searxng"

,

   

"searxngUrl"

:

"http://localhost:8888"

 

}

}


QQ Channel Remote Control

Reasonix can use QQ as a remote communication channel for existing chat and code sessions, not as a separate operating mode.

Start a session first, then connect QQ.



# 1. Start the session

reasonix code



# 2. Connect QQ in session

/qq connect          # 首次使用引导输入 App ID 和 App Secret

/qq status           # 查看连接状态

/qq disconnect       # 断开连接

After connecting, slash commands, confirmation prompts and AI replies can all go through QQ, with no need to type in the terminal. Subsequent chat / code sessions will automatically start the QQ channel. Desktop users can configure it in Settings → General → QQ Channel.


In-depth Guide to the Desktop Version

The desktop version adds more visual features on top of the CLI TUI.

Interface Layout

The desktop version adds three main panels on top of the CLI TUI:

Panel Function
Right-side File Panel Shows a live list of files the Agent has read or edited in this session; click to view their content directly
Bottom Status Bar Fully corresponds to the CLI top bar: cost counter, cache hit rate, current model, Token consumption
Multiple Tabs Open multiple project sessions at once and switch between tabs independently

Relationship with the CLI

The desktop version and the CLI share the same configuration (~/.reasonix/config.json) and API Key.

Skills, memory and MCP configurations saved in the CLI are immediately available in the desktop version, and vice versa.

All slash commands available in the CLI are fully supported in the desktop version's input box, including /plan, /skill, /mcp, /apply, /pro and more.

Desktop-exclusive Features

Capability Description
Graphical file-tree browsing Visually browse project files in the right-side panel
Multi-tab workspace management A friendlier multi-project switching experience
Graphical QQ configuration Settings → General → QQ Channel
Built-in Node runtime Users do not need to install Node.js separately

Case 1: Exploring a New Project and Reading Code

Scenario: taking over an unfamiliar TypeScript backend repository, needing to quickly understand the architecture and find key modules.

Use chat mode (does not touch files, saves cost):



# Enter project directory, use chat mode and mount MCP

cd unknown-project

reasonix chat --mcp stdio:npx,-y,@modelcontextprotocol/server-github

Conversation walkthrough:



你:用 100 字以内描述这个项目是做什么的



AI:[调用 read_file 读 README.md 和 package.json]

    这是一个多租户 SaaS 订阅管理服务,基于 Node.js + PostgreSQL,

    处理订阅计划创建、支付 Webhook 和使用量追踪。



你:找出最核心的 3 个业务逻辑文件,各用一句话说明职责



AI:[调用 list_directory、search_content 扫描 src/]

    1. src/billing/subscription.ts — 订阅生命周期管理(创建/升级/取消)

    2. src/webhooks/stripe.ts — Stripe 事件处理和订阅状态同步

    3. src/usage/tracker.ts — API 调用量统计和超限检测



你:src/billing/subscription.ts 里的 cancelSubscription 函数,

    它做了什么,有没有可能的竞态条件?



AI:[调用 read_file 精确读取该函数]

    该函数...

    潜在竞态:如果同时收到两次取消请求,

    第 47 行的状态检查和第 52 行的数据库更新之间存在时间窗口...

Generate project memory:



你:把刚才了解的内容写成 REASONIX.md,我切到 code 模式后继续工作



AI:[生成 REASONIX.md 草稿]



你:/apply


Case 2: Multi-file Refactoring (with Plan mode)

Scenario: migrate the error handling of an existing REST API uniformly from throw new Error() to a custom AppError class.

Start and enter Plan mode:



# Start code mode

reasonix code



你:/plan



你:我要把所有 throw new Error() 改成 throw new AppError()。

    AppError 类在 src/errors.ts,接受 code、message、statusCode 三个参数。

    先分析影响范围,不要做任何修改。



AI:[调用 search_content 搜索 "throw new Error"]



    Found 23 calls that need to be migrated, distributed across 8 files:

    - src/routes/users.ts (5 处)

    - src/routes/billing.ts (4 处)

    - src/services/auth.ts (7 处)

    ...



    建议迁移顺序:先处理 services 层(无 HTTP 依赖),

    再处理 routes 层,最后更新测试。



    预计改动:23 处调用,约 150 行代码变更。



    [plan-confirm 弹出]

    → Ctrl+P 展开完整文件清单



你:批准



AI:[进入执行模式,依次修改文件]

    每次改动都会弹出 SEARCH/REPLACE 预览



你:/apply     ← 每批次确认

After execution completes:



你:/commit

AI:[分析所有改动,生成 commit message]

    "refactor: migrate error handling to AppError class



    Replace 23 bare Error throws with typed AppError instances

    across 8 files, improving error observability and HTTP status

    code consistency."



你:确认提交


Case 3: Bug Localization and Fix

Scenario: an intermittent "Cannot read properties of undefined" error appears in production, with only a stack trace in the logs.

Example

,

        "env": {

          "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"

        }

      }

    }

  },

  "permissions": {

    "shell": {

      "allow": [

        "npm test",

        "npm run ",

        "git ",

        "pnpm ",

        "cat ",

        "ls ",

        "grep "

      ]

    }

  },

  "hooks": {

    "PostToolUse": [

      {

        "matcher": { "tool": "edit_file" },

        "command": "npx biome format --write {{file}} 2>/dev/null || true"

      }

    ]

  },

  "search": {

    "engine": "searxng",

    "searxngUrl": "http://localhost:8888"

  },

  "index": {

    "endpoint": "http://localhost:11434/api/embeddings",

    "model": "nomic-embed-text"

  },

  "parallelMax": 4

}

Permission Whitelist Rules

Uses exact prefix matching: allowing "git " means allowing all commands starting with "git " (note the trailing space). Commands not in the whitelist require manual confirmation each time.


Comparison with Other Tools

Below is a comparison of Reasonix with other mainstream AI coding tools:

Dimension Reasonix Claude Code Cursor Aider
Backend DeepSeek (dedicated) Anthropic OpenAI/Anthropic Any (OpenRouter)
License MIT Closed source Closed source Apache 2
Cost characteristics Low cost per task Premium pricing Subscription + usage Depends on the model
DeepSeek prefix-cache Purpose-built Not applicable Not applicable Occasional hits
Built-in Web Dashboard Is — Within the IDE —
Configurable web search engine /search-engine — — —
Persistent per-workspace sessions Is Section Not applicable —
Plan mode · MCP · Hooks · Skills All included All included Yes Section

Resources and Community

Below are the official resources and community links for Reasonix.

Official Resources

Resource link
GitHub esengine/DeepSeek-Reasonix
Official Website https://reasonix.io/
Document https://reasonix.io/docs/