@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
|
@@ -0,0 +1,625 @@
|
|
|
1
|
+
# doc-bridge config contract v1
|
|
2
|
+
|
|
3
|
+
`doc-bridge.config.ts` (or `.js`, `.mjs`, `.json`, or `package.json` → `docBridge`) is the alpha integration point for any project. Layer 0 fields are sufficient to run `index`, `query`, and MCP without an LLM.
|
|
4
|
+
|
|
5
|
+
| npm package | `@agentskit/doc-bridge` |
|
|
6
|
+
| CLI binary | `ak-docs` |
|
|
7
|
+
| Config file | `doc-bridge.config.ts` |
|
|
8
|
+
|
|
9
|
+
Standalone CLI — not merged into a framework or OS CLI.
|
|
10
|
+
|
|
11
|
+
## Design rules
|
|
12
|
+
|
|
13
|
+
1. **Progressive** — only `schemaVersion` + `corpus.agent` required; everything else defaults sensibly.
|
|
14
|
+
2. **Plugin-shaped** — doc sites and monorepo layout are plugins, not hardcoded paths.
|
|
15
|
+
3. **No provider in core** — adapter config lives under `intelligence`, never required.
|
|
16
|
+
4. **Deterministic output** — paths in config are resolved at build time; no timestamps in index hash input.
|
|
17
|
+
5. **One config per repo** — monorepo root config; packages inherit via `routing` / plugin discovery.
|
|
18
|
+
|
|
19
|
+
## Discovery order
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
doc-bridge.config.ts
|
|
23
|
+
doc-bridge.config.mts
|
|
24
|
+
doc-bridge.config.js
|
|
25
|
+
doc-bridge.config.mjs
|
|
26
|
+
doc-bridge.config.json
|
|
27
|
+
package.json → "docBridge" field (subset, JSON only)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
TypeScript/JavaScript configs are static in v0.1 alpha: `defineConfig` imports are supported, but arbitrary imports are not. YAML config files are planned.
|
|
31
|
+
|
|
32
|
+
## TypeScript shape (authoritative)
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import type { DocBridgeConfigV1 } from '@agentskit/doc-bridge/config'
|
|
36
|
+
|
|
37
|
+
export default {
|
|
38
|
+
schemaVersion: 1,
|
|
39
|
+
|
|
40
|
+
/** Optional display name; defaults to package.json name or directory basename */
|
|
41
|
+
project?: { name?: string; root?: string }
|
|
42
|
+
|
|
43
|
+
/** Agent-readable knowledge (required) */
|
|
44
|
+
corpus: {
|
|
45
|
+
agent: AgentCorpusConfig
|
|
46
|
+
human?: HumanCorpusConfig | HumanCorpusConfig[]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Where deterministic artifacts are written */
|
|
50
|
+
index?: IndexConfig
|
|
51
|
+
|
|
52
|
+
/** Ownership, intents, change routes — monorepo plugin fills this */
|
|
53
|
+
routing?: RoutingConfig
|
|
54
|
+
|
|
55
|
+
/** CI gate presets */
|
|
56
|
+
gates?: GatesConfig
|
|
57
|
+
|
|
58
|
+
/** CLI + MCP surfaces */
|
|
59
|
+
surfaces?: SurfacesConfig
|
|
60
|
+
|
|
61
|
+
/** Optional: chat, memory, retriever — any provider */
|
|
62
|
+
intelligence?: IntelligenceConfig
|
|
63
|
+
|
|
64
|
+
/** Optional: Playbook / Registry / remote OKF bundles */
|
|
65
|
+
federation?: FederationConfig
|
|
66
|
+
} satisfies DocBridgeConfigV1
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## `corpus.agent` (required)
|
|
72
|
+
|
|
73
|
+
Agent corpus = dense markdown for coding agents (OKF or for-agents layout).
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
type AgentCorpusConfig = {
|
|
77
|
+
/** Root directory, relative to project root */
|
|
78
|
+
root: string // e.g. 'docs/for-agents' | '.agent-docs' | 'docs'
|
|
79
|
+
|
|
80
|
+
/** Jump table entrypoint (recommended) */
|
|
81
|
+
index?: string // default: '{root}/INDEX.md'
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Glob patterns under root, relative to root.
|
|
85
|
+
* Default: ['**/*.md'] excluding INDEX conventions
|
|
86
|
+
*/
|
|
87
|
+
include?: string[]
|
|
88
|
+
exclude?: string[] // default: ['**/node_modules/**', '**/.git/**']
|
|
89
|
+
|
|
90
|
+
/** OKF frontmatter: require `type` field (soft warn vs hard gate) */
|
|
91
|
+
okf?: {
|
|
92
|
+
requireType?: boolean // default: false (warn); true in strict preset
|
|
93
|
+
allowedTypes?: string[] // optional vocabulary enforcement
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Minimal solo project
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
corpus: {
|
|
102
|
+
agent: { root: 'docs' }
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## `corpus.human` (optional)
|
|
109
|
+
|
|
110
|
+
Human wiki / doc site. **Always via plugin** — doc-bridge does not ship a site generator.
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
type HumanCorpusConfig = {
|
|
114
|
+
plugin: HumanCorpusPluginId
|
|
115
|
+
/** Plugin-specific options (see plugin docs) */
|
|
116
|
+
options?: Record<string, unknown>
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
type HumanCorpusPluginId =
|
|
120
|
+
| 'plain-markdown' // docs/**/*.md, frontmatter `package`/`module`/`id`
|
|
121
|
+
| 'fumadocs' // markdown scan with index routes, (group) slugs, pages allowlists
|
|
122
|
+
| 'docusaurus' // markdown scan with id/slug frontmatter + static sidebars.js
|
|
123
|
+
| 'mkdocs' // planned
|
|
124
|
+
| 'vitepress' // planned
|
|
125
|
+
| 'custom' // path to user plugin module
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Bridge to agent docs
|
|
129
|
+
|
|
130
|
+
When `corpus.human` is set, plugins MUST:
|
|
131
|
+
|
|
132
|
+
1. Emit resolvable `humanDoc` URLs/paths into `AgentHandoff`
|
|
133
|
+
2. Support `## Human guide` link validation (gate `human-guide-links`)
|
|
134
|
+
3. Map by stable id (`packageId`, `moduleId`, `slug`) — config defines the join key
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
corpus: {
|
|
138
|
+
agent: { root: 'docs/for-agents' },
|
|
139
|
+
human: {
|
|
140
|
+
plugin: 'fumadocs',
|
|
141
|
+
options: {
|
|
142
|
+
contentDir: 'apps/web/content/docs',
|
|
143
|
+
urlPrefix: '/docs', // public path prefix
|
|
144
|
+
metaFile: 'meta.json',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Multiple human corpora (e.g. marketing + internal):
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
human: [
|
|
154
|
+
{ plugin: 'fumadocs', options: { contentDir: 'apps/web/content/docs', urlPrefix: '/docs' } },
|
|
155
|
+
{ plugin: 'plain-markdown', options: { root: 'docs/internal', urlPrefix: null } },
|
|
156
|
+
]
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## `index` (optional)
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
type IndexConfig = {
|
|
165
|
+
/** Output path for DocBridgeIndex JSON */
|
|
166
|
+
outFile?: string // default: '.doc-bridge/index.json'
|
|
167
|
+
|
|
168
|
+
/** Optional llms.txt alongside index */
|
|
169
|
+
llmsTxt?: {
|
|
170
|
+
enabled?: boolean // default: true
|
|
171
|
+
outFile?: string // default: 'llms.txt' at project root
|
|
172
|
+
preamble?: string // project-specific intro paragraph
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** Optional Self-Describe companion artifact */
|
|
176
|
+
capabilities?: {
|
|
177
|
+
enabled?: boolean // default: true
|
|
178
|
+
outFile?: string // default: '.doc-bridge/capabilities.json'
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Hash algorithm for contentHash field */
|
|
182
|
+
contentHash?: 'sha256-normalized-v1' // only algo in v1
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## `routing` (optional — monorepo-first)
|
|
189
|
+
|
|
190
|
+
Without `routing`, handoffs are inferred from agent corpus links only. Monorepo plugin populates ownership graph.
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
type RoutingConfig = {
|
|
194
|
+
plugin?: 'pnpm-monorepo' | 'npm-workspaces' | 'yarn-workspaces' | 'custom'
|
|
195
|
+
|
|
196
|
+
options?: {
|
|
197
|
+
/** Workspace globs; default from package manager */
|
|
198
|
+
packages?: string[] // e.g. ['packages/*', 'apps/*']
|
|
199
|
+
|
|
200
|
+
/** Map package id → metadata (auto-discovered if omitted) */
|
|
201
|
+
ownership?: Record<string, OwnershipEntry>
|
|
202
|
+
|
|
203
|
+
/** Curated reading paths for tasks */
|
|
204
|
+
intents?: IntentEntry[]
|
|
205
|
+
|
|
206
|
+
/** "I want to change X" → start here */
|
|
207
|
+
changes?: ChangeRouteEntry[]
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
type OwnershipEntry = {
|
|
212
|
+
path: string // 'packages/auth'
|
|
213
|
+
group?: string // logical layer / team
|
|
214
|
+
layer?: string // L0–L4 or custom
|
|
215
|
+
purpose?: string // one line
|
|
216
|
+
checks?: string[] // default gates for this owner
|
|
217
|
+
agentDoc?: string // override path; default inferred
|
|
218
|
+
humanDoc?: string // filled by human plugin join
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
type IntentEntry = {
|
|
222
|
+
id: string // kebab-case
|
|
223
|
+
title: string
|
|
224
|
+
paths: string[] // read-before-editing list
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
type ChangeRouteEntry = {
|
|
228
|
+
id: string // e.g. 'add-api-endpoint'
|
|
229
|
+
title: string
|
|
230
|
+
startHere: string
|
|
231
|
+
relatedPackages?: string[]
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Join keys (agent ↔ human ↔ ownership)
|
|
236
|
+
|
|
237
|
+
| Entity | Primary key | Human plugin maps via |
|
|
238
|
+
|--------|-------------|------------------------|
|
|
239
|
+
| Package / module | `id` (folder name or `package.json` name) | frontmatter `package` or path convention |
|
|
240
|
+
| Screen / feature | `id` in `screens/` or `features/` | MDX slug |
|
|
241
|
+
| Flow / recipe | `id` in `flows/` | docs slug |
|
|
242
|
+
|
|
243
|
+
Plugins document their join convention; gates fail on orphan links.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## `gates` (optional)
|
|
248
|
+
|
|
249
|
+
```ts
|
|
250
|
+
type GatesConfig = {
|
|
251
|
+
preset?: 'minimal' | 'standard' | 'strict'
|
|
252
|
+
/** Enabled gate ids; merged with preset */
|
|
253
|
+
include?: GateId[]
|
|
254
|
+
exclude?: GateId[]
|
|
255
|
+
/** Gate-specific options */
|
|
256
|
+
options?: {
|
|
257
|
+
'human-guide-links'?: { strict?: boolean }
|
|
258
|
+
'index-freshness'?: { failOnDrift?: boolean }
|
|
259
|
+
'okf-type'?: { requireType?: boolean }
|
|
260
|
+
'docs-style'?: {
|
|
261
|
+
profile?: 'google-dev-docs' | 'playbook-okf' | 'custom'
|
|
262
|
+
required?: Array<
|
|
263
|
+
| 'title'
|
|
264
|
+
| 'purpose'
|
|
265
|
+
| 'audience'
|
|
266
|
+
| 'task-orientation'
|
|
267
|
+
| 'examples'
|
|
268
|
+
| 'owner-source'
|
|
269
|
+
| 'no-stale-wording'
|
|
270
|
+
>
|
|
271
|
+
}
|
|
272
|
+
'link-rot'?: { scanDirs?: string[] }
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
type GateId =
|
|
277
|
+
| 'index-freshness'
|
|
278
|
+
| 'human-guide-links'
|
|
279
|
+
| 'link-rot'
|
|
280
|
+
| 'okf-type'
|
|
281
|
+
| 'docs-style'
|
|
282
|
+
| 'routing-currency' // every workspace package appears in routing
|
|
283
|
+
| 'bootstrap-size' // AGENTS.md / CLAUDE.md line budgets
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
| Preset | Gates |
|
|
287
|
+
|--------|-------|
|
|
288
|
+
| `minimal` | `index-freshness` |
|
|
289
|
+
| `standard` | + `human-guide-links` in v0.1 alpha |
|
|
290
|
+
| `strict` | + `okf-type` in v0.1 alpha |
|
|
291
|
+
|
|
292
|
+
Implemented alpha gates: `index-freshness`, `human-guide-links`, `okf-type`, `docs-style`. `include` / `exclude` are applied to implemented gates only.
|
|
293
|
+
|
|
294
|
+
### Structural vs style validation
|
|
295
|
+
|
|
296
|
+
Alpha gates are deterministic lint checks, not editorial grading:
|
|
297
|
+
|
|
298
|
+
| Gate | Kind | What it proves |
|
|
299
|
+
|------|------|----------------|
|
|
300
|
+
| `index-freshness` | structural | Generated index matches current docs/config |
|
|
301
|
+
| `human-guide-links` | structural | Local `humanDoc` links resolve through configured human-doc adapters |
|
|
302
|
+
| `okf-type` | OKF lint | Agent docs have required `type:` frontmatter when strict/required |
|
|
303
|
+
| `docs-style` | style lint | Opt-in deterministic profile checks for title, purpose, audience, examples, owner/source, task orientation, and stale wording |
|
|
304
|
+
|
|
305
|
+
`docs-style` supports `google-dev-docs`, `playbook-okf`, and `custom` profiles. It is not part of the default alpha path and does not grade prose quality; it checks for explicit structural signals. LLM critique remains planned optional behavior.
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## `surfaces` (optional)
|
|
310
|
+
|
|
311
|
+
```ts
|
|
312
|
+
type SurfacesConfig = {
|
|
313
|
+
cli?: {
|
|
314
|
+
/** Published binary name (package.json bin) */
|
|
315
|
+
bin?: string // default: 'ak-docs'
|
|
316
|
+
/** Default output: json | text */
|
|
317
|
+
defaultFormat?: 'json' | 'text'
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
mcp?: {
|
|
321
|
+
enabled?: boolean // default: true
|
|
322
|
+
/** Tool ids to expose; default: core set */
|
|
323
|
+
tools?: McpToolId[]
|
|
324
|
+
transport?: 'stdio' | 'http'
|
|
325
|
+
http?: { port?: number; path?: string }
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
type McpToolId =
|
|
330
|
+
| 'handoff.resolve'
|
|
331
|
+
| 'doc.search' // deterministic index search
|
|
332
|
+
| 'doc.get'
|
|
333
|
+
| 'gate.status'
|
|
334
|
+
| 'playbook.pattern.get' // requires federation
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## `intelligence` (optional — any provider)
|
|
340
|
+
|
|
341
|
+
Absent `intelligence` = Layer 0 only. AgentsKit is the **reference implementation** of this block.
|
|
342
|
+
|
|
343
|
+
```ts
|
|
344
|
+
type IntelligenceConfig = {
|
|
345
|
+
/** When false, ignore all other intelligence fields */
|
|
346
|
+
enabled?: boolean // default: false
|
|
347
|
+
|
|
348
|
+
adapter?: {
|
|
349
|
+
/** Provider id or path to custom adapter module */
|
|
350
|
+
provider: 'openai' | 'anthropic' | 'ollama' | 'openrouter' | 'custom'
|
|
351
|
+
model?: string
|
|
352
|
+
/** Env var name for API key; never inline secrets in config */
|
|
353
|
+
apiKeyEnv?: string
|
|
354
|
+
baseUrl?: string
|
|
355
|
+
options?: Record<string, unknown>
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
chat?: {
|
|
359
|
+
enabled?: boolean
|
|
360
|
+
/** Corpus scopes for retrieval */
|
|
361
|
+
sources?: ('agent' | 'human' | 'federation')[]
|
|
362
|
+
/** Prefer deterministic handoff before RAG when confidence high */
|
|
363
|
+
handoffFirst?: boolean // default: true
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
retriever?: {
|
|
367
|
+
enabled?: boolean
|
|
368
|
+
/** local | remote | bm25-only */
|
|
369
|
+
mode?: 'local' | 'remote' | 'bm25'
|
|
370
|
+
embedModel?: string
|
|
371
|
+
chunkSize?: number
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
memory?: {
|
|
375
|
+
enabled?: boolean
|
|
376
|
+
adapters?: MemoryAdapterId[]
|
|
377
|
+
ingestDir?: string // default: '.agent-memory'
|
|
378
|
+
classify?: boolean // default: false — opt-in
|
|
379
|
+
promote?: {
|
|
380
|
+
enabled?: boolean
|
|
381
|
+
targets?: ('agent' | 'human' | 'agents-md')[]
|
|
382
|
+
requireApproval?: boolean // default: true
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/** Reference runtime; custom path for non-AgentsKit engines later */
|
|
387
|
+
runtime?: 'agentskit' | 'custom'
|
|
388
|
+
runtimeModule?: string
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
type MemoryAdapterId =
|
|
392
|
+
| 'playbook-memory' // .agent-memory/MEMORY.md layout
|
|
393
|
+
| 'cursor-rules' // .cursor/rules/*.mdc
|
|
394
|
+
| 'session-export' // manual JSON/md drop folder
|
|
395
|
+
| 'bootstrap-delta' // git diff on AGENTS.md
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
## `federation` (optional — ecosystem)
|
|
401
|
+
|
|
402
|
+
Not required for any project. Private dogfood enables this profile to validate scale; public consumers do not depend on private repos.
|
|
403
|
+
|
|
404
|
+
```ts
|
|
405
|
+
type FederationConfig = {
|
|
406
|
+
enabled?: boolean
|
|
407
|
+
sources?: FederationSource[]
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
type FederationSource = {
|
|
411
|
+
id: string // 'playbook' | 'agentskit' | custom
|
|
412
|
+
llmsTxt?: string // URL or local path
|
|
413
|
+
rawBaseUrl?: string // e.g. 'https://playbook.agentskit.io/raw'
|
|
414
|
+
includeInRetriever?: boolean
|
|
415
|
+
includeInChat?: boolean
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
Layer 0 exports a local retriever helper over `DocBridgeIndex`:
|
|
420
|
+
|
|
421
|
+
```ts
|
|
422
|
+
import { createDocBridgeRetriever } from '@agentskit/doc-bridge'
|
|
423
|
+
|
|
424
|
+
const retriever = createDocBridgeRetriever(index, { property: 'my-project' })
|
|
425
|
+
const chunks = retriever.retrieve('auth ownership')
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
Chunk keys are stable: `{property}:{type}:{id}`. Deterministic CLI search and exact handoff resolution stay first; semantic/RAG runtimes can inject this retriever and add federated sources later.
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
## `AgentHandoff` emission rules
|
|
433
|
+
|
|
434
|
+
When `ak-docs query <target> --agent` runs:
|
|
435
|
+
|
|
436
|
+
```ts
|
|
437
|
+
type AgentHandoffV1 = {
|
|
438
|
+
type: 'agent-handoff'
|
|
439
|
+
schemaVersion: 1
|
|
440
|
+
source: string // index.outFile path
|
|
441
|
+
target: { type: TargetType; id: string }
|
|
442
|
+
startHere: string
|
|
443
|
+
readBeforeEditing: string[]
|
|
444
|
+
editRoots: string[]
|
|
445
|
+
checks: string[]
|
|
446
|
+
humanDoc?: string | null
|
|
447
|
+
playbookPatterns?: string[] // only if federation enabled
|
|
448
|
+
notes: string[]
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
type TargetType =
|
|
452
|
+
| 'package' | 'module' | 'app'
|
|
453
|
+
| 'screen' | 'flow' | 'component'
|
|
454
|
+
| 'intent' | 'change'
|
|
455
|
+
| 'search' // --agent on search picks best match
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
**Merge precedence** (later wins):
|
|
459
|
+
|
|
460
|
+
1. Agent corpus frontmatter (`checks`, `humanDoc`)
|
|
461
|
+
2. `routing.ownership[id]`
|
|
462
|
+
3. `gates.preset` default checks
|
|
463
|
+
4. Global `handoff.defaults` (if set in future minor version)
|
|
464
|
+
|
|
465
|
+
---
|
|
466
|
+
|
|
467
|
+
## Example configs
|
|
468
|
+
|
|
469
|
+
### 1. Solo library (minimal)
|
|
470
|
+
|
|
471
|
+
```ts
|
|
472
|
+
// doc-bridge.config.ts
|
|
473
|
+
import { defineConfig } from '@agentskit/doc-bridge'
|
|
474
|
+
|
|
475
|
+
export default defineConfig({
|
|
476
|
+
schemaVersion: 1,
|
|
477
|
+
corpus: {
|
|
478
|
+
agent: {
|
|
479
|
+
root: 'docs',
|
|
480
|
+
index: 'docs/INDEX.md',
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
})
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
### 2. pnpm monorepo + ownership
|
|
487
|
+
|
|
488
|
+
```ts
|
|
489
|
+
import { defineConfig } from '@agentskit/doc-bridge'
|
|
490
|
+
|
|
491
|
+
export default defineConfig({
|
|
492
|
+
schemaVersion: 1,
|
|
493
|
+
corpus: {
|
|
494
|
+
agent: { root: 'docs/for-agents' },
|
|
495
|
+
},
|
|
496
|
+
routing: {
|
|
497
|
+
plugin: 'pnpm-monorepo',
|
|
498
|
+
options: {
|
|
499
|
+
packages: ['packages/*', 'apps/*'],
|
|
500
|
+
},
|
|
501
|
+
},
|
|
502
|
+
gates: { preset: 'standard' },
|
|
503
|
+
})
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### 3. Monorepo + Fumadocs (standard profile)
|
|
507
|
+
|
|
508
|
+
```ts
|
|
509
|
+
import { defineConfig } from '@agentskit/doc-bridge'
|
|
510
|
+
|
|
511
|
+
export default defineConfig({
|
|
512
|
+
schemaVersion: 1,
|
|
513
|
+
corpus: {
|
|
514
|
+
agent: { root: 'docs/for-agents' },
|
|
515
|
+
human: {
|
|
516
|
+
plugin: 'fumadocs',
|
|
517
|
+
options: {
|
|
518
|
+
contentDir: 'apps/web/content/docs',
|
|
519
|
+
urlPrefix: '/docs',
|
|
520
|
+
},
|
|
521
|
+
},
|
|
522
|
+
},
|
|
523
|
+
routing: { plugin: 'pnpm-monorepo' },
|
|
524
|
+
gates: { preset: 'standard' },
|
|
525
|
+
intelligence: {
|
|
526
|
+
enabled: true,
|
|
527
|
+
adapter: { provider: 'ollama', model: 'llama3', apiKeyEnv: '' },
|
|
528
|
+
chat: { enabled: true, handoffFirst: true },
|
|
529
|
+
},
|
|
530
|
+
})
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
### 4. Docusaurus + optional memory
|
|
534
|
+
|
|
535
|
+
```ts
|
|
536
|
+
import { defineConfig } from '@agentskit/doc-bridge'
|
|
537
|
+
|
|
538
|
+
export default defineConfig({
|
|
539
|
+
schemaVersion: 1,
|
|
540
|
+
corpus: {
|
|
541
|
+
agent: { root: '.agent-docs' },
|
|
542
|
+
human: {
|
|
543
|
+
plugin: 'docusaurus',
|
|
544
|
+
options: {
|
|
545
|
+
docsDir: 'website/docs',
|
|
546
|
+
sidebarsFile: 'website/sidebars.js',
|
|
547
|
+
urlPrefix: '/docs',
|
|
548
|
+
},
|
|
549
|
+
},
|
|
550
|
+
},
|
|
551
|
+
intelligence: {
|
|
552
|
+
enabled: true,
|
|
553
|
+
adapter: { provider: 'openrouter', model: 'openai/gpt-4o-mini', apiKeyEnv: 'OPENROUTER_API_KEY' },
|
|
554
|
+
chat: { enabled: true, sources: ['agent', 'human'] },
|
|
555
|
+
memory: {
|
|
556
|
+
enabled: true,
|
|
557
|
+
adapters: ['cursor-rules', 'playbook-memory'],
|
|
558
|
+
classify: true,
|
|
559
|
+
promote: { enabled: true, requireApproval: true },
|
|
560
|
+
},
|
|
561
|
+
},
|
|
562
|
+
})
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
### 5. JSON config (no TypeScript)
|
|
566
|
+
|
|
567
|
+
```json
|
|
568
|
+
{
|
|
569
|
+
"schemaVersion": 1,
|
|
570
|
+
"corpus": {
|
|
571
|
+
"agent": { "root": "docs/for-agents" }
|
|
572
|
+
},
|
|
573
|
+
"routing": {
|
|
574
|
+
"plugin": "npm-workspaces"
|
|
575
|
+
},
|
|
576
|
+
"gates": { "preset": "minimal" }
|
|
577
|
+
}
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
---
|
|
581
|
+
|
|
582
|
+
## CLI mapping
|
|
583
|
+
|
|
584
|
+
| Command | Config sections used |
|
|
585
|
+
|---------|---------------------|
|
|
586
|
+
| `ak-docs init` | scaffolds minimal `corpus.agent` + optional plugin prompt |
|
|
587
|
+
| `ak-docs index` | `corpus`, `routing`, `index`, plugins |
|
|
588
|
+
| `ak-docs query <t> --agent` | `index` + `routing` + handoff merge |
|
|
589
|
+
| `ak-docs search <q>` | `index` |
|
|
590
|
+
| `ak-docs retrieve <q>` | `index` + `federation` |
|
|
591
|
+
| `ak-docs gate run` | `gates` |
|
|
592
|
+
| `ak-docs mcp` | `surfaces.mcp` |
|
|
593
|
+
| `ak-docs chat` | planned; `intelligence.*` |
|
|
594
|
+
| `ak-docs memory ingest` | deterministic local ingest; `MemoryCandidate[]` |
|
|
595
|
+
| `ak-docs memory classify` | deterministic route classifier |
|
|
596
|
+
| `ak-docs memory promote` | draft promotion + safety scan |
|
|
597
|
+
| `ak-docs registry topology` | doc-curator topology |
|
|
598
|
+
| `ak-docs playbook draft` | draft Playbook feedback payload |
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
## Validation
|
|
603
|
+
|
|
604
|
+
- Config validated with **Zod** at CLI startup (`ak-docs validate-config`).
|
|
605
|
+
- Unknown `schemaVersion` → hard error with migration link.
|
|
606
|
+
- Unknown plugin id → hard error listing built-in + `custom` path.
|
|
607
|
+
- `intelligence.enabled: true` without `adapter` → warn + chat/memory subcommands disabled.
|
|
608
|
+
|
|
609
|
+
---
|
|
610
|
+
|
|
611
|
+
## Versioning
|
|
612
|
+
|
|
613
|
+
| Version | Scope |
|
|
614
|
+
|---------|-------|
|
|
615
|
+
| **v1** | This document. Additive fields only in v1.x. |
|
|
616
|
+
| **v2** | Breaking changes require `schemaVersion: 2` + codemod. |
|
|
617
|
+
|
|
618
|
+
---
|
|
619
|
+
|
|
620
|
+
## See also
|
|
621
|
+
|
|
622
|
+
- [POSITIONING.md](../POSITIONING.md)
|
|
623
|
+
- [AgentHandoff v1](../schemas/agent-handoff-v1.md)
|
|
624
|
+
- [DocBridgeIndex v1](../schemas/doc-bridge-index-v1.md)
|
|
625
|
+
- [MemoryCandidate v1](../schemas/memory-candidate-v1.md)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Playbook Feedback Promotion
|
|
2
|
+
|
|
3
|
+
doc-bridge can feed durable documentation learnings back into public patterns, but promotion must be explicit and reviewable.
|
|
4
|
+
|
|
5
|
+
## Finding Template
|
|
6
|
+
|
|
7
|
+
```md
|
|
8
|
+
---
|
|
9
|
+
type: Playbook Finding
|
|
10
|
+
source: doc-bridge
|
|
11
|
+
visibility: public-candidate
|
|
12
|
+
license: CC-BY-4.0
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Finding title
|
|
16
|
+
|
|
17
|
+
## Context
|
|
18
|
+
|
|
19
|
+
What happened, where it was observed, and why it matters.
|
|
20
|
+
|
|
21
|
+
## Evidence
|
|
22
|
+
|
|
23
|
+
Links to public docs, issue numbers, or redacted local references.
|
|
24
|
+
|
|
25
|
+
## Proposed Playbook Change
|
|
26
|
+
|
|
27
|
+
The smallest pattern, checklist, or raw doc update that should be drafted.
|
|
28
|
+
|
|
29
|
+
## Safety Review
|
|
30
|
+
|
|
31
|
+
- [ ] No secrets
|
|
32
|
+
- [ ] No private customer names
|
|
33
|
+
- [ ] No private repository paths
|
|
34
|
+
- [ ] Attribution preserved
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Promotion Pipeline
|
|
38
|
+
|
|
39
|
+
```yaml
|
|
40
|
+
id: playbook-feedback-promotion
|
|
41
|
+
version: 1
|
|
42
|
+
trigger:
|
|
43
|
+
manual: true
|
|
44
|
+
schedule: weekly
|
|
45
|
+
onContentHashDrift: optional
|
|
46
|
+
steps:
|
|
47
|
+
- id: collect
|
|
48
|
+
reads:
|
|
49
|
+
- ".agent-memory/**/*.md"
|
|
50
|
+
- "docs/for-agents/**/*.md"
|
|
51
|
+
- id: scan
|
|
52
|
+
checks:
|
|
53
|
+
- secrets
|
|
54
|
+
- pii
|
|
55
|
+
- private-paths
|
|
56
|
+
- id: draft
|
|
57
|
+
delegate: knowledge-promoter
|
|
58
|
+
output: draft-pr
|
|
59
|
+
- id: verify
|
|
60
|
+
checks:
|
|
61
|
+
- attribution-cc-by-4
|
|
62
|
+
- doc-bridge-gates
|
|
63
|
+
- id: review
|
|
64
|
+
requiresHuman: true
|
|
65
|
+
mergePolicy:
|
|
66
|
+
autoMerge: false
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Doc Bridge Pattern Stub
|
|
70
|
+
|
|
71
|
+
The public pattern should describe the trilogy:
|
|
72
|
+
|
|
73
|
+
- `AgentHandoff`: precise editing route for coding agents.
|
|
74
|
+
- OKF docs: knowledge files that can be linted and indexed.
|
|
75
|
+
- Self-Describe artifacts: `llms.txt`, `capabilities.json`, and content hashes for discovery.
|
|
76
|
+
|
|
77
|
+
The first automated implementation should only open a draft PR. Human review owns merge, licensing, and final wording.
|