Filippo D'Errigo Ideas, notes & experiments
Source Code Live

Pa Router

Pa Router
Source code github.com/fderrigo/PA-Router

A local access point for using multiple AI services, with rules for data, tools, sessions, and memory.

PA Router is a terminal application for Windows and Linux. It receives your request, prepares the context, applies the configured privacy checks and policies, and chooses among the permitted services.

You can work with Ollama models, APIs, and official agent programs without having to rebuild your entire working context every time.

The PA Router code is source-available under the PolyForm Noncommercial 1.0.0 license: use, study, modification, and redistribution are permitted within the limits set by the license. Commercial uses not covered by the license require a separate written agreement with the author.

Full license · Dependency licenses

Experimental beta

Memory retrieval has not yet reached its quality goals. It may omit useful memories or include irrelevant information. You should therefore verify the retrieved facts and the model outputs.


What it does for you

1. Brings AI services together in a single workflow

You use a single CLI and one working session to send requests to the configured services.

The registry describes each service's capabilities, where inference takes place, and the controls available. The router chooses among the services your rules allow; in the terminal you can view the available services and guide the selection.

Available integrations:

  • Ollama — local models.

  • OpenAI-compatible APIs.

  • Anthropic API.

  • Claude Code CLI.

  • Codex CLI.

  • OpenCode CLI.

The presence of an integration in the code does not mean it is already enabled or certified for every environment. Actual availability depends on the configuration, probes, observed compatibility, and policies.

The agent CLIs use their own programs, accounts, and native controls.

Personal use through a subscription remains separate from chatbot API access. The initial chatbot profile that ships with the product uses local Ollama, while the API channel excludes agents and services with subscription credentials.

2. Checks data and permissions before sending

The request and its context, including any memories and skills, go through privacy analysis before the service is chosen.

Policies determine which data and capabilities can reach specific destinations. A prohibition cannot be bypassed by choosing a faster or cheaper service.

Personal data detection with RizzoPII

To also catch data that might slip past format-based rules, PA Router optionally supports the local model RizzoPII (rizzo-pii-0.3B), developed by Simone Rizzo / Rizzo AI Academy.

The detector identifies potential entities such as:

  • First and last names.

  • Addresses.

  • Documents.

  • Italian identifiers.

  • Other potentially personal information.

The model runs locally, within the router process via ONNX, and works alongside the deterministic checks, which remain necessary for credentials and verifiable identifiers.

The model detects the data; it is PA Router's policies that determine its classification and the permitted destinations.

The integration does not correspond to the standalone RizzoPII application and does not implement its full reversible anonymization workflow.

Activation and operation

The model is disabled by default. The weights are not included in the downloads and are not downloaded while a turn is running.

To use it, the operator must:

  1. Obtain the weights from the rights holder.

  2. Convert them to the supported ONNX format.

  3. Install them in their own data directory.

  4. Enable the pii-detection service with the onnx-local adapter.

  5. Verify the configuration with pa doctor.

When the model is enabled, a scan that fails to complete is considered incomplete and blocks sending to the cloud.

Detection is nonetheless probabilistic: results must be verified before you entrust real data to the system.

Authorization and audit

Every send requires a valid authorization for the specific payload and the recording of the intent in the audit log.

Audit and telemetry use controlled metadata, intentionally excluding raw prompts and responses.

These mechanisms reduce risk, but they do not make the detection of sensitive data infallible and do not replace firewalls or operating system isolation.

3. Organizes your work into sessions

PA Router lets you:

  • Create and name sessions.

  • Resume an existing session.

  • Fork a session to explore different paths.

  • Archive completed sessions.

The router maintains a structured context and prepares the handoff to a different service, without simulating the transfer of a native session between different programs.

Persistence and encryption

The initial mode is memory_only: content is not kept as durable history.

To retain it over time, you need to enable encrypted persistence.

  • Windows: protection via DPAPI.

  • Linux: passphrase protection, requested interactively or provided via PA_ROUTER_PASSPHRASE.

4. Retrieves memory relevant to your work

The built-in memory combines lexical and vector search, using embeddings generated through a configured Ollama service.

Searches respect the project and session before retrieval. The results are then rechecked before being inserted into the request context.

Available features:

  • Memory lookup.

  • Exploration of the timeline of observations.

  • Content reindexing.

  • Selective deletion of observations through the forget functions.

Information protection

Information classified as secret is not stored. Personal or sensitive data remains confined to the session designated by the rules.

Persistent content and vectors are encrypted, while the lexical index operates in memory.

If embeddings are unavailable, the behavior is explicit and depends on the configured profile:

  • Lexical-only search.

  • Turn blocking.

There is no hidden cloud fallback for memory retrieval.

Current limitations of the beta

Memory lets you reuse context, but it has not yet reached all of its quality goals.

In particular, the beta version does not guarantee accuracy, completeness, or correct abstention by the memory system.

Passing performance tests or completing a successful build does not, by itself, demonstrate semantic reliability.

5. Reuses skills and instruction packages

PA Router lets you install packages verified through a manifest and digest, admit them into a project, and select the text skills relevant to the request.

The content of skills is again subject to privacy checks and policies.

A skill does not independently grant permissions or access to data.

Text skills remain separate from the plugins and native integrations of individual providers.

Native compatibility is not universal and cannot be inferred solely from the package name.

6. Offers automation and a local API

PA Router supports both interactive and automated use.

The CLI can receive prompts via standard input and produce responses in JSON format.

An explicitly started worker lets clients share the runtime and the store.

The pa serve command exposes an authenticated API, accessible exclusively via loopback, with:

  • Service tokens.

  • Session tokens.

  • Idempotency handling.

  • Status events.

Storage and backup

Application state is managed through embedded SQLite, with no need for a database server.

Backups include the necessary data and an integrity manifest.

The verification command checks the validity of the backup, but does not perform a restore.

Available interface

PA Router offers a CLI and an interactive terminal interface. There is no web UI in the current version.

Share
Back to the Lab