sam-4screen-desktop 2026-11-5:20:51:30
This commit is contained in:
8
.obsidian/workspace.json
vendored
8
.obsidian/workspace.json
vendored
@@ -210,12 +210,14 @@
|
||||
"templater-obsidian:Templater": false
|
||||
}
|
||||
},
|
||||
"active": "7066c9273c6fb936",
|
||||
"active": "26813e16e829b798",
|
||||
"lastOpenFiles": [
|
||||
"010 inbox/AI tool to try and implement.md",
|
||||
"300 areas/350 AI Pi Coding Agent/AI tool to try and implement.md",
|
||||
"010 inbox/_sort log.md",
|
||||
"010 inbox/Basketball Team Manager.md",
|
||||
"010 inbox/Paperclip board — operator notes and key model.md",
|
||||
"010 inbox/Documentation audit — MiniMax Voice.md",
|
||||
"010 inbox/_sort log.md",
|
||||
"010 inbox/Internet Use Control — Kids' Screen Time Limits.md",
|
||||
"200 projects/Tools Software WebUI/Internet Use Control — Kids' Screen Time Limits.md",
|
||||
"200 projects/Tools Software WebUI/Graphify.md",
|
||||
@@ -237,8 +239,6 @@
|
||||
"400 Personal Family/470 Holidays Travel/Family Holiday Camping Wilsons Prom.md",
|
||||
"010 inbox/MiniMax Voice — Cloud STT and TTS with Local Fallback.md",
|
||||
"200 projects/Tools Software WebUI/MiniMax Voice — Cloud STT and TTS with Local Fallback.md",
|
||||
"300 areas/355 AI Research and Techniques/Ai memory management.md",
|
||||
"200 projects/Tools Software WebUI/Family Console.md",
|
||||
"010 inbox/Family Holiday Camping Wilsons Prom.md~",
|
||||
"010 inbox/_WATCHER",
|
||||
"300 areas/355 AI Research and Techniques",
|
||||
|
||||
@@ -20136,3 +20136,51 @@ What the watcher did, newest last.
|
||||
### 2026-10-29 06:31:53
|
||||
- **re-proposing** `Basketball Team Manager.md` — you edited it
|
||||
- **proposed** `Basketball Team Manager.md` → `200 projects/Tools Software WebUI` (folder already set — kept) (confidence 0.55)
|
||||
|
||||
### 2026-11-05 20:38:49
|
||||
- **held** `Untitled.md` — BLOCKED: untitled notes are never moved automatically. Rename it first if it is real content.
|
||||
|
||||
### 2026-11-05 20:38:59
|
||||
- **held** `Untitled.md` — BLOCKED: untitled notes are never moved automatically. Rename it first if it is real content.
|
||||
|
||||
### 2026-11-05 20:39:09
|
||||
- **held** `Untitled.md` — BLOCKED: untitled notes are never moved automatically. Rename it first if it is real content.
|
||||
|
||||
### 2026-11-05 20:39:19
|
||||
- **held** `Untitled.md` — BLOCKED: untitled notes are never moved automatically. Rename it first if it is real content.
|
||||
|
||||
### 2026-11-05 20:39:29
|
||||
- **held** `Untitled.md` — BLOCKED: untitled notes are never moved automatically. Rename it first if it is real content.
|
||||
|
||||
### 2026-11-05 20:39:39
|
||||
- **held** `Untitled.md` — BLOCKED: untitled notes are never moved automatically. Rename it first if it is real content.
|
||||
|
||||
### 2026-11-05 20:39:49
|
||||
- **proposed** `AI tool to try and implement.md` → `200 projects/260 Ideas to Build Create Make` (confidence 0.64)
|
||||
|
||||
### 2026-11-05 20:40:00
|
||||
- **re-proposing** `AI tool to try and implement.md` — you edited it
|
||||
- **proposed** `AI tool to try and implement.md` → `200 projects/260 Ideas to Build Create Make` (folder already set — kept) (confidence 0.60)
|
||||
|
||||
### 2026-11-05 20:40:30
|
||||
- **re-proposing** `AI tool to try and implement.md` — you edited it
|
||||
- **proposed** `AI tool to try and implement.md` → `200 projects/260 Ideas to Build Create Make` (folder already set — kept) (confidence 0.31)
|
||||
- - JEV was torn: bucket 'project' but folder implies 'area' — review before applying
|
||||
- - Low JEV confidence — recommend human confirmation
|
||||
|
||||
### 2026-11-05 20:41:00
|
||||
- **re-proposing** `AI tool to try and implement.md` — you edited it
|
||||
- **proposed** `AI tool to try and implement.md` → `200 projects/260 Ideas to Build Create Make` (folder already set — kept) (confidence 0.49)
|
||||
- - JEV was torn: bucket 'project' but folder implies 'area' — review before applying
|
||||
- - Low JEV confidence — recommend human confirmation
|
||||
|
||||
### 2026-11-05 20:41:11
|
||||
- **re-proposing** `AI tool to try and implement.md` — you edited it
|
||||
- **proposed** `AI tool to try and implement.md` → `200 projects/260 Ideas to Build Create Make` (folder already set — kept) (confidence 0.56)
|
||||
- - JEV was torn: bucket 'project' but folder implies 'area' — review before applying
|
||||
|
||||
### 2026-11-05 20:43:11
|
||||
- **toc follows folder** `AI tool to try and implement.md` → 100 Table of Contents/Areas.md → AI & Coding Agent
|
||||
|
||||
### 2026-11-05 20:43:21
|
||||
- **filed** `AI tool to try and implement.md` → `300 areas/350 AI Pi Coding Agent/AI tool to try and implement.md` (type area)
|
||||
|
||||
@@ -52,6 +52,7 @@ Core infrastructure: machines, containers, networks, monitoring, backups.
|
||||
- [[Pi Subagent Integration]]
|
||||
- [[Pi Agent Extensions & Skills]]
|
||||
- [[Pi Subagent]]
|
||||
- [[AI tool to try and implement]]
|
||||
|
||||
## AI Research & Techniques
|
||||
|
||||
|
||||
191
300 areas/350 AI Pi Coding Agent/AI tool to try and implement.md
Normal file
191
300 areas/350 AI Pi Coding Agent/AI tool to try and implement.md
Normal file
@@ -0,0 +1,191 @@
|
||||
---
|
||||
title: AI tool to try and implement
|
||||
type: area
|
||||
status: active
|
||||
created: "2026-11-05 20:38"
|
||||
updated: "2026-09-26"
|
||||
tags:
|
||||
- ai
|
||||
- tool
|
||||
- dev
|
||||
- framework
|
||||
- implement
|
||||
modified: "2026-11-05 20:38"
|
||||
---
|
||||
|
||||
# [[AI tool to try and implement]]
|
||||
|
||||
# Integrating Mouse-1 and Switch into an AI Engineering Stack
|
||||
|
||||
This document details how to integrate **Mouse-1** (a low-latency, System 1 decision-routing model) alongside the **Switch** framework inside your **Pi Dev (`pi.dev`)** environment.
|
||||
|
||||
---
|
||||
|
||||
## 1. Architectural Overview
|
||||
|
||||
In a production AI agent or DevOps pipeline, offloading classification, routing, and safety filtering to a frontier reasoning model (like Claude or GPT) is slow and expensive.
|
||||
|
||||
Instead, use a tiered system:
|
||||
* **System 2 (Slow/Complex):** Large frontier models handle planning, code generation, and complex reasoning.
|
||||
* **System 1 (Fast/Deterministic):** **Mouse-1** handles 100ms routing, tool gating, and error handling via fixed token probabilities.
|
||||
|
||||
|
||||
|
||||
|
||||
[Agent State / Log Output]
|
||||
│
|
||||
▼
|
||||
┌───────────────────────┐
|
||||
│ osolmaz/switch │ <-- Evaluates variables, structures payload
|
||||
└───────────┬───────────┘
|
||||
│
|
||||
▼
|
||||
┌───────────────────────┐
|
||||
│ Mouse-1 │ <-- Evaluates probability of choices in ~100ms
|
||||
└───────────┬───────────┘
|
||||
│
|
||||
[Probabilities]
|
||||
│
|
||||
▼
|
||||
┌───────────────────────┐
|
||||
│ Pi Dev Extension │ <-- Blocks tool, executes rollback, or continues
|
||||
└───────────────────────┘
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 2. Core Stack Components
|
||||
|
||||
### Mouse-1 (Decision Model)
|
||||
* **API Endpoint:** `https://mouse.dev`
|
||||
* **Pricing:** Flat \$0.10 per 1 million input tokens (outputs/probabilities are free).
|
||||
* **Primary Benefit:** Supports native LoRA fine-tuning via `/v1/calibrations` to realign routing decisions based on your unique system logs.
|
||||
|
||||
### Switch (Dynamic Router)
|
||||
* **Repository:** [osolmaz/switch](https://github.com)
|
||||
* **Primary Benefit:** A declarative routing package that maps systemic states to execution branches. It prevents messy `if/else` logic when preparing schema choices for a decision layer.
|
||||
|
||||
---
|
||||
|
||||
## 3. Implementation in Pi Dev (`pi.dev`)
|
||||
|
||||
Pi Dev uses a TypeScript extension system to intercept and gate operations. The best way to implement Mouse-1 is at the **tool lifecycle layer**, intercepting tool calls or terminal inputs before execution.
|
||||
|
||||
### File: `extensions/mouse-guard.ts`
|
||||
|
||||
```typescript
|
||||
import { Extension, ToolCallEvent } from '@earendil-works/pi-agent-core';
|
||||
|
||||
export const MouseGuardExtension: Extension = {
|
||||
name: 'mouse-guard',
|
||||
|
||||
init(context) {
|
||||
// Intercept tool execution events before they hit the operating system
|
||||
context.events.on('tool:beforeCall', async (event: ToolCallEvent) => {
|
||||
|
||||
// Bypass evaluation for safe read operations
|
||||
if (event.toolName === 'read_file') return;
|
||||
|
||||
// Extract system context for the state string
|
||||
const state = `The agent is attempting to run tool: "${event.toolName}" with args: ${JSON.stringify(event.args)}. CWD State: ${context.projectSummary}`;
|
||||
|
||||
// Define explicit, deterministic options
|
||||
const options = [
|
||||
"allow_execution",
|
||||
"block_and_request_human_review",
|
||||
"abort_with_error"
|
||||
];
|
||||
|
||||
try {
|
||||
const response = await fetch('https://mouse.dev', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${process.env.MOUSE_API_KEY}`
|
||||
},
|
||||
body: JSON.stringify({
|
||||
model: 'mouse-1',
|
||||
state: state,
|
||||
options: options
|
||||
})
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
const probabilities = data.probabilities;
|
||||
|
||||
// Human-in-the-loop gate: Block if threshold for human review exceeds 70%
|
||||
if (probabilities.block_and_request_human_review > 0.70) {
|
||||
event.cancel("Execution blocked by Mouse-1: High probability of safety or structural risk.");
|
||||
}
|
||||
} catch (error) {
|
||||
// Fail-safe open if the API fails
|
||||
console.error("Mouse-1 decision layer unreachable. Defaulting to safe-open.", error);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. Using `switch` to Structure Python Pipeline Decisions
|
||||
|
||||
When orchestrating background DevOps flows (e.g., automated error recovery, CI/CD self-healing), use `switch` to map your application states directly to dynamic payloads.
|
||||
|
||||
### File: `devops_router.py`
|
||||
|
||||
```python
|
||||
import requests
|
||||
import os
|
||||
from switch import Router
|
||||
|
||||
router = Router()
|
||||
|
||||
# Define explicit deployment branches
|
||||
@router.case("run_helm_rollback")
|
||||
def handle_rollback(log_context):
|
||||
print("Executing automatic helm rollback...")
|
||||
# os.system("helm rollback ...")
|
||||
|
||||
@router.case("trigger_slack_alert")
|
||||
def handle_escalation(log_context):
|
||||
print("Escalating critical error to engineering Slack channel...")
|
||||
|
||||
# Orchestrate the Mouse-1 lookup layer
|
||||
def evaluate_and_route(error_logs: str):
|
||||
# Dynamically extract potential options from our switch cases
|
||||
options = list(router.cases.keys())
|
||||
|
||||
payload = {
|
||||
"model": "mouse-1",
|
||||
"state": f"CI/CD Pipeline Failure. Error Logs:\n{error_logs}",
|
||||
"options": options
|
||||
}
|
||||
|
||||
headers = {
|
||||
"Authorization": f"Bearer {os.getenv('MOUSE_API_KEY')}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
# Query decision layer
|
||||
response = requests.post("https://mouse.dev", json=payload, headers=headers).json()
|
||||
probabilities = response["probabilities"]
|
||||
|
||||
# Select the branch with the highest confidence
|
||||
best_choice = max(probabilities, key=probabilities.get)
|
||||
confidence = probabilities[best_choice]
|
||||
|
||||
print(f"Mouse-1 selected branch: {best_choice} ({confidence*100:.1f}% confidence)")
|
||||
|
||||
# Route execution via switch framework if confidence hits the SLA threshold
|
||||
if confidence > 0.85:
|
||||
router.route(best_choice, error_logs)
|
||||
else:
|
||||
router.route("trigger_slack_alert", error_logs)
|
||||
|
||||
if __name__ == "__main__":
|
||||
sample_crash = "Fatal Error: OOM Killed on pod replica-abc-123. Memory limit exceeded."
|
||||
evaluate_and_route(sample_crash)
|
||||
```
|
||||
````
|
||||
Reference in New Issue
Block a user