# System Remediation 2026-06-04 (Library, Companies, Hooks, Agents)

# System Remediation — 2026-06-04 (Library, Companies, Hooks, Agents)

**Author:** John (AI Director) · **Date:** 2026-06-04 · **Trigger:** CEO inspection of ALAI tools/library/skills/hooks/MCP/companies/agents.

This page documents a tool-verified remediation sweep across four subsystems. Every fix below was verified against live tool output. Local evidence bundles are linked per section.

---

## Summary

| Category | State before | State after | Evidence |
|----------|-------------|-------------|----------|
| Library | 8 drift items, FORGE sync stale ~48 days | drift 0, FORGE 0h | `~/system/evidence/library-drift-fix-2026-06-04.md` |
| 12 Companies | dead-model routing (531 silent-fails/7d) | all model refs resolve 200 | `~/system/evidence/companies-deadmodel-fix-2026-06-04.md` |
| Hooks | 1 registered hook missing (cost-guard) | 77/77 resolve, cost-guard restored (26/26 tests) | `~/system/evidence/hooks-category-audit-2026-06-04.md` |
| Agents | 2 tax experts unrouteable | both routeable via Finverge | `~/system/evidence/agents-category-audit-2026-06-04.md` |

Inspection baseline: `~/system/evidence/system-inspection-deepdive-2026-06-04.md`.

---

## 1. Library (`library.js`)
- Architecture: global master `~/.claude/skills` → distributed to `~/companies/<Name>/`; cookbook map `~/system/library.yaml`; drift via `sync`, FORGE push via `forge-sync`.
- Fixed 6 skills with dangling `overrides:` pointing to non-existent global bases (CodeCraft api-design/api-security/database-schema; Lexicon api-documentation/compliance/legal-documentation) → removed the override pointer (became company-only).
- Created missing blueprint template `~/system/templates/scaffold/blueprints/api-backend.yaml` (codecraft-api.yaml + finverge-api.yaml extend it).
- Ran `forge-sync` (orchestrator + worker + prompt builder). Result: `sync` checked 178, drift 0, FORGE 0h.

## 2. The 12 AI Companies — dead-model routing
- Root cause: central `tier-routing.json` was remapped 2026-05-18 (devstral removed from FORGE, "531 silent-fails in 7d") but per-company `config.json` + `agents/*.yaml` + `CLAUDE.md` were never updated.
- Dead tags (404 on FORGE 10.0.0.2:11434): devstral:24b, deepseek-r1:32b, deepseek-r1:8b, qwen3:8b, qwen3-coder:32b(-hq), qwen2.5-coder:32b.
- Remap applied (intent-preserving):
  - devstral:24b / qwen3-coder:32b → **qwen3-coder:30b**
  - qwen2.5-coder:32b → **qwen2.5-coder:32b-instruct-q8_0**
  - deepseek-r1:32b → **deepseek-r1:70b**
  - deepseek-r1:8b / qwen3:8b → **qwen3:8b-q8_0**
- Scope: 12/12 config.json, 69 agent-yaml refs, 5 CLAUDE.md prose. Final: ZERO dead refs; every distinct ref re-tested 200; all JSON valid; library sync drift 0.
- Follow-up: central `ollama-fleet.json` + handbook still say devstral/qwen3-coder:latest — **MC #102949**.

## 3. Hooks
- Audited all 77 registered hooks (settings.json). One real break: `userprompt-cost-guard.sh` registered but file missing (daily-Opus cost guard silently not running).
- Recovered exact file from git (commit 4f7fda94c); 26/26 test harness PASS; re-audit 0 missing.
- Incident: running the test harness tripped the production killswitch (hook hardcodes STATE_DIR; ran against real costs.db with high Opus spend), and killswitch-gate has no self-exemption → full self-lockout; CEO disengaged via `! killswitch.sh off`.
- Design gaps → **MC #102953** (killswitch-gate self-exemption + cost-guard test env-isolation; security-reviewed).

## 4. Agents
- 66 agent .md + routing mapping (now 79 entries).
- Fixed: `ole-gjems-onstad` (NO skatterett) + `vlado-brkanic` (HR accounting/tax) were well-formed but absent from `specialist-mapping.json` → added under Finverge; routing now surfaces both (verified).
- Residuals → **MC #102954**: indy-dandev.md no frontmatter; fileless mapping entries (alem-clone, anthropic-chief-architect); stale model pins (opus-4-5, sonnet-4-5); dead-ollama refs in 5 agent bodies.

---

## Inspection anomalies (opened same session)
- **MC #102942** rebuild stale session-index.db (last build 2026-04-09)
- **MC #102943** regenerate stale product-index.json (pre-PhaseD ~/ALAI/ paths; missing SnowIT/SEO)
- **MC #102944** resolve orphan empty `~/system/skill-registry.db`
- **MC #102946** health-triage: 13 LaunchAgents non-zero exit + LightRAG 4 failed docs

## Remaining categories (not yet swept)
Skills, MCP, Mem/Knowledge, Daemons (per #102946).