@lll9p/pi-trellis-guard

Guard Trellis subagents in pi: wrap up at a turn budget, and block pi-subagents from launching trellis-* types that would skip Trellis context injection.

Packages

Package details

extension

Install @lll9p/pi-trellis-guard from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@lll9p/pi-trellis-guard
Package
@lll9p/pi-trellis-guard
Version
0.1.0
Published
Aug 27, 2026
Downloads
104/mo · 11/wk
Author
lll9p
License
MIT
Types
extension
Size
8.7 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-trellis-guard

English | 中文

A pi extension that keeps Trellis subagents on Trellis's own path:

  1. Turn budget in a Trellis child process (TRELLIS_SUBAGENT_CHILD=1). Trellis-spawned agents are full pi sessions, so they ignore pi-subagents' max_turns. Same policy as pi-subagents: steer a wrap-up at maxTurns, abort after graceTurns more.
  2. Route guard in the parent. trellis-* agent files are visible to pi-subagents. Calling them via subagent skips Trellis task-context injection. Those calls are blocked; use trellis_subagent instead.

Install

# From npm
pi install npm:@lll9p/pi-trellis-guard

# From source
pi install .

Then /reload.

Requires pi ≥ 0.84.3.

The turn-budget path only runs when the child process has TRELLIS_SUBAGENT_CHILD=1. Trellis must set that on spawn; without it, only the route guard is active.

Configuration

Project overrides global. Missing files use the default. The extension never creates these files.

.pi/extensions/pi-trellis-guard/config.json
~/.pi/agent/extensions/pi-trellis-guard/config.json
{
  "maxTurns": 100,
  "graceTurns": 5
}
Option Type Default Description
maxTurns positive integer 100 After this many turns, steer a wrap-up message. Invalid values are ignored.
graceTurns positive integer 5 Extra turns after maxTurns. Then abort. Invalid values are ignored.

Tests

bun test

License

MIT