Documentation
Nity Agent
Overview

Nity Agent — Overview

♾️

Nity (Sanskrit: नित्य, nitya) — eternal, perpetual, timeless. An eternal coding companion that grows with every task it touches.

What is Nity?

Nity is the core AI extension for pi-coding-agent. It layers autonomous task execution, persistent memory, self-reflection, quality gates, and skill learning on top of the base agent framework.

Where pi-coding-agent provides the foundation — tool execution, session management, MCP integration — Nity provides the mind. It remembers what it has done, learns from outcomes, and improves its approach over time.


The 8 Component Systems

Nity is organized into 8 component systems that work together as a cohesive cognitive architecture.

#SystemResponsibility
1CoordinatorOrchestrates all other components; central dispatch
2Task AnalyzerDecomposes incoming tasks into subtasks and complexity scores
3Strategy PlannerSelects execution strategies based on task analysis
4Execution RouterRoutes tasks to the right adapter or execution path
5Quality GatesValidates outputs against configurable quality dimensions
6Self-ReflectionCaptures post-task learning and meta-cognitive insights
7Skill RegistryStores, indexes, and retrieves learned skills
8Progress TrackerStreams status updates during long-running operations

The central nervous system. Receives events from pi-coding-agent, delegates to the appropriate component, and aggregates results. Initialized with references to session brain, skill registry, quality gates, and self-reflection modules.


Integration with pi-coding-agent

Nity extends pi-coding-agent through the extension API. It registers as a first-class extension, subscribes to lifecycle events, and injects tools into the agent's tool palette.

┌─────────────────────────────────────────────┐
│              pi-coding-agent                │
│  ┌───────────────────────────────────────┐  │
│  │          Extension System             │  │
│  │  ┌─────────────────────────────────┐  │  │
│  │  │         Nity Extension          │  │  │
│  │  │  index.ts (entry point)         │  │  │
│  │  │  ┌───────────┬──────────────┐   │  │  │
│  │  │  │ Coordinator│   Brain      │   │  │  │
│  │  │  │            │   (memory)   │   │  │  │
│  │  │  ├────────────┼──────────────┤   │  │  │
│  │  │  │ Skill      │   Self-      │   │  │  │
│  │  │  │ Registry   │   Reflection │   │  │  │
│  │  │  └────────────┴──────────────┘   │  │  │
│  │  └─────────────────────────────────┘  │  │
│  └───────────────────────────────────────┘  │
│  ┌───────────────────────────────────────┐  │
│  │        pi-coding-agent Core           │  │
│  │  (sessions, tools, MCP, sandbox)      │  │
│  └───────────────────────────────────────┘  │
└─────────────────────────────────────────────┘

For full details on the extension API, see the pi-mono extension documentation (opens in a new tab).


File Structure

Nity lives at extensions/nity/ with 17 source files:

extensions/nity/
├── index.ts                  # Extension entry point — tool registration & event wiring
├── package.json              # @88pi/nity dependencies
├── types.ts                  # Core type definitions (NityConfig, TaskAnalysis, etc.)
├── config.ts                 # Configuration management
├── coordinator.ts            # Central orchestrator
├── task-analyzer.ts          # Task decomposition & complexity scoring
├── strategy-planner.ts       # Execution strategy selection
├── execution-router.ts       # Route tasks to adapters or standalone
├── standalone-runner.ts      # Wraps nity-loop LoopEngine for direct execution
├── quantumreef-bridge.ts     # WebSocket bridge to QuantumReef execution fabric
├── quality-gates.ts          # Quality validation pipeline
├── self-reflection.ts        # Post-task learning & meta-cognition
├── skill-registry.ts         # Skill storage, indexing, retrieval
├── progress-tracker.ts       # Real-time status streaming
├── brand/
│   ├── voice.ts              # Brand voice generation by state
│   └── state-to-brand.ts     # State → brand presence mapping
└── tui/
    ├── presence-indicator.ts # Nity presence badge in TUI
    ├── loop-status.ts        # Loop progress display
    └── memory-banner.ts      # Memory/brain status banner
⚠️

The 400-line rule applies to every file in this directory. If any source file approaches 350 lines, stop and refactor into smaller, single-responsibility modules.


Implementation Status

All 5 phases from the specification are complete:

PhaseComponentsStatus
1. FoundationEntry point, types, coordinator, config✅ Complete
2. Brain & Memorynity-memory (brain, episodes, Ralph Universal, SimpleMem)✅ Complete
3. ExecutionTask analyzer, strategy planner, router, standalone-runner, quantumreef-bridge, progress✅ Complete
4. Quality & ReflectionQuality gates, self-reflection✅ Complete
5. EvolutionSkill registry, learned skill derivation, integration tests✅ Complete

Test coverage: 63 nity tests + 868 total across ecosystem, build clean.

All 5 spec families (nity, nity-memory, nity-loop, nity-brand, nity-bidirectional-bridge) are fully implemented and validated. The Nity Agent is production-ready.


Next Steps