Make runtime index build non-interactive and self-contained

entry.md now gives the exact build command (pwsh ./tools/Build-KnowledgeIndex.ps1)
so the agent's preparation step is unambiguous, and the generator's -BCQualityRoot
parameter is optional (defaults to the clone root) so it runs in non-interactive
-p mode without prompting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Jesper Schulz-Wedde 2026-06-04 14:43:47 +02:00
parent 5c4bb480c9
commit eb462ee1f9
2 changed files with 17 additions and 2 deletions

View file

@ -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.

View file

@ -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 `<BCQualityRoot>/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"
}