← All posts

Building on Giants: How Daniel Miessler's PAI Became My Foundation

I'd been building my AI infrastructure for months before I found a name for it. I had a CLAUDE.md with operating modes, a folder of skills, a deploy script that pushed everything to multiple machines.

  • claude-code
  • ai
  • pai
  • open-source
  • architecture
  • personal-ai

I found PAI the way you find out someone else already named the thing you’ve been calling “that config folder.”

I was on my third rebuild of a CLAUDE.md that had gotten too long to scan — again. I had a skills/ directory I’d been filling with markdown files that told Claude Code how to run specific workflows. I had a bash script called push-config.sh that rsynced the whole mess to my other machines. It worked, mostly. Sometimes a machine would drift and I wouldn’t notice until I asked Claude to do something and got a blank stare.

Then I landed on Daniel Miessler’s Personal AI Infrastructure repo and read through the README. Operating modes. A skill system. Memory structures. An opinionated CLAUDE.md layout. I had built fragments of every single one of these — modes I’d called “quick” and “full,” skills I’d organized differently on every machine, a memory approach that was really just me dumping context into markdown files and hoping I’d find them later.

PAI gave me the vocabulary and the shape. More than that — it told me I wasn’t crazy for wanting Claude Code to behave like a persistent environment instead of a per-session scratchpad.

This post walks through what I kept from PAI, what I built on top of it, and why I open-sourced the result.

A layered diagram showing PAI as the foundation, with deployment infrastructure and agent stack stacked on top

What PAI Gives You

PAI is a framework for wiring Claude Code into a personal AI operating system. Not a SaaS, not a wrapper — just a set of conventions for organizing config files that Claude reads every time it starts.

The core pieces:

  • Operating modes — Every response uses one of three formats: NATIVE (a quick task, a few lines), ALGORITHM (multi-step work with phases and verification), or MINIMAL (acknowledgments). Sounds cosmetic. It isn’t. Before modes, I’d ask Claude a yes/no question and get back a design document. Modes enforce the right level of effort for the ask.
  • Skill system — User-level skills live in ~/.claude/skills/ and load automatically in every project. A skill is a markdown file, not a script. It tells Claude how to do something the same way every time. Write it once, it’s available everywhere.
  • Memory — GCC-style memory (COMMIT, BRANCH, MERGE, CONTEXT) lets the AI carry reasoning across sessions without dumping files into your project repo. If you’ve ever explained the same architectural decision to Claude three times in three different sessions, you know why this matters.
  • Algorithm v3.5 — A 7-phase execution loop (OBSERVE → THINK → PLAN → BUILD → EXECUTE → VERIFY → LEARN). Complex tasks stop being “Claude, fix this” and start being trackable work with checkpoints.

What PAI deliberately leaves out: a way to manage all of this config across multiple machines, version it in git, or deploy it automatically when you change something.

I hit that gap within about four days.

What I Added: The Deployment Layer

Here’s the problem: I use Claude Code on four machines — a Mac, a Linux devbox, a production server, and a playground box. I’d edit a skill on my Mac, push it to one machine manually, forget to push it to the others, and then wonder why Claude behaved differently on devbox than on the Mac.

The claude-agent-stack repo fills the gap with three pieces:

LayerWhat it does
Git versioningAll config in one repo — skills, hooks, agents, CLAUDE.md
deploy.shRsync to local and remote machines on demand
GitHub Actions CIPush to main → runners on each remote machine auto-deploy

The deploy mechanism is intentionally boring. deploy.sh is ~90 lines of bash. I didn’t reach for Ansible, Docker, or anything that would need its own maintenance. It rsyncs skills, hooks, agents, and CLAUDE.md to ~/.claude on whatever machines you point it at. Remote machines run self-hosted GitHub Actions runners — little background processes that watch the repo and trigger ./deploy.sh remote <host> on every push to main. My Mac just runs ./deploy.sh local when I want immediate sync.

The payoff: every machine gets identical skills, identical hooks, identical CLAUDE.md. If a skill breaks something, git revert unwinds it from the whole fleet. No drift, no “wait, which machine has the updated version?”

What I Added: The 4-Layer Agent Stack

Beyond deployment, the config layers an opinionated architecture for building reusable automation. I wrote about the four-layer model in the previous post.

how the deployment mechanism actually works give me the detail

The four layers map onto real primitives you already know:

Skills       ~/.claude/skills/<name>/SKILL.md   — markdown loaded into context
Agents       ~/.claude/agents/<name>.md          — scoped Claude personas/workflows
Commands     ~/.claude/commands/<name>.md        — slash-commands Claude executes
Justfile     project-root/justfile               — human entry point (just ui-review)

Deploy loop: deploy.sh is ~90 lines of bash wrapping rsync -av --delete. It targets ~/.claude/ on each machine via SSH. Self-hosted GitHub Actions runners on each remote box listen on main — a push event triggers ./deploy.sh remote <host>, so all machines converge within seconds of a git push. No Ansible, no Docker, no Kubernetes — just rsync and a runner process.

Why this holds up: skills are pure markdown, so the “install” is a file copy. Claude Code reads ~/.claude/skills/ at session start; there’s nothing to compile or restart. The whole pipeline is:

# add a skill, deploy everywhere
cp new-skill.md ~/.claude/skills/
git add -A && git commit -m "add: new-skill" && git push
# runners on each box: rsync fires, skill is live next session

Try it: clone the claude-agent-stack, run ./deploy.sh local, then open Claude Code and type / — your new commands appear immediately. Skills registered this way survive project switches and machine reboots because they live in the user config dir, not a project.

The Playwright-based playwright-bowser skill is a good concrete example: the skill markdown describes how Claude should invoke Playwright (via a CLI wrapper), so the model gains browser automation without any API key — just a Node package and a skill file.

PAI defines the skill layer. The four-layer model fills in agents, commands, and the human entry point. The deployment system makes the whole thing consistent across machines.

The Synthesis

Here’s the full stack, laid out flat:

ComponentSourceWhat it provides
NATIVE/ALGORITHM modesDaniel Miessler’s PAIConsistent response structure
Skill system designDaniel Miessler’s PAIUser-level skills that load everywhere
Algorithm v3.5Daniel Miessler’s PAI7-phase structured execution
Skills → Agents → Commands modelIndie DevDanComposable automation architecture
deploy.sh + GitHub Actions CIThis repoMulti-machine consistency via git
27 custom skillsThis repoBugBot, DevFlow, BlogWriter, etc.

PAI alone doesn’t get you here. PAI is the operating system for the AI’s brain. The 4-layer model adds the muscle — structured ways to build and invoke automation. The deployment layer is the memory across machines.

Exactly one of these three pieces was original work. The other two were about recognizing good ideas and wiring them together.

Why Open-Source?

The private repo has things that only make sense on my network: machine hostnames, internal service URLs, skills wired to my specific infrastructure. The public version strips every private detail and keeps what’s reusable: a CLAUDE.md template you can adapt, a sanitized deploy.sh, and 27 skills that work in any context.

My reason for publishing it is simple. If this setup saves you the weekend I burned figuring out the wiring, that’s worth it. PAI is public. The 4-layer model is public. The deployment layer — the piece that makes it all survive across machines — was the missing link in both resources.

If you build something on top of it, I genuinely want to hear about it. The interesting work isn’t in running someone else’s skills. It’s in how you adapt them to your stack, which commands you write for your workflows, what your justfile looks like after six months of real use.

Production Details

  • Install PAI first. Run danielmiessler/Personal_AI_Infrastructure and use it for a week before you add a deployment layer. You’ll learn which pieces you actually reach for and which ones you don’t.
  • Template, don’t fork. The public repo is a starting point, not a product you install and leave alone. Your CLAUDE.md should name your stack, your machines, your preferences. Copy the structure. Rewrite the content.
  • The deploy mechanism doesn’t care about your language or framework. It’s rsync. It works on any Unix system. GitHub Actions runners are straightforward to set up on any machine with an internet connection.
  • Skills that reference your own infrastructure stay private. Share the generic ones — code review methodology, research patterns, blog writing guidelines.
  • Version control is the unlock you didn’t know you needed. Git diffs on config changes. Revert on bad deploys. A clear history of what you changed and when, with commit messages that actually explain the reasoning.

What I Learned

Finding a framework for something you’re already building is underrated. I didn’t study PAI and then build toward it. I built independently, hit the same walls, solved them in similar ways, and then found PAI — which had better names for everything. The convergence was more valuable than if I’d started with the framework. It meant I understood why each piece existed, not just that someone told me it should.

Open-sourcing forces you to explain things you stopped noticing. Writing the public README required me to articulate concepts I’d internalized. That process surfaced two design decisions I’d made for dumb reasons and one assumption about what was “obviously generalizable” that wasn’t.

The best infrastructure is the one you forget is there. After setting all of this up, I don’t think about it. Claude Code behaves the same way on every machine. Skills are in sync. Changes propagate without me touching anything. The deployment layer’s goal is to disappear — and for the most part, it does.


Tools used: Claude Code by Anthropic. Framework: Personal AI Infrastructure (PAI) by Daniel Miessler. Architecture: Indie DevDan’s 4-Layer Bowser System. CI/CD: GitHub Actions. Source: claude-agent-stack. Built with Claude Code by Anthropic.