> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monolex.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OnIt Viewer Overview

> Session-based documentation viewer for ongoing work tracking in the Monolex Work-Wiki system

## Overview

WikiOnitViewer displays ongoing work sessions with simple, chronological organization. Each OnIt session represents active work that's "on it" - capturing ideas, exploration, and progress in real-time.

## Architecture

The viewer follows a flat file structure with timestamp-based naming, using a 6-pattern parser for maximum compatibility across historical naming conventions.

```
┌─────────────────────────────────────────────────┐
│  WikiOnitViewer Structure                       │
├─────────────────────────────────────────────────┤
│                                                 │
│  WikiBaseViewer (base class)                    │
│       ↓                                         │
│  WikiOnitViewer (350 lines)                     │
│       ↓                                         │
│  sessions: OnitSession[]                        │
│       ↓                                         │
│  Render → Accordion List (chronological)        │
│                                                 │
└─────────────────────────────────────────────────┘
```

## Data Model

Each session includes parsed timestamp, session name, and inferred status based on modification time.

**OnitSession Interface:**

* `date`: YYYY-MM-DD format
* `time`: HH:MM or HH:MM:SS (with seconds)
* `sessionName`: Extracted from filename
* `pattern`: Which of 6 patterns matched (1-6)
* `sortKey`: Normalized timestamp for sorting
* `status`: active, completed, or archived

**Status Inference:**

* **Active**: Modified within last 24 hours (green)
* **Completed**: In WIP folder, not recently modified (blue)
* **Archived**: Graduated to wiki folder (gray)

## Filename Patterns

The viewer uses an external 6-pattern parser achieving 100% coverage of 1,873 historical files:

| Pattern | Format                         | Coverage |
| ------- | ------------------------------ | -------- |
| 1       | `YYYY-MM-DD-HH-MM-SS-name.md`  | 39.1%    |
| 2       | `YYYY-MM-DD-HH-MM-SS.md`       | 1.4%     |
| 3       | `YYYY-MM-DD-HH-MM-name.md`     | 31.7%    |
| 4       | `YYYY-MM-DD-name.md`           | 1.5%     |
| 5       | `NN-TOPIC-YYYY-MM-DD-HH-MM.md` | 0.4%     |
| 6       | `TOPIC-NAME.md` (fallback)     | 25.6%    |

This multi-pattern approach handles historical variations while maintaining backward compatibility.

## Rendering System

The render system generates a flat accordion list with status-based color coding.

**Main Components:**

* **Header**: Shows "OnIt (N)" with session count
* **Session List**: Chronological accordion items (newest first)
* **Status Badges**: Color-coded status indicators
* **Empty State**: Contextual help for WIP vs Wiki modes

**Date Display Logic:**

* Last 24 hours: Show time (e.g., "14:30")
* Last 48 hours: Show "yesterday"
* Older: Show full date (YYYY-MM-DD)

## Interaction Patterns

Two main interaction types:

### WIP/Wiki Toggle

Switches between work-in-progress sessions and archived sessions by changing the filesystem path.

```
WIP:  ~/Library/.../wip/onit/
Wiki: ~/Library/.../wiki/onit/
```

### Accordion Expansion

Click session header to load and display markdown content inline. Content is cached after first load for instant re-expansion.

**Accordion States:**

1. **Collapsed** (initial): Content hidden
2. **Loading**: Shows "Loading..." message
3. **Expanded**: Renders full markdown with sticky header
4. **Cached**: Preserves loaded content when collapsed

## State Management

Minimal state design following SMPC principles:

**State Properties:**

* `sessions`: OnitSession\[] (only custom state)
* Inherited from base: container, projectSlug, category, isWip, settings

**State Lifecycle:**

1. Initialize → Load sessions → Render → Attach listeners
2. Toggle → Update isWip → Refresh (reload + re-render)
3. Refresh → Replace sessions array → Full DOM re-render

State is unidirectional: User action → State update → DOM re-render. No reverse binding.

## Comparison with Prepare Viewer

| Feature           | OnIt       | Prepare          |
| ----------------- | ---------- | ---------------- |
| Lines of code     | 350        | 789              |
| Data structure    | Flat files | Folders + files  |
| Status states     | 3          | 4 (projects)     |
| Display modes     | 1 (list)   | 2 (cards + list) |
| Filename patterns | 6          | 1                |
| Progress tracking | No         | Yes (checkboxes) |

OnIt is the simplest wiki viewer due to its flat structure and single display mode.

<div style={{ textAlign: 'center', marginTop: '3rem', marginBottom: '2rem', fontSize: '1.5rem', fontWeight: '300', color: '#666' }}>
  THE CENTER

  <div style={{ fontSize: '0.9rem', marginTop: '0.5rem' }}>
    Visibility enables the Human-AI feedback loop
  </div>
</div>

<Card title="Technical Credibility" icon="code">
  Built on Rust IPC, Tauri commands, and xterm.js rendering. Uses external parser module for filename compatibility. Inherits shared infrastructure from WikiBaseViewer abstract class.
</Card>
