@koda-sl/baker-bridge 0.190.0-dev.faaded67a → 0.192.0-dev.119a96955

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/README.md CHANGED
@@ -139,7 +139,10 @@ the CLI gates some tools on the model, so the resolved set differs per model.
139
139
  additional directory; the root file is excluded so it is not loaded twice. In
140
140
  the system prompt the scaffold's text ends on a cache breakpoint, so every chat
141
141
  reads one cached copy instead of writing its own ~24k tokens. A `CLAUDE.md`
142
- without that exact block loads as before. See `workspace-instructions.ts`.
142
+ without that exact block loads as before. COMPANY.md is imported one heading
143
+ section per file (copies in `.cache/baker-instructions/company/`), so when it
144
+ changes, a resumed Session re-reads only the sections that changed rather than
145
+ the whole profile. See `workspace-instructions.ts`.
143
146
 
144
147
  `Options.agents` is deliberately left unset: the workspace ships its own
145
148
  subagents in `.claude/agents/`, discovered from disk via
@@ -692,7 +695,11 @@ Convex action ──POST /message/async──▶ Bridge AgentSession
692
695
  profile stays, as the other place the language is written. Neither touches
693
696
  the tools or the system prompt, so the shared prefix still reads warm.
694
697
  Measured through the real CLI on Bedrock (Opus 5.5): 24,061 tokens written on
695
- the first request before, 12,135 after, 29,697 read both times. Auto-memory
698
+ the first request before, 12,135 after, 29,697 read both times. The publish
699
+ skill keeps its failure-path guidance (a failed verify, troubleshooting) in
700
+ `references/`, read only when that path is taken, which cuts another ~1.4k
701
+ from every first request (Haiku 5.5: 7,598 written with an empty journal,
702
+ 10,885 with a 9.5kB one). Auto-memory
696
703
  stays: turning it off rewrites the system prompt. The workspace's subagents
697
704
  stay listed: a publish may edit a landing to get verify green, and the
698
705
  scaffold's hooks then tell it to spawn `visual-check`.
@@ -997,6 +1004,8 @@ one, or says it was not measured (no request followed, or one reported no input
997
1004
  usage).
998
1005
  The cache hit rate counts cache writes as input the cache did not supply, and
999
1006
  `turns.md` names the cold turns: any with a request that read nothing from cache.
1007
+ `tools.md` counts a `baker` call under its verb even when it is wrapped in
1008
+ `timeout N`, `env` or `VAR=value`, post-filter included.
1000
1009
 
1001
1010
  Two of the files are easy to underrate:
1002
1011
 
@@ -1587,6 +1587,56 @@ describe("BridgeJobExecutor", () => {
1587
1587
  expect(options.env?.CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD).toBe("1");
1588
1588
  expect(await readFile(join(instructionsDirMock.value, "CLAUDE.md"), "utf8")).toBe(`@${join(workspace, "COMPANY.md")}\n`);
1589
1589
  });
1590
+ // On resume the CLI re-sends, whole, every instruction file that differs from
1591
+ // the copy already in the conversation. The scaffold's CLAUDE.md rides in the
1592
+ // system prompt instead, so a scaffold sync that rewords a paragraph of it
1593
+ // must leave every file the CLI loads as it was.
1594
+ it("re-sends no instruction file when a paragraph of the workspace's CLAUDE.md changes between turns", async () => {
1595
+ const workspace = await mkdtemp(join(tmpdir(), "baker-job-claude-md-edit-"));
1596
+ const claudeMd = (rules) => `# Project Instructions\n\n## Client Context\n\nOne client per repo. Everything known about them:\n\n@COMPANY.md\n\n## Rules\n\n${rules}\n`;
1597
+ await writeFile(join(workspace, "CLAUDE.md"), claudeMd("Stage, don't ask."));
1598
+ await writeFile(join(workspace, "COMPANY.md"), "# Company\n\n## Offer\n\nHeat pumps.\n\n## Tone\n\nWarm.\n");
1599
+ projectRootMock.value = workspace;
1600
+ const loadedFiles = async (options) => {
1601
+ const loaded = new Map();
1602
+ const load = async (file) => {
1603
+ const content = await readFile(file, "utf8");
1604
+ loaded.set(file, content);
1605
+ for (const [, imported] of content.matchAll(/^@(\/\S+)$/gm)) {
1606
+ if (imported && !loaded.has(imported)) {
1607
+ await load(imported);
1608
+ }
1609
+ }
1610
+ };
1611
+ const excluded = options.settings?.claudeMdExcludes ?? [];
1612
+ const rootClaudeMd = join(workspace, "CLAUDE.md");
1613
+ if (!excluded.includes(rootClaudeMd)) {
1614
+ await load(rootClaudeMd);
1615
+ }
1616
+ for (const dir of options.additionalDirectories ?? []) {
1617
+ await load(join(dir, "CLAUDE.md"));
1618
+ }
1619
+ return loaded;
1620
+ };
1621
+ const turn = async (turnId) => {
1622
+ const queryInputs = [];
1623
+ await createExecutor({
1624
+ queryInputs,
1625
+ queryResults: [scriptedMessages(resultMessage(0, "session_claude_md_edit"))],
1626
+ }).execute({ threadId: "thread_claude_md_edit", turnId, prompt: "Build a landing", history: history([]) }, activeControls());
1627
+ const options = queryInputs[0]?.options;
1628
+ if (!options) {
1629
+ throw new Error("the turn ran no query");
1630
+ }
1631
+ return loadedFiles(options);
1632
+ };
1633
+ const before = await turn("turn_claude_md_1");
1634
+ await writeFile(join(workspace, "CLAUDE.md"), claudeMd("Stage every change, and never ask for approval mid-turn."));
1635
+ const after = await turn("turn_claude_md_2");
1636
+ const resent = [...after].filter(([path, content]) => before.get(path) !== content);
1637
+ expect(after.size).toBeGreaterThan(1);
1638
+ expect(resent).toEqual([]);
1639
+ });
1590
1640
  // A task's system prompt is its own, and it replaces the one the shared
1591
1641
  // instructions would ride on: the task keeps loading CLAUDE.md as memory.
1592
1642
  it("leaves a task's workspace instructions in CLAUDE.md, under the task's own system prompt", async () => {