jostlebot Claude Opus 4.5 commited on
Commit
7d4dcb0
·
1 Parent(s): ae87306

Add WISDOM tool with sacred text traditions

Browse files

- New WISDOM tool: Choose from Torah/Talmud, Jesus Following, Quran, Buddhist Texts, Rumi, or Brené Brown
- Analyzes conversation themes and provides relevant wisdom quotes
- Added backend prompt for wisdom/sacred texts
- Golden styling for WISDOM button
- Interactive tradition selection like FEEL and NEED tools

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Files changed (2) hide show
  1. app.py +23 -1
  2. static/index.html +115 -1
app.py CHANGED
@@ -352,7 +352,29 @@ Never:
352
  - Tell them not to send
353
  - Be prescriptive about what they should do""",
354
 
355
- # TOOL 10: REPAIR SUPPORT
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
356
  "repair_support": """This tool helps craft genuine repair attempts after ruptures.
357
 
358
  ABSOLUTE RULE - NO FIRST PERSON:
 
352
  - Tell them not to send
353
  - Be prescriptive about what they should do""",
354
 
355
+ # TOOL 10: WISDOM (Sacred Texts)
356
+ "wisdom": """You are a wisdom companion offering support through sacred and meaningful texts.
357
+
358
+ ABSOLUTE RULE - NO FIRST PERSON:
359
+ - NEVER say "I notice", "I sense", "I see"
360
+ - Just provide the wisdom directly
361
+
362
+ Based on the conversation themes and the user's chosen tradition, provide ONE relevant quote, verse, or passage that speaks to their situation with compassion, grounding, or insight.
363
+
364
+ Guidelines:
365
+ - Choose a quote that feels applicable to their specific relational situation
366
+ - The quote should offer comfort, perspective, or gentle wisdom about connection, conflict, repair, or love
367
+ - Include a clear citation (book/chapter/verse, or source/work for authors)
368
+ - Keep your response focused - the quote and a brief (1-2 sentence) bridge to their situation
369
+
370
+ Format your response as:
371
+ **[The quote text]**
372
+
373
+ — [Citation]
374
+
375
+ [Brief bridge to their situation - how this might apply]""",
376
+
377
+ # TOOL 11: REPAIR SUPPORT
378
  "repair_support": """This tool helps craft genuine repair attempts after ruptures.
379
 
380
  ABSOLUTE RULE - NO FIRST PERSON:
static/index.html CHANGED
@@ -125,6 +125,21 @@
125
  background: rgba(236, 72, 153, 0.1);
126
  }
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  /* Settings */
129
  .settings-section {
130
  padding: 16px;
@@ -806,6 +821,11 @@
806
  <h4>LOVE</h4>
807
  <p>Slow down. Take a breath. Return to presence.</p>
808
  </div>
 
 
 
 
 
809
  </div>
810
 
811
  <div class="settings-section">
@@ -898,6 +918,7 @@
898
  <button class="tool-btn" onclick="useTool('repair')">REPAIR</button>
899
  <button class="tool-btn" onclick="useTool('soma')">SOMA</button>
900
  <button class="tool-btn love" onclick="useTool('love')">LOVE</button>
 
901
  </div>
902
 
903
  <!-- Message Input -->
@@ -948,9 +969,22 @@
948
  listen: { name: 'Receive Mode', icon: '👂', api: 'receive_mode' },
949
  repair: { name: 'Repair Support', icon: '🙏', api: 'repair_support' },
950
  soma: { name: 'Somatic Check-in', icon: '🫁', api: 'somatic_checkin' },
951
- love: { name: 'Slow Down', icon: '💗', api: null }
 
 
 
 
 
 
 
 
 
 
 
952
  };
953
 
 
 
954
  // NVC Feelings vocabulary
955
  const FEELINGS_DATA = {
956
  'When needs ARE met': ['Calm', 'Content', 'Grateful', 'Hopeful', 'Joyful', 'Peaceful', 'Relieved', 'Safe', 'Tender', 'Touched'],
@@ -1055,10 +1089,49 @@
1055
  return;
1056
  }
1057
 
 
 
 
 
 
1058
  // Call API for other tools
1059
  callToolAPI(tool, userInput);
1060
  }
1061
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1062
  function showFeelingsSelection() {
1063
  selectedFeelings = [];
1064
  const content = document.getElementById('tool-content');
@@ -1308,6 +1381,47 @@
1308
  return;
1309
  }
1310
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1311
  if (!userInput || !activeTool) return;
1312
 
1313
  input.value = '';
 
125
  background: rgba(236, 72, 153, 0.1);
126
  }
127
 
128
+ .tool-desc.wisdom-desc {
129
+ border-left-color: #f59e0b;
130
+ background: rgba(245, 158, 11, 0.1);
131
+ }
132
+
133
+ .tool-btn.wisdom {
134
+ border-color: #f59e0b;
135
+ color: #f59e0b;
136
+ }
137
+
138
+ .tool-btn.wisdom:hover, .tool-btn.wisdom.active {
139
+ background: #f59e0b;
140
+ color: white;
141
+ }
142
+
143
  /* Settings */
144
  .settings-section {
145
  padding: 16px;
 
821
  <h4>LOVE</h4>
822
  <p>Slow down. Take a breath. Return to presence.</p>
823
  </div>
824
+
825
+ <div class="tool-desc wisdom-desc" onclick="showToolInfo('wisdom')">
826
+ <h4>WISDOM</h4>
827
+ <p>Draw from sacred texts. Choose your tradition for grounded wisdom.</p>
828
+ </div>
829
  </div>
830
 
831
  <div class="settings-section">
 
918
  <button class="tool-btn" onclick="useTool('repair')">REPAIR</button>
919
  <button class="tool-btn" onclick="useTool('soma')">SOMA</button>
920
  <button class="tool-btn love" onclick="useTool('love')">LOVE</button>
921
+ <button class="tool-btn wisdom" onclick="useTool('wisdom')">WISDOM</button>
922
  </div>
923
 
924
  <!-- Message Input -->
 
969
  listen: { name: 'Receive Mode', icon: '👂', api: 'receive_mode' },
970
  repair: { name: 'Repair Support', icon: '🙏', api: 'repair_support' },
971
  soma: { name: 'Somatic Check-in', icon: '🫁', api: 'somatic_checkin' },
972
+ love: { name: 'Slow Down', icon: '💗', api: null },
973
+ wisdom: { name: 'Sacred Wisdom', icon: '🕊️', api: 'wisdom', interactive: true }
974
+ };
975
+
976
+ // Wisdom traditions
977
+ const WISDOM_TRADITIONS = {
978
+ 'Torah/Talmud': 'Jewish scripture and rabbinic wisdom',
979
+ 'Jesus Following': 'Christian scripture and teachings',
980
+ 'Quran': 'Islamic scripture',
981
+ 'Buddhist Texts': 'Sutras, Dhammapada, and teachings',
982
+ 'Rumi': 'Sufi poetry and mysticism',
983
+ 'Brené Brown': 'Modern wisdom on vulnerability and connection'
984
  };
985
 
986
+ let selectedTradition = null;
987
+
988
  // NVC Feelings vocabulary
989
  const FEELINGS_DATA = {
990
  'When needs ARE met': ['Calm', 'Content', 'Grateful', 'Hopeful', 'Joyful', 'Peaceful', 'Relieved', 'Safe', 'Tender', 'Touched'],
 
1089
  return;
1090
  }
1091
 
1092
+ if (tool === 'wisdom') {
1093
+ showWisdomSelection();
1094
+ return;
1095
+ }
1096
+
1097
  // Call API for other tools
1098
  callToolAPI(tool, userInput);
1099
  }
1100
 
1101
+ function showWisdomSelection() {
1102
+ selectedTradition = null;
1103
+ const content = document.getElementById('tool-content');
1104
+
1105
+ let html = '<p style="margin-bottom: 16px; color: var(--text-secondary);">Choose a wisdom tradition to draw from:</p>';
1106
+ html += '<div class="selection-grid">';
1107
+
1108
+ for (const [tradition, desc] of Object.entries(WISDOM_TRADITIONS)) {
1109
+ html += `<button class="selection-btn" onclick="selectTradition('${tradition}')" id="trad-${tradition.replace(/[^a-zA-Z]/g, '')}" title="${desc}">${tradition}</button>`;
1110
+ }
1111
+
1112
+ html += '</div>';
1113
+ html += '<div class="selected-items" id="tradition-summary" style="display: none;"><h4>Selected tradition:</h4><p id="tradition-selected"></p></div>';
1114
+ html += '<p style="margin-top: 16px; color: var(--text-muted); font-size: 0.8rem;">Select a tradition, then click Submit to get wisdom relevant to your conversation.</p>';
1115
+
1116
+ content.innerHTML = html;
1117
+ }
1118
+
1119
+ function selectTradition(tradition) {
1120
+ // Clear previous selection
1121
+ document.querySelectorAll('#tool-content .selection-btn').forEach(btn => btn.classList.remove('selected'));
1122
+
1123
+ // Select new tradition
1124
+ const btn = document.getElementById(`trad-${tradition.replace(/[^a-zA-Z]/g, '')}`);
1125
+ if (btn) btn.classList.add('selected');
1126
+
1127
+ selectedTradition = tradition;
1128
+
1129
+ const summary = document.getElementById('tradition-summary');
1130
+ const selected = document.getElementById('tradition-selected');
1131
+ summary.style.display = 'block';
1132
+ selected.textContent = `${tradition} — ${WISDOM_TRADITIONS[tradition]}`;
1133
+ }
1134
+
1135
  function showFeelingsSelection() {
1136
  selectedFeelings = [];
1137
  const content = document.getElementById('tool-content');
 
1381
  return;
1382
  }
1383
 
1384
+ // Handle WISDOM tool submission
1385
+ if (activeTool === 'wisdom' && selectedTradition) {
1386
+ addToolMsg('user', `Drawing from: ${selectedTradition}`);
1387
+
1388
+ // Build conversation context for wisdom
1389
+ const convContext = conversationHistory.map(m => `${m.role === 'user' ? 'User' : 'Partner'}: ${m.content}`).join('\n');
1390
+
1391
+ addToolLoading();
1392
+ const isVerbose = document.getElementById('toggle-verbose')?.checked || false;
1393
+ try {
1394
+ const response = await fetch('/api/tool', {
1395
+ method: 'POST',
1396
+ headers: { 'Content-Type': 'application/json' },
1397
+ body: JSON.stringify({
1398
+ tool: 'wisdom',
1399
+ partner_message: lastPartnerMessage,
1400
+ user_draft: userInput || '',
1401
+ user_input: `The user draws wisdom from: ${selectedTradition}.
1402
+
1403
+ Conversation so far:
1404
+ ${convContext || 'No conversation yet.'}
1405
+
1406
+ ${userInput ? 'User adds: ' + userInput : ''}
1407
+
1408
+ Based on the themes in this conversation (conflict, connection, fear, love, boundaries, etc.), provide ONE relevant quote from ${selectedTradition} that speaks to their situation.`,
1409
+ verbose: isVerbose
1410
+ })
1411
+ });
1412
+ const data = await response.json();
1413
+ removeToolLoading();
1414
+ if (data.response) {
1415
+ addToolMsg('tool', data.response, `${selectedTradition} Wisdom`);
1416
+ }
1417
+ } catch (e) {
1418
+ removeToolLoading();
1419
+ addToolMsg('tool', 'Connection error.', 'Error');
1420
+ }
1421
+ input.value = '';
1422
+ return;
1423
+ }
1424
+
1425
  if (!userInput || !activeTool) return;
1426
 
1427
  input.value = '';