# Config Generation Workflow

## Goal
Keep agent policy consistent and avoid drift between registry and runtime router config.

## Current Reality
- `tools/agents generate` updates:
  - `config/router_agents.json`
  - `config/crewai_agents.json`
  - `gateway-bot/agent_registry.json`
- `services/router/router-config.yml` is still runtime-critical and currently not fully regenerated from registry.

## Update Procedure
1. Edit canonical policy in `config/agent_registry.yml`.
2. Run `python3 tools/agents generate`.
3. Manually sync runtime-critical rules in `services/router/router-config.yml`:
   - llm profiles (`cloud_deepseek`, `cloud_mistral`, `cloud_grok`, local profiles)
   - per-agent routing rules (`*_agent` rules)
   - infra agents local-first constraints
4. Deploy router and run smoke:
   - infer: all top-level agents + `monitor`
   - webhook: `/telegram/webhook` + selected agent webhook
   - canary: `ops/monitor_canary_summary.sh`
5. Commit policy docs + config updates in one PR/commit set.

## Hard Rules
- No temporary code-level model policy hacks in `services/router/main.py`.
- If emergency hotfix is needed, remove it in the next stabilization commit.
