@rely-ai/caliber 1.40.2 → 1.40.4
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 +47 -7
- 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
|
|
|
@@ -12186,9 +12188,10 @@ async function refreshCommand(options) {
|
|
|
12186
12188
|
`${repoName}: refresh failed \u2014 ${err instanceof Error ? err.message : "unknown error"}`
|
|
12187
12189
|
)
|
|
12188
12190
|
);
|
|
12191
|
+
} finally {
|
|
12192
|
+
process.chdir(originalDir);
|
|
12189
12193
|
}
|
|
12190
12194
|
}
|
|
12191
|
-
process.chdir(originalDir);
|
|
12192
12195
|
} catch (err) {
|
|
12193
12196
|
if (err instanceof Error && err.message === "__exit__") throw err;
|
|
12194
12197
|
writeRefreshError(err);
|
|
@@ -12472,6 +12475,8 @@ function readStdin() {
|
|
|
12472
12475
|
import fs43 from "fs";
|
|
12473
12476
|
import path35 from "path";
|
|
12474
12477
|
var MAX_RESPONSE_LENGTH = 2e3;
|
|
12478
|
+
var MAX_PROMPT_LENGTH = 2e3;
|
|
12479
|
+
var MAX_SESSION_FILE_BYTES = 10 * 1024 * 1024;
|
|
12475
12480
|
var DEFAULT_STATE = {
|
|
12476
12481
|
sessionId: null,
|
|
12477
12482
|
eventCount: 0,
|
|
@@ -12495,6 +12500,16 @@ function truncateResponse(response) {
|
|
|
12495
12500
|
return { _truncated: str.slice(0, MAX_RESPONSE_LENGTH) };
|
|
12496
12501
|
}
|
|
12497
12502
|
function trimSessionFileIfNeeded(filePath) {
|
|
12503
|
+
try {
|
|
12504
|
+
const stat = fs43.statSync(filePath);
|
|
12505
|
+
if (stat.size > MAX_SESSION_FILE_BYTES) {
|
|
12506
|
+
fs43.writeFileSync(filePath, "");
|
|
12507
|
+
resetState();
|
|
12508
|
+
return;
|
|
12509
|
+
}
|
|
12510
|
+
} catch {
|
|
12511
|
+
return;
|
|
12512
|
+
}
|
|
12498
12513
|
const state = readState2();
|
|
12499
12514
|
if (state.eventCount + 1 > LEARNING_MAX_EVENTS) {
|
|
12500
12515
|
const lines = fs43.readFileSync(filePath, "utf-8").split("\n").filter(Boolean);
|
|
@@ -12513,13 +12528,26 @@ function appendEvent(event) {
|
|
|
12513
12528
|
}
|
|
12514
12529
|
function appendPromptEvent(event) {
|
|
12515
12530
|
ensureLearningDir();
|
|
12531
|
+
const truncated = {
|
|
12532
|
+
...event,
|
|
12533
|
+
prompt_content: event.prompt_content.length > MAX_PROMPT_LENGTH ? event.prompt_content.slice(0, MAX_PROMPT_LENGTH) : event.prompt_content
|
|
12534
|
+
};
|
|
12516
12535
|
const filePath = sessionFilePath();
|
|
12517
|
-
fs43.appendFileSync(filePath, JSON.stringify(
|
|
12536
|
+
fs43.appendFileSync(filePath, JSON.stringify(truncated) + "\n");
|
|
12518
12537
|
trimSessionFileIfNeeded(filePath);
|
|
12519
12538
|
}
|
|
12520
12539
|
function readAllEvents() {
|
|
12521
12540
|
const filePath = sessionFilePath();
|
|
12522
|
-
|
|
12541
|
+
try {
|
|
12542
|
+
const stat = fs43.statSync(filePath);
|
|
12543
|
+
if (stat.size > MAX_SESSION_FILE_BYTES) {
|
|
12544
|
+
fs43.writeFileSync(filePath, "");
|
|
12545
|
+
resetState();
|
|
12546
|
+
return [];
|
|
12547
|
+
}
|
|
12548
|
+
} catch {
|
|
12549
|
+
return [];
|
|
12550
|
+
}
|
|
12523
12551
|
const lines = fs43.readFileSync(filePath, "utf-8").split("\n").filter(Boolean);
|
|
12524
12552
|
const events = [];
|
|
12525
12553
|
for (const line of lines) {
|
|
@@ -12532,13 +12560,21 @@ function readAllEvents() {
|
|
|
12532
12560
|
}
|
|
12533
12561
|
function getEventCount() {
|
|
12534
12562
|
const filePath = sessionFilePath();
|
|
12535
|
-
|
|
12563
|
+
try {
|
|
12564
|
+
const stat = fs43.statSync(filePath);
|
|
12565
|
+
if (stat.size > MAX_SESSION_FILE_BYTES) return 0;
|
|
12566
|
+
} catch {
|
|
12567
|
+
return 0;
|
|
12568
|
+
}
|
|
12536
12569
|
const content = fs43.readFileSync(filePath, "utf-8");
|
|
12537
12570
|
return content.split("\n").filter(Boolean).length;
|
|
12538
12571
|
}
|
|
12539
12572
|
function clearSession() {
|
|
12540
12573
|
const filePath = sessionFilePath();
|
|
12541
|
-
|
|
12574
|
+
try {
|
|
12575
|
+
fs43.writeFileSync(filePath, "");
|
|
12576
|
+
} catch {
|
|
12577
|
+
}
|
|
12542
12578
|
}
|
|
12543
12579
|
function readState2() {
|
|
12544
12580
|
const filePath = stateFilePath();
|
|
@@ -13060,11 +13096,15 @@ async function learnObserveCommand(options) {
|
|
|
13060
13096
|
const hookData = JSON.parse(raw);
|
|
13061
13097
|
const sessionId = hookData.session_id || hookData.conversation_id || "unknown";
|
|
13062
13098
|
if (options.prompt) {
|
|
13099
|
+
const content = String(hookData.prompt_content || hookData.content || hookData.prompt || "");
|
|
13100
|
+
if (/^You are an expert\b/i.test(content)) {
|
|
13101
|
+
return;
|
|
13102
|
+
}
|
|
13063
13103
|
const event2 = {
|
|
13064
13104
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13065
13105
|
session_id: sessionId,
|
|
13066
13106
|
hook_event_name: "UserPromptSubmit",
|
|
13067
|
-
prompt_content: sanitizeSecrets(
|
|
13107
|
+
prompt_content: sanitizeSecrets(content),
|
|
13068
13108
|
cwd: hookData.cwd || process.cwd()
|
|
13069
13109
|
};
|
|
13070
13110
|
appendPromptEvent(event2);
|
package/package.json
CHANGED