jfl 0.6.3 → 0.7.1

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.
Files changed (51) hide show
  1. package/README.md +124 -952
  2. package/dist/commands/context-hub.d.ts.map +1 -1
  3. package/dist/commands/context-hub.js +96 -0
  4. package/dist/commands/context-hub.js.map +1 -1
  5. package/dist/commands/init.d.ts +11 -2
  6. package/dist/commands/init.d.ts.map +1 -1
  7. package/dist/commands/init.js +179 -126
  8. package/dist/commands/init.js.map +1 -1
  9. package/dist/commands/kanban.d.ts +34 -0
  10. package/dist/commands/kanban.d.ts.map +1 -0
  11. package/dist/commands/kanban.js +216 -0
  12. package/dist/commands/kanban.js.map +1 -0
  13. package/dist/commands/peter.d.ts.map +1 -1
  14. package/dist/commands/peter.js +37 -0
  15. package/dist/commands/peter.js.map +1 -1
  16. package/dist/commands/setup.d.ts.map +1 -1
  17. package/dist/commands/setup.js +79 -1
  18. package/dist/commands/setup.js.map +1 -1
  19. package/dist/commands/verify.d.ts.map +1 -1
  20. package/dist/commands/verify.js +28 -0
  21. package/dist/commands/verify.js.map +1 -1
  22. package/dist/dashboard-static/assets/index-CW8oWAdr.css +1 -0
  23. package/dist/dashboard-static/assets/index-Ck8f9dcM.js +121 -0
  24. package/dist/dashboard-static/index.html +2 -2
  25. package/dist/index.js +69 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/lib/agent-session.d.ts.map +1 -1
  28. package/dist/lib/agent-session.js +66 -33
  29. package/dist/lib/agent-session.js.map +1 -1
  30. package/dist/lib/flow-engine.d.ts.map +1 -1
  31. package/dist/lib/flow-engine.js +38 -8
  32. package/dist/lib/flow-engine.js.map +1 -1
  33. package/dist/lib/kanban-github.d.ts +81 -0
  34. package/dist/lib/kanban-github.d.ts.map +1 -0
  35. package/dist/lib/kanban-github.js +318 -0
  36. package/dist/lib/kanban-github.js.map +1 -0
  37. package/dist/lib/kanban.d.ts +131 -0
  38. package/dist/lib/kanban.d.ts.map +1 -0
  39. package/dist/lib/kanban.js +340 -0
  40. package/dist/lib/kanban.js.map +1 -0
  41. package/dist/lib/service-gtm.d.ts.map +1 -1
  42. package/dist/lib/service-gtm.js +11 -0
  43. package/dist/lib/service-gtm.js.map +1 -1
  44. package/dist/lib/setup/agent-generator.d.ts +5 -0
  45. package/dist/lib/setup/agent-generator.d.ts.map +1 -1
  46. package/dist/lib/setup/agent-generator.js +209 -3
  47. package/dist/lib/setup/agent-generator.js.map +1 -1
  48. package/package.json +1 -1
  49. package/scripts/train/v2/domain.json +62 -14
  50. package/dist/dashboard-static/assets/index-CW9ZxqX8.css +0 -1
  51. package/dist/dashboard-static/assets/index-DNN__p4K.js +0 -121
package/README.md CHANGED
@@ -1,1046 +1,218 @@
1
- # JFL - Just Fucking Launch
1
+ <h1 align="center">JFL Just Fucking Launch</h1>
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/jfl.svg)](https://www.npmjs.com/package/jfl)
3
+ <p align="center">
4
+ <strong>Multiplayer AI. Persistent context. Self-driving agents.</strong>
5
+ </p>
4
6
 
5
- **The engineering intelligence platform.**
6
-
7
- JFL provides persistent context, autonomous agents, and self-driving improvement loops for any project. Agents read past sessions, understand decisions, track eval scores, and propose improvements — all backed by structured files in git.
8
-
9
- Context lives in git as structured files (markdown, JSONL). Any AI tool can integrate via MCP.
10
-
11
- **Quick Links:** [GitHub](https://github.com/402goose/jfl-cli) | [npm](https://www.npmjs.com/package/jfl)
12
-
13
- ---
14
-
15
- ## What Problem Does This Solve?
16
-
17
- AI agents are stateless. Each session starts from scratch:
18
- - Previous decisions aren't remembered
19
- - Work from other sessions isn't visible
20
- - Context has to be re-explained every time
21
- - Agent improvements aren't measured or tracked
22
-
23
- JFL provides a shared context layer that accumulates over time, measures agent performance, and enables autonomous improvement loops — accessible to any AI tool.
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/jfl"><img src="https://img.shields.io/npm/v/jfl.svg" alt="npm version" /></a>
9
+ <a href="https://github.com/402goose/jfl-cli/actions"><img src="https://img.shields.io/github/actions/workflow/status/402goose/jfl-cli/ci.yml?branch=main" alt="CI" /></a>
10
+ <a href="https://github.com/402goose/jfl-cli"><img src="https://img.shields.io/github/stars/402goose/jfl-cli" alt="GitHub stars" /></a>
11
+ <img src="https://img.shields.io/badge/tests-952%20passing-brightgreen" alt="tests" />
12
+ <a href="https://github.com/402goose/jfl-cli/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT license" /></a>
13
+ </p>
24
14
 
25
15
  ---
26
16
 
27
- ## Installation
17
+ AI agents are stateless. Each session starts from scratch — decisions aren't remembered, work from other sessions is invisible, and context has to be re-explained every time.
28
18
 
29
- ```bash
30
- npm install -g jfl
31
- ```
32
-
33
- **Requirements:** Node >= 18
34
-
35
- **Also installs:**
36
- - `jfl-context-hub-mcp` — MCP server binary for Context Hub
37
- - `jfl-service-registry-mcp` — MCP server binary for Service Registry
19
+ **JFL gives every project a shared brain.** Context accumulates in git. Agents read past sessions, track eval scores, and propose improvements autonomously. Works with Claude Code, Pi, or any AI via MCP.
38
20
 
39
21
  ---
40
22
 
41
23
  ## Quick Start
42
24
 
43
25
  ```bash
44
- # Create a GTM workspace
45
- jfl init -n my-project
46
-
47
- # Start working
48
- cd my-project
49
- claude # Claude Code — hooks fire automatically
50
-
51
- # Inside Claude Code:
52
- /hud # Project dashboard — start here
26
+ npm install -g jfl
27
+ jfl init -n my-project && cd my-project
28
+ claude # or: jfl pi
53
29
  ```
54
30
 
55
- That's it. SessionStart hooks handle repo sync, session branching, Context Hub startup, and auto-commit. You just work.
31
+ That's it. Session hooks handle repo sync, branching, Context Hub startup, and auto-commit. You just work.
56
32
 
57
33
  ---
58
34
 
59
- ## Architecture
60
-
61
- JFL supports a three-level hierarchy: **Portfolio > GTM > Services**. Portfolios coordinate multiple products. GTMs are context layers for individual products. Services are the repos that do the actual work.
35
+ ## How It Works
62
36
 
63
37
  ```
64
- visa-portfolio/ <- Portfolio (strategy, cross-product RL, data flow)
65
- ├── .jfl/
66
- │ ├── config.json <- type: "portfolio", registered child GTMs
67
- │ ├── eval.jsonl <- Aggregated eval data from all children
68
- │ ├── flows.yaml <- Cross-product event routing
69
- │ └── journal/ <- Portfolio-level + synced child journals
70
-
71
- ├── productrank-gtm/ <- GTM workspace (registered as child)
72
- │ ├── .jfl/
73
- │ │ ├── config.json <- type: "gtm", portfolio_parent, registered services
74
- │ │ ├── eval.jsonl <- Eval entries from arena competitions
75
- │ │ ├── journal/ <- Session journals + synced service journals
76
- │ │ ├── agents/ <- Agent manifests + policies
77
- │ │ ├── flows/ <- Per-agent flow definitions
78
- │ │ └── service-events.jsonl
79
- │ ├── knowledge/ <- Strategy docs (VISION, ROADMAP, THESIS, etc.)
80
- │ ├── content/ <- Generated content
81
- │ ├── suggestions/ <- Per-contributor workspaces
82
- │ ├── .claude/
83
- │ │ ├── settings.json <- Claude Code hooks
84
- │ │ ├── agents/ <- Service agent definitions
85
- │ │ └── skills/ <- Slash commands (/hud, /content, etc.)
86
- │ ├── scripts/session/ <- Session management
87
- │ ├── CLAUDE.md <- AI instructions
88
- │ └── .mcp.json <- MCP server config
89
-
90
- └── seo-agent/ <- Another GTM (registered as child)
91
- └── ...
92
-
93
- my-api/ <- Service repo (registered in GTM)
94
- ├── src/
95
- ├── .jfl/config.json <- type: "service", gtm_parent: "/path/to/gtm"
96
- └── .jfl/journal/ <- Service journals (synced to GTM on session end)
38
+ You (or agent) works in a session
39
+ Journal captures decisions, features, fixes
40
+ Context Hub indexes everything (memory + semantic search)
41
+ Next session starts with full context automatically
42
+ Eval framework tracks agent performance
43
+ Self-driving loop proposes improvements
44
+ → Auto-merge if eval scores improve
97
45
  ```
98
46
 
99
- **Why separate?**
100
- - Clean separation of concerns
101
- - Services work independently
102
- - Multiple services register to one GTM
103
- - `jfl update` updates tooling without touching service code
104
- - Eval data dual-writes up the chain (service > GTM > portfolio)
105
- - Cross-product event routing at portfolio level
47
+ **Everything lives in git** — `.jfl/journal/`, `.jfl/eval.jsonl`, `knowledge/` docs. No external database. Any AI can read it.
106
48
 
107
49
  ---
108
50
 
109
- ## Core Systems
110
-
111
- ### Context Hub
112
-
113
- A per-project daemon that aggregates journal entries, knowledge docs, code headers, and events into a unified context layer. Any AI can query it via MCP.
114
-
115
- ```bash
116
- jfl context-hub ensure # Start if not running (idempotent)
117
- jfl context-hub status # Check health
118
- jfl context-hub stop # Stop daemon
119
- jfl context-hub restart # Restart daemon
120
- jfl context-hub doctor # Diagnose all projects (OK/ZOMBIE/DOWN/STALE)
121
- jfl context-hub ensure-all # Start for all GTM projects
122
- jfl context-hub dashboard # Open web dashboard (opens browser)
123
- jfl context-hub install-daemon # Auto-start on boot (launchd/systemd)
124
- jfl context-hub uninstall-daemon # Remove auto-start
125
- jfl context-hub query # Query context from CLI
126
- jfl context-hub serve # Run in foreground (daemon mode)
127
- ```
128
-
129
- **Per-project ports** assigned automatically (or set in `.jfl/config.json` > `contextHub.port`).
130
-
131
- **MCP Tools** (available to Claude Code and any MCP client):
132
-
133
- | Tool | What It Does |
134
- |------|-------------|
135
- | `context_get` | Unified context (journal + knowledge + code headers) |
136
- | `context_search` | Semantic search across all sources |
137
- | `context_status` | Daemon health check |
138
- | `context_sessions` | Activity from other sessions |
139
- | `memory_search` | Search indexed journal memories |
140
- | `memory_status` | Memory system statistics |
141
- | `memory_add` | Add manual memory entry |
142
- | `events_publish` | Publish event to MAP event bus |
143
- | `events_recent` | Get recent events (with pattern filter) |
144
- | `query_experiment_history` | Query RL trajectories for agent experiments |
145
-
146
- **Resilience:** 5-layer system — MCP auto-recovery on ECONNREFUSED, health-check-before-ensure hooks, `ensure-all` for batch startup, `doctor` diagnostics, launchd/systemd daemon with keepalive.
147
-
148
- ### Dashboard
149
-
150
- A pre-built Vite + Preact + Tailwind SPA served by Context Hub at `/dashboard/`. Auto-detects workspace type and adapts layout.
151
-
152
- **Pages:**
153
-
154
- | Page | What It Shows |
155
- |------|--------------|
156
- | **Overview** | Activity charts, product cards, metric cards |
157
- | **Journal** | Searchable journal entries with type filters |
158
- | **Events** | Live event feed with pattern filter presets (eval, session, flow, etc.) |
159
- | **Services** | Registered services with type badges, context scope visualization, data flows |
160
- | **Flows** | Flow definitions and execution history |
161
- | **Health** | System metrics, context sources, memory index, tracked projects |
162
- | **Agents** | Eval leaderboards grouped by product domain |
163
- | **Experiments** | Experiment runs with dot plots — green (improved) / gray (no change) / red (regression) |
164
- | **Telemetry** | Cost breakdown, command usage, error rates, hub health metrics |
165
- | **Topology** | Service dependency graph and event flow visualization |
166
-
167
- **Features:** Sidebar with structured sections (Workspace / Infra / Eval), inline SVG icons, agent leaderboard in sidebar, sparkline charts, real-time polling.
168
-
169
- ```bash
170
- jfl context-hub dashboard # Opens /dashboard/ in browser
171
- jfl viz dash # Terminal equivalent (no browser needed)
172
- ```
173
-
174
- ### MAP Event Bus
175
-
176
- Metrics, Agents, Pipeline — an in-process event bus inside Context Hub.
177
-
178
- - **Ring buffer** (1000 events) with JSONL persistence
179
- - **Service event bridge** — watches `.jfl/service-events.jsonl`, converts to events
180
- - **Journal bridge** — watches `.jfl/journal/`, emits events on new entries
181
- - **Pattern-matching subscriptions** (glob support)
182
- - **Transports:** SSE, WebSocket, HTTP polling
183
- - **Cross-product routing** — portfolio flows route events between child GTMs
184
- - **Event types:** `session:started`, `session:ended`, `eval:scored`, `journal:entry`, `flow:triggered`, `agent:iteration-complete`, `portfolio:phone-home`, `review:findings`, `telemetry:insight`, `peter:pr-proposed`, and more
185
-
186
- Services emit events by appending to `.jfl/service-events.jsonl` — no auth needed, Context Hub watches the file automatically.
187
-
188
- ### Eval Framework
51
+ ## Core Concepts
189
52
 
190
- Track agent performance over time. Eval entries dual-write up the parent chain (service > GTM > portfolio) so every level has visibility.
53
+ | Concept | What It Is | How It Works |
54
+ |---------|-----------|-------------|
55
+ | **Context Hub** | Per-project daemon | Aggregates journals, knowledge, code into unified API. MCP + HTTP. |
56
+ | **Journal** | Structured session log | JSONL entries: features, decisions, fixes, discoveries. Replay buffer for RL. |
57
+ | **Eval Framework** | Agent scorecard | Composite scores, leaderboards, trajectories. Dual-writes up parent chain. |
58
+ | **Self-Driving Loop** | Autonomous improvement | Detect issue → create fix → eval → auto-merge if improved. |
59
+ | **MAP Event Bus** | Nervous system | Events flow between agents, services, and flows. SSE + WebSocket. |
60
+ | **Flow Engine** | Declarative automation | YAML trigger-action flows: `eval:scored` → auto-merge, `telemetry:insight` → spawn fix. |
61
+ | **Pi Runtime** | Multi-model TUI agent | JFL extension for Pi — full context injection, tools, custom rendering. |
62
+ | **Kanban** | Task board | GitHub Issues-backed cards: `jfl kanban add` → `pick` → `done`. Dashboard + Peter integration. |
191
63
 
192
- ```bash
193
- jfl eval list # List recent eval entries
194
- jfl eval list -a shadow # Filter by agent
195
- jfl eval trajectory -a shadow # Composite score over time (with sparkline)
196
- jfl eval log -a shadow -m '{"composite":0.69}' # Log an eval entry
197
- jfl eval compare # Side-by-side agent comparison
198
- jfl eval tuples # Extract (state, action, reward) training tuples
199
- ```
200
-
201
- **Eval entries** are JSONL with agent name, metrics, composite score, model version, and deltas:
202
-
203
- ```json
204
- {
205
- "v": 1, "ts": "2026-03-05T15:22:47Z",
206
- "agent": "productrank-shadow",
207
- "dataset": "vibe-50-v1",
208
- "model_version": "shadow-0.3.1",
209
- "metrics": {"ndcg@10": 0.59, "mrr": 0.77, "precision@5": 0.43},
210
- "composite": 0.6935,
211
- "delta": {"composite": -0.029}
212
- }
213
- ```
214
-
215
- **Leaderboard:** Agents grouped by metric domain. ProductRank agents scored on ndcg@10, mrr, precision@5. SEO agents scored on avg_rank, keywords_ranked. Dashboard Agents page shows leaderboards per domain.
216
-
217
- **Training tuples** extracted from journals for fine-tuning: `(state, action, reward)` — maps codebase state + experiment action to eval score delta.
218
-
219
- **API endpoints** on Context Hub:
220
- - `GET /api/eval/leaderboard` — all agents ranked by composite
221
- - `GET /api/eval/trajectory?agent=X&metric=composite` — score trajectory with timestamps
64
+ ---
222
65
 
223
- ### Self-Driving Loop
66
+ ## Architecture
224
67
 
225
- The autonomous improvement cycle. Agents detect issues, create fixes, and the system auto-merges if eval scores improve.
68
+ JFL supports three levels: **Portfolio > GTM > Services**.
226
69
 
227
70
  ```
228
- Telemetry Agent detects issue
229
- telemetry:insight event
230
- Flow engine routes to Peter Parker
231
- PP creates fix PR (pp/ branch)
232
- GitHub Action runs eval + AI review
233
- eval:scored event posted to hub
234
- → Auto-merge if improved / flag if regressed
235
- Training tuple logged
236
- Cycle repeats
71
+ my-portfolio/ ← Coordinates multiple products
72
+ ├── productrank-gtm/ ← Context layer for one product
73
+ │ ├── .jfl/ ← Journal, eval, events, config
74
+ │ ├── knowledge/ ← VISION, ROADMAP, THESIS, NARRATIVE
75
+ │ ├── .claude/ ← Hooks, skills, agents
76
+ │ └── .mcp.json ← MCP server config
77
+
78
+ └── my-api/ ← Service repo (registered in GTM)
79
+ └── .jfl/config.json ← type: "service", gtm_parent
237
80
  ```
238
81
 
239
- **9 declarative flows** in `.jfl/flows/self-driving.yaml`:
82
+ GTMs are context layers — they never house product code. Services register to GTMs and sync journals on session end.
240
83
 
241
- | Flow | Trigger | Action |
242
- |------|---------|--------|
243
- | `auto-merge-on-improvement` | `eval:scored` (improved) | `gh pr merge` + journal milestone |
244
- | `flag-regression` | `eval:scored` (regressed) | `gh pr review --request-changes` |
245
- | `log-training-tuple` | `eval:scored` | Log (state, action, reward) to journal |
246
- | `log-quality-training-tuple` | `eval:scored` | Enriched tuple with AI quality dimensions |
247
- | `block-merge-on-blockers` | `review:findings` (red) | `gh pr review --request-changes` |
248
- | `log-review-training-data` | `review:findings` | Log review results as training data |
249
- | `pp-address-review-blockers` | `review:findings` (red) | Spawn PP to fix (gated, max 3 iterations) |
250
- | `insight-triggers-pp` | `telemetry:insight` (high) | Spawn PP to create fix PR |
251
- | `predict-before-pr` | `peter:pr-proposed` | Run Stratus prediction before acting |
252
-
253
- **Review gate:** Eval checks for AI review blockers before auto-merging. If the AI review requested changes (red findings), eval holds the merge even if tests improved. PRs must pass both eval AND review to auto-merge.
254
-
255
- **CI Workflows** that close the loop:
256
-
257
- - **`jfl-eval.yml`** — Runs on PP pull requests (`pp/` prefix). Checks out main for baseline, runs tests on PR, computes delta, runs AI quality assessment, posts `eval:scored` event to hub, comments on PR with eval results.
258
- - **`jfl-review.yml`** — Context-aware AI code review on PP PRs. Gathers project context + knowledge docs, reviews diff for bugs/security/architecture, extracts structured findings (red/yellow/blue severity), posts `review:findings` event to hub.
84
+ ---
259
85
 
260
- ### Stratus Prediction Engine
86
+ ## CLI Reference
261
87
 
262
- Predict eval score deltas before executing changes using the Stratus world model (JEPA rollout + chat ensemble).
88
+ ### Daily Use
263
89
 
264
90
  ```bash
265
- jfl predict run --proposal "Fix auth timeout" --goal "improve test pass rate" --type fix --scope small
266
- jfl predict resolve --id <id> --actual-delta 0.05 --actual-score 0.92 --eval-run <run-id>
267
- jfl predict accuracy # Direction accuracy, mean delta error, calibration
268
- jfl predict history # Recent predictions with sparkline trend
269
- ```
270
-
271
- **Dual Stratus strategy:**
272
- - **Rollout API** (`/v1/rollout`) — JEPA world model, ~1.6s, ~$0.001. Fast state prediction for health trajectory.
273
- - **Chat API** (`/v1/chat/completions`) — Full reasoning, ~28s, ~$0.05. Human-readable insights when patterns detected.
274
-
275
- ### RL Infrastructure
276
-
277
- JFL generalizes the Karpathy nanochat pattern: structured journals are the replay buffer, eval scores are rewards, agents learn in-context from past trajectories.
278
-
91
+ jfl status # Project status
92
+ jfl hud # Campaign dashboard
93
+ jfl synopsis [hours] # Work summary
94
+ jfl ask "what did we decide?" # Search memory
95
+ jfl ide # Terminal workspace (tmux/cmux)
279
96
  ```
280
- Agent LLM (Policy) > reads trajectories, proposes experiments
281
- Stratus (World Model) > predicts outcomes, filters bad proposals
282
- Journals (Replay Buffer) > structured experiment history
283
- Eval Framework (Reward) > composite scores, score deltas
284
- Event Bus (Nervous System) > connects everything
285
- Telemetry Agent > autonomous health monitoring + anomaly detection
286
- ```
287
-
288
- **JournalEntry type** — canonical schema with 6 RL fields: `hypothesis`, `outcome`, `score_delta`, `eval_snapshot`, `diff_hash`, `context_entries`.
289
97
 
290
- **TrajectoryLoader** query, filter, and render experiment trajectories for agent context windows. Supports filtering by session, agent, outcome, score range.
291
-
292
- **Peter Parker** — model-routed orchestrator with cost/balanced/quality profiles. Routes tasks to haiku/sonnet/opus based on complexity. Subscribes to event bus for reactive dispatch. Creates PRs on `pp/` branches.
293
-
294
- **Flow Engine** — declarative trigger-action automation in `.jfl/flows.yaml` and `.jfl/flows/*.yaml`:
295
-
296
- ```yaml
297
- - name: eval-scored-trigger-analysis
298
- trigger:
299
- pattern: "eval:scored"
300
- gate:
301
- requires_approval: true
302
- actions:
303
- - type: spawn
304
- command: "claude -p 'Analyze the latest eval results'"
305
- ```
306
-
307
- Flow actions: `log`, `emit`, `journal`, `webhook`, `command`, `spawn`. Gates: `after` (time-gated), `before` (deadline), `requires_approval`.
308
-
309
- **MCP tool:** `query_experiment_history` — agents query past experiment trajectories to inform next proposals.
310
-
311
- ### Telemetry Agent
312
-
313
- Autonomous monitoring agent that runs inside Context Hub on a configurable interval.
314
-
315
- - Analyzes local telemetry events for patterns
316
- - Detects anomalies: cost spikes (2x baseline), error spikes (3x baseline)
317
- - Calls Stratus rollout API for JEPA health trajectory prediction
318
- - Tracks `brain_goal_proximity` over time (product health score)
319
- - Emits `telemetry:insight` events that trigger the self-driving loop
320
- - State persisted at `.jfl/telemetry-agent-state.json`
321
-
322
- **Insight types:** `anomaly`, `regression`, `cost_spike`, `pattern`, `stratus_prediction`
323
-
324
- ### Terminal Visualizations
325
-
326
- Headless dashboard data rendered in the terminal via `jfl viz`. No browser needed — same data as the web dashboard.
98
+ ### Context Hub
327
99
 
328
100
  ```bash
329
- jfl viz dash # Composite: leaderboard + flows + events + status
330
- jfl viz experiments # Experiment runs with dot plot and sparklines
331
- jfl viz leaderboard # Ranked agents with bar chart
332
- jfl viz flows # Flow definitions and pending executions
333
- jfl viz events # Recent event stream with type coloring
334
- jfl viz status # Hub health and sources
101
+ jfl context-hub ensure # Start if not running
102
+ jfl context-hub dashboard # Open web dashboard
103
+ jfl context-hub status # Health check
104
+ jfl context-hub doctor # Diagnose all projects
335
105
  ```
336
106
 
337
- All subcommands support `--json` for programmatic consumption. Uses kuva for rich terminal plots with ASCII fallback.
338
-
339
- ### Portfolio Management
340
-
341
- Coordinate multiple GTM workspaces under one portfolio.
107
+ ### Agents & Eval
342
108
 
343
109
  ```bash
344
- jfl portfolio register /path/to/gtm # Register a GTM in this portfolio
345
- jfl portfolio list # List child GTMs with health
346
- jfl portfolio unregister <name> # Remove a GTM
347
- jfl portfolio status # Portfolio health + eval summary
348
- jfl portfolio phone-home # Report GTM health to portfolio parent
349
- ```
350
-
351
- **Portfolio Context Hub** operates in fan-out mode:
352
- - Connects to child GTM hubs via SSE
353
- - Bridges child events into portfolio event bus
354
- - Fans out search queries across all child hubs
355
- - Aggregates eval leaderboard across products
356
- - Enforces context scope (produces/consumes/denied) between GTMs
357
-
358
- **Cross-product flows** defined in `.jfl/flows.yaml`:
359
-
360
- ```yaml
361
- - name: tool-trends-to-seo
362
- trigger:
363
- pattern: "discovery:tool-trend"
364
- source: "productrank-gtm"
365
- actions:
366
- - type: webhook
367
- url: "http://localhost:{{child.seo-agent.port}}/api/events"
110
+ jfl eval list # Recent eval entries
111
+ jfl eval trajectory -a shadow # Score over time
112
+ jfl peter experiment # Run autonomous improvement cycle
113
+ jfl predict run --proposal "Fix auth" --goal "improve tests"
114
+ jfl kanban ls # Task board
115
+ jfl kanban add "Fix the thing" # Add card
116
+ jfl kanban pick --agent cash # Agent picks top card
368
117
  ```
369
118
 
370
- Template variables: `{{child.NAME.port}}`, `{{child.NAME.token}}`
371
-
372
- **Context scope** — each child GTM declares what events it produces and consumes. Portfolio enforces boundaries:
373
-
374
- ```json
375
- {
376
- "context_scope": {
377
- "produces": ["discovery:tool-trend", "eval:*"],
378
- "consumes": ["strategy:*", "seo:serp-data"],
379
- "denied": []
380
- }
381
- }
382
- ```
383
-
384
- ### Memory System
385
-
386
- Hybrid search over all journal entries with TF-IDF (40%) + semantic embeddings (60%).
119
+ ### Services
387
120
 
388
121
  ```bash
389
- jfl memory init # Initialize database
390
- jfl memory search "pricing" # Search memories
391
- jfl memory status # Stats and health
392
- jfl memory index [--force] # Reindex journal entries
393
- jfl ask "what did we decide about auth?" # Shorthand
122
+ jfl onboard /path/to/repo # Register a service
123
+ jfl services # Interactive TUI
124
+ jfl services validate --fix # Auto-repair config issues
394
125
  ```
395
126
 
396
- Auto-indexes every 60 seconds. Boosts recent entries (1.3x), decisions (1.4x), features (1.2x). Works with or without OpenAI embeddings — TF-IDF alone provides solid keyword search.
397
-
398
- ### Session Management
399
-
400
- Automatic session isolation for parallel work:
401
-
402
- - **Single session:** Works directly on a session branch (no worktree overhead)
403
- - **Multiple concurrent sessions:** Isolated git worktrees prevent conflicts
404
- - **Auto-commit:** Saves work every 2 minutes (knowledge, journal, suggestions)
405
- - **Crash recovery:** Detects uncommitted work in stale sessions, auto-commits on next start
406
- - **Cleanup guard:** Prevents `rm -rf` on main branch when no worktrees exist
127
+ ### Pi Runtime
407
128
 
408
129
  ```bash
409
- # Hooks handle everything automatically. Manual control:
410
- jfl session create # Create session
411
- jfl session list # List active sessions
412
- jfl session end # End and merge
413
- ./scripts/session/auto-commit.sh start # Background auto-commit
130
+ jfl pi # Launch Pi with JFL extensions
131
+ jfl pi --model claude-opus-4-6 # Specific model
132
+ jfl pi agents run --team teams/gtm-team.yaml # Spawn agent team
414
133
  ```
415
134
 
416
- **SessionStart hook flow:**
417
- 1. Sync repos (prevent context loss)
418
- 2. Check for stale sessions, auto-cleanup if > 5
419
- 3. Recover uncommitted work from crashed sessions
420
- 4. Create session branch (or worktree if concurrent)
421
- 5. Start auto-commit
422
- 6. Health-check Context Hub (start only if down)
423
-
424
135
  ---
425
136
 
426
- ## Service Agents
427
-
428
- Register external repos as services in your GTM. Each service gets an agent definition, skill wrapper, and journal sync.
429
-
430
- ```bash
431
- # Onboard a service repo
432
- jfl onboard /path/to/my-api --name my-api --type api
433
-
434
- # Or create from scratch
435
- jfl services create
436
-
437
- # Manage services
438
- jfl services list # All registered services
439
- jfl services status my-api # Health check
440
- jfl services start my-api # Start a service
441
- jfl services stop my-api # Stop a service
442
- jfl services validate --fix # Validate and auto-repair
443
- jfl services sync-agents # Sync peer agent definitions
444
- jfl services scan # Discover services in directory
445
- jfl services deps # Show dependency graph
446
- jfl services # Interactive TUI (no args)
447
- ```
448
-
449
- **What onboarding creates:**
450
- - Agent definition (`.claude/agents/service-{name}.md`)
451
- - Skill wrapper (`.claude/skills/{name}/SKILL.md` + `handler.sh`)
452
- - Service entry in `.jfl/services.json`
453
- - Config in service repo (`.jfl/config.json` with `gtm_parent`)
454
-
455
- **Context scoping:** Each service declares what events it produces and consumes. The GTM enforces scope — teams can't read each other's journals unless explicitly granted.
456
-
457
- ```json
458
- {
459
- "context_scope": {
460
- "produces": ["eval:submission", "journal:my-team*"],
461
- "consumes": ["eval:scored", "leaderboard:updated"],
462
- "denied": ["journal:other-team*"]
463
- }
464
- }
465
- ```
137
+ ## MCP Tools
466
138
 
467
- **Phone-home on session end:** When a service session ends, it syncs to the parent GTM:
468
- - Journal entries copied to `GTM/.jfl/journal/service-{name}-*.jsonl`
469
- - Comprehensive sync payload (git stats, health, environment)
470
- - GTM agent notified via event bus
471
- - Never blocks session end
139
+ Available to Claude Code and any MCP client:
472
140
 
473
- **Invoke from GTM:**
474
- ```
475
- /my-api status # Check service health
476
- /my-api recent # Recent changes
477
- ```
141
+ | Tool | Description |
142
+ |------|------------|
143
+ | `context_get` | Unified context (journal + knowledge + code) |
144
+ | `context_search` | Semantic search across all sources |
145
+ | `memory_search` | Search indexed memories by query + type |
146
+ | `memory_add` | Add manual memory entry |
147
+ | `events_publish` | Publish event to MAP bus |
148
+ | `events_recent` | Recent events with pattern filter |
149
+ | `query_experiment_history` | RL trajectories for agent experiments |
478
150
 
479
151
  ---
480
152
 
481
- ## Commands
482
-
483
- ### Core
484
-
485
- | Command | Description |
486
- |---------|-------------|
487
- | `jfl init -n <name>` | Create new GTM workspace |
488
- | `jfl status` | Project status and auth |
489
- | `jfl hud [-c\|--compact]` | Campaign dashboard (ship date, phases, pipeline) |
490
- | `jfl doctor [--fix]` | Check project health, auto-repair fixable issues |
491
- | `jfl update [--dry]` | Pull latest skills, scripts, templates (preserves CLAUDE.md, .mcp.json) |
492
- | `jfl synopsis [hours] [author]` | Work summary (journal + commits + file headers) |
493
- | `jfl repair` | Fix corrupted .jfl/config.json |
494
- | `jfl validate-settings [--fix] [--json]` | Validate and repair .claude/settings.json |
495
- | `jfl preferences [--clear-ai] [--show]` | Manage JFL preferences |
496
- | `jfl profile [action]` | Manage profile (show, edit, export, import, generate) |
497
- | `jfl ci setup` | Deploy eval + review CI workflows to project |
498
- | `jfl test` | Test onboarding flow (isolated environment) |
499
-
500
- ### Context Hub
501
-
502
- | Command | Description |
503
- |---------|-------------|
504
- | `jfl context-hub ensure` | Start daemon if not running |
505
- | `jfl context-hub stop [--purge]` | Stop daemon |
506
- | `jfl context-hub restart` | Restart daemon |
507
- | `jfl context-hub status` | Health check |
508
- | `jfl context-hub doctor [--clean]` | Diagnose all projects |
509
- | `jfl context-hub ensure-all` | Start for all GTM projects |
510
- | `jfl context-hub dashboard` | Open web dashboard in browser |
511
- | `jfl context-hub query` | Query context from CLI |
512
- | `jfl context-hub serve` | Run in foreground (daemon mode) |
513
- | `jfl context-hub install-daemon` | Auto-start on boot |
514
- | `jfl context-hub uninstall-daemon` | Remove auto-start |
515
-
516
- ### Eval Framework
517
-
518
- | Command | Description |
519
- |---------|-------------|
520
- | `jfl eval list [-a agent] [-l limit]` | List recent eval entries |
521
- | `jfl eval trajectory -a <agent>` | Composite score trajectory with sparkline |
522
- | `jfl eval log -a <agent> -m <metrics>` | Log an eval entry |
523
- | `jfl eval compare --agents <a,b>` | Side-by-side agent comparison |
524
- | `jfl eval tuples [--team N] [--since date]` | Extract training tuples from journals |
525
-
526
- ### Prediction
527
-
528
- | Command | Description |
529
- |---------|-------------|
530
- | `jfl predict run --proposal <text> --goal <text>` | Predict eval delta for proposed change |
531
- | `jfl predict resolve --id <id> --actual-delta <n>` | Resolve prediction with actual results |
532
- | `jfl predict accuracy` | Prediction accuracy stats (direction, delta error, calibration) |
533
- | `jfl predict history [--limit N]` | Recent predictions with sparkline |
534
-
535
- ### Visualization
536
-
537
- | Command | Description |
538
- |---------|-------------|
539
- | `jfl viz dash` | Composite terminal dashboard (default) |
540
- | `jfl viz experiments [--agent name]` | Experiment runs with dot plot and sparklines |
541
- | `jfl viz leaderboard` | Ranked agent leaderboard with bar chart |
542
- | `jfl viz flows [--pending]` | Flow definitions and pending executions |
543
- | `jfl viz events [--pattern glob] [--limit N]` | Recent events with type coloring |
544
- | `jfl viz status` | Hub health, children, sources |
545
-
546
- ### Portfolio
547
-
548
- | Command | Description |
549
- |---------|-------------|
550
- | `jfl portfolio register <path>` | Register GTM workspace in portfolio |
551
- | `jfl portfolio list` | List child GTMs with health status |
552
- | `jfl portfolio unregister <name>` | Remove GTM from portfolio |
553
- | `jfl portfolio status` | Portfolio health and eval summary |
554
- | `jfl portfolio phone-home` | Report GTM health to portfolio parent |
555
-
556
- ### Memory
557
-
558
- | Command | Description |
559
- |---------|-------------|
560
- | `jfl memory init` | Initialize memory database |
561
- | `jfl memory search <query> [-t type] [-n max]` | Search indexed memories |
562
- | `jfl memory status` | Stats and health |
563
- | `jfl memory index [--force]` | Reindex journal entries |
564
- | `jfl ask <question> [-t type]` | Shorthand for memory search |
565
-
566
- ### Services
567
-
568
- | Command | Description |
569
- |---------|-------------|
570
- | `jfl onboard <path> [-n name] [-t type]` | Register service in GTM |
571
- | `jfl services` | Interactive service manager TUI |
572
- | `jfl services create [--skip-ai]` | Create new service (wizard) |
573
- | `jfl services list` | List all services |
574
- | `jfl services status [name]` | Health check |
575
- | `jfl services start <name>` | Start a service |
576
- | `jfl services stop <name> [--force]` | Stop a service |
577
- | `jfl services scan [--path <p>] [--dry-run]` | Discover services in directory |
578
- | `jfl services deps [validate]` | Show/validate dependency graph |
579
- | `jfl services validate [--fix] [--json]` | Validate configs, auto-repair |
580
- | `jfl services sync-agents [--dry-run] [--current]` | Sync peer agent definitions |
581
- | `jfl service-agent <action> [name]` | Manage MCP agents (init, generate, generate-all, register, unregister, list, clean) |
582
- | `jfl service-manager <action>` | Service Manager daemon (start, stop, restart, status, serve) |
583
- | `jfl migrate-services [gtm-path]` | Migrate from references/ to service manager |
584
-
585
- ### Agent Orchestration
586
-
587
- | Command | Description |
588
- |---------|-------------|
589
- | `jfl agent init <name> [-d desc]` | Scaffold agent (manifest + policy + lifecycle flows) |
590
- | `jfl agent list` | List registered agents |
591
- | `jfl agent status <name>` | Show agent health and config |
592
- | `jfl peter setup [--cost\|--balanced\|--quality]` | Configure model routing profile |
593
- | `jfl peter run [--task text]` | Run orchestrator (interactive or headless) |
594
- | `jfl peter pr --task <text>` | Run agent, create PR on pp/ branch, emit event |
595
- | `jfl peter experiment` | Proactive: analyze trajectory, pick highest-value task, execute |
596
- | `jfl peter autoresearch [--rounds N]` | Tight loop: N experiments, only PR the winner |
597
- | `jfl peter status` | Show config and recent events |
598
- | `jfl peter dashboard` | Live event stream TUI |
599
- | `jfl ralph [args]` | Ralph-tui agent loop orchestrator |
600
- | `jfl orchestrate [name] [--list] [--create <n>]` | Multi-service orchestration workflows |
601
- | `jfl dashboard` | Interactive service monitoring TUI |
602
- | `jfl events [-p pattern]` | Live MAP event bus dashboard |
603
-
604
- ### Hooks & Flows
605
-
606
- | Command | Description |
607
- |---------|-------------|
608
- | `jfl hooks init` | Generate HTTP hooks + default flows |
609
- | `jfl hooks status` | Check hooks and hub connectivity |
610
- | `jfl hooks remove` | Remove HTTP hooks |
611
- | `jfl hooks deploy` | Deploy hooks to all registered services |
612
- | `jfl flows list` | List configured event-action flows |
613
- | `jfl flows add` | Interactive flow builder |
614
- | `jfl flows test <name>` | Test a flow with synthetic event |
615
- | `jfl flows enable/disable <name>` | Toggle flows |
616
- | `jfl flows approve [--flow name] [--all]` | Approve gated flow executions |
617
- | `jfl scope list` | View service context scopes |
618
- | `jfl scope set` | Set scope declarations |
619
- | `jfl scope test` | Test scope enforcement |
620
- | `jfl scope viz` | ASCII scope graph with access matrix |
621
-
622
- ### Platform
623
-
624
- | Command | Description |
625
- |---------|-------------|
626
- | `jfl login [--platform\|--x402\|--solo\|--team\|--free]` | Authenticate |
627
- | `jfl logout` | Logout from platform |
628
- | `jfl wallet` | Wallet and day pass status |
629
- | `jfl deploy [-f]` | Deploy to JFL platform |
630
- | `jfl agents [action]` | Manage parallel agents (list, create, start, stop, destroy) |
631
- | `jfl feedback [action]` | Rate session (0-5), view or sync |
632
- | `jfl pi [--yolo] [--mode interactive\|rpc\|headless]` | Launch JFL in Pi runtime |
633
- | `jfl pi agents run [--team yaml]` | Spawn agent team as Pi subprocesses |
634
-
635
- ### Telemetry & Intelligence
636
-
637
- | Command | Description |
638
- |---------|-------------|
639
- | `jfl telemetry status` | Show telemetry status |
640
- | `jfl telemetry show` | Show queued events |
641
- | `jfl telemetry digest [--hours N] [--format json] [--plots]` | Cost breakdown, health analysis, terminal charts |
642
- | `jfl telemetry reset` | Reset install ID |
643
- | `jfl telemetry track --category <c> --event <e>` | Emit event from shell scripts |
644
- | `jfl improve [--dry-run] [--auto] [--hours N]` | Self-improvement loop: analyze, suggest, create issues |
645
- | `jfl preferences --no-telemetry` | Opt out of telemetry |
646
-
647
- **Model cost tracking:** Every Stratus API call emits token counts and estimated cost. Covers claude-opus-4-6, claude-sonnet-4-6, claude-sonnet-4-5, claude-haiku-3-5, gpt-4o.
153
+ ## Self-Driving Loop
648
154
 
649
- **`jfl telemetry digest`** analyzes local events: per-model cost tables, command stats, error rates, hub/memory/session health. `--plots` renders bar charts via kuva (falls back to ASCII).
155
+ Agents detect issues, create fixes, and the system auto-merges if eval scores improve.
650
156
 
651
- **`jfl improve`** generates actionable suggestions from the digest. `--dry-run` previews, `--auto` creates GitHub issues tagged `[jfl-improve]`.
652
-
653
- ### Voice Input
654
-
655
- Local voice-to-text using Whisper models.
656
-
657
- | Command | Description |
658
- |---------|-------------|
659
- | `jfl voice` | Start voice recording with VAD |
660
- | `jfl voice setup` | First-time setup wizard |
661
- | `jfl voice devices` | List audio input devices |
662
- | `jfl voice test [-d device]` | Test record + transcribe (3s) |
663
- | `jfl voice recording [-d device] [-t seconds]` | Test recording only |
664
- | `jfl voice record [-d device]` | Record with VAD |
665
- | `jfl voice hotkey [-d device] [-m mode]` | Global hotkey listener (macOS) |
666
- | `jfl voice daemon start\|stop\|status` | Background hotkey daemon (macOS) |
667
- | `jfl voice model list\|download\|default [name]` | Manage whisper models |
668
- | `jfl voice help` | Voice command help |
669
-
670
- ### Skills
671
-
672
- | Command | Description |
673
- |---------|-------------|
674
- | `jfl skills list [-a\|--available] [-c category] [-t tag]` | List installed or available skills |
675
- | `jfl skills install <skills...>` | Install skill(s) |
676
- | `jfl skills remove <skills...>` | Remove skill(s) |
677
- | `jfl skills update [skill] [--dry]` | Update installed skill(s) |
678
- | `jfl skills search <query>` | Search for skills |
679
- | `jfl brand [subcommand]` | Brand architect shortcut |
680
- | `jfl content <type> [topic]` | Content creator shortcut |
681
-
682
- ### OpenClaw Protocol
683
-
684
- Runtime-agnostic agent integration. All commands support `--json`.
685
-
686
- | Command | Description |
687
- |---------|-------------|
688
- | `jfl openclaw session-start -a <agent>` | Start agent session |
689
- | `jfl openclaw session-end [-s]` | End session (merge, sync) |
690
- | `jfl openclaw context [-q query] [-t type]` | Query project context |
691
- | `jfl openclaw journal --type <t> --title <t> --summary <s>` | Write journal entry |
692
- | `jfl openclaw heartbeat` | Health pulse (auto-commit, check hub) |
693
- | `jfl openclaw status` | Agent session state |
694
- | `jfl openclaw register -g <gtm>` | Register agent with GTM |
695
- | `jfl openclaw gtm-list` | List registered GTM workspaces |
696
- | `jfl openclaw gtm-switch <id>` | Switch active GTM workspace |
697
- | `jfl openclaw gtm-create <name> [-p path]` | Create and register new GTM |
698
- | `jfl openclaw tag <service> <message>` | Send message to service agent |
699
-
700
- ### Clawdbot
701
-
702
- Telegram-based agent with context injection.
703
-
704
- | Command | Description |
705
- |---------|-------------|
706
- | `jfl clawdbot setup` | Install JFL plugin into Clawdbot |
707
- | `jfl clawdbot status` | Plugin installation status |
708
-
709
- ### GTM
157
+ | Flow | Trigger | Action |
158
+ |------|---------|--------|
159
+ | Auto-merge | `eval:scored` (improved) | `gh pr merge` |
160
+ | Flag regression | `eval:scored` (regressed) | Request changes on PR |
161
+ | Fix blockers | `review:findings` (red) | Spawn agent to fix |
162
+ | Cost spike | `telemetry:insight` (high) | Create fix PR |
163
+ | Predict first | `peter:pr-proposed` | Stratus prediction gate |
710
164
 
711
- | Command | Description |
712
- |---------|-------------|
713
- | `jfl gtm process-service-update [file]` | Process service sync notification (hook) |
165
+ **CI closes the loop:** `jfl-eval.yml` runs eval on PP pull requests. `jfl-review.yml` does AI code review. Both post events to Context Hub.
714
166
 
715
167
  ---
716
168
 
717
- ## Skills
169
+ ## Dashboard
718
170
 
719
- Pre-installed slash commands for Claude Code:
171
+ Pre-built Vite + Preact + Tailwind SPA served by Context Hub at `/dashboard/`.
720
172
 
721
- | Skill | Description |
722
- |-------|-------------|
723
- | `/hud` | Project dashboard — guided workflow, progress tracking |
724
- | `/brand-architect` | Generate brand identity (marks, colors, typography) |
725
- | `/web-architect` | Implement brand assets, audit code |
726
- | `/content` | Create content (threads, posts, articles, one-pagers) |
727
- | `/founder-video` | Viral short-form video scripts |
728
- | `/startup` | Startup guidance (idea to scale) |
729
- | `/spec` | Multi-agent adversarial spec refinement |
730
- | `/fly-deploy` | Fly.io deployment management |
731
- | `/search` | Semantic search across knowledge base |
732
- | `/end` | End session gracefully (merge, cleanup) |
733
- | `/ralph-tui` | AI agent loop orchestrator |
734
- | `/x-algorithm` | X/Twitter For You feed optimization |
735
- | `/agent-browser` | Headless browser automation |
736
- | `/react-best-practices` | React/Next.js performance patterns |
737
- | `/remotion-best-practices` | Remotion video creation in React |
738
- | `/geo` | GEO-first SEO analysis for AI search engines |
739
- | `/geo-audit` | Full website GEO+SEO audit with parallel agents |
740
- | `/viz` | Terminal data visualization via kuva |
173
+ **Pages:** Overview, Journal, Events, Services, Flows, Health, Agents, Experiments, Telemetry, Topology, Kanban
741
174
 
742
175
  ```bash
743
- # Install more skills
744
- jfl skills list --available
745
- jfl skills install geo-audit
176
+ jfl context-hub dashboard # Open in browser
177
+ jfl viz dash # Terminal equivalent
746
178
  ```
747
179
 
748
180
  ---
749
181
 
750
- ## Knowledge Layer
182
+ ## Configuration
751
183
 
752
- Strategy docs filled through conversation, not forms:
753
-
754
- ```
755
- knowledge/
756
- ├── VISION.md # What you're building, who it's for
757
- ├── NARRATIVE.md # How you tell the story
758
- ├── THESIS.md # Why you'll win
759
- ├── ROADMAP.md # What ships when
760
- ├── BRAND_BRIEF.md # Brand inputs
761
- ├── BRAND_DECISIONS.md # Finalized brand choices
762
- └── VOICE_AND_TONE.md # How the brand speaks
763
- ```
764
-
765
- **Philosophy:** Vision emerges from doing, not declaring. Start building immediately. Claude captures context into docs as you work.
766
-
767
- ---
768
-
769
- ## Journal Protocol
770
-
771
- Every session MUST write journal entries. Hooks enforce this.
184
+ All config in `.jfl/config.json`:
772
185
 
773
186
  ```json
774
187
  {
775
- "v": 1,
776
- "ts": "2026-02-27T10:00:00.000Z",
777
- "session": "session-goose-20260227-1014-abc123",
778
- "type": "feature",
779
- "status": "complete",
780
- "title": "Add service agent onboarding",
781
- "summary": "Built jfl onboard command that registers service repos in GTM",
782
- "detail": "Creates agent definition, skill wrapper, services.json entry...",
783
- "files": ["src/commands/onboard.ts"],
784
- "hypothesis": "Structured onboarding reduces setup errors",
785
- "outcome": "confirmed",
786
- "score_delta": 0.12,
787
- "eval_snapshot": {"composite": 0.85}
188
+ "name": "my-project",
189
+ "type": "gtm",
190
+ "contextHub": { "port": 4360 },
191
+ "registered_services": [],
192
+ "context_scope": {
193
+ "produces": ["eval:*", "journal:*"],
194
+ "consumes": ["strategy:*"]
195
+ }
788
196
  }
789
197
  ```
790
198
 
791
- **Write entries when:** Feature completed, decision made, bug fixed, milestone reached, session ending.
792
-
793
- Entries become searchable via `jfl memory search` and MCP `memory_search` tool. RL fields (`hypothesis`, `outcome`, `score_delta`, `eval_snapshot`, `diff_hash`, `context_entries`) enable trajectory-based learning.
199
+ Flows in `.jfl/flows/self-driving.yaml`. Knowledge in `knowledge/`. Skills in `.claude/skills/`.
794
200
 
795
201
  ---
796
202
 
797
- ## How It Works
798
-
799
- ```
800
- Session Start During Session Session End
801
- ───────────── ────────────── ───────────
802
- SessionStart hook fires You work normally Stop hook fires
803
- ├─ Sync repos ├─ Code, content, strategy ├─ Warn if no journal
804
- ├─ Create session branch ├─ Journal entries auto-tracked ├─ Auto-commit changes
805
- ├─ Recover crashed sessions ├─ Auto-commit every 2 min ├─ Merge to main
806
- ├─ Health-check Context Hub ├─ Events flow to MAP bus └─ Cleanup branch
807
- └─ Start auto-commit ├─ Memory indexes continuously
808
- ├─ Telemetry agent monitors
809
- └─ Flows react to events
810
-
811
- Context Hub (always running)
812
- ├─ Serves MCP tools to Claude Code
813
- ├─ Aggregates journal + knowledge + code
814
- ├─ Bridges service events from file-drop
815
- ├─ Watches journal/ for live entries
816
- ├─ Portfolio mode: fans out to child hubs
817
- ├─ Flow engine: reactive trigger→action
818
- ├─ Telemetry agent: health monitoring
819
- └─ Web dashboard at /dashboard/
820
- ```
821
-
822
- **Everything is files.** No proprietary database. No lock-in. Context is git-native — version controlled, portable, model-agnostic.
823
-
824
- ---
825
-
826
- ## CI/CD
827
-
828
- Two GitHub Actions workflows handle quality and releases. Two additional workflows close the self-driving loop.
829
-
830
- ### CI — `.github/workflows/ci.yml`
831
-
832
- Runs on every push and PR to `main`:
833
-
834
- - TypeScript strict mode type checking
835
- - Full test suite (~365 tests across 17 test files)
836
- - Coverage report uploaded as artifact
837
-
838
- ### Release — `.github/workflows/release.yml`
839
-
840
- Fires after CI passes on `main`. Two paths:
841
-
842
- 1. **Version bumped** (package.json differs from npm): Build, publish with provenance, create git tag, create GitHub Release with auto-generated notes.
843
- 2. **Version matches npm**: Generate changesets from conventional commits, create "Version Packages" PR via changesets/action.
203
+ ## Development
844
204
 
845
205
  ```bash
846
- # Option A: Manual changeset
847
- npx changeset # pick bump level, write summary
848
-
849
- # Option B: Just use conventional commits — auto-generated on CI
850
- # feat: = minor, fix: = patch, feat!: = major
851
-
852
- # Push to main → CI runs → Release publishes or creates Version PR
853
- ```
854
-
855
- **Secrets required:** `NPM_TOKEN` (granular access token scoped to jfl package). Provenance attestation via npm Trusted Publisher (OIDC).
856
-
857
- ### Eval — `.github/workflows/jfl-eval.yml`
858
-
859
- Runs on PRs from Peter Parker (`pp/` prefix), any `agent/*` branch, or `run-eval` label:
860
-
861
- - Detects agent from branch prefix (`pp/` → peter-parker, `agent/name/` → name, fallback → PR author)
862
- - Baseline test pass rate from `main`
863
- - PR test pass rate + AI quality assessment (correctness, coverage, architecture, value)
864
- - Stratus prediction before eval, resolve after (optional, needs `STRATUS_API_KEY` secret)
865
- - Auto-merge if improved + no AI review blockers; request changes if regressed
866
- - Commits eval entry + service events to PR branch (file-drop pattern for hub)
867
- - PR comment with full eval table, AI quality dimensions, and prediction accuracy
868
-
869
- ### AI Review — `.github/workflows/jfl-review.yml`
870
-
871
- Runs on PRs from Peter Parker (`pp/` prefix) or `ai-review` label:
872
-
873
- - Gathers project context (config, knowledge docs, journal)
874
- - Context-aware diff review (bugs, security, architecture, tests)
875
- - Structured findings with severity (red/yellow/blue)
876
- - Posts `review:findings` event to Context Hub
877
- - Comments on PR with findings
878
-
879
- ---
880
-
881
- ## Auto-Update
882
-
883
- JFL checks for npm updates on session start (24-hour cache):
884
-
885
- - **Minor/patch:** Auto-updates silently
886
- - **Major:** Prompts for approval
887
-
888
- ```bash
889
- jfl update # Pull latest skills and scripts
890
- jfl update --dry # Preview changes first
891
- jfl --no-update # Skip auto-update check
892
- ```
893
-
894
- **What gets updated:** `.claude/skills/`, `scripts/`, `templates/`, `context-hub`
895
- **What's preserved:** `knowledge/`, `content/`, `suggestions/`, `CLAUDE.md`, `.mcp.json`, `.jfl/config.json`
896
-
897
- ---
898
-
899
- ## Authentication
900
-
901
- ```bash
902
- jfl login # Platform Account (recommended)
903
- jfl login --x402 # x402 Day Pass ($5/day, crypto)
904
- jfl login --solo # Solo plan ($49/mo)
905
- jfl login --team # Team plan ($199/mo)
906
- jfl login --free # Stay on trial
907
- jfl logout # Logout
908
- jfl status # Check auth status
909
- jfl wallet # Wallet and day pass status
910
- ```
911
-
912
- ---
913
-
914
- ## What's New
915
-
916
- **0.4.4**
917
- - Feat: **`jfl peter autoresearch --rounds N`** — tight inner loop: N experiments, branch/change/eval/keep|revert, only PRs the winner (Karpathy autoresearch pattern)
918
- - Feat: **Stratus predictor in CI** — predicts eval delta before running tests, resolves after. PR comments show predicted vs actual with direction accuracy
919
- - Feat: **Agent generalization** — CI detects agent from branch prefix (`pp/*` → peter-parker, `bot/*` → bot, `agent/name/*` → extracted). Any agent gets the self-driving loop
920
- - Fix: Eval path alignment — CI writes `.jfl/eval.jsonl` matching `readEvals()` (was `.jfl/eval/eval.jsonl`)
921
- - Feat: Eval entries include `prediction_id` and AI quality dimensions for dashboard linking
922
-
923
- **0.4.3**
924
- - Feat: **Self-driving loop proven end-to-end** — eval CI auto-merges improved PRs, requests changes on regressions. First auto-merged PP PR (#16) in 90 seconds
925
- - Feat: **`jfl peter experiment`** — proactive experiment selection. Analyzes trajectory history + eval trends, uses Stratus to rank proposals (heuristic fallback), picks highest-value task, spawns PP to execute
926
- - Feat: **`jfl ci setup`** — deploys eval + review CI workflows to any project with secret setup instructions
927
- - Feat: **Review gate** — eval checks for AI review blockers before auto-merging. PRs must pass both eval AND review
928
- - Feat: **Cron triggers** in flow engine — `cron:daily`, `cron:hourly`, `cron:every-30-minutes` patterns for proactive flows
929
- - Feat: **`jfl update` syncs flows** — new flow files deployed on update (merge-only, never overwrites customizations)
930
- - Fix: Eval CI self-sufficient — commits eval entries + service events to PR branch, no hub dependency for core loop
931
- - Test: 274 tests (up from 266)
932
-
933
- **0.4.2**
934
- - Fix: HTTP hook port correction — `jfl init` and `jfl update` now detect and fix hooks pointing to wrong Context Hub port
935
- - Fix: Release pipeline — direct publish when version bumped, changeset generation when version matches npm
936
- - Fix: npm auth — NPM_TOKEN required (OIDC trusted publisher is for provenance only)
937
- - Feat: Telemetry archive path fix — telemetry data properly flows to digest
938
-
939
- **0.4.1**
940
- - Feat: **Self-driving loop** — 9 declarative flows in `self-driving.yaml` for autonomous improvement (auto-merge, flag regression, training tuples, review response, telemetry-to-PP dispatch, Stratus prediction gate)
941
- - Feat: **`jfl predict`** — Stratus prediction engine with run/resolve/accuracy/history subcommands
942
- - Feat: **`jfl viz`** — terminal visualizations (experiments, leaderboard, flows, events, status, dash)
943
- - Feat: **`jfl-eval.yml`** — CI workflow for eval on Peter Parker PRs (baseline comparison, AI quality scoring, event posting)
944
- - Feat: **`jfl-review.yml`** — CI workflow for context-aware AI code review (structured findings, severity levels, event posting)
945
- - Feat: **Telemetry agent** — autonomous monitoring in Context Hub (anomaly detection, Stratus JEPA health prediction, insight events)
946
- - Feat: **`spawn` action type** in flow engine — spawn detached subprocesses with cleaned environment
947
- - Feat: **`flows approve`** subcommand — approve gated flow executions (interactive or batch)
948
- - Feat: Dashboard pages: **Experiments** (dot plots, sparklines), **Telemetry** (cost/usage/health), **Topology** (service dependency graph)
949
- - Feat: **`jfl pi`** — Pi AI runtime integration with extensions, skills, and agent team spawning
950
- - Feat: MCP tools: `events_publish`, `events_recent` for MAP event bus interaction
951
-
952
- **0.4.0**
953
- - Feat: **Peter Parker `pr` subcommand** — run agent, commit, push `pp/` branch, create PR, emit `pr:created` event
954
- - Feat: **Peter Parker `dashboard`** — live event stream TUI
955
- - Feat: Richer eval composite with AI quality dimensions (correctness, coverage, architecture, value)
956
- - Feat: `scope viz` — ASCII scope graph with access matrix and flow visualization
957
- - Feat: Context-aware AI review with structured findings + severity levels
958
- - Fix: Baseline eval uses clean checkout (git checkout --force + clean)
959
- - Test: Predictor unit tests, hub-client test coverage
960
-
961
- **0.3.0**
962
- - Feat: **Portfolio workspace type** — `jfl portfolio register/list/unregister/status/phone-home`. Portfolios contain multiple GTM workspaces with cross-product event routing via SSE, context scope enforcement (produces/consumes/denied), fan-out queries to child hubs, and portfolio-level leaderboard aggregation
963
- - Feat: **Dashboard V2** — pre-built Vite + Preact + Tailwind SPA served at `/dashboard/`. Pages: Overview (activity charts, metric cards), Journal (search + type filters), Events (pattern filter presets), Services (type badges, context scope, data flows), Flows (definitions + execution history), Health (system metrics, memory index), Agents (eval leaderboards grouped by domain)
964
- - Feat: **Eval framework** — `jfl eval list/trajectory/log/compare/tuples`. Track agent metrics over time with composite scores, dual-write up parent chain, extract (state, action, reward) training tuples. Agents grouped by metric domain (ProductRank: ndcg@10/mrr/precision@5, SEO: avg_rank/keywords_ranked)
965
- - Feat: **RL infrastructure (Phase 1)** — `JournalEntry` type with 6 RL fields, `TrajectoryLoader` for querying experiment history, `query_experiment_history` MCP tool
966
- - Feat: **Flow engine** — declarative trigger-action automation in `.jfl/flows.yaml`. Actions: log, emit, journal, webhook, command, spawn. Gates: time-gated, deadline, requires_approval. Template interpolation with `{{child.NAME.port}}`
967
- - Feat: **HTTP hooks** — Claude Code lifecycle hooks (PostToolUse, Stop, PreCompact, SubagentStart/Stop) POST to Context Hub. `jfl hooks init/status/remove/deploy`
968
- - Feat: **Context scope enforcement** — produces/consumes/denied patterns. Event bus filters by scope declarations. `jfl scope list/set/test`
969
- - Feat: CI/CD pipeline — GitHub Actions CI (strict TypeScript + Jest gate) + CD via Changesets with auto-generation from conventional commits
970
- - Feat: Service agent templates (CLAUDE.md, settings.json, knowledge docs)
971
- - Feat: Session cleanup guard — prevents `rm -rf` on main when no worktrees exist
972
- - Fix: TypeScript strict mode build errors resolved
973
- - Test: ~365 tests across 17 test files (up from 237)
974
-
975
- **0.2.5**
976
- - Feat: Docker-style grouped `jfl --help` — 5 groups (Getting Started, Daily Use, Management, Platform, Advanced), ~30 lines down from 52
977
- - Feat: `jfl doctor [--fix]` — unified project health checker (9 checks: .jfl dir, config, Context Hub, hooks, memory, journal, agents, flows, git). Auto-repairs hooks, config, and journal with `--fix`
978
- - Feat: `jfl agent init|list|status` — scaffold narrowly-scoped agents with manifest, policy, and lifecycle flows
979
- - Feat: Flow engine scans `.jfl/flows/*.yaml` for per-agent flow definitions
980
- - Feat: Kuva terminal plots + spawn action type in flow engine
981
- - Fix: Stop committing JFL runtime files (.jfl/logs/, memory.db, *.pid) — gitignore + untrack ([@hathbanger](https://github.com/hathbanger) [#5](https://github.com/402goose/jfl-cli/pull/5))
982
- - Fix: Enforce `jfl update --auto` on session start with 24h cache ([@hathbanger](https://github.com/hathbanger) [#5](https://github.com/402goose/jfl-cli/pull/5))
983
- - Test: 31 new tests (agent-manifest, doctor, agent command, flow-engine directory scan)
984
-
985
- **0.2.4**
986
- - Feat: `jfl telemetry digest` — per-model cost tables, command stats, health analysis, improvement suggestions
987
- - Feat: `jfl improve` — self-improvement loop with GitHub issue creation (`--auto`)
988
- - Feat: Model cost tracking on every Stratus API call (token counts, estimated USD, confidence, timing)
989
- - Feat: Peter Parker agent cost tracking (per-role, per-model cost events)
990
- - Feat: Model pricing table (claude-opus-4-6, claude-sonnet-4-6, claude-sonnet-4-5, claude-haiku-3-5, gpt-4o)
991
-
992
- **0.2.3**
993
- - Fix: Context Hub race condition — SessionStart hook checks health before ensure
994
- - Fix: `jfl update` no longer clobbers project-specific CLAUDE.md and .mcp.json
995
- - Fix: `restartCoreServices` checks health before stop+restart cycle
996
- - Feat: Context Hub dashboard with live event stream
997
- - Feat: Journal bridge — journal entries appear in MAP event bus in real-time
998
- - Feat: Auth supports query param tokens for SSE/EventSource connections
999
-
1000
- **0.2.2**
1001
- - Feat: Context Hub always-on — MCP auto-recovery, ensure-all, doctor, launchd daemon
1002
- - Fix: Context Hub survives SIGTERM during daemon startup (5s grace period)
1003
- - Feat: MAP event bus with ring buffer, SSE/WS, pattern matching, file-drop bridging
1004
- - Feat: Per-project Context Hub ports (no more collisions)
1005
-
1006
- **0.2.1**
1007
- - Feat: Service agent system — onboard, create, validate, phone-home
1008
- - Feat: Peter Parker model-routed orchestrator (cost/balanced/quality profiles)
1009
- - Feat: Peer agent sync across services
1010
- - Fix: `jfl init` no longer creates nested directories
1011
-
1012
- **0.2.0**
1013
- - OpenClaw protocol — runtime-agnostic agent integration
1014
- - Clawdbot plugin — Telegram-based agent with context injection
1015
- - Memory system — TF-IDF + embeddings, hybrid search, auto-indexing
1016
-
1017
- **0.1.0**
1018
- - Auto-update on session start
1019
- - Synopsis command
1020
- - Context Hub productization
1021
-
1022
- ---
1023
-
1024
- ## Environment Variables
1025
-
1026
- ```bash
1027
- OPENAI_API_KEY=sk-... # Optional: enables semantic embeddings for memory search
1028
- STRATUS_API_KEY=stratus_... # Optional: enables Stratus prediction engine + telemetry agent
1029
- CONTEXT_HUB_PORT=4242 # Override per-project port
1030
- CRM_SHEET_ID=your-sheet-id # Google Sheets CRM integration
1031
- JFL_PLATFORM_URL=... # JFL platform URL (default: jfl.run)
206
+ git clone https://github.com/402goose/jfl-cli
207
+ cd jfl-cli
208
+ npm install
209
+ npm run build
210
+ npm test # 952 tests
211
+ npm link # Use local build globally
1032
212
  ```
1033
213
 
1034
214
  ---
1035
215
 
1036
216
  ## License
1037
217
 
1038
- MIT License - see LICENSE file.
1039
-
1040
- ---
1041
-
1042
- ## Credits
1043
-
1044
- Built by [@tagga](https://x.com/taggaoyl) (Alec Taggart)
1045
-
1046
- Powered by [Claude](https://claude.ai) (Anthropic), [Stratus](https://stratus.run) (JEPA world model), [x402](https://x402.org) (crypto micropayments), Commander.js, sql.js, and more.
218
+ MIT