← Back to Plugins
Tools

Concept Ledger

tianzhiceng297-boop By tianzhiceng297-boop 👁 77 views ▲ 0 votes

OpenClaw Plugin: A living concept glossary that tracks term clarity, detects naming chaos, and helps concepts evolve from vague to implementable.

GitHub

Install

npm install concept-ledger

Configuration Example

{
  "plugins": ["concept-ledger"]
}

README

# Concept Ledger โ€” OpenClaw Plugin

A living glossary that tracks concept maturity in your conversations. The plugin automatically detects naming chaos, intervenes at the right moment, and helps concepts evolve from vague to implementable โ€” all without manual commands.

## Installation

```bash
npm install concept-ledger
```

Or build from source:

```bash
git clone <repo-url>
cd concept-ledger-plugin
npm install
npm run build
```

Add to your OpenClaw configuration:

```json
{
  "plugins": ["concept-ledger"]
}
```

## How It Works

The plugin maintains a **Concept Ledger** โ€” a background knowledge graph of every term in your conversation. It tracks each concept through a 6-state lifecycle:

### State Machine

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    definition given     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    boundaries stable    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    implementation confirmed    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  VAGUE  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ†’ โ”‚ FORMING โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ†’ โ”‚ CLEAR โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ†’ โ”‚ FROZEN โ”‚
โ”‚         โ”‚                         โ”‚         โ”‚                         โ”‚       โ”‚                                 โ”‚        โ”‚
โ”‚ metaphorโ”‚ โ†โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ downgrade โ”€โ”€โ”€โ”€โ”‚         โ”‚ โ†โ”€โ”€ definition wrong โ”€โ”€โ”€โ”‚       โ”‚ โ†โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ unfreeze โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚        โ”‚
โ”‚ /intuit โ”‚                         โ”‚         โ”‚                         โ”‚       โ”‚                                 โ”‚        โ”‚
โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                 โ””โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜
     โ”‚                                                                                                              โ”‚
     โ”‚ user tags                                                                                                     โ”‚ unreferenced
     โ–ผ                                                                                                              โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                                                                              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ METAPHOR     โ”‚                                                                                              โ”‚ ZOMBIE โ”‚
โ”‚ ONLY         โ”‚  (never upgrades)                                                                            โ”‚        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                                                                              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

### Statuses

| Status | Meaning | How to Enter |
|--------|---------|--------------|
| **Vague** | Metaphor or intuition; cannot be described without figurative language | Default entry for new concepts |
| **Forming** | Has a provisional definition; general logic can be articulated | Definition is provided by user or agent |
| **Clear** | Can be described independently and without ambiguity; boundaries explicit | Definition is stable and used consistently |
| **Frozen** | Entered implementation path; has an interface or data structure | User confirms or code appears |
| **Metaphor Only** | Explicitly declared as a figure of speech; never to be resolved | User tags it |
| **Zombie** | Frozen but no longer referenced in recent sessions | Auto-detected by scanner |

## Auto-Detection

The plugin continuously scans conversations for these signals:

| Signal | Trigger | Behavior |
|--------|---------|----------|
| **Synonym Loop** | 3+ alternative names for the same concept | Pauses and suggests unification |
| **Definition Drift** | Meaning of a Forming/Clear concept shifts significantly | Alerts: upgrade or redefinition? |
| **Metaphor Overreach** | Vague concept tied to implementation details | Blocks: define clearly first |
| **Concept Collision** | Two concepts are logically equivalent | Suggests merging |
| **Zombie Concept** | Frozen concept unreferenced in 5+ sessions | Marks as Zombie, suggests review |

## User Gestures

| Gesture | Effect |
|---------|--------|
| `Lock [Concept] = [Definition]` | Freeze directly with final definition |
| `Merge [A], [B]` | Merge B into A; A inherits all associations |
| `Discard [Concept]` | Remove from ledger entirely |
| `Metaphor only [Concept]` | Mark as Metaphor Only; plugin stops pushing for upgrade |
| `Unfreeze [Concept]` | Frozen โ†’ Clear; allow modification |

## Session Wrap-Up

At the end of each session, the plugin embeds a concept inventory:

```
Concept inventory for this session:
  Frozen (2)   Data Funnel, Event Pipeline โ€” ready for implementation
  Clear  (1)   Message Decay โ€” suggest freezing after confirming interface
  Forming (2)  Perception Gateway, Sentiment Probe โ€” continue refining
  Vague  (1)   Green Channel โ€” suggest discarding or redefining
  Zombie (0)   None
```

## Configuration

```json
{
  "projectId": "my-project",
  "autoIntervene": true,
  "synonymThreshold": 0.85
}
```

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `projectId` | string | `"default"` | Isolate ledgers by project |
| `autoIntervene` | boolean | `true` | Whether to automatically intervene when signals are detected |
| `synonymThreshold` | number | `0.85` | Jaro-Winkler similarity threshold for synonym detection |

## Storage

All data is stored in **local JSON files** at:

```
~/.openclaw/concept-ledger/{projectId}.json
```

- Data is written atomically (temp file โ†’ rename) to prevent corruption
- Automatic schema migration on version upgrades
- Path safety validation prevents directory traversal

## Disclaimer

**This plugin operates entirely locally.** It reads and writes only JSON files in the `~/.openclaw/concept-ledger/` directory. It does not:

- Make any network requests
- Execute shell commands
- Read environment variables
- Upload any data to external services
- Access files outside the `concept-ledger` storage directory

## Development

```bash
npm install
npm run build
npm test
```

### Project Structure

```
src/
โ”œโ”€โ”€ index.ts       # Plugin entry: register(api), lifecycle hooks
โ”œโ”€โ”€ ledger.ts      # State machine engine, transitions, commands
โ”œโ”€โ”€ scanner.ts     # Term scanner: 5 detection signals
โ”œโ”€โ”€ parser.ts      # LLM response parser: concepts, definitions, gestures
โ”œโ”€โ”€ store.ts       # JSON persistence with atomic writes
โ”œโ”€โ”€ types.ts       # All type definitions
โ””โ”€โ”€ __tests__/     # Test files
    โ”œโ”€โ”€ ledger.test.ts
    โ”œโ”€โ”€ scanner.test.ts
    โ””โ”€โ”€ store.test.ts
```

## License

MIT

## Security Statement

This plugin operates entirely on local JSON files (`~/.openclaw/concept-ledger/`). It does not upload any data to remote servers, make network requests, execute shell commands, or read environment variables. File paths are strictly validated via `path.relative` whitelist to prevent directory traversal attacks.

## Migrating from the Skill

If you previously used the Concept Ledger Skill (pure document version), the Plugin version offers:

- **True cross-session persistence**: The Skill version starts from scratch each session; the Plugin version automatically saves and restores concept state
- **Automatic signal detection**: The Skill version relies on the LLM to consciously scan conversations; the Plugin version executes detection with hardcoded thresholds in hooks
- **Hardcoded state machine constraints**: The Skill version's state transitions could be ignored or bypassed by the LLM; the Plugin version enforces transitions via the TRANSITIONS table โ€” invalid transitions throw errors
- **Path safety**: The Plugin version enforces whitelist path validation on all file I/O; the Skill version has no file operations

The Skill version is lightweight, requires no build step, and suits quick experimentation. The Plugin version is more robust, ideal for long-term projects that need consistent terminology across sessions.
tools

Comments

Sign in to leave a comment

Loading comments...