Skip to content
alexghrPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Pact

Pact runs the Pi coding agent in isolated containers, using your host Pi credentials and custom models.

Running sessions

Build with ./shell p-build, then run ./pact daemon in a separate terminal (or as a background process). In another terminal:

./pact                      # Create and attach to an interactive session
# Enter a prompt, then press Ctrl-] to detach while it works.
./pact attach 42            # Reattach using the printed Pact session ID
./pact -d                   # Create a session without attaching yet (--detach)
./pact start -d -p "Review PR <link>" # Start work before attaching

pact start is an alias for starting a new session. Both accept workspace, model, effort, config, DinD and host-network flags. Add --prompt TEXT (or -p TEXT) to submit an initial task in the native Pi TUI, with or without --detach. Detached starts return the Pact ID without waiting for the model. Attach to the same session to inspect startup errors or continue the conversation. The initial task is not replayed on resume or native navigation. Prompt text is task input, not a Pi slash command or @file argument. Ctrl-C reaches Pi. Ctrl-] only disconnects the terminal.

Configure providers on the host in ~/.pi/agent/auth.json and ~/.pi/agent/models.json. Pact snapshots these files for every new execution; host Pi settings, extensions, and packages are not copied. API keys and ChatGPT OAuth access tokens are supported. OpenAI renewal requires Pi 1.5 or newer available as pi on the daemon's host PATH. ChatGPT credentials renew as needed, including while detached; refresh tokens never enter the container. If renewal fails, check the host network and pi auth check --provider openai, reconnect ChatGPT using host Pi /login if needed, then retry in the same conversation. No stop/resume is required for routine OpenAI renewal.

--model passes its value directly to Pi. For a custom provider named local-llama with a model named gpt-oss-20b:

./pact --model local-llama/gpt-oss-20b --hostnet

--hostnet lets Pi reach a model server bound to host loopback, such as http://127.0.0.1:8080/v1. Docker Desktop requires host networking to be enabled. Omit --model to use Pi's model selection. See Pi integration for configuration and credential lifetime details.

The daemon keeps live sessions in memory and replays up to 1 MiB of raw terminal output on attachment. Screen restoration, especially after a resize, is experimental. One terminal can attach to each session. Build and startup diagnostics appear in the daemon terminal. Stopping the daemon stops its agent containers; workspace files and saved conversations remain. There is no crash recovery. All session execution runs through the daemon.

Sessions

Run pact for an interactive session in a fresh managed workspace. Use pact -w PATH to supply an existing directory. Pact retains workspace files, private agent state, and launch settings between runs. Pact uses Nix shells behind the scense to give agents access to all the tools they need to achieve their tasks. The Nix store is shared between all Pact sessions so that storage space is used efficiently.

Each new session prints its Pact ID. Find sessions from any directory with pact sessions list, or inspect one with pact sessions show 42. Both accept --json; listing supports --workspace PATH. The catalogue defaults to ~/.local/state/pact/store.sqlite; managed workspaces default to ~/.local/state/pact/workspaces/. XDG_STATE_HOME overrides ~/.local/state. Set databasePath and workspaceRoot in ~/.config/pact/config.json (or the file selected by pact --config PATH daemon) to choose other locations:

{
  "databasePath": "~/.local/state/pact/store.sqlite",
  "workspaceRoot": "~/.local/state/pact/workspaces"
}

Relative paths resolve against the config directory. The managed workspace root must not contain the database or Pact config. For -w PATH, you choose everything exposed to the agent; Pact does not check for host config or credential files inside that directory.

The daemon selects storage locations at startup. Start clients with the same config, or another config with matching databasePath and workspaceRoot. If those paths differ, restart the daemon with the intended config.

Existing catalogues are not moved automatically. To keep an older installation, set databasePath to its existing sessions.db and workspaceRoot to its existing workspace directory. Saved sessions retain their recorded workspace locations.

A Pact session binds once to the agent's initial native conversation. Run pact resume to resume the Pact session with the most recently started execution from any directory, or pact resume 42 to select a session. If it is still running, resume reattaches to its native TUI. Otherwise, it starts a new execution using its saved model, reasoning effort, Docker-in-Docker and host-network capabilities, workspace, and private state. New executions use current host configuration for Pi, Git and MCP; --config PATH selects another config file with matching storage locations. Live reattachment keeps the execution's existing configuration. Use pact resume 42 -d to resume without attaching, then enter follow-up prompts after attaching.

Pi is the supported backend. Native /new and /resume navigation does not change the Pact session's saved backend reference. Pact does not list native threads or select the most recently used native conversation. A session with no backend reference starts its first conversation on its next run. An unavailable saved conversation causes a native resume error.

Sessions created with Codex cannot resume through Pi. Start a new session with pact -w PATH to reuse their workspace files.

The daemon records execution outcomes and removes temporary agent/DinD containers and socket volumes on exit or handled cancellation. Shared Nix storage and private session state remain. A hard crash can leave running containers and unfinished records: stop/remove stray resources manually with docker rm -f and docker volume rm before resuming. Pact does not lock writers or recover previous executions; interrupted prompts are not replayed.

Bundled skills and extensions

The container includes Graphene and its graphene-stacked-prs skill. Nix pins the CLI and skill to the same source revision in internal/images/context/agent/env/flake.lock.

Bundled skills are listed in internal/images/context/agent/env/flake.nix and exposed through /etc/pi/skills. To add or remove one, edit the skills list (and add any required tools to pact-tools), then rebuild the launcher with ./shell p-build. Bundled Pi extension entrypoints are declared in the adjacent extensions list and loaded from immutable Nix store paths. Host extensions, settings, and packages are not copied. Project extensions in .pi/extensions retain Pi's native discovery and project-trust checks.

Each agent starts in a Nix shell using its pinned toolset. Sessions share cached package outputs, while each container keeps its own tools and skills. Tool updates apply to newly started containers and do not change the daemon image.

Project skills in .agents/skills inside the Git clone remain available through Pi's normal skill discovery.

To review a PR, start pact and enter Use the review-pr skill to review https://forge.example.com/team/project/pulls/123. The bundled review skills use the target repository's review policy. Include “publish findings” to post a review through your configured forge connection. See code review for policy setup and review behavior.

Git

Configure a Git identity in ~/.config/pact/config.json. Pact keeps the private SSH key on the host and brokers Git transport and signing; the agent uses normal git clone, git commit, git fetch, and git push commands.

{
  "git": {
    "name": "Pact Agent",
    "email": "agent@example.com",
    "sshKey": "~/.ssh/pact_ed25519",
    "allowedRemotes": ["ssh://forgejo@forge.example.com/team/project"]
  }
}

Add the server's verified host key to the host's ~/.ssh/known_hosts before use. The Git broker always starts but only works when properly configured. Only the listed repositories can use the host key. Edit git.allowedRemotes on the host during a session to change access for the next Git operation. The config is refreshed from disk on every request.

After adding or changing the Git identity, the agent can run pact-git-sign --refresh inside the container, then use Git normally. The command is safe to repeat and requires no restart.

MCP

Configure MCP forwarding with named entries under mcp in your Pact config. See the MCP bridge documentation for endpoints, credentials, and tool permission regexes. Use allowedTools for automatic allowance and approvalTools for per-call decisions from an external service over a host Unix socket. Other tool calls are denied.

See the approval protocol for setup.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages