# Jiva v0.3.43 — Token Tracking & Enhanced Agent Infrastructure

**Release Date:** April 6, 2026

---

## Highlights

- **Token tracking and usage monitoring** — comprehensive visibility into token consumption across the agent pipeline
- **Enhanced agent infrastructure** — token usage reporting and workspace directive integration
- **Increased session limits** — longer consecutive reads support for extended sessions
- **Infrastructure improvements** — better monitoring and observability capabilities

---

## New Features

### Token Usage Monitoring System

Comprehensive token tracking infrastructure that provides visibility into resource consumption:

- **TokenUsageSnapshot interface** — captures token usage data with `promptTokens` and `completionTokens` fields
- **Token tracking in AgentResponse** — all agent responses now include `tokenUsage` for consumption monitoring
- **Orchestrator integration** — token usage is captured and reported from the orchestrator layer
- **Usage reporting** — token consumption data is available through the agent response interface

### Workspace Directive Integration

Enhanced conversation summarization with workspace directive support:

- **Directive-aware summarization** — conversations now include workspace directives in context
- **Better context retention** — directives are preserved during conversation compaction and summarization
- **Improved session continuity** — agents maintain awareness of workspace directives across sessions

### Enhanced Session Management

Improved session handling for longer and more complex interactions:

- **Increased read limits** — `MAX_CONSECUTIVE_READS` increased from 5 to 15 to accommodate longer sessions
- **Better session resilience** — infrastructure supports extended conversation lengths
- **Improved error handling** — enhanced error tracking and recovery for long-running sessions

---

## Infrastructure Improvements

### Token Tracking Architecture

New token tracking infrastructure integrated across the agent system:

- **TokenUsageSnapshot** interface for standardized token data
- **AgentResponse enhancement** with `tokenUsage` field
- **Orchestrator integration** for comprehensive tracking
- **Monitoring capabilities** for resource usage analysis

### Configuration Updates

Enhanced configuration options for better control:

- **Token tracking parameters** available in agent configuration
- **Workspace directive settings** for conversation management
- **Session limit adjustments** for extended interactions

---

## Files Changed

| File | Change |
|------|--------|
| `src/models/token-tracker.ts` (new) | Token tracking infrastructure and interfaces |
| `src/models/harmony.ts` (updated) | Token usage integration and directive support |
| `src/models/model-client.ts` (updated) | Token tracking configuration |
| `src/models/orchestrator.ts` (updated) | Token usage capture and reporting |
| `src/core/agent-interface.ts` (updated) | AgentResponse interface with tokenUsage field |
| `src/core/conversation-manager.ts` (updated) | Workspace directive integration |
| `src/core/dual-agent.ts` (updated) | Enhanced session management |
| `src/core/manager-agent.ts` (updated) | Token tracking integration |
| `src/core/worker-agent.ts` (updated) | Token usage monitoring |
| `src/evaluator/evaluator-agent.ts` (updated) | Token tracking support |
| `src/evaluator/types.ts` (updated) | Evaluator token usage interfaces |
| `src/interfaces/cli/index.ts` (updated) | CLI token tracking options |
| `src/interfaces/cli/repl.ts` (updated) | REPL token usage display |
| `src/interfaces/http/routes/chat.ts` (updated) | HTTP API token usage reporting |
| `src/interfaces/http/routes/session.ts` (updated) | Session token tracking |
| `src/interfaces/http/session-manager.ts` (updated) | Token usage management |
| `src/mcp/client.ts` (updated) | MCP token tracking integration |
| `src/storage/types.ts` (updated) | Storage layer token usage support |

---

## Breaking Changes

None. All changes are backward compatible and additive.

---

## Upgrade

```bash
npm install -g jiva-core@0.3.43
```
