# Wolfpack: Agentic AI with NX° Guardrails

> "Imagine a pack of wolves you can send out to fix a business problem or create software; that's what we are building. We give those wolves our framework, NX°, which gives them the guardrails they need to produce useful, reliable output."

---

## The Concept

In our unpopular opinion, website templating is dead tech walking. We only invented them because designing every page from scratch was too slow and too expensive. Templates weren't an aesthetic choice, they were an economic one. Modern AI lets us build 100% bomber, bespoke, high-performance code in minutes… what is the argument for a template?

- Why cram your brand into pre-baked boxes?
- Why carry legacy CSS frameworks and unused boilerplate?
- Why look like everyone else when bespoke is now as fast as generic?

WolfPack ditches templates entirely. AI agents create 100% custom code every single time.

Modern agentic AI gives us autonomous problem-solvers that can code, refactor, and deploy solutions in minutes. However, unconstrained agent swarms quickly drift:
- They wander across architectural layers and introduce cross-boundary leaks.
- They rewrite unrelated files or invent duplicate utilities.
- They incur massive token and compute waste by running indiscriminate repo-wide test suites.
- They introduce circular dependencies and break encapsulation.

**Wolfpack** pairs autonomous multi-agent swarms with **NX°**, using the monorepo's structural primitives as inviolable rules of engagement.

---

## Architecture

```
                  ┌─────────────────────────────────────────┐
                  │          Mission Dispatcher             │
                  │    (Alpha: Goal Breakdown & Scope)      │
                  └───────────────────┬─────────────────────┘
                                      │
            ┌─────────────────────────┼─────────────────────────┐
            ▼                         ▼                         ▼
   ┌─────────────────┐       ┌─────────────────┐       ┌─────────────────┐
   │ Agent: Feature  │       │ Agent: API/Data │       │ Agent: Quality  │
   │  Implementation │       │   Contracts     │       │  & Verification │
   └────────┬────────┘       └────────┬────────┘       └────────┬────────┘
            │                         │                         │
            └─────────────────────────┼─────────────────────────┘
                                      ▼
    ═════════════════════════════════════════════════════════════════════
                         NX° FRAMEWORK GUARDRAILS
    ═════════════════════════════════════════════════════════════════════
     1. Strict Module Boundaries (`@nx/enforce-module-boundaries`)
     2. Project Graph Scoping (`scope:listingslab`, `type:feature`, etc.)
     3. Precision Target Execution (`nx affected --target=test`)
     4. Deterministic Contracts (`build`, `lint`, `test`, `e2e`)
     5. Computation Caching (Zero-waste replay of solved steps)
    ═════════════════════════════════════════════════════════════════════
                                      ▼
                     Verified, Production-Ready Software
```

---

## The 5 Core NX° Guardrails

### 1. Enforced Module Boundaries
Every app and library in the workspace is assigned tags (such as `scope:shared`, `scope:listingslab`, `type:ui`, `type:feature`, `type:util`). The NX° ESLint rule (`@nx/enforce-module-boundaries`) prevents agents from crossing isolation boundaries:
- A UI component cannot reach into server-only database code.
- An application cannot bypass shared abstraction layers.
- If an agent attempts an illegal import, the boundary rule trips immediately during the lint step.

### 2. Precision Hunting via the Project Graph (`nx affected`)
Instead of scanning or testing the entire monorepo, agents leverage NX°'s computation graph:
- Changes are analyzed against the dependency graph.
- The pack tests and verifies *only* the affected libraries and their dependents.
- This preserves token context and provides lightning-fast verification loops.

### 3. Deterministic Contract Targets
Agents need clear, unambiguous binary criteria for success. NX° standardizes targets across all projects:
```bash
nx run listingslab:lint
nx run listingslab:test
nx run listingslab:build
```
The agent does not guess build or test commands; targets are uniform across the entire workspace.

### 4. Computation Caching
NX° caches previous task results by cryptographic hashing of inputs. When multiple subagents work in parallel or iteratively refine code:
- Untouched dependencies hit the local/remote cache in milliseconds.
- Compute is preserved strictly for newly modified code.

### 5. Workspace Generators & Scaffolding
When the pack creates new features, APIs, or components, standard NX° generators enforce consistent naming, directory structures, and configuration boilerplate automatically.

---

## The Lean Route Synergy

Wolfpack integrates directly with Listingslab's zero-server client architecture:
- **Client-Side Wasm Compute**: WebContainer and in-browser bundlers eliminate cloud microVM costs.
- **Fast Edge Models with Prompt Caching**: Efficient models (Gemini Flash / Claude Haiku) run with cached prompt context to minimize per-action cost.
- **Git as the Single Source of Truth**: Changes are committed directly to version control without database lock-in.

---

## Summary

A pack of wolves without guardrails is chaos. A pack guided by NX° is an unstoppable engineering team: autonomous, fast, disciplined, and bounded by verifiable architectural truth.
