@agentskit/harness 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,45 @@
1
+ # ADR-0028: MCP is an adapter-only boundary
2
+
3
+ ## Status
4
+
5
+ Accepted — 2026-09-11.
6
+
7
+ ## Context
8
+
9
+ MCP (Model Context Protocol) is a useful integration surface for read-only
10
+ inspection and, later, gated tool calls. The keep-pushing loop and kernel must
11
+ remain usable without any MCP host, SDK, or network dependency. MODULE-BOUNDARIES
12
+ and ADR-0026 already classify MCP as an adapter concern; 0.6.0 needs an
13
+ explicit decision before any public bridge ships.
14
+
15
+ ## Decision
16
+
17
+ 1. **Adapter-only.** MCP lives under `src/adapters/mcp.ts` (and future adapter
18
+ modules). Kernel modules do not import MCP clients, hosts, or transports.
19
+ 2. **Default-deny policy.** Every tool call goes through an allowlist
20
+ (`allowTools`) and a `PolicyGate` (or compatible `evaluate`). Missing
21
+ allowlist entry or non-`allow` decision returns `{ status: 'blocked' }`
22
+ without invoking the underlying call.
23
+ 3. **Read-only profile first.** The initial public surface is a policy-gated
24
+ call bridge intended for read-only / inspection tools. Mutating MCP tools
25
+ require a later ADR covering authorization, idempotency, and audit evidence.
26
+ 4. **Harness works without MCP.** Default loop config keeps `mcp.enabled: false`.
27
+ No MCP process is started by install, tick, or deliver.
28
+ 5. **Not wired into loop tick/deliver in 0.6.0.** The bridge is exported for
29
+ composition and future CLI/doctor use. Tick and deliver must not call it in
30
+ this release.
31
+
32
+ ## Consequences
33
+
34
+ - Consumers can plug MCP behind the same policy gate used by session tool
35
+ recording without coupling the kernel to a vendor host.
36
+ - Loop automation remains deterministic and offline-testable when MCP is off.
37
+ - A later release may wire a read-only MCP profile into doctor or a dedicated
38
+ CLI after eval coverage; mutating tools stay out until gated separately.
39
+
40
+ ## Alternatives considered
41
+
42
+ - **Kernel MCP host:** rejected; violates ADR-0026 and forces an optional
43
+ network dependency into deterministic gates.
44
+ - **Wire MCP into tick/deliver now:** rejected for 0.6.0; needs allowlist
45
+ provenance, audit events, and eval coverage first.
package/docs/LOOP.md CHANGED
@@ -160,6 +160,87 @@ When a provider runs out of usage the loop records a cooldown in `<stateDir>/pro
160
160
  inside a WSL distro (host Defender load is invisible there). The loop never lowers a running worker; it only
161
161
  decides whether to start another.
162
162
 
163
+ ## Integrations used by the loop
164
+
165
+ The loop talks to the rest of AgentsKit through **adapters and CLI seams**, not by importing those packages into
166
+ the published dependency tree. `@agentskit/harness` stays dependency-light (`commander`, `ink`, `react`, `yaml`,
167
+ `zod`); Doc Bridge and Code Review are optional at runtime.
168
+
169
+ ### Doc Bridge (context for the orchestrator)
170
+
171
+ | Item | Detail |
172
+ |---|---|
173
+ | Adapter | `src/adapters/doc-bridge.ts` → `createDocBridgeContextProvider` |
174
+ | Loop wiring | `resolveDocContext` in `src/loop/contract.ts` |
175
+ | Trigger | `.doc-bridge/index.json` exists under `project.root` |
176
+ | Knob | `contract.maxContextReferences` (default `6`; `0` disables) |
177
+ | Behaviour | Query is `"<issue id> <title>"`. Up to N deterministic references are appended to the orchestrator prompt. Missing or malformed index → **no refs** (loop continues). |
178
+ | Boundary | No `@agentskit/doc-bridge` import; the adapter only reads the local index contract ([ADR-0003](ADR-0003-doc-bridge-context-binding.md)). Index build/refresh stays with Doc Bridge (`pnpm docs:bridge:index` in repos that use it). |
179
+
180
+ ### Code Review (`agentskit-review`)
181
+
182
+ | Item | Detail |
183
+ |---|---|
184
+ | Adapter | `src/adapters/code-review.ts` → `runCodeReview` / `buildReviewArgv` |
185
+ | Loop wiring | Deliver stage, after CI is green and the head has not been reviewed |
186
+ | CLI | `delivery.review.cli` (default `agentskit-review` from `@agentskit/code-review`) |
187
+ | Knobs | `mode` (`trusted-local` recommended so CLI logins work), `transport` (`headless` for current Grok CLI), `profile` (`fast` fits a 600 s Orca stage; `full` needs batching), `votes`, `concurrency`, `minSeverity`, `deadlineMs`, `maxCalls`, `post` |
188
+ | Provider/model | First available candidate from `models.reviewer` tiers |
189
+ | Verdicts | exit `0` → clean (merge path); `1` → findings ≥ floor (fix round); `2` / timeout / incomplete → wait and retry |
190
+ | Boundary | Argv + `--result` file only; the harness never embeds the review SDK. |
191
+
192
+ ### Eval battery (package quality, not the live loop)
193
+
194
+ `evals/manifest.json` plus `runEvalBattery` / `pnpm test:eval-battery` score harness components (`doc-bridge`,
195
+ `code-review`, `orca-worktree`, `memory`, …) under a frozen fixture provider. That is the **library** eval gate.
196
+ The live SDLC loop does **not** call the eval battery on every PR; it calls `agentskit-review` on each head.
197
+
198
+ Loop-focused Vitest coverage lives under `test/loop-*.test.ts`, `test/review.test.ts`, and `test/doc-bridge.test.ts`.
199
+
200
+ ## AgentsKit ecosystem map (what the harness has vs what the loop uses)
201
+
202
+ Legend: **Loop** = wired into `ak-harness loop …` today · **Kernel** = public API / contracts available to callers ·
203
+ **Compat** = pinned in `compatibility/manifest.json` · **Absent** = no seam yet.
204
+
205
+ | Capability | Status | Where | Notes for SDLC |
206
+ |---|---|---|---|
207
+ | **Doc Bridge** | Loop + Kernel + Compat | `adapters/doc-bridge.ts`, contract stage | Optional context on contract freeze. Playbook/docs surfaces appear as Doc Bridge scopes when the index includes them. |
208
+ | **Code Review** | Loop + Compat | `adapters/code-review.ts`, deliver | Live adversarial review before auto-merge. |
209
+ | **Orca / Linear / GitHub** | Loop | `adapters/orca-cli.ts`, `linear-orca.ts`, `github-cli.ts` | Scheduler, worktrees, queue, PR merge. |
210
+ | **Coding-agent CLIs** | Loop | `adapters/providers.ts`, `models.*` tiers | Claude / Codex / Grok / OpenCode via TUI + headless templates — not an AgentsKit agent registry. |
211
+ | **Memory** | Loop + Kernel + Compat | `kernel/memory.ts`, `loop/memory.ts` | Approved learnings (`loop learning promote`) shrink Doc Bridge/issue text in contract + brief. |
212
+ | **Eval** | Kernel + Compat | `kernel/eval.ts`, `evals/manifest.json` | Battery + `assessAgentEval`. **Not run inside tick/deliver**. |
213
+ | **Runtime (process / Docker)** | Kernel | `execution/runtime.ts` | Tool runtimes with attestation for kernel/agent sessions. Loop workers run as Orca terminals + provider TUIs instead. |
214
+ | **Plugin / context registry** | Kernel | `kernel/plugins.ts`, `CONTEXT_PROVIDER_SLOT` | Typed slots so Doc Bridge / Playbook / custom providers plug in without kernel changes. Loop uses Doc Bridge directly today. |
215
+ | **Playbook practices** | Loop (via Doc Bridge scopes) | `contract.briefScopes` → worker brief | Titles/paths for `playbook` / `for-agents` scopes listed in the brief when indexed. |
216
+ | **RAG (`@agentskit/rag` / os-rag)** | Kernel adapter (opt-in) | `adapters/rag-context.ts` | Argv/`ContextProvider` seam; enable via `rag.enabled` + `contract.contextProviders`. No hard dep. |
217
+ | **AgentsKit agent registry** | Composition (opt-in file) | `loop/agent-registry.ts` | Optional `agents.registry.yaml` role→TUI/argv overlay. Not OS marketplace. |
218
+ | **MCP / event bridge** | Kernel adapter + ADR-0028 | `adapters/mcp.ts` | Policy-gated tool bridge; **not** wired into tick/deliver in 0.6.0. |
219
+ | **`@agentskit/core` / `@agentskit/eval` / `@agentskit/memory`** | Compat pins only | `compatibility/manifest.json` | Upstream packages are compatibility-tested; harness does **not** depend on them at runtime. Callers adapt them through the seams above. |
220
+
221
+ Compatibility report for 0.4.0 was **fail-closed** on code-review quality baselines and the no-Harness pilot cohort; see `compatibility/report.md`. Refresh after each release (qualification + pinned revisions).
222
+
223
+ ## What can be added to help the SDLC
224
+
225
+ **0.6.0 ships the backlog below** (memory, doctor freshness/review probe, brief scopes, deliver smoke, agent registry, RAG provider, MCP seam+ADR, Docker verify config, weekly retro automation). Remaining work is dogfooding and deeper MCP/OS registry integrations.
226
+
227
+ Ordered by leverage for a keep-pushing loop (config/adapters first; no kernel redesign required for the early items).
228
+
229
+ | Priority | Addition | Why it helps | Suggested shape |
230
+ |---|---|---|---|
231
+ | P0 | **Memory in contract + brief** | Stop re-deriving the same repo facts; carry approved decisions across tickets | On contract freeze / worker brief, `recall` from an `AgentMemoryAdapter` (backed by `@agentskit/memory` or a file store under `<stateDir>`). Persist only human-`promoteLearnings` / retro-approved records. |
232
+ | P0 | **Doc Bridge freshness gate** | Orchestrator context goes stale when the index is old | Doctor check: index exists, `contentHash` age, optional `docs:bridge:index` hint when missing. |
233
+ | P1 | **Playbook / for-agents snippets in the brief** | Workers skip repo conventions that already exist as docs | Resolve Doc Bridge (or a Playbook `ContextProvider`) with scopes `playbook` + `for-agents` and render a bounded “must follow” block into `renderWorkerBrief`. |
234
+ | P1 | **Eval smoke on deliver (optional)** | Catch harness/component regressions before merge on harness itself | Config flag to run a **bounded** subset of `evals/manifest.json` (or project `ak-verify`) as an extra deliver gate — not a full battery on every product PR. |
235
+ | P1 | **Review transport/doctor** | Incomplete reviews burned the pilot (login / model id / stage budget) | Doctor probes `agentskit-review --help`, configured transport, and a one-lens trusted-local dry call; surface `review-tool-errors` in retro. |
236
+ | P2 | **RAG context provider** | Large codebases exceed Doc Bridge’s deterministic top-N | New adapter implementing `ContextProvider` over `@agentskit/rag` / os-rag; same freeze-into-contract rules as Doc Bridge (hash + cap). |
237
+ | P2 | **AgentsKit agent/skill registry** | Reuse named agents (reviewer, security, docs) instead of free-form CLI templates | Optional `agents.registry` file or OS dispatcher lookup → map role → argv/TUI. Keep fail-closed when the registry entry is missing. |
238
+ | P2 | **MCP tools behind policy** | Controlled access to issue trackers, browsers, internal APIs | MCP adapter + `createPolicyGate` allowlist; record hashed tool events. Requires ADR (MODULE-BOUNDARIES already flags this). |
239
+ | P3 | **Kernel runtime for untrusted tools** | Sandbox one-off scripts the worker must not run on the host | Offer Docker tool runtime as an opt-in for verify commands; loop default stays Orca worktree. |
240
+ | P3 | **Weekly Linear retro automation** | Close the continuous-improvement loop without a human remembering `loop retro` | Orca schedule → `loop retro --learnings` → comment on a fixed Linear issue (project vs harness sections already split). |
241
+
242
+ Non-goals for the loop: embedding LLM SDKs, reading API key values from config, or making `@agentskit/*` hard dependencies of the published package. New ecosystem pieces enter as adapters/plugins with argv/timeouts and eval coverage ([ADR-0026](ADR-0026-kernel-adapters-boundary.md), [ADR-0027](ADR-0027-keep-pushing-loop.md)).
243
+
163
244
  ## Boundaries
164
245
 
165
246
  Adapters (`src/adapters/command.ts`, `orca-cli.ts`, `providers.ts`, `linear-orca.ts`) depend on kernel contracts
@@ -149,7 +149,10 @@ Orca, and tracking. No adapter implementation is re-exported wholesale.
149
149
 
150
150
  ## External integration inventory
151
151
 
152
- | Integration | Current location | Side effects | 0.4.0 boundary |
152
+ How these seams are wired into the keep-pushing loop (and what is still only a kernel contract) is summarized in
153
+ [`LOOP.md`](LOOP.md#integrations-used-by-the-loop) and the [AgentsKit ecosystem map](LOOP.md#agentskit-ecosystem-map-what-the-harness-has-vs-what-the-loop-uses).
154
+
155
+ | Integration | Current location | Side effects | Boundary |
153
156
  | --- | --- | --- | --- |
154
157
  | Doc Bridge | `src/adapters/doc-bridge.ts` | Reads a local index | Keep behind `ContextProvider`; measure context hit/quality separately. |
155
158
  | Orca | `src/adapters/orca.ts` | None; produces argv and lifecycle projections only | Keep lease/worktree/issue-lock/SHA planning provider-neutral; execution belongs to the orchestrator. |
@@ -161,8 +164,10 @@ Orca, and tracking. No adapter implementation is re-exported wholesale.
161
164
  | Process runtime | `src/execution/runtime.ts` | Starts child processes | Execution support; policy and evidence gates remain kernel decisions. |
162
165
  | Docker runtime | `src/execution/runtime.ts` | Starts Docker containers | Optional sandbox selected by config, never a mandatory kernel dependency. |
163
166
  | LLM provider/model | Caller/plugin | Provider call and token spend | Bind provider/model in experiment metadata; do not embed SDKs in kernel. |
164
- | Memory backend | Caller/plugin; `memory.ts` contract | Backend reads/writes | Keep record validation in kernel; backend adapter owns persistence. |
165
- | MCP/event bridge | Not implemented | Future network/event effects | Add as adapters only after a separate ADR and eval coverage. |
167
+ | Memory backend | Caller/plugin; `memory.ts` + `loop/memory.ts` | Backend reads/writes; loop file store under `stateDir` | Only human-promoted approved records enter loop prompts; prefer-over-DocBridge shrinks tokens. |
168
+ | RAG context | `src/adapters/rag-context.ts` | Optional argv / injected query | No hard `@agentskit/rag` dep; same ContextProvider freeze rules as Doc Bridge. |
169
+ | Agent registry (file) | `src/loop/agent-registry.ts` | Reads YAML | Role→TUI/argv overlay; fail closed only when `agents.requireRegistry`. |
170
+ | MCP/event bridge | `src/adapters/mcp.ts` + [ADR-0028](ADR-0028-mcp-adapter-boundary.md) | Policy-gated tool calls | Adapter-only in 0.6.0; **not** wired into tick/deliver. |
166
171
 
167
172
  ## Review status
168
173
 
@@ -90,8 +90,13 @@ delivery:
90
90
  profile: fast # one bounded pass over required lenses; `full` needs batching to fit a 600 s stage
91
91
  votes: 1
92
92
  concurrency: 4
93
- minSeverity: med # nit < med < high < blocker; findings at/above this block auto-merge
93
+ minSeverity: med
94
+ # doctorProbe: help # nit < med < high < blocker; findings at/above this block auto-merge
94
95
  deadlineMs: 600000
96
+ # smoke:
97
+ # enabled: false
98
+ # kind: verify-argv
99
+ # argv: [pnpm, test]
95
100
  merge:
96
101
  auto: true
97
102
  method: squash
@@ -104,18 +109,49 @@ delivery:
104
109
  cleanupWorktree: true # remove the Orca worktree after merge
105
110
  returnState: Todo # where a stuck/blocked issue goes back to
106
111
 
112
+
113
+ # --- 0.6.0 optional SDLC seams (defaults keep prior behaviour) ---
114
+ memory:
115
+ enabled: false # set true to recall approved learnings into contract/brief (token reduction)
116
+ # backend: file
117
+ # preferOverDocBridge: true # shrink Doc Bridge refs when memory covers them
118
+ # maxRecall: 5
119
+ # maxBlockChars: 1200
120
+ # categories: [adjustment] # only these LearningRecord categories become memory on promote
121
+ # issueCharsWithMemory: 4000
122
+
123
+ # agents:
124
+ # registryPath: agents.registry.yaml
125
+ # requireRegistry: false
126
+
127
+ # rag:
128
+ # enabled: false
129
+ # queryArgv: [] # argv printing ContextSnapshot JSON on stdout
130
+ # maxReferences: 4
131
+
132
+ # mcp: # public API / ADR-0028 — not wired into tick/deliver
133
+ # enabled: false
134
+ # allowTools: []
135
+
107
136
  contract:
108
137
  maxIssueChars: 12000 # issue text rendered into the orchestrator prompt (as untrusted data)
109
138
  timeoutMs: 300000
110
139
  maxContextReferences: 6 # Doc Bridge hits appended when .doc-bridge/index.json exists
111
140
  reuseHours: 72 # cached contract reused for this long
141
+ docBridgeMaxAgeHours: 168 # doctor warns when .doc-bridge/index.json is older
142
+ requireDocBridge: false
143
+ briefScopes: [playbook, for-agents] # Doc Bridge scopes listed in the worker brief
144
+ maxBriefReferences: 4
145
+ contextProviders: [doc-bridge] # add rag when rag.enabled
112
146
 
113
147
  schedule:
114
148
  tick: "*/5 * * * *"
115
149
  deliver: "*/10 * * * *"
116
150
  precheckTimeoutSec: 120
117
151
  harnessCommand: ak-harness # how the Orca automation runs the harness inside the workspace
118
- namePrefix: loop # automations: loop-tick, loop-deliver
152
+ namePrefix: loop # automations: loop-tick, loop-deliver[, loop-retro]
153
+ # retro: weekly # with retroIssue, installs <prefix>-retro
154
+ # retroIssue: AGE-0 # Linear issue that receives the digest comment
119
155
  runner: precheck # the stage runs inside Orca's precheck command; no agent session is ever opened
120
156
  stageTimeoutSec: 600 # Orca caps prechecks at 600 s; one tick/deliver run must fit
121
157
  # provider: claude # Orca agent that executes the automation prompt (default: watcher role)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentskit/harness",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Portable, evidence-backed development harness for coding agents.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -2,7 +2,7 @@
2
2
  "type": "agentskit-harness-release-manifest",
3
3
  "schemaVersion": 1,
4
4
  "package": "@agentskit/harness",
5
- "version": "0.5.0",
5
+ "version": "0.6.0",
6
6
  "channel": "latest",
7
7
  "sourceRevision": "b8cfe596e5f30f2c373b89f00f271079b296feaf",
8
8
  "requiredChecks": [
package/release/notes.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.6.0 release candidate
2
+
3
+ Keep-pushing loop gains approved memory (token reduction + continuous improvement), Doc Bridge freshness/review doctor probes, brief guidance scopes, optional deliver smoke, agent registry YAML, RAG context provider, MCP adapter seam (ADR-0028), Docker verify config, and weekly Linear retro automation. Config defaults preserve 0.5.0 behaviour.
4
+
1
5
  # 0.5.0 release candidate
2
6
 
3
7
  This release adds the keep-pushing SDLC loop (`ak-harness loop …`): project config with a per-machine overlay,