> For the complete documentation index, see [llms.txt](https://k4k3ru.gitbook.io/k4k3ru-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://k4k3ru.gitbook.io/k4k3ru-docs/agent/configuration.md).

# Configuration and Local State

K4K3RU Agent stores its configuration, account context, credentials, and update-check cache in `~/.k4k3ru`.

## Local Files

| File          | Purpose                                             | Sensitivity            |
| ------------- | --------------------------------------------------- | ---------------------- |
| `config.toml` | Optional Agent configuration                        | Normally non-sensitive |
| `state.json`  | Account ID and email used for local account context | Personal data          |
| `auth.json`   | API credentials and signing material                | Sensitive              |
| `update.json` | Cached npm update-check result                      | Non-sensitive          |

Agent creates the directory when it is required. Credential files are written with owner-only permissions.

## Credential Selection

`auth.json` can contain multiple unexpired credentials. A newly created credential becomes the default for signed requests. Agent migrates the older single-credential file format when it loads one.

The local credential list omits secrets:

```
/account api-key list
```

## Configuration Precedence

Agent resolves settings in this order:

1. Command-line options
2. `~/.k4k3ru/config.toml`
3. Built-in defaults

The production Gateway URL is built in. The `gateway.url` setting can override it for local development. Plain HTTP is accepted only for localhost and loopback IP addresses.

The `updates.check_on_startup` setting controls startup update checks.

## Update Checks

Interactive npm-managed installations check the npm `latest` version at startup. A successful result is cached for 24 hours. If the npm registry is unavailable, Agent still starts.

Update Agent with:

```bash
npm install --global k4k3ru-agent@latest
```

## Protect Local State

* Never commit the `.k4k3ru` directory or its files.
* Do not print or log `auth.json`.
* Do not attach credential files to support requests.
* Protect backups that contain `state.json` or `auth.json`.
* Do not weaken file permissions on `auth.json`.

Agent does not expose a local API. Other applications should use the public K4K3RU API and their own securely managed credentials.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://k4k3ru.gitbook.io/k4k3ru-docs/agent/configuration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
