fix: sync kilo.jsonc + capability-index.yaml after evolution upgrade

- kilo.jsonc: manual fix 7 agent models (sync script does not write back)
- capability-index.yaml: orchestrator model glm-5.1 → kimi-k2.6:cloud
- evolutionary-sync.md: add kilo.jsonc + capability-index.yaml manual rules
- Add cloud suffix verification and per-file verification checklist
- Document finding: sync script reads kilo.jsonc but never writes back
This commit is contained in:
¨NW¨
2026-04-27 16:49:25 +01:00
parent dbea8c90db
commit 2ae7789802
3 changed files with 161 additions and 30 deletions

View File

@@ -483,7 +483,7 @@ agents:
forbidden:
- code_writing
- code_review
model: ollama-cloud/glm-5.1
model: ollama-cloud/kimi-k2.6:cloud
variant: thinking
mode: all
delegates_to:

View File

@@ -4,34 +4,88 @@ When agents are modified, created, or updated during evolutionary improvement, t
## Source of Truth
**`kilo.json`** is the single source of truth for:
**`kilo-meta.json`** is the single source of truth for:
- Agent definitions (models, modes, descriptions)
- Command definitions (models, descriptions)
- Categories and groupings
**CRITICAL**: Also update `kilo.jsonc` manually — the sync script synchronizes `.md` frontmatters FROM `kilo-meta.json`, but does NOT write back to `kilo.jsonc`.
## Files to Synchronize
When agents change, update ALL of these files:
| File | What to Update |
|------|----------------|
| `kilo.json` | Models, modes, descriptions (source of truth) |
| `kilo-meta.json` | Models, modes, descriptions (source of truth) |
| `kilo.jsonc` | Agent model values in `"agent"` block (manual!) |
| `.kilo/agents/*.md` | Model in YAML frontmatter |
| `.kilo/capability-index.yaml` | `model:` field per agent |
| `.kilo/KILO_SPEC.md` | Pipeline Agents table, Workflow Commands table |
| `AGENTS.md` | Pipeline Agents tables by category |
| `.kilo/agents/orchestrator.md` | Task Tool Invocation table |
## Sync Checklist
## Sync Process (REQUIRED ORDER)
When modifying agents:
1. **Update `kilo-meta.json`** with new model (source of truth)
2. **Run sync script** — propagates to `.md` files:
```bash
node scripts/sync-agents.js --fix
```
3. **Manually update `kilo.jsonc`** — sync script does NOT touch this file
4. **Manually update `.kilo/capability-index.yaml`** — sync script does NOT touch this file
5. **Run sync check** — verify everything:
```bash
node scripts/sync-agents.js --check
```
6. **If violations found** → fix them, return to step 2
## Post-Sync Verification Checklist
After running `--fix`, you MUST verify:
```
□ Update kilo.json with new model/description
Update agent .md file frontmatter
Update KILO_SPEC.md Pipeline Agents table
Update AGENTS.md category tables
Update orchestrator.md subagent_type mappings (if new agent)
Run scripts/sync-agents.js --check to verify
□ `kilo.jsonc` — all 7 changed agents match kilo-meta.json
`kilo-meta.json` — no syntax errors (JSON.parse)
`.kilo/agents/*.md` — frontmatter YAML valid
`KILO_SPEC.md` — Pipeline Agents table updated
`AGENTS.md` — category tables updated
`.kilo/capability-index.yaml` — model fields updated
□ No old models leaked (grep for previous model IDs)
□ `ollama-cloud/kimi-k2.6` → always `:cloud` suffix
```
## Findings from Evolution Round 2026-04-27
### kilo.jsonc NOT synced by script
The sync script (`sync-agents.cjs`) reads `kilo.jsonc` to check for mismatches, but only WRITES to:
- `.kilo/agents/*.md` frontmatter
- `KILO_SPEC.md` tables
- `AGENTS.md` tables
**It does NOT write back to `kilo.jsonc`**. This must be done manually.
### Fix: verify kilo.jsonc after every sync
```bash
grep -n 'ollama-cloud/glm-5' kilo.jsonc # should return nothing
grep -n 'qwen/qwen3.6-plus:free' kilo.jsonc # should return nothing
grep -n 'ollama-cloud/deepseek-v3.2' kilo.jsonc # should return nothing
grep -n 'ollama-cloud/nemotron-3-super' kilo.jsonc # for changed agents only
```
### capability-index.yaml NOT synced
The capability index is not touched by sync script. After model changes, verify with:
```bash
python -c "
import yaml, json
with open('.kilo/capability-index.yaml') as f: ci = yaml.safe_load(f)
with open('kilo-meta.json') as f: meta = json.load(f)
for a in meta['agents']:
ci_m = ci.get('agents', {}).get(a, {}).get('model')
meta_m = meta['agents'][a]['model']
if ci_m and ci_m != meta_m:
print(f'MISMATCH: {a}: ci={ci_m} meta={meta_m}')
"
```
## Adding New Agent
@@ -40,9 +94,9 @@ When modifying agents:
```yaml
---
description: Agent description
mode: subagent|primary|all
mode: subagent
model: provider/model-id
color: #HEX
color: "#HEX"
permission:
read: allow
edit: allow
@@ -50,7 +104,7 @@ When modifying agents:
---
```
2. Add to `kilo.json` under `agents`:
2. Add to `kilo-meta.json` under `agents`:
```json
"agent-name": {
"file": ".kilo/agents/agent-name.md",
@@ -61,11 +115,27 @@ When modifying agents:
}
```
3. If subagent, add to `orchestrator.md`:
3. Add to `kilo.jsonc` under `agent`:
```jsonc
"agent-name": {
"description": "...",
"mode": "subagent",
"model": "provider/model-id"
}
```
4. Update `.kilo/capability-index.yaml`:
```yaml
agent-name:
capabilities: [...]
model: provider/model-id
```
5. If subagent, add to `orchestrator.md`:
- Add to permission list
- Add to Task Tool Invocation table
4. Run sync script:
6. Run sync script:
```bash
node scripts/sync-agents.js --fix
```
@@ -74,28 +144,77 @@ When modifying agents:
When changing a model:
1. Update agent file frontmatter
2. Update `kilo.json`
3. Update `KILO_SPEC.md`
4. Document reason in commit message
1. Update `kilo-meta.json` (source of truth)
2. Run `node scripts/sync-agents.js --fix`
3. **Manually update `kilo.jsonc` for all 78 changed agents**
4. **Manually update `.kilo/capability-index.yaml`**
5. Run `node scripts/sync-agents.js --check` to verify
6. Document reason in commit message
Example:
```
fix: update LeadDeveloper model from qwen3-coder:free to qwen3-coder:480b
feat: evolutionary agent model upgrades based on recommendation matrix
Reason: Better code generation quality, supports larger context
- devops-engineer: deepseek-v3.2 → kimi-k2.6:cloud (★88)
- browser-automation: glm-5 → kimi-k2.6:cloud (★86)
- ...
```
## Verification
## Cloud Model Suffix Check
Run sync verification before commits:
When using `ollama-cloud/kimi-k2.6` models, ALWAYS include `:cloud` suffix:
```yaml
# ✅ Correct
model: ollama-cloud/kimi-k2.6:cloud
# ❌ Wrong — missing cloud suffix
model: ollama-cloud/kimi-k2.6
```
Verification:
```bash
grep -r "kimi-k2\.6[^:]" .kilo/agents/ kilo-meta.json kilo.jsonc
# should return nothing
```
## Verification Commands
Run all checks before commit:
```bash
# Check only (CI mode)
# 1. JSON valid
node -e "require('./kilo-meta.json')" && echo "kilo-meta.json: OK"
# 2. Sync check
node scripts/sync-agents.js --check
# Fix discrepancies
node scripts/sync-agents.js --fix
# 3. No stale models in kilo.jsonc
grep -n "ollama-cloud/glm-5" kilo.jsonc || true
grep -n "qwen/qwen3.6-plus:free" kilo.jsonc || true
# 4. Cloud suffix check
grep -r "kimi-k2\.6[^:]" .kilo/agents/ kilo-meta.json kilo.jsonc || true
# 5. YAML frontmatter validity
python -c "
import yaml, glob, sys
errors = []
for path in glob.glob('.kilo/agents/*.md'):
with open(path) as f:
content = f.read()
if not content.startswith('---'): continue
try:
fm = yaml.safe_load(content.split('---')[1])
if not fm.get('model'):
errors.append(f'{path}: missing model')
except Exception as e:
errors.append(f'{path}: {e}')
if errors:
print('\n'.join(errors))
sys.exit(1)
print('All frontmatters valid')
"
```
## CI Integration
@@ -105,11 +224,23 @@ Add to `.github/workflows/ci.yml`:
```yaml
- name: Verify Agent Sync
run: node scripts/sync-agents.js --check
- name: Verify JSON Validity
run: node -e "require('./kilo-meta.json')"
- name: Check for stale models in kilo.jsonc
run: |
! grep -q "qwen/qwen3.6-plus:free" kilo.jsonc
! grep -q "ollama-cloud/glm-5\"" kilo.jsonc
```
## Prohibited Actions
- DO NOT update KILO_SPEC.md without updating kilo.json
- DO NOT update `KILO_SPEC.md` without updating `kilo-meta.json`
- DO NOT update agent model without updating `kilo.jsonc` manually
- DO NOT update agent model without updating `.kilo/capability-index.yaml`
- DO NOT update agent model without updating all sync targets
- DO NOT add new agent without updating orchestrator permissions
- DO NOT skip running sync script after changes
- DO NOT skip running sync script after changes
- DO NOT use `kimi-k2.6` without `:cloud` suffix
- DO NOT commit if `sync-agents.js --check` fails

View File

@@ -403,7 +403,7 @@
"browser-automation": {
"description": "Browser automation agent using Playwright MCP for E2E testing, form filling, navigation, and web interaction",
"mode": "subagent",
"model": "ollama-cloud/glm-5",
"model": "ollama-cloud/kimi-k2.6:cloud",
"permission": {
"read": "allow",
"edit": "allow",