diff --git a/skills/entry.md b/skills/entry.md index 3433f58..f094aa6 100644 --- a/skills/entry.md +++ b/skills/entry.md @@ -37,7 +37,13 @@ task-context: Before routing, ensure the knowledge index is current for the **live** clone. The dispatched review skills read `knowledge-index.json` (at the clone root) at their Source step instead of opening every knowledge file — see READ's [Retrieval workflow](read.md). Because a consumer prunes its clone to policy *before* the agent runs, the index MUST be built over the clone as it exists now, so it lists exactly the articles that survived pruning and never an article the consumer denied: -- If `knowledge-index.json` is absent — or you cannot confirm it reflects the current knowledge tree — regenerate it by running `tools/Build-KnowledgeIndex.ps1`. It walks the knowledge files present in the clone and writes the index at the clone root in well under a second. When in doubt, rebuild: a sub-second rebuild is always cheaper than a stale or over-listing index, which is a correctness risk. +- If `knowledge-index.json` is absent — or you cannot confirm it reflects the current knowledge tree — regenerate it by running, from the checkout root: + + ``` + pwsh ./tools/Build-KnowledgeIndex.ps1 + ``` + + It defaults to indexing this checkout and writes `knowledge-index.json` at the root in well under a second. When in doubt, rebuild: a sub-second rebuild is always cheaper than a stale or over-listing index, which is a correctness risk. - This is a side step. It MUST NOT change Entry's output — the dispatch record below is the only thing Entry emits, and build logs are never part of the dispatch JSON. Generation is **owned by BCQuality**: the generator ships here next to the skills and knowledge it derives from, and the consuming orchestrator neither builds nor knows about the index. diff --git a/tools/Build-KnowledgeIndex.ps1 b/tools/Build-KnowledgeIndex.ps1 index 04b3a68..09758b9 100644 --- a/tools/Build-KnowledgeIndex.ps1 +++ b/tools/Build-KnowledgeIndex.ps1 @@ -33,6 +33,9 @@ .PARAMETER BCQualityRoot Path to the BCQuality content root to index (typically a filtered clone). + Defaults to the clone root (the parent of this script's `tools/` folder), so + the agent can run `pwsh ./tools/Build-KnowledgeIndex.ps1` from the clone root + with no arguments. .PARAMETER IndexPath Where to write the index JSON. Defaults to `/knowledge-index.json`. @@ -56,7 +59,7 @@ #> [CmdletBinding()] param( - [Parameter(Mandatory)][string] $BCQualityRoot, + [string] $BCQualityRoot, [string] $IndexPath, [string[]] $EnabledLayers, [string[]] $KnowledgeAllow = @(), @@ -67,6 +70,12 @@ param( Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' +# Default to the clone root (parent of this script's tools/ folder) so the +# agent's Entry preparation step can invoke this with no arguments from the +# checkout root. A consumer/orchestrator may still pass -BCQualityRoot. +if (-not $BCQualityRoot) { + $BCQualityRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path +} if (-not (Test-Path $BCQualityRoot)) { throw "BCQuality root not found: $BCQualityRoot" }