@rely-ai/caliber 1.19.4 → 1.19.5
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 +58 -24
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -2060,39 +2060,53 @@ Return a JSON object with this exact shape:
|
|
|
2060
2060
|
}
|
|
2061
2061
|
|
|
2062
2062
|
Respond with ONLY the JSON object, no markdown fences or extra text.`;
|
|
2063
|
-
var LEARN_SYSTEM_PROMPT = `You are an expert developer experience engineer. You analyze raw tool call events from AI coding sessions to extract reusable lessons that will
|
|
2063
|
+
var LEARN_SYSTEM_PROMPT = `You are an expert developer experience engineer. You analyze raw tool call events from AI coding sessions to extract reusable operational lessons that will help future LLM sessions work more effectively in this project.
|
|
2064
2064
|
|
|
2065
2065
|
You receive a chronological sequence of tool events from a Claude Code session. Each event includes the tool name, its input, its response, and whether it was a success or failure.
|
|
2066
2066
|
|
|
2067
|
-
Your job is to
|
|
2067
|
+
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.
|
|
2068
2068
|
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2069
|
+
Look for:
|
|
2070
|
+
|
|
2071
|
+
1. **Failure \u2192 Recovery sequences**: A tool call failed, then a different approach succeeded. Document what works and what doesn't. Example: an API call failed with one config but succeeded with different headers or parameters.
|
|
2072
|
+
2. **Environment gotchas**: Commands that need specific env vars, flags, or preconditions to work in this project.
|
|
2073
|
+
3. **Retry patterns**: When something had to be called multiple times with different arguments before succeeding.
|
|
2074
|
+
4. **Project-specific commands**: The correct way to build, test, lint, deploy \u2014 especially if it differs from defaults.
|
|
2075
|
+
5. **File/path traps**: Paths that are misleading, files that shouldn't be edited, directories with unexpected structure.
|
|
2076
|
+
6. **Configuration quirks**: Settings, flags, or arguments that are required but non-obvious.
|
|
2077
|
+
|
|
2078
|
+
DO NOT extract:
|
|
2079
|
+
- Descriptions of what the code does or how features work (e.g. "compression removes comments" or "skeleton extraction creates outlines")
|
|
2080
|
+
- General programming best practices everyone already knows
|
|
2081
|
+
- Summaries of successful routine operations that need no special handling
|
|
2082
|
+
- Anything already covered in the existing CLAUDE.md
|
|
2075
2083
|
|
|
2076
2084
|
From these observations, produce:
|
|
2077
2085
|
|
|
2078
2086
|
### claudeMdLearnedSection
|
|
2079
|
-
A markdown section with concise, actionable bullet points. Your output will be written to CALIBER_LEARNINGS.md \u2014 a standalone file that all AI coding agents (Claude Code, Cursor, Codex) reference for project-specific
|
|
2080
|
-
|
|
2087
|
+
A markdown section with concise, actionable bullet points. Your output will be written to CALIBER_LEARNINGS.md \u2014 a standalone file that all AI coding agents (Claude Code, Cursor, Codex) reference for project-specific operational patterns. Each bullet should be a concrete instruction that prevents a future mistake or encodes a discovered workaround. Format: what to do (or avoid), and why.
|
|
2088
|
+
|
|
2089
|
+
Good examples:
|
|
2090
|
+
- "Run \`npm install\` before \`npm run build\` \u2014 the build assumes deps are installed and gives a misleading error otherwise"
|
|
2081
2091
|
- "The test database requires \`DATABASE_URL\` to be set \u2014 use \`source .env.test\` first"
|
|
2082
|
-
- "
|
|
2083
|
-
- "
|
|
2084
|
-
- "
|
|
2085
|
-
- "
|
|
2086
|
-
- "
|
|
2092
|
+
- "Use \`pnpm\` not \`npm\` \u2014 the lockfile is pnpm-lock.yaml and npm creates conflicts"
|
|
2093
|
+
- "Do NOT run \`jest\` directly \u2014 always use \`npm run test\` which sets the correct NODE_ENV"
|
|
2094
|
+
- "API calls to \`/v2/users\` require the \`X-Api-Version\` header \u2014 without it you get a 404 that looks like the endpoint doesn't exist"
|
|
2095
|
+
- "When \`tsup\` build fails with a type error, run \`npx tsc --noEmit\` first to get the real error \u2014 tsup swallows the details"
|
|
2096
|
+
- "Files in \`src/generated/\` are auto-generated \u2014 editing them directly will be overwritten on next build"
|
|
2097
|
+
|
|
2098
|
+
Bad examples (do NOT produce these):
|
|
2099
|
+
- "The codebase uses TypeScript with strict mode" (describes code, not actionable)
|
|
2100
|
+
- "Components follow a pattern of X" (describes architecture, not operational)
|
|
2101
|
+
- "The project has a scoring module" (summarizes code structure)
|
|
2087
2102
|
|
|
2088
2103
|
Rules for the learned section:
|
|
2089
2104
|
- Be additive: keep all existing learned items, add new ones, remove duplicates
|
|
2090
2105
|
- Never repeat instructions already present in the main CLAUDE.md
|
|
2091
|
-
- Each bullet must
|
|
2106
|
+
- Each bullet must encode an operational lesson from actual events \u2014 not a code description
|
|
2092
2107
|
- Include both positive directives ('Always do X') and negative rules ('Never do Y because Z') when the session evidence supports them
|
|
2093
2108
|
- Maximum ~30 bullet items total
|
|
2094
|
-
-
|
|
2095
|
-
- If there's nothing meaningful to learn, return null
|
|
2109
|
+
- If there's nothing operationally meaningful to learn, return null \u2014 this is perfectly fine
|
|
2096
2110
|
|
|
2097
2111
|
### skills
|
|
2098
2112
|
Only create a skill when there's enough domain-specific knowledge to warrant a dedicated file (e.g., a specific build process, a testing pattern, a deployment workflow). Most sessions won't produce skills.
|
|
@@ -8127,7 +8141,14 @@ function readAllEvents() {
|
|
|
8127
8141
|
const filePath = sessionFilePath();
|
|
8128
8142
|
if (!fs30.existsSync(filePath)) return [];
|
|
8129
8143
|
const lines = fs30.readFileSync(filePath, "utf-8").split("\n").filter(Boolean);
|
|
8130
|
-
|
|
8144
|
+
const events = [];
|
|
8145
|
+
for (const line of lines) {
|
|
8146
|
+
try {
|
|
8147
|
+
events.push(JSON.parse(line));
|
|
8148
|
+
} catch {
|
|
8149
|
+
}
|
|
8150
|
+
}
|
|
8151
|
+
return events;
|
|
8131
8152
|
}
|
|
8132
8153
|
function getEventCount() {
|
|
8133
8154
|
const filePath = sessionFilePath();
|
|
@@ -8271,7 +8292,7 @@ ${eventsText}`;
|
|
|
8271
8292
|
|
|
8272
8293
|
// src/commands/learn.ts
|
|
8273
8294
|
init_config();
|
|
8274
|
-
var MIN_EVENTS_FOR_ANALYSIS =
|
|
8295
|
+
var MIN_EVENTS_FOR_ANALYSIS = 25;
|
|
8275
8296
|
async function learnObserveCommand(options) {
|
|
8276
8297
|
try {
|
|
8277
8298
|
const raw = await readStdin();
|
|
@@ -8298,19 +8319,29 @@ async function learnObserveCommand(options) {
|
|
|
8298
8319
|
async function learnFinalizeCommand(options) {
|
|
8299
8320
|
if (!options?.force) {
|
|
8300
8321
|
const { isCaliberRunning: isCaliberRunning2 } = await Promise.resolve().then(() => (init_lock(), lock_exports));
|
|
8301
|
-
if (isCaliberRunning2())
|
|
8322
|
+
if (isCaliberRunning2()) {
|
|
8323
|
+
console.log(chalk17.dim("caliber: skipping finalize \u2014 another caliber process is running"));
|
|
8324
|
+
return;
|
|
8325
|
+
}
|
|
8326
|
+
}
|
|
8327
|
+
if (!acquireFinalizeLock()) {
|
|
8328
|
+
console.log(chalk17.dim("caliber: skipping finalize \u2014 another finalize is in progress"));
|
|
8329
|
+
return;
|
|
8302
8330
|
}
|
|
8303
|
-
if (!acquireFinalizeLock()) return;
|
|
8304
8331
|
let analyzed = false;
|
|
8305
8332
|
try {
|
|
8306
8333
|
const config = loadConfig();
|
|
8307
8334
|
if (!config) {
|
|
8335
|
+
console.log(chalk17.yellow("caliber: no LLM provider configured \u2014 run `caliber config` first"));
|
|
8308
8336
|
clearSession();
|
|
8309
8337
|
resetState();
|
|
8310
8338
|
return;
|
|
8311
8339
|
}
|
|
8312
8340
|
const events = readAllEvents();
|
|
8313
|
-
if (events.length < MIN_EVENTS_FOR_ANALYSIS)
|
|
8341
|
+
if (events.length < MIN_EVENTS_FOR_ANALYSIS) {
|
|
8342
|
+
console.log(chalk17.dim(`caliber: ${events.length}/${MIN_EVENTS_FOR_ANALYSIS} events recorded \u2014 need more before analysis`));
|
|
8343
|
+
return;
|
|
8344
|
+
}
|
|
8314
8345
|
await validateModel({ fast: true });
|
|
8315
8346
|
migrateInlineLearnings();
|
|
8316
8347
|
const existingConfigs = readExistingConfigs(process.cwd());
|
|
@@ -8335,7 +8366,10 @@ async function learnFinalizeCommand(options) {
|
|
|
8335
8366
|
}
|
|
8336
8367
|
}
|
|
8337
8368
|
}
|
|
8338
|
-
} catch {
|
|
8369
|
+
} catch (err) {
|
|
8370
|
+
if (options?.force) {
|
|
8371
|
+
console.error(chalk17.red("caliber: finalize failed \u2014"), err instanceof Error ? err.message : err);
|
|
8372
|
+
}
|
|
8339
8373
|
} finally {
|
|
8340
8374
|
if (analyzed) {
|
|
8341
8375
|
clearSession();
|
package/package.json
CHANGED