Objectif
Cette page est le compagnon lisible par machine de Configuration. La référence prose explique le pourquoi ; cette page montre la forme.
Le schéma ci-dessous est une vue en forme de JSON-Schema de la structure Config dans internal/config/config.go. Elle fait autorité pour les noms de champs, les types et les défauts — la structure Go est la source de vérité.
Forme de premier niveau
{
"$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
}
Définitions
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 (partagé par openai, openrouter, ollama)
{
"type": "object",
"properties": {
"api_key": { "type": "string" },
"model": { "type": "string" },
"base_url": { "type": "string" },
"max_tokens": { "type": "integer" }
}
}
URL de base préréglées :
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 Go contre le JSON brut d'entrée d'outil" }
}
}
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": "Chaîne de durée Go, par ex. \"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" }
}
}
Précédence
Ordre de résolution (depuis internal/config/config.go) :
- Flag CLI (via
viper.BindPFlagchez l'appelant). - Variable d'environnement (
ROUSSEAU_<UPPERSNAKE>pour toute clé ; cas spécialANTHROPIC_API_KEY). - Fichier de config (
~/.config/rousseau/config.yamlpar défaut). - Défauts codés en dur (voir
setDefaultsdansinternal/config/config.go).
Mappage vers l'environnement
Chaque champ se mappe à ROUSSEAU_<SECTION>_<KEY> en majuscules avec . remplacé par _. Exemples :
| Clé | Variable env |
|---|---|
log.level |
ROUSSEAU_LOG_LEVEL |
anthropic.api_key |
ROUSSEAU_ANTHROPIC_API_KEY (aussi ANTHROPIC_API_KEY) |
agent.max_iterations |
ROUSSEAU_AGENT_MAX_ITERATIONS |
slack.app_token |
ROUSSEAU_SLACK_APP_TOKEN |
Suite
- Configuration — référence prose avec explication de chaque bouton.
- Référence : commandes CLI — les flags surchargent chaque champ de config.
- Référence : codes de sortie — comment les erreurs de parsing de config remontent aux systèmes d'init.