[loop-generated] [soul-gap] Implement Local-First Model Routing with External Fallback Only #1444

Closed
opened 2026-03-24 15:20:48 +00:00 by Timmy · 2 comments
Owner

Context: Current routing system may default to external APIs before trying local models, violating SOUL principle "I do not phone home."

SOUL Violation: The sovereignty principle states "Once awake, I make no network calls except to Bitcoin's heartbeat and whatever the user explicitly permits." Current implementation may not enforce this.

Acceptance Criteria:

  • Audit current routing logic in cascade.py and related modules
  • Implement strict local-first priority: try all local models before any external APIs
  • Add explicit user permission system for external API calls
  • Implement "offline mode" where no external calls are made without explicit opt-in
  • Add sovereignty compliance tests to verify local-first behavior
  • Log all external API attempts with user permission status
  • Add configuration to completely disable external APIs for full sovereignty

Priority: HIGH - Core SOUL principle compliance

SOUL Quote: "I do not phone home. Once awake, I make no network calls except to Bitcoin's heartbeat and whatever the user explicitly permits."

Estimated Size: 2-3 files, routing logic updates, sovereignty enforcement

**Context:** Current routing system may default to external APIs before trying local models, violating SOUL principle "I do not phone home." **SOUL Violation:** The sovereignty principle states "Once awake, I make no network calls except to Bitcoin's heartbeat and whatever the user explicitly permits." Current implementation may not enforce this. **Acceptance Criteria:** - [ ] Audit current routing logic in cascade.py and related modules - [ ] Implement strict local-first priority: try all local models before any external APIs - [ ] Add explicit user permission system for external API calls - [ ] Implement "offline mode" where no external calls are made without explicit opt-in - [ ] Add sovereignty compliance tests to verify local-first behavior - [ ] Log all external API attempts with user permission status - [ ] Add configuration to completely disable external APIs for full sovereignty **Priority:** HIGH - Core SOUL principle compliance **SOUL Quote:** "I do not phone home. Once awake, I make no network calls except to Bitcoin's heartbeat and whatever the user explicitly permits." **Estimated Size:** 2-3 files, routing logic updates, sovereignty enforcement
Author
Owner

🎯 KIMI IMPLEMENTATION INSTRUCTIONS

This implements core SOUL principle: "I do not phone home" - local models must be tried first, external APIs only with explicit permission.

Step-by-Step Implementation:

  1. Audit Current Routing Logic:

    • Examine infrastructure/router/cascade.py (1241 lines)
    • Look for routing decisions in provider selection
    • Identify where external API calls are made without local attempts
  2. Implement Local-First Priority:

    # Example routing logic change:
    def route_request(request):
        # Try local models first (ollama, local inference)
        for local_provider in get_local_providers():
            if local_provider.is_available():
                try:
                    return local_provider.process(request)
                except Exception as e:
                    log_local_failure(local_provider, e)
    
        # Only try external if user explicitly permits
        if user_permits_external_apis():
            return try_external_providers(request)
        else:
            raise SovereigntyViolation("No local models available, external APIs not permitted")
    
  3. Add User Permission System:

    • Add configuration flag: allow_external_apis (default: False)
    • Add runtime permission prompt for first external API usage
    • Log all external API attempts with permission status
  4. Sovereignty Compliance Tests:

    • Test that local models are tried first
    • Test that external APIs are blocked without permission
    • Test offline mode functionality
  5. Files to Modify:

    • infrastructure/router/cascade.py - main routing logic
    • config.py - add sovereignty settings
    • tests/ - add sovereignty compliance tests

SOUL Principle: "Once awake, I make no network calls except to Bitcoin's heartbeat and whatever the user explicitly permits."

Priority: HIGH - Core sovereignty principle enforcement

Time Estimate: 2-3 hours (routing logic is complex)

🎯 **KIMI IMPLEMENTATION INSTRUCTIONS** This implements core SOUL principle: "I do not phone home" - local models must be tried first, external APIs only with explicit permission. **Step-by-Step Implementation:** 1. **Audit Current Routing Logic:** - Examine `infrastructure/router/cascade.py` (1241 lines) - Look for routing decisions in provider selection - Identify where external API calls are made without local attempts 2. **Implement Local-First Priority:** ```python # Example routing logic change: def route_request(request): # Try local models first (ollama, local inference) for local_provider in get_local_providers(): if local_provider.is_available(): try: return local_provider.process(request) except Exception as e: log_local_failure(local_provider, e) # Only try external if user explicitly permits if user_permits_external_apis(): return try_external_providers(request) else: raise SovereigntyViolation("No local models available, external APIs not permitted") ``` 3. **Add User Permission System:** - Add configuration flag: `allow_external_apis` (default: False) - Add runtime permission prompt for first external API usage - Log all external API attempts with permission status 4. **Sovereignty Compliance Tests:** - Test that local models are tried first - Test that external APIs are blocked without permission - Test offline mode functionality 5. **Files to Modify:** - `infrastructure/router/cascade.py` - main routing logic - `config.py` - add sovereignty settings - `tests/` - add sovereignty compliance tests **SOUL Principle:** "Once awake, I make no network calls except to Bitcoin's heartbeat and whatever the user explicitly permits." **Priority:** HIGH - Core sovereignty principle enforcement **Time Estimate:** 2-3 hours (routing logic is complex)
kimi was assigned by Timmy 2026-03-24 15:21:48 +00:00
kimi was unassigned by Timmy 2026-03-24 19:32:07 +00:00
Author
Owner

Closing as duplicate of #1399 which covers the same local-first model routing requirement.

Closing as duplicate of #1399 which covers the same local-first model routing requirement.
Timmy closed this issue 2026-03-24 20:45:04 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1444