---
title: "System Prompt Customization"
description: "Customize or replace the default system prompt to tailor the agent's behavior, personality, constraints, and output style for your specific needs."
sidebar:
  label: "System Prompt"
seo:
  description: "Customize or replace the system prompt that guides agent behavior. Use CLI flags to tailor the agent's personality, constraints, and output style."
---

## Overview

The system prompt is the foundational instruction set that shapes how the agent behaves. Autohand ships with a carefully crafted default prompt, but you can customize it for specialized use cases.

There are two approaches:

- **Replace** — Swap out the entire system prompt with your own
- **Append** — Add instructions to the end of the default prompt

## Replacing the system prompt [#replace]

Use `--sys-prompt` to completely replace the default system prompt:

```bash
# Inline text
autohand --sys-prompt "You are a senior Python developer. Always use type hints and write docstrings."

# From a file
autohand --sys-prompt ./prompts/python-expert.md
```

Autohand auto-detects whether the value is a file path or inline text. See [File path detection](/working-with-autohand-code/system-prompt#file-detection) for the rules.

:::tip
**Warning:** Replacing the system prompt removes all built-in safety guidelines, tool instructions, and behavioral constraints. It also drops AGENTS.md, stored memory, the skills list and any `--append-sys-prompt` content: the replacement text is the whole prompt. Use this only when you need complete control over agent behavior.
:::

## Appending to the system prompt [#append]

Use `--append-sys-prompt` to add instructions without removing the defaults:

```bash
# Add inline instructions
autohand --append-sys-prompt "Always write tests for new functions. Prefer vitest over jest."

# Append from a file
autohand --append-sys-prompt ./prompts/team-guidelines.md
```

This is the safer option — you keep all built-in behavior while adding your own constraints on top.

## File path detection [#file-detection]

Both flags auto-detect file paths. A single-line value is treated as a path when it:

1. Starts with `./`, `../`, `/`, `~/` or a Windows drive such as `C:\`
2. Ends with `.md`, `.txt` or `.prompt`
3. Contains `/` or `\` and no spaces

Relative paths resolve from the workspace root. If the path exists, the file contents are used; the file must be under 1 MB and not empty, and a directory is an error. Any other value, including multi-line text, is used as inline text.

**Check the path:** if a value looks like a path but no file exists there, Autohand does not report an error. It sends the path itself as the prompt text, so a misspelled file name silently becomes a one-line prompt.

```bash
# These read from files:
autohand --sys-prompt ./my-prompt.md
autohand --append-sys-prompt /absolute/path/to/guidelines.txt

# These use inline text:
autohand --sys-prompt "Be concise and direct"
autohand --append-sys-prompt "Always explain your reasoning"
```

## Use cases

### Team coding standards

```bash
# Append team guidelines to every session
autohand --append-sys-prompt ./team/coding-standards.md
```

### Domain-specific assistant

```bash
# Create a specialized data engineering assistant
autohand --sys-prompt "You are a data engineering expert. Focus on SQL optimization, ETL pipelines, and data modeling. Use dbt best practices."
```

### Output formatting

```bash
# Force specific output style
autohand --append-sys-prompt "Always respond in bullet points. Keep explanations under 3 sentences."
```

### CI/CD integration

```bash
# Strict mode for automated pipelines
autohand --sys-prompt ./ci/review-prompt.md \
  --restricted \
  -p "Review staged changes for security issues"
```

## Precedence rules [#precedence]

System prompt components are assembled in this order:

1. **Base prompt**: default system prompt, including the tool capability catalog
2. **Memory**: stored memories from `/memory` and `#` entries
3. **AGENTS.md**: project-level instructions from your AGENTS.md file
4. **Skills**: available and active skills
5. **Append prompt**: content from `--append-sys-prompt`

Exact tool schemas are attached to each request separately. `--bare` skips memory and AGENTS.md; the append prompt still applies.

When using `--sys-prompt`, items 2-5 do not apply. The replacement text is used as the entire system prompt, so include any project instructions you still need in it.

:::tip
**Tip:** For most use cases, prefer `--append-sys-prompt` over `--sys-prompt`. Appending preserves the agent's built-in capabilities while adding your specific requirements.
:::
