mur-common 2.22.0

Shared types and traits for the MUR ecosystem
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
# MUR

[![Release](https://img.shields.io/github/v/release/mur-run/mur)](https://github.com/mur-run/mur/releases)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

**The learning layer for AI coding tools.**

MUR is the only system that captures patterns from your coding sessions, evolves them over time, and injects them into 16+ AI tools automatically. Unlike static rules files or generic memory APIs, MUR's patterns mature, decay, and adapt — so your AI assistants continuously get smarter.

## Why MUR?

Every AI coding tool starts from scratch. You repeat the same instructions, lose hard-won discoveries, and maintain separate config files for each tool.

**MUR closes the loop.**

```
Session 1:  You correct the AI → MUR captures the pattern (Draft)
Session 5:  Pattern auto-promoted to Emerging (validated by usage)
Session 20: Pattern reaches Stable — injected with high confidence
Month 3:    Unused patterns decay. Active ones get promoted to Canonical.
```

### How MUR compares

| | **Rules sync tools** (ai-rulez, rulesync) | **Agent memory** (Mem0, Zep, Letta) | **MUR** |
|---|---|---|---|
| Multi-tool sync | Yes (static files) | No | Yes (16+ tools) |
| Learns from sessions | No | Generic memory | Developer-specific patterns |
| Pattern evolution | No | No | Decay, maturity lifecycle, GEP |
| Feedback loop | No | No | Reinforcement + contradiction detection |
| Data format | Markdown/YAML | Opaque DB / API | YAML + Git-friendly |
| Privacy | Local | Cloud-dependent | 100% local-first |

> **In short:** Rules sync tools write config files but don't learn. Memory frameworks store data but don't evolve it. MUR does both — and connects them in a closed loop.

### Agents (P0a — `murmur`)

`mur agent ...` spawns and manages long-running per-agent processes that
speak A2A v0.3. Each agent has its own profile, prompt, MCP servers,
skills, entitlements, and Unix socket; the runtime is one BusyBox-style
binary symlinked once per agent (`mur_agent_<name>` → `mur-agent-runtime`).
See [`mur-agent-runtime/README.md`](mur-agent-runtime/README.md) for the
walkthrough (`create / start / send / card / list / export`).

## Quick Start

```bash
# macOS / Linux — one-liner
curl -fsSL https://mur.run/install.sh | sh

# Interactive setup — configures embeddings, hooks, and sync targets
mur init

# Search your skill library
mur search "testing patterns"

# Sync to all your AI tools (Claude Code, Gemini CLI, Cursor, etc.)
mur sync
```

<details>
<summary>Other install methods</summary>

```bash
# Windows (PowerShell)
irm https://mur.run/install.ps1 | iex

# macOS — signed installer
# Download mur-aarch64-apple-darwin.dmg from the Releases page and double-click.

# Homebrew (macOS arm64)
brew install mur-run/tap/mur

# crates.io
cargo install mur

# Keep up to date
mur update           # check + install latest
mur update --check   # check only, don't install
```

</details>

## How It Works

```
 You use AI CLI normally
 $ claude "write tests for auth module"
 MUR hooks inject relevant patterns ──────────────────────┐
 [swift-testing, error-handling, auth-conventions]         │
              │                                            │
              ▼                                            │
 AI responds with your preferences                        │
              │                                            │
              ▼                                            │
 Post-session feedback loop ◄─────────────────────────────┘
 • Contradiction detection
 • Pattern reinforcement / decay
 • Cross-session emergence clustering
```

Patterns start as **Draft**, get promoted through **Emerging → Stable → Canonical** based on real usage, and automatically decay if unused. No junk accumulates.

## Features

| Feature | Description |
|---------|-------------|
| **Closed-Loop Learning** | Session recording → pattern extraction → injection → feedback → evolution. No other tool does all five. |
| **Pattern Evolution Engine** | Time decay (exponential half-life), maturity lifecycle (Draft→Canonical), GEP-based genetic evolution, auto-promotion/demotion. **No competitor has this.** |
| **Universal Sync** | 16+ tools: Claude Code, Gemini CLI, Auggie, Cursor, Copilot CLI, OpenClaw, OpenCode, Amp, Codex, Aider, Windsurf, Zed, Junie, Trae, Cline, Amazon Q |
| **Hybrid Semantic Search** | Vector similarity (70%) + BM25 keyword (30%) + 6-factor scoring. More precise than pure vector search. |
| **Workflow Engine** | Multi-step workflows with variables, tools, and session extraction |
| **Embedded Dashboard** | Built-in web UI for pattern management, workflow editing, and session review |
| **YAML + Git Friendly** | Human-readable patterns, version-controllable, no opaque database lock-in |
| **100% Local First** | All data on your machine. Zero telemetry. Injection scanning + content hashing for security. |
| **Multi-language** | Dashboard UI in English, 繁體中文, 简体中文 |

## Dashboard

MUR includes a built-in web dashboard for visual management:

```bash
# Start the dashboard
mur serve

# Opens at http://localhost:3847
```

The dashboard provides:
- **Pattern management** — view, edit, filter by maturity/tier/tags, bulk operations
- **Workflow editor** — create, edit, and search workflows with semantic search
- **Session review** — browse recordings, extract workflows from sessions
- **Statistics** — confidence distribution, maturity breakdown, decay warnings
- **Settings** — data source config, export/import, theme toggle

## Workflows

Workflows are reusable multi-step procedures extracted from your sessions:

```bash
# Record a session
mur session start
# ... do your work in an AI CLI ...
mur session stop

# Extract a workflow from the session (via dashboard)
mur serve
# → Sessions → Select session → "Extract Workflow"

# Or create manually
mur workflow new "deploy-staging"

# Search workflows (semantic + keyword)
mur workflow search "deploy process"

# Show workflow as AI-readable prompt
mur workflow show "deploy-staging" --md

# Run a workflow (outputs executable prompt for AI)
mur run "deploy"
```

Workflows support:
- **Variables** — string, url, path, number, bool, array types with defaults
- **Tool detection** — auto-detects agent-browser, MCP servers, etc.
- **Smart extraction** — heuristic title, description, and variable detection from session recordings

## CLI Commands

```
mur
├── init               Interactive setup wizard
├── search <query>     Semantic + keyword hybrid search
├── inject             Inject matching patterns into context
├── context            Preview what would be injected
├── sync               Sync skills to all AI tools + auto-reindex
│   ├── status         Show sync status (queue depths, last fetch)
│   └── fleet          Sync profiles + skills across devices (Pro)
│       ├── pull       Pull from remote to local
│       ├── push       Push from local to remote
│       ├── both       Two-way sync (push then pull)
│       └── [--force-local] Override local on conflict
├── serve              Start the web dashboard
├── stats              Skill library statistics
├── suggest            Skill suggestion & composition
├── workflow
│   ├── list           List all workflows
│   ├── show <name>    Show workflow details (--md for AI format)
│   ├── search <q>     Semantic search workflows
│   └── new <name>     Create a new workflow
├── skill
│   ├── install        Install a skill
│   ├── list           List installed skills
│   ├── show <name>    Show skill details
│   ├── from-pattern   Migrate legacy patterns to skills (deprecated)
│   └── recombine <a> <b>  Combine two skills into new draft (M7b)
├── run <query>        Find and output workflow as executable prompt
├── session
│   ├── start          Start recording a session
│   ├── stop           Stop recording
│   ├── record         Record an event
│   ├── status         Current session status
│   └── list           List past sessions
├── exchange
│   ├── import         Import skill file
│   └── export         Export skill to MKEF
├── gc                 Garbage collect expired skills
├── reindex            Rebuild vector search index
└── community          Browse community skills
```

## Semantic Search

Find patterns by meaning, not just keywords:

```bash
# With Ollama (free, local — recommended)
ollama pull qwen3-embedding:0.6b
mur reindex

# With OpenAI
export OPENAI_API_KEY=sk-...
mur reindex

# Search naturally
mur search "how to handle authentication errors"
# → error-handling-auth (0.84)
# → retry-with-backoff  (0.71)
```

> **Note:** Semantic search requires an embedding provider (Ollama or OpenAI). Without one, MUR falls back to keyword search. Run `mur init` to configure.

## Pattern Format

Patterns are YAML files in `~/.mur/patterns/`:

```yaml
schema: 2
name: swift-testing-macro
description: Prefer Swift Testing over XCTest
content:
  technical: |
    Use @Test macro instead of func test...()
    Use #expect() instead of XCTAssert
  principle: |
    Swift Testing is more expressive and supports async natively
tier: project
importance: 0.8
confidence: 0.7
maturity: stable
tags:
  languages: [swift]
  topics: [testing]
applies:
  languages: [swift]
```

## Configuration

```yaml
# ~/.mur/config.yaml
embedding:
  provider: ollama              # ollama | openai | gemini | anthropic
  model: qwen3-embedding:0.6b  # run mur init for options
  dimensions: 1024

llm:
  provider: anthropic
  model: claude-sonnet-4-20250514
  api_key_env: ANTHROPIC_API_KEY

ask:
  summarize_hits_enabled: true  # Enable abstractive compression in overflow cascade
  summarize_model: null         # Override model for Stage 1b (null → falls back to ask.model)
```

Run `mur init` for an interactive setup wizard.

### Ask Configuration

The `ask` section controls behavior of `mur ask` queries:

- **`summarize_hits_enabled`** (default `true`) — When context is tight, `mur ask` runs an overflow cascade that compresses the longest hits using an abstractive summarization stage. This trades accuracy for context efficiency. Results cache per-hit at `~/.mur/conversations/cache/abstractive/` to amortize LLM cost. Summarization has a hardcoded 5s per-hit timeout and soft-fails silently on error. Set to `false` to restore pre-3.5 behavior (drop history first).

- **`summarize_model`** (default `null`) — Override the LLM model used for Stage 1b summarization. When `null`, falls back to `ask.model`. Pair with a faster model like `qwen3:4b` to trade summarization accuracy for speed on tight-budget queries.

#### CLI overrides (per-invocation)

Override the `summarize_*` config keys for a single `mur ask` invocation without editing `~/.mur/config.yaml`:

- **`--no-summarize`** — Disable Stage 1b for this invocation. Overrides `ask.summarize_hits_enabled`. Useful for demos, benchmarks, or scripted comparisons.

- **`--summarize-model <model>`** — Override the Stage 1b model for this invocation. Overrides `ask.summarize_model`. Pair with a faster model like `qwen3:4b` to trade quality for speed on the summarize hop. The cache key includes the model name, so changing this flag produces a fresh cache entry.

The two flags are mutually exclusive: passing both errors at argument-parse time.

## AI Tool Integration

MUR syncs patterns to your AI tools via their native skill/rules systems:

| Tool | Sync Target |
|------|-------------|
| Claude Code | `~/.claude/CLAUDE.md` |
| Gemini CLI | `~/.gemini/GEMINI.md` |
| Cursor | `.cursor/rules/` |
| OpenClaw | `~/.agents/skills/mur/` |
| Auggie | `~/.augment/skills/mur/` |
| Others | See `mur init --hooks` |

```bash
# Sync once
mur sync

# Auto-inject before each AI session (via shell hooks)
mur init --hooks
```

## Fleet Sync (Pro)

Sync your skills and agent profiles across multiple devices. Fleet Sync uses event-union merge for usage statistics and Last-Writer-Wins (LWW) for manifest conflicts — so your local and remote copies stay in sync even with concurrent edits.

```bash
# Pull remote skills and profiles to local device
mur sync fleet pull

# Push local skills and profiles to remote server
mur sync fleet push

# Two-way sync (push first, then pull)
mur sync fleet both

# Override local version on conflict
mur sync fleet pull --force-local
```

Fleet Sync:
- **Event-union merge** — Deduplicates skill usage events (retrievals, executions, dismissals) across devices
- **Manifest conflict resolution** — Newer manifest wins by timestamp; `--force-local` to keep local version
- **Pro feature** — Requires an active Pro subscription for server-side fleet storage
- **Skill corpus** — Syncs all installed skills with their event logs and metadata
- **Agent profiles** — Syncs agent names, custom instructions, and model bindings

## Privacy & Security

- **100% local** — all patterns stored on your machine (`~/.mur/`)
- **No telemetry** — zero usage data collected
- **Injection scanning** — patterns checked for prompt injection attempts
- **Content hashing** — tamper detection on pattern files
- **Trust levels** — community patterns sandboxed from local ones

## Architecture

```
mur-common/     Shared types (Pattern, Workflow, KnowledgeBase, Config)
mur-core/       CLI + server + all logic
```

- `mur-common/src/coordination/` — Shared coordination protocol types (Plan/Step/Microstep schema, Verify Gateway, conformance suite). Used by mur-runtime and mur-commander.

~12,000 lines of Rust. YAML as source of truth with a rebuildable LanceDB vector index.

## System Requirements

- **macOS** (Apple Silicon or Intel) — primary platform
- **Linux** — supported
- **Optional:** [Ollama]https://ollama.com for local embeddings (recommended)
- **Optional:** OpenAI API key for cloud embeddings

## Companion mode (Phase 1.1)

Companion mode adds a relationship-keyed warm voice into an agent's `sys_prompt` and an opt-in proactive outbox. The voice is composed once from onboarding answers and can be ejected to disk for manual editing; the outbox sends occasional context-aware check-ins based on time-of-day situation weights and a bandit-state picker — all fully local, no cloud required.

```bash
mur agent create my-buddy --provider stub
mur agent companion init my-buddy --answers <fixture>
mur agent companion proactive enable my-buddy   # opt in to occasional check-ins
mur agent companion inbox my-buddy --unread-only
mur agent companion ack <msg-id> --good
```

| Subcommand | Description |
|---|---|
| `companion proactive enable\|disable` | Toggle proactive sends on/off |
| `companion quiet --for\|--until\|--off` | Pause proactive sends for a duration or until a timestamp |
| `companion voice eject\|rebuild\|diff` | Manage the composed `voice.md` file on disk |
| `companion templates eject [--scope]` | Eject embedded voice templates for editing |
| `companion content add <situation>` | Add entries to the content pool for a situation |
| `companion inbox [--unread-only]` | List messages; filter to unread |
| `companion ack <id> --good\|--bad\|--dismiss` | Rate or dismiss a message |
| `companion preview --situation <s> [--no-llm]` | Preview a generated message without sending |
| `companion why-did-you-message [<id>]` | Replay the event chain that triggered a message |
| `companion rhythm wipe` | Reset companion state (preserves voice config) |

## Contributing

Issues and PRs welcome.

```bash
git clone https://github.com/mur-run/mur.git
cd mur
cargo test --workspace
```

## License

MIT