jfl 0.9.2 → 0.9.3

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 (71) hide show
  1. package/dist/commands/context-hub.d.ts.map +1 -1
  2. package/dist/commands/context-hub.js +23 -1
  3. package/dist/commands/context-hub.js.map +1 -1
  4. package/dist/commands/init.d.ts.map +1 -1
  5. package/dist/commands/init.js +6 -0
  6. package/dist/commands/init.js.map +1 -1
  7. package/dist/commands/peter.d.ts.map +1 -1
  8. package/dist/commands/peter.js +11 -15
  9. package/dist/commands/peter.js.map +1 -1
  10. package/dist/commands/pivot.d.ts.map +1 -1
  11. package/dist/commands/pivot.js +22 -25
  12. package/dist/commands/pivot.js.map +1 -1
  13. package/dist/commands/repair.d.ts.map +1 -1
  14. package/dist/commands/repair.js +26 -0
  15. package/dist/commands/repair.js.map +1 -1
  16. package/dist/commands/session.d.ts.map +1 -1
  17. package/dist/commands/session.js +39 -0
  18. package/dist/commands/session.js.map +1 -1
  19. package/dist/commands/start.d.ts.map +1 -1
  20. package/dist/commands/start.js +60 -0
  21. package/dist/commands/start.js.map +1 -1
  22. package/dist/commands/update.d.ts.map +1 -1
  23. package/dist/commands/update.js +3 -1
  24. package/dist/commands/update.js.map +1 -1
  25. package/dist/lib/agent-session.d.ts.map +1 -1
  26. package/dist/lib/agent-session.js +6 -3
  27. package/dist/lib/agent-session.js.map +1 -1
  28. package/dist/lib/gtm-generator.js +7 -0
  29. package/dist/lib/gtm-generator.js.map +1 -1
  30. package/dist/lib/memory-db.d.ts +8 -0
  31. package/dist/lib/memory-db.d.ts.map +1 -1
  32. package/dist/lib/memory-db.js +24 -0
  33. package/dist/lib/memory-db.js.map +1 -1
  34. package/dist/lib/memory-indexer.d.ts +8 -0
  35. package/dist/lib/memory-indexer.d.ts.map +1 -1
  36. package/dist/lib/memory-indexer.js +30 -1
  37. package/dist/lib/memory-indexer.js.map +1 -1
  38. package/dist/lib/memory-search.d.ts.map +1 -1
  39. package/dist/lib/memory-search.js +2 -7
  40. package/dist/lib/memory-search.js.map +1 -1
  41. package/dist/lib/service-detector.js +2 -2
  42. package/dist/lib/service-detector.js.map +1 -1
  43. package/dist/lib/telemetry/physical-world-collector.js +1 -1
  44. package/dist/lib/telemetry/physical-world-collector.js.map +1 -1
  45. package/dist/utils/git.d.ts +1 -1
  46. package/dist/utils/git.d.ts.map +1 -1
  47. package/dist/utils/git.js +9 -6
  48. package/dist/utils/git.js.map +1 -1
  49. package/dist/utils/provenance.d.ts +65 -0
  50. package/dist/utils/provenance.d.ts.map +1 -0
  51. package/dist/utils/provenance.js +213 -0
  52. package/dist/utils/provenance.js.map +1 -0
  53. package/package.json +1 -1
  54. package/packages/pi/extensions/context.ts +11 -0
  55. package/packages/pi/extensions/header.ts +171 -0
  56. package/packages/pi/extensions/hud-tool.ts +1 -1
  57. package/packages/pi/extensions/index.ts +28 -3
  58. package/packages/pi/extensions/memory-tool.ts +3 -3
  59. package/packages/pi/extensions/onboarding-v2.ts +70 -185
  60. package/packages/pi/extensions/onboarding-v3.ts +32 -21
  61. package/packages/pi/extensions/service-skills.ts +6 -1
  62. package/packages/pi/extensions/session.ts +7 -1
  63. package/packages/pi/extensions/startup-briefing.ts +313 -0
  64. package/packages/pi/extensions/subway-mesh.ts +893 -0
  65. package/packages/pi/extensions/types.ts +1 -0
  66. package/packages/pi/package.json +1 -0
  67. package/scripts/pp-branch-pr.sh +24 -6
  68. package/scripts/pp-branch-pr.sh.bak +115 -0
  69. package/template/.pi/settings.json +5 -0
  70. package/template/CLAUDE.md +82 -1738
  71. package/template/CLAUDE.md.bak +0 -1187
@@ -1,1187 +0,0 @@
1
- # JFL - Claude Instructions
2
-
3
- Your context layer. Any project. Any AI.
4
-
5
- ## Project Identity
6
-
7
- **Get project name from (in order):**
8
- 1. `.jfl/config.json` → `name` field
9
- 2. `knowledge/VISION.md` → first heading
10
- 3. Directory name
11
-
12
- Use this name in status displays, greetings, and when referring to the project.
13
-
14
- ## Philosophy
15
-
16
- **Vision emerges from doing, not declaring.**
17
-
18
- Don't make users fill out forms before they can build. Let them start immediately. Capture context INTO the knowledge docs as you work together - the docs become a record of decisions, not a gate to getting started.
19
-
20
- ---
21
-
22
- ## CRITICAL: Session Sync (MUST READ)
23
-
24
- **Context loss is unacceptable.** Before starting ANY work, verify repos are synced.
25
-
26
- ### At Session Start - ALWAYS Do (BEFORE RESPONDING TO USER):
27
-
28
- **Complete ALL steps before saying anything to the user.**
29
-
30
- **1. Verify session branch** (from hook output)
31
-
32
- **2. Run session sync:**
33
- ```bash
34
- ./scripts/session/session-sync.sh
35
- ```
36
-
37
- **3. Run doctor check:**
38
- ```bash
39
- ./scripts/session/jfl-doctor.sh
40
- ```
41
- Note any warnings (unmerged sessions, memory not initialized).
42
-
43
- **4. Get unified context via MCP (REQUIRED):**
44
- ```
45
- Call: mcp__jfl-context__context_get
46
- ```
47
-
48
- This single call returns:
49
- - Recent journal entries (what happened across sessions)
50
- - Knowledge docs (vision, roadmap, narrative, thesis)
51
- - Code file headers (@purpose tags)
52
-
53
- **DO NOT read individual markdown files.** The context MCP tool aggregates everything. This is why we built Context Hub.
54
-
55
- **5. Show recent journal entries:**
56
- ```bash
57
- cat .jfl/journal/*.jsonl 2>/dev/null | tail -10
58
- ```
59
-
60
- **6. Run /hud to show project dashboard:**
61
- ```
62
- Invoke: /hud skill
63
- ```
64
-
65
- This displays the full status, pipeline, tasks, and guides next action.
66
-
67
- **ONLY AFTER completing all 6 steps**, respond to the user with the HUD output.
68
-
69
- **CRITICAL: Automatic Tool Invocation**
70
-
71
- **When the user asks questions, AUTOMATICALLY use the right tool:**
72
-
73
- | User Question | Auto-Invoke | Don't Ask |
74
- |---------------|-------------|-----------|
75
- | "What did we decide about X?" | `memory_search: X` | Just do it |
76
- | "When did we implement Y?" | `memory_search: Y` | Just do it |
77
- | "Why did we choose Z?" | `memory_search: Z decision` | Just do it |
78
- | "Search for pricing" | `memory_search: pricing` | Just do it |
79
- | "Show me database features" | `memory_search: database + type=feature` | Just do it |
80
- | "What files have X?" | `context_search: X` | Just do it |
81
- | "Find code about Y" | `context_search: Y` | Just do it |
82
-
83
- **The user should NEVER have to type MCP tool names.** You detect the intent and invoke automatically.
84
-
85
- **Examples:**
86
-
87
- User: "What did we decide about Service Manager?"
88
- You: *silently calls `memory_search: "Service Manager decision"`*
89
- Then: "We decided that [results from memory]..."
90
-
91
- User: "When did we fix the PID bug?"
92
- You: *silently calls `memory_search: "PID bug" with type="fix"`*
93
- Then: "We fixed the PID bug on [date]: [details]..."
94
-
95
- User: "Search for pricing decisions"
96
- You: *silently calls `memory_search: "pricing" with type="decision"`*
97
- Then: "Found 2 pricing decisions: [results]..."
98
-
99
- **Tool Selection Logic:**
100
-
101
- ```
102
- if question contains ("decide", "decided", "choice", "why we"):
103
- → memory_search with type="decision"
104
-
105
- if question contains ("when did we", "implemented", "built", "added"):
106
- → memory_search with type="feature"
107
-
108
- if question contains ("bug", "fix", "error"):
109
- → memory_search with type="fix"
110
-
111
- if question contains ("learn", "insight", "discovery"):
112
- → memory_search (check learned field)
113
-
114
- if question about "files" or "code":
115
- → context_search
116
-
117
- if question about "current" or "now":
118
- → context_get
119
-
120
- else:
121
- → memory_search (general - hybrid search finds relevant)
122
- ```
123
-
124
- ### CRITICAL: Verify Session Branch
125
-
126
- **After SessionStart hook runs, verify you're on the session branch.**
127
-
128
- The hook creates a session branch and outputs:
129
- ```
130
- ═══════════════════════════════════════════════════════════
131
- Session: session-*
132
- ═══════════════════════════════════════════════════════════
133
- ```
134
-
135
- **Verify you're on session branch:**
136
- ```bash
137
- git branch --show-current
138
- ```
139
-
140
- Should show `session-*`, NOT `main`.
141
-
142
- ---
143
-
144
- This syncs:
145
- - jfl-gtm (this repo)
146
- - jfl-platform (product symlink target)
147
- - All submodules
148
-
149
- ### Why This Matters
150
-
151
- The `product/` directory is a **symlink** to `../jfl-platform`. If jfl-platform gets out of sync with GitHub:
152
- - Files appear "deleted" when they exist on GitHub
153
- - Work done in previous sessions is invisible
154
- - User loses trust in the system
155
-
156
- **This has happened multiple times. Do not skip the sync.**
157
-
158
- ### Verify Context is Intact
159
-
160
- ```bash
161
- ./scripts/session/test-context-preservation.sh
162
- ```
163
-
164
- This checks:
165
- - Critical knowledge files exist (VISION.md, BRAND_DECISIONS.md, etc.)
166
- - Product specs exist (PLATFORM_SPEC.md, TEMPLATE_SPEC.md, CONTEXT_GRAPH_SPEC.md)
167
- - Git repos are in sync with remotes
168
- - No uncommitted changes in knowledge/
169
-
170
- **If tests fail, do not proceed until fixed.**
171
-
172
- ### Auto-Push on Session End
173
-
174
- Hooks in `.claude/settings.json` automatically:
175
- - Commit changes on Stop/PreCompact
176
- - Push to origin
177
-
178
- ### Continuous Auto-Commit (RECOMMENDED)
179
-
180
- **Problem:** Stop/PreCompact hooks only run if session ends cleanly. If session crashes, terminal closes, or you switch away → files can be lost.
181
-
182
- **Solution:** Run continuous auto-commit in background:
183
-
184
- ```bash
185
- # In a separate terminal, run:
186
- ./scripts/session/auto-commit.sh start
187
-
188
- # Or with custom interval (default 120s):
189
- ./scripts/session/auto-commit.sh start 60
190
- ```
191
-
192
- This commits every 2 minutes to:
193
- - knowledge/
194
- - previews/
195
- - content/
196
- - suggestions/
197
- - CLAUDE.md
198
- - .jfl/
199
-
200
- **Start this at every session.** It's the only way to guarantee no work is lost.
201
-
202
- ---
203
-
204
- ## CRITICAL: Journal Protocol (NON-NEGOTIABLE)
205
-
206
- **⚠️ THIS IS MANDATORY. NOT OPTIONAL. NOT SKIPPABLE.**
207
-
208
- You MUST write journal entries. The Stop hook will block session end if no journal entry exists.
209
-
210
- **Write DETAILED journal entries as you work. Not titles — actual content.**
211
-
212
- The journal is the handoff document between sessions and between people. When someone asks "what did Hath work on?", the journal should answer with specifics, not vague titles.
213
-
214
- ### Enforcement
215
-
216
- Hooks enforce this automatically:
217
- - **Stop hook** → Blocks session end if no journal entry for this session
218
- - **PreCompact hook** → Checks for journal entry before context compaction
219
- - **PostToolUse (Write/Edit)** → Checks for @purpose header on code files
220
-
221
- If you see "STOP - JOURNAL ENTRY REQUIRED", you MUST write a journal entry before proceeding.
222
-
223
- ### The Problem We're Solving
224
-
225
- BAD entry (useless):
226
- ```json
227
- {"title": "Session management improvements", "summary": "Applied Takopi patterns"}
228
- ```
229
-
230
- GOOD entry (useful):
231
- ```json
232
- {
233
- "title": "Session management with runner infrastructure",
234
- "summary": "Built database tables, service layer, and API for managing AI sessions",
235
- "detail": "Created runner_sessions, session_events, session_costs tables. RunnerService class with create/suspend/resume/destroy methods. /api/sessions endpoints for CRUD. Dashboard UI with polling. Note: simulateAgentStartup() is a stub - needs real Claude integration.",
236
- "files": ["product/src/lib/db/schema.ts", "product/src/lib/runner-service.ts", "product/src/app/api/sessions/route.ts"],
237
- "incomplete": ["simulateAgentStartup is stubbed", "cost tracking not connected to Stripe"],
238
- "next": "Connect to Claude API for real agent execution"
239
- }
240
- ```
241
-
242
- ### Per-Session Journal Files
243
-
244
- Each session writes to its own file to avoid merge conflicts:
245
- ```
246
- .jfl/journal/<session-id>.jsonl
247
- ```
248
-
249
- The session ID comes from your git branch name (e.g., `session-goose-20260125-0240-bea0be`).
250
-
251
- ### When to Write (MANDATORY TRIGGERS)
252
-
253
- Write a journal entry IMMEDIATELY when ANY of these happen:
254
-
255
- | Event | Type | You MUST capture |
256
- |-------|------|------------------|
257
- | **Feature completed** | `feature` | What was built, files created, what's stubbed, next steps |
258
- | **Decision made** | `decision` | Options considered, why this choice, decision slug |
259
- | **Bug fixed** | `fix` | Root cause, the fix, what you learned |
260
- | **Something learned** | `discovery` | The insight, how it changes approach |
261
- | **Milestone reached** | `milestone` | Everything in this milestone, incomplete items |
262
- | **Session ending** | `session-end` | Summary of session, handoff for next person |
263
-
264
- **Do not wait until session end to write entries.** Write them AS events happen. Multiple entries per session is normal and expected.
265
-
266
- ### Real-Time Capture Triggers (ENFORCE THESE)
267
-
268
- **After you do ANY of these, IMMEDIATELY write a journal entry:**
269
-
270
- 1. **After git commit** → Journal entry describing what was committed
271
- 2. **After TaskUpdate to completed** → Journal entry for that task
272
- 3. **After user says "done", "looks good", "ship it", "approved"** → Journal entry capturing what was approved
273
- 4. **After making a choice between options** → Decision journal entry
274
- 5. **After fixing an error/bug** → Fix journal entry with root cause
275
- 6. **After writing a new file** → Journal entry if it's significant (not just a small helper)
276
- 7. **After completing a multi-step task** → Feature/milestone journal entry
277
-
278
- **Pattern to follow:**
279
- ```
280
- 1. Do the work
281
- 2. Commit (if code)
282
- 3. Write journal entry ← DON'T SKIP THIS
283
- 4. Continue to next task
284
- ```
285
-
286
- **If you catch yourself about to move to the next task without journaling, STOP and write the entry first.**
287
-
288
- The session-end hook is a BACKSTOP, not the primary enforcement. Real-time capture is mandatory.
289
-
290
- ### Entry Format
291
-
292
- ```json
293
- {
294
- "v": 1,
295
- "ts": "2026-01-25T10:30:00.000Z",
296
- "session": "session-goose-20260125-xxxx",
297
- "type": "feature|fix|decision|milestone|spec|discovery",
298
- "status": "complete|incomplete|blocked",
299
- "title": "Short title (but not TOO short)",
300
- "summary": "2-3 sentence summary of what this actually is",
301
- "detail": "Full description. What was built? What files? What's stubbed? What's next?",
302
- "files": ["file1.ts", "file2.ts"],
303
- "decision": "decision-slug-for-linking",
304
- "incomplete": ["list of things not finished"],
305
- "next": "what should happen next",
306
- "learned": ["key learnings from this work"]
307
- }
308
- ```
309
-
310
- **Required fields:** v, ts, session, type, title, summary
311
- **Strongly recommended:** detail, files
312
-
313
- ### How to Write Entries
314
-
315
- **Direct file append** (no CLI dependency):
316
-
317
- ```bash
318
- # Get session and file path
319
- SESSION=$(git branch --show-current)
320
- JOURNAL_FILE=".jfl/journal/${SESSION}.jsonl"
321
- mkdir -p .jfl/journal
322
-
323
- # Append entry
324
- cat >> "$JOURNAL_FILE" << 'ENTRY'
325
- {"v":1,"ts":"2026-01-25T10:30:00.000Z","session":"SESSION_ID","type":"feature","status":"complete","title":"...","summary":"...","detail":"...","files":["..."]}
326
- ENTRY
327
- ```
328
-
329
- Or just use the **Write tool** to append to the file directly. The format is one JSON object per line.
330
-
331
- ### What Makes a GOOD Entry
332
-
333
- 1. **Someone reading it can understand what exists** — not just that you worked on something
334
- 2. **Files are listed** — so they can find the code
335
- 3. **Incomplete items are noted** — so they know what's stubbed
336
- 4. **Next steps are clear** — so they can continue
337
-
338
- ### File Headers (MANDATORY FOR CODE FILES)
339
-
340
- Every `.ts`, `.tsx`, `.js`, `.jsx` file MUST have a header with at minimum `@purpose`:
341
-
342
- ```typescript
343
- /**
344
- * Component/Module Name
345
- *
346
- * Brief description of what this does.
347
- *
348
- * @purpose One-line description of file's purpose
349
- * @spec Optional: link to spec (e.g., PLATFORM_SPEC.md#sessions)
350
- * @decision Optional: decision slug (e.g., journal/2026-01.md#per-session)
351
- */
352
- ```
353
-
354
- The PostToolUse hook will warn you if you write/edit a code file without `@purpose`. Add it immediately.
355
-
356
- This enables:
357
- - Synopsis to extract context from files
358
- - Codebase understanding without reading full files
359
- - Decision traceability
360
-
361
- ### Reading the Journal
362
-
363
- All session files are in `.jfl/journal/`. To see recent entries across all sessions:
364
- ```bash
365
- cat .jfl/journal/*.jsonl | sort -t'"' -k4 | tail -20
366
- ```
367
-
368
- Or read a specific session's journal:
369
- ```bash
370
- cat .jfl/journal/session-goose-20260125-xxxx.jsonl
371
- ```
372
-
373
- ### Integration with Memory System
374
-
375
- **The memory system automatically indexes all journal entries for fast semantic search.**
376
-
377
- Every journal entry you write is indexed into `.jfl/memory.db` with:
378
- - TF-IDF tokens for fast keyword search
379
- - OpenAI embeddings for semantic understanding (if OPENAI_API_KEY is set)
380
- - Metadata extraction (files, decisions, learnings)
381
-
382
- **Using Memory via MCP Tools:**
383
-
384
- When the user asks questions about past work, use the MCP tools:
385
-
386
- ```
387
- # Search for past decisions, features, or learnings
388
- Call: mcp__jfl-context__memory_search with query="pricing decision"
389
- Call: mcp__jfl-context__memory_search with query="Service Manager features" and type="feature"
390
- Call: mcp__jfl-context__memory_search with query="what did we decide about X" and maxItems=5
391
-
392
- # Get memory system status
393
- Call: mcp__jfl-context__memory_status
394
-
395
- # Add a manual memory/note
396
- Call: mcp__jfl-context__memory_add with title="Important insight" and content="..."
397
- ```
398
-
399
- **Available MCP Tools:**
400
-
401
- 1. **`memory_search`** - Search indexed journal entries
402
- - `query` (required): Search query
403
- - `type` (optional): Filter by type (feature, fix, decision, discovery, milestone)
404
- - `maxItems` (optional): Max results (default: 10)
405
- - `since` (optional): ISO date - only entries after this date
406
-
407
- 2. **`memory_status`** - Get memory system statistics
408
- - Returns: total memories, by type, date range, embedding status
409
-
410
- 3. **`memory_add`** - Manually add a memory
411
- - `title` (required): Short title
412
- - `content` (required): Full content
413
- - `tags` (optional): Array of tags
414
-
415
- **When to Use Memory Search:**
416
-
417
- Use `memory_search` when the user asks:
418
- - "What did we decide about X?"
419
- - "When did we implement Y?"
420
- - "Search for past work on Z"
421
- - "What decisions were made about pricing?"
422
- - "Show me features related to database"
423
-
424
- **Search Quality:**
425
-
426
- The hybrid search combines:
427
- - **TF-IDF** (fast, keyword-based) - weighted 40%
428
- - **Embeddings** (semantic, contextual) - weighted 60%
429
-
430
- Results are scored by relevance (high/medium/low) with boosting for:
431
- - Recent entries (1.3x if < 7 days old)
432
- - Decisions (1.4x multiplier)
433
- - Features (1.2x multiplier)
434
-
435
- **Automatic Indexing:**
436
-
437
- - Runs on Context Hub startup
438
- - Scans for new entries every 60 seconds
439
- - No manual reindexing needed
440
-
441
- **If Memory Not Initialized:**
442
-
443
- The doctor script will warn and can auto-fix:
444
- ```bash
445
- ./scripts/session/jfl-doctor.sh --fix
446
- ```
447
-
448
- Or manually initialize:
449
- ```bash
450
- jfl memory init
451
- ```
452
-
453
- ---
454
-
455
- ## CRITICAL: Synopsis Command (What Happened?)
456
-
457
- **When anyone asks "what happened?" use synopsis:**
458
-
459
- ```bash
460
- cd product/packages/memory && node dist/journal/cli.js synopsis [hours] [author]
461
-
462
- # Examples:
463
- node dist/journal/cli.js synopsis 24 # Last 24 hours
464
- node dist/journal/cli.js synopsis 24 hathbanger # Specific author
465
- ```
466
-
467
- Aggregates journal entries, git commits, file headers, and time audit with category breakdown.
468
-
469
- ---
470
-
471
- ## CRITICAL: Immediate Decision Capture
472
-
473
- **When a decision is made, update the relevant doc AND journal IMMEDIATELY.**
474
-
475
- ### Flow
476
-
477
- 1. Decision made in conversation
478
- 2. Update the relevant doc:
479
- - Naming/brand → `knowledge/BRAND_DECISIONS.md`
480
- - Product direction → `product/SPEC.md`
481
- - Architecture → relevant `*_SPEC.md`
482
- 3. Write journal entry with full context (options considered, why this choice)
483
- 4. Continue conversation
484
-
485
- ### Example
486
-
487
- ```
488
- User: "Let's go with Option A for the pricing"
489
-
490
- Claude: *updates knowledge/PRICING.md with Option A details*
491
- *appends to .jfl/journal/<session>.jsonl:*
492
- {
493
- "type": "decision",
494
- "title": "Pricing model: Option A (usage-based)",
495
- "summary": "Chose usage-based pricing over flat rate",
496
- "detail": "Options considered: A) $5/day usage-based, B) $49/mo flat, C) freemium. Chose A because: aligns with x402 micropayments, lower barrier to start, scales with value delivered. Rejected B because fixed cost feels like commitment before value proven.",
497
- "decision": "pricing-model",
498
- "files": ["knowledge/PRICING.md"]
499
- }
500
-
501
- "Done — updated PRICING.md. Ready to implement?"
502
- ```
503
-
504
- ### Why Detail Matters
505
-
506
- - Next session, someone asks "why usage-based?" → journal has the answer
507
- - You can trace back through decision history
508
- - Avoids re-debating settled decisions
509
-
510
- ---
511
-
512
- ## CRITICAL: CRM is Google Sheets (NOT a markdown file)
513
-
514
- **NEVER read a CRM.md file. It doesn't exist. The CRM is Google Sheets accessed via CLI.**
515
-
516
- ### CRM Commands
517
-
518
- ```bash
519
- ./crm # Dashboard with insights
520
- ./crm list # List all deals
521
- ./crm prep <name> # Full context for a contact (use before calls)
522
- ./crm stale # Deals with no activity in 5+ days
523
- ./crm priority # High priority deals
524
- ./crm touch <name> # Log an activity
525
- ./crm update <name> <field> <value> # Update a field
526
- ./crm add contact "Name" "Company" # Add new contact
527
- ./crm add deal "Name" "Contact" "Pipeline" # Add deal
528
- ```
529
-
530
- ### When to Use
531
-
532
- - **Before any outreach:** `./crm prep [name]` to get full context
533
- - **After a call/meeting:** `./crm touch [name]` to log it
534
- - **Checking pipeline:** `./crm list` or `./crm stale`
535
- - **HUD pulls from CRM:** The `/hud` skill uses `./crm list` to show pipeline
536
-
537
- **DO NOT:**
538
- - Read `knowledge/CRM.md` (it doesn't exist)
539
- - Try to grep for CRM data in markdown files
540
- - Store contact info in suggestions files
541
-
542
- ---
543
-
544
- ## Core Architecture Principle
545
-
546
- **A GTM workspace should NEVER house product code.**
547
-
548
- JFL creates GTM workspaces - context layers for building and launching. The actual product code always lives in its own separate repo. Even if you're a founder building everything, the structure is:
549
-
550
- ```
551
- my-project-gtm/ ← GTM workspace (this repo)
552
- ├── product/ ← SUBMODULE → your-product-repo
553
- ├── knowledge/ ← Strategy, vision, narrative
554
- ├── content/ ← Marketing content
555
- ├── suggestions/ ← Contributor work
556
- ├── skills/ ← JFL skills (updated via jfl update)
557
- └── CLAUDE.md ← Instructions (updated via jfl update)
558
-
559
- your-product-repo/ ← SEPARATE REPO (all code lives here)
560
- ├── src/
561
- ├── cli/
562
- ├── platform/
563
- └── ...
564
- ```
565
-
566
- **Why?**
567
- - Clean separation of concerns
568
- - Product can be worked on independently
569
- - GTM context doesn't pollute product repo
570
- - Multiple GTMs can reference same product
571
- - `jfl update` updates GTM toolkit without touching product
572
-
573
- ---
574
-
575
- ## Understanding the Project Setup
576
-
577
- **Before doing any work, understand the setup:**
578
-
579
- ### 1. What's their relationship to the product?
580
-
581
- Ask early (or infer from context):
582
- ```
583
- Quick question - what's your setup?
584
-
585
- 1. Building the product (I have/need a product repo)
586
- 2. GTM only (team handles code, I do marketing/content)
587
- 3. Contributor (I work on specific tasks, suggest changes)
588
- ```
589
-
590
- ### 2. Detect the repo structure
591
-
592
- Check what repos/references exist:
593
- ```bash
594
- ls -la # What's in this project?
595
- cat .jfl/config.json # Project config
596
- ls references/ # Any linked repos?
597
- ls product/ # Product specs here?
598
- git remote -v # What repo is this?
599
- ```
600
-
601
- **Common setups:**
602
-
603
- | Setup | What It Looks Like | How to Handle |
604
- |-------|-------------------|---------------|
605
- | **Building product** | `product/` submodule linked to product repo | Code changes go to product repo (submodule) |
606
- | **GTM only** | No `product/` submodule, just `knowledge/`, `content/` | Focus on GTM, no code changes |
607
- | **Contributor** | Has suggestions file, limited scope | Work in `suggestions/`, route through owner |
608
-
609
- ### 3. Where do changes go?
610
-
611
- **Based on setup, route work correctly:**
612
-
613
- | What They're Doing | Where It Goes |
614
- |-------------------|---------------|
615
- | Writing product code | Product repo (wherever that is) |
616
- | Updating product spec | `product/SPEC.md` in this repo |
617
- | Marketing content | `content/` in this repo |
618
- | Brand/design work | `knowledge/BRAND*.md`, `previews/` |
619
- | Strategic docs | `knowledge/` in this repo |
620
- | CRM/outreach | `./crm` CLI (Google Sheets), `suggestions/` |
621
-
622
- ### 4. Store the setup in config
623
-
624
- Once you understand their setup, save it:
625
- ```json
626
- // .jfl/config.json
627
- {
628
- "name": "project-name",
629
- "type": "gtm",
630
- "setup": "building-product", // or "gtm-only", "contributor"
631
- "product_repo": "github.com/...", // if building product
632
- "product_path": "product/", // submodule path
633
- "description": "..."
634
- }
635
- ```
636
-
637
- **Check this config at session start** - don't re-ask if already configured.
638
-
639
- ---
640
-
641
- ## Working Modes
642
-
643
- | Mode | Structure | Behavior |
644
- |------|-----------|----------|
645
- | **Building Product** | `product/` submodule → product repo | Code to `product/`, GTM to main repo. Commit to submodule first, then update reference. |
646
- | **GTM Only** | No code, just `knowledge/`, `content/` | Focus on content/brand/outreach. Never suggest code changes. |
647
- | **Contributor** | Has `suggestions/{name}.md` | Work within scope. Route suggestions through proper channels. |
648
-
649
- **Detecting mode changes:**
650
- - "I need to update the code" → Add product submodule if missing
651
- - "I'm taking over the product" → Switch to building-product mode
652
- - Update `.jfl/config.json` when mode changes
653
-
654
- ---
655
-
656
- ## Working with GTM Services
657
-
658
- JFL supports registering services within a GTM workspace and syncing their work back to the parent.
659
-
660
- ### Service Registration
661
-
662
- When you onboard a service in a GTM workspace, JFL:
663
- 1. Creates `.jfl/config.json` in service with `type: "service"` and `gtm_parent` path
664
- 2. Adds service to GTM's `registered_services` array
665
- 3. Sets up sync configuration
666
-
667
- ### Deploying Skills to Services
668
-
669
- Deploy GTM skills to all registered services:
670
-
671
- ```bash
672
- # Deploy /end skill to all services
673
- jfl services deploy-skill end
674
-
675
- # Deploy to specific service
676
- jfl services deploy-skill end stratus-run
677
-
678
- # Deploy all skills
679
- jfl services deploy-skill --all
680
- ```
681
-
682
- ### Automatic Sync on Session End
683
-
684
- When you end a session in a service (using `/end`):
685
- 1. Service session cleaned up normally
686
- 2. Journal entries copied to GTM at `.jfl/journal/service-{name}-*.jsonl`
687
- 3. GTM's `last_sync` timestamp updated
688
- 4. Sync event created in GTM journal
689
-
690
- ### Manual Sync
691
-
692
- Force sync without ending session:
693
-
694
- ```bash
695
- jfl services sync # Sync all services
696
- jfl services sync stratus-run # Sync specific service
697
- ```
698
-
699
- ### Health Check
700
-
701
- Check service-GTM connectivity:
702
-
703
- ```bash
704
- jfl services health # Check all services
705
- jfl services health stratus-run # Check specific service
706
- ```
707
-
708
- Shows:
709
- - Service directory exists
710
- - GTM parent reachable
711
- - Service registered in GTM
712
- - Journal sync working
713
-
714
- ### Service Validation
715
-
716
- **Ensure services are properly configured and compliant:**
717
-
718
- ```bash
719
- jfl services validate # Check everything
720
- jfl services validate --fix # Auto-repair issues
721
- jfl services validate --json # JSON output for scripts
722
- ```
723
-
724
- **What it validates:**
725
- - ✅ Service configuration complete (name, type, gtm_parent)
726
- - ✅ Registered in parent GTM
727
- - ✅ Hooks configured correctly (catches invalid hook names like `SessionStart:service`)
728
- - ✅ Journal directory exists
729
- - ✅ Context Hub connected
730
- - ✅ Skills deployed
731
- - ✅ Health checks (worktrees, git state, permissions)
732
-
733
- **Auto-fix capabilities:**
734
- - Fixes invalid hook names (`SessionStart:service` → `SessionStart`)
735
- - Creates missing directories (`.jfl/journal/`, `.claude/skills/`)
736
- - Creates default `.claude/settings.json`
737
- - Registers service in parent GTM
738
-
739
- **When validation runs:**
740
- - Automatically on `SessionStart` (services only, non-blocking)
741
- - Before session end via `/end` skill (offers to fix issues)
742
- - Manually with `jfl services validate`
743
-
744
- **Example output:**
745
-
746
- ```
747
- 🔍 SERVICE VALIDATION: stratus-api
748
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
749
-
750
- [✓] Service Configuration
751
- [✓] GTM Integration
752
- [✗] Hooks - Invalid hook name: SessionStart:service
753
- [✓] Context Hub
754
-
755
- Summary: 3 passed, 1 error
756
- Run 'jfl services validate --fix' to auto-repair.
757
- ```
758
-
759
- **Hook configuration template:**
760
-
761
- Services should use `.claude/service-settings.json` template which includes:
762
- - Validation on SessionStart (shows warnings)
763
- - Journal check on Stop
764
- - Service name display
765
- - Status information
766
- - GTM parent configured and valid
767
- - /end skill deployed
768
- - Last sync time (warns if > 7 days)
769
-
770
- ---
771
-
772
- ## Starting a New Project (Foundation Empty)
773
-
774
- When knowledge docs are empty, pull them through foundation in order. Don't ask open-ended "What do you want to build?"
775
-
776
- **Foundation checklist:**
777
-
778
- 1. **VISION.md** - What are you building? Who is it for? What problem does it solve? One-liner?
779
- 2. **ROADMAP.md** - When do you want to ship? MVP? Phases? Hard deadlines?
780
- 3. **NARRATIVE.md** - Casual pitch? Before/after? Key words? Emotional hook?
781
- 4. **THESIS.md** - Why will YOU win? What insight? Unfair advantage? Why now?
782
-
783
- **Key principles:**
784
- - Ask role-specific questions (don't ask non-technical founders about stack)
785
- - Write to files immediately as they answer
786
- - Provide examples/suggestions to guide them
787
- - Allow "emergent" status - vision clarifies through building
788
- - Don't skip docs - complete all four before building
789
-
790
- **After foundation:**
791
- - Check if ALL FOUR docs have real content (not templates)
792
- - Then ask: "Foundation is set. Want to work on brand/design next, or jump into building?"
793
-
794
- ---
795
-
796
- ## Before Building Any UI/Frontend
797
-
798
- **⚠️ ALWAYS establish brand direction before writing UI code**
799
-
800
- **Check for brand decisions:**
801
- 1. `knowledge/BRAND_DECISIONS.md` - finalized choices
802
- 2. `knowledge/BRAND_BRIEF.md` - brand inputs
803
- 3. `knowledge/VOICE_AND_TONE.md` - personality/feel
804
-
805
- **If no explicit brand docs, INFER from foundation:**
806
- - Read NARRATIVE.md and VISION.md
807
- - Extract tone, audience, positioning
808
- - Propose direction and confirm
809
-
810
- **Gather references:**
811
- - Aesthetic refs: Sites they like
812
- - Functional refs: Similar products done well
813
- - Anti-refs: What to avoid
814
- - Store in `references/` or note in `product/SPEC.md`
815
-
816
- **NEVER:**
817
- - Use another project's styling as default
818
- - Assume dark theme without reason
819
- - Pick random colors without basis
820
- - Build UI "to get started" and "refine later"
821
-
822
- Brand direction exists in foundation docs. Extract it, confirm it, build with intention.
823
-
824
- ---
825
-
826
- ## Product Specs: The Living Build Document
827
-
828
- When building a product, maintain `product/SPEC.md` as the source of truth for implementation.
829
-
830
- **Template sections:** What We're Building | Who It's For | Core Features (table) | Tech Stack | Current Focus | Decisions Made (table) | Open Questions | References (table)
831
-
832
- See `templates/` folder for full spec template.
833
-
834
- **When to use:**
835
- - Before starting: Read spec for decisions already made
836
- - While building: Update feature status, add decisions, note questions
837
- - After building: Mark features done, document tech choices
838
-
839
- **Spec vs Foundation:**
840
- | Doc | Purpose | Updates |
841
- |-----|---------|---------|
842
- | VISION.md | Why we're building | Rarely |
843
- | NARRATIVE.md | How we talk about it | Evolves |
844
- | product/SPEC.md | What we're building | Every session |
845
-
846
- **Before building, ensure foundation is complete:**
847
- - Check VISION.md, ROADMAP.md, NARRATIVE.md, THESIS.md all have real content
848
- - If any are missing, complete them first before asking "what to build?"
849
- - Date handling: Dates without year assume future (next year if passed this year)
850
-
851
- ---
852
-
853
- ## Session Feedback
854
-
855
- Every few sessions, ask: "How's JFL doing this session? (0-5)"
856
-
857
- - **0-2:** Ask what went wrong, log to `.jfl/feedback.jsonl` with details
858
- - **3-5:** Log rating only
859
-
860
- Don't ask every session - maybe every 3rd or after major milestones.
861
-
862
- Then:
863
- 1. Get right into building
864
- 2. Capture what they said into VISION.md in the background
865
- 3. As decisions are made, record them in the appropriate docs
866
- 4. Context compounds over time
867
-
868
- ---
869
-
870
- ## After Planning
871
-
872
- Before building, ask clarifying questions:
873
- 1. Specific question about their use case
874
- 2. Question about scope/priorities
875
- 3. Question about integrations/APIs
876
- 4. Any references or examples to pull in?
877
-
878
- If foundation docs are empty, offer to capture what you learned into VISION.md, ROADMAP.md, etc.
879
-
880
- Accept any format: pictures, documents, voice notes, links, stream of consciousness.
881
-
882
- ---
883
-
884
- ## On Every Conversation Start
885
-
886
- ### 1. Identify the User
887
-
888
- **Authentication is required for owner access.** Git config alone is NOT trusted.
889
-
890
- ```bash
891
- # Check JFL authentication status
892
- jfl status 2>/dev/null
893
- ```
894
-
895
- **Identity Resolution:**
896
-
897
- | JFL Auth Status | Git Config | Identity | Access |
898
- |-----------------|------------|----------|--------|
899
- | Authenticated (GitHub/x402) | Any | Use JFL auth identity | Based on role |
900
- | Not authenticated | Matches owner | **Unknown** - require auth | None until auth |
901
- | Not authenticated | Other | New contributor | Onboard flow |
902
-
903
- **If not authenticated, prompt:**
904
- ```
905
- To access this project, please authenticate:
906
-
907
- jfl login
908
-
909
- This verifies your identity. Git config alone isn't enough for security.
910
- ```
911
-
912
- **After authentication, check their role:**
913
- - If JFL auth username matches owner in Team Config → Owner access
914
- - If they have `suggestions/{name}.md` → Contributor access
915
- - Otherwise → New contributor, create suggestions file
916
-
917
- ### 2. Determine User Type
918
-
919
- | Type | Check | Permissions |
920
- |------|-------|-------------|
921
- | **Owner** | Listed in Team section below | Full edit access |
922
- | **Contributor** | Has suggestions file | Route to suggestions |
923
- | **New** | No suggestions file | Onboard first |
924
-
925
- ### 3. Show Status
926
-
927
- Run `/hud` to show the project dashboard.
928
-
929
- ---
930
-
931
- ## Team Configuration
932
-
933
- **Owner** (full edit access - must authenticate via `jfl login`):
934
- - **Name:** {owner_name}
935
- - **GitHub Username:** {owner_github_username}
936
- - **x402 Address:** {owner_wallet_address}
937
-
938
- **Core Team** (authenticated access):
939
- | Name | GitHub Username | x402 Address | Role |
940
- |------|-----------------|--------------|------|
941
- | | | | |
942
-
943
- **Contributors:** Identified by `suggestions/{name}.md` file. New users onboarded as contributors.
944
-
945
- ---
946
-
947
- ## Onboarding Flows
948
-
949
- **New Contributor:** Orient → Profile → Assign
950
- 1. Explain VISION.md and NARRATIVE.md
951
- 2. Capture their strengths, role, time commitment in `suggestions/{name}.md`
952
- 3. Assign tasks from `knowledge/TASKS.md`
953
-
954
- **Returning (> 7 days):** Show updates since last visit, remind them what they were working on
955
-
956
- **Regular (< 7 days):** Show /hud dashboard, ask what to work on
957
-
958
- ---
959
-
960
- ## Knowledge Sources
961
-
962
- **Check VISION.md status:** If `EMERGENT` → synthesize from living docs. If `DECLARED` → use declared vision.
963
-
964
- **When EMERGENT, synthesize from:** Product specs → GTM strategy → `content/articles/` → `drafts/` → CRM notes → `knowledge/VISION.md`
965
-
966
- ### Other Strategic Docs
967
-
968
- | Document | Purpose | How Claude Uses It |
969
- |----------|---------|-------------------|
970
- | `knowledge/NARRATIVE.md` | How you tell the story | Generate content |
971
- | `knowledge/THESIS.md` | Why this wins | Answer "Why will you win?" |
972
- | `knowledge/ROADMAP.md` | What ships when | Track progress, countdown |
973
-
974
- ### Brand Docs
975
-
976
- | Document | Purpose |
977
- |----------|---------|
978
- | `knowledge/BRAND_BRIEF.md` | Brand inputs |
979
- | `knowledge/BRAND_DECISIONS.md` | Finalized choices |
980
- | `knowledge/VOICE_AND_TONE.md` | How the brand speaks |
981
-
982
- ### Collaboration Docs
983
-
984
- | Document | Purpose |
985
- |----------|---------|
986
- | `knowledge/TASKS.md` | Master task list |
987
- | `./crm` CLI | Contact database (Google Sheets) - **NEVER read a CRM.md file** |
988
- | `suggestions/{name}.md` | Per-person working space |
989
-
990
- ---
991
-
992
- ## Collaboration System
993
-
994
- ### Routing Work
995
-
996
- **Owner:** Can edit any file directly.
997
-
998
- **Everyone else:** Work goes to `suggestions/{name}.md`:
999
- - Contact updates
1000
- - Task progress
1001
- - Ideas and suggestions
1002
- - Research findings
1003
-
1004
- Owner reviews and merges.
1005
-
1006
- ### CRM Through Conversation
1007
-
1008
- Don't make people type in spreadsheets. Capture updates naturally:
1009
-
1010
- ```
1011
- User: "I DMed @person today"
1012
-
1013
- Claude: "Got it. Logging:
1014
- - @person: DM_SENT
1015
-
1016
- What angle did you use?"
1017
- ```
1018
-
1019
- Log to their suggestions file:
1020
- ```markdown
1021
- ## CRM UPDATES (for sync)
1022
- | Handle | Action | Status | Date | Notes |
1023
- |--------|--------|--------|------|-------|
1024
- | @person | UPDATE | DM_SENT | {date} | |
1025
- ```
1026
-
1027
- ### Task Updates
1028
-
1029
- Same pattern:
1030
- ```
1031
- User: "Finished the thread draft"
1032
-
1033
- Claude: "Nice! Marking complete.
1034
-
1035
- ## TASK UPDATES
1036
- | Task | Status | Notes |
1037
- |------|--------|-------|
1038
- | Write launch thread | DONE | |
1039
- ```
1040
-
1041
- ---
1042
-
1043
- ## Skills Available
1044
-
1045
- | Skill | Purpose | Key Commands |
1046
- |-------|---------|--------------|
1047
- | `/hud` | Project dashboard | `(default)` full dashboard, `--compact` one-line |
1048
- | `/brand-architect` | Brand creation | `(default)` full workflow, `marks`, `colors` |
1049
- | `/web-architect` | Asset implementation | `audit`, `implement all` |
1050
- | `/content` | Content creation | `thread [topic]`, `post [topic]`, `article [topic]`, `one-pager [topic]` |
1051
- | `/video` | Founder video scripts | `idea [topic]`, `script [topic]`, `hook [topic]`, `story [exp]`, `batch [theme]` |
1052
- | `/startup` | Startup guidance | `(default)` assess stage, `next`, `validate [idea]`, `mvp [idea]`, `customers`, `launch` |
1053
-
1054
- See `skills/` folder for detailed documentation on each skill.
1055
-
1056
- ---
1057
-
1058
- ## The Workflow Phases
1059
-
1060
- 1. **Foundation** - Copy templates to `knowledge/`, fill VISION/NARRATIVE/THESIS/ROADMAP
1061
- 2. **Collaboration Setup** - Edit Team section, create `suggestions/` files, set up `./crm`
1062
- 3. **Brand** - Fill `BRAND_BRIEF.md`, run `/brand-architect`, record decisions, run `/web-architect implement all`
1063
- 4. **Content** - Use `/content` for threads/posts/articles, preview in `previews/content/`
1064
- 5. **Launch** - Track with `/hud`, execute tasks, ship it
1065
-
1066
- ---
1067
-
1068
- ## File Conventions
1069
-
1070
- ### Suggestions Files
1071
-
1072
- ```markdown
1073
- # Suggestions - @{name}
1074
-
1075
- ## PROFILE
1076
- {captured during onboarding}
1077
-
1078
- ## CURRENT SESSION
1079
- {what they're working on}
1080
-
1081
- ## CRM UPDATES (for sync)
1082
- | Handle | Action | Status | Date | Notes |
1083
- |--------|--------|--------|------|-------|
1084
-
1085
- ## TASK UPDATES (for sync)
1086
- | Task | Status | Notes |
1087
- |------|--------|-------|
1088
-
1089
- ## IDEAS
1090
- {their suggestions}
1091
- ```
1092
-
1093
- ### SVG Naming
1094
-
1095
- ```
1096
- {type}-{variant}-{size}-{theme}.svg
1097
-
1098
- Examples:
1099
- mark-v1-80-dark.svg
1100
- banner-xl-1500x500-dark.svg
1101
- favicon-32-dark.svg
1102
- ```
1103
-
1104
- ---
1105
-
1106
- ## Session End
1107
-
1108
- When they say "done", "bye", "exit":
1109
-
1110
- ### 1. Save Their Work
1111
-
1112
- Update their suggestions file with everything from this session.
1113
-
1114
- ### 2. Commit and Push
1115
-
1116
- ```bash
1117
- git add .
1118
- git commit -m "{name}: {brief summary}"
1119
- git push
1120
- ```
1121
-
1122
- ### 3. Confirm
1123
-
1124
- ```
1125
- Saved and pushed!
1126
-
1127
- See you next time.
1128
- ```
1129
-
1130
- ---
1131
-
1132
- ## Context to Always Have
1133
-
1134
- Read from your living docs and synthesize. Don't rely on stale one-liners.
1135
-
1136
- **Launch Date:** {from ROADMAP.md}
1137
- **Current Phase:** {from ROADMAP.md}
1138
- **What we're building:** {synthesize from product spec, articles, drafts}
1139
- **Who it's for:** {synthesize from GTM strategy, CRM notes}
1140
-
1141
- Pull fresh from the docs each session. The vision emerges through building, not declaration.
1142
-
1143
- ---
1144
-
1145
- ## Error Handling
1146
-
1147
- ### Missing Foundation Docs
1148
-
1149
- ```
1150
- Strategic docs not found.
1151
-
1152
- To get started:
1153
- 1. Copy templates from templates/strategic/ to knowledge/
1154
- 2. Fill in VISION.md, NARRATIVE.md, THESIS.md, ROADMAP.md
1155
- 3. Run /hud to see your dashboard
1156
- ```
1157
-
1158
- ### Missing Brand Brief
1159
-
1160
- ```
1161
- Brand brief not found.
1162
-
1163
- To create your brand:
1164
- 1. Copy templates/brand/BRAND_BRIEF.md to knowledge/
1165
- 2. Fill in your brand details
1166
- 3. Run /brand-architect
1167
- ```
1168
-
1169
- ### Unknown User
1170
-
1171
- ```
1172
- I don't have a suggestions file for you yet.
1173
-
1174
- What's your name? I'll get you set up.
1175
- ```
1176
-
1177
- ---
1178
-
1179
- ## Remember
1180
-
1181
- 1. **Foundation first** - Strategy docs before tactics
1182
- 2. **Route to suggestions** - Non-owners don't edit main docs
1183
- 3. **Capture naturally** - CRM updates through conversation
1184
- 4. **Context compounds** - Each session builds on the last
1185
- 5. **Ship it** - The goal is launch, not endless iteration
1186
-
1187
- ---