the-campfire 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -85,7 +85,7 @@
85
85
 
86
86
  ## Quick Start
87
87
 
88
- There are three ways to run Campfire: from npm, from source, or with Docker.
88
+ There are four ways to run Campfire: from npm, from source, with Docker, or as a native macOS app.
89
89
 
90
90
  ### Option 1: npm (fastest)
91
91
 
@@ -187,6 +187,22 @@ docker stop campfire && docker rm campfire
187
187
 
188
188
  See [Docker Deployment](#docker-deployment) for advanced configuration (mounting agent CLIs, reverse proxy, environment variables).
189
189
 
190
+ ### Option 4: macOS Desktop App (Apple Silicon)
191
+
192
+ A native desktop app for Macs with Apple Silicon. It bundles the full Campfire server and the Bun runtime — no Bun install needed, every feature included.
193
+
194
+ 1. Download `Campfire-<version>-arm64.dmg` from the [latest release](https://github.com/stretchcloud/campfire/releases/latest)
195
+ 2. Drag **Campfire** into **Applications**
196
+ 3. First launch: right-click the app → **Open** (the build is not notarized with Apple; if macOS still refuses, run `xattr -cr /Applications/Campfire.app` once)
197
+
198
+ The app stores its data in the same `~/.campfire` directory as the CLI, so sessions, recordings, and settings are shared. If a Campfire server is already running on port 4567 (for example the `the-campfire` background service), the app attaches to it instead of starting a second one. Agent CLIs (`claude`, `codex`, …) still need to be installed on your machine.
199
+
200
+ To build the DMG from source:
201
+
202
+ ```bash
203
+ make dmg # stages the backend, then packages desktop/dist/Campfire-<version>-arm64.dmg
204
+ ```
205
+
190
206
  ### Requirements
191
207
 
192
208
  **For native (npm or source):**
@@ -1203,17 +1219,17 @@ It operates as a non-blocking observer: no agent message is ever delayed by it,
1203
1219
 
1204
1220
  | Layer | What it does |
1205
1221
  |-------|-------------|
1206
- | **Semantic Memory** | Stores observations, decisions, and patterns from each agent session as vector embeddings in a local LanceDB database. Any session can query this shared knowledge base for relevant context before starting a task. |
1222
+ | **Semantic Memory** | Stores observations, decisions, and patterns from each session in a local LanceDB database, scoped by namespace (global / repo / session / agent). Memories decay over time unless reused, and relevant ones are auto-recalled into a session's next prompt. See [Semantic Memory](#semantic-memory-details) below. |
1207
1223
  | **Deliberation Engine** | Proposes structured decisions across sessions (e.g. "which approach should we use?"). Connected viewers and agents can respond; the engine aggregates votes with role-weighted majority and resolves to `approved`, `rejected`, or `synthesized`. |
1208
1224
  | **Capability Discovery** | Each session self-reports its strengths, available tools, and context usage. When routing a task, the engine scores all connected sessions and picks the best fit. Confidence probes can be sent to agents in real time to verify self-reported capabilities. |
1209
1225
  | **Shared Context Stream** | A live think-aloud stream where agents can inject thoughts and observations. The engine detects semantic links (agrees, disagrees, builds on, contradicts) between fragments and tracks consensus scores across the session group. |
1210
1226
 
1211
1227
  **How it works end-to-end:**
1212
1228
 
1213
- 1. When an agent produces output, the CI layer silently extracts observations and stores them as `MemoryFragment` records (with vector embeddings if an embedding provider is configured).
1214
- 2. When a user sends a message, the CI layer queries the memory store for relevant context and prepends it to the message giving agents access to knowledge from past sessions.
1229
+ 1. When an agent produces output, the CI layer extracts observations, decisions, and patterns and stores them as `MemoryFragment` records in the right namespace (with vector embeddings if an embedding provider is configured). Thinking-block content is scrubbed before anything is stored.
1230
+ 2. When a user sends a message, the CI layer recalls the most relevant memories from the repo, agent, and global namespaces (under a 250 ms budget so chat is never blocked) and prepends them to the message. The recalled items are shown to the user as a collapsible "recalled context" chip on that message.
1215
1231
  3. Browser clients can send `memory_query`, `memory_store`, `deliberation_respond`, `route_task`, and `inject_thought` messages over WebSocket. The server handles them and broadcasts results back to all connected viewers.
1216
- 4. Sessions consolidate their episodic memories into distilled `ConsolidatedKnowledge` entries when they end.
1232
+ 4. Episodic fragments are consolidated into distilled `ConsolidatedKnowledge` triggered on turn boundaries, idle, session end, or manually — via a JUDGE → DISTILL → CONSOLIDATE pipeline (see below).
1217
1233
 
1218
1234
  **Embedding providers:**
1219
1235
 
@@ -1225,16 +1241,25 @@ Vector search requires an embedding provider. Configure one in **Settings**:
1225
1241
  | `ollama` | `nomic-embed-text` (default) | 768 | Requires local Ollama instance |
1226
1242
  | `none` | — | — | Fragments stored without embeddings; metadata-only search |
1227
1243
 
1228
- Without an embedding provider, memory still works — queries fall back to a full scan filtered by session, repo root, tags, and type.
1244
+ Without an embedding provider, memory still works — recall falls back to a recency- and confidence-ranked scan over the relevant namespaces (so recent repo decisions still surface, just without semantic similarity).
1245
+
1246
+ <a id="semantic-memory-details"></a>
1247
+
1248
+ **How Semantic Memory works:**
1249
+
1250
+ - **Namespaces** — every memory lives in a scope: `global` (cross-repo conventions), `repo:<hash>` (one repository), `session:<id>` (one session's episodic notes), and `agent:<backend>` (backend-specific quirks). Recall for a session draws from repo, agent, and global scopes with per-namespace depth limits.
1251
+ - **Decay & reinforcement** — memories lose weight over time on a per-namespace half-life; being recalled reinforces a memory and extends its life (capped, so nothing becomes immortal). Low-weight, consolidated memories are eventually evicted. You can **pin** a memory so it never decays.
1252
+ - **Consolidation (JUDGE → DISTILL → CONSOLIDATE)** — raw fragments are filtered and clustered locally, then distilled into durable knowledge by an LLM (via your configured OpenRouter key). If no key is set, it falls back to a simple concatenation, badged as such in the UI — consolidation is never blocked on configuration.
1253
+ - **UI** — the Memory panel shows per-namespace counts and decayed-weight bars with pin/unpin controls; **Settings → Memory** exposes per-namespace decay half-lives, reinforce multipliers, and recall depths.
1229
1254
 
1230
1255
  **Storage:**
1231
1256
 
1232
- All CI data is stored locally under `~/.campfire/memory/lancedb/` — no external service required.
1257
+ All CI data is stored locally under `~/.campfire/memory/` — no external service required. Schema is versioned via `meta.json` and migrated automatically from earlier versions.
1233
1258
 
1234
1259
  | Table | Purpose |
1235
1260
  |-------|---------|
1236
- | `fragments.lance` | Episodic memory fragments with embeddings |
1237
- | `consolidated.lance` | Distilled knowledge synthesized from sessions |
1261
+ | `fragments_v2` | Episodic memory fragments (namespace-scoped, with embeddings when available) |
1262
+ | `consolidated_v2` | Distilled knowledge synthesized from fragments |
1238
1263
 
1239
1264
  Capability data is stored as JSON in `~/.campfire/capabilities/` and learning history is appended to `~/.campfire/capability-learning.jsonl`.
1240
1265
 
@@ -1260,12 +1285,12 @@ curl -X POST http://localhost:4567/api/sessions/route-task \
1260
1285
 
1261
1286
  | Group | Endpoints |
1262
1287
  |-------|-----------|
1263
- | Memory | `GET/POST /sessions/:id/memory`, `GET /sessions/:id/memory/query`, `POST /sessions/:id/memory/consolidate`, `GET /memory/global` |
1288
+ | Memory | `GET/POST /sessions/:id/memory`, `GET /sessions/:id/memory/query`, `GET /sessions/:id/memory/overview`, `POST /sessions/:id/memory/consolidate`, `POST /memory/pin`, `GET /memory/global` |
1264
1289
  | Deliberation | `GET /sessions/:id/deliberations`, `GET /sessions/:id/deliberations/:proposalId`, `POST .../respond`, `POST .../resolve` |
1265
1290
  | Capabilities | `POST /sessions/route-task`, `GET /capabilities`, `GET /capabilities/history`, `POST /capabilities/feedback` |
1266
1291
  | Shared Context | `GET /sessions/:id/context/stream`, `GET /sessions/:id/context/consensus`, `GET /sessions/:id/context/thread/:fragmentId` |
1267
1292
 
1268
- Architecture details are documented in [`CLAUDE.md`](CLAUDE.md). A design study for the next iteration of the memory layer lives at [`docs/design/semantic-memory-v2.md`](docs/design/semantic-memory-v2.md).
1293
+ Architecture details are documented in [`CLAUDE.md`](CLAUDE.md). The full semantic-memory design (namespaces, decay, retrieval scoring, and the consolidation pipeline) is written up in [`docs/design/semantic-memory-v2.md`](docs/design/semantic-memory-v2.md).
1269
1294
 
1270
1295
  ---
1271
1296
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "the-campfire",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "description": "Campfire \u2014 collaborative web platform for AI coding agents. Run Claude Code, Codex, Goose, Aider, and more from one browser UI with real-time collaboration, permission voting, and automation.",
6
6
  "license": "MIT",
@@ -55,6 +55,17 @@ export function generateAgentToolDefinitions(backends: BackendType[] = TOOL_BACK
55
55
  }));
56
56
  }
57
57
 
58
+ /**
59
+ * Resolve the Bun executable to launch the stdio MCP server with. When the
60
+ * server itself runs under Bun (always in production, including the desktop
61
+ * app where Bun is bundled inside the .app and not on PATH), use the absolute
62
+ * path of the current runtime so the agent CLI can spawn it without needing
63
+ * a global `bun` install.
64
+ */
65
+ function resolveBunCommand(): string {
66
+ return typeof Bun !== "undefined" && process.execPath ? process.execPath : "bun";
67
+ }
68
+
58
69
  export function createAgentMcpServerConfig(options: {
59
70
  port: number;
60
71
  token: string;
@@ -64,7 +75,7 @@ export function createAgentMcpServerConfig(options: {
64
75
  }): McpServerConfig {
65
76
  return {
66
77
  type: "stdio",
67
- command: "bun",
78
+ command: resolveBunCommand(),
68
79
  args: [`${options.packageRoot}/server/agent-mcp-stdio.ts`],
69
80
  env: {
70
81
  CAMPFIRE_AGENT_MCP_URL: `http://127.0.0.1:${options.port}/api/internal/agent-mcp`,