pi-monofold

Pi extension that folds multiple repositories and folders into a guarded virtual monorepo for AI agents.

Packages

Package details

extension

Install pi-monofold from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-monofold
Package
pi-monofold
Version
0.3.3
Published
Jun 6, 2026
Downloads
937/mo · 370/wk
Author
eiei114
License
MIT
Types
extension
Size
119.6 KB
Dependencies
1 dependency · 3 peers
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-monofold

CI Publish npm version npm downloads License: MIT Pi Package Trusted Publishing

Pi extension that folds multiple local repositories and folders into a guarded Virtual Monorepo for AI agents.

What this is

Pi Monofold (pi-monofold) keeps repositories physically separate while giving Pi a lightweight manifest, routed writes, workspace-aware reads, guarded commands, and explicit git flows. Documentation, rules, product context, and implementation code can appear as one connected system without migrating everything into a single git repository.

See docs/usage.md for configuration, commands, agent tools, and guard behavior.

Features

  • Virtual monorepo manifest — declare workspaces and project workspaces in .pi/monofold.yaml
  • Routed Markdown writes — route PRDs, progress notes, and other doc types to configured folders
  • Workspace-aware reads — list, read, search, and tree views scoped to readable workspaces, with bounded previews by default
  • Capability guard — block or confirm read / write / edit / grep / find / bash based on workspace tags
  • Focus presets — tag-based focus targets for the control workspace
  • Natural-language commands/monofold:explore, /monofold:write, /monofold:config, /monofold:git, and more
  • Strict agent toolsmonofold_* tools for programmatic access behind the command surface
  • Config migration — upgrade legacy .pi/monofold.yml with backups and validation

Install

Pi Monofold is a Pi package. Install it with Pi's package installer from git or npm.

Security: Pi packages run with full system access. Review packages before installing third-party code.

From git

pi install git:github.com/eiei114/pi-monofold

Project-local install:

pi install -l git:github.com/eiei114/pi-monofold

Pin a version:

pi install git:github.com/eiei114/pi-monofold@v0.3.2

Try without installing:

pi -e git:github.com/eiei114/pi-monofold

From npm

pi install npm:pi-monofold

Project-local install:

pi install -l npm:pi-monofold

Pin a version:

pi install npm:pi-monofold@0.3.2

Try without installing:

pi -e npm:pi-monofold

Quick start

  1. Install the extension (see Install).
  2. In your control repository, create .pi/monofold.yaml with at least one workspace entry (or run /monofold:init).
  3. Start Pi in the control repository and run /monofold:explore show the project workspaces.
  4. Use /monofold:write for routed Markdown outputs and /monofold:git for guarded git workflows.

Example command flows: docs/examples.md.

Usage summary

Surface Purpose
/monofold:explore List, read, search, or inspect workspace trees
/monofold:write Create routed Markdown outputs
/monofold:config Add or change workspaces and project workspaces
/monofold:git Run guarded git status, commit, push, or commit+push
/monofold:guide Interactive guide for common flows
/monofold:init Create or update .pi/monofold.yaml
/monofold:update Migrate legacy config and optionally request config edits

Agent tools (monofold_list, monofold_read, monofold_write, monofold_git, monofold_init) sit behind these commands. Full reference: docs/usage.md.

Safe read defaults

monofold_read can reach files across multiple configured workspaces. Returning full file bodies or unbounded search/tree output by default would flood the agent chat and can bias later turns. Pi Monofold therefore uses preview-first, capped-by-default reads.

monofold_read mode Default output
file Path, size, line/character counts, modified time, then a bounded preview (first 20 lines, up to 2,000 characters). Files that already fit those bounds are shown in full without a truncation marker.
search Up to 50 match lines and 8,000 characters of ripgrep output.
tree Up to 200 entries; traversal depth is capped at 5.

When output is cut, the tool response includes a [truncated] marker (file mode) or a [truncated: …] footer (search/tree) that states what was shown and how to request more.

Request more content intentionally:

Goal monofold_read parameters
Full file body mode: "file", includeContent: true
Larger bounded file slice head, tail, and/or maxChars (positive integers)
More search results Higher maxMatches and/or maxChars, or a narrower path / query
Larger directory tree Higher maxEntries, lower depth, or a narrower path

Agents should call monofold_read (not guess at raw Pi read). Humans should use /monofold:explore with natural language. Legacy slash commands such as /monofold:read apply the same caps for compatibility but are not the preferred human-facing surface—see docs/usage.md.

Package contents

pi-monofold/
├── .github/workflows/
│   ├── auto-release.yml            # Auto-tag + release on merge to main
│   ├── ci.yml                      # Validate on PR / push
│   └── publish.yml                 # Publish to npm (Trusted Publishing)
├── docs/
│   ├── usage.md                    # Config, commands, agent API, guard
│   ├── examples.md                 # Command examples
│   └── release.md                  # Release and publish flow
├── tests/
│   └── focus-preset.test.ts
├── CHANGELOG.md
├── SECURITY.md
├── focus-preset.ts
├── index.ts
├── LICENSE
├── package.json
├── README.md
├── validation.ts
└── tsconfig.json

Development

Clone and validate:

git clone https://github.com/eiei114/pi-monofold.git
cd pi-monofold
npm install
npm run check

Try the local checkout without installing:

pi -e .

Release

Releases are automated. See docs/release.md for details.

  1. Bump version in package.json and update CHANGELOG.md.
  2. Merge to main.
  3. Auto Release tags v<version> and creates a GitHub release when the tag is new.
  4. The tag triggers Publish, which publishes to npm with OIDC provenance.

Security

Pi Monofold intercepts standard Pi tool calls when monofold config is present. Writes and shell commands are allowed only when the resolved workspace grants the matching capability. Git commit/push via raw bash is blocked; use /monofold:git or monofold_git instead.

Report vulnerabilities per SECURITY.md.

Links

License

MIT