forge-reasoning 0.1.2

Reasoning tools for LLM debugging - checkpointing, hypotheses, contradictions
Documentation
# TDD Wave 1: Core Checkpointing

**Status**: ✅ Complete  
**Date**: 2026-02-19  
**Focus**: Basic checkpoint creation and identification

---

## Overview

Wave 1 establishes the foundation of the temporal checkpointing system. The goal is to implement basic checkpoint creation with unique identifiers and sequence numbers.

---

## Test Results

| Test | Description | Status |
|------|-------------|--------|
| 1 | Create in-memory storage ||
| 2 | Create checkpoint manager ||
| 3 | Create a checkpoint ||
| 4 | Checkpoint IDs are unique ||
| 5 | Sequence numbers increment ||
| 6 | List checkpoints (empty) ||
| 7 | Auto-checkpoint throttling ||
| 8 | Manual checkpoint (no throttle) ||
| 9 | Session ID attached ||
| 10 | Environment info captured ||

**Results**: 10 passed, 0 failed

---

## Implementation

### Core Types Added

```rust
/// Unique identifier for a checkpoint
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct CheckpointId(pub Uuid);

/// Unique identifier for a debugging session
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct SessionId(pub Uuid);

/// A snapshot of debugging state
pub struct TemporalCheckpoint {
    pub id: CheckpointId,
    pub timestamp: DateTime<Utc>,
    pub sequence_number: u64,
    pub message: String,
    pub tags: Vec<String>,
    pub state: DebugStateSnapshot,
    pub trigger: CheckpointTrigger,
    pub session_id: SessionId,
}
```

### Storage Trait

```rust
pub trait CheckpointStorage: Send + Sync {
    fn store(&self, checkpoint: &TemporalCheckpoint) -> Result<()>;
    fn get(&self, id: CheckpointId) -> Result<TemporalCheckpoint>;
    fn list_by_session(&self, session_id: SessionId) -> Result<Vec<CheckpointSummary>>;
}
```

### Key Features

1. **UUID-based IDs**: Each checkpoint gets a unique v4 UUID
2. **Per-manager sequences**: Each manager maintains its own counter
3. **Throttling**: Auto-checkpoints are throttled (30-second default)
4. **Manual override**: User-initiated checkpoints bypass throttling

---

## Design Decisions

### 1. UUID vs Sequential IDs

**Chosen**: UUID v4 for checkpoint IDs

**Rationale**: 
- Globally unique without coordination
- No central ID server needed
- Secure (not guessable)

### 2. In-Memory vs Persistent Storage

**Chosen**: Both supported via trait

**Rationale**:
- In-memory for testing
- SQLiteGraph for production
- Easy to add new backends

### 3. Throttling Strategy

**Chosen**: Time-based (30 seconds)

**Rationale**:
- Prevents checkpoint spam
- Simple to understand
- Configurable per-manager

---

## Code Metrics

| File | Lines Added |
|------|-------------|
| `src/checkpoint.rs` | ~200 |
| `src/storage.rs` | ~60 |
| `src/errors.rs` | ~40 |
| `tests/checkpoint_tests.rs` | ~200 |

---

## Next Steps

Wave 2 will add query methods (get, list, restore) to make checkpoints useful.

---

**Wave 1 Complete** ✅

Foundation established with core checkpoint creation and storage abstraction.