Propósito
Esta página es la contraparte legible por máquina de Configuración. La referencia en prosa explica el porqué; esta página muestra la forma.
El esquema a continuación es una vista con forma de JSON Schema del struct Config en internal/config/config.go. Es autoritativa para nombres de campos, tipos y defaults: el struct Go es la fuente de verdad.
Forma de nivel superior
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"provider": { "type": "string", "enum": ["claudecli","anthropic","openai","openrouter","ollama","bedrock","vertex"], "default": "claudecli" },
"anthropic": { "$ref": "#/$defs/anthropic" },
"claudecli": { "$ref": "#/$defs/claudecli" },
"openai": { "$ref": "#/$defs/openai" },
"openrouter": { "$ref": "#/$defs/openai" },
"ollama": { "$ref": "#/$defs/openai" },
"bedrock": { "$ref": "#/$defs/bedrock" },
"vertex": { "$ref": "#/$defs/vertex" },
"log": { "$ref": "#/$defs/log" },
"state": { "$ref": "#/$defs/state" },
"agent": { "$ref": "#/$defs/agent" },
"whatsapp": { "$ref": "#/$defs/whatsapp" },
"signal": { "$ref": "#/$defs/signal" },
"telegram": { "$ref": "#/$defs/telegram" },
"matrix": { "$ref": "#/$defs/matrix" },
"slack": { "$ref": "#/$defs/slack" },
"discord": { "$ref": "#/$defs/discord" },
"sms": { "$ref": "#/$defs/sms" },
"imessage": { "$ref": "#/$defs/imessage" },
"email": { "$ref": "#/$defs/email" }
},
"additionalProperties": false
}
Definiciones
anthropic
{
"type": "object",
"properties": {
"api_key": { "type": "string" },
"model": { "type": "string", "default": "claude-sonnet-4-6" },
"max_tokens": { "type": "integer", "default": 4096 }
}
}
claudecli
{
"type": "object",
"properties": {
"binary": { "type": "string", "default": "claude" },
"model": { "type": "string" },
"permission_mode": { "type": "string", "enum": ["acceptEdits","auto","bypassPermissions","default","dontAsk","plan"] },
"extra_args": { "type": "array", "items": { "type": "string" } }
}
}
openai (compartido por openai, openrouter, ollama)
{
"type": "object",
"properties": {
"api_key": { "type": "string" },
"model": { "type": "string" },
"base_url": { "type": "string" },
"max_tokens": { "type": "integer" }
}
}
URLs base preconfiguradas:
openrouter.base_url:https://openrouter.ai/api/v1ollama.base_url:http://localhost:11434/v1ollama.api_key:not-required
bedrock
{
"type": "object",
"properties": {
"region": { "type": "string" },
"model": { "type": "string" },
"profile": { "type": "string" },
"max_tokens": { "type": "integer" }
}
}
vertex
{
"type": "object",
"properties": {
"project": { "type": "string" },
"region": { "type": "string" },
"model": { "type": "string" },
"credentials_file": { "type": "string" },
"max_tokens": { "type": "integer" }
}
}
log
{
"type": "object",
"properties": {
"level": { "type": "string", "enum": ["debug","info","warn","error"], "default": "info" },
"format": { "type": "string", "enum": ["text","json"], "default": "text" }
}
}
state
{
"type": "object",
"properties": {
"path": { "type": "string", "default": "~/.local/share/rousseau/sessions.db" }
}
}
agent
{
"type": "object",
"properties": {
"system_prompt": { "type": "string" },
"max_iterations": { "type": "integer", "default": 32 },
"skills_dir": { "type": "string" },
"approver": { "$ref": "#/$defs/approver" },
"compression": { "$ref": "#/$defs/compression" }
}
}
approver
{
"type": "object",
"properties": {
"mode": { "type": "string", "enum": ["allow_all","deny_all","pattern"], "default": "allow_all" },
"reason": { "type": "string" },
"default": { "type": "string", "enum": ["allow","deny"], "default": "deny" },
"allow": { "type": "array", "items": { "$ref": "#/$defs/pattern_entry" } },
"deny": { "type": "array", "items": { "$ref": "#/$defs/pattern_entry" } }
}
}
pattern_entry
{
"type": "object",
"properties": {
"tool": { "type": "string" },
"match": { "type": "string", "description": "Regex RE2 de Go contra el JSON en bruto de la entrada de la herramienta" }
}
}
compression
{
"type": "object",
"properties": {
"enabled": { "type": "boolean", "default": false },
"trigger_messages": { "type": "integer", "default": 60 },
"keep_recent": { "type": "integer", "default": 8 },
"prompt": { "type": "string" }
}
}
whatsapp
{
"type": "object",
"properties": {
"reply_header": { "type": "string" },
"voice": { "$ref": "#/$defs/voice" }
}
}
voice
{
"type": "object",
"properties": {
"enabled": { "type": "boolean", "default": false },
"binary": { "type": "string", "default": "whisper" },
"model": { "type": "string" },
"model_path": { "type": "string" },
"language": { "type": "string" },
"extra_args": { "type": "array", "items": { "type": "string" } }
}
}
signal
{
"type": "object",
"properties": {
"binary": { "type": "string", "default": "signal-cli" },
"account": { "type": "string" },
"extra_args": { "type": "array", "items": { "type": "string" } },
"reply_header": { "type": "string" },
"allowlist": { "type": "array", "items": { "type": "string" } }
}
}
telegram
{
"type": "object",
"properties": {
"token": { "type": "string" },
"base_url": { "type": "string" },
"reply_header": { "type": "string" },
"allowlist": { "type": "array", "items": { "type": "string" } }
}
}
matrix
{
"type": "object",
"properties": {
"homeserver_url": { "type": "string" },
"access_token": { "type": "string" },
"user_id": { "type": "string" },
"reply_header": { "type": "string" },
"allowlist": { "type": "array", "items": { "type": "string" } }
}
}
slack
{
"type": "object",
"properties": {
"app_token": { "type": "string" },
"bot_token": { "type": "string" },
"bot_user_id": { "type": "string" },
"reply_header": { "type": "string" },
"allowlist": { "type": "array", "items": { "type": "string" } }
}
}
discord
{
"type": "object",
"properties": {
"token": { "type": "string" },
"reply_header": { "type": "string" },
"allowlist": { "type": "array", "items": { "type": "string" } }
}
}
sms
{
"type": "object",
"properties": {
"provider": { "type": "string", "enum": ["twilio","vonage"] },
"from": { "type": "string" },
"account_sid": { "type": "string" },
"auth_token": { "type": "string" },
"api_key": { "type": "string" },
"base_url": { "type": "string" },
"reply_header": { "type": "string" }
}
}
imessage
{
"type": "object",
"properties": {
"base_url": { "type": "string", "default": "http://localhost:1234" },
"password": { "type": "string" },
"chat_guid": { "type": "string" },
"poll_interval": { "type": "string", "description": "Cadena de duración de Go, p. ej. \"5s\"" },
"reply_header": { "type": "string" }
}
}
email
{
"type": "object",
"properties": {
"imap_addr": { "type": "string" },
"imap_username": { "type": "string" },
"imap_password": { "type": "string" },
"mailbox": { "type": "string" },
"poll_interval": { "type": "string" },
"smtp_addr": { "type": "string" },
"smtp_username": { "type": "string" },
"smtp_password": { "type": "string" },
"from": { "type": "string" },
"reply_header": { "type": "string" }
}
}
Precedencia
Orden de resolución (de internal/config/config.go):
- Flag de CLI (vía
viper.BindPFlagen el llamador). - Variable de entorno (
ROUSSEAU_<UPPERSNAKE>para cualquier clave; caso especialANTHROPIC_API_KEY). - Archivo de configuración (
~/.config/rousseau/config.yamlpor defecto). - Defaults en el código (consulta
setDefaultseninternal/config/config.go).
Mapeo de entorno
Cada campo se mapea a ROUSSEAU_<SECTION>_<KEY> en mayúsculas con . reemplazado por _. Ejemplos:
| Clave | Variable de entorno |
|---|---|
log.level |
ROUSSEAU_LOG_LEVEL |
anthropic.api_key |
ROUSSEAU_ANTHROPIC_API_KEY (también ANTHROPIC_API_KEY) |
agent.max_iterations |
ROUSSEAU_AGENT_MAX_ITERATIONS |
slack.app_token |
ROUSSEAU_SLACK_APP_TOKEN |
Siguiente
- Configuración: referencia en prosa con explicación de cada perilla.
- Referencia: Comandos CLI: los flags sobrescriben cada campo de configuración.
- Referencia: Códigos de salida: cómo los errores de parseo de configuración se muestran a sistemas init.