@hraness/kb 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +197 -113
  2. package/dist/authoring.js +2 -2
  3. package/dist/benchmark.js +3 -3
  4. package/dist/cli.js +16 -12
  5. package/dist/evaluation-builder.js +5 -5
  6. package/dist/evaluation-kb.js +5 -5
  7. package/dist/graph.js +3 -1
  8. package/dist/{index-zxdy5pby.js → index-5m2ydj5q.js} +2 -2
  9. package/dist/{index-cxfrakt7.js → index-ekpwvbra.js} +5 -2
  10. package/dist/{index-jsmvyyvf.js → index-ey46z1zf.js} +4 -4
  11. package/dist/{index-cv6fh7z5.js → index-gm9t95d9.js} +1 -1
  12. package/dist/{index-01jj6rbv.js → index-gxr0fctd.js} +3 -3
  13. package/dist/index-nd6nynv2.js +1162 -0
  14. package/dist/{index-s2gw5aw9.js → index-qwgsmtsz.js} +1 -1
  15. package/dist/{index-zzhgcwyt.js → index-vxmf14m1.js} +3 -3
  16. package/dist/{index-n5dd7r0v.js → index-xw9ac71d.js} +2 -2
  17. package/dist/{index-1vrd1rmn.js → index-ykvvkd77.js} +1 -1
  18. package/dist/index.js +30 -8
  19. package/dist/percolate.js +22 -2
  20. package/dist/portfolio.js +5 -5
  21. package/dist/sdk.js +4 -4
  22. package/dist/search.js +2 -2
  23. package/dist/semantic.js +3 -3
  24. package/dist/workflows/decision-context.js +5 -5
  25. package/dist/workflows/index.js +5 -5
  26. package/package.json +1 -1
  27. package/skills/kb/AGENTS.md +3 -0
  28. package/skills/kb/SKILL.md +38 -29
  29. package/skills/kb/agents/openai.yaml +2 -2
  30. package/skills/kb/references/companion-skills.md +96 -0
  31. package/skills/kb/references/customize.md +123 -0
  32. package/skills/kb/references/percolate.md +39 -7
  33. package/skills/kb/references/query.md +21 -0
  34. package/skills/kb/templates/companion-skill.template.md +57 -0
  35. package/src/authoring.ts +5 -3
  36. package/src/cli.ts +12 -7
  37. package/src/graph.ts +8 -1
  38. package/src/percolate.ts +1088 -17
  39. package/dist/index-dyqwejk5.js +0 -531
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  fuseRankedCandidates
4
- } from "./index-cv6fh7z5.js";
4
+ } from "./index-gm9t95d9.js";
5
5
 
6
6
  // src/benchmark.ts
7
7
  var MAX_BENCHMARK_CASES = 500;
@@ -8,7 +8,7 @@ import {
8
8
  openSemanticSearchSession,
9
9
  recommendedEmbeddingModel,
10
10
  scanVault
11
- } from "./index-zxdy5pby.js";
11
+ } from "./index-5m2ydj5q.js";
12
12
  import {
13
13
  UntrustedContentBudgetError,
14
14
  createUntrustedToolResult
@@ -27,7 +27,7 @@ import {
27
27
  fuseRankedCandidates,
28
28
  searchExactVault,
29
29
  validateSearchQuery
30
- } from "./index-cv6fh7z5.js";
30
+ } from "./index-gm9t95d9.js";
31
31
  import {
32
32
  NavigationBudgetError,
33
33
  navigateLinks
@@ -37,7 +37,7 @@ import {
37
37
  } from "./index-48pz4jpc.js";
38
38
  import {
39
39
  lookupNote
40
- } from "./index-cxfrakt7.js";
40
+ } from "./index-ekpwvbra.js";
41
41
 
42
42
  // src/sdk.ts
43
43
  import { resolve } from "path";
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  MAX_SEARCH_RESULTS,
4
4
  openKnowledgeBase
5
- } from "./index-zzhgcwyt.js";
5
+ } from "./index-vxmf14m1.js";
6
6
  import {
7
7
  scanVault
8
- } from "./index-zxdy5pby.js";
8
+ } from "./index-5m2ydj5q.js";
9
9
  import {
10
10
  runGitCommand
11
11
  } from "./index-1gwbassd.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-3v2z4f0q.js";
5
5
  import {
6
6
  packUntrustedSearchContext
7
- } from "./index-zzhgcwyt.js";
7
+ } from "./index-vxmf14m1.js";
8
8
 
9
9
  // src/workflows/decision-context.ts
10
10
  var decisionContextWorkflow = defineWorkflow({
package/dist/index.js CHANGED
@@ -29,15 +29,25 @@ import {
29
29
  MAX_PERCOLATION_MENTIONS,
30
30
  MAX_PERCOLATION_MENTION_PAIRS,
31
31
  MAX_PERCOLATION_NOTES,
32
+ MAX_PERCOLATION_RESULT_NODES,
33
+ MAX_PERCOLATION_RESULT_UTF8_BYTES,
34
+ MAX_PERCOLATION_TEXT_UTF8_BYTES,
32
35
  MAX_SCOPED_PERCOLATION_MENTION_PAIRS,
36
+ PERCOLATION_RESULT_SCHEMA_VERSION,
37
+ parsePercolationCliOutput,
38
+ parsePercolationCliOutputV1,
39
+ parsePercolationCliOutputV2,
40
+ parsePercolationResult,
41
+ parsePercolationResultV1,
42
+ parsePercolationResultV2,
33
43
  percolateVault
34
- } from "./index-dyqwejk5.js";
44
+ } from "./index-nd6nynv2.js";
35
45
  import {
36
46
  FrozenEvaluationSnapshotError,
37
47
  knowledgeBaseEvaluationRetrieverIds,
38
48
  openKnowledgeBaseEvaluation,
39
49
  verifyFrozenEvaluationSnapshot
40
- } from "./index-n5dd7r0v.js";
50
+ } from "./index-xw9ac71d.js";
41
51
  import {
42
52
  DEFAULT_SEARCH_RESULTS,
43
53
  MAX_SEARCH_CANDIDATES,
@@ -49,7 +59,7 @@ import {
49
59
  packSearchContext,
50
60
  packUntrustedSearchContext,
51
61
  validateKnowledgeBaseSearchHistory
52
- } from "./index-zzhgcwyt.js";
62
+ } from "./index-vxmf14m1.js";
53
63
  import"./index-adx6khj5.js";
54
64
  import {
55
65
  MAX_EMBEDDING_MODEL_BYTES,
@@ -75,7 +85,7 @@ import {
75
85
  searchSemanticVault,
76
86
  semanticDatabasePath,
77
87
  sha256EmbeddingModelFile
78
- } from "./index-zxdy5pby.js";
88
+ } from "./index-5m2ydj5q.js";
79
89
  import"./index-4j3tt0c3.js";
80
90
  import {
81
91
  GitHistoryError,
@@ -144,14 +154,14 @@ import {
144
154
  normalizeRelationPredicate,
145
155
  noteRevision,
146
156
  removeNoteRelation
147
- } from "./index-01jj6rbv.js";
157
+ } from "./index-gxr0fctd.js";
148
158
  import"./index-3rm7cz6h.js";
149
159
  import {
150
160
  createRepresentativeRetrievalFixture,
151
161
  createSyntheticRankFusionFixture,
152
162
  evaluateRanking,
153
163
  evaluateRetrievalBenchmark
154
- } from "./index-s2gw5aw9.js";
164
+ } from "./index-qwgsmtsz.js";
155
165
  import {
156
166
  MAX_SEARCH_QUERY_BYTES,
157
167
  MAX_SEARCH_QUERY_TERMS,
@@ -159,7 +169,7 @@ import {
159
169
  fuseRankedCandidates,
160
170
  searchExactVault,
161
171
  validateSearchQuery
162
- } from "./index-cv6fh7z5.js";
172
+ } from "./index-gm9t95d9.js";
163
173
  import {
164
174
  MAX_NAVIGATION_INDEXED_CONNECTIONS,
165
175
  MAX_NAVIGATION_RETURNED_CONNECTIONS,
@@ -235,6 +245,7 @@ import {
235
245
  catalogEnd,
236
246
  catalogStart,
237
247
  isCanonicalNoteId,
248
+ isCanonicalRelationPredicate,
238
249
  lookupNote,
239
250
  metadataValueFromUnknown,
240
251
  normalizeVaultPath,
@@ -243,7 +254,7 @@ import {
243
254
  replaceCatalog,
244
255
  searchableMarkdown,
245
256
  wikiLinks
246
- } from "./index-cxfrakt7.js";
257
+ } from "./index-ekpwvbra.js";
247
258
  import"./index-1xxnjn0d.js";
248
259
  // src/oh-adoption.ts
249
260
  import { createHash } from "crypto";
@@ -593,6 +604,12 @@ export {
593
604
  planStatuses,
594
605
  percolateVault,
595
606
  parseRetrievalEvaluationCorpus,
607
+ parsePercolationResultV2,
608
+ parsePercolationResultV1,
609
+ parsePercolationResult,
610
+ parsePercolationCliOutputV2,
611
+ parsePercolationCliOutputV1,
612
+ parsePercolationCliOutput,
596
613
  parseNote,
597
614
  parseLocalAttachmentReferences,
598
615
  parseGitHistoryOutput,
@@ -618,6 +635,7 @@ export {
618
635
  knowledgeBaseEvaluationRetrieverIds,
619
636
  isTerminalPlanStatus,
620
637
  isPlanStatus,
638
+ isCanonicalRelationPredicate,
621
639
  isCanonicalNoteId,
622
640
  isActivePlanStatus,
623
641
  inspectRepositoryScopeState,
@@ -677,6 +695,7 @@ export {
677
695
  RepositoryScopeError,
678
696
  RETRIEVAL_EVALUATION_SCHEMA_VERSION,
679
697
  RETRIEVAL_EVALUATION_REPORT_VERSION,
698
+ PERCOLATION_RESULT_SCHEMA_VERSION,
680
699
  NoteRevisionConflictError,
681
700
  NoteRecoveryRequiredError,
682
701
  NoteAlreadyExistsError,
@@ -714,6 +733,9 @@ export {
714
733
  MAX_QUERY_METADATA_PATH_SEGMENTS,
715
734
  MAX_QUERY_FILTER_VALUES,
716
735
  MAX_QUERY_FILTERS,
736
+ MAX_PERCOLATION_TEXT_UTF8_BYTES,
737
+ MAX_PERCOLATION_RESULT_UTF8_BYTES,
738
+ MAX_PERCOLATION_RESULT_NODES,
717
739
  MAX_PERCOLATION_NOTES,
718
740
  MAX_PERCOLATION_MENTION_PAIRS,
719
741
  MAX_PERCOLATION_MENTIONS,
package/dist/percolate.js CHANGED
@@ -7,13 +7,33 @@ import {
7
7
  MAX_PERCOLATION_MENTIONS,
8
8
  MAX_PERCOLATION_MENTION_PAIRS,
9
9
  MAX_PERCOLATION_NOTES,
10
+ MAX_PERCOLATION_RESULT_NODES,
11
+ MAX_PERCOLATION_RESULT_UTF8_BYTES,
12
+ MAX_PERCOLATION_TEXT_UTF8_BYTES,
10
13
  MAX_SCOPED_PERCOLATION_MENTION_PAIRS,
14
+ PERCOLATION_RESULT_SCHEMA_VERSION,
15
+ parsePercolationCliOutput,
16
+ parsePercolationCliOutputV1,
17
+ parsePercolationCliOutputV2,
18
+ parsePercolationResult,
19
+ parsePercolationResultV1,
20
+ parsePercolationResultV2,
11
21
  percolateVault
12
- } from "./index-dyqwejk5.js";
13
- import"./index-cxfrakt7.js";
22
+ } from "./index-nd6nynv2.js";
23
+ import"./index-ekpwvbra.js";
14
24
  export {
15
25
  percolateVault,
26
+ parsePercolationResultV2,
27
+ parsePercolationResultV1,
28
+ parsePercolationResult,
29
+ parsePercolationCliOutputV2,
30
+ parsePercolationCliOutputV1,
31
+ parsePercolationCliOutput,
32
+ PERCOLATION_RESULT_SCHEMA_VERSION,
16
33
  MAX_SCOPED_PERCOLATION_MENTION_PAIRS,
34
+ MAX_PERCOLATION_TEXT_UTF8_BYTES,
35
+ MAX_PERCOLATION_RESULT_UTF8_BYTES,
36
+ MAX_PERCOLATION_RESULT_NODES,
17
37
  MAX_PERCOLATION_NOTES,
18
38
  MAX_PERCOLATION_MENTION_PAIRS,
19
39
  MAX_PERCOLATION_MENTIONS,
package/dist/portfolio.js CHANGED
@@ -20,14 +20,14 @@ import {
20
20
  selectAuthorizedVaults,
21
21
  snapshotPortfolioRegistry,
22
22
  validateResolvedPortfolioVaults
23
- } from "./index-jsmvyyvf.js";
24
- import"./index-zzhgcwyt.js";
23
+ } from "./index-ey46z1zf.js";
24
+ import"./index-vxmf14m1.js";
25
25
  import"./index-adx6khj5.js";
26
- import"./index-zxdy5pby.js";
26
+ import"./index-5m2ydj5q.js";
27
27
  import"./index-4j3tt0c3.js";
28
28
  import"./index-1gwbassd.js";
29
29
  import"./index-x3fthpsc.js";
30
- import"./index-cv6fh7z5.js";
30
+ import"./index-gm9t95d9.js";
31
31
  import"./index-d13v9ckt.js";
32
32
  import"./index-48pz4jpc.js";
33
33
  import"./index-06c9ctr6.js";
@@ -42,7 +42,7 @@ import {
42
42
  parseVaultKey,
43
43
  portfolioDocumentIdentity,
44
44
  portfolioVaultIdentity
45
- } from "./index-cxfrakt7.js";
45
+ } from "./index-ekpwvbra.js";
46
46
  import"./index-1xxnjn0d.js";
47
47
  export {
48
48
  validateResolvedPortfolioVaults,
package/dist/sdk.js CHANGED
@@ -10,17 +10,17 @@ import {
10
10
  packSearchContext,
11
11
  packUntrustedSearchContext,
12
12
  validateKnowledgeBaseSearchHistory
13
- } from "./index-zzhgcwyt.js";
13
+ } from "./index-vxmf14m1.js";
14
14
  import"./index-adx6khj5.js";
15
- import"./index-zxdy5pby.js";
15
+ import"./index-5m2ydj5q.js";
16
16
  import"./index-4j3tt0c3.js";
17
17
  import"./index-1gwbassd.js";
18
- import"./index-cv6fh7z5.js";
18
+ import"./index-gm9t95d9.js";
19
19
  import"./index-d13v9ckt.js";
20
20
  import"./index-48pz4jpc.js";
21
21
  import"./index-06c9ctr6.js";
22
22
  import"./index-5vwpzb5a.js";
23
- import"./index-cxfrakt7.js";
23
+ import"./index-ekpwvbra.js";
24
24
  import"./index-1xxnjn0d.js";
25
25
  export {
26
26
  validateKnowledgeBaseSearchHistory,
package/dist/search.js CHANGED
@@ -6,12 +6,12 @@ import {
6
6
  fuseRankedCandidates,
7
7
  searchExactVault,
8
8
  validateSearchQuery
9
- } from "./index-cv6fh7z5.js";
9
+ } from "./index-gm9t95d9.js";
10
10
  import"./index-d13v9ckt.js";
11
11
  import"./index-48pz4jpc.js";
12
12
  import"./index-06c9ctr6.js";
13
13
  import"./index-5vwpzb5a.js";
14
- import"./index-cxfrakt7.js";
14
+ import"./index-ekpwvbra.js";
15
15
  export {
16
16
  validateSearchQuery,
17
17
  searchExactVault,
package/dist/semantic.js CHANGED
@@ -14,13 +14,13 @@ import {
14
14
  searchSemanticVault,
15
15
  semanticDatabasePath,
16
16
  sha256EmbeddingModelFile
17
- } from "./index-zxdy5pby.js";
18
- import"./index-cv6fh7z5.js";
17
+ } from "./index-5m2ydj5q.js";
18
+ import"./index-gm9t95d9.js";
19
19
  import"./index-d13v9ckt.js";
20
20
  import"./index-48pz4jpc.js";
21
21
  import"./index-06c9ctr6.js";
22
22
  import"./index-5vwpzb5a.js";
23
- import"./index-cxfrakt7.js";
23
+ import"./index-ekpwvbra.js";
24
24
  export {
25
25
  sha256EmbeddingModelFile,
26
26
  semanticDatabasePath,
@@ -1,19 +1,19 @@
1
1
  // @bun
2
2
  import {
3
3
  decisionContextWorkflow
4
- } from "../index-1vrd1rmn.js";
4
+ } from "../index-ykvvkd77.js";
5
5
  import"../index-3v2z4f0q.js";
6
- import"../index-zzhgcwyt.js";
6
+ import"../index-vxmf14m1.js";
7
7
  import"../index-adx6khj5.js";
8
- import"../index-zxdy5pby.js";
8
+ import"../index-5m2ydj5q.js";
9
9
  import"../index-4j3tt0c3.js";
10
10
  import"../index-1gwbassd.js";
11
- import"../index-cv6fh7z5.js";
11
+ import"../index-gm9t95d9.js";
12
12
  import"../index-d13v9ckt.js";
13
13
  import"../index-48pz4jpc.js";
14
14
  import"../index-06c9ctr6.js";
15
15
  import"../index-5vwpzb5a.js";
16
- import"../index-cxfrakt7.js";
16
+ import"../index-ekpwvbra.js";
17
17
  import"../index-1xxnjn0d.js";
18
18
  export {
19
19
  decisionContextWorkflow
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  decisionContextWorkflow
4
- } from "../index-1vrd1rmn.js";
4
+ } from "../index-ykvvkd77.js";
5
5
  import {
6
6
  explainChangeWorkflow
7
7
  } from "../index-zr53sf63.js";
@@ -9,17 +9,17 @@ import {
9
9
  planRadarWorkflow
10
10
  } from "../index-vvdj6kca.js";
11
11
  import"../index-3v2z4f0q.js";
12
- import"../index-zzhgcwyt.js";
12
+ import"../index-vxmf14m1.js";
13
13
  import"../index-adx6khj5.js";
14
- import"../index-zxdy5pby.js";
14
+ import"../index-5m2ydj5q.js";
15
15
  import"../index-4j3tt0c3.js";
16
16
  import"../index-1gwbassd.js";
17
- import"../index-cv6fh7z5.js";
17
+ import"../index-gm9t95d9.js";
18
18
  import"../index-d13v9ckt.js";
19
19
  import"../index-48pz4jpc.js";
20
20
  import"../index-06c9ctr6.js";
21
21
  import"../index-5vwpzb5a.js";
22
- import"../index-cxfrakt7.js";
22
+ import"../index-ekpwvbra.js";
23
23
  import"../index-1xxnjn0d.js";
24
24
  export {
25
25
  planRadarWorkflow,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hraness/kb",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "A knowledge base for coding agents, built from Markdown, backlinks, semantic search, and Git context.",
5
5
  "license": "MIT",
6
6
  "contentPolicy": {
@@ -2,10 +2,12 @@
2
2
 
3
3
  - `SKILL.md` – public entrypoint, runtime contract, and intent router for all hraness/kb agent workflows.
4
4
  - `references/query.md` – scoped retrieval through exact metadata, hybrid search, graph structure, and Git provenance.
5
+ - `references/customize.md` and `companion-skills.md` – interview-first KB setup, explicit approval boundaries, and contracts for optional recurring rituals.
5
6
  - `references/save-url.md`, `url-authentication.md`, and `url-platforms.md` – auditable web capture, signed-in source handling, and platform-specific completeness boundaries.
6
7
  - `references/save-pdf.md` and `pdf-review.md` – PDF ingestion, OCR, image evidence, and mixed-media review.
7
8
  - `references/plan.md` and `plan-structure.md` – durable plan authoring and its adaptable Markdown contract.
8
9
  - `references/percolate.md` and `refresh.md` – evidence-backed graph edits, catalog maintenance, and vault validation.
10
+ - `templates/companion-skill.template.md` – inert, copyable starting point for an approved companion skill.
9
11
  - `agents/openai.yaml` – user-facing skill metadata and invocation prompt.
10
12
 
11
13
  # Guidelines
@@ -14,6 +16,7 @@
14
16
  - Keep discovery language grounded in real user requests for knowledge bases, coding-agent memory, Markdown or Obsidian vaults, source capture, repository context, plans, and knowledge graphs. Exclude generic research, PDF reading, and planning outside hraness/kb.
15
17
  - Invoke the installed `kb` CLI without depending on a source checkout. Check for an existing command first, require Bun when installation is needed, and pin installation to the current immutable repository tag.
16
18
  - Never initialize or mutate a vault as part of skill or CLI installation.
19
+ - Route setup, evolution, and custom-ritual requests before runtime discovery. Keep inspection non-mutating until the exact proposal is approved, and never treat skill discovery or an ambient account as authority.
17
20
  - Keep Markdown authoritative. Preserve incomplete source boundaries, read cited evidence before graph edits, and never generate reciprocal, inferred, transitive, or similarity-derived relationships.
18
21
  - In parallel managed-catalog work, defer refresh to the integrating agent and use the catalog-skipping check in each edit lane. Authored-catalog refreshes leave the front door unchanged.
19
22
  - Update `agents/openai.yaml`, README installation text, package inventory checks, and the pinned CLI tag together when the skill identity or package release changes.
@@ -1,14 +1,16 @@
1
1
  ---
2
2
  name: kb
3
3
  description: >-
4
- Operate a hraness/kb local-first Markdown knowledge base for coding-agent
5
- memory. Use when a user asks to search or query a KB or Obsidian vault; load
4
+ Set up, evolve, or operate a hraness/kb local-first Markdown knowledge base
5
+ for coding-agent memory. Use when a user asks to design KB conventions or a
6
+ recurring KB ritual; search or query a KB or Obsidian vault; load or recover
6
7
  repository context, plans, decisions, concepts, backlinks, semantic search,
7
- or Git provenance; save, clip, scrape, or archive a URL, article, social
8
- thread, signed-in browser page, or PDF as auditable Markdown; create or
9
- update a durable plan in the vault; or refresh, check, percolate, and
10
- maintain its knowledge graph. Do not use for generic web research, generic
11
- PDF reading, or ordinary planning that will not use a hraness/kb vault.
8
+ or Git provenance from an earlier coding session; save, clip, scrape, or
9
+ archive a URL, article, social thread, signed-in browser page, or PDF as
10
+ auditable Markdown; create or update a durable plan in the vault; or refresh,
11
+ check, percolate, and maintain its knowledge graph. Do not use for generic
12
+ web research, generic PDF reading, or ordinary planning that will not use a
13
+ hraness/kb vault.
12
14
  ---
13
15
 
14
16
  # Work with KB
@@ -17,7 +19,29 @@ Use hraness/kb to preserve and retrieve inspectable agent memory in Markdown
17
19
  and Git. Select the smallest workflow that matches the request, then load only
18
20
  its references.
19
21
 
20
- ## Prepare the runtime
22
+ ## Route the request
23
+
24
+ Route the request before discovering, installing, or running the CLI. A setup,
25
+ evolution, or custom-ritual request begins with read-only inspection and an
26
+ approved proposal; it does not require a runtime merely because this skill was
27
+ selected.
28
+
29
+ | User intent | Read |
30
+ | --- | --- |
31
+ | Design, set up, or evolve a KB; choose its boundaries and conventions; or define a recurring KB ritual | [Customize a KB setup](references/customize.md); add [Companion skill contracts](references/companion-skills.md) only when the proposal includes a new or revised skill |
32
+ | Recover work from an earlier session, find notes, search one vault or an authorized portfolio, load repository-path context, inspect plans or decisions, follow backlinks or relationships, audit vault organization, or retrieve Git provenance | [Query the knowledge base](references/query.md) |
33
+ | Save, clip, scrape, or archive a URL, article, social post or thread, GitHub or Discourse discussion, signed-in page, feed, inbox, private document, WhatsApp conversation, or YouTube page | [Capture web content](references/save-url.md); add [browser authentication](references/url-authentication.md) for signed-in sources and [platform routing](references/url-platforms.md) when route choice or completeness matters |
34
+ | Import, extract, archive, OCR, or convert a local or public PDF into Markdown | [Save a PDF](references/save-pdf.md); add [PDF image review](references/pdf-review.md) for scans, screenshots, conversations, charts, or mixed media |
35
+ | Create or update an implementation plan, proposal, RFC, migration plan, execution audit, or phased checklist in the vault | [Write a durable plan](references/plan.md) and [use its structure](references/plan-structure.md) |
36
+ | Review recurring ideas, promote concepts, or add and verify typed relationships | [Percolate concepts and relationships](references/percolate.md) |
37
+ | Refresh or validate the catalog, graph, attachments, repository scopes, context mappings, or overall vault health | [Refresh and check the knowledge base](references/refresh.md) |
38
+
39
+ Read more than one primary reference only when the request spans those
40
+ workflows. For example, saving a source and linking it from a maintained note
41
+ uses the capture workflow followed by the relevant percolation and refresh
42
+ steps.
43
+
44
+ ## Prepare the runtime when execution needs it
21
45
 
22
46
  Use an existing `kb` command when one is available. Do not reinstall or upgrade
23
47
  it merely because this skill loaded.
@@ -31,7 +55,7 @@ missing:
31
55
  ```sh
32
56
  command -v kb >/dev/null 2>&1 || {
33
57
  command -v bun >/dev/null 2>&1 || exit 1
34
- bun add --global @hraness/kb@0.18.0
58
+ bun add --global @hraness/kb@0.19.0
35
59
  }
36
60
  kb --help
37
61
  ```
@@ -46,28 +70,13 @@ Installation ends after command verification. Never run `kb init`, create a
46
70
  vault, refresh a catalog, or edit Markdown as an installation side effect.
47
71
  Initialize or mutate a vault only when the user's request requires that change.
48
72
 
49
- ## Route the request
50
-
51
- | User intent | Read |
52
- | --- | --- |
53
- | Find notes, search one vault or an authorized portfolio, load repository-path context, inspect plans or decisions, follow backlinks or relationships, audit vault organization, or retrieve Git provenance | [Query the knowledge base](references/query.md) |
54
- | Save, clip, scrape, or archive a URL, article, social post or thread, GitHub or Discourse discussion, signed-in page, feed, inbox, private document, WhatsApp conversation, or YouTube page | [Capture web content](references/save-url.md); add [browser authentication](references/url-authentication.md) for signed-in sources and [platform routing](references/url-platforms.md) when route choice or completeness matters |
55
- | Import, extract, archive, OCR, or convert a local or public PDF into Markdown | [Save a PDF](references/save-pdf.md); add [PDF image review](references/pdf-review.md) for scans, screenshots, conversations, charts, or mixed media |
56
- | Create or update an implementation plan, proposal, RFC, migration plan, execution audit, or phased checklist in the vault | [Write a durable plan](references/plan.md) and [use its structure](references/plan-structure.md) |
57
- | Review recurring ideas, promote concepts, or add and verify typed relationships | [Percolate concepts and relationships](references/percolate.md) |
58
- | Refresh or validate the catalog, graph, attachments, repository scopes, context mappings, or overall vault health | [Refresh and check the knowledge base](references/refresh.md) |
59
-
60
- Read more than one primary reference only when the request spans those
61
- workflows. For example, saving a source and linking it from a maintained note
62
- uses the capture workflow followed by the relevant percolation and refresh
63
- steps.
64
-
65
73
  ## Preserve the KB contract
66
74
 
67
- - Resolve `KB_ROOT` to the existing vault directory that contains its managed
68
- or authored `index.md`. Read the applicable repository and vault
69
- `AGENTS.md` files before writing. Do not assume the session started in the
70
- vault.
75
+ - For an existing vault, resolve `KB_ROOT` to the directory that contains its
76
+ managed or authored `index.md`. During setup, inspect the explicitly proposed
77
+ location without assuming that `index.md` or any KB directory exists. Read
78
+ the applicable repository and vault `AGENTS.md` files before writing. Do not
79
+ assume the session started in the vault.
71
80
  - Treat authored Markdown and Git as the record. Catalogs, backlinks, graph
72
81
  reports, search indexes, embeddings, and percolation candidates are derived
73
82
  views.
@@ -1,4 +1,4 @@
1
1
  interface:
2
2
  display_name: "KB"
3
- short_description: "Query, capture, plan, and maintain Markdown memory"
4
- default_prompt: "Use $kb to work with this hraness/kb knowledge base and load only the workflow references needed for the request."
3
+ short_description: "Set up, query, capture, and maintain Markdown memory"
4
+ default_prompt: "Use $kb to set up or work with this hraness/kb knowledge base, routing the request before any runtime preparation and loading only the references needed."
@@ -0,0 +1,96 @@
1
+ # Companion skill contracts
2
+
3
+ A companion skill handles one recurring KB ritual that benefits from a
4
+ discriminating trigger and an explicit operating contract. It composes with
5
+ the public `kb` skill. It does not register code at runtime, execute vault
6
+ metadata, or gain authority by being installed.
7
+
8
+ ## Identity and routing
9
+
10
+ Give the skill a lowercase action-oriented name and a description that states
11
+ the concrete request that should select it. Keep generic querying, capture,
12
+ planning, percolation, refresh, and validation in the main `kb` skill. Propose
13
+ at most three companions, and prefer zero when the standard router is enough.
14
+
15
+ ## Inputs and preconditions
16
+
17
+ List the exact inputs that must be supplied or resolved before work starts.
18
+ Distinguish an existing vault from a proposed location. State required local
19
+ commands, repository state, source availability, and authorization without
20
+ installing or probing them as a side effect of skill discovery.
21
+
22
+ ## Surfaces and authority
23
+
24
+ List each filesystem, repository, application, account, network, and
25
+ integration surface the workflow may read or write. Skill discovery,
26
+ installation, or an existing signed-in session grants no authority. The user's
27
+ scope, the applicable repository instructions, host permissions, and the
28
+ selected tool's own approval boundary remain controlling.
29
+
30
+ Do not infer that an account operation is read-only from its HTTP method. Do
31
+ not place secrets, cookies, tokens, session data, or ambient personal context
32
+ in durable output.
33
+
34
+ The shipped customization executor proves filesystem scaffolding only. It
35
+ does not execute an application, account, network, or integration write. A
36
+ companion skill that later needs such an action must treat it as a separate
37
+ runtime request with its own exact proposal, approval, capable tool, and
38
+ inspectable result.
39
+
40
+ ## Approval boundary
41
+
42
+ Separate read-only inspection from mutation. Present exact targets and writes
43
+ before approval unless the user's request already authorizes them. A denial,
44
+ no response, changed proposal, path expansion, added account, or new external
45
+ surface requires stopping or renewed approval.
46
+
47
+ ## Execution semantics
48
+
49
+ Define deterministic behavior for the first run and an exact repeat. Require
50
+ path confinement, reject symbolic-link targets, and preserve divergent
51
+ existing content. Name each effect explicitly instead of granting a broad
52
+ filesystem or application capability.
53
+
54
+ ## Durable outputs and provenance
55
+
56
+ Name the files or records that persist, their authority, and the provenance
57
+ they retain. Markdown and Git remain authoritative KB state. Generated
58
+ catalogs, indexes, embeddings, and graph reports stay rebuildable. Exclude
59
+ credentials, session material, and unrelated account data.
60
+
61
+ ## Verification and KB maintenance
62
+
63
+ Define the narrow checks that establish the intended result. After material KB
64
+ edits, review percolation candidates and run the appropriate catalog-aware
65
+ check. Parallel lanes use `kb check --no-catalog`; one integrating agent owns a
66
+ managed catalog refresh.
67
+
68
+ ## Composition boundary
69
+
70
+ Call the installed `kb` command or its public package interfaces only when the
71
+ approved workflow needs them. Do not add a plugin registry, hook loader,
72
+ background process, executable vault metadata, or implicit account bridge. A
73
+ companion skill is an instruction boundary, not runtime extensibility.
74
+
75
+ ## Review checklist
76
+
77
+ The repository's fake-capability suite is a tested contract example. It checks
78
+ the expected approval and failure transitions, but it does not prove that every
79
+ agent or host integration complies. Review the executing agent's actual tool
80
+ and permission boundaries as well.
81
+
82
+ - Does the trigger identify one recurring request without attracting generic
83
+ KB work?
84
+ - Are inputs, preconditions, read surfaces, write surfaces, and exact targets
85
+ explicit?
86
+ - Can inspection finish without installing, indexing, caching, or mutating?
87
+ - Does approval cover every effect, with renewed approval for any change?
88
+ - Is an exact repeat a no-op, while divergence, path escape, symlinks, partial
89
+ failure, and unapproved external access stop safely?
90
+ - Do durable outputs preserve useful provenance without secrets or session
91
+ data?
92
+ - Does the skill compose with the public router without copying its general
93
+ instructions?
94
+
95
+ Start from [`companion-skill.template.md`](../templates/companion-skill.template.md)
96
+ only after the proposal's target skill root and name are approved.