@agentskit/doc-bridge 0.1.0-alpha.1
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/CHANGELOG.md +28 -0
- package/CODE_OF_CONDUCT.md +7 -0
- package/CONTRIBUTING.md +32 -0
- package/LICENSE +21 -0
- package/README.md +137 -0
- package/SECURITY.md +24 -0
- package/bin/ak-docs.js +6 -0
- package/dist/cli/program.d.ts +3 -0
- package/dist/cli/program.js +3155 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +361 -0
- package/dist/config/index.js.map +1 -0
- package/dist/index-CD_zmKXf.d.ts +932 -0
- package/dist/index.d.ts +1608 -0
- package/dist/index.js +2566 -0
- package/dist/index.js.map +1 -0
- package/docs/POSITIONING.md +78 -0
- package/docs/RELEASE.md +75 -0
- package/docs/chat-and-rag.md +48 -0
- package/docs/examples.md +50 -0
- package/docs/getting-started.md +111 -0
- package/docs/mcp.md +50 -0
- package/docs/schemas/agent-handoff-v1.md +32 -0
- package/docs/schemas/doc-bridge-index-v1.md +71 -0
- package/docs/schemas/memory-candidate-v1.md +32 -0
- package/docs/spec/cli.md +137 -0
- package/docs/spec/config-v1.md +625 -0
- package/docs/spec/playbook-feedback.md +77 -0
- package/docs/spec/registry-agents.md +65 -0
- package/examples/docusaurus-only.config.ts +18 -0
- package/examples/docusaurus-with-memory.config.ts +37 -0
- package/examples/fumadocs-only.config.ts +18 -0
- package/examples/fumadocs-with-chat.config.ts +42 -0
- package/examples/minimal-plain-markdown.config.ts +13 -0
- package/examples/pnpm-monorepo.config.ts +19 -0
- package/package.json +105 -0
package/docs/RELEASE.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Release checklist — `@agentskit/doc-bridge`
|
|
2
|
+
|
|
3
|
+
## Pre-flight (local)
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pnpm install
|
|
7
|
+
pnpm typecheck
|
|
8
|
+
pnpm test
|
|
9
|
+
pnpm build
|
|
10
|
+
pnpm smoke:packaged
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Expect: packaged smoke prints `packaged smoke passed` and includes demo `query package example --agent`.
|
|
14
|
+
|
|
15
|
+
## Version
|
|
16
|
+
|
|
17
|
+
Alpha versions use Changesets:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm changeset # if new entry needed
|
|
21
|
+
pnpm version-packages # bumps package.json + CHANGELOG from .changeset/*
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Current track: `0.1.0-alpha.x`.
|
|
25
|
+
|
|
26
|
+
## Publish (npm)
|
|
27
|
+
|
|
28
|
+
Requires npm auth for the `@agentskit` org (`npm whoami` / `NPM_TOKEN`).
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm release
|
|
32
|
+
# equivalent:
|
|
33
|
+
# pnpm build && pnpm test && changeset publish
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or one-shot after version bump:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm publish --access public
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Confirm:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm view @agentskit/doc-bridge version
|
|
46
|
+
npx ak-docs@0.1.0-alpha.x --version
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## GitHub
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
git tag v0.1.0-alpha.x
|
|
53
|
+
git push origin master --tags
|
|
54
|
+
gh release create v0.1.0-alpha.x --title "v0.1.0-alpha.x" --notes-file CHANGELOG.md
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Post-publish smoke (fresh machine)
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm i -D @agentskit/doc-bridge@0.1.0-alpha.x
|
|
61
|
+
npx ak-docs init
|
|
62
|
+
npx ak-docs index
|
|
63
|
+
npx ak-docs query package example --agent
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Ecosystem dogfood (after npm is live)
|
|
67
|
+
|
|
68
|
+
1. **for-agents** — https://www.agentskit.io/docs/for-agents — add `doc-bridge.config` + CI gate in AgentsKit docs monorepo
|
|
69
|
+
2. **Playbook** — https://playbook.agentskit.io/llms.txt — federation source already used in smoke
|
|
70
|
+
3. **Registry** — https://registry.agentskit.io/ — ship `llms.txt` + link doc-bridge as onboarding companion
|
|
71
|
+
|
|
72
|
+
## Do not claim
|
|
73
|
+
|
|
74
|
+
- Chat/RAG works without installing Layer 1 peers
|
|
75
|
+
- Private monorepos as the public proof of scale
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Chat and RAG (Layer 1)
|
|
2
|
+
|
|
3
|
+
Layer 0 (index, handoff, MCP, gates, memory pipeline) never requires an LLM.
|
|
4
|
+
|
|
5
|
+
Layer 1 is **opt-in** and dogfoods public AgentsKit packages:
|
|
6
|
+
|
|
7
|
+
| Peer | Role |
|
|
8
|
+
|------|------|
|
|
9
|
+
| `@agentskit/rag` | Chunk, embed, ingest, search |
|
|
10
|
+
| `@agentskit/memory` | `fileVectorMemory` under `.doc-bridge/vectors` |
|
|
11
|
+
| `@agentskit/adapters` | Chat model + embedder (ollama, openai, …) |
|
|
12
|
+
| `@agentskit/ink` | Terminal chat UI (`ak-docs chat`) |
|
|
13
|
+
| `react` | Required by Ink |
|
|
14
|
+
|
|
15
|
+
## Trust model
|
|
16
|
+
|
|
17
|
+
1. **`handoffFirst`** (default): if the question mentions a known package id, attach deterministic AgentHandoff context before the model answers.
|
|
18
|
+
2. RAG retrieves from the indexed agent corpus (and configured sources).
|
|
19
|
+
3. CI gates still decide merge truth — chat never auto-writes docs.
|
|
20
|
+
|
|
21
|
+
## Commands
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ak-docs rag ingest
|
|
25
|
+
ak-docs rag search "<query>"
|
|
26
|
+
ak-docs chat
|
|
27
|
+
ak-docs ask "<question>" --chat
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Missing peers produce an install hint instead of a silent no-op.
|
|
31
|
+
|
|
32
|
+
## Providers
|
|
33
|
+
|
|
34
|
+
| provider | Notes |
|
|
35
|
+
|----------|--------|
|
|
36
|
+
| `ollama` | Best zero-cloud path; uses `ollamaEmbedder` (e.g. `nomic-embed-text`) |
|
|
37
|
+
| `openai` | Chat + `text-embedding-3-small` |
|
|
38
|
+
| `openrouter` | Chat via OpenRouter |
|
|
39
|
+
| `anthropic` | Chat; embeddings currently need `OPENAI_API_KEY` or use ollama |
|
|
40
|
+
|
|
41
|
+
## Config sketch
|
|
42
|
+
|
|
43
|
+
See `examples/fumadocs-with-chat.config.ts`.
|
|
44
|
+
|
|
45
|
+
## When not to use Layer 1
|
|
46
|
+
|
|
47
|
+
- You only need routing for coding agents → Layer 0 is enough.
|
|
48
|
+
- You already have another RAG stack → keep Layer 0 handoffs; skip peers.
|
package/docs/examples.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
Config sketches under [`examples/`](../examples/):
|
|
4
|
+
|
|
5
|
+
| File | Profile |
|
|
6
|
+
|------|---------|
|
|
7
|
+
| `minimal-plain-markdown.config.ts` | Solo markdown, Layer 0 only |
|
|
8
|
+
| `pnpm-monorepo.config.ts` | Workspace discovery + ownership |
|
|
9
|
+
| `fumadocs-only.config.ts` | Human bridge via Fumadocs |
|
|
10
|
+
| `docusaurus-only.config.ts` | Human bridge via Docusaurus |
|
|
11
|
+
| `fumadocs-with-chat.config.ts` | Standard + intelligence (AgentsKit peers) |
|
|
12
|
+
| `docusaurus-with-memory.config.ts` | Assisted memory promotion path |
|
|
13
|
+
|
|
14
|
+
## Ownership without monorepo
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"schemaVersion": 1,
|
|
19
|
+
"corpus": { "agent": { "root": "docs/for-agents" } },
|
|
20
|
+
"routing": {
|
|
21
|
+
"options": {
|
|
22
|
+
"ownership": {
|
|
23
|
+
"auth": {
|
|
24
|
+
"path": "src/auth",
|
|
25
|
+
"purpose": "Authentication",
|
|
26
|
+
"checks": ["npm test -- auth"]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Or frontmatter on an agent doc:
|
|
35
|
+
|
|
36
|
+
```md
|
|
37
|
+
---
|
|
38
|
+
package: auth
|
|
39
|
+
editRoot: src/auth
|
|
40
|
+
checks: [npm test -- auth]
|
|
41
|
+
---
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Public ecosystem surfaces
|
|
45
|
+
|
|
46
|
+
doc-bridge is designed to be consumed by:
|
|
47
|
+
|
|
48
|
+
- https://www.agentskit.io/docs/for-agents
|
|
49
|
+
- https://registry.agentskit.io/
|
|
50
|
+
- https://playbook.agentskit.io/llms.txt
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Getting started
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm i -D @agentskit/doc-bridge
|
|
7
|
+
# or
|
|
8
|
+
pnpm add -D @agentskit/doc-bridge
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
CLI binary: **`ak-docs`**.
|
|
12
|
+
|
|
13
|
+
## Two-minute path (no API key)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ak-docs init # config + demo ownership + AGENTS.md snippet
|
|
17
|
+
ak-docs index
|
|
18
|
+
ak-docs query package example --agent
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
You should see an **AgentHandoff** with `startHere`, `editRoots`, and `checks`.
|
|
22
|
+
|
|
23
|
+
Useful follow-ups:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
ak-docs list packages --text
|
|
27
|
+
ak-docs ask "where do I change example?"
|
|
28
|
+
ak-docs gate run
|
|
29
|
+
ak-docs mcp
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`init --no-demo` skips the starter module if you want an empty corpus.
|
|
33
|
+
|
|
34
|
+
## Configuration
|
|
35
|
+
|
|
36
|
+
Default: `doc-bridge.config.json` (also `.ts` / `.js` / `package.json#docBridge`).
|
|
37
|
+
|
|
38
|
+
**Required:** `schemaVersion: 1` + `corpus.agent.root`.
|
|
39
|
+
|
|
40
|
+
Ownership (any one of these):
|
|
41
|
+
|
|
42
|
+
1. `routing.options.ownership`
|
|
43
|
+
2. Frontmatter on agent docs: `package` + `editRoot`
|
|
44
|
+
3. Monorepo plugin (`pnpm-monorepo` + workspace discovery)
|
|
45
|
+
|
|
46
|
+
Project root for `--config path/to/doc-bridge.config.json` is the **directory of that file**.
|
|
47
|
+
|
|
48
|
+
See [config-v1](./spec/config-v1.md) and [examples](./examples.md).
|
|
49
|
+
|
|
50
|
+
## MCP (Cursor / Claude)
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"ak-docs": {
|
|
56
|
+
"command": "ak-docs",
|
|
57
|
+
"args": ["mcp"]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Tools: `handoff.resolve`, `doc.search`, `doc.get`, `gate.status`, …
|
|
64
|
+
|
|
65
|
+
## Human ↔ agent bridge
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# After configuring corpus.human (fumadocs | docusaurus | plain-markdown)
|
|
69
|
+
ak-docs index
|
|
70
|
+
ak-docs query package <id> --agent # includes humanDoc when linked
|
|
71
|
+
ak-docs gate run human-guide-links
|
|
72
|
+
ak-docs bootstrap agent-docs # draft agent docs from human site
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Memory → project docs
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
ak-docs memory ingest
|
|
79
|
+
ak-docs memory classify
|
|
80
|
+
ak-docs memory promote # draft only — never auto-merges
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Sources include `.agent-memory/**` and `.cursor/rules/*.mdc`.
|
|
84
|
+
|
|
85
|
+
## Optional chat + RAG (AgentsKit)
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npm i -D @agentskit/rag @agentskit/ink @agentskit/adapters @agentskit/memory react
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Enable in config:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"intelligence": {
|
|
96
|
+
"enabled": true,
|
|
97
|
+
"adapter": { "provider": "ollama", "model": "llama3.2" },
|
|
98
|
+
"chat": { "enabled": true, "handoffFirst": true, "sources": ["agent", "human"] }
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
ak-docs index
|
|
105
|
+
ak-docs rag ingest
|
|
106
|
+
ak-docs rag search "authentication boundaries"
|
|
107
|
+
ak-docs chat
|
|
108
|
+
ak-docs ask "how does auth work?" --chat
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Details: [chat-and-rag.md](./chat-and-rag.md).
|
package/docs/mcp.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# MCP setup
|
|
2
|
+
|
|
3
|
+
## Cursor / Claude Desktop / Codex-style
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
{
|
|
7
|
+
"mcpServers": {
|
|
8
|
+
"ak-docs": {
|
|
9
|
+
"command": "npx",
|
|
10
|
+
"args": ["ak-docs", "mcp"],
|
|
11
|
+
"cwd": "/absolute/path/to/your/repo"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or with a global/local bin:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"mcpServers": {
|
|
22
|
+
"ak-docs": {
|
|
23
|
+
"command": "ak-docs",
|
|
24
|
+
"args": ["mcp"]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Run from the repo root (or pass config discovery that resolves to it). Always `ak-docs index` after doc changes (or gate in CI).
|
|
31
|
+
|
|
32
|
+
## Tools
|
|
33
|
+
|
|
34
|
+
| Tool | Purpose |
|
|
35
|
+
|------|---------|
|
|
36
|
+
| `handoff.resolve` | Package/ownership → AgentHandoff |
|
|
37
|
+
| `doc.search` | Deterministic index search |
|
|
38
|
+
| `doc.get` | Read an indexed agent doc |
|
|
39
|
+
| `gate.status` | Freshness / configured gates |
|
|
40
|
+
| `retriever.query` | Local retriever chunks |
|
|
41
|
+
| `memory.classify` / `memory.promoteDraft` | Memory pipeline |
|
|
42
|
+
|
|
43
|
+
## Agent guidance (paste into AGENTS.md)
|
|
44
|
+
|
|
45
|
+
Before editing a package:
|
|
46
|
+
|
|
47
|
+
1. Call `handoff.resolve` with the package id
|
|
48
|
+
2. Open `startHere`
|
|
49
|
+
3. Stay inside `editRoots`
|
|
50
|
+
4. Run `checks` before claiming done
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# AgentHandoff v1
|
|
2
|
+
|
|
3
|
+
Zod schema: `AgentHandoffV1Schema` in `@agentskit/doc-bridge`.
|
|
4
|
+
|
|
5
|
+
Portable JSON Schema export: `AgentHandoffV1JsonSchema`.
|
|
6
|
+
|
|
7
|
+
## Shape
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"type": "agent-handoff",
|
|
12
|
+
"schemaVersion": 1,
|
|
13
|
+
"source": ".doc-bridge/index.json",
|
|
14
|
+
"target": { "type": "package", "id": "auth" },
|
|
15
|
+
"startHere": "docs/for-agents/modules/auth.md",
|
|
16
|
+
"readBeforeEditing": ["docs/for-agents/modules/auth.md", "AGENTS.md"],
|
|
17
|
+
"editRoots": ["src/auth/"],
|
|
18
|
+
"checks": ["npm test -- auth"],
|
|
19
|
+
"humanDoc": "/docs/guides/authentication",
|
|
20
|
+
"notes": ["Authentication module"]
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Legacy compatibility
|
|
25
|
+
|
|
26
|
+
Legacy `--agent` payloads may omit `schemaVersion`. Use `normalizeAgentHandoff()` or `safeParseAgentHandoff()` to upgrade.
|
|
27
|
+
|
|
28
|
+
## CLI validation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
ak-docs validate-handoff ./handoff.json
|
|
32
|
+
```
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# DocBridgeIndex v1
|
|
2
|
+
|
|
3
|
+
Zod schema: `DocBridgeIndexV1Schema` in `@agentskit/doc-bridge`.
|
|
4
|
+
|
|
5
|
+
Portable JSON Schema export: `DocBridgeIndexV1JsonSchema`.
|
|
6
|
+
|
|
7
|
+
## Shape
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"schemaVersion": 1,
|
|
12
|
+
"contentHash": "df701207f5f3663d3e0a5d0e257c7ce1b8f2898ef8e1ea1fe91d5289ec74bb3c",
|
|
13
|
+
"contentHashAlgo": "sha256-normalized-v1",
|
|
14
|
+
"generatedAt": "2026-07-09T00:00:00.000Z",
|
|
15
|
+
"project": { "name": "my-project", "root": "." },
|
|
16
|
+
"knowledge": [
|
|
17
|
+
{
|
|
18
|
+
"id": "auth",
|
|
19
|
+
"type": "agent-doc",
|
|
20
|
+
"title": "Authentication",
|
|
21
|
+
"path": "docs/for-agents/auth.md",
|
|
22
|
+
"description": "Auth ownership and edit workflow."
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"handoffs": {
|
|
26
|
+
"auth": {
|
|
27
|
+
"type": "agent-handoff",
|
|
28
|
+
"schemaVersion": 1,
|
|
29
|
+
"source": ".doc-bridge/index.json",
|
|
30
|
+
"target": { "type": "package", "id": "auth", "path": "packages/auth" },
|
|
31
|
+
"startHere": "docs/for-agents/auth.md",
|
|
32
|
+
"readBeforeEditing": ["docs/for-agents/auth.md", "AGENTS.md"],
|
|
33
|
+
"editRoots": ["packages/auth"],
|
|
34
|
+
"checks": ["npm test -- auth"],
|
|
35
|
+
"notes": ["Authentication package"]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"lookup": {
|
|
39
|
+
"packages": ["auth"],
|
|
40
|
+
"ownership": {
|
|
41
|
+
"auth": {
|
|
42
|
+
"id": "auth",
|
|
43
|
+
"path": "packages/auth",
|
|
44
|
+
"checks": ["npm test -- auth"],
|
|
45
|
+
"agentDoc": "docs/for-agents/auth.md"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Content Hash
|
|
53
|
+
|
|
54
|
+
`contentHashAlgo` is `sha256-normalized-v1`.
|
|
55
|
+
|
|
56
|
+
The hash input is deterministic JSON containing only:
|
|
57
|
+
|
|
58
|
+
- `schemaVersion`
|
|
59
|
+
- `knowledge`
|
|
60
|
+
- `handoffs`
|
|
61
|
+
- `lookup`
|
|
62
|
+
|
|
63
|
+
`generatedAt` is not part of the hash input. When the hash is unchanged, `ak-docs index` preserves the existing `generatedAt` so regenerated `index.json` bytes stay stable.
|
|
64
|
+
|
|
65
|
+
## Validation
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import { parseDocBridgeIndex } from '@agentskit/doc-bridge'
|
|
69
|
+
|
|
70
|
+
const index = parseDocBridgeIndex(JSON.parse(raw))
|
|
71
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# MemoryCandidate v1
|
|
2
|
+
|
|
3
|
+
Zod schema: `MemoryCandidateV1Schema` in `@agentskit/doc-bridge`.
|
|
4
|
+
|
|
5
|
+
Portable JSON Schema export: `MemoryCandidateV1JsonSchema`.
|
|
6
|
+
|
|
7
|
+
This is the normalized draft shape for memory ingestion. Layer 0 ships deterministic local ingest for Cursor rules and `.agent-memory/**/*.md`; classification and promotion are planned.
|
|
8
|
+
|
|
9
|
+
## Shape
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"schemaVersion": 1,
|
|
14
|
+
"id": "auth-abort-signal",
|
|
15
|
+
"source": "agent-memory",
|
|
16
|
+
"rawPath": ".agent-memory/auth.md",
|
|
17
|
+
"fact": "Auth handlers must forward AbortSignal.",
|
|
18
|
+
"why": "Run cancellation must stop network work.",
|
|
19
|
+
"howToApply": "Use AbortSignal.any([caller, AbortSignal.timeout(ms)]).",
|
|
20
|
+
"suggestedType": "project",
|
|
21
|
+
"confidence": 0.8,
|
|
22
|
+
"references": ["docs/for-agents/auth.md"]
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Validation
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { parseMemoryCandidate } from '@agentskit/doc-bridge'
|
|
30
|
+
|
|
31
|
+
const candidate = parseMemoryCandidate(JSON.parse(raw))
|
|
32
|
+
```
|
package/docs/spec/cli.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# ak-docs CLI
|
|
2
|
+
|
|
3
|
+
Command-line interface for **`@agentskit/doc-bridge`**. The npm package is scoped; the **only published binary** is `ak-docs`.
|
|
4
|
+
|
|
5
|
+
## Naming
|
|
6
|
+
|
|
7
|
+
| What | Name |
|
|
8
|
+
|------|------|
|
|
9
|
+
| npm package | `@agentskit/doc-bridge` |
|
|
10
|
+
| CLI binary | `ak-docs` |
|
|
11
|
+
| Config file | `doc-bridge.config.ts` |
|
|
12
|
+
| GitHub repo | `AgentsKit-io/doc-bridge` |
|
|
13
|
+
|
|
14
|
+
Install the package, run `ak-docs` — not `doc-bridge` on the shell.
|
|
15
|
+
|
|
16
|
+
## Why a separate binary
|
|
17
|
+
|
|
18
|
+
| Choice | Rationale |
|
|
19
|
+
|--------|-----------|
|
|
20
|
+
| **`ak-docs`**, not `agentskit docs` | Dedicated tool; no need for full `@agentskit/cli` |
|
|
21
|
+
| **`ak-docs`**, not an OS subcommand | OS CLIs imply sidecar / runs / pipelines |
|
|
22
|
+
| **`@agentskit/doc-bridge` package** | Part of AgentsKit npm scope; engine + first consumer alignment |
|
|
23
|
+
| **`ak-docs` bin name** | Short, memorable CLI; avoids colliding with package import path |
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @agentskit/doc-bridge
|
|
29
|
+
# or
|
|
30
|
+
pnpm add -D @agentskit/doc-bridge
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"name": "@agentskit/doc-bridge",
|
|
36
|
+
"bin": {
|
|
37
|
+
"ak-docs": "./bin/ak-docs.js"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Commands (v1)
|
|
43
|
+
|
|
44
|
+
### Layer 0 — no API key
|
|
45
|
+
|
|
46
|
+
| Command | Description |
|
|
47
|
+
|---------|-------------|
|
|
48
|
+
| `ak-docs init` | Scaffold `doc-bridge.config.json` + agent INDEX stub |
|
|
49
|
+
| `ak-docs init --scaffold-workspaces` | Also create draft `docs/for-agents/packages/*.md` from discovered pnpm workspaces; never overwrites existing docs |
|
|
50
|
+
| `ak-docs bootstrap agent-docs` | Create draft `docs/for-agents/human/*.md` from configured human-doc adapters; never overwrites existing docs |
|
|
51
|
+
| `ak-docs validate-config` | Zod-validate config file |
|
|
52
|
+
| `ak-docs index` | Build `DocBridgeIndex` + optional `llms.txt` |
|
|
53
|
+
| `ak-docs query <target> [--agent] [--text]` | Resolve package/module/intent/change → handoff JSON or text |
|
|
54
|
+
| `ak-docs search <term> [--agent] [--text]` | Full-text search over index |
|
|
55
|
+
| `ak-docs ask <question>` | Human-readable local consult mode: search + best match + next handoff commands; no LLM |
|
|
56
|
+
| `ak-docs ask` | Interactive local REPL in a TTY; commands: `search <term>`, `read <id-or-path>`, `open <id-or-path>`, `resolve <id>`, `gate [id]`, `exit` |
|
|
57
|
+
| `ak-docs retrieve <query>` | Hybrid local/federated retriever chunks; deterministic local first |
|
|
58
|
+
| `ak-docs init --demo` / default | Scaffold demo ownership (`example`) + `AGENTS.md` snippet so `query --agent` works immediately |
|
|
59
|
+
| `ak-docs init --no-demo` | Config + empty INDEX only |
|
|
60
|
+
| `ak-docs memory ingest` | Normalize local memory files (`.agent-memory/**/*.md`, `.cursor/rules/*.mdc`) into `MemoryCandidate[]` |
|
|
61
|
+
| `ak-docs memory classify` | Deterministically route candidates to agent/human/playbook/discard |
|
|
62
|
+
| `ak-docs memory promote` | Build draft-only promotion body with safety scan; never auto-merges |
|
|
63
|
+
| `ak-docs registry topology` | Print the `doc-curator` topology for AgentsKit/Registry composition |
|
|
64
|
+
| `ak-docs playbook draft` | Build a draft Playbook feedback payload from local memory candidates |
|
|
65
|
+
| `ak-docs list <kind> [--text]` | List packages, apps, intents, … |
|
|
66
|
+
| `ak-docs gate run [index-freshness]` | Check generated index freshness |
|
|
67
|
+
| `ak-docs mcp` | Start MCP server (stdio default) |
|
|
68
|
+
|
|
69
|
+
### Layer 1 — optional AgentsKit peers (`intelligence.enabled`)
|
|
70
|
+
|
|
71
|
+
| Command | Description |
|
|
72
|
+
|---------|-------------|
|
|
73
|
+
| `ak-docs rag ingest` | Ingest agent corpus into `@agentskit/rag` + file vector store |
|
|
74
|
+
| `ak-docs rag search <query>` | Semantic search over ingested vectors |
|
|
75
|
+
| `ak-docs chat` | Interactive terminal chat (`@agentskit/ink` + retriever + adapter) |
|
|
76
|
+
| `ak-docs ask <question> --chat` | One-shot grounded answer (`handoffFirst` when possible) |
|
|
77
|
+
|
|
78
|
+
Peers: `@agentskit/rag`, `@agentskit/ink`, `@agentskit/adapters`, `@agentskit/memory`, `react`.
|
|
79
|
+
|
|
80
|
+
## Global flags
|
|
81
|
+
|
|
82
|
+
| Flag | Description |
|
|
83
|
+
|------|-------------|
|
|
84
|
+
| `--config <path>` | Config file (default: auto-discover) |
|
|
85
|
+
| `--json` / `--text` | Output format for non-agent commands (default: json); `--agent` always emits agent JSON |
|
|
86
|
+
| `--chat` | Request planned intelligence-backed ask mode; errors clearly until `intelligence.adapter` and RAG/chat support are configured |
|
|
87
|
+
| `--help` | Command help |
|
|
88
|
+
|
|
89
|
+
## Examples
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
ak-docs index
|
|
93
|
+
ak-docs query ownership auth --agent
|
|
94
|
+
ak-docs query ownership auth --text
|
|
95
|
+
ak-docs search "sidecar transport" --agent
|
|
96
|
+
ak-docs list packages --text
|
|
97
|
+
ak-docs gate run
|
|
98
|
+
ak-docs mcp
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## MCP server config (Cursor)
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"mcpServers": {
|
|
106
|
+
"ak-docs": {
|
|
107
|
+
"command": "ak-docs",
|
|
108
|
+
"args": ["mcp"]
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Programmatic API
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
import { buildIndex, query, defineConfig } from '@agentskit/doc-bridge'
|
|
118
|
+
|
|
119
|
+
export default defineConfig({ schemaVersion: 1, corpus: { agent: { root: 'docs' } } })
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
CLI is a thin wrapper over the same exports.
|
|
123
|
+
|
|
124
|
+
`MCP_TOOLS` exports the static tool descriptors used by `tools/list`.
|
|
125
|
+
|
|
126
|
+
## Private Dogfood Alias
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
pnpm docs:internal:query … # private dogfood wrapper → ak-docs query …
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Private repo wrappers stay private. `ak-docs` is the only public binary.
|
|
133
|
+
|
|
134
|
+
## See also
|
|
135
|
+
|
|
136
|
+
- [config-v1.md](./config-v1.md)
|
|
137
|
+
- [POSITIONING.md](../POSITIONING.md)
|