Skip to content
Back to skills

Ewig Editor

ASecurity

The eternal text editor — Didactic Ersatz Emacs demonstrating immutable

  • 61 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 6, 2026
code-qualityc++bashrefactoringgit

Works with

  • cursor
  • terminal
  • mcp

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 6, 2026

npx -y skills add plurigrid/asi --skill ewig-editor --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ewig Editor?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ewig Editor
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/plurigrid-ewig-editor/badge)](https://www.skillsdirectory.com/skills/plurigrid-ewig-editor)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ewig-editor
description: The eternal text editor — Didactic Ersatz Emacs demonstrating immutable
  data-structures and the single-atom architecture.
metadata:
  trit: 0
---

# Ewig - Eternal Didactic Text Editor

The eternal text editor — Didactic Ersatz Emacs demonstrating immutable data-structures and the single-atom architecture.

## Repository
- **Source**: https://github.com/bmorphism/ewig (fork of arximboldi/ewig)
- **Language**: C++ (immer library)
- **Pattern**: Persistent data structures + single atom state

## Core Concept

Ewig demonstrates how to build a text editor using:
1. **Immutable data structures** - All state changes create new versions
2. **Single-atom architecture** - One atom holds the entire application state
3. **Structural sharing** - Efficient memory via shared structure

```cpp
// Single atom state
atom<editor_state> state;

// All mutations are pure transformations
state.update([](editor_state s) {
    return s.insert_char('x');  // Returns new state, doesn't mutate
});
```

## Architecture

```
┌─────────────────────────────────────────────────────┐
│                      Ewig                           │
├─────────────────────────────────────────────────────┤
│                                                     │
│   ┌─────────────────────────────────────────────┐   │
│   │              Single Atom                    │   │
│   │         (immutable editor_state)            │   │
│   └─────────────────────────────────────────────┘   │
│        │                              │             │
│        ▼                              ▼             │
│   ┌─────────┐                    ┌─────────┐       │
│   │ immer   │   structural       │ lager   │       │
│   │ vectors │   sharing          │ cursors │       │
│   └─────────┘                    └─────────┘       │
│                                                     │
└─────────────────────────────────────────────────────┘
```

## Key Libraries

### immer
Persistent immutable data structures for C++:
```cpp
#include <immer/vector.hpp>

immer::vector<char> buffer = {'h', 'e', 'l', 'l', 'o'};
auto new_buffer = buffer.push_back('!');  // O(log n), shares structure
```

### lager
Unidirectional data-flow architecture:
```cpp
auto store = lager::make_store<action>(
    model{},
    lager::with_reducer(update),
    lager::with_effect(effect)
);
```

## Relevance to CRDT/Collaborative Editing

Ewig's immutable architecture aligns with CRDT principles:

| Ewig Concept | CRDT Parallel |
|--------------|---------------|
| Immutable state | Operation-based CRDT |
| Structural sharing | Delta-state CRDT |
| Single atom | Causal consistency |
| Pure transformations | Commutative operations |

## Integration with crdt-vterm-bridge

The single-atom pattern can be applied to terminal state:

```cpp
// Terminal state as immutable atom
struct terminal_state {
    immer::flex_vector<line> lines;
    cursor_pos cursor;
    gf3_trit trit;  // GF(3) assignment
};

atom<terminal_state> term_state;
```

## Building

```bash
git clone https://github.com/bmorphism/ewig
cd ewig
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
./ewig
```

## Related Skills
- `code-refactoring` - Immutable refactoring patterns
- `bisimulation-game` - State equivalence
- `gay-mcp` - Deterministic UI coloring

Files in this skill

  • CONCOMITANT_SKILLS.md878 B
  • SKILL.md3.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in code-quality →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.