@bodhi-ventures/aiocs 0.5.3 → 0.6.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.
@@ -47,11 +47,16 @@ All of these support the root-level `--json` flag:
47
47
  - `doctor`
48
48
  - `source upsert`
49
49
  - `source list`
50
+ - `source describe`
51
+ - `source context show`
52
+ - `source context upsert`
50
53
  - `fetch`
51
54
  - `canary`
52
55
  - `refresh due`
53
56
  - `snapshot list`
54
57
  - `diff`
58
+ - `page list`
59
+ - `page show`
55
60
  - `project link`
56
61
  - `project unlink`
57
62
  - `backup export`
@@ -61,6 +66,9 @@ All of these support the root-level `--json` flag:
61
66
  - `embeddings clear`
62
67
  - `embeddings run`
63
68
  - `search`
69
+ - `retrieve`
70
+ - `learning save`
71
+ - `learning list`
64
72
  - `verify coverage`
65
73
  - `show`
66
74
 
@@ -177,6 +185,63 @@ Summary status values:
177
185
  }
178
186
  ```
179
187
 
188
+ ### `source.describe`
189
+
190
+ ```json
191
+ {
192
+ "source": {
193
+ "id": "hyperliquid",
194
+ "kind": "web",
195
+ "label": "Hyperliquid",
196
+ "specPath": "/absolute/path/to/spec.yaml"
197
+ },
198
+ "context": {
199
+ "sourceId": "hyperliquid",
200
+ "context": {
201
+ "purpose": "Primary exchange docs",
202
+ "summary": "Use for exchange API and auth questions.",
203
+ "topicHints": ["authentication", "orders"],
204
+ "commonLocations": [],
205
+ "gotchas": [],
206
+ "authNotes": []
207
+ },
208
+ "createdAt": "2026-04-08T12:00:00.000Z",
209
+ "updatedAt": "2026-04-08T12:00:00.000Z"
210
+ },
211
+ "latestSnapshot": {
212
+ "snapshotId": "snp_...",
213
+ "detectedVersion": null,
214
+ "createdAt": "2026-04-08T12:05:00.000Z",
215
+ "pageCount": 139
216
+ },
217
+ "recentLearnings": []
218
+ }
219
+ ```
220
+
221
+ ### `source.context.show` and `source.context.upsert`
222
+
223
+ ```json
224
+ {
225
+ "sourceId": "hyperliquid",
226
+ "context": {
227
+ "purpose": "Primary exchange docs",
228
+ "summary": "Use for exchange API and auth questions.",
229
+ "topicHints": ["authentication", "orders"],
230
+ "commonLocations": [
231
+ {
232
+ "label": "Auth reference",
233
+ "url": "https://example.dev/docs/auth",
234
+ "note": "Start here for API setup questions."
235
+ }
236
+ ],
237
+ "gotchas": ["Read the full page before answering from isolated chunks."],
238
+ "authNotes": ["Wallet signing docs are separate from trader docs."]
239
+ },
240
+ "createdAt": "2026-04-08T12:00:00.000Z",
241
+ "updatedAt": "2026-04-08T12:00:00.000Z"
242
+ }
243
+ ```
244
+
180
245
  ### `fetch` and `refresh.due`
181
246
 
182
247
  ```json
@@ -236,6 +301,46 @@ Summary status values:
236
301
  }
237
302
  ```
238
303
 
304
+ ### `page.list`
305
+
306
+ ```json
307
+ {
308
+ "sourceId": "hyperliquid",
309
+ "snapshotId": "snp_...",
310
+ "total": 2,
311
+ "limit": 50,
312
+ "offset": 0,
313
+ "hasMore": false,
314
+ "pages": [
315
+ {
316
+ "url": "https://example.dev/docs/start",
317
+ "title": "Docs Start",
318
+ "pageKind": "document",
319
+ "filePath": null,
320
+ "language": null,
321
+ "markdownLength": 245
322
+ }
323
+ ]
324
+ }
325
+ ```
326
+
327
+ ### `page.show`
328
+
329
+ ```json
330
+ {
331
+ "sourceId": "hyperliquid",
332
+ "snapshotId": "snp_...",
333
+ "page": {
334
+ "url": "https://example.dev/docs/start",
335
+ "title": "Docs Start",
336
+ "markdown": "# Docs Start\n\nFull page content...",
337
+ "pageKind": "document",
338
+ "filePath": null,
339
+ "language": null
340
+ }
341
+ }
342
+ ```
343
+
239
344
  ### `project.link` and `project.unlink`
240
345
 
241
346
  ```json
@@ -285,6 +390,97 @@ Summary status values:
285
390
  }
286
391
  ```
287
392
 
393
+ ### `retrieve`
394
+
395
+ ```json
396
+ {
397
+ "query": "where is maker flow documented",
398
+ "modeRequested": "lexical",
399
+ "modeUsed": "lexical",
400
+ "sourceScope": ["hyperliquid"],
401
+ "sourceHints": [
402
+ {
403
+ "sourceId": "hyperliquid",
404
+ "score": 2,
405
+ "context": {
406
+ "purpose": "Primary exchange docs",
407
+ "summary": "Use for exchange API and auth questions.",
408
+ "topicHints": ["maker flow"],
409
+ "commonLocations": [],
410
+ "gotchas": [],
411
+ "authNotes": []
412
+ },
413
+ "matchedCommonLocations": []
414
+ }
415
+ ],
416
+ "matchedLearnings": [],
417
+ "avoidedLearnings": [],
418
+ "search": {
419
+ "total": 1,
420
+ "limit": 20,
421
+ "offset": 0,
422
+ "hasMore": false,
423
+ "results": []
424
+ },
425
+ "pages": [
426
+ {
427
+ "sourceId": "hyperliquid",
428
+ "snapshotId": "snp_...",
429
+ "url": "https://example.dev/docs/start",
430
+ "title": "Docs Start",
431
+ "markdown": "# Docs Start\n\nFull page content...",
432
+ "pageKind": "document",
433
+ "filePath": null,
434
+ "language": null
435
+ }
436
+ ]
437
+ }
438
+ ```
439
+
440
+ ### `learning.save`
441
+
442
+ ```json
443
+ {
444
+ "learning": {
445
+ "learningId": "rte_...",
446
+ "sourceId": "hyperliquid",
447
+ "snapshotId": "snp_...",
448
+ "learningType": "discovery",
449
+ "intent": "where is maker flow documented",
450
+ "pageUrl": "https://example.dev/docs/start",
451
+ "filePath": null,
452
+ "title": "Docs Start",
453
+ "note": "Start here for maker-flow docs questions.",
454
+ "searchTerms": ["maker flow"],
455
+ "createdAt": "2026-04-08T12:00:00.000Z",
456
+ "updatedAt": "2026-04-08T12:00:00.000Z"
457
+ }
458
+ }
459
+ ```
460
+
461
+ ### `learning.list`
462
+
463
+ ```json
464
+ {
465
+ "learnings": [
466
+ {
467
+ "learningId": "rte_...",
468
+ "sourceId": "hyperliquid",
469
+ "snapshotId": "snp_...",
470
+ "learningType": "discovery",
471
+ "intent": "where is maker flow documented",
472
+ "pageUrl": "https://example.dev/docs/start",
473
+ "filePath": null,
474
+ "title": "Docs Start",
475
+ "note": "Start here for maker-flow docs questions.",
476
+ "searchTerms": ["maker flow"],
477
+ "createdAt": "2026-04-08T12:00:00.000Z",
478
+ "updatedAt": "2026-04-08T12:00:00.000Z"
479
+ }
480
+ ]
481
+ }
482
+ ```
483
+
288
484
  ### `search`
289
485
 
290
486
  ```json
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bodhi-ventures/aiocs",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Local-only documentation store, fetcher, and search CLI for AI agents.",
@@ -22,6 +22,11 @@ Use this skill when you need authoritative local documentation lookup through th
22
22
  - Check `source_list` or scoped `search` before assuming a source is missing.
23
23
  - Use `aiocs` first for the bundled `hyperliquid` source and for any repo or machine that already relies on `~/.aiocs`.
24
24
  - This skill is the default read/search path. If the task requires source creation, force fetch, targeted refresh, or canary remediation, also load `aiocs-curation`.
25
+ - Default to the awareness loop before answering:
26
+ - `source describe` to understand the source
27
+ - `page list` to inspect likely full pages
28
+ - `search` to shortlist candidate chunks
29
+ - `retrieve` or `page show` to read the full stored page before synthesizing an answer
25
30
  - Only fall back to live browsing when:
26
31
  - the source is not present in `aiocs`
27
32
  - the user explicitly wants the live site
@@ -38,6 +43,7 @@ Use this skill when you need authoritative local documentation lookup through th
38
43
 
39
44
  ## Search defaults for agents
40
45
 
46
+ - Prefer `retrieve` when the user wants an answer grounded in the right document, not just raw chunk matches.
41
47
  - Default to `search` with `mode=auto`.
42
48
  - Use `mode=lexical` for exact identifiers, section titles, endpoint names, and error strings.
43
49
  - Use `--path` / `pathPatterns` and `--language` / `languages` when searching repo/code sources.
@@ -61,6 +67,15 @@ aiocs --json init --no-fetch
61
67
 
62
68
  ## Core commands
63
69
 
70
+ Inspect source awareness and stored pages:
71
+
72
+ ```bash
73
+ aiocs --json source describe hyperliquid
74
+ aiocs --json source context show hyperliquid
75
+ aiocs --json page list hyperliquid --query "auth"
76
+ aiocs --json page show hyperliquid --url "https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api"
77
+ ```
78
+
64
79
  Search the shared catalog:
65
80
 
66
81
  ```bash
@@ -77,6 +92,13 @@ Inspect a specific chunk:
77
92
  aiocs --json show 42
78
93
  ```
79
94
 
95
+ Assemble answer context from awareness, search, and full-page reads:
96
+
97
+ ```bash
98
+ aiocs --json retrieve "where is maker flow documented" --source hyperliquid --mode lexical
99
+ aiocs --json retrieve "api introduction" --source bulk-trade --mode lexical --page-limit 2
100
+ ```
101
+
80
102
  Inspect source availability and health:
81
103
 
82
104
  ```bash
@@ -119,9 +141,13 @@ The `aiocs-mcp` server exposes the same core operations without shell parsing:
119
141
  - `doctor`
120
142
  - `init`
121
143
  - `source_list`
144
+ - `source_describe`
145
+ - `source_context_show`
122
146
  - `canary`
123
147
  - `snapshot_list`
124
148
  - `diff_snapshots`
149
+ - `page_list`
150
+ - `page_show`
125
151
  - `project_link`
126
152
  - `project_unlink`
127
153
  - `embeddings_status`
@@ -131,20 +157,24 @@ The `aiocs-mcp` server exposes the same core operations without shell parsing:
131
157
  - `backup_export`
132
158
  - `backup_import`
133
159
  - `search`
160
+ - `retrieve_context`
134
161
  - `show`
162
+ - `learning_list`
135
163
  - `verify_coverage`
136
164
  - `batch`
137
165
 
138
- Mutation-capable MCP tools such as `source_upsert`, `refresh_due`, and `fetch` belong to `aiocs-curation`.
166
+ Mutation-capable MCP tools such as `source_upsert`, `source_context_upsert`, `learning_save`, `refresh_due`, and `fetch` belong to `aiocs-curation`.
139
167
 
140
168
  ## Recommended Codex workflow
141
169
 
142
170
  1. If runtime health is in doubt, run `doctor`.
143
- 2. Run `source_list` to see whether the source already exists.
144
- 3. Use `search` in `auto` mode first, then `show` for the selected chunk.
145
- 4. Use `canary`, `diff_snapshots`, or `verify_coverage` when the question is about drift, changes, or completeness.
146
- 5. If the source is missing or stale and the next step is to mutate `aiocs`, load `aiocs-curation`.
147
- 6. Use `batch` when combining list/search/show or diff/coverage checks in one pass.
171
+ 2. Run `source_list` or `source_describe` to see whether the source already exists and what it covers.
172
+ 3. Use `page_list` when the question is likely page-oriented, or `search` when chunk recall is the fastest shortlist path.
173
+ 4. Use `retrieve` when the answer should be grounded in full-page reads rather than isolated chunks.
174
+ 5. Use `page_show` when you already know the exact page to read.
175
+ 6. Use `canary`, `diff_snapshots`, or `verify_coverage` when the question is about drift, changes, or completeness.
176
+ 7. If the source is missing or stale and the next step is to mutate `aiocs`, load `aiocs-curation`.
177
+ 8. Use `batch` when combining describe/page-list/search/show or diff/coverage checks in one pass.
148
178
 
149
179
  ## Operational notes
150
180
 
@@ -152,6 +182,7 @@ Mutation-capable MCP tools such as `source_upsert`, `refresh_due`, and `fetch` b
152
182
  - Default state root: `~/.aiocs/data`, `~/.aiocs/config`, and `~/.aiocs/sources`.
153
183
  - Use `aiocs daemon` or the Docker daemon service when the catalog should stay fresh automatically.
154
184
  - `aiocs search --mode auto` is the right default for agents; it uses hybrid retrieval only when embeddings are current and healthy for the requested scope.
185
+ - `aiocs retrieve` is the right default when the agent should answer from the best full document, not just the top chunk.
155
186
  - The Docker Compose stack includes a dedicated `aiocs-qdrant` container and expects Ollama to be reachable separately.
156
187
  - Canaries are the first place to look when a docs site changed and fetches started degrading.
157
188
  - Newly added or changed sources become due immediately, so `refresh due <source-id>` is the safe first refresh path after upsert.
@@ -13,6 +13,8 @@ Use this skill when you need to add, refresh, repair, or otherwise mutate `aiocs
13
13
  - An existing source is stale and should be refreshed instead of bypassed.
14
14
  - A source spec needs to be created, updated, or upserted under `~/.aiocs/sources`.
15
15
  - A reusable external git repository should be added as a `kind: git` source under `~/.aiocs/sources`.
16
+ - A source should gain curated metadata such as purpose, topic hints, common locations, gotchas, or auth notes.
17
+ - A durable routing hint should be saved because a discovery or failed path will help future retrieval.
16
18
  - A canary is failing and the source needs remediation or targeted refetch.
17
19
  - The user explicitly wants `aiocs` maintenance, source onboarding, or catalog repair.
18
20
 
@@ -59,6 +61,12 @@ mkdir -p ~/.aiocs/sources
59
61
  aiocs --json source upsert ~/.aiocs/sources/my-source.yaml
60
62
  ```
61
63
 
64
+ Add or update curated source context:
65
+
66
+ ```bash
67
+ aiocs --json source context upsert my-source ~/.aiocs/source-context/my-source.yaml
68
+ ```
69
+
62
70
  Refresh only what is needed:
63
71
 
64
72
  ```bash
@@ -69,6 +77,13 @@ aiocs --json fetch my-source
69
77
  aiocs --json canary my-source
70
78
  ```
71
79
 
80
+ Persist durable routing learnings when they will help future retrieval:
81
+
82
+ ```bash
83
+ aiocs --json learning save --source my-source --kind discovery --intent "where is auth documented" --page-url "https://..."
84
+ aiocs --json learning save --source my-source --kind negative --intent "where is auth documented" --page-url "https://..." --note "Overview page is not enough."
85
+ ```
86
+
72
87
  Heavy maintenance remains explicit:
73
88
 
74
89
  ```bash
@@ -84,9 +99,11 @@ The `aiocs-mcp` server exposes the same curation operations without shell parsin
84
99
  - `doctor`
85
100
  - `source_list`
86
101
  - `source_upsert`
102
+ - `source_context_upsert`
87
103
  - `canary`
88
104
  - `fetch`
89
105
  - `refresh_due`
106
+ - `learning_save`
90
107
  - `embeddings_status`
91
108
  - `embeddings_backfill`
92
109
  - `embeddings_clear`
@@ -98,13 +115,17 @@ The `aiocs-mcp` server exposes the same curation operations without shell parsin
98
115
  1. Run `doctor` or `source_list` if runtime health, presence, or freshness is unclear.
99
116
  2. If the source already exists and is due, prefer `refresh due <source-id>`.
100
117
  3. If the source is missing but worth curating, create a spec under `~/.aiocs/sources`, then `source_upsert` it.
101
- 4. After upsert, use `refresh due <source-id>` as the safe first fetch path.
102
- 5. Use `canary` when the site changed or extraction drift is suspected.
103
- 6. Escalate to `fetch <source-id>` or `fetch all` only for explicit maintenance or when due-based refresh is not enough.
118
+ 4. If source-level context will help future retrieval, upsert a curated source-context file.
119
+ 5. After upsert, use `refresh due <source-id>` as the safe first fetch path.
120
+ 6. Use `canary` when the site changed or extraction drift is suspected.
121
+ 7. Save routing learnings only when the discovery is durable enough to help future runs.
122
+ 8. Escalate to `fetch <source-id>` or `fetch all` only for explicit maintenance or when due-based refresh is not enough.
104
123
 
105
124
  ## Operational notes
106
125
 
107
126
  - New or changed sources become due immediately after `source_upsert`.
127
+ - `source context upsert` is the right place for durable source-level guidance; do not overload source specs with retrieval notes.
128
+ - `learning save` is for durable routing memory, not one-off scratch notes.
108
129
  - `~/.aiocs/sources` and bundled repo sources behave the same once bootstrapped into the catalog.
109
130
  - Targeted refresh is the default. Broad refresh is a maintenance task, not a normal answering step.
110
131
  - Use `aiocs` for read/search flows and this skill only for catalog mutation.