Proposal: Pack Plugin Architecture #383
Replies: 3 comments 3 replies
-
|
This is excellent, well-constructed and timely; I'm working on a (personal) Pack now and thinking along the same lines. I suspect @danielmiessler has thought about this too and will opine soon. I'll review and comment in more detail when I can make time in my projects. In the meantime, some immediate reactions...
|
Beta Was this translation helpful? Give feedback.
-
|
This looks extraordinary. I'm going to have Kai look at this after we do this next release to see if we can modify the official PAI Pack system to use a system like this. I still need some help figuring out what is different from the current system, but I'm sure that will become clear as I read it deeper and have Kai find the differences. Thank you! |
Beta Was this translation helpful? Give feedback.
-
|
Packs are now the core architecture in v3.0 — they're the modular, installable unit of PAI functionality. The Pack system is live and ships with the repo. See the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey all, as Ive been developing a few packs over the last week and Ive quickly realised that this is going to be come a problem to maintain if third party packs are kept in the main repo.
Therefore I want to open up for discussion for a Pack Plugin in Architecture and have attach a possible solution for review and discussion. But main point is opening up the current architect for discussion such that it can be easily maintained as the project gains momentum.
PAI Plugin Architecture Proposal
Version: 0.1.0 (Draft)
Date: 2026-01-12
Status: Proposal - Awaiting Review
Executive Summary
This document proposes a plugin architecture for Personal AI Infrastructure (PAI) that enables third-party developers to create, distribute, and maintain packs independently of the main project repository. The goal is to shift from a "merge-to-main" model to a "publish-and-install" model while preserving the AI-first, markdown-centric design philosophy that makes PAI unique.
1. Problem Statement
Current Architecture Limitations
The existing pack system has several constraints that limit ecosystem growth:
Packs/within the main repoThe Pack Support Problem
When packs are merged into the main repository, support expectations become unclear:
Specific Support Challenges:
Desired State
2. Design Principles
Building on PAI's existing philosophy, the plugin architecture should follow these principles:
2.1 AI-First Design
2.2 Self-Contained Autonomy
2.3 Progressive Complexity
2.4 Trust but Verify
3. Proposed Architecture
3.1 Architecture Overview
3.2 Pack Distribution Channels
Channel 1: Official Packs (pai-*)
Channel 2: Community Packs (npm/GitHub)
@pai-community/<pack-name>or individual namespacesbun addor direct git cloneChannel 3: Private/Local Packs
3.3 Pack Manifest Evolution
The current README.md metadata evolves to a formal
pack.json:{ "$schema": "https://pai.dev/schemas/pack/v1.json", "name": "pai-example-skill", "version": "1.0.0", "description": "Example skill pack for PAI", "author": "developer@example.com", "license": "MIT", "pack": { "type": "skill", "apiVersion": "1.0", "platform": "claude-code", "icon": "assets/icon.png", "entry": { "skill": "src/skills/example/SKILL.md", "install": "INSTALL.md", "verify": "VERIFY.md" }, "directories": { "docs": "docs/", "examples": "examples/", "assets": "assets/" }, "capabilities": { "skills": ["example"], "hooks": ["PostToolUse"], "tools": ["example-tool"], "mcpServers": [] }, "dependencies": { "packs": { "pai-agents-skill": "^1.0.0", "pai-knowledge-system": "^1.0.0" }, "npm": { "zod": "^3.0.0" } }, "repository": { "type": "git", "url": "https://github.com/user/pai-example-skill" }, "keywords": ["osint", "investigation"], "verified": false, "deprecated": false } }4. Plugin API Contract
4.1 API Versioning
4.2 Skill API Contract
Skills must provide a
SKILL.mdwith this structure:4.3 Workflow API Contract
Workflows must follow this structure:
4.4 Hook API Contract
Hooks must export specific functions based on event type:
4.5 Tool API Contract
Tools must be TypeScript files with:
4.6 MCP Server Contract
MCP servers follow the standard MCP protocol with PAI-specific metadata:
{ "name": "pai-example-mcp", "version": "1.0.0", "protocol": "mcp", "transport": "stdio", "command": "bun", "args": ["run", "src/mcp/server.ts"], "tools": [ { "name": "example_tool", "description": "Does something", "inputSchema": { ... } } ], "resources": [ { "uri": "example://resource", "name": "Example Resource" } ] }5. Pack Resolution & Installation
5.1 Resolution Flow
5.2 Installation Commands
5.3 Pack Registry (Optional)
A lightweight registry for discovery:
5.4 Registry-Free Installation
The registry is optional. Packs can be installed directly via:
This preserves the "no central authority" philosophy while enabling discoverability for those who want it.
6. Dependency Management
6.1 Dependency Types
6.2 Dependency Resolution Strategy
6.3 Lock File
7. Security Considerations
7.1 Trust Model
7.2 Security Scanning Recommendations
7.3 Sandboxing Considerations
For untrusted packs, consider:
Note: Full sandboxing is complex and may be a future enhancement.
8. Pack Development Experience
8.1 Pack Scaffolding
Generated structure:
8.1.1 Directory Requirements
assets/- Static Assets (Required)Contains all static files for the pack including the mandatory icon.
icon.pngbanner.pngscreenshots/diagrams/docs/- Extended Documentation (Required)Contains comprehensive documentation beyond the root README.md.
QUICK_REFERENCE.mdUSER_GUIDE.mdAPI.mdTROUBLESHOOTING.mdCONTRIBUTING.mdexamples/- Usage Examples (Required)Contains runnable examples demonstrating pack capabilities.
basic/advanced/integrations/Example Format:
.md) with step-by-step instructions8.2 Development Workflow
8.3 Pack Validation
9. Migration Strategy
9.1 Phase 1: API Formalization (Non-Breaking)
pack.jsonto existing packs (alongside README metadata)9.2 Phase 2: Resolution Infrastructure
pai installcommand9.3 Phase 3: Community Enablement
9.4 Phase 4: Full Independence
9.5 Backwards Compatibility
10. Comparison with Other Systems
11. Open Questions
11.1 Registry Hosting
11.2 Verification Process
11.3 Breaking Changes
11.4 Monetization (Future)
11.5 Pack Signing
12. Implementation Estimate
13. References
Plugin Architecture Patterns
TypeScript Plugin Systems
VSCode Extension Architecture
Appendix A: Full pack.json Schema
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": ["name", "version", "description", "pack"], "properties": { "name": { "type": "string", "pattern": "^[a-z0-9-]+$", "description": "Pack identifier (lowercase, hyphens only)" }, "version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$", "description": "Semantic version (MAJOR.MINOR.PATCH)" }, "description": { "type": "string", "description": "Brief description of what the pack does" }, "author": { "type": "string", "description": "Author name or email" }, "license": { "type": "string", "description": "SPDX license identifier" }, "pack": { "type": "object", "required": ["type", "apiVersion", "platform", "icon", "entry", "directories"], "properties": { "type": { "enum": ["skill", "system", "tool", "mcp"], "description": "Pack type classification" }, "apiVersion": { "type": "string", "pattern": "^\\d+\\.\\d+$", "description": "PAI Plugin API version compatibility" }, "platform": { "enum": ["claude-code"], "description": "Target platform" }, "icon": { "type": "string", "description": "Path to pack icon (256x256 transparent PNG)", "pattern": "^assets/icon\\.png$" }, "entry": { "type": "object", "required": ["install", "verify"], "properties": { "skill": { "type": "string", "description": "Path to SKILL.md (required for skill packs)" }, "install": { "type": "string", "description": "Path to INSTALL.md wizard" }, "verify": { "type": "string", "description": "Path to VERIFY.md checklist" } } }, "directories": { "type": "object", "required": ["docs", "examples", "assets"], "properties": { "docs": { "type": "string", "description": "Path to documentation directory" }, "examples": { "type": "string", "description": "Path to examples directory" }, "assets": { "type": "string", "description": "Path to assets directory" } } }, "capabilities": { "type": "object", "properties": { "skills": { "type": "array", "items": { "type": "string" }, "description": "Skill identifiers provided by this pack" }, "hooks": { "type": "array", "items": { "type": "string" }, "description": "Hook event types this pack registers" }, "tools": { "type": "array", "items": { "type": "string" }, "description": "Tool names provided by this pack" }, "mcpServers": { "type": "array", "items": { "type": "string" }, "description": "MCP server names provided by this pack" } } }, "dependencies": { "type": "object", "properties": { "packs": { "type": "object", "description": "Required PAI pack dependencies with semver ranges" }, "npm": { "type": "object", "description": "Required npm package dependencies" }, "optional": { "type": "object", "description": "Optional dependencies for enhanced functionality" }, "peer": { "type": "object", "description": "Peer dependencies user must install separately" } } }, "repository": { "type": "object", "properties": { "type": { "type": "string" }, "url": { "type": "string", "format": "uri" } }, "description": "Source repository information" }, "keywords": { "type": "array", "items": { "type": "string" }, "description": "Search keywords for registry discovery" }, "verified": { "type": "boolean", "description": "Whether pack has been verified by PAI maintainers" }, "deprecated": { "type": "boolean", "description": "Whether pack is deprecated" } } } } }Appendix B: Icon Specification
Requirements
assets/icon.png(mandatory path)Design Guidelines
Icon Validation
The
pai validatecommand checks:assets/icon.pngOptional Assets
assets/banner.pngassets/screenshots/*.pngassets/diagrams/*.pngAppendix C: CLI Command Reference
End of Proposal
This document is a living proposal. Feedback and contributions welcome.
Beta Was this translation helpful? Give feedback.
All reactions