# Environment Summary Feature in DeepSeek-Reasonix: Automatic OS and Tool Context Injection

> Discover DeepSeek-Reasonix's environment summary feature. Automatically inject OS, shell, and tool context into your LLM system prompt at startup for enhanced performance.

- Repository: [YHH/DeepSeek-Reasonix](https://github.com/esengine/DeepSeek-Reasonix)
- Tags: feature-overview
- Published: 2026-08-06

---

**TLDR:** The environment summary feature in DeepSeek-Reasonix automatically injects deterministic metadata— including the operating system, shell, and explicitly declared tool paths— into the LLM's system prompt at startup when `environment.enabled` is true.

DeepSeek-Reasonix includes a built-in **environment summary** that prepends host system information to every model interaction. When the `environment.enabled` flag is set to true (the default), the engine constructs a stable context block describing the execution environment. This gives the LLM a reproducible "world view" while maintaining safety through an explicit allowlist of trusted executables.

## What Information Does the Environment Summary Capture?

The feature collects three distinct categories of system metadata:

- **OS and Architecture:** Derived from Go's `runtime.GOOS` and `runtime.GOARCH`, reporting values like `darwin`, `linux`, `windows` and `amd64`, `arm64`.
- **Shell Environment:** Detected via the `SHELL` environment variable on Unix-like systems or Windows-specific heuristics, identifying the default interactive shell (e.g., `/bin/zsh`, `/bin/bash`, `powershell`).
- **Trusted Tools:** Paths to executables explicitly declared in the `environment.tools` table of the configuration file, such as `go`, `python`, or `node`.

This deterministic approach ensures the LLM receives identical environment metadata across sessions, eliminating variability that could affect code generation or system commands.

## How the Injection Works

The implementation centers on the [`internal/config/render.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/config/render.go) file, specifically the `renderEnvironmentConfig` function. When Reasonix initializes, this function checks the `environment.enabled` setting and renders the configuration into the system prompt.

```go
// internal/config/render.go
func renderEnvironmentConfig(b *strings.Builder, cfg EnvironmentConfig) {
    b.WriteString("[environment]\n")
    enabled := true
    if cfg.Enabled != nil {
        enabled = *cfg.Enabled
    }
    // inject a stable startup environment summary into the model prompt
    fmt.Fprintf(b, "enabled = %v   # inject a stable startup environment summary into the model prompt\n", enabled)

    // ...
}

```

The boolean `enabled` flag (defaulting to `true`) controls whether the engine prepends the environment block to the LLM prompt. The structure definition resides in [`internal/config/types.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/config/types.go), which declares the `EnvironmentConfig` type containing the `Enabled` and `Tools` fields.

## Practical Configuration Examples

### Default Configuration with Tool Paths

To enable the summary and declare trusted executables, add the following to your [`reasonix.toml`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/reasonix.toml):

```toml

# reasonix.toml

[environment]
enabled = true

[environment.tools]
go = "/opt/homebrew/bin/go"
python = "/usr/local/bin/python3"

```

When active, Reasonix injects a prompt prefix similar to:

```

System environment:
- OS: darwin
- Architecture: amd64
- Shell: /bin/zsh
- Tools:
  • go = /opt/homebrew/bin/go
  • python = /usr/local/bin/python3

```

### Disabling the Summary

To suppress environment injection entirely:

```toml
[environment]
enabled = false

```

With this setting, the LLM receives only the user-provided prompt without any automatic system context.

## Safety and Reproducibility Design

The environment summary serves two critical architectural purposes:

1. **Stable Context:** By sourcing OS and architecture data from Go's runtime constants rather than dynamic system calls, the feature guarantees consistent metadata across identical hardware, ensuring reproducible LLM outputs.
2. **Execution Safety:** Only binaries listed under `environment.tools` are considered trusted. According to the **esengine/DeepSeek-Reasonix** source code, the engine never auto-executes workspace-local binaries unless explicitly declared in the configuration, preventing accidental invocation of malicious or unexpected executables.

## Summary

- The **environment summary** automatically injects OS, shell, and tool information into DeepSeek-Reasonix prompts when `environment.enabled` is true.
- System metadata comes from `runtime.GOOS`/`runtime.GOARCH` and the `SHELL` environment variable, while tool paths are user-defined in [`reasonix.toml`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/reasonix.toml).
- Implementation lives in [`internal/config/render.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/config/render.go) within the `renderEnvironmentConfig` function.
- Disabling the feature requires setting `enabled = false` in the `[environment]` configuration section.
- The explicit tool allowlist mechanism enhances security by preventing unauthorized binary execution.

## Frequently Asked Questions

### Where does DeepSeek-Reasonix read the environment configuration from?

DeepSeek-Reasonix reads environment settings from the [`reasonix.toml`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/reasonix.toml) configuration file, specifically the `[environment]` section. The [`internal/config/types.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/config/types.go) file defines the `EnvironmentConfig` structure that maps these TOML settings into the application.

### Can I customize which tools appear in the environment summary?

Yes. You explicitly define trusted tools in the `[environment.tools]` table within [`reasonix.toml`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/reasonix.toml). Only tools listed there are included in the prompt injection; Reasonix does not auto-discover executables from the system PATH.

### What happens if I disable the environment summary?

When `enabled` is set to `false`, the `renderEnvironmentConfig` function skips the injection logic, and the LLM receives prompts containing only your user-defined content without any automatic OS, shell, or tool metadata.

### Is the environment detection dynamic or static at startup?

The detection occurs once at startup. Values like OS and architecture are pulled from Go's `runtime` package constants (`GOOS`, `GOARCH`), while the shell is determined from environment variables at initialization time, creating a stable snapshot for the session duration.