@rely-ai/caliber 1.40.2 → 1.40.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.
- package/dist/bin.js +39 -5
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -3565,6 +3565,8 @@ You receive a chronological sequence of events from a Claude Code session. Most
|
|
|
3565
3565
|
|
|
3566
3566
|
Your job is to find OPERATIONAL patterns \u2014 things that went wrong and how they were fixed, commands that required specific flags or configuration, APIs that needed a particular approach to work. Focus on the WORKFLOW, not the code logic.
|
|
3567
3567
|
|
|
3568
|
+
IMPORTANT CONTEXT: Your output will be committed to git and shared with all developers and AI agents working on this repo. Only include patterns that will genuinely help future work \u2014 not descriptions of bugs that were already fixed in this session, not local environment issues, and not implementation details of what was built.
|
|
3569
|
+
|
|
3568
3570
|
CRITICAL FILTER \u2014 apply this to every potential learning before including it:
|
|
3569
3571
|
The litmus test: "Would a different developer, working on a DIFFERENT task in this same repo next week, benefit from knowing this?" If the answer is no \u2014 if it only matters for the exact problem being debugged today \u2014 do NOT include it.
|
|
3570
3572
|
|
|
@@ -3573,7 +3575,7 @@ DO NOT extract:
|
|
|
3573
3575
|
- General programming best practices everyone already knows
|
|
3574
3576
|
- Summaries of successful routine operations that need no special handling
|
|
3575
3577
|
- Anything already covered in the existing CLAUDE.md
|
|
3576
|
-
- **One-time debugging artifacts** \u2014 fixes for a specific bug that was resolved in this session and won't recur (e.g. "fixed the stream parser by adding a null check at line 42"). Only extract if the pattern
|
|
3578
|
+
- **One-time debugging artifacts** \u2014 fixes for a specific bug that was resolved in this session and won't recur (e.g. "fixed the stream parser by adding a null check at line 42"). The fix is in the code and git history \u2014 don't duplicate it as a learning. Only extract if the pattern reveals a recurring trap that future sessions could fall into.
|
|
3577
3579
|
- **Session-specific file paths, worktree locations, or branch names** \u2014 these are ephemeral and won't apply to future sessions
|
|
3578
3580
|
- **Implementation details of a feature being built** \u2014 the learning should be about HOW to work in this project, not WHAT was built
|
|
3579
3581
|
|
|
@@ -12472,6 +12474,8 @@ function readStdin() {
|
|
|
12472
12474
|
import fs43 from "fs";
|
|
12473
12475
|
import path35 from "path";
|
|
12474
12476
|
var MAX_RESPONSE_LENGTH = 2e3;
|
|
12477
|
+
var MAX_PROMPT_LENGTH = 2e3;
|
|
12478
|
+
var MAX_SESSION_FILE_BYTES = 10 * 1024 * 1024;
|
|
12475
12479
|
var DEFAULT_STATE = {
|
|
12476
12480
|
sessionId: null,
|
|
12477
12481
|
eventCount: 0,
|
|
@@ -12495,6 +12499,15 @@ function truncateResponse(response) {
|
|
|
12495
12499
|
return { _truncated: str.slice(0, MAX_RESPONSE_LENGTH) };
|
|
12496
12500
|
}
|
|
12497
12501
|
function trimSessionFileIfNeeded(filePath) {
|
|
12502
|
+
try {
|
|
12503
|
+
const stat = fs43.statSync(filePath);
|
|
12504
|
+
if (stat.size > MAX_SESSION_FILE_BYTES) {
|
|
12505
|
+
fs43.writeFileSync(filePath, "");
|
|
12506
|
+
return;
|
|
12507
|
+
}
|
|
12508
|
+
} catch {
|
|
12509
|
+
return;
|
|
12510
|
+
}
|
|
12498
12511
|
const state = readState2();
|
|
12499
12512
|
if (state.eventCount + 1 > LEARNING_MAX_EVENTS) {
|
|
12500
12513
|
const lines = fs43.readFileSync(filePath, "utf-8").split("\n").filter(Boolean);
|
|
@@ -12513,13 +12526,25 @@ function appendEvent(event) {
|
|
|
12513
12526
|
}
|
|
12514
12527
|
function appendPromptEvent(event) {
|
|
12515
12528
|
ensureLearningDir();
|
|
12529
|
+
const truncated = {
|
|
12530
|
+
...event,
|
|
12531
|
+
prompt_content: event.prompt_content.length > MAX_PROMPT_LENGTH ? event.prompt_content.slice(0, MAX_PROMPT_LENGTH) : event.prompt_content
|
|
12532
|
+
};
|
|
12516
12533
|
const filePath = sessionFilePath();
|
|
12517
|
-
fs43.appendFileSync(filePath, JSON.stringify(
|
|
12534
|
+
fs43.appendFileSync(filePath, JSON.stringify(truncated) + "\n");
|
|
12518
12535
|
trimSessionFileIfNeeded(filePath);
|
|
12519
12536
|
}
|
|
12520
12537
|
function readAllEvents() {
|
|
12521
12538
|
const filePath = sessionFilePath();
|
|
12522
|
-
|
|
12539
|
+
try {
|
|
12540
|
+
const stat = fs43.statSync(filePath);
|
|
12541
|
+
if (stat.size > MAX_SESSION_FILE_BYTES) {
|
|
12542
|
+
fs43.writeFileSync(filePath, "");
|
|
12543
|
+
return [];
|
|
12544
|
+
}
|
|
12545
|
+
} catch {
|
|
12546
|
+
return [];
|
|
12547
|
+
}
|
|
12523
12548
|
const lines = fs43.readFileSync(filePath, "utf-8").split("\n").filter(Boolean);
|
|
12524
12549
|
const events = [];
|
|
12525
12550
|
for (const line of lines) {
|
|
@@ -12532,7 +12557,12 @@ function readAllEvents() {
|
|
|
12532
12557
|
}
|
|
12533
12558
|
function getEventCount() {
|
|
12534
12559
|
const filePath = sessionFilePath();
|
|
12535
|
-
|
|
12560
|
+
try {
|
|
12561
|
+
const stat = fs43.statSync(filePath);
|
|
12562
|
+
if (stat.size > MAX_SESSION_FILE_BYTES) return 0;
|
|
12563
|
+
} catch {
|
|
12564
|
+
return 0;
|
|
12565
|
+
}
|
|
12536
12566
|
const content = fs43.readFileSync(filePath, "utf-8");
|
|
12537
12567
|
return content.split("\n").filter(Boolean).length;
|
|
12538
12568
|
}
|
|
@@ -13060,11 +13090,15 @@ async function learnObserveCommand(options) {
|
|
|
13060
13090
|
const hookData = JSON.parse(raw);
|
|
13061
13091
|
const sessionId = hookData.session_id || hookData.conversation_id || "unknown";
|
|
13062
13092
|
if (options.prompt) {
|
|
13093
|
+
const content = String(hookData.prompt_content || hookData.content || hookData.prompt || "");
|
|
13094
|
+
if (/^You are an expert\b/i.test(content)) {
|
|
13095
|
+
return;
|
|
13096
|
+
}
|
|
13063
13097
|
const event2 = {
|
|
13064
13098
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13065
13099
|
session_id: sessionId,
|
|
13066
13100
|
hook_event_name: "UserPromptSubmit",
|
|
13067
|
-
prompt_content: sanitizeSecrets(
|
|
13101
|
+
prompt_content: sanitizeSecrets(content),
|
|
13068
13102
|
cwd: hookData.cwd || process.cwd()
|
|
13069
13103
|
};
|
|
13070
13104
|
appendPromptEvent(event2);
|
package/package.json
CHANGED