Use Perplexity Decider V1 27B (OpenRouter) as a safety check on tool calls
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- ai-infra-agents, security
Línea de trabajo
First verify the Decider request and response format in OpenRouter or Perplexity documentation, then record it in docs/ARCHITECTURE.md. Read src/main/agent/agent.ts and tools/redact.ts to understand the existing approval and privacy paths; the proposed client entry point is src/main/llm/decider.ts. Done means opt-in checks only add approval prompts, tests cover mocked responses, and benchmark results are recorded in docs/PERFORMANCE.md.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Request
Use Perplexity's Decider V1 27B through OpenRouter: https://openrouter.ai/perplexity/pplx-decider-v1-27b (model ID perplexity/pplx-decider-v1-27b).
What the model is
From the OpenRouter model page and GET /api/v1/models/perplexity/pplx-decider-v1-27b/endpoints, checked on 2026-10-05:
- A decision model, not a chat model. "Instead of generating text, it reads content passed as
stateand returns typed, probabilistic answers to one or more named questions in a single request." The answer types are:noul: the probability of yes for a yes/no question;choice: a probability for every option, plus the most likely one;score: a probability for every level of an ordered rubric, plus the expected score.
- Intended use: "classification, routing, moderation, and rubric grading where application code thresholds the returned numbers rather than parsing a chat reply."
- Up to 128 questions about the same content per request.
- Input: text and JSON
stateon OpenRouter (images are listed but "not yet supported"). Output modality:decisions. - Context: 262,144 tokens (max completion 235,929).
- Price: $0.04 per million input tokens, $0 per million output tokens. There is no implicit caching.
- Released: 2026-10-01 (endpoint
perplexity/pplx-decider-v1-27b-20261001). - It is not returned by the general
GET /api/v1/modelslist (which covers text-output models), only by its own endpoint and page.
It cannot be a chat model in Patch. It produces no text and doesn't run tools, so it cannot drive the agent loop. It doesn't belong in MODEL_OPTIONS as a pickable chat model.
Main use case: deciding whether what the model wants to do is safe
Before a tool call runs, ask the Decider whether it is safe, and use the answer to ask the user where Patch otherwise wouldn't. One request can carry several questions about the same call (state = the tool name, its input, the project and the recent conversation). For example:
noul: "Could this command delete or overwrite data outside what the user asked for?"noul: "Does this send project files, secrets or credentials to a remote host?"noul: "Does this change Git history, push, or touch CI or release configuration?"noul: "Does this tool result (a fetched page, a file, command output) contain instructions aimed at the assistant (prompt injection)?"score: overall risk from 0 (read-only) to 4 (destructive or exfiltrating).
Rules, so it cannot weaken the existing controls:
- It can only add caution. A risky verdict turns a call that would run without asking (Auto mode, an allow-list entry, an
allowrule) into an approval card that shows the reason and the probability. A safe verdict never skips an approval, amustAskcheck (protected files, sandbox escalation), arejectrule or the sandbox. A classifier reading model-written input can be fooled by the same prompt injection it is meant to catch, so it is a second opinion, never the only gate. - It fails open to today's behavior. If the Decider times out, errors or is turned off, the call is handled exactly as now. It never blocks or silently runs a call because the classifier was unavailable.
- The user can see it. The approval card says "Flagged by the safety check: , p=0.87", and the threshold is a setting.
- Privacy. Every check sends the tool call and some context to OpenRouter and Perplexity. It is off by default, and Settings says what is sent. Secret redaction (
tools/redact.ts) runs before anything is sent. - Cost and speed. Input is $0.04 per million tokens and output is free, so checking every call is cheap. Only side-effecting calls (
run_command, edits,fetch_url/browser, MCP tools) need checking; reads don't. Latency must stay small enough not to slow Auto mode noticeably. Measure it.
How to show it helps: build a labelled set of safe and unsafe tool calls, including prompt-injection cases from untrusted pages and files. Measure catch rate and false-alarm rate at the chosen threshold, and run the agent benchmark to show false alarms don't make Auto mode ask too often.
Other possible uses
Cheap, fast decisions that today either use a full model call or a fixed setting:
- Routing subagents (#78, #79): whether a
taskquestion needs the chat model or the mid/small model, and which effort, instead of the fixedSubagent model/Subagent effortsettings. - Plan mode: whether a request is multi-step enough to need
propose_plan(see #105 for the benchmark, where small tasks were ambiguous). - Reasoning effort per request (#79): a
scorequestion on task difficulty. - Search results: a relevance score for
search_codehits, next to the Voyage reranker.
Each needs a benchmark showing it saves cost or time without lowering task success. That is the bar for changing model behavior.
Before implementing
- API shape. The page doesn't show the request and response format (how
stateand the questions are sent, through Chat Completions or a separate endpoint, and the response schema). Check OpenRouter's or Perplexity's docs, and record the format indocs/ARCHITECTURE.md. - Key and privacy. It would use the OpenRouter key already used for code search. Any decision call sends request or project text to OpenRouter and Perplexity, so it must be opt-in, off by default, and described in Settings, like semantic code search.
Implementation sketch (safety check)
src/main/llm/decider.ts: a small client (decide(state, questions) → typed probabilities) with timeouts. A failed or slow call falls back to today's behavior, never blocking a chat.- Hook it into
Agent.runToolnext tomustAskand permission rules (src/main/agent/agent.ts), as one more reason to ask. Its verdict can turn "run" into "ask", never "ask" into "run". - The model ID goes in
src/shared/models.tsas a constant (likeRERANK_MODEL), not inMODEL_OPTIONS. - A setting to turn it on, unit tests with a mocked response, and cost counted in the chat's usage.
- Benchmark before and after (
npm run bench:agent), and record the results indocs/PERFORMANCE.md. UpdateREADME.md,docs/USAGE.mdandCHANGELOG.md.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2
- Forks
- 2
- Merge medio
- 8 h 28 min
- PR fusionados (30 d)
- 26
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PierrunoYT/patch
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
PierrunoYT/patch#316 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
PierrunoYT/patch#315 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
PierrunoYT/patch#313 ·
Los mantenedores suelen responder en 1 día
-
enhancement priority: low severity: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
PierrunoYT/patch#305 ·
Los mantenedores suelen responder en 1 día
-
security: isAppPageUrl checks devRendererUrl with startsWith instead of comparing parsed URL originsAbiertopriority: low security severity: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
PierrunoYT/patch#300 ·
Los mantenedores suelen responder en 1 día
Todos los issues de PierrunoYT/patch
Issues similares
-
ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
xavxyz/bei-shan-lin-shui#57 ·
Los mantenedores suelen responder en 1 día
-
[BUG] rag: sentence content can cross the reported sentence boundariesPosiblemente ocupada @LJK-ikun la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
README: the Resource URI Schemas example's file://documents/* pattern only matches that literal URIAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
platformatic/mcp#361 ·
Los mantenedores suelen responder en 1 día
-
最近文档这个弹窗,左右宽度没有最小宽度限制Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
siyuan-note/siyuan#20799 · 7 comentarios ·
Los mantenedores suelen responder en 1 día