# How PAI Integrates with Fabric: Architecture and Native Execution Patterns

> Discover how PAI integrates with Fabric, using it as an embedded prompt library for native execution. Learn about its architecture and patterns.

- Repository: [Daniel Miessler 🛡️/Personal_AI_Infrastructure](https://github.com/danielmiessler/personal_ai_infrastructure)
- Tags: architecture
- Published: 2026-02-16

---

**Personal AI Infrastructure (PAI) treats Fabric as an embedded prompt library, storing over 240 patterns locally and executing them natively without spawning the external Fabric CLI.**

The relationship between PAI and the Fabric project is that of runtime engine to knowledge base. While PAI provides the memory, routing, and self-improvement infrastructure for a personal AI assistant, Fabric supplies the domain-specific prompt patterns that encode how to perform tasks like extraction, summarization, and threat modeling. This article explores the technical architecture of how PAI embeds Fabric patterns directly into its skill system.

## What is PAI vs. Fabric?

**Personal AI Infrastructure (PAI)** is a modular, open-source framework that supplies the runtime for a personal AI assistant. It handles memory stores, skill routing, configuration management, and self-improvement loops.

**Fabric** (github.com/danielmiessler/Fabric) is an open-source collection of over 240 **prompt patterns**—reusable templates that encode "what to ask AI" for specific tasks. These patterns live as markdown files with standardized [`system.md`](https://github.com/danielmiessler/Personal_AI_Infrastructure/blob/main/system.md) entries.

PAI does not merely call Fabric as an external tool; it ingests Fabric patterns as first-class citizens of its skill ecosystem.

## How PAI Embeds Fabric Patterns

PAI integrates Fabric through a native execution model that eliminates CLI overhead for most operations.

### Local Pattern Storage

PAI maintains a **local copy** of every Fabric pattern under `~/.claude/skills/PAI/Tools/fabric/Patterns/`. This local storage ensures the assistant can read pattern definitions directly without launching the external `fabric` CLI or fetching remote resources at runtime.

According to the PAI source code in `~/.claude/skills/Prompting/Standards.md` (lines 694-698), this storage location follows a strict directory convention where each pattern resides in its own subdirectory containing a [`system.md`](https://github.com/danielmiessler/Personal_AI_Infrastructure/blob/main/system.md) file.

### Native Execution Without CLI

When a user requests a Fabric-based operation (e.g., "use fabric to summarize this article"), PAI's **Fabric skill** reads the relevant [`system.md`](https://github.com/danielmiessler/Personal_AI_Infrastructure/blob/main/system.md) file, injects the user content, and sends the composed prompt directly to the LLM.

As implemented in `~/.claude/skills/Fabric/SKILL.md` (lines 83-89), this native execution path means **no external process is spawned** for the vast majority of patterns. The skill loads the pattern content, constructs the message payload, and handles the API call internally.

## The Fabric Skill Architecture

PAI implements Fabric support as a dedicated skill with specific workflows for pattern execution and maintenance.

### ExecutePattern Workflow

The `ExecutePattern` workflow maps natural-language triggers (such as "use fabric" or "extract wisdom") to the corresponding pattern file and executes it.

According to `~/.claude/skills/Fabric/SKILL.md` (lines 42-46), this workflow handles the routing logic that connects user intent to the specific [`system.md`](https://github.com/danielmiessler/Personal_AI_Infrastructure/blob/main/system.md) file stored in the local Patterns directory. It extracts the pattern name from the user request, validates its existence, and triggers the native execution path.

### UpdatePatterns Workflow

To keep the local pattern library synchronized with upstream changes, PAI provides the `UpdatePatterns` workflow.

This workflow, referenced in the same Fabric skill documentation, performs a `git pull` operation against the upstream Fabric repository to fetch new patterns or updates to existing ones. It ensures that PAI users always have access to the latest community-contributed prompt patterns without manual intervention.

## Cross-Skill Integration

Other PAI skills leverage Fabric patterns internally to gain structured output capabilities without implementing custom prompt engineering.

As documented in `~/.claude/skills/Fabric/SKILL.md` (lines 57-63), skills such as **Research**, **Blogging**, and **Security** invoke Fabric patterns like `analyze_claims` or `create_threat_model` to process their outputs. This architecture keeps the core algorithm of each skill lightweight while delegating domain-specific prompt engineering to the Fabric library.

For example, a TypeScript skill might import the Fabric utility:

```typescript
// In a TypeScript skill file (e.g., ResearchSkill.ts)
import { runFabricPattern } from "$PAI_ROOT/skills/Fabric/Utils";

async function analyseClaims(text: string) {
  const result = await runFabricPattern("analyze_claims", text);
  // `result` now contains fact-checked claims in a structured JSON format
  return result;
}

```

This cross-skill dependency demonstrates how Fabric patterns function as shared infrastructure across the entire PAI ecosystem.

## When PAI Falls Back to Fabric CLI

While native execution is the default, PAI retains the ability to spawn the external Fabric CLI for specific edge cases.

According to `~/.claude/skills/Fabric/SKILL.md` (lines 90-95), PAI calls the external `fabric` binary when the user requires functionality that depends on Fabric's native integrations, such as **YouTube transcript extraction** (the `-y` flag) or **URL fetching** (the `-u` flag). These operations require external HTTP handling or specific CLI flags that PAI's native implementation does not replicate.

For all other patterns, the local [`system.md`](https://github.com/danielmiessler/Personal_AI_Infrastructure/blob/main/system.md) execution path remains preferred for performance and reliability.

## Summary

- **PAI is the runtime engine** that provides memory, skill routing, and self-improvement infrastructure for personal AI assistants.
- **Fabric is the prompt library** containing over 240 reusable patterns for specific AI tasks.
- **PAI stores Fabric patterns locally** under `~/.claude/skills/PAI/Tools/fabric/Patterns/` for direct access without CLI overhead.
- **Native execution** via the `ExecutePattern` workflow allows PAI to read [`system.md`](https://github.com/danielmiessler/Personal_AI_Infrastructure/blob/main/system.md) files and send composed prompts directly to the LLM.
- **Cross-skill integration** enables Research, Security, and other PAI skills to leverage Fabric patterns as shared infrastructure.
- **CLI fallback** is reserved only for Fabric features requiring external integrations like YouTube or URL fetching.

## Frequently Asked Questions

### Does PAI require the Fabric CLI to be installed?

No. PAI maintains a local copy of Fabric patterns under `~/.claude/skills/PAI/Tools/fabric/Patterns/` and executes them natively by reading the [`system.md`](https://github.com/danielmiessler/Personal_AI_Infrastructure/blob/main/system.md) files directly. The external Fabric CLI is only invoked for specific features like YouTube transcript extraction (`-y`) or URL fetching (`-u`) that require external HTTP handling.

### How does PAI keep its Fabric patterns up to date?

PAI includes an `UpdatePatterns` workflow that synchronizes the local pattern library with the upstream Fabric repository. This workflow performs a `git pull` operation to fetch new patterns or updates to existing ones, ensuring users have access to the latest community-contributed prompts without manual file management.

### Can other PAI skills use Fabric patterns internally?

Yes. Skills such as Research, Blogging, and Security invoke Fabric patterns through a shared utility interface to gain structured output capabilities. For example, the Research skill might call the `analyze_claims` pattern to fact-check content, while the Security skill uses `create_threat_model` for threat analysis. This keeps individual skills lightweight while leveraging Fabric's domain-specific prompt engineering.

### Where are the Fabric pattern files stored in PAI?

Fabric patterns are stored locally under `~/.claude/skills/PAI/Tools/fabric/Patterns/` with each pattern residing in its own subdirectory containing a [`system.md`](https://github.com/danielmiessler/Personal_AI_Infrastructure/blob/main/system.md) file. This storage location is defined in `~/.claude/skills/Prompting/Standards.md` (lines 694-698) and allows PAI to read and execute patterns without external dependencies.