sam-4screen-desktop 2026-6-13:15:5:24
This commit is contained in:
16
.obsidian/workspace.json
vendored
16
.obsidian/workspace.json
vendored
@@ -13,12 +13,12 @@
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "300 areas/350 AI/Pi Agent Extensions & Skills.md",
|
||||
"file": "100 inbox/test.md",
|
||||
"mode": "source",
|
||||
"source": false
|
||||
},
|
||||
"icon": "lucide-file",
|
||||
"title": "Pi Agent Extensions & Skills"
|
||||
"title": "test"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -181,10 +181,10 @@
|
||||
"state": {
|
||||
"type": "file-properties",
|
||||
"state": {
|
||||
"file": "300 areas/350 AI/Pi Agent Extensions & Skills.md"
|
||||
"file": "100 inbox/test.md"
|
||||
},
|
||||
"icon": "lucide-info",
|
||||
"title": "File properties for Pi Agent Extensions & Skills"
|
||||
"title": "File properties for test"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -207,17 +207,18 @@
|
||||
"templater-obsidian:Templater": false
|
||||
}
|
||||
},
|
||||
"active": "7066c9273c6fb936",
|
||||
"active": "c431d71763a4e2d5",
|
||||
"lastOpenFiles": [
|
||||
"300 areas/350 AI/Pi Agent Extensions & Skills.md",
|
||||
"100 inbox/test.md",
|
||||
"300 areas/350 AI/Moonshot AI Launches Kimi Work, a Local Desktop Agent Reportedly Running on Kimi K2.6 With a 300-Sub-Agent Agent Swarm.md",
|
||||
"200 projects/210 AI Resume/Tools.md",
|
||||
"200 projects/210 AI Resume/Local Hybrid Vector + Graph RAG Setup.md",
|
||||
"200 projects/210 AI Resume/Trigger.Dev.md",
|
||||
"200 projects/210 AI Resume/Websites pages for AI resume.md",
|
||||
"200 projects/210 AI Resume/Understand Anything.md",
|
||||
"200 projects/210 AI Resume/multica-ai.md",
|
||||
"300 areas/350 AI/Pi Agent Extensions & Skills.md",
|
||||
"000 daily/Daily Notes and To Do.md",
|
||||
"300 areas/350 AI/Moonshot AI Launches Kimi Work, a Local Desktop Agent Reportedly Running on Kimi K2.6 With a 300-Sub-Agent Agent Swarm.md",
|
||||
"100 inbox/Filesystem Consolidation Plan.md",
|
||||
"400 resources/430 Movies Books Plays Games/Hope.md",
|
||||
"100 inbox/Photo Consolidation Plan.md",
|
||||
@@ -234,7 +235,6 @@
|
||||
"300 areas/360 Dev-Ops Network Computers/Bumblebee - The Open-Source Scanner for Messy Dev Machines.md",
|
||||
"300 areas/360 Dev-Ops Network Computers/Untitled.md",
|
||||
"100 inbox/Docker Containers.md",
|
||||
"100 inbox/Home Network Overview.md",
|
||||
"Clippings",
|
||||
"Untitled.canvas",
|
||||
"500 archive/540 Resources",
|
||||
|
||||
10
100 inbox/test.md
Normal file
10
100 inbox/test.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Agent Integration Test
|
||||
|
||||
## Test Items
|
||||
- [ ] Sub-agent spawns and returns result
|
||||
- [ ] Widget shows agent activity
|
||||
- [ ] Background agent completes and notifies
|
||||
- [ ] /agents command shows agent types
|
||||
|
||||
## Dummy Data
|
||||
This is a test note created on 2026-06-13 to verify the pi-subagents system works end-to-end.
|
||||
@@ -30,14 +30,25 @@ aliases: []
|
||||
| **ask-user-question** | `~/.agents` | `ask_user_question` — LLM presents structured multiple-choice / text questions with keyboard UI |
|
||||
| **video-extract** | `~/.agents` | `video_extract` — extract frames from YouTube/local video + full Gemini analysis (requires ffmpeg + yt-dlp + GEMINI_API_KEY) |
|
||||
| **filechanges** | `~/.agents` | `/filechanges`, `/filechanges-accept`, `/filechanges-decline` — tracks every file LLM edits/writes, diff review, revert |
|
||||
| **pi-subagents** (nicopreme) | npm (global) | Spawn child Pi agents with chains, parallel execution, async dispatch. `/agents` command. Integrates with pi-prompt-template-model for delegated prompt execution |
|
||||
| **pi-prompt-template-model** | npm (global) | Model-switching prompt templates with frontmatter. See [[#Prompt Templates]] section below |
|
||||
| **pi-mcp-adapter** | npm (global) | Single proxy tool (~200 tokens) replaces hundreds of MCP tool definitions. `/mcp` command for management. Lazy server connections |
|
||||
| **pi-graphify** | `~/.agents` | Knowledge graph tools: build, query, path tracing, explain, watch, add, update |
|
||||
| **plannotator** | `~/.agents` | Interactive plan review with browser UI, annotations, code review |
|
||||
| **caveman** | `~/.agents` | Ultra-compressed communication mode |
|
||||
| **markitdown** | `~/.agents` | Convert files (PDF, Word, Excel, PPTX, images, HTML, etc.) to Markdown. Image analysis via Qwen 2.5 VL 72B on OpenRouter. |
|
||||
| **smart-router** | `~/.agents` | Dynamic prompt routing + thinking levels — analyzes intent, routes to optimal model, sets thinking level per task complexity. `/lock-model` and `/unlock-model` for manual override. Triggers Headroom compression for heavy analysis/code/devops contexts. |
|
||||
| **@tintinweb/pi-subagents** | npm (global) | 18 custom agent types, background agents, mid-run steering, session resume, worktree isolation, scheduling, cross-extension RPC |
|
||||
| **@tintinweb/pi-tasks** | npm (global) | Task management with dependency tracking, auto-cascade, background process tracking, TaskExecute spawns subagents via RPC |
|
||||
| **gentle-engram** | `~/.agents` | Memory service connecting to engram via ENGRAM_URL. Replaces memory-vault. Session capture, compaction recovery |
|
||||
| **headroom-bridge** | `~/.agents` | `compress_for_agent` tool — compresses >20K chars via Headroom Docker on .13:8787. 60-95% token reduction |
|
||||
|
||||
|
||||
### pi-subagents (@tintinweb)
|
||||
|
||||
v0.10.2, installed globally. 18 custom agent types in `~/.pi/agent/agents/` → `~/.agents/agents/`. Tools: `Agent()`, `get_subagent_result()`, `steer_subagent()`. `/agents` command for interactive management. Features: background agents with concurrency (4 default), mid-run steering, session resume, worktree isolation, scheduling, persistent widget showing live agent status. Cross-extension RPC event bus.
|
||||
|
||||
### pi-tasks (@tintinweb)
|
||||
|
||||
v0.7.0, installed globally. 7 task tools: `TaskCreate`, `TaskList`, `TaskGet`, `TaskUpdate`, `TaskOutput`, `TaskStop`, `TaskExecute`. `/tasks` command. Features: dependency tracking (blocks/blockedBy), auto-cascade, background process tracking, persistent widget. `TaskExecute` spawns subagents via RPC.
|
||||
|
||||
---
|
||||
|
||||
@@ -157,83 +168,16 @@ npq check <package> --json
|
||||
|
||||
The **npm-security** skill instructs the Pi agent to follow this workflow before any install.
|
||||
|
||||
---
|
||||
|
||||
## Smart Router
|
||||
|
||||
The smart-router extension (`~/.agents/extensions/smart-router/`) is a **prompt interceptor** that analyzes every incoming prompt and dynamically routes it to the most appropriate model based on intent. It also sets thinking levels and triggers Headroom context compression for heavy workloads.
|
||||
|
||||
### How it works
|
||||
|
||||
1. Every prompt is intercepted before the agent loop starts
|
||||
2. A fast model (`openrouter/free`) analyzes the intent
|
||||
3. The prompt is classified into tags (read, discuss, search, devops-low, devops-high, code-analysis-low, code-analysis-high, codewrite-low, codewrite-high)
|
||||
4. The router selects the optimal model + thinking level based on tag
|
||||
5. For analysis/code/devops tags, large contexts (>5K tokens) are compressed via Headroom before reaching the LLM
|
||||
6. Routing + compression status appears in the **footer status bar** (e.g. `🎯 devops-low → opencode-go/deepseek-v4-flash`, `📦 73%`)
|
||||
|
||||
### Routing table
|
||||
|
||||
| Tag | Route Key | Model | Thinking | Use case |
|
||||
|-----|-----------|-------|----------|----------|
|
||||
| `read`, `discuss`, `search` | `free-core` | `openrouter/free` | — | Reading docs, chat, web search |
|
||||
| `devops-low` | `economy-devops` | `opencode-go/deepseek-v4-flash` | — | Simple YAML, Docker, bash |
|
||||
| `devops-high` | `precision-devops` | `opencode-go/deepseek-v4-flash` | — | Complex multi-container, server crashes |
|
||||
| `code-analysis-low` | `free-core` | `openrouter/free` | — | Finding bugs in short files |
|
||||
| `code-analysis-high` | `context-heavy` | `openrouter/free` | — | Refactoring large codebases (262K context) |
|
||||
| `codewrite-low` | `economy-code` | `opencode-go/deepseek-v4-flash` | — | Boilerplate, simple functions |
|
||||
| `codewrite-high` (React) | `precision-react` | `opencode-go/deepseek-v4-pro` | `high` | Complex React/JS |
|
||||
| `codewrite-high` (other) | `precision-code-high` | `opencode-go/deepseek-v4-pro` | `high` | Complex code, dense logic |
|
||||
| Short prompts (<15 chars) | `router-eval` | `openrouter/free` | — | Quick responses |
|
||||
|
||||
### Thinking levels
|
||||
|
||||
Only set for tasks that genuinely benefit. Everything else keeps default (off):
|
||||
|
||||
| Thinking Level | Tags | Effect |
|
||||
|---|---|---|
|
||||
| (off) | `read`, `discuss`, `search`, `devops-low`, `devops-high`, `code-analysis-low`, `code-analysis-high`, `codewrite-low` | Fast, no extended reasoning |
|
||||
| `high` | `codewrite-high`, `precision-react` | Full reasoning for genuinely complex code — worth the latency and token cost |
|
||||
|
||||
### Manual override
|
||||
|
||||
```
|
||||
# Lock to a specific model (disables routing)
|
||||
/lock-model openrouter/anthropic/claude-3.5-sonnet
|
||||
|
||||
# Re-enable dynamic routing
|
||||
/unlock-model
|
||||
```
|
||||
|
||||
**Note on model ID format:** `/lock-model` takes `provider/model-id`. Some OpenRouter models include the provider prefix in their ID (e.g. `openrouter/owl-alpha` has `id = "openrouter/owl-alpha"`). The handler tries both `id` and `provider/id` to find the model.
|
||||
|
||||
### What about `/do-*` commands?
|
||||
|
||||
The `/do-*` prompt templates are **no longer needed** for model selection. The smart-router handles all routing automatically. However, `/do-img` and `/do-make-img` are still available for image analysis/generation since those use specialized tool calls rather than just model selection.
|
||||
|
||||
### Configuration
|
||||
|
||||
Model mappings are defined in `~/.agents/extensions/smart-router/index.ts`. To change routing, thinking, or compression behavior, edit the `MODELS`, `THINKING`, or `COMPRESS_TAGS` tables and run `/reload`.
|
||||
|
||||
### Files
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `~/.agents/extensions/smart-router/index.ts` | Extension source |
|
||||
| `~/.agents/extensions/smart-router/package.json` | npm deps (headroom-ai) |
|
||||
| `~/.pi/agent/extensions/smart-router/index.ts` | Synced copy |
|
||||
|
||||
---
|
||||
|
||||
## Headroom
|
||||
|
||||
Headroom is a **context compression layer** that reduces prompt token usage by 60-95% for heavy analysis/code/devops workloads. It runs as a Docker container on the server (192.168.20.13) and is selectively triggered by the smart-router.
|
||||
Headroom is a **context compression layer** that reduces prompt token usage by 60-95% for heavy analysis/code/devops workloads. It runs as a Docker container on the server (192.168.20.13) and is triggered by the headroom-bridge extension.
|
||||
|
||||
### How it works
|
||||
|
||||
1. Smart-router analyzes the prompt → determines if compression is needed
|
||||
1. headroom-bridge detects analysis/code/devops contexts
|
||||
2. Tags `read`, `discuss`, `search` **never** trigger compression (these are fast paths)
|
||||
3. For all other tags, if accumulated context exceeds ~5K tokens, the smart-router calls `compress()`
|
||||
3. For all other tags, if accumulated context exceeds ~5K tokens, headroom-bridge calls `compress()`
|
||||
4. Messages are sent to the Headroom proxy at `192.168.20.13:8787`
|
||||
5. Headroom compresses the context (using SmartCrusher for JSON, CodeCompressor for AST, Kompress-base ML for text)
|
||||
6. Compressed messages are returned and forwarded to the LLM
|
||||
@@ -244,14 +188,14 @@ Headroom is a **context compression layer** that reduces prompt token usage by 6
|
||||
```
|
||||
Desktop (.27) Server (.13)
|
||||
───────────── ────────────
|
||||
smart-router analyzes prompt headroom proxy (Docker)
|
||||
headroom-bridge headroom proxy (Docker)
|
||||
│ │
|
||||
│ if compress needed: │
|
||||
│ compress(messages) ──────────────► │
|
||||
│ compress_for_agent(content) ──────►│
|
||||
│ HTTP POST 192.168.20.13:8787 │
|
||||
│ ◄────────── compressed messages │
|
||||
│ ◄────────── compressed content │
|
||||
│ │
|
||||
│ send to LLM │
|
||||
│ return to agent │
|
||||
│ │
|
||||
│ if proxy down: pass through │
|
||||
```
|
||||
@@ -265,6 +209,10 @@ smart-router analyzes prompt headroom proxy (Docker)
|
||||
| Context ≥ 5K tokens + analysis/code/devops tag | Compress |
|
||||
| Proxy unreachable | Pass through unchanged |
|
||||
|
||||
### headroom-bridge
|
||||
|
||||
Path: `~/.agents/extensions/headroom-bridge/index.ts`. Tool: `compress_for_agent({ content })` — compresses content >20K chars via Headroom Docker on .13:8787. 60-95% token reduction. See [[#Function Calls]] for signature.
|
||||
|
||||
### Management
|
||||
|
||||
```bash
|
||||
@@ -285,10 +233,17 @@ ssh 192.168.20.13 "cd /home/sam/Docker/Containers/headroom && docker compose pul
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `~/.agents/extensions/smart-router/index.ts` | Compression logic (`compress()` import + `context` event handler) |
|
||||
| `~/.agents/extensions/headroom-bridge/index.ts` | `compress_for_agent` tool implementation |
|
||||
| `/home/sam/Docker/Containers/headroom/docker-compose.yml` | Docker service definition (on .13) |
|
||||
| `/home/sam/Docker/Containers/headroom/.env` | Environment file (on .13) |
|
||||
|
||||
|
||||
## engram + gentle-engram
|
||||
|
||||
engram v1.16.1 runs on nixos-desktop (.13) at `~/.local/bin/engram`. Systemd user service auto-starts. Binds `127.0.0.1:7437`, accessed via SSH tunnel: `ssh -fNL 7437:127.0.0.1:7437 192.168.20.13`.
|
||||
|
||||
**gentle-engram** connects via `ENGRAM_URL=http://127.0.0.1:7437`. Replaces memory-vault. Features: session capture, compaction recovery, private block redaction.
|
||||
|
||||
---
|
||||
|
||||
## MCP Servers
|
||||
@@ -337,18 +292,27 @@ pi-mcp-adapter connects Pi to external services via the Model Context Protocol.
|
||||
- Workspace map at `~/.pi/agent/memory-vault/00-system/workspace-map.json`
|
||||
- Each chat folder has isolated memory (prevents sibling directory contamination)
|
||||
|
||||
|
||||
### models.json (Provider Routing)
|
||||
|
||||
Path: `~/.pi/agent/models.json` (symlinked from `~/.agents/models.json` for Gitea). Injects OpenRouter provider routing for KV cache sharing. DeepSeek cache discount: 91.7% ($0.145/M vs $1.74/M input). Configured: deepseek, qwen, minimax, moonshotai. Mechanism: pi-core reads `model.compat.openRouterRouting` → injects `provider: { order: [...] }`.
|
||||
|
||||
### subagents.json
|
||||
|
||||
Path: `~/.pi/agent/subagents.json`. Configuration for pi-subagents agent types, default models, and providers.
|
||||
|
||||
---
|
||||
|
||||
## Useful Commands
|
||||
|
||||
| Command | What it does |
|
||||
|---|---|
|
||||
| `/lock-model <id>` | Lock routing to a specific model (e.g. `openrouter/anthropic/claude-3.5-sonnet`) |
|
||||
| `/unlock-model` | Re-enable dynamic prompt routing |
|
||||
| `/config-setup` | One-shot: creates `.pi/`, `settings.json`, memory vault in current folder |
|
||||
| `/config-add ext <name>` | Activate an extension from `~/.agents` |
|
||||
| `/config-add skill <name>` | Activate a skill from `~/.agents` |
|
||||
| `/config-show` | Show active extensions and skills |
|
||||
| `/agents` | Interactive agent management (pi-subagents) |
|
||||
| `/tasks` | Interactive task management (pi-tasks) |
|
||||
| `/memctx-init` | Scan folder, build initial memory pack |
|
||||
| `/memctx-status` | Show memory status |
|
||||
| `/memctx-refresh` | Re-scan and enrich memory |
|
||||
@@ -357,6 +321,43 @@ pi-mcp-adapter connects Pi to external services via the Model Context Protocol.
|
||||
| `/filechanges-decline` | Revert all changes |
|
||||
| `markitdown <file>` | Convert file to Markdown (PDF, Word, Excel, PPTX, images, HTML, etc.) |
|
||||
| `markitdown-vision <file>` | Describe image using Qwen 2.5 VL 72B via OpenRouter |
|
||||
| `Agent()` | Spawn subagent (pi-subagents) |
|
||||
| `get_subagent_result()` | Retrieve results from background agent |
|
||||
| `steer_subagent()` | Send mid-run steering message |
|
||||
| `compress_for_agent()` | Compress large content via Headroom |
|
||||
|
||||
|
||||
## Agent Roster (18)
|
||||
|
||||
| Agent | Model | Provider |
|
||||
|-------|-------|----------|
|
||||
| chat-search | google/gemini-2.5-flash:free | openrouter |
|
||||
| code-analysis | deepseek-r1-distill-qwen-32b | opencode-go |
|
||||
| code-ingest | google/gemini-2.5-flash:free | openrouter |
|
||||
| coder-basic | deepseek/deepseek-chat | openrouter |
|
||||
| coder-pro | deepseek/deepseek-v4-pro | openrouter |
|
||||
| database | deepseek-r1-distill-qwen-32b | opencode-go |
|
||||
| devops-basic | deepseek/deepseek-chat | openrouter |
|
||||
| devops-pro | deepseek/deepseek-v4-pro | openrouter |
|
||||
| document-writer | deepseek-r1-distill-qwen-32b | opencode-go |
|
||||
| file-ops | qwen-coder-32b-instruct | opencode-go |
|
||||
| home-automation | deepseek-r1-distill-qwen-32b | opencode-go |
|
||||
| image-maker | black-forest-labs/flux-1-schnell | openrouter |
|
||||
| iot-coder | qwen-coder-32b-instruct | opencode-go |
|
||||
| iot-hardware | moonshotai/kimi-k2.6 | openrouter |
|
||||
| obsidian | deepseek-r1-distill-qwen-14b | opencode-go |
|
||||
| research | google/gemini-2.5-flash:free | openrouter |
|
||||
| video-analyze | qwen/qwen-2.5-vl | openrouter |
|
||||
| vscode-setup | qwen/qwen-3-coder-next | openrouter |
|
||||
|
||||
## Function Calls
|
||||
|
||||
```
|
||||
Agent({ subagent_type, prompt, description, model?, thinking?, max_turns?, run_in_background?, resume?, isolated?, isolation?, inherit_context? })
|
||||
get_subagent_result({ agent_id, wait?, verbose? })
|
||||
steer_subagent({ agent_id, message })
|
||||
compress_for_agent({ content })
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -377,11 +378,18 @@ pi-mcp-adapter connects Pi to external services via the Model Context Protocol.
|
||||
## Tasks
|
||||
|
||||
- [x] Rebuild NixOS to activate new packages (Google provider, ffmpeg/yt-dlp, pi-prompt-template-model, pi-mcp-adapter, pi-subagents) ✅ 2026-06-11
|
||||
- [x] Migrate pi-subagents to @tintinweb version with 18 agent types
|
||||
- [x] Define all 18 agent types in subagents.json
|
||||
- [x] Deploy models.json with OpenRouter provider routing
|
||||
- [x] Deploy engram + gentle-engram memory service on .13
|
||||
- [x] Install pi-tasks (@tintinweb/pi-tasks) v0.7.0
|
||||
- [x] Set up Zellij layout for Pi dev environment
|
||||
- [ ] Add MCP servers to `~/.config/mcp/mcp.json` or `.mcp.json` as needed (Home Assistant, databases, etc.)
|
||||
- [ ] Run `/reload` in Pi to activate filechanges and new templates
|
||||
- [ ] Add more prompt templates to `~/.pi/agent/prompts/` as needed
|
||||
- [ ] Verify video-extract works with Gemini
|
||||
- [x] Add markitdown skill to Obsidian skills page
|
||||
- [x] Add smart-router extension and update Obsidian docs
|
||||
- [x] Deploy Headroom Docker compression on .13, integrate with smart-router
|
||||
- [x] Add markitdown skill to Obsidian skills page ✅ 2026-06-11
|
||||
- [x] Add smart-router extension and update Obsidian docs ✅ 2026-06-11
|
||||
- [x] Deploy Headroom Docker compression on .13, integrate with smart-router ✅ 2026-06-11
|
||||
- [x] Replace smart-router with headroom-bridge and update all references
|
||||
- [ ] Clean up workspace-map.json entries for any stale memory packs
|
||||
|
||||
Reference in New Issue
Block a user