Nity as PM — QuantumReef Integration
Nity serves as the Project Manager in the 88.pi ecosystem, orchestrating task execution through QuantumReef's multimodel engine fabric. External clients connect to Nity through the Bridge SDK, and Nity delegates execution to QuantumReef when tasks exceed local capabilities.
Architecture
External Client (Kilo Code, Cursor, VS Code)
│
▼
Bridge SDK (createNitySession)
│
▼
Nity Extension (PM Layer)
┌─────────────────────────────────┐
│ Task Analyzer → classify/risk │
│ Strategy Planner → mode/steps │
│ Execution Router → standalone │
│ or quantumreef? │
└──────────┬──────────────────────┘
│
┌─────────┴─────────┐
▼ ▼
Standalone QuantumReef Bridge
(LoopEngine) (WebSocket → ws://localhost:7777)
│
▼
QuantumReef Engines
├─→ Claude Code
├─→ OpenCode
├─→ Aider
├─→ Gemini CLI
├─→ Kilo Code
└─→ 12 total adapters
│
▼
PM Verdict + Results
(streamed back to client)How It Works
1. Client Connects via Bridge SDK
import { createNitySession } from '@mariozechner/pi-coding-agent/extensions/nity/bridge';
const session = await createNitySession({ costTier: 'hybrid' });The bridge creates a pi-coding-agent session with Nity loaded as an extension.
2. Task Enters Nity's PM Pipeline
When sendTask is called, Nity runs the full PM pipeline:
sendTask("execute", "Add OAuth2 support")
│
▼
TaskAnalyzer
├─ category: "implement"
├─ complexity: "complex"
├─ risk: "medium"
└─ localSufficient: false
│
▼
StrategyPlanner
├─ mode: "quantumreef"
├─ steps: [validate, implement, test]
├─ qualityGateRequired: true
└─ reflectionRequired: true
│
▼
ExecutionRouter
├─ decision: "quantumreef"
├─ confidence: 0.85
└─ reasoning: "Complex task benefits from specialized engine"3. Nity Delegates to QuantumReef
The QuantumReefBridge sends the task over WebSocket using the Clawtopus protocol:
// Inside Nity coordinator
if (strategy.mode === 'quantumreef' && bridge.connected) {
const task = bridge.buildTask(instruction, strategy, cwd);
const result = await bridge.dispatch(task, onProgress);
// result includes engine name, artifacts, duration
}Protocol messages:
| Message | Direction | Purpose |
|---|---|---|
task.dispatch | Nity → QR | Send task with category, context, timeout |
task.progress | QR → Nity | Real-time progress (phase, step, %) |
task.complete | QR → Nity | Final result with artifacts |
Category mapping (Nity → QuantumReef):
| Nity Category | QR Category |
|---|---|
| implement | code |
| refactor | code |
| debug | code |
| review | review |
| plan | spec |
| test | test |
| explore | code |
| generate | code |
4. Quality Gates Verify Results
After execution (standalone or QuantumReef), Nity runs quality gates:
const report = qualityGates.evaluate(result, strategy.analysis);
// { passed: true, dimensions: [...], summary: "All checks passed" }Four dimensions checked:
- Execution completed — success flag
- No blocking errors — no error in failure state
- Output present — non-empty output or files changed
- Risk boundary — high-risk tasks must succeed cleanly
5. Self-Reflection Captures Learning
Post-task reflection synthesizes lessons and persists them:
const reflection = await selfReflection.reflect(result, strategy, brain);
// { outcome, whatWorked, whatFailed, lessons, followUps }
// Persisted to EpisodeRecorder for future recall6. Results Stream Back to Client
The bridge SDK streams events to the external client in real time:
const unsubscribe = session.subscribe((event) => {
if (event.type === 'task_progress') {
// Nity's internal progress + QuantumReef progress combined
}
if (event.type === 'task_complete') {
// Final result with quality gate status + reflection
}
});
const result = await session.sendTask('execute', 'Add OAuth2 support');
// result.qualityGatePassed = true
// result.reflection = { lessons: [...], followUps: [...] }Standalone vs QuantumReef
Nity's ExecutionRouter decides autonomously:
| Condition | Route |
|---|---|
| Simple tasks (low complexity) | Standalone (LoopEngine) |
| No QuantumReef available | Standalone (graceful fallback) |
| Complex + multi-step | QuantumReef |
| Requires specific engine | QuantumReef |
| High risk + needs sandbox | QuantumReef |
The router provides a confidence score (0.5–0.9) and reasoning string for each decision.
QuantumReef Connection
The QuantumReef bridge connects to ws://localhost:7777 by default. Configure via nity.config.json:
{
"quantumreefEndpoint": "ws://localhost:7777",
"bridgeTimeout": 300000
}Connection Status
Nity probes QuantumReef availability on session start:
const status = await bridge.isAvailable();
// { available: true, endpoint: "ws://localhost:7777" }
// or
// { available: false, reason: "Connection refused" }When QuantumReef is unavailable, Nity falls back to standalone execution transparently.
What QuantumReef Provides
| Capability | Description |
|---|---|
| 12 Engine Adapters | Claude Code, OpenCode, Aider, Gemini CLI, Kilo Code, Goose, Codex, GitHub Copilot, Droid, Kiro, RovoDev, Clawtopus |
| 7 Domain Adapters | Code, Design, Data, Media, Test, API, Validation |
| Polymorphic Sandbox | Domain-adaptive execution with resource limits |
| Multi-Agent Orchestration | Parallel, sequential, pipeline strategies |
QuantumReef is the execution playground — 88.pi/Nity is the PM that orchestrates it. Visit the QuantumReef Landing Page (opens in a new tab) to learn more about the engine fabric, or explore What You Can Build with 7 domains × 12 engines.
PM Verdict Flow
When a task completes through Nity's pipeline, the external client receives a structured verdict:
const result = await session.sendTask('validate', 'Check the new auth module');
// result contains:
{
taskType: 'validate',
success: true,
output: 'Quality gate passed: all checks successful',
qualityGatePassed: true,
reflection: {
lessons: ['JWT rotation prevents token theft'],
followUps: ['Add refresh token endpoint']
},
episodeId: 'ep-auth-2026-03-21',
duration: 4523
}Cost Transparency
The client sees cost before execution:
import { CostTracker } from '@mariozechner/pi-coding-agent/extensions/nity/bridge';
const tracker = new CostTracker({ budgetLimit: 1.0 });
const estimate = tracker.estimateCost('premium', 5000, 2000);
console.log(`Estimated: $${estimate.estimatedCost.toFixed(4)}`);
// After execution
const report = tracker.getReport();
console.log(`Total: $${report.totalCost.toFixed(4)} across ${report.totalTasks} tasks`);