Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .lokf/m365/ktl-docent-m365.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This is the Microsoft 365 Copilot build of the ktl-docent skill from [knowledge-
4. **Weigh what you found.** Derive each concept's trust label from its frontmatter (table below). Prefer *confirmed by a person*; treat *edited since a person last confirmed it* as unconfirmed, because the person confirmed an earlier text; use drafts and unchecked concepts, but say so; treat *retired* as history, not fact; treat *past its review date* as possibly stale.
5. **Say what you could not check.** Versions, endpoints, numbers and paths are summaries in the bundle; the concept's `resource` is authoritative, and this skill cannot open it. Where a `sources` entry carries an `excerpt`, give it as the passage the bundle quotes from that resource: it is the only part of the source the snapshot holds. State the value as the bundle gives it, say it was not checked at the source, and give the reader the source as a link (see [Source links](#source-links)). Give the link also when the question is about the present and the only concept is *nobody has checked this yet* or *edited since a person last confirmed it*. If the agent has another tool that can open that link, use it and say that you did.
6. **Answer with a footing.** Give the answer, then what it rests on: each concept (title, path) with its label, and the snapshot. Use plain words: the label names below, never RDF/IRI/tier.
7. **Stop at the edge of the bundle.** When no concept is relevant, or the only one is retired or stale and the question hinges on being current, say the bundle does not cover it. A retired concept's newest `**Deprecation**` line in `log.md` may link the concept that replaced it after "replaced by": answer from that concept first. Do not fill the gap from general knowledge as if it came from the repository. An answer from another knowledge source the agent has is fine when you name that source.
7. **Stop at the edge of the bundle.** When no concept is relevant, or the only one is retired or stale and the question hinges on being current, say the bundle does not cover it. A retired concept's `isReplacedBy` may name the concept that replaced it: answer from that concept first. Do not fill the gap from general knowledge as if it came from the repository. An answer from another knowledge source the agent has is fine when you name that source.
8. **Hand the gap back.** For a miss or a disagreement, end the answer with one entry the reader can paste into the repository's feedback (see [Reporting a gap](#reporting-a-gap)). Never claim the gap was recorded.

## Trust labels (the same words ktl-curator uses)
Expand All @@ -45,7 +45,7 @@ This is the Microsoft 365 Copilot build of the ktl-docent skill from [knowledge-

A bare `verified: { by, at }` counts as one event. Absent `status` means stable. Give each concept's labels on one line, in the order and form below. The repository's report script prints them the same way, so a reader sees the same words in Copilot and in the repository.

- Label a *retired* concept *retired*, and give it no other label. Add *replaced by* and the path of the concept that replaced it: the first that its `isReplacedBy` names, or else the one its newest `**Deprecation**` line in `log.md` links.
- Label a *retired* concept *retired*, and give it no other label. Add *replaced by* and the path of the concept that replaced it: the first that its `isReplacedBy` names.
- Otherwise, start with the first of *edited since a person last confirmed it*, *confirmed by a person*, *checked by automation only* and *nobody has checked this yet* that applies. Add *still a draft*, then *past its review date*, where they apply.
- After *confirmed by a person*, give the date of the latest `human:` event. When that event carries a `revision`, add "against" and the revision: a commit hash cut to its first seven characters, a `sha256:` digest cut to the seven after `sha256:`, or an ETag as written.
- *Edited since a person last confirmed it* takes the place of *confirmed by a person*, because the person confirmed an earlier text. Give both dates, as in "(confirmed 2026-09-01, edited 2026-09-20)", or both full times when they fall on one day. Compare `generated.at` with the latest `human:` `verified[].at` whole, as strings, never cut to the day: an edit at 14:00 follows a confirmation at 10:00 the same day. Use the v0.1 `timestamp` where `generated.at` is missing. A concept with neither cannot carry this label.
Expand Down
2 changes: 1 addition & 1 deletion .lokf/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description = "LOKF knowledge-bundle tooling for SLSA."
# Keep in sync with the `lokf` toolkit's own requires-python floor.
requires-python = ">=3.11"
dependencies = [
"ktl==0.69.2",
"ktl==0.70.1",
"lokf[build]>=0.9.0",
"rust-just==1.59.0",
]
Expand Down
25 changes: 3 additions & 22 deletions .lokf/scripts/knowledge-report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@
# concept waits in .lokf/feedback.md
# retired `status: deprecated`; no other label applies,
# and it names the concept that replaced it
# when its isReplacedBy names one, or else
# the newest **Deprecation** line in log.md
# links one
# when its isReplacedBy names one
#
# The whole report also prints the queue of ktl-curator, Worth ten minutes
# today, and what ranks it: review dates due within 30 days, confirmed
Expand Down Expand Up @@ -1176,12 +1174,8 @@ function resolve(v, from, d, r) {

# The concept that replaced a retired one, as S<TAB>retired<TAB>successor.
# Its isReplacedBy decides: the first target, in the field or in `relations`,
# that names a concept of the bundle. ktl-curator writes it on Retire. Where
# it names none, the link after "replaced by" in the newest **Deprecation**
# line of log.md that links the retired concept, in the `../` form that
# ktl-curator and the KTL Curator plugin write; a retirement recorded before
# the slot has only that line. A line with no such link names no successor.
# The first S line for a concept is the one read.
# that names a concept of the bundle. ktl-curator writes it on Retire. A
# **Deprecation** line in log.md is history and names no successor.
successors() {
printf '%s\n' "$all" | awk -F'\t' -v base="$(bundle_base)" "$resolve_fn"'
$1 == "C" { nc++; order[nc] = $2; st[$2] = $4 }
Expand All @@ -1195,19 +1189,6 @@ successors() {
named[p] = 1; print "S\t" p "\t" t
}
}'
[ -f "$bundle/log.md" ] || return 0
awk '
function target(s, a, b) {
a = index(s, "]("); if (!a) return ""; s = substr(s, a + 2); b = index(s, ")"); if (!b) return ""
rest = substr(s, b + 1); s = substr(s, 1, b - 1); sub(/^\.\.\//, "", s); sub(/^\.\//, "", s); return s
}
/^[*-] \*\*Deprecation\*\*: \[/ {
old = target($0); if (old == "" || (old in seen)) next
seen[old] = 1 # the newest line for this concept decides, whether or not it names a successor
c = index(rest, "replaced by ["); if (!c) next
new = target(substr(rest, c)); if (new == "") next
print "S\t" old "\t" new
}' "$bundle/log.md"
}

# Each Disagreement of a reader that names a concept and still waits, as
Expand Down
45 changes: 37 additions & 8 deletions .lokf/scripts/knowledge-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
# every workflow change into --held for a person to apply
# --held <file> where --apply writes the held workflow changes
#
# KNOWLEDGE_SYNC_INDEX_WAIT, a number of seconds, keeps asking the index for
# a release it does not show yet, for a sync asked right after the release:
# a mirror trails PyPI by a minute or so. Unset or 0, a missing release is
# final.
#
# Exit 0 when the host is synced or already was. Exit 1 when the host was
# skipped (no .lokf/, no git, no ktl pin, uncommitted changes, the branch
# exists) or a check failed. Exit 2 when the arguments or the release are
Expand Down Expand Up @@ -76,6 +81,28 @@ usage() {
exit 2
}
die() { echo "knowledge-sync: $*" >&2; exit 2; }
# The sync writes plain files alone, never through a link: <path>.
plain_file() { [[ ! -L "$1" ]] || die "$1 is a link, and the sync writes plain files alone"; }

# Lock the pin from the index: <project folder> [uv args...]. uv's words are
# the output when it fails. For KNOWLEDGE_SYNC_INDEX_WAIT seconds, a release
# the index does not show yet is asked for again, as the header says.
lock_pin() {
local dir="$1" waited=0 wait="${KNOWLEDGE_SYNC_INDEX_WAIT:-0}" said step
shift
[[ "$wait" =~ ^[0-9]+$ ]] || { echo "KNOWLEDGE_SYNC_INDEX_WAIT is '$wait', not a number of seconds"; return 2; }
while :; do
if said="$(cd "$dir" && uv lock --quiet --refresh-package ktl "$@" 2>&1)"; then return 0; fi
if (( waited < wait )) && printf '%s' "$said" | grep -qF "no version of ktl=="; then
step=$(( wait - waited < 30 ? wait - waited : 30 ))
echo " waiting the index does not show the release yet; asking again in $step s" >&2
sleep "$step"; waited=$(( waited + step ))
continue
fi
printf '%s\n' "$said"
return 1
done
}

# The run's temporary folder, and the undo for a stop between moving the
# pin and reading the release: the pin's two files, and in branch mode the
Expand Down Expand Up @@ -203,13 +230,11 @@ apply_patch() {
git reset --quiet --hard
die "uv is not installed, and the lock the patch brings is checked with it"
fi
err="$(mktemp)"
if git cat-file -e "HEAD:$lock" 2>/dev/null; then git show "HEAD:$lock" > "$lock"; else rm -f "$lock"; fi
if ! (cd .lokf && uv lock --quiet --refresh-package ktl) 2>"$err"; then
if ! err="$(lock_pin .lokf)"; then
git reset --quiet --hard
die "uv could not lock the patch's pin ($(tr '\n' ' ' < "$err" | cut -c1-300))"
die "uv could not lock the patch's pin ($(printf '%s' "$err" | tr '\n' ' ' | cut -c1-300))"
fi
rm -f "$err"
if ! git diff --quiet -- "$lock"; then
git reset --quiet --hard
die "the patch's $lock differs from the one uv resolves from the index for its pin, so it was not taken"
Expand Down Expand Up @@ -332,8 +357,8 @@ main() {
echo " no default branch to start from (origin/HEAD, main or master); skipped" >&2
return 1
fi
if git -C "$host" rev-parse -q --verify "refs/heads/$branch" >/dev/null; then
echo " $branch already exists in $host: finish it, or delete it, first; skipped" >&2
if git -C "$host" rev-parse -q --verify "refs/heads/$branch" >/dev/null || git -C "$host" rev-parse -q --verify "refs/remotes/origin/$branch" >/dev/null; then
echo " $branch already exists in $host, or on its origin: finish it, or delete it, first; skipped" >&2
return 1
fi
previous="$(git -C "$host" symbolic-ref --quiet --short HEAD 2>/dev/null || git -C "$host" rev-parse HEAD)"
Expand Down Expand Up @@ -390,7 +415,7 @@ main() {
rm -f "$host/$pyproject.sync-bak"
fi
echo " locking ktl==$version"
if ! said="$(cd "$host/.lokf" && uv lock --quiet --refresh-package ktl ${from[@]+"${from[@]}"} 2>&1)"; then
if ! said="$(lock_pin "$host/.lokf" ${from[@]+"${from[@]}"})"; then
if printf '%s' "$said" | grep -qF "no version of ktl=="; then
die "no release $tag of ktl on the index: publish the release first, then sync (that order is the point)"
elif printf '%s' "$said" | grep -qF "ktl was not found"; then
Expand Down Expand Up @@ -497,6 +522,7 @@ main() {
continue
fi
mkdir -p "$(dirname "$host/$dst")"
plain_file "$host/$dst"
tpl "$src" > "$host/$dst"
[[ ! -x "$new_t/$src" ]] || chmod +x "$host/$dst"
added+=("$dst ($why)")
Expand Down Expand Up @@ -525,6 +551,7 @@ main() {
else
copied+=("$dst")
fi
plain_file "$host/$dst"
cat "$want" > "$host/$dst"
rm -f "$was"
fi
Expand All @@ -549,6 +576,7 @@ main() {
dst="$site/$rel"; [[ "$rel" == gitignore ]] && dst="$site/.gitignore"
if [[ ! -f "$host/$dst" ]]; then
mkdir -p "$(dirname "$host/$dst")"
plain_file "$host/$dst"
cat "$new_w/website/$rel" > "$host/$dst"
[[ ! -x "$new_w/website/$rel" ]] || chmod +x "$host/$dst"
added+=("$dst (the site cannot build without it)")
Expand All @@ -560,6 +588,7 @@ main() {
else
copied+=("$dst")
fi
plain_file "$host/$dst"
cat "$new_w/website/$rel" > "$host/$dst"
[[ ! -x "$new_w/website/$rel" ]] || chmod +x "$host/$dst"
fi
Expand Down Expand Up @@ -696,7 +725,7 @@ main() {
(
rc=0
cd "$host/.lokf"
if [[ -x scripts/knowledge-preflight.sh ]]; then
if [[ -f scripts/knowledge-preflight.sh ]]; then
echo "preflight: $(bash scripts/knowledge-preflight.sh | tail -1)"
fi
if command -v uv >/dev/null 2>&1; then
Expand Down
8 changes: 4 additions & 4 deletions .lokf/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The `v0.1.0` tag is a baseline, not a release: it marks where versioning starts

## [Unreleased]

### Security

- **The sidecar copies and the skills pin are at Knowledge Trust Ladder [v0.70.1](https://github.com/noelmcloughlin/knowledge-trust-ladder/compare/v0.69.2...v0.70.1).** The release changed `.github/workflows/knowledge-release.yaml`, `.github/workflows/knowledge-sync.yaml`, `.lokf/scripts/knowledge-report.sh`, `.lokf/scripts/knowledge-sync.sh` and `.lokf/m365/ktl-docent-m365.md` here.

## [0.11.4] - 2026-11-19

### Security
Expand Down
Loading