# Citadel Saas Factory

> 265 autonomous AI agents across 15 business domains. Full-stack SaaS framework with real model routing, RAG pipeline, guardrails, and Chrome extension. FastAPI + Next.js + K3s. Runs on any server. $0/month software cost.

- **Type:** MCP server
- **Install:** `agentstack add mcp-citadel-cloud-management-citadel-saas-factory`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Citadel-Cloud-Management](https://agentstack.voostack.com/s/citadel-cloud-management)
- **Installs:** 0
- **Category:** [Cloud & Infrastructure](https://agentstack.voostack.com/c/cloud-infrastructure)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Citadel-Cloud-Management](https://github.com/Citadel-Cloud-Management)
- **Source:** https://github.com/Citadel-Cloud-Management/citadel-saas-factory
- **Website:** https://citadelcloudmanagement.com

## Install

```sh
agentstack add mcp-citadel-cloud-management-citadel-saas-factory
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

**Clone. Set one API key. Run any of 265 agents. Ship to any server.**

[Quick Start](#-quick-start) | [Agent Fleet](#-the-265-agent-fleet) | [Architecture](#-architecture) | [Runtime Engine](#-runtime-engine) | [Free Toolchain](#-free-toolchain)

---

## Why This Exists

Most SaaS frameworks give you scaffolding. This one gives you a **full autonomous workforce**.

265 AI agents across 15 business domains -- from CEO strategy to DevOps canary deploys -- each with its own system prompt, RAG retrieval pipeline, model tier, and guardrails. The entire stack runs on any Linux server with Docker. No AWS. No vendor lock-in. No monthly SaaS bills.

```
You:     "Analyze our API for security vulnerabilities"
Citadel: Routes to sec-sast agent (reasoning_deep tier, Claude Opus)
         -> Retrieves codebase context via RAG
         -> Runs OWASP Top 10 analysis
         -> Returns grounded findings with citations
         -> Output validated through triple-layer guardrails
```

---

## Quick Start

```bash
git clone https://github.com/Citadel-Cloud-Management/citadel-saas-factory.git
cd citadel-saas-factory
cp .env.example .env          # Add your ANTHROPIC_API_KEY
docker compose up -d           # Postgres, Redis, Keycloak, MinIO, RabbitMQ
cd backbone && pip install -e ".[dev]" && cd ..
```

**Run your first agent in 3 lines:**

```python
from backbone.runtime.agent_sdk import AgentSDK
sdk = AgentSDK()
result = await sdk.run_agent("eng-api-designer", prompt="Design a health check endpoint")
```

**Or use the CLI:**

```bash
python -m backbone.cli run "Analyze competitor pricing strategy"
python -m backbone.cli health
python -m backbone.cli agents
```

---

## The 265-Agent Fleet

Every agent has: a system prompt, RAG retrieval pipeline, model tier routing, and guardrails validation.

```python
sdk.list_agents(domain="engineering")   # 25 agents
sdk.list_agents(domain="security")      # 22 agents
sdk.list_agents(domain="devops")        # 28 agents
sdk.list_agents()                       # all 265
```

### Executive and Strategy `12`
CEO Strategist, COO Operations, CFO Finance, CTO Technology, CMO Marketing, CPO Product, VP Engineering, VP Sales, OKR Tracker, Board Reporter, Competitive Intel, Decision Logger

### Marketing and Growth `22`
SEO, Content, Social Media, Email, PPC, Analytics, Landing Page, Brand Voice, PR, Influencer, Video, Podcast, Community, Growth Hacker, A/B Testing, Competitor Monitor, Newsletter, Webinar, Affiliate, Product Launch, Persona, Retention

### Sales and Revenue `18`
Lead Qualifier, Outbound, Proposals, CRM, Demo Prep, Contracts, Forecast, Win/Loss, Pricing, Territory, Upsell, Scheduler, Objection Handler, Referral, Partner, Call Analyzer, Pipeline Cleaner, Commission

### Customer Success `15`
Onboarding, Ticket Router, Response Drafter, Escalation, Churn Predictor, Health Scorer, NPS, Knowledge Builder, Chatbot, Feedback, Renewal, QBR, Adoption, SLA Monitor, Voice of Customer

### Product and Design `20`
UI Designer, UX Research, Wireframes, Prototyping, Design System, Accessibility, Responsive, Color Palette, Typography, Icons, Animation, Illustration, Data Viz, User Flow, Heuristic Eval, Onboarding UX, Form UX, Search UX, Notifications, Mobile

### Engineering `25`
API Designer, Models, Schemas, Services, Repositories, Migrations, Middleware, Events, Workers, Auth, Cache, Search, Webhooks, Email, File Handling, Pagination, Rate Limiting, Health, WebSockets, GraphQL, Multi-tenant, Error Handling, Logging, Config, Code Review

### Frontend `18`
Components, Pages, Layouts, Forms, Tables, Charts, Auth, State, API Client, Accessibility, Responsive, i18n, SEO, Performance, Testing, Animation, Error Boundaries, PWA

### DevOps and Infrastructure `28`
CI, CD, GitOps, Image Build, Image Scan, Image Sign, Helm, Terraform, Ansible, K8s, Scaling, Debugging, Canary, Rollback, Release, Certs, DNS, Backup, Restore, Monitoring, Alerts, Logs, Service Mesh, Ingress, Storage, Queue, Cost, Capacity

### Security `22`
SAST, SCA, DAST, Secrets, Container, IaC, Runtime, Policy, Incidents, Vulnerabilities, Patching, Access Review, RBAC, Encryption, Audit, Compliance, Pentest, Threat Hunt, Network, WAF, PII Detection, Supply Chain

### Data and Analytics `18`
Schema, Migrations, Indexes, Query Optimization, RLS, Backups, ETL, Analytics, Vectors, Warehouse, Reports, Dashboards, Events, Cohorts, A/B Analysis, Forecasting, Anomaly, Privacy

### QA and Testing `22`
Unit, Integration, E2E, API, Load, Performance, Security, Accessibility, Visual Regression, Coverage, Mutation, Contract, Chaos, Fixtures, Mocks, Regression, Flaky Detection, Prioritization, Smoke, Compatibility, Data Validation, Reporting

### HR, Finance, Legal, Content `45`
Job Descriptions, Interviews, Onboarding, Performance, Billing/Stripe, Subscriptions, Tax, Revenue, Runway, ToS, DPA, GDPR, SOC2, Tech Writing, Blog, Docs, Changelog, Case Studies, and 27 more

Full agent registry (click to expand)

See [`.claude/agents/_registry.yaml`](.claude/agents/_registry.yaml) for all 265 entries with IDs, domains, and descriptions.

Each agent definition lives in `.claude/agents//.md` with:
- YAML frontmatter (id, domain, tier, rag_enabled, tools, skills)
- RAG Retrieval Prompt with domain-scoped metadata filters
- LLM System Prompt with role, rules, and escalation protocol

---

## Architecture

```
                              CLIENTS
                    Browser / Mobile / API
                              |
                    +---------+---------+
                    |                   |
              +-----v------+    +------v-------+
              |  FRONTEND  |    | AUTH GATEWAY  |
              | Next.js 14 |    | Keycloak 24   |
              +-----+------+    +------+-------+
                    |                  |
              +-----v------------------v-------+
              |          BACKEND API           |
              |   FastAPI + Agent Runtime      |
              |   /agent/run  /agent/browse    |
              +-----+------+------+------+-----+
                    |      |      |      |
            +-------v+  +-v----+ +v-----+ +v--------+
            |Postgres|  |Redis | |MinIO | |RabbitMQ  |
            |16+pgvec|  |  7   | | (S3) | |          |
            +--------+  +-----+ +------+ +---------+
                    |
            +-------v----------------------------+
            |        AGENT RUNTIME (backbone/)   |
            |  ModelRouter -> AgentSDK -> RAG    |
            |  Planner -> Guardrails -> Tracer   |
            +-------+---------------------------+
                    |
            +-------v----------------------------+
            |         ORCHESTRATION              |
            |   K3s + ArgoCD + Linkerd (mTLS)    |
            +------------------------------------+
```

### Tech Stack

| Layer | Technology | Why |
|-------|-----------|-----|
| Backend | **FastAPI** (Python 3.12) | Async-first, Pydantic validation, OpenAPI |
| Agent Runtime | **backbone/** (LiteLLM + structlog) | Multi-model routing, budget control, RAG |
| Frontend | **Next.js 14** (TypeScript) | SSR/SSG, React Server Components |
| Database | **PostgreSQL 16** + pgvector | HNSW vector search, JSONB, RLS |
| Cache | **Redis 7** | Session, rate limiting, pub/sub |
| Auth | **Keycloak 24** | OAuth2, RBAC, MFA, SSO |
| Storage | **MinIO** | S3-compatible, self-hosted |
| Messaging | **RabbitMQ** | Async events, DLQ |
| Orchestration | **K3s + ArgoCD** | Lightweight K8s, GitOps |
| Service Mesh | **Linkerd** | mTLS between all services |
| Secrets | **HashiCorp Vault** | Rotation, encryption |
| Observability | **Prometheus + Grafana + Loki** | Metrics, dashboards, logs |

---

## Runtime Engine

The `backbone/` package powers the agent fleet with 5 model tiers, agentic RAG, and triple-layer guardrails.

### Model Routing (5 tiers, automatic fallback)

```yaml
reasoning_deep:   Claude Opus 4     -> Sonnet 4       # Architecture, security
reasoning_fast:   Claude Sonnet 4   -> Haiku 4.5      # Development, reviews
cheap_fast:       Claude Haiku 4.5  -> --              # Content, high volume
rag_specialist:   Claude Sonnet 4   -> Haiku 4.5      # RAG with citations
local_only:       Ollama Llama 3.1  -> Mistral         # Budget fallback
```

Daily budget cap ($50 default). Exceeds? Auto-routes to `local_only`. Service continues, quality degrades gracefully.

### Agent SDK

```python
from backbone.runtime.agent_sdk import AgentSDK

sdk = AgentSDK()

# Run any agent by ID
result = await sdk.run_agent("sec-sast", prompt="Scan auth module for injection")

# Spawn sub-agents (depth-capped at 3, fan-out at 5)
await sdk.spawn_sub_agent("parent-id", "sec-pentest", prompt="Deep scan /api/auth")

# List by domain
sdk.list_agents(domain="security")  # 22 agents
```

### Agentic RAG Pipeline

```
Query -> Retrieve (vector + keyword + RRF) -> Grade (LLM-as-judge)
                                                |
                                    relevance  Executor runs -> Critic approves or revises
```

### Triple-Layer Guardrails

| Layer | What | How |
|-------|------|-----|
| 1. Output Validation | Hallucination, toxicity, PII | Guardrails AI Hub validators |
| 2. Input Sanitization | Prompt injection in RAG docs and browser content | 16 regex patterns, truncation |
| 3. Action Enforcement | Out-of-scope tool calls | 10-action allowlist, fail-closed |

Threshold: 0.85. Below? Retry (max 3). Still below? Reject. No exceptions.

### Chrome Extension

Manifest V3 side-panel assistant at `extensions/chrome/`. Captures active tab text on explicit user click, sanitizes through injection filters, routes through `POST /agent/browse`.

---

## Harness (`.claude/`)

The full agent harness lives in `.claude/`:

| Component | Count | Purpose |
|-----------|-------|---------|
| **Agents** | 265 generated + 11 hand-written | Executable definitions with RAG prompts |
| **Skills** | 10 | Deep reference: code-review, deploy, guardrails, llm-wiki, testing, etc. |
| **Commands** | 38 (20 YAML + 18 MD) | `/deploy`, `/audit`, `/scaffold`, `/wiki-ingest`, etc. |
| **Hooks** | 11 scripts + settings.json | pre-commit, post-deploy, on-security-alert, vault-autolink |
| **Templates** | 20 | FastAPI endpoints, React components, Helm charts, Terraform modules |
| **Rules** | 21 | Architecture, security, testing, naming, guardrails, obsidian backlinks |
| **MCP Servers** | 6 | GitHub, filesystem, PostgreSQL, Docker, Kubernetes, Ruflo |

---

## Free Toolchain

**Total monthly software cost: $0**

**Orchestration**
- ArgoCD (replaces Spinnaker)
- K3s (replaces EKS/GKE)
- Traefik (replaces AWS ALB)
- Linkerd (replaces Istio)

**Security**
- Semgrep (replaces SonarQube)
- Trivy (replaces Snyk)
- Falco (replaces Sysdig)
- Kyverno (replaces OPA GK)
- OWASP ZAP (replaces Burp)
- TruffleHog (replaces GitGuardian)

**Identity and Secrets**
- Keycloak (replaces Auth0)
- HashiCorp Vault (replaces AWS SM)
- Certbot (replaces commercial TLS)

**Observability**
- Prometheus (replaces Datadog)
- Grafana (replaces Datadog dashboards)
- Loki (replaces Splunk)
- Grafana OnCall (replaces PagerDuty)

**Storage and Messaging**
- MinIO (replaces AWS S3)
- RabbitMQ (replaces SQS)
- Velero (replaces Kasten K10)

**Deployment**
- Ansible (replaces Puppet/Chef)
- Flagsmith (replaces LaunchDarkly)

**AI/ML Security**
- Guardrails AI
- DeepEval

---

## Docker Compose (One Command)

```bash
docker compose up -d
```

| Service | Port | Purpose |
|---------|------|---------|
| PostgreSQL 16 | 5432 | Primary database + pgvector |
| Redis 7 | 6379 | Cache, sessions, rate limiting |
| Keycloak 24 | 8080 | Auth server (admin console) |
| MinIO | 9000/9001 | Object storage and console |
| RabbitMQ | 5672/15672 | Message broker and management |
| MailHog | 1025/8025 | Local email capture |
| Backend | 8000 | FastAPI API |
| Frontend | 3000 | Next.js UI |

---

## Infrastructure Agnostic

Runs on **any** Linux server with SSH and Docker. No cloud vendor lock-in.

- Any VPS (Hetzner, DigitalOcean, Linode, Vultr)
- Bare metal servers
- On-premises infrastructure
- Edge deployments
- Home lab

---

## LLM Wiki (Karpathy Pattern)

The agent fleet uses Andrej Karpathy's [LLM Wiki pattern](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f) as persistent brain memory:

```
docs/vault/
  raw/          # Immutable source documents (never modified by LLM)
  wiki/         # LLM-maintained compiled knowledge
    index.md    # Master index (always consulted first)
    entities/   # People, tools, services
    concepts/   # Patterns, principles
    sources/    # Source metadata
  SCHEMA.md     # Governance (co-evolved with human)
```

Every session adds to the wiki. Every valuable answer is filed back. Knowledge compounds across all 265 agents instead of dying with the chat.

---

## Security

- **OWASP LLM Top 10 mapped**: `security/ai-security-by-design.html`
- **Sigma detection rules** for injection attempts and repeated rejections
- **OPA policies** for browse endpoint rate limiting
- **Kyverno policies** for agent container restrictions
- All outputs validated. All inputs sanitized. Fail-closed by default.

---

## Contributing

1. Fork the repo
2. Create a feature branch: `git checkout -b feat/your-feature`
3. Write tests first (TDD mandatory, 80% coverage minimum)
4. Run: `make lint && make test && make security`
5. Commit: `feat: add user auth`
6. Open a PR, wait for CI, get 1 approval

---

## License

MIT License. See [LICENSE](LICENSE).

Copyright (c) Citadel Cloud Management

---

**[citadelcloudmanagement.com](https://citadelcloudmanagement.com)**

Built with Claude Code. Powered by 265 autonomous agents. $0/month software cost.

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Citadel-Cloud-Management](https://github.com/Citadel-Cloud-Management)
- **Source:** [Citadel-Cloud-Management/citadel-saas-factory](https://github.com/Citadel-Cloud-Management/citadel-saas-factory)
- **License:** MIT
- **Homepage:** https://citadelcloudmanagement.com

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-citadel-cloud-management-citadel-saas-factory
- Seller: https://agentstack.voostack.com/s/citadel-cloud-management
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
