@iamoberlin/chorus 1.2.1 → 1.2.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 (2) hide show
  1. package/index.ts +66 -12
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -38,7 +38,7 @@ import {
38
38
  import * as prayers from "./src/prayers/prayers.js";
39
39
  import * as prayerStore from "./src/prayers/store.js";
40
40
 
41
- const VERSION = "1.2.1"; // Bug fixes: error handling, async safety
41
+ const VERSION = "1.2.3"; // Vision now outputs collected insights + RSI summary
42
42
 
43
43
  const plugin = {
44
44
  id: "chorus",
@@ -315,21 +315,16 @@ const plugin = {
315
315
  process.stdout.write(` ${choir.emoji} ${choir.name}...`);
316
316
 
317
317
  try {
318
- // Build a simplified prompt for vision mode
319
- const visionPrompt = `You are running as ${choir.name} in VISION MODE (day ${day}/${days}).
320
- Your role: ${choir.function}
321
- Output: ${choir.output}
318
+ // Build a simplified prompt for vision mode (short enough for CLI args)
319
+ const visionPrompt = `You are ${choir.name} in VISION MODE (day ${day}/${days}). Role: ${choir.function}. Output: ${choir.output}. Provide a brief summary of what you would do. Keep response under 300 words.`;
322
320
 
323
- This is a simulated cognitive cycle. Provide a brief summary of what you would do/output.
324
- Keep response under 500 words.`;
325
-
326
- // Use spawnSync with stdin to avoid arg length limits
321
+ // Vision prompts are short - safe to use --message
327
322
  const result = spawnSync('openclaw', [
328
323
  'agent',
329
324
  '--session-id', `chorus:vision:${choirId}:d${day}`,
325
+ '--message', visionPrompt,
330
326
  '--json',
331
327
  ], {
332
- input: visionPrompt,
333
328
  encoding: 'utf-8',
334
329
  timeout: 120000, // 2 min timeout per choir
335
330
  maxBuffer: 1024 * 1024, // 1MB buffer
@@ -339,11 +334,11 @@ Keep response under 500 words.`;
339
334
  try {
340
335
  const json = JSON.parse(result.stdout);
341
336
  const text = json.result?.payloads?.[0]?.text || '';
342
- contextStore.set(choirId, text.slice(0, 500));
337
+ contextStore.set(`${choirId}:d${day}`, text.slice(0, 500));
343
338
  successfulRuns++;
344
339
  console.log(` ✓`);
345
340
  } catch {
346
- contextStore.set(choirId, `[${choir.name} completed]`);
341
+ contextStore.set(`${choirId}:d${day}`, `[${choir.name} completed]`);
347
342
  successfulRuns++;
348
343
  console.log(` ✓`);
349
344
  }
@@ -369,6 +364,65 @@ Keep response under 500 words.`;
369
364
  console.log(` Choir runs: ${successfulRuns}/${totalRuns}`);
370
365
  console.log(` Duration: ${elapsed}s`);
371
366
  console.log("");
367
+
368
+ // Output collected insights
369
+ if (contextStore.size > 0 && !options?.dryRun) {
370
+ console.log("📜 COLLECTED INSIGHTS");
371
+ console.log("═".repeat(55));
372
+
373
+ // Group by choir across days
374
+ const choirInsights: Map<string, string[]> = new Map();
375
+ for (const [key, value] of contextStore) {
376
+ const [choirId] = key.split(':');
377
+ if (!choirInsights.has(choirId)) {
378
+ choirInsights.set(choirId, []);
379
+ }
380
+ choirInsights.get(choirId)!.push(value);
381
+ }
382
+
383
+ // Output key choirs with full text
384
+ const keyChoirs = ['virtues', 'powers', 'seraphim'];
385
+ for (const choirId of keyChoirs) {
386
+ const choir = CHOIRS[choirId];
387
+ if (!choir) continue;
388
+
389
+ const insights = [];
390
+ for (const [key, value] of contextStore) {
391
+ if (key.startsWith(choirId) || key.includes(`:${choirId}:`)) {
392
+ insights.push(value);
393
+ }
394
+ }
395
+
396
+ if (insights.length > 0) {
397
+ console.log("");
398
+ console.log(`${choir.emoji} ${choir.name.toUpperCase()}`);
399
+ console.log("─".repeat(40));
400
+ insights.forEach((insight, i) => {
401
+ if (days > 1) console.log(`Day ${i + 1}:`);
402
+ console.log(insight);
403
+ console.log("");
404
+ });
405
+ }
406
+ }
407
+
408
+ // RSI Summary (from Virtues)
409
+ const virtuesInsights = [];
410
+ for (const [key, value] of contextStore) {
411
+ if (key.includes('virtues')) {
412
+ virtuesInsights.push(value);
413
+ }
414
+ }
415
+
416
+ if (virtuesInsights.length > 0) {
417
+ console.log("");
418
+ console.log("🔄 RSI SUMMARY (Self-Improvement)");
419
+ console.log("═".repeat(55));
420
+ virtuesInsights.forEach((v, i) => {
421
+ console.log(`Day ${i + 1}: ${v.slice(0, 200)}${v.length > 200 ? '...' : ''}`);
422
+ });
423
+ console.log("");
424
+ }
425
+ }
372
426
  });
373
427
 
374
428
  // Metrics command
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iamoberlin/chorus",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "CHORUS: Hierarchy Of Recursive Unified Self-improvement — with Prayer Requests social network",
5
5
  "author": "Oberlin <iam@oberlin.ai>",
6
6
  "license": "MIT",