Segment collapse failing every 5 minutes with 401 authentication errors: ``` Generic OpenAI client HTTP error: 401 - Invalid bearer token COLLAPSE FAILURE: Segment ... collapse failed ```
Scanned 5/31/2026
Install via CLI
openskills install tools-only/X-Skills# MIRA Research & Bug Fixes
## 2026-02-09: Segment Collapse Authentication Fix
### Problem
Segment collapse failing every 5 minutes with 401 authentication errors:
```
Generic OpenAI client HTTP error: 401 - Invalid bearer token
COLLAPSE FAILURE: Segment ... collapse failed
```
Segments not compressing → growing token overhead → rate limit issues
### Root Cause
Database misconfiguration in `internal_llm` table:
```sql
name: summary
endpoint_url: https://api.anthropic.com/v1/messages
api_key_name: anthropic_key
```
When `endpoint_url` is set, `LLMProvider.generate_response()` routes to `GenericOpenAIClient`, designed for OpenAI-compatible APIs. Anthropic requires different auth headers:
- OpenAI-compatible: `Authorization: Bearer {key}`
- Anthropic: `x-api-key: {key}` + `anthropic-version: 2023-06-01`
### Solution
Update database to empty string (NOT NULL constraint prevents NULL):
```python
import psycopg2
from clients.vault_client import get_database_url
admin_url = get_database_url('mira_service', admin=True)
conn = psycopg2.connect(admin_url)
cur = conn.cursor()
cur.execute("UPDATE internal_llm SET endpoint_url = '' WHERE name = 'summary';")
conn.commit()
```
Empty string evaluates to `False` in `if endpoint_url:` check (line 893 in `llm_provider.py`), triggering native Anthropic client.
### Result
✅ Segment collapse working without auth errors
✅ Memory properly compresses
✅ Reduced token overhead
### Note
This was an original configuration bug, not introduced by recent changes.
---
## Framework Token Optimization (In Progress)
### Challenge
Five philosophical frameworks total ~26,000 tokens:
- Ontological Framework: ~5,200 tokens
- Stillness Framework: ~5,200 tokens
- Negentropy Framework: ~5,200 tokens
- Resonance Framework: ~5,200 tokens
- Emergence Framework: ~5,200 tokens
Combined with memories (~8K) and conversation history, frequently exceeds Tier 1 rate limits (30K tokens/minute).
### Approach
Condense each framework to ~800 tokens while preserving core functionality. Testing with Framework 1 (Ontological) first.
No comments yet. Be the first to comment!
Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.
Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...
**Complete production-ready guide for Google Gemini embeddings API** This skill provides comprehensive coverage of the `gemini-embedding-001` model for generating text embeddings, including SDK usage, REST API patterns, batch processing, RAG integration with Cloudflare Vectorize, and advanced use cases like semantic search and document clustering. ---
Interview, source-challenge, verify, save, and ADR-gate fuzzy coding requests into Codex-ready implementation specs. Use when a feature, bugfix, refactor, migration, repo-wide change, or architecture task needs user-verified requirements, source-backed decisions, durable architecture decisions, acceptance criteria, validation commands, rollout notes, saved spec/ADR files, and a Codex execution prompt. Do not use when already fully specified or when the user wants direct implementation now.
Use when a repo needs CodeGraph plus ast-grep for Codex MCP setup, exploration, impact analysis, structural search, or safe refactor planning.