@agentskit/doc-bridge 0.1.0-alpha.3 → 1.0.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 (50) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +139 -57
  3. package/action.yml +78 -0
  4. package/dist/cli/program.js +987 -69
  5. package/dist/cli/program.js.map +1 -1
  6. package/dist/index.d.ts +238 -26
  7. package/dist/index.js +704 -22
  8. package/dist/index.js.map +1 -1
  9. package/docs/DOGFOOD-ROUND3.md +74 -0
  10. package/docs/POSITIONING.md +2 -0
  11. package/docs/RELEASE.md +5 -3
  12. package/docs/chat-and-rag.md +2 -0
  13. package/docs/getting-started.md +14 -1
  14. package/docs/landing/index.html +299 -0
  15. package/docs/mcp.md +10 -1
  16. package/docs/ollama-demo.md +64 -0
  17. package/docs/playbook/doc-bridge-pattern.md +114 -0
  18. package/docs/recipes/index-pipeline.md +89 -0
  19. package/docs/skills/doc-bridge.md +64 -0
  20. package/docs/spec/cli.md +6 -0
  21. package/docs/spec/playbook-feedback.md +12 -4
  22. package/examples/demo-example/doc-bridge.config.json +23 -0
  23. package/examples/demo-example/docs/for-agents/INDEX.md +3 -0
  24. package/examples/demo-example/docs/for-agents/packages/example.md +14 -0
  25. package/examples/demo-example/package.json +7 -0
  26. package/examples/demo-example/src/.gitkeep +0 -0
  27. package/examples/demo-monorepo/doc-bridge.config.json +37 -0
  28. package/examples/demo-monorepo/docs/for-agents/INDEX.md +4 -0
  29. package/examples/demo-monorepo/docs/for-agents/packages/auth.md +22 -0
  30. package/examples/demo-monorepo/docs/for-agents/packages/billing.md +19 -0
  31. package/examples/demo-monorepo/docs/human/guides/auth.md +7 -0
  32. package/examples/demo-monorepo/package.json +7 -0
  33. package/examples/demo-monorepo/packages/auth/package.json +8 -0
  34. package/examples/demo-monorepo/packages/billing/package.json +7 -0
  35. package/examples/demo-monorepo/pnpm-workspace.yaml +2 -0
  36. package/examples/ollama-chat.config.ts +42 -0
  37. package/package.json +5 -2
  38. package/src/cli/demo.ts +143 -0
  39. package/src/cli/program.ts +194 -14
  40. package/src/doctor/badge.ts +53 -0
  41. package/src/doctor/run-doctor.ts +286 -0
  42. package/src/index-builder/build-handoffs.ts +19 -1
  43. package/src/index-builder/watch-index.ts +94 -0
  44. package/src/index.ts +24 -0
  45. package/src/mcp/install.ts +84 -0
  46. package/src/memory/github-pr.ts +190 -0
  47. package/src/playbook/doc-bridge-pattern.ts +121 -0
  48. package/src/query/query.ts +19 -1
  49. package/src/schemas/agent-handoff.ts +11 -0
  50. package/src/version.ts +1 -1
@@ -0,0 +1,74 @@
1
+ # Dogfood round 3 — `@agentskit/doc-bridge@0.1.0-alpha.3`
2
+
3
+ **Date:** 2026-07-09
4
+ **npm:** `alpha` → `0.1.0-alpha.3` · `latest` still `0.1.0-alpha.1`
5
+
6
+ ## Scoreboard
7
+
8
+ | Repo | Install | Ver | K | Handoffs | Gate | Ranking | Ask | Retrieve |
9
+ |------|---------|-----|---|----------|------|---------|-----|----------|
10
+ | **agentskit** | `pnpm add -Dw` ✅ | 0.1.0-alpha.3 | 25 | 24 | ✅ 24 humanDoc | `core` #1 (683) ✅ | ownership core ✅ | ✅ soft, 8 chunks |
11
+ | **agentskit-os** | `npx` (store issue) ✅ | 0.1.0-alpha.3 | 170 | 92 | ✅ | `os-core` #1 (689) ✅ | ownership os-core ✅ | ✅ 8 chunks |
12
+ | **playbook** | `pnpm add -D` ✅ | 0.1.0-alpha.3 | 127 | 81 | ✅ okf | OKF pattern #1 ✅ | pattern ownership ✅ | ✅ |
13
+ | **registry** | `--legacy-peer-deps` ⚠️ | 0.1.0-alpha.3 | 36 | 36 | ✅ | `docs-chat` #1 (593) ✅ | docs-chat ✅ | ✅ |
14
+
15
+ ## Round-2 issues — validation
16
+
17
+ | Item (R2) | Status | Evidence |
18
+ |-----------|--------|----------|
19
+ | Exact id ranking | **Fixed** | agentskit `search core` → best=`core` not angular |
20
+ | ask wrong package | **Fixed** | “change the core package?” → ownership core |
21
+ | Notes truncated | **Fixed** | full purpose sentences on core / os-core |
22
+ | Full-text search | **Improved** | `search documentation` → 20 matches (was 0) |
23
+ | Federation 404 hard-fail | **Fixed** | retrieve exit 0, no error, local chunks only |
24
+ | Peer install friction | **Improved** | no peer warning on agentskit; registry still needs legacy-peer-deps |
25
+ | Text UX | **Fixed** | multi-line `[ownership] id score=` format |
26
+ | Path dedupe | **OK** | top lists are unique ownership rows |
27
+ | AKOS humanDoc sparse | **Still open** | os-core handoff has no `humanDoc` (product docs thin) |
28
+ | pnpm store AKOS | **Still open** | environment; npx works |
29
+ | `latest` on old alpha | **Still open** | publish hygiene |
30
+
31
+ ## Sample outputs (alpha.3)
32
+
33
+ ### agentskit — ranking
34
+
35
+ ```json
36
+ { "term": "core", "best": "core", "top": ["core:683", "angular:27", "ink:27"] }
37
+ ```
38
+
39
+ ### agentskit — handoff
40
+
41
+ ```json
42
+ {
43
+ "startHere": "apps/docs-next/content/docs/for-agents/core.mdx",
44
+ "editRoots": ["packages/core"],
45
+ "checks": ["pnpm --filter @agentskit/core test", "pnpm --filter @agentskit/core lint"],
46
+ "humanDoc": "/docs/reference/packages/core",
47
+ "notes": ["Stable TypeScript contracts (Adapter, Tool, Memory, Retriever, Skill, Runtime) + `createChatController` + primitives. Target: <10 KB gzipped, zero runtime deps."]
48
+ }
49
+ ```
50
+
51
+ ### agentskit-os — ranking
52
+
53
+ ```json
54
+ { "best": "os-core", "top": ["os-core:689", "command-palette:36", "os-blob:36"] }
55
+ ```
56
+
57
+ ### registry — ranking
58
+
59
+ ```json
60
+ { "best": "docs-chat", "top": ["docs-chat:593", "agency-brief-generator:15"] }
61
+ ```
62
+
63
+ ## Remaining improvements (lower urgency)
64
+
65
+ 1. **AKOS humanDoc coverage** — enrich for-agents frontmatter `humanDoc` or map product Fumadocs more densely (content work more than code).
66
+ 2. **npm install without legacy-peer-deps** on registry — may still need peerOptional tuning vs npm ERESOLVE; document install flags.
67
+ 3. **HTML entities in notes** — `&lt;10 KB` from source MD; optional decode on index.
68
+ 4. **AKOS lockfile install path** — fix local pnpm store / commit published dep version.
69
+ 5. **CI wire-up** — `docs:bridge:gate` on each consumer after merge of dogfood branches.
70
+ 6. **Publish tags** — keep `latest` free of prereleases or retag intentionally.
71
+
72
+ ## Verdict
73
+
74
+ **alpha.3 is a successful dogfood pass.** P0/P1 product issues from round 2 are validated fixed on published package across monorepo + playbook + registry. Remaining items are polish, content, or consumer-side install/CI.
@@ -49,6 +49,8 @@ Engineering teams with real ownership (monorepos first). Secondary: solo libs, i
49
49
  - [AgentsKit for-agents](https://www.agentskit.io/docs/for-agents) — agent-first package corpus
50
50
  - [Registry](https://registry.agentskit.io/) — agent discovery / onboarding companion
51
51
  - [Playbook llms.txt](https://playbook.agentskit.io/llms.txt) — patterns + federation source
52
+ - [doc-bridge landing](https://agentskit-io.github.io/doc-bridge/) — conversion page + used-by
53
+ - [Doc Bridge Playbook pattern](../playbook/doc-bridge-pattern.md) — `ak-docs playbook pattern`
52
54
 
53
55
  ## Comparison
54
56
 
package/docs/RELEASE.md CHANGED
@@ -21,7 +21,7 @@ pnpm changeset # if new entry needed
21
21
  pnpm version-packages # bumps package.json + CHANGELOG from .changeset/*
22
22
  ```
23
23
 
24
- Current track: `0.1.0-alpha.x`.
24
+ Current track: **`1.0.0` stable** (alpha series ended at `0.1.0-alpha.5`).
25
25
 
26
26
  ## Publish (npm)
27
27
 
@@ -49,11 +49,13 @@ npx ak-docs@0.1.0-alpha.x --version
49
49
  ## GitHub
50
50
 
51
51
  ```bash
52
- git tag v0.1.0-alpha.x
52
+ git tag v1.0.0
53
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
54
+ gh release create v1.0.0 --title "v1.0.0 — AgentHandoff stable" --notes-file CHANGELOG.md
55
55
  ```
56
56
 
57
+ Enable GitHub Pages (Settings → Pages → GitHub Actions) for landing deploy from `.github/workflows/pages.yml`.
58
+
57
59
  ## Post-publish smoke (fresh machine)
58
60
 
59
61
  ```bash
@@ -29,6 +29,8 @@ ak-docs ask "<question>" --chat
29
29
 
30
30
  Missing peers produce an install hint instead of a silent no-op.
31
31
 
32
+ **Ollama walkthrough:** [ollama-demo.md](./ollama-demo.md) · `pnpm smoke:ollama`
33
+
32
34
  ## Providers
33
35
 
34
36
  | provider | Notes |
@@ -10,15 +10,28 @@ pnpm add -D @agentskit/doc-bridge
10
10
 
11
11
  CLI binary: **`ak-docs`**.
12
12
 
13
+ ## 60-second demo (zero setup)
14
+
15
+ ```bash
16
+ npx ak-docs demo --text
17
+ npx ak-docs demo --fixture monorepo --text # auth + billing monorepo
18
+ ```
19
+
20
+ Prints before/after, a real handoff, gate red→green, and the MCP snippet.
21
+
13
22
  ## Two-minute path (no API key)
14
23
 
15
24
  ```bash
16
25
  ak-docs init # config + demo ownership + AGENTS.md snippet
17
26
  ak-docs index
18
27
  ak-docs query package example --agent
28
+ ak-docs doctor --text
29
+ ak-docs doctor --badge
30
+ ak-docs mcp install --cursor
31
+ ak-docs index --watch # optional — dev loop
19
32
  ```
20
33
 
21
- You should see an **AgentHandoff** with `startHere`, `editRoots`, and `checks`.
34
+ You should see an **AgentHandoff** with `startHere`, `editRoots`, `checks`, and optional `bridge`.
22
35
 
23
36
  Useful follow-ups:
24
37
 
@@ -0,0 +1,299 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>doc-bridge — AgentHandoff for your monorepo</title>
7
+ <meta name="description" content="Deterministic routing for coding agents: edit the right package, run the right checks, bridge to human docs. No API key required." />
8
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
9
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
10
+ <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap" rel="stylesheet" />
11
+ <style>
12
+ :root {
13
+ --bg: #0b0f14;
14
+ --surface: #121820;
15
+ --border: #1e2a38;
16
+ --text: #e8eef6;
17
+ --muted: #8fa3b8;
18
+ --accent: #3d9cf5;
19
+ --accent-dim: #2563a8;
20
+ --green: #3ecf8e;
21
+ --red: #f07178;
22
+ --amber: #e6c07b;
23
+ --mono: "IBM Plex Mono", ui-monospace, monospace;
24
+ --sans: "IBM Plex Sans", system-ui, sans-serif;
25
+ --radius: 12px;
26
+ --max: 1080px;
27
+ }
28
+ * { box-sizing: border-box; margin: 0; padding: 0; }
29
+ body {
30
+ font-family: var(--sans);
31
+ background: var(--bg);
32
+ color: var(--text);
33
+ line-height: 1.55;
34
+ -webkit-font-smoothing: antialiased;
35
+ }
36
+ a { color: var(--accent); text-decoration: none; }
37
+ a:hover { text-decoration: underline; }
38
+ .wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }
39
+ header {
40
+ padding: 1.25rem 0;
41
+ border-bottom: 1px solid var(--border);
42
+ position: sticky; top: 0; z-index: 10;
43
+ background: rgba(11, 15, 20, 0.92);
44
+ backdrop-filter: blur(8px);
45
+ }
46
+ .nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
47
+ .logo { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; }
48
+ .logo span { color: var(--muted); font-weight: 500; }
49
+ .nav-links { display: flex; gap: 1.25rem; font-size: 0.9rem; }
50
+ .nav-links a { color: var(--muted); }
51
+ .nav-links a:hover { color: var(--text); text-decoration: none; }
52
+ .hero { padding: 4.5rem 0 3rem; }
53
+ .eyebrow {
54
+ display: inline-block;
55
+ font-size: 0.75rem;
56
+ font-weight: 600;
57
+ letter-spacing: 0.08em;
58
+ text-transform: uppercase;
59
+ color: var(--accent);
60
+ margin-bottom: 1rem;
61
+ }
62
+ h1 {
63
+ font-size: clamp(2rem, 5vw, 3.25rem);
64
+ line-height: 1.1;
65
+ letter-spacing: -0.03em;
66
+ max-width: 16ch;
67
+ margin-bottom: 1.25rem;
68
+ }
69
+ .lead {
70
+ font-size: 1.15rem;
71
+ color: var(--muted);
72
+ max-width: 52ch;
73
+ margin-bottom: 2rem;
74
+ }
75
+ .cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 3rem; }
76
+ .btn {
77
+ display: inline-flex; align-items: center; gap: 0.4rem;
78
+ padding: 0.7rem 1.15rem;
79
+ border-radius: 8px;
80
+ font-weight: 600; font-size: 0.95rem;
81
+ border: 1px solid transparent;
82
+ cursor: pointer;
83
+ text-decoration: none !important;
84
+ }
85
+ .btn-primary { background: var(--accent); color: #041018; }
86
+ .btn-primary:hover { background: #5aadf7; }
87
+ .btn-ghost { border-color: var(--border); color: var(--text); background: var(--surface); }
88
+ .btn-ghost:hover { border-color: var(--muted); }
89
+ .terminal {
90
+ background: var(--surface);
91
+ border: 1px solid var(--border);
92
+ border-radius: var(--radius);
93
+ overflow: hidden;
94
+ font-family: var(--mono);
95
+ font-size: 0.82rem;
96
+ line-height: 1.65;
97
+ }
98
+ .terminal-bar {
99
+ display: flex; gap: 6px; padding: 0.65rem 1rem;
100
+ border-bottom: 1px solid var(--border);
101
+ background: #0d1219;
102
+ }
103
+ .dot { width: 10px; height: 10px; border-radius: 50%; }
104
+ .dot-r { background: var(--red); }
105
+ .dot-y { background: var(--amber); }
106
+ .dot-g { background: var(--green); }
107
+ .terminal-body { padding: 1.25rem 1.5rem; overflow-x: auto; }
108
+ .t-dim { color: var(--muted); }
109
+ .t-ok { color: var(--green); }
110
+ .t-bad { color: var(--red); }
111
+ .t-hi { color: var(--accent); }
112
+ section { padding: 3.5rem 0; border-top: 1px solid var(--border); }
113
+ h2 { font-size: 1.5rem; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
114
+ .section-lead { color: var(--muted); margin-bottom: 2rem; max-width: 60ch; }
115
+ .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
116
+ @media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } .nav-links { display: none; } }
117
+ .card {
118
+ background: var(--surface);
119
+ border: 1px solid var(--border);
120
+ border-radius: var(--radius);
121
+ padding: 1.25rem 1.35rem;
122
+ }
123
+ .card h3 { font-size: 1rem; margin-bottom: 0.35rem; }
124
+ .card p { color: var(--muted); font-size: 0.92rem; }
125
+ .card code { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); }
126
+ .loops { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
127
+ @media (max-width: 900px) { .loops { grid-template-columns: repeat(2, 1fr); } }
128
+ @media (max-width: 480px) { .loops { grid-template-columns: 1fr; } }
129
+ .loop-tag {
130
+ font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
131
+ text-transform: uppercase; color: var(--accent); margin-bottom: 0.4rem;
132
+ }
133
+ .used-by {
134
+ display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
135
+ }
136
+ .used-by a {
137
+ display: flex; align-items: center; gap: 0.5rem;
138
+ padding: 0.65rem 1rem;
139
+ background: var(--surface);
140
+ border: 1px solid var(--border);
141
+ border-radius: 8px;
142
+ color: var(--text);
143
+ font-weight: 500;
144
+ font-size: 0.9rem;
145
+ text-decoration: none;
146
+ }
147
+ .used-by a:hover { border-color: var(--accent-dim); }
148
+ .badge-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; }
149
+ .badge-row img { height: 22px; }
150
+ footer {
151
+ padding: 2.5rem 0 3rem;
152
+ border-top: 1px solid var(--border);
153
+ color: var(--muted);
154
+ font-size: 0.85rem;
155
+ }
156
+ footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
157
+ </style>
158
+ </head>
159
+ <body>
160
+ <header>
161
+ <div class="wrap nav">
162
+ <div class="logo">doc-bridge <span>/ ak-docs</span></div>
163
+ <nav class="nav-links">
164
+ <a href="#demo">Demo</a>
165
+ <a href="#loops">Loops</a>
166
+ <a href="#used-by">Used by</a>
167
+ <a href="https://github.com/AgentsKit-io/doc-bridge">GitHub</a>
168
+ </nav>
169
+ <a class="btn btn-primary" href="https://www.npmjs.com/package/@agentskit/doc-bridge">npm install</a>
170
+ </div>
171
+ </header>
172
+
173
+ <main>
174
+ <section class="hero">
175
+ <div class="wrap">
176
+ <div class="eyebrow">AgentHandoff for your monorepo</div>
177
+ <h1>Your agent never edits the wrong package again.</h1>
178
+ <p class="lead">
179
+ Deterministic handoffs: <strong>startHere</strong>, <strong>editRoots</strong>, <strong>checks</strong>, and a bridge to human docs.
180
+ Layer 0 works without any LLM or API key.
181
+ </p>
182
+ <div class="cta-row">
183
+ <a class="btn btn-primary" href="#demo">See 60s demo</a>
184
+ <a class="btn btn-ghost" href="https://github.com/AgentsKit-io/doc-bridge#readme">Read README</a>
185
+ </div>
186
+ <div class="grid-2" id="demo">
187
+ <div class="terminal">
188
+ <div class="terminal-bar"><span class="dot dot-r"></span><span class="dot dot-y"></span><span class="dot dot-g"></span></div>
189
+ <div class="terminal-body">
190
+ <div class="t-dim"># Before — agent guesses</div>
191
+ <div class="t-bad">✗ edits packages/billing when task says "auth"</div>
192
+ <div class="t-bad">✗ runs repo-wide test instead of package checks</div>
193
+ <br />
194
+ <div class="t-dim">$ npx ak-docs demo --text</div>
195
+ <br />
196
+ <div class="t-dim"># After — handoff.resolve</div>
197
+ <div class="t-ok">✓ target: auth (packages/auth)</div>
198
+ <div class="t-ok">✓ edit: packages/auth</div>
199
+ <div class="t-ok">✓ checks: pnpm --filter @demo/auth test</div>
200
+ <div class="t-ok">✓ human guide: /docs/guides/auth</div>
201
+ <div class="t-hi">Gate: red → green</div>
202
+ </div>
203
+ </div>
204
+ <div class="terminal">
205
+ <div class="terminal-bar"><span class="dot dot-r"></span><span class="dot dot-y"></span><span class="dot dot-g"></span></div>
206
+ <div class="terminal-body">
207
+ <div class="t-dim">$ npm i -D @agentskit/doc-bridge</div>
208
+ <div class="t-dim">$ npx ak-docs init && npx ak-docs index</div>
209
+ <div class="t-dim">$ ak-docs mcp install --cursor</div>
210
+ <div class="t-dim">$ ak-docs doctor --text</div>
211
+ <br />
212
+ <div>Score: <span class="t-ok">82/100 (B)</span></div>
213
+ <div>Agent docs: 8/10 <span class="t-dim">(80% handoff-ready)</span></div>
214
+ <div>Human guides: 6/10 <span class="t-dim">(60% bridged)</span></div>
215
+ <div>Gates: <span class="t-ok">3/3 passing</span></div>
216
+ <br />
217
+ <div class="t-dim">→ ak-docs query package auth --agent</div>
218
+ </div>
219
+ </div>
220
+ </div>
221
+ </div>
222
+ </section>
223
+
224
+ <section id="loops">
225
+ <div class="wrap">
226
+ <h2>Four loops, one bridge</h2>
227
+ <p class="section-lead">Act, bridge, learn, explain — each loop has a CLI command and real output, not a concept table.</p>
228
+ <div class="loops">
229
+ <div class="card">
230
+ <div class="loop-tag">Act</div>
231
+ <h3>Handoff routing</h3>
232
+ <p><code>query --agent</code> · MCP <code>handoff.resolve</code></p>
233
+ </div>
234
+ <div class="card">
235
+ <div class="loop-tag">Bridge</div>
236
+ <h3>Human ↔ agent</h3>
237
+ <p><code>bootstrap agent-docs</code> · <code>bridge.humanDoc</code></p>
238
+ </div>
239
+ <div class="card">
240
+ <div class="loop-tag">Learn</div>
241
+ <h3>Memory → docs</h3>
242
+ <p><code>memory promote --pr</code> · HITL draft PR</p>
243
+ </div>
244
+ <div class="card">
245
+ <div class="loop-tag">Explain</div>
246
+ <h3>Local consult</h3>
247
+ <p><code>ask</code> · optional Ollama chat</p>
248
+ </div>
249
+ </div>
250
+ </div>
251
+ </section>
252
+
253
+ <section id="used-by">
254
+ <div class="wrap">
255
+ <h2>Used by AgentsKit (public)</h2>
256
+ <p class="section-lead">Dogfooded on open surfaces — not private monorepo claims.</p>
257
+ <div class="used-by">
258
+ <a href="https://www.agentskit.io/docs/for-agents">AgentsKit for-agents</a>
259
+ <a href="https://registry.agentskit.io/">AgentsKit Registry</a>
260
+ <a href="https://playbook.agentskit.io/llms.txt">Agents Playbook</a>
261
+ <a href="https://github.com/AgentsKit-io/doc-bridge">doc-bridge (this repo)</a>
262
+ </div>
263
+ <div class="badge-row">
264
+ <img src="https://img.shields.io/npm/v/@agentskit/doc-bridge?style=flat-square&color=3d9cf5" alt="npm version" />
265
+ <img src="https://img.shields.io/badge/Layer%200-no%20API%20key-3ecf8e?style=flat-square" alt="no api key" />
266
+ <img src="https://img.shields.io/badge/handoff_coverage-ready-2ea44f?style=flat-square" alt="handoff coverage" />
267
+ <img src="https://img.shields.io/github/actions/workflow/status/AgentsKit-io/doc-bridge/ci.yml?branch=master&style=flat-square&label=CI" alt="CI" />
268
+ </div>
269
+ </div>
270
+ </section>
271
+
272
+ <section>
273
+ <div class="wrap">
274
+ <h2>CI on every PR</h2>
275
+ <p class="section-lead">Stale handoffs fail the build — same gate locally and in GitHub Actions.</p>
276
+ <div class="terminal">
277
+ <div class="terminal-bar"><span class="dot dot-r"></span><span class="dot dot-y"></span><span class="dot dot-g"></span></div>
278
+ <div class="terminal-body">
279
+ <div class="t-dim"># .github/workflows/pr.yml</div>
280
+ <div>- uses: <span class="t-hi">AgentsKit-io/doc-bridge@v1.0.0</span></div>
281
+ <div>&nbsp;&nbsp;with:</div>
282
+ <div>&nbsp;&nbsp;&nbsp;&nbsp;config-path: doc-bridge.config.json</div>
283
+ </div>
284
+ </div>
285
+ </div>
286
+ </section>
287
+ </main>
288
+
289
+ <footer>
290
+ <div class="wrap">
291
+ <div>MIT · <a href="https://github.com/AgentsKit-io/doc-bridge">AgentsKit-io/doc-bridge</a></div>
292
+ <div>
293
+ <a href="https://github.com/AgentsKit-io/doc-bridge/blob/master/docs/playbook/doc-bridge-pattern.md">Playbook pattern</a>
294
+ · <a href="https://github.com/AgentsKit-io/doc-bridge/blob/master/docs/skills/doc-bridge.md">Agent skill</a>
295
+ </div>
296
+ </div>
297
+ </footer>
298
+ </body>
299
+ </html>
package/docs/mcp.md CHANGED
@@ -1,6 +1,15 @@
1
1
  # MCP setup
2
2
 
3
- ## Cursor / Claude Desktop / Codex-style
3
+ ## One command (recommended)
4
+
5
+ ```bash
6
+ ak-docs mcp install --cursor # writes .cursor/mcp.json in repo root
7
+ ak-docs mcp install --claude # merges into Claude Desktop config (macOS)
8
+ ```
9
+
10
+ Then add the agent skill: [skills/doc-bridge.md](./skills/doc-bridge.md)
11
+
12
+ ## Manual — Cursor / Claude Desktop / Codex-style
4
13
 
5
14
  ```json
6
15
  {
@@ -0,0 +1,64 @@
1
+ # Ollama chat demo (Layer 1)
2
+
3
+ Zero-cloud path for grounded `ak-docs chat` and `ak-docs ask --chat`.
4
+
5
+ ## Prerequisites
6
+
7
+ ```bash
8
+ # Terminal 1 — model server
9
+ ollama serve
10
+
11
+ # Terminal 2 — models
12
+ ollama pull llama3.2
13
+ ollama pull nomic-embed-text
14
+
15
+ # Layer 1 peers (once per repo)
16
+ npm i -D @agentskit/doc-bridge \
17
+ @agentskit/rag @agentskit/ink @agentskit/adapters @agentskit/memory react
18
+ ```
19
+
20
+ ## Config
21
+
22
+ Copy [`examples/ollama-chat.config.ts`](../examples/ollama-chat.config.ts) or merge into your `doc-bridge.config.ts`:
23
+
24
+ ```ts
25
+ intelligence: {
26
+ enabled: true,
27
+ adapter: {
28
+ provider: 'ollama',
29
+ model: 'llama3.2',
30
+ baseUrl: 'http://127.0.0.1:11434',
31
+ options: { embedModel: 'nomic-embed-text' },
32
+ },
33
+ chat: { enabled: true, handoffFirst: true },
34
+ retriever: { enabled: true, mode: 'agentskit-rag' },
35
+ }
36
+ ```
37
+
38
+ ## Run
39
+
40
+ ```bash
41
+ ak-docs index
42
+ ak-docs rag ingest
43
+ ak-docs ask "who owns auth?" --chat # one-shot; handoffFirst when package id matches
44
+ ak-docs chat # Ink terminal UI
45
+ ```
46
+
47
+ `handoffFirst` (default) prepends deterministic AgentHandoff JSON when the question mentions a known package id — visible in the chat transcript before the model answer.
48
+
49
+ ## Smoke test
50
+
51
+ ```bash
52
+ pnpm smoke:ollama
53
+ ```
54
+
55
+ Skips gracefully if Ollama is down or peers are missing (safe for CI as optional job).
56
+
57
+ ## Troubleshooting
58
+
59
+ | Error | Fix |
60
+ |-------|-----|
61
+ | `Intelligence provider request failed` | `ollama serve` not running |
62
+ | `Optional peer "@agentskit/rag" is not installed` | Install Layer 1 peers (see above) |
63
+ | Empty chat response | Pull models: `ollama pull llama3.2` |
64
+ | Slow first `rag ingest` | Normal — embeds entire corpus locally |
@@ -0,0 +1,114 @@
1
+ ---
2
+ type: pattern
3
+ id: doc-bridge-pattern
4
+ purpose: Route coding agents to the correct package, checks, and human docs in any monorepo.
5
+ owner: AgentsKit
6
+ license: CC-BY-4.0
7
+ visibility: public
8
+ tags: [agents, documentation, monorepo, handoff, mcp]
9
+ ---
10
+
11
+ # Doc Bridge Pattern
12
+
13
+ **AgentHandoff for your monorepo** — deterministic routing so agents edit the right roots, run the right checks, and stay linked to human documentation.
14
+
15
+ Published pattern for [Agents Playbook](https://playbook.agentskit.io/). Export with:
16
+
17
+ ```bash
18
+ ak-docs playbook pattern --text
19
+ ak-docs playbook pattern --json
20
+ ```
21
+
22
+ ## Problem
23
+
24
+ Coding agents guess package ownership. They edit sibling modules, run repo-wide tests, and ship changes without a bridge to human-facing guides. Wikis and RAG explain concepts but weakly answer *where to act*.
25
+
26
+ ## Solution (three artifacts)
27
+
28
+ | Artifact | Role |
29
+ |----------|------|
30
+ | **AgentHandoff** | JSON handoff: `startHere`, `editRoots`, `checks`, `humanDoc`, `bridge` |
31
+ | **DocBridgeIndex** | Deterministic index + `contentHash` for CI freshness gates |
32
+ | **Self-describe** | `llms.txt`, `capabilities.json` for discovery |
33
+
34
+ ## Four loops
35
+
36
+ | Loop | Command | Outcome |
37
+ |------|---------|---------|
38
+ | **Act** | `ak-docs query package <id> --agent` | Agent edits only `editRoots` |
39
+ | **Bridge** | `ak-docs bootstrap agent-docs` | Link agent corpus ↔ human site |
40
+ | **Learn** | `ak-docs memory promote --pr` | HITL draft PR from agent memory |
41
+ | **Explain** | `ak-docs ask "<question>"` | Local consult + handoff preview |
42
+
43
+ ## 60-second proof
44
+
45
+ ```bash
46
+ npm i -D @agentskit/doc-bridge
47
+ npx ak-docs demo --text
48
+ ak-docs mcp install --cursor
49
+ ```
50
+
51
+ ## AgentHandoff example
52
+
53
+ ```json
54
+ {
55
+ "type": "agent-handoff",
56
+ "startHere": "docs/for-agents/packages/auth.md",
57
+ "editRoots": ["packages/auth"],
58
+ "checks": ["pnpm --filter @demo/auth test"],
59
+ "humanDoc": "/docs/guides/auth",
60
+ "bridge": { "humanDoc": "linked" }
61
+ }
62
+ ```
63
+
64
+ When `humanDoc` is missing, handoffs surface `bridge.action: "ak-docs bootstrap agent-docs"` — a feature, not a silent gap.
65
+
66
+ ## MCP contract
67
+
68
+ Agents call `handoff.resolve` before editing `packages/*`:
69
+
70
+ 1. Read `startHere`
71
+ 2. Stay inside `editRoots`
72
+ 3. Run every `checks` command
73
+ 4. Link `humanDoc` or escalate missing bridge
74
+
75
+ ## CI gate
76
+
77
+ ```yaml
78
+ - uses: AgentsKit-io/doc-bridge@v1.0.0
79
+ ```
80
+
81
+ Or: `ak-docs index && ak-docs gate run` — stale index fails the PR.
82
+
83
+ ## Coverage metric
84
+
85
+ ```bash
86
+ ak-docs doctor --text
87
+ ak-docs doctor --badge
88
+ ```
89
+
90
+ Teams track handoff % and human-bridge % daily.
91
+
92
+ ## When to use
93
+
94
+ - pnpm/npm monorepos with real package ownership
95
+ - Fumadocs / Docusaurus human sites + dense agent corpus
96
+ - Cursor / Claude / Codex agents that should not guess edit roots
97
+
98
+ ## When not to use
99
+
100
+ - Single-file repos with no ownership boundaries (AGENTS.md may suffice)
101
+ - Hosted doc chat as primary product (doc-bridge is routing + bridge, not SaaS chat)
102
+
103
+ ## Promotion to Playbook
104
+
105
+ 1. Review this file for secrets and private paths
106
+ 2. Open PR to [agents-playbook](https://github.com/AgentsKit-io/agents-playbook) under `content/docs/pillars/ai-collaboration/`
107
+ 3. Or run `ak-docs memory promote --pr` for memory-sourced findings
108
+
109
+ ## References
110
+
111
+ - npm: https://www.npmjs.com/package/@agentskit/doc-bridge
112
+ - repo: https://github.com/AgentsKit-io/doc-bridge
113
+ - skill: [doc-bridge skill](../skills/doc-bridge.md)
114
+ - landing: https://agentskit-io.github.io/doc-bridge/