From 0fa1f6df8b48f52ab5cd57ae89cbcbd662cb3669 Mon Sep 17 00:00:00 2001 From: Will Washburn Date: Thu, 20 Aug 2026 11:24:05 -0400 Subject: [PATCH] fix(cli): digest only the compiled persona in a nested agent dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A missing file digests to nulls, so `/persona.json` alone witnesses both the compile that first writes it and later edits. Digesting the agent subdirectory alongside it invalidated the cached launch plan whenever any sibling changed — the handler, the README, or the `agent-card.json` written by the same compile — rebuilding a plan whose persona was untouched. Also corrects the `sources add --position` wording, which still described a single fixed cwd source. Co-Authored-By: Claude Opus 5 (1M context) --- packages/cli/README.md | 6 +++--- packages/cli/src/cli-impl.ts | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index 87ed4e0e..ff6415d1 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -406,13 +406,13 @@ the override without editing JSON by hand. `sources add` appends by default. `--position ` inserts at the 1-based position among configurable directories, so `--position 1` gives that directory -the highest priority after the fixed cwd source. `sources remove` accepts either -that configurable position or an exact path. +the highest priority after the fixed `cwd` and `cwd:agents` sources. `sources +remove` accepts either that configurable position or an exact path. Examples: ```sh -# Show the full source cascade, including fixed cwd and library entries +# Show the full source cascade, including fixed cwd/cwd:agents and library entries agentworkforce sources list # Install personas from another checkout, below the default user persona dir diff --git a/packages/cli/src/cli-impl.ts b/packages/cli/src/cli-impl.ts index 9dfa5014..1d03cb3e 100644 --- a/packages/cli/src/cli-impl.ts +++ b/packages/cli/src/cli-impl.ts @@ -1757,10 +1757,11 @@ function buildFastLaunchPlan(input: { // dirs, so every persona JSON in every layer is a resolution input. for (const name of entries) { if (dir.nested) { - // One persona per subdirectory. The subdirectory's own mtime witnesses - // the compile that first creates persona.json, which the parent dir's - // stat does not see. - digests.push(statDigestOf(join(dir.dir, name))); + // One persona per subdirectory. A missing file digests to nulls, so + // this one entry witnesses both the compile that first writes + // persona.json and later edits to it. Digesting the subdirectory too + // would invalidate the plan every time an unrelated sibling — the + // handler, the README, agent-card.json — is added or rewritten. digests.push(statDigestOf(join(dir.dir, name, NESTED_PERSONA_FILENAME))); } else if (name.endsWith('.json')) { digests.push(statDigestOf(join(dir.dir, name)));