# Jiva v0.2.1 Release Notes

## Major Architecture Overhaul: Dual-Agent System

This release introduces a complete architectural redesign of Jiva's core execution engine, replacing the single-agent architecture with a **dual-agent pattern** for improved reliability, transparency, and task completion.

### What's New

#### 🤖 Two-Agent Architecture (Manager + Worker)

Jiva now uses a specialized agent pattern with clear separation of concerns:

- **Manager Agent**: High-level planning, task breakdown, result review, and response synthesis
- **Worker Agent**: Focused tool execution and information gathering
- **Orchestration Layer**: Coordinates both agents through three distinct phases

#### 📊 Three-Phase Execution Model

Every task now follows a structured workflow:

1. **Planning Phase** - Manager analyzes the request and creates an execution plan
2. **Execution Phase** - Worker executes subtasks, Manager reviews results and adapts
3. **Synthesis Phase** - Manager creates final user-facing response

#### 🔍 Transparent Chain-of-Thought Logging

New INFO-level logging shows agent reasoning in real-time:

```
[PHASE 1: Planning]
[Manager] Creating plan...
[Manager] Reasoning: User wants to list TypeScript files...
[Manager] Plan: 3 subtasks
  1. Check directory exists
  2. List and filter files
  3. Format results

[PHASE 2: Execution]
[Worker] Starting: "Check directory exists"
  [Worker] Tool: filesystem__list_directory
[Worker] Complete
[Manager] Reviewing: "Check directory exists"
[Manager] Decision: COMPLETE
```

#### 🛡️ Robust Error Handling

- **Automatic retry on API errors**: Worker recovers from invalid tool calls and parameter errors
- **Error feedback loop**: Failed operations provide context for correction
- **Graceful degradation**: Up to 5 retry attempts before reporting failure
- **Clear error messages**: Users see what went wrong without system crashes

#### 🎯 Improved Workspace Awareness

- Worker agent now has full workspace context
- Automatic path resolution: relative paths default to workspace directory
- Explicit path support: absolute paths work as specified
- Clear file operation instructions in system prompts

#### 🎨 Cleaner Logging Output

- Removed excessive emojis in favor of ASCII symbols and structure
- Color-coded output with semantic markers: `[*]`, `[+]`, `>>`, `[Manager]`, `[Worker]`
- Structured phase separators for easy reading
- Progress indicators show current execution stage

### Breaking Changes

⚠️ The CLI now uses `DualAgent` by default instead of `JivaAgent`. The single-agent implementation remains available for compatibility but is no longer the default.

### Technical Improvements

- **Better task focus**: Worker limited to 5 iterations per subtask prevents wandering
- **Adaptive planning**: Manager can add new subtasks based on Worker results
- **Context preservation**: Manager maintains task context throughout execution
- **Workspace-relative paths**: Smart path interpretation for file operations
- **Tool validation**: API-level error catching prevents crashes from malformed requests

### Files Added

- `src/core/dual-agent.ts` - Main orchestration layer
- `src/core/manager-agent.ts` - Planning and coordination agent
- `src/core/worker-agent.ts` - Tool execution agent

### Upgrade Notes

No configuration changes required. The dual-agent system is automatically enabled and uses the same CLI arguments as before:

```bash
jiva chat                    # Interactive mode with dual agents
jiva run "your prompt"       # Single execution with dual agents
```

### What's Next

Future releases will focus on:
- E2E testing framework for cognitive ability validation
- Performance optimizations
- Enhanced multi-step task planning
- Improved tool selection strategies

---

**Full Changelog**: v0.2.0...v0.2.1
