Reasonix

repository·main-v2·Indexed 12 days ago

https://github.com/esengine/deepseek-reasonix

A config-driven, autonomous coding agent designed for local execution. It is accessible via CLI/TUI, a desktop application, a VS Code extension, or editor integration through the ACP protocol. The project includes a comprehensive benchmarking suite (e2ebench) for evaluating agent performance, honesty, anchor resistance, and fault recovery.

Tokens
198K
Snippets
420
Records
818
Agent score
99%

What's inside Reasonix

  1. Overview of Reasonix Built-in Tools

    main-v2

    Reasonix provides a set of built-in tools that allow an agent or provider to interact with the filesystem, shell, and task management system. These tools are categorized by their capability to read or write data and their impact on the workspace.

    Tool Categories

    • Filesystem Operations: read_file, write_file, edit_file, multi_edit, delete_range, delete_symbol, move_file, glob, ls, grep.
    • Shell & Execution: bash, bash_output, kill_shell, wait.
    • Task & Goal Management: todo_write, complete_step, update_goal.
    • Information Retrieval: web_fetch, code_index.
    • Specialized Editing: notebook_edit (for Jupyter notebooks).
    • Context Management: compress (to manage conversation history).
  2. Overview of Reasonix Benchmarks harnesses

    main-v2

    Reasonix provides three distinct benchmarking harnesses located in the benchmarks/ directory to evaluate different aspects of agent performance:

    1. e2e/ (End-to-End): The primary suite for evaluating real-world task completion. It is driven by cmd/e2ebench and runs tasks against real providers. It generates markdown and JSON reports covering accuracy, cache-hit rate, token usage, and cost.
    2. context-maintenance-e2e/: A standalone harness designed to A/B-compare how different context pruning strategies affect cache behavior during seed $\rightarrow$ resume $\rightarrow$ comprehension workflows.
    3. compaction/ (CompactionBench): Measures the cost and information loss associated with repeated session compaction by growing a session one generation at a time and folding it after each step.
  3. Overview of reasonix-accounts service

    main-v2

    The reasonix-accounts service is a backend API for reasonix.io that handles user authentication and profile management. It provides functionality for email/password sign-up, email verification, session management, password resets, and public profiles.

    Key Characteristics:

    • Backend Only: It is a JSON API with no HTML pages. It is intended to be consumed by web frontends, CLI tools, or desktop applications.
    • Technology Stack: Built as a Cloudflare Worker using the Hono framework, backed by Cloudflare D1.
    • Security Model:
      • Uses PBKDF2-HMAC-SHA256 with 100k iterations for password hashing.
      • Sessions are stored as sha256(pepper:token) to prevent session resurrection from database leaks.
      • Registration is enumeration-safe (responses do not reveal if an email already exists).
    • Authentication Methods: Supports both session cookies (for web) and Authorization: Bearer <token> headers (for CLI/desktop).
  4. Reasonix project layout and module structure

    main-v2

    The Reasonix repository is organized to support a plugin-based architecture with strict dependency directions. The core logic resides in internal/, and built-in providers/tools register themselves via side-effect imports in the main entry point.

    Directory Overview

    • cmd/reasonix/main.go: The main entry point; uses blank imports to trigger registration of built-in providers and tools.
    • cmd/reasonix-plugin-example/: A reference implementation of an MCP stdio plugin.
    • internal/cli/: Handles subcommand routing, flags, and exit codes.
    • internal/config/: Manages TOML loading with a precedence order of flag > project > user > defaults.
    • internal/provider/: Defines the Provider interface and the factory registry (e.g., openai implementation).
    • internal/tool/: Defines the Tool interface and registry (e.g., builtin tools like read_file, bash, ls).
    • internal/plugin/: An MCP-compatible stdio JSON-RPC client that adapts remote tools.
    • internal/agent/: Contains the Session and the main harness loop.
    • internal/remote/: Implements SSH transport, including port forwarding, SFTP file layers, and SSH bootstrapping.
    • internal/permission/: Manages per-call policies (allow/ask/deny).
    • internal/command/: Loads custom slash commands from .reasonix/commands/*.md files.
  5. Understand Reasonix Execution Modes

    main-v2

    Reasonix operates in several distinct modes that define how the model interacts with tools and requires user approval:

    • Ask: The default mode where the model asks for user permission before executing tools (fallback approval).
    • Auto: Automatically approves tool executions, though explicit ask or deny rules still apply.
    • YOLO (You Only Live Once): Skips most tool approvals. However, deny rules, user-defined ask questions, and plan approval prompts will still pause execution.
    • Plan: A "plan-first" workflow. The model is required to create a plan before execution. During the planning phase, MCP writers, destructive targets, and untrusted readers are hard-blocked (cannot be approved). Tools like complete_step only run after the plan is approved.
    • Goal: A persistent mode where the model continuously pursues a saved goal until it is completed, blocked, or explicitly cleared.
  6. Understand the Reasonix v1.20+ install layout

    main-v2

    Starting with v1.20, Windows and Linux use a versioned install root. The reasonix-launcher (or .exe) is a thin component that reads current.json to start the active desktop version. It does not support selecting previous versions or entering Safe Mode.

    Directory Structure:

    InstallRoot/
      reasonix-launcher[.exe]
      Reasonix.exe                 # Windows portable / Start Menu alias
      reasonix[-cli.exe]
      current.json
      versions/<version>/
        reasonix-desktop[.exe]
        reasonix-cli[.exe]
        reasonix-update-helper[.exe]
    InstallRoot/
      reasonix-launcher[.exe]
      Reasonix.exe
      reasonix[-cli.exe]
      current.json
      versions/<version>/
        reasonix-desktop[.exe]
        reasonix-cli[.exe]
        reasonix-update-helper[.exe]
  7. Use the sessionSteer extension for in-round guidance

    main-v2

    Reasonix provides an extension for in-round guidance (steering) via the _reasonix.io/session/steer method. This is not part of the core ACP spec but is available if declared in agentCapabilities._meta["reasonix.io"].sessionSteer.method.

    Usage: Call the declared method while a session/prompt is still active. The request will be persisted and either accepted into the current round or queued for the next.

    Dispositions:

    • steer_accepted: The active round has accepted the guidance.
    • queued_followup: The guidance was persisted but the current round rejected it or no active round exists; it will be applied to the next round.

    Warning: Do not call a generic session/steer. Always use the specific method name found in the capabilities metadata.

    {
      "jsonrpc": "2.0",
      "id": 2,
      "method": "_reasonix.io/session/steer",
      "params": {
        "sessionId": "session-id",
        "prompt": [
          {"type": "text", "text": "Change username to email"}
        ]
      }
    }
  8. Understand Theme Kinds and Permissions

    main-v2

    Reasonix categorizes themes into four kinds, each with different behaviors regarding editing and management:

    KindSourceEditableDeletableExportable
    Base stylesSix visual directions (Graphite, Aurora, Slate, Carbon, Nocturne, Amber)nonono
    Official themesEight read-only packs embedded in the installernonono
    User themesCreated in editor, duplicated, or imported as .reasonix-themeyesyesyes
    Plugin themesContributed by enabled plugins via Manifest v2 contributes.themesnonono

    Important Notes:

    • Reserved IDs: All 14 built-in IDs (6 base + 8 official) are reserved. Attempts to save, import, copy-over, or delete them will fail to prevent collisions.
    • Duplicating: To edit an official theme, use the "Duplicate" action. This creates an editable User theme by copying the official background into your user library.
    • Plugin Themes: These are read-only and identified by the format plugin:<plugin>:<theme>. If the plugin is uninstalled, the app preserves the ID in desktop-theme-state.json and falls back to the base style, allowing the theme to restore automatically when the plugin is reinstalled.
  9. Manage Theme Storage and State

    main-v2

    Reasonix manages themes using specific file locations:

    • desktop-theme-state.json: Stores the current theme pointer (e.g., activeThemeId, themeMode). Do not modify this file manually.
    • themes/<id>/: The user theme library where custom themes are stored (contains theme.json and up to two images).

    Theme Types and Lifecycle:

    • Base Styles: Six visual directions. Read-only.
    • Official Themes: Eight built-in themes. Read-only.
    • My Themes: Created by the user via editor, copying, or importing .reasonix-theme. Editable, deletable, and exportable.
    • Plugin Themes: Contributed by plugins via Manifest v2 contributes.themes. These are read directly from plugin directories and are not copied to the user library. They use the ID format plugin:<plugin>:<theme>.
  10. AutoResearch Completion Gate Logic

    main-v2

    In the proposed design, when a model emits [goal:complete], the controller runs an AutoResearch readiness check before allowing completion. Completion is rejected if:

    1. task_spec.json or progress.json are missing or invalid.
    2. Required success criteria lack at least one accepted evidence_id that resolves to a findings.jsonl entry.
    3. Code was changed but lacks accepted verification evidence (or an accepted reason why verification couldn't run).
    4. progress.status is currently blocked.
    5. stale_count > 0 and the final iteration did not address the stale direction with accepted evidence.

    If these checks fail, the controller returns an intercept message to the model listing missing criteria and required next actions.

  11. Understand the Extension Runtime v2 Lifecycle and Components

    main-v2

    The v2 model is built around 'Spatiotemporal Composability' using the following core abstractions:

    • RuntimeSnapshot: An immutable view of configurations and dependencies.
    • RuntimeSet / EffectScope: Represents a single generation of live resources.
    • RuntimePlan: Defines the transition from an old generation to a new one (subgraph classification).
    • RuntimeOwner: Acts as the gate for a single session lineage; manages receipts, streams, and file evidence.
    • Controller: A consumer of a published generation, bound via admission to a RuntimeOwner.

    Component States: Components transition through the following states: Inactive $\rightarrow$ Preparing $\rightarrow$ Active $\rightarrow$ Draining $\rightarrow$ Inactive (or Failed).

  12. Understand the Guardian Safety Gate Policy

    main-v2

    The Guardian acts as a safety gate that evaluates proposed actions based on conversation transcripts (evidence). It does not participate in the conversation but instead outputs a JSON verdict to determine if an action should be allowed or denied.

    When implementing or interacting with the Guardian, you must adhere to the following logic:

    Risk Levels

    • low: Routine, narrowly scoped, easy-to-reverse, no credential access, no data loss risk.
    • medium: Bounded blast radius, reversible side effects.
    • high: Dangerous or costly-to-reverse, irreversible damage or service disruption risk.
    • critical: Credential/secret exfiltration, major irreversible destruction, persistent security weakening.

    User Authorization Levels

    • high: User explicitly requested the exact action.
    • medium: User authorized the action in substance but not exact form.
    • low: Weak or ambiguous authorization.
    • unknown: No evidence the user authorized the action.

    Outcome Rules

    • Low Risk: Always allow.
    • Medium Risk: Always allow.
    • High Risk: allow only if user_authorization is medium or high. Otherwise, deny.
    • Critical Risk: Always deny.

    Special Cases:

    • Destructive actions (e.g., rm -rf outside workspace, force-push to main) are categorized as high or critical risk.
    • Exposing secrets/credentials to untrusted destinations is critical risk.
    • If a user explicitly re-approves a previously denied action, set user_authorization to high and allow.