@bodhi-ventures/aiocs 0.1.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.
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@bodhi-ventures/aiocs",
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "type": "module",
6
+ "description": "Local-only documentation store, fetcher, and search CLI for AI agents.",
7
+ "keywords": [
8
+ "ai",
9
+ "docs",
10
+ "search",
11
+ "mcp",
12
+ "cli"
13
+ ],
14
+ "homepage": "https://github.com/Bodhi-Ventures/aiocs",
15
+ "bugs": {
16
+ "url": "https://github.com/Bodhi-Ventures/aiocs/issues"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/Bodhi-Ventures/aiocs.git"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public",
24
+ "provenance": true
25
+ },
26
+ "packageManager": "pnpm@9.15.9",
27
+ "files": [
28
+ "dist",
29
+ "sources",
30
+ "docs",
31
+ "README.md",
32
+ "LICENSE",
33
+ "skills"
34
+ ],
35
+ "bin": {
36
+ "docs": "./dist/cli.js",
37
+ "aiocs-mcp": "./dist/mcp-server.js"
38
+ },
39
+ "engines": {
40
+ "node": ">=22"
41
+ },
42
+ "scripts": {
43
+ "build": "tsup --config tsup.config.ts",
44
+ "dev": "tsx src/cli.ts",
45
+ "dev:mcp": "tsx src/mcp-server.ts",
46
+ "lint": "tsc --noEmit",
47
+ "test": "vitest run",
48
+ "test:watch": "vitest"
49
+ },
50
+ "dependencies": {
51
+ "@modelcontextprotocol/sdk": "^1.28.0",
52
+ "@mozilla/readability": "^0.6.0",
53
+ "@qdrant/js-client-rest": "1.17.0",
54
+ "better-sqlite3": "^12.4.1",
55
+ "commander": "^14.0.1",
56
+ "jsdom": "^27.0.1",
57
+ "playwright": "^1.57.0",
58
+ "turndown": "^7.2.1",
59
+ "turndown-plugin-gfm": "^1.0.2",
60
+ "yaml": "^2.8.1",
61
+ "zod": "^4.1.12"
62
+ },
63
+ "devDependencies": {
64
+ "@types/better-sqlite3": "^7.6.13",
65
+ "@types/jsdom": "^21.1.7",
66
+ "@types/node": "^24.7.2",
67
+ "@types/turndown": "^5.0.5",
68
+ "execa": "^9.6.0",
69
+ "tsup": "^8.5.0",
70
+ "tsx": "^4.20.6",
71
+ "typescript": "^5.9.3",
72
+ "vitest": "^3.2.4"
73
+ }
74
+ }
@@ -0,0 +1,174 @@
1
+ # aiocs
2
+
3
+ Use this skill when you need authoritative local documentation search, inspection, safe refresh, or bootstrap through the shared `aiocs` catalog under `~/.aiocs`.
4
+
5
+ ## When to use it
6
+
7
+ - The user is asking about exchange or product docs that may already exist in the local `aiocs` catalog.
8
+ - You need authoritative local docs for an exchange, SDK, or product without browsing the live site every time.
9
+ - You want machine-readable search/show results for an AI agent.
10
+ - You need to detect source drift or compare snapshot changes over time.
11
+ - You want hybrid docs retrieval with lexical plus semantic/vector recall.
12
+ - You need to bootstrap or validate `aiocs` on a new machine.
13
+ - You want to keep the local docs catalog warm through the `aiocs` daemon or MCP server.
14
+ - You need to back up or restore the shared catalog.
15
+
16
+ ## Trigger guidance for Codex
17
+
18
+ - Prefer `aiocs` before live web browsing when the requested docs may already be in the local catalog.
19
+ - Check `source_list` or scoped `search` before assuming a source is missing.
20
+ - Use `aiocs` first for supported built-in sources and for any repo or machine that already relies on `~/.aiocs`.
21
+ - If a source is missing, only add it when it is worth curating for future reuse.
22
+ - Prefer `refresh due <source-id>` over force `fetch <source-id>` whenever freshness is the real goal.
23
+ - Do not use `fetch all` as a normal answering path; reserve it for explicit user requests or maintenance flows.
24
+ - Only fall back to live browsing when:
25
+ - the source is not present in `aiocs`
26
+ - the user explicitly wants the live site
27
+ - the local catalog is stale or broken and the answer cannot wait for refresh/canary remediation
28
+ - If you need multiple docs operations in MCP, use `batch` instead of many small round trips.
29
+
30
+ ## Preferred interfaces
31
+
32
+ 1. Prefer `aiocs-mcp` when an MCP client can use it directly.
33
+ 2. Otherwise use the CLI with the root `--json` flag.
34
+ 3. Avoid parsing human-formatted CLI output unless there is no alternative.
35
+
36
+ ## Search defaults for agents
37
+
38
+ - Default to `search` with `mode=auto`.
39
+ - Use `mode=lexical` for exact identifiers, section titles, endpoint names, and error strings.
40
+ - Use `mode=hybrid` for conceptual questions when embeddings are healthy.
41
+ - Use `mode=semantic` only when you explicitly want vector-only recall.
42
+ - When citing results, include `sourceId`, `snapshotId`, and `pageUrl` when they materially help traceability.
43
+
44
+ ## First-run workflow
45
+
46
+ Validate the local runtime:
47
+
48
+ ```bash
49
+ docs --json doctor
50
+ ```
51
+
52
+ Bootstrap the bundled built-in sources:
53
+
54
+ ```bash
55
+ docs --json init --no-fetch
56
+ ```
57
+
58
+ User-managed source specs live under:
59
+
60
+ ```bash
61
+ ~/.aiocs/sources
62
+ ```
63
+
64
+ ## Core commands
65
+
66
+ Search the shared catalog:
67
+
68
+ ```bash
69
+ docs --json search "maker flow" --source hyperliquid
70
+ docs --json search "maker flow" --all
71
+ docs --json search "maker flow" --source hyperliquid --limit 5 --offset 0
72
+ docs --json search "maker flow" --source hyperliquid --mode hybrid
73
+ ```
74
+
75
+ Inspect a specific chunk:
76
+
77
+ ```bash
78
+ docs --json show 42
79
+ ```
80
+
81
+ Refresh the catalog:
82
+
83
+ ```bash
84
+ docs --json source list
85
+ docs --json refresh due hyperliquid
86
+ docs --json canary hyperliquid
87
+ docs --json embeddings status
88
+ docs --json embeddings backfill all
89
+ docs --json embeddings run
90
+ ```
91
+
92
+ Force fetch is still available for explicit maintenance:
93
+
94
+ ```bash
95
+ docs --json fetch hyperliquid
96
+ docs --json fetch all
97
+ ```
98
+
99
+ Inspect what changed between snapshots:
100
+
101
+ ```bash
102
+ docs --json diff hyperliquid
103
+ ```
104
+
105
+ Back up or restore the shared catalog:
106
+
107
+ ```bash
108
+ docs --json backup export /absolute/path/to/backup
109
+ docs --json backup import /absolute/path/to/backup --replace-existing
110
+ ```
111
+
112
+ Verify fetched coverage against reference markdown:
113
+
114
+ ```bash
115
+ docs --json verify coverage hyperliquid /absolute/path/to/reference.md
116
+ ```
117
+
118
+ Scope docs to a project path:
119
+
120
+ ```bash
121
+ docs --json project link /absolute/path/to/project hyperliquid lighter
122
+ docs --json project unlink /absolute/path/to/project lighter
123
+ ```
124
+
125
+ ## MCP tools
126
+
127
+ The `aiocs-mcp` server exposes the same core operations without shell parsing:
128
+
129
+ - `version`
130
+ - `doctor`
131
+ - `init`
132
+ - `source_upsert`
133
+ - `source_list`
134
+ - `canary`
135
+ - `fetch`
136
+ - `refresh_due`
137
+ - `snapshot_list`
138
+ - `diff_snapshots`
139
+ - `project_link`
140
+ - `project_unlink`
141
+ - `embeddings_status`
142
+ - `embeddings_backfill`
143
+ - `embeddings_clear`
144
+ - `embeddings_run`
145
+ - `backup_export`
146
+ - `backup_import`
147
+ - `search`
148
+ - `show`
149
+ - `verify_coverage`
150
+ - `batch`
151
+
152
+ ## Recommended Codex workflow
153
+
154
+ 1. If runtime health or freshness is in doubt, run `doctor`.
155
+ 2. Run `source_list` to see whether the source already exists and whether it is due.
156
+ 3. If the source exists and is due, prefer `refresh due <source-id>` over force fetch.
157
+ 4. If the source is missing but likely to be reused, add a spec under `~/.aiocs/sources`, upsert it, then refresh only that source.
158
+ 5. Use `search` in `auto` mode first, then `show` for the selected chunk.
159
+ 6. Use `canary`, `diff_snapshots`, or `verify_coverage` when the question is about drift, changes, or completeness.
160
+ 7. Use `batch` when combining list/search/show or diff/coverage checks in one pass.
161
+
162
+ ## Operational notes
163
+
164
+ - The catalog is local-only and shared across projects on the same machine.
165
+ - Default state root: `~/.aiocs/data`, `~/.aiocs/config`, and `~/.aiocs/sources`.
166
+ - Use `docs daemon` or the Docker daemon service when the catalog should stay fresh automatically.
167
+ - `docs search --mode auto` is the right default for agents; it uses hybrid retrieval only when embeddings are current and healthy for the requested scope.
168
+ - The Docker Compose stack includes a dedicated `aiocs-qdrant` container and expects Ollama to be reachable separately.
169
+ - Canaries are the first place to look when a docs site changed and fetches started degrading.
170
+ - Newly added or changed sources become due immediately, so `refresh due <source-id>` is the safe first refresh path after upsert.
171
+ - CLI failures expose machine-readable `error.code` fields in `--json` mode.
172
+ - MCP tool results use `{ ok, data?, error? }` envelopes, and `batch` can reduce multiple small MCP round trips.
173
+ - For exact CLI payloads, see `/Users/jmucha/repos/mandex/aiocs/docs/json-contract.md`.
174
+ - For Codex setup and subagent examples, see `/Users/jmucha/repos/mandex/aiocs/docs/codex-integration.md`.
@@ -0,0 +1,20 @@
1
+ id: ethereal
2
+ label: Ethereal Docs
3
+ startUrls:
4
+ - https://docs.ethereal.trade/
5
+ allowedHosts:
6
+ - docs.ethereal.trade
7
+ discovery:
8
+ include:
9
+ - https://docs.ethereal.trade/**
10
+ exclude: []
11
+ maxPages: 500
12
+ extract:
13
+ strategy: clipboardButton
14
+ interactions:
15
+ - action: click
16
+ selector: button[aria-label="Copy page"]
17
+ normalize:
18
+ prependSourceComment: true
19
+ schedule:
20
+ everyHours: 24
@@ -0,0 +1,20 @@
1
+ id: hyperliquid
2
+ label: Hyperliquid Docs
3
+ startUrls:
4
+ - https://hyperliquid.gitbook.io/hyperliquid-docs
5
+ allowedHosts:
6
+ - hyperliquid.gitbook.io
7
+ discovery:
8
+ include:
9
+ - https://hyperliquid.gitbook.io/hyperliquid-docs**
10
+ exclude: []
11
+ maxPages: 500
12
+ extract:
13
+ strategy: clipboardButton
14
+ interactions:
15
+ - action: click
16
+ selector: button[aria-label="Copy page"]
17
+ normalize:
18
+ prependSourceComment: true
19
+ schedule:
20
+ everyHours: 24
@@ -0,0 +1,24 @@
1
+ id: lighter
2
+ label: Lighter Docs
3
+ startUrls:
4
+ - https://apidocs.lighter.xyz/docs/get-started
5
+ - https://apidocs.lighter.xyz/reference/status
6
+ allowedHosts:
7
+ - apidocs.lighter.xyz
8
+ discovery:
9
+ include:
10
+ - https://apidocs.lighter.xyz/docs/**
11
+ - https://apidocs.lighter.xyz/reference/**
12
+ exclude: []
13
+ maxPages: 800
14
+ extract:
15
+ strategy: clipboardButton
16
+ interactions:
17
+ - action: click
18
+ selector: 'button:has-text("Ask AI")'
19
+ - action: click
20
+ selector: 'div[role="button"]:has-text("Copy Markdown")'
21
+ normalize:
22
+ prependSourceComment: true
23
+ schedule:
24
+ everyHours: 24
@@ -0,0 +1,22 @@
1
+ id: nado
2
+ label: Nado Docs
3
+ startUrls:
4
+ - https://docs.nado.xyz/
5
+ allowedHosts:
6
+ - docs.nado.xyz
7
+ discovery:
8
+ include:
9
+ - https://docs.nado.xyz/**
10
+ exclude: []
11
+ maxPages: 500
12
+ extract:
13
+ strategy: clipboardButton
14
+ interactions:
15
+ - action: click
16
+ selector: button[aria-label="More"]
17
+ - action: click
18
+ selector: '[role="menuitem"]:has-text("Copy page")'
19
+ normalize:
20
+ prependSourceComment: true
21
+ schedule:
22
+ everyHours: 24
@@ -0,0 +1,24 @@
1
+ id: synthetix
2
+ label: Synthetix Docs
3
+ startUrls:
4
+ - https://developers.synthetix.io/
5
+ allowedHosts:
6
+ - developers.synthetix.io
7
+ discovery:
8
+ include:
9
+ - https://developers.synthetix.io/**
10
+ exclude: []
11
+ maxPages: 500
12
+ extract:
13
+ strategy: clipboardButton
14
+ interactions:
15
+ - action: hover
16
+ selector: .vocs_AiCtaDropdown
17
+ - action: click
18
+ selector: .vocs_AiCtaDropdown_buttonRight
19
+ - action: click
20
+ selector: '[role="menuitem"]:has-text("Copy")'
21
+ normalize:
22
+ prependSourceComment: true
23
+ schedule:
24
+ everyHours: 24