Skip to main content

Introduction

NikCLI’s agent system is a sophisticated, multi-layered architecture that enables autonomous AI-driven development. Agents can analyze code, make decisions, execute complex tasks, and coordinate with each other to accomplish goals.

Architecture Overview

Agent Hierarchy

Base Agent

Abstract foundation providing core functionality for all agents

Universal Agent

Single comprehensive agent with 64+ capabilities for general tasks

Specialized Agents

Domain-specific agents (Frontend, Backend, DevOps, etc.)

Autonomous Orchestrator

Coordinates multiple agents for complex multi-step workflows

Core Components

1. Agent Factory

Creates and manages agent instances:
interface AgentFactory {
  createAgent(type: AgentType, config: AgentConfig): Agent;
  getAgent(id: string): Agent;
  listAgents(): Agent[];
  destroyAgent(id: string): void;
}
Features:
  • Dynamic Creation: Instantiate agents on-demand
  • Lifecycle Management: Handle agent initialization and cleanup
  • Resource Pooling: Reuse agents for efficiency
  • Configuration: Customize agent behavior per instance

2. Agent Orchestrator

Coordinates multi-agent workflows:
interface AgentOrchestrator {
  orchestrate(task: Task): Promise<Result>;
  coordinateAgents(agents: Agent[]): void;
  handleConflicts(conflicts: Conflict[]): Resolution;
  optimizeExecution(plan: ExecutionPlan): OptimizedPlan;
}
Capabilities:
  • Task Decomposition: Break complex tasks into subtasks
  • Agent Selection: Choose optimal agents for each subtask
  • Parallel Execution: Run independent tasks concurrently
  • Conflict Resolution: Handle competing agent actions
  • Progress Tracking: Monitor and report execution status

3. Tool Registry

Manages tools available to agents:
interface ToolRegistry {
  registerTool(tool: Tool): void;
  getTool(name: string): Tool;
  getToolsForAgent(agent: Agent): Tool[];
  validateToolAccess(agent: Agent, tool: Tool): boolean;
}
Features:
  • 40+ Built-in Tools: File ops, Git, search, Web3, etc.
  • Security Levels: safe, confirmed, dangerous
  • Access Control: Tool permissions per agent type
  • Context Awareness: Tools understand project context

4. Context Manager

Provides agents with project understanding:
interface ContextManager {
  getProjectContext(): ProjectContext;
  getFileContext(path: string): FileContext;
  searchSemantic(query: string): SearchResults;
  updateContext(changes: Change[]): void;
}
Provides:
  • Project Structure: File tree, dependencies, architecture
  • Code Understanding: Semantic search via RAG
  • Framework Detection: React, Vue, Express, etc.
  • Coding Patterns: Project conventions and styles
  • Historical Context: Previous changes and decisions

5. Streaming Provider

Manages real-time output:
interface StreamingProvider {
  streamMessage(message: StreamMessage): void;
  handleToolCall(toolCall: ToolCall): void;
  updateProgress(progress: Progress): void;
  streamComplete(): void;
}
Features:
  • Real-time Updates: Stream agent thoughts and actions
  • Progress Tracking: Visual indicators for long tasks
  • Interactive Prompts: Request user input during execution
  • Error Handling: Graceful failure recovery

Agent Capabilities

Universal Agent (64+ Capabilities)

  • Component creation (React, Vue, Angular)
  • Function/class generation
  • API endpoint creation
  • Database schema design
  • Configuration file generation
  • Boilerplate scaffolding
  • Type definitions
  • Interface design
  • Module structure
  • Package setup
  • Script creation
  • Documentation generation
  • Quality assessment
  • Security vulnerability scanning
  • Performance profiling
  • Dependency analysis
  • Dead code detection
  • Code smell identification
  • Complexity metrics
  • Test coverage analysis
  • Architecture review
  • Best practices verification
  • Refactoring
  • Bug fixing
  • Optimization
  • Modernization
  • Type safety improvements
  • Error handling enhancement
  • Accessibility improvements
  • Internationalization
  • Unit test generation
  • Integration test creation
  • E2E test development
  • Test fixing
  • Coverage improvement
  • Mock generation
  • Test refactoring
  • Snapshot testing
  • README creation
  • API documentation
  • Inline comments
  • JSDoc/TSDoc generation
  • Architecture diagrams
  • Usage examples
  • Docker configuration
  • CI/CD pipeline creation
  • Environment setup
  • Deployment scripts
  • Monitoring setup
  • Infrastructure as Code
  • Build optimization
  • Dependency management
  • Error diagnosis
  • Stack trace analysis
  • Performance debugging
  • Memory leak detection
  • Logic error identification
  • Regression analysis
  • Smart contract generation
  • DeFi integration
  • Wallet operations
  • Token management
  • Transaction handling
  • Web3 testing

Specialized Agents

  • Frontend Agent
  • Backend Agent
  • DevOps Agent
  • Code Review Agent
Expertise:
  • React, Vue, Angular, Svelte
  • CSS, Tailwind, styled-components
  • State management (Redux, Zustand, Recoil)
  • Component libraries
  • Responsive design
  • Accessibility (WCAG)
  • Performance optimization
  • SEO best practices
Use Cases:
  • UI component creation
  • Layout implementation
  • State management setup
  • Styling and theming
  • Animation and transitions
  • Form handling and validation

Execution Modes

Interactive Mode (Default)

/agent universal-agent "create authentication system"
Flow:
  1. Agent analyzes task
  2. Generates execution plan
  3. Requests approval from user
  4. Executes approved plan
  5. Reports results
Best For:
  • Learning how agents work
  • Critical or sensitive tasks
  • When you want control
  • Exploratory development

Autonomous Mode

/auto "create authentication system"
Flow:
  1. Agent analyzes task
  2. Generates execution plan
  3. Executes immediately (no approval)
  4. Reports results
Best For:
  • Trusted, routine tasks
  • When you’re confident in the request
  • Batch operations
  • CI/CD automation
Autonomous mode skips approval prompts. Review results carefully.

Planning Mode

/plan "create authentication system"
Flow:
  1. Agent generates detailed plan
  2. User reviews and edits plan
  3. User approves modified plan
  4. Agents execute plan step-by-step
  5. User approves each critical step
Best For:
  • Complex multi-phase projects
  • When you want fine-grained control
  • Learning and education
  • High-stakes changes

Agent Communication

Agents can communicate through an event bus:
interface AgentEvent {
  type: 'task-complete' | 'task-failed' | 'help-needed' | 'conflict';
  source: Agent;
  data: any;
  timestamp: number;
}

class EventBus {
  subscribe(event: string, handler: (event: AgentEvent) => void): void;
  publish(event: AgentEvent): void;
  unsubscribe(event: string, handler: Function): void;
}
Communication Patterns:
  • Task Handoff: One agent completes task, hands off to another
  • Help Requests: Agent requests assistance from specialist
  • Conflict Resolution: Agents negotiate conflicting changes
  • Status Updates: Agents broadcast progress

Agent State Management

interface AgentState {
  id: string;
  type: AgentType;
  status: 'idle' | 'analyzing' | 'planning' | 'executing' | 'waiting' | 'error';
  currentTask?: Task;
  progress?: Progress;
  context: AgentContext;
  history: Action[];
}
State Tracking:
  • Idle: Agent available for tasks
  • Analyzing: Understanding the task
  • Planning: Creating execution plan
  • Executing: Performing actions
  • Waiting: Awaiting user input
  • Error: Encountered failure

Performance & Optimization

Parallel Execution

Multiple agents work simultaneously on independent tasks

Intelligent Caching

Reuse analysis results and context across sessions

Token Optimization

Minimize API costs through smart context management

Streaming Output

Real-time updates reduce perceived latency

Security Model

Tool Security Levels

1

Safe Tools

No approval required:
  • File reading
  • Code analysis
  • Search operations
  • Documentation generation
2

Confirmed Tools

Require approval:
  • File writing
  • File modification
  • Git operations
  • Package installation
3

Dangerous Tools

Require explicit approval with warning:
  • File deletion
  • System commands
  • Environment modification
  • Deployment operations

Access Control

interface AgentPermissions {
  allowedTools: string[];
  allowedPaths: string[];
  deniedPaths: string[];
  maxFileSize: number;
  requireApproval: boolean;
  canExecuteCommands: boolean;
}

Monitoring & Observability

Track agent performance:
# View agent statistics
/agent-stats

# Monitor active agents
/agent-list --active

# View agent history
/agent-history universal-agent

# Export agent metrics
/agent-metrics --format json
Enable monitoring to track agent performance and optimize your workflows

Next Steps