# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## What This Is

A platform-agnostic system prompt library for LLM agents. 29 personas across 10 domains, 111 variants, 59,712 words. Includes 796 shared skills + 20 Feynman research-workflow skills, 58 brand design systems, 23 company agents, 168 AD/red team attack docs (InternalAllTheThings), and auto-install to 7 platforms (Claude, Antigravity, Gemini, OpenClaw, OpenCode, Paperclip, raw).

## Build

```bash
pip install pyyaml          # only dependency
python3 build.py            # builds all personas → generated/
```

Output goes to `generated/<persona>/<variant>.{prompt.md,yaml,json}`. The `generated/` directory is gitignored.

Optional: `cp config.example.yaml config.yaml` for dynamic variable injection. Build works without it.

## Architecture

**Build pipeline** (`build.py`): Reads persona `.md` files with YAML frontmatter → parses sections → applies config templating (`{{key}}`, `{{#if key}}...{{/if}}`, `{{#unless}}`) → outputs three formats per variant.

**Persona structure**: Each persona lives in `personas/<codename>/` with:
- `_meta.yaml` — metadata, triggers, relations, variants list
- `general.md` — base prompt (YAML frontmatter + markdown sections: Soul, Expertise, Methodology, Tools & Resources, Behavior Rules, Boundaries)
- `<specialization>.md` — domain-narrowed variants
- `salva.md` — user-personalized variant

**Templates**: `personas/_template.md` and `personas/_meta_template.yaml` are starting points for new personas. Files starting with `_` are skipped during build.

**Config system**: `config.yaml` (gitignored) provides user-specific values. `build.py` flattens nested keys (`user.name`, `infrastructure.tools.sdr_scanner`) and injects them into persona templates. Supports `{{#if key}}` / `{{#unless key}}` conditional blocks.

**Cross-persona escalation**: Each persona's Boundaries section defines handoff triggers to other personas, enabling multi-agent chains (e.g., Neo → Cipher → Sentinel → Frodo). Build auto-extracts these into `generated/_index/escalation_graph.json`.

**Shared library** (`personas/_shared/`): Reusable knowledge bases (skipped during persona build, indexed into outputs):
- `skills/` — 42 shared skills from OpenClaw/kali-claw (SKILL.md + references per skill)
- `paperclip-skills/` — 52 skills from paperclip-docs (ceo-advisor, coding-agent, security-review, etc.)
- `community-skills/` — 703 skills from skills.sh marketplace (shadcn, vercel, olla, expo, etc.) (shadcn, vercel, marketing, expo, obsidian, impeccable, browser-use, stitch, firecrawl, github, neon, azure, etc.)
- `feynman-skills/` — 20 research-workflow skills adapted from Feynman (deep-research, literature-review, paper-code-audit, peer-review, paper-writing, replication, source-comparison, summarize, alpha-research, eli5, autoresearch, docker/modal/runpod compute, session-log, session-search, jobs, watch, preview, contributing). Cross-platform: Claude Code + OpenCode. Subagent refs (`researcher`/`reviewer`/`writer`/`verifier`) mapped to host `Task`/`task` tool. Mapped to Scholar/Forge/Oracle personas.
- `design-md/` — 58 brand DESIGN.md files (Stripe, Claude, Linear, Apple, Vercel, etc.)
- `ui-ux-pro-max/` — BM25 search engine + 14 CSV data files (67 styles, 161 products, 57 fonts)
- `paperclip-agents/` — 23 company agents (Odin/CEO, Thor/CTO, Freya/CMO, Frigg/COO + 19 team members)
- `kali-tools/` — 16 Kali Linux tool reference docs (nmap, hashcat, metasploit, AD, OSINT, wireless)
- `openclaw-personas/` — Original 6 OpenClaw persona definitions + SOUL.md + IDENTITY.md + TOOLS.md
- `osint-sources/` — OSINT master reference and investigation templates
- `ad-attack-tools/` — Active Directory attack chain references
- `internal-allthethings/` — 168 InternalAllTheThings docs (swisskyrepo): AD attacks (ADCS ESC1-15, Kerberos, NTLM relay, coerce, delegation), red team (access, escalation, evasion, persistence, pivoting), cloud (AWS/Azure/IBM), C2 (Cobalt Strike, Metasploit, Mythic), containers, databases, DevOps CI/CD

**Build outputs** (`generated/_index/`):
- `escalation_graph.json` — cross-persona handoff map extracted from Boundaries sections
- `trigger_index.json` — keyword→persona routing for multi-agent auto-switching
- `skills_index.json` — all shared skills mapped to personas with metadata

**Skill injection**: Build auto-maps skills from `_shared/skills/` to personas via domain mapping. Each persona's JSON/YAML output includes a `skills` array listing applicable shared skills.

## Install to Platforms

```bash
python3 build.py --install claude       # 111 slash commands → ~/.claude/commands/
python3 build.py --install claude-skills # shared skills → ~/.claude/skills/ (default: skills,paperclip-skills,feynman-skills)
python3 build.py --install antigravity  # personas → ~/.config/antigravity/personas/
python3 build.py --install gemini       # Gems → generated/_gems/
python3 build.py --install openclaw     # IDENTITY.md + 29 personas → generated/_openclaw/
python3 build.py --install opencode     # 29 agents + skills → ~/.config/opencode/{agents,skills}/
python3 build.py --install paperclip    # 52 agents + 73 skills → generated/_paperclip/
python3 build.py --install all          # all platforms at once
```

## Conventions

- Persona codenames are lowercase directory names (`neo`, `frodo`, `sentinel`)
- Every persona must have `general.md` with valid YAML frontmatter
- Frontmatter fields: `codename`, `name`, `domain`, `subdomain`, `version`, `address_to`, `address_from`, `tone`, `activation_triggers`, `tags`, `inspired_by`, `quote`, `language`
- Section headers use `## ` (H2) — the build parser splits on these
- Turkish honorific titles ("Hitap") are used for `address_to` fields
- `config.yaml` must never be committed (contains personal infrastructure details)
