Skip to content

Build the skills governance suite + the compiled knowledge base (P-SKILL.4/.5, P-SKILLREG.1/.2, P-KB.1/.2/.2b) - #242

Merged
mlcyclops merged 2 commits into
masterfrom
feat/skills-kb-desktop
Jul 6, 2026
Merged

Build the skills governance suite + the compiled knowledge base (P-SKILL.4/.5, P-SKILLREG.1/.2, P-KB.1/.2/.2b)#242
mlcyclops merged 2 commits into
masterfrom
feat/skills-kb-desktop

Conversation

@mlcyclops

Copy link
Copy Markdown
Owner

Seven verified increments across two epics, rebased cleanly on top of the Trivia Wire merge (#241). Every increment is fail-closed + scan-gated; no contracts.ts change (EventNames deferred).

Skills governance

  • P-SKILL.4 (ADR-0097) — the Agent Skill directory + per-skill management (inspect / re-scan / remove), closed-set trust labels, enable/disable. The four existing skill surfaces now share one governed view.
  • P-SKILLREG.1 (ADR-0098) — the enterprise registry reader seam: Ed25519 verify → fail-closed scan-gate → confined install (unsigned / bad-sig / no-keys / poisoned ⇒ blocked, nothing written). Remote server + runbooks stay private add-on IP.
  • P-SKILL.5 (ADR-0101) — Skill Studio: analyze recent work → model-drafted candidates (defensively parsed) → reviewed, gated codify into the directory.
  • P-SKILLREG.2 (ADR-0102) — the publish seam: RegistryPublisher + default LocalRegistryPublisher + a fail-safe PublishDispatcher (mirrors the SIEM Sink); round-trips through the P-SKILLREG.1 reader.

Compiled knowledge base (OpenKB-style)

  • P-KB.1 (ADR-0099) — the compiled-page store + gated compile pipeline (harness/kb, TS+DuckDB, frozen migration 0011): scan source → compile → re-scan every derived page → store. A poisoned source or page is quarantined, never stored.
  • P-KB.2 (ADR-0100) — the hybrid retrieval router (vector | compiled | both, delimited + cited) + the kept-in-sync generator (idempotent, contradiction-flagged, prior page retained).
  • P-KB.2b — the desktop surface: kbStore() + /api/kb/ingest|retrieve|graph routes (backed by backend.complete) + a Compiled KB graph view in the Knowledge panel, reusing mountGraph over kb_links (node click → page body as escaped DATA).

Invariants held

Fail-closed everywhere (dead scanner ⇒ quarantine) · keystone #2 (derived/registry/drafted content never auto-trusted) · untrusted content delimited (#5) · closed trust set (#7) · frozen DuckDB migration (#10) · EventNames deferred, no contracts.ts bytes (#8) · no Python outside scanner-sidecar/ (#2).

Verification

  • Root bun x tsc --noEmit: green.
  • bun test desktop + bun test harness: green modulo the documented fs_browse / lucid_acp Windows path-sep failures (pre-existing, unrelated).
  • Renderer bundles; all 7 make demo-* targets pass (real scanner + real Ed25519 where relevant); BUSL-1.1 headers present.

Notes

  • Rebased onto origin/master (c7bdc8a, the Trivia Wire); my stale local trivia copies were discarded in favor of the merged final versions.
  • The registry/publish remote implementations and the RAG/vector desktop wiring remain follow-ups (seams are in place; retrieve vector/hybrid currently degrade to compiled hits until the vector store is desktop-wired).

Seven verified increments across two epics, each fail-closed + scan-gated.

Skills governance:
- P-SKILL.4 (ADR-0097): the Agent Skill directory + per-skill management
  (inspect / re-scan / remove), closed-set trust labels, enable/disable.
- P-SKILLREG.1 (ADR-0098): the enterprise registry READER seam
  (Ed25519 verify -> fail-closed scan-gate -> confined install).
- P-SKILL.5 (ADR-0101): Skill Studio (analyze recent work -> model-drafted
  candidates -> gated codify).
- P-SKILLREG.2 (ADR-0102): the publish seam (RegistryPublisher +
  LocalRegistryPublisher + fail-safe PublishDispatcher).

Compiled knowledge base:
- P-KB.1 (ADR-0099): the compiled-page store + gated compile pipeline
  (harness/kb, TS+DuckDB, frozen migration 0011).
- P-KB.2 (ADR-0100): the hybrid retrieval router (vector | compiled | both)
  + kept-in-sync + contradiction flag.
- P-KB.2b: the desktop surface (kbStore + /api/kb routes + a Compiled-KB
  graph view reusing mountGraph in the Knowledge panel).

Invariants held: fail-closed everywhere (dead scanner => quarantine),
keystone #2 (derived/registry content never auto-trusted), delimited
untrusted data (#5), closed trust set (#7), frozen DuckDB migration (#10),
no contracts.ts change (EventNames deferred, inv #8), no Python outside
scanner-sidecar (#2).

Verified: root tsc green; bun test desktop + harness green (modulo the
documented fs_browse / lucid_acp Windows path-sep fails); renderer bundles;
demo-P-SKILL.4/.5, demo-P-SKILLREG.1/.2, demo-P-KB.1/.2/.2b all pass;
BUSL-1.1 headers present.
Comment thread desktop/skill_studio.ts Outdated
…caping or encoding'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@mlcyclops
mlcyclops merged commit f74bc93 into master Jul 6, 2026
4 checks passed
@mlcyclops
mlcyclops deleted the feat/skills-kb-desktop branch July 6, 2026 06:12
mlcyclops added a commit that referenced this pull request Jul 6, 2026
…d .md + three robustness layers (ADR-0177), release v1.10.3 (#246)

Root cause (reproduced on the shipped artifact): extraResources stripped ALL
node_modules/**/*.md; #242 made dev.ts import @oh-my-pi/pi-coding-agent in-process,
which imports its prompt .md files at module load - the packaged engine died at
import and never bound port 5319.

- packaging: drop the !node_modules/**/*.md exclusion (READMEs are cheaper than bricks)
- skills_data: the omp import is type-only + LAZY inside fail-soft discoverRaw - an
  unloadable optional dep degrades the Skills directory, never kills the engine
  (verified with the bad filter deliberately restored)
- main.ts: engine stdout/stderr teed to <userData>/engine.log; the failure dialog
  points at the log instead of asking for a terminal relaunch
- packaged_boot.test.ts: CI guard that emulates the LIVE packaging exclusions with a
  Bun resolver plugin and boots the real dev.ts - red in <1s on the v1.10.2 state,
  green on the fix, so this brick class can never ship again
- version bump to 1.10.3 (version.ts + package.json + about.test.ts in lockstep)

Co-authored-by: mlcyclops <mlcyclops@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
mlcyclops added a commit that referenced this pull request Jul 8, 2026
…-0186-0190) (#258)

* Port P-TRIV.4/P-EVAL.1/P-CHAT.A-C pure cores onto master (ADR-0186-0190)

Re-integration of the genuinely-new work from the stale feat/skills-kb-desktop
branch, which forked before the skills/KB suite + Trivia Wire fixes merged to
master (v1.10.2-v1.10.5). The branch's skills/KB commit was a duplicate of
already-shipped PR #242 and is dropped; only these five pure cores are new:

- P-TRIV.4 (ADR-0186): trivia_seed.ts - AI re-seed for the Trivia Wire.
- P-EVAL.1 (ADR-0187): evals.ts - model-eval metrics + latency rollup core.
- P-CHAT.A (ADR-0188): answer_sections.ts - settled-turn section splitter.
- P-CHAT.B (ADR-0189): answer_chips.ts - inline tool-event chip interleave.
- P-CHAT.C (ADR-0190): eval_report.ts - observed-turn -> RunRecord adapter.

ADRs renumbered 0177-0181 -> 0186-0190 to clear the collision with master's
released 0177-0185. Cores + tests (37) + demos (5) + typecheck all green on
the master base. The app.ts/dev.ts/bridge.ts/styles.css wiring + DECISIONS.md/
PROGRESS.md are the next milestone (must re-apply against master's current chat
renderer + reconcile P-CHAT.A's collapsed subagent card with master's P-TASK.5).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Wire P-CHAT.A (ADR-0188): settled-turn collapsible sections

Re-apply the sectionize wiring against master's current renderer:
- import answer_sections + appendIntro/appendSection + section-only
  renderAnswerBody in app.ts
- hook the 3 settle points: renderMessage (assistant only), the `done`
  event, and the `finally` block
- .answer-sec CSS in styles.css

Subagent-card reconciliation: NO change. Master's P-TASK.5 already
collapses the delegation card on finish (toggle(false)) while keeping it
open during the run so live subagent activity stays visible - starting it
collapsed (old P-CHAT.A) would regress P-TASK.5, so master's behavior wins.

Desktop typecheck + demo-P-CHAT.A + 6 unit tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Wire P-CHAT.B (ADR-0189): inline tool-event chips

Extend the settle transform against master's current streaming closure:
- import answer_chips; add ChipData type + renderProse + createChipRow
- renderAnswerBody gains the marks-aware chip branch (returns whether it
  chipped; a no-tool turn still sectionizes via P-CHAT.A)
- the streaming closure records a mark per tool call (anchored at the
  answer-buffer length) inside master's existing `tool` handler; on settle
  the chips carry the activity and the redundant live thoughts window is
  dropped
- .answer-chip/.tchip/.tinline CSS

Desktop typecheck + demo-P-CHAT.B + 15 unit tests green. Chip/drilldown
styling + collapse verified in the browser preview.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Wire P-CHAT.C (ADR-0190): settled-turn "Generate engineering report"

Complete the settle transform with the run-footer CTA + server route:
- bridge.ts: EvalReportTurn / EvalReportResult types + evalReport() ->
  POST /api/eval/report
- app.ts: appendRunReport (the run footer + CTA that swaps to an "Open in
  Reports" link), buildEvalTurn (maps the turn's marks/tokens/failures to
  the observed-telemetry shape), maybeAppendReport at both settle points;
  the block handler now records non-quarantined tool failures for the
  fail-rate metric
- dev.ts: the /api/eval/report route - defensively coerces the payload,
  maps it to evals.ts's RunRecord via renderTurnEvalReport, saves a brief
  (kind=brief, role=evals) so it lists in Reports
- .runfoot/.report-cta/.reportlink CSS

Verified END-TO-END in the browser preview: POST returns a saved brief,
it lists in /api/reports, reads back via the Open-in-Reports path, and the
Model-Evaluation markdown metrics compute correctly (200 tok/net-line).
Full typecheck (all 3 tsconfigs) + demo-P-CHAT.C + eval tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Wire P-TRIV.4 (ADR-0186): Trivia Wire Settings card + AI re-seed

Re-apply the Recycle feature against master's current trivia code:
- bridge.ts: TriviaSeedSources / TriviaSeedView + triviaReseed() ->
  POST /api/trivia/reseed
- dev.ts: the /api/trivia/reseed route - gathers the opt-in on-device
  sources (session titles / KG facts+nodes / code-graph names) and hands
  them to seedTrivia, which scans fail-closed and generates on the user's
  selected model (tool-free); fail-quiet
- app.ts: secTrivia() Settings card (toggle + 3 opt-in source checkboxes +
  Recycle + status), reseedTrivia(), the per-role pack persistence layer
  (storedTriviaPack/effectiveTriviaBank/apply/clear), and the settings
  click handlers. Both game builders (refreshTriviaGame, ensureTrivia) now
  route through effectiveTriviaBank = generated pack ?? seed bank (the
  permanent fail-closed floor)
- styles.css: the card + tightened mini source checkboxes (3px 8px padding,
  14px boxes, txt-2 12.5px labels - tight + readable)

Full typecheck (all 3 tsconfigs) + demo-P-TRIV.4 + 9 unit tests green.
Settings card + the 3 source rows + mini-checkbox styling verified live in
the browser preview.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Docs: ADR-0186-0190 entries + PROGRESS for the re-integration

- DECISIONS.md: append the five ADRs (renumbered 0177-0181 -> 0186-0190)
  with a re-integration banner; correct the P-CHAT.A record - no
  subagent-card collapse (master's P-TASK.5 already handles it); update the
  P-CHAT status lines to WIRED (C's server route verified end-to-end)
- PROGRESS.md: the shipped/stubbed/next entry for the re-integration

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Default the Trivia Wire OFF (opt-in easter egg)

triviaEnabled() now returns true only when the key is explicitly "1" -
an unset key (fresh install / most users) is OFF. It stays a thing people
discover and switch on in Settings -> Trivia Wire, rather than showing to
everyone by default. All writers already use explicit "1"/"0", so the
right-click hide + undo + Settings toggle are unaffected.

Verified in preview: fresh origin -> wire not mounted, toggle unchecked;
flipping the toggle writes "1" and mounts the wire.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: mlcyclops <mlcyclops@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants