@agentskit/harness 0.4.0 → 0.5.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,639 @@
1
+ # Harness 0.4.0 PRD and architecture roadmap
2
+
3
+ Status: proposal for implementation and release
4
+
5
+ This document consolidates the ideas extracted from `agentskit-devflow`, the
6
+ AgentsKit Playbook, and the current `@agentskit/harness` implementation. It is
7
+ the working PRD for the Harness as a modular SDLC control engine and loop
8
+ engineer.
9
+
10
+ ## Product objective
11
+
12
+ The Harness must make agent-assisted delivery predictable, auditable,
13
+ configurable, and measurable without becoming a monolithic replacement for
14
+ agents, orchestrators, trackers, or developer tools.
15
+
16
+ 1. High-quality structure: explicit contracts, predictable organization,
17
+ directional dependencies, deterministic tests, and current documentation.
18
+ 2. Modular composition: capabilities are replaceable through profiles and
19
+ adapters without editing the kernel.
20
+ 3. Controlled SDLC: state machines, workflows, bounded parallelism, caching,
21
+ agent memory, gates, recovery, and auditability.
22
+ 4. Loop engineering: every run measures outcome, cost, speed, failures, and
23
+ evidence so the next iteration can improve the process.
24
+
25
+ ## Kernel mission and boundary
26
+
27
+ The Harness is the **SDLC control plane**. It coordinates, validates, measures,
28
+ and enforces contracts. Concrete capabilities are supplied by adapters.
29
+
30
+ ```text
31
+ Harness kernel
32
+ ├─ controls: phases, state machines, gates, policies, budgets, evidence
33
+ ├─ optimizes: context, memory, cache, parallelism, and recovery
34
+ ├─ observes: tokens, cost, duration, CPU, memory, precision, regressions
35
+ └─ connects: coding agents, Orca, Doc Bridge, code review, trackers, runtime
36
+ ```
37
+
38
+ The kernel must not contain a coding agent, model, UI, mandatory Docker
39
+ sandbox, or concrete GitHub/Linear client. It provides protocols so those
40
+ components can be swapped without rewriting workflows.
41
+
42
+ ### Kernel responsibilities
43
+
44
+ - start from the issue contract and run the discovery/`grill-me` cycle;
45
+ - surface ambiguities, options, and recommendations before development;
46
+ - stop only at material human decisions defined by the contract;
47
+ - validate documentation, code, context, DoD, and acceptance criteria before
48
+ opening a PR;
49
+ - orchestrate agents and sub-agents with concurrency and budget limits;
50
+ - persist decisions, artifacts, hashes, events, and evidence;
51
+ - prevent incomplete PRs, changed approved content, and invalid transitions;
52
+ - resume idempotently after failure, timeout, or interruption;
53
+ - measure quality, cost, speed, memory, cache, parallelism, and machine load.
54
+
55
+ ### Out of the kernel
56
+
57
+ - deciding product ambiguity or business rules autonomously;
58
+ - replacing the coding agent, model, or review tool;
59
+ - maintaining a shadow copy of issues or PRs;
60
+ - requiring Docker when a process runtime is sufficient;
61
+ - treating missing telemetry as zero;
62
+ - closing an issue or claiming production validation without evidence.
63
+
64
+ ## Plugin and adapter contract
65
+
66
+ Every plugin declares capabilities, inputs, outputs, effects, lifecycle,
67
+ cancellation, errors, and telemetry. The kernel provides run identity, bound
68
+ context, policy, budget, cancellation, and event emission.
69
+
70
+ | Adapter | Provides | Must return |
71
+ |---|---|---|
72
+ | Coding agent | Analysis, edits, and tests | Structured result, diff, usage, failures |
73
+ | Orca | Dispatch, leases, worktrees | Lease, state, events, recovery data |
74
+ | Doc Bridge | Documentation and knowledge | Sources, hashes, relevance, context used |
75
+ | Code review | Adversarial review | Verdict, findings, severity, confidence, evidence |
76
+ | Memory | Reusable facts and decisions | Hits, origin, validity, context cost |
77
+ | Cache | Reusable results/context | Hit/miss, key, validity, savings estimate |
78
+ | Runtime | Process or Docker execution | Command, limits, attestation, output, resources |
79
+ | GitHub/Linear | PRs, issues, transitions | Remote state, SHA, idempotency key, confirmation |
80
+
81
+ Adapters may not bypass the state machine, policy gate, budget, or evidence
82
+ binding. Missing telemetry is `unknown`, never an implicit success.
83
+
84
+ ## Reference workflow
85
+
86
+ ```mermaid
87
+ flowchart TD
88
+ Issue[Linear issue + GitHub code] --> Preflight[Contract and grill-me]
89
+ Preflight -->|material ambiguity| Human[One human decision packet]
90
+ Preflight -->|defined| Context[Doc Bridge + memory + cache]
91
+ Context --> Plan[Structured plan]
92
+ Plan --> Review[Adversarial code review adapter]
93
+ Review --> Implement[Coding agent adapter]
94
+ Implement --> Verify[Tests, lint, eval, runtime]
95
+ Verify --> Audit[DoD, evidence, quality matrix]
96
+ Audit -->|failure| Repair[Bounded repair and resume]
97
+ Repair --> Verify
98
+ Audit -->|pass| PR[Deterministic PR]
99
+ PR --> QA[GitHub/Linear: QA]
100
+ QA --> Production[Real production validation]
101
+ Production --> Learn[Metrics, memory, profile learning]
102
+ Learn --> Preflight
103
+ ```
104
+
105
+ `yolo` changes operational pause thresholds only. It never removes product
106
+ decisions, security gates, evidence requirements, or mandatory HITL points.
107
+
108
+ ## Lifecycle and failure semantics
109
+
110
+ The kernel owns the execution state; GitHub and Linear show projections of that
111
+ state. A feature is not complete when a PR is opened.
112
+
113
+ ```text
114
+ CLARIFYING → PLANNED → IMPLEMENTING → VERIFYING
115
+ ↑ │ │ │
116
+ └─ decision ──┘ │ ├─ failed → IMPLEMENTING
117
+ │ └─ passed → READY_FOR_QA
118
+ └─ failure ───────────────┘
119
+
120
+ READY_FOR_QA → PRODUCTION_VALIDATING → COMPLETE
121
+ │ │
122
+ └─ QA failure ────┴→ VERIFYING (new source revision invalidates evidence)
123
+ ```
124
+
125
+ `AWAITING_HUMAN_APPROVAL`, `AWAITING_AUTHORIZATION`, and `BLOCKED` are explicit
126
+ states that can interrupt any gated transition. Every transition records the
127
+ actor, reason, source revision, contract hash, evidence IDs, and run ID.
128
+
129
+ The tracker projection must update Linear to `QA` only after feature validation
130
+ passes. Production validation is a separate gate. A failed QA or production
131
+ check returns the run to verification and invalidates downstream evidence.
132
+
133
+ ## Traceability contract
134
+
135
+ Every requirement and decision receives a stable ID. The release report must
136
+ map each ID through the complete chain:
137
+
138
+ ```text
139
+ requirement → issue → phase → artifact → check/eval → evidence → gate → release
140
+ ```
141
+
142
+ An item without a current evidence reference is `unverified`. An item changed
143
+ after evidence was produced is `stale`. Aggregate dashboards may summarize this
144
+ chain, but cannot replace criterion-level evidence.
145
+
146
+ ## Current Harness state
147
+
148
+ | Capability | Evidence | Assessment |
149
+ |---|---|---|
150
+ | Workflow DAG and concurrency | `src/workflow.ts` | Strong base; needs configurable SDLC phase profiles |
151
+ | State machine and verification contract | `src/state-machine.ts`, `src/verification.ts`, `src/types.ts` | Covers transitions and stale evidence |
152
+ | Event log, locks, recovery | `src/events.ts`, `src/agent.ts`, `src/resilience.ts` | Base for diary, replay, and resume |
153
+ | Policy and delivery gates | `src/policy.ts`, `src/delivery.ts` | Base for pre-PR gates and HITL |
154
+ | Process/Docker runtime | `src/runtime.ts` | Docker optional; process mode supported |
155
+ | Doc Bridge, Orca, tracking adapters | `src/adapters/` | Correct direction; keep providers outside the kernel |
156
+ | Metrics, eval, memory, cache | `src/metrics.ts`, `src/eval.ts`, `src/memory.ts`, `src/cache.ts` | Initial instrumentation; bind it to phases |
157
+ | Profiles and context | `src/profiles.ts`, `src/context.ts` | Base for modes and composition |
158
+
159
+ The current registry in `src/plugins.ts` is the starting point for capability
160
+ composition. The current adapters are projections/planners rather than a full
161
+ integration suite; H-045 and H-047A must prove real adapter behavior wherever a
162
+ component is changed.
163
+
164
+ Runtime guarantees are mode-specific. Process mode provides shell-free
165
+ execution, timeouts, output limits, and configured environment handling; it does
166
+ not provide filesystem or network isolation. Docker mode adds the configured
167
+ sandbox controls and attestation. An adapter must declare its assurance level
168
+ instead of implying that every runtime has the same isolation.
169
+
170
+ Cache measurements must distinguish result cache, context cache, and provider
171
+ prefix cache. A hit is not a token saving unless provider usage or a measured
172
+ equivalent is available.
173
+
174
+ ## Agents Playbook practices to adopt
175
+
176
+ The Playbook is modular; adopt a practice because it prevents a real failure,
177
+ not to create completeness theater. Reference:
178
+ <https://playbook.agentskit.io/llms.txt>.
179
+
180
+ ### Day-zero kernel invariants
181
+
182
+ - typed boundaries for profiles, plugins, events, artifacts, and adapters;
183
+ - named exports and stable public entry points;
184
+ - stable typed error hierarchy and machine-readable error codes;
185
+ - ADR before architecture changes and RFC before breaking public contracts;
186
+ - verify-first checks for issue, branch, SHA, context, and remote state;
187
+ - honest confidence: `automated-verified`, `claimed`, `not-verified`,
188
+ `known-not-done`;
189
+ - fail-loud defaults for mandatory dependencies;
190
+ - structured PR intent (`adds`, `changes`, `removes`, `tests`, `docs`);
191
+ - fast quality gates before push and in CI;
192
+ - deny-by-default egress and dependency hygiene.
193
+
194
+ ### Agent behavior
195
+
196
+ - bootstrap and routing documents that tell an agent what to read and where to
197
+ edit;
198
+ - versioned prompt and tool registries with hashes and eval results;
199
+ - explicit context selection, ordering, compaction, retention, and cost;
200
+ - grounding, constrained generation, and abstention when evidence is weak;
201
+ - scoped sub-agent contracts; child results never approve the parent task;
202
+ - three-tier eval: deterministic, LLM-as-judge, and production monitoring.
203
+
204
+ ## Event Bridge
205
+
206
+ Event Bridge is useful, but an external broker is not a day-zero dependency.
207
+
208
+ Define the contract now:
209
+
210
+ ```text
211
+ eventId, eventType, schemaVersion, occurredAt,
212
+ runId, issueRef, sourceRevision, correlationId,
213
+ payload, idempotencyKey, provenance
214
+ ```
215
+
216
+ Rules: at-least-once delivery, idempotent consumers, compatible schema
217
+ evolution, replay, inspection, dead-letter handling, and backpressure that
218
+ cannot stall the main workflow.
219
+
220
+ Implementation order:
221
+
222
+ 1. Use the existing append-only event log as the source of truth and define an
223
+ `EventSink`/`EventBridge` interface.
224
+ 2. Add a queue, pub/sub, or stream adapter only when real independent
225
+ consumers require it.
226
+
227
+ Do not select Kafka, NATS, Redis, or another broker before measuring volume,
228
+ durability, and latency needs.
229
+
230
+ ## MCP
231
+
232
+ MCP is an integration boundary, not the internal orchestration layer. The
233
+ Harness must remain fully usable without MCP.
234
+
235
+ Initial read-only surface:
236
+
237
+ - discover profiles and capabilities;
238
+ - inspect runs and their lifecycle state;
239
+ - read artifacts, evidence, decisions, and blockers;
240
+ - inspect gate status and quality metrics;
241
+ - request bounded Doc Bridge or memory context.
242
+
243
+ Start, pause, resume, and cancel are mutating operations even when they do not
244
+ touch an external service. They require a separate gated MCP surface with
245
+ authorization, idempotency, and audit evidence. Arbitrary shell execution, PR
246
+ publication, remote issue transitions, worktree cleanup, secrets, and
247
+ out-of-scope context are never exposed by the default profile.
248
+
249
+ Implement the capability manifest first, then a local/stdio read-only MCP
250
+ adapter. Add mutating operations only after authorization, idempotency, and
251
+ audit evidence are proven.
252
+
253
+ ## Consolidated execution plan
254
+
255
+ ### Phase 0 — Baseline and architectural contract
256
+
257
+ - inventory modules, imports, and public exports;
258
+ - classify modules as kernel, execution, context, delivery, profile, or adapter;
259
+ - record forbidden dependencies and justified exceptions;
260
+ - capture typecheck, test, build, pack, and metric baselines;
261
+ - create the versioned eval manifest, golden corpus, rubrics, and no-Harness
262
+ baseline before feature implementation;
263
+ - record provider/model, prompt/tool versions, repetitions, seed/temperature
264
+ where applicable, and thresholds for every eval;
265
+ - write the kernel/adapters ADR and plugin contract.
266
+
267
+ Output: module map, dependency rules, extension contract, and reproducible eval
268
+ baseline.
269
+
270
+ ### Phase 1 — Kernel/adapters organization
271
+
272
+ Target capability-first layout:
273
+
274
+ ```text
275
+ src/
276
+ kernel/ # workflow, machine, policy, events, evidence, hashes
277
+ execution/ # runtime, recovery, coordination, budgets, metrics
278
+ context/ # context contracts, memory, cache
279
+ delivery/ # gates and deterministic composition
280
+ adapters/ # Orca, Doc Bridge, GitHub, Linear, review, providers
281
+ profiles/ # declarative capability composition and modes
282
+ ```
283
+
284
+ Move mechanically by capability, preserve `src/index.ts` re-exports, run
285
+ typecheck/tests after each group, and do not create folders for one-file layers
286
+ without a real boundary.
287
+
288
+ ### Phase 2 — Deterministic SDLC engine
289
+
290
+ - define profiles with phases, inputs, outputs, dependencies, gates, retries,
291
+ and budgets;
292
+ - run preflight/`grill-me` before mutation;
293
+ - aggregate ambiguities into one human decision packet;
294
+ - continue automatically when the contract is complete;
295
+ - support `safe`, `yolo`, and `dry-run` through one engine;
296
+ - reject cycles and unbounded retries.
297
+
298
+ ### Phase 3 — Artifacts, decision log, and recovery
299
+
300
+ - implement a versioned `ArtifactEnvelope` in JSON plus a readable form;
301
+ - bind artifacts to run, issue, SHA, contract, configuration, and context;
302
+ - record plan, findings, decisions, repairs, and blockers;
303
+ - resume from the event log without repeating completed effects;
304
+ - invalidate stale artifacts and evidence.
305
+
306
+ ### Phase 4 — Operational adapters
307
+
308
+ - coding agent: structured output, diff, usage, and failures;
309
+ - Orca: leases, deterministic worktrees, issue locks, remote SHA confirmation,
310
+ and safe cleanup;
311
+ - Doc Bridge: source, hash, relevance, and context cost;
312
+ - memory/cache: hit/miss, validity, scope, and measured savings;
313
+ - process/Docker runtime selected by profile;
314
+ - GitHub/Linear effects idempotent and evidence-bound.
315
+
316
+ ### Phase 5 — Delivery gates
317
+
318
+ - review and audit before opening a PR;
319
+ - derive PR intent from structured fields;
320
+ - bind approved PR content to a hash;
321
+ - publish only after checks, DoD, and audit pass;
322
+ - transition Linear to QA after feature validation;
323
+ - validate production before closing the delivery;
324
+ - confirm remote branch/SHA before worktree cleanup.
325
+
326
+ ### Phase 6 — Efficiency and observability
327
+
328
+ - measure input/output/cache tokens, cost, and duration per phase;
329
+ - measure memory/context retrieval, cache hit/miss, and relevance;
330
+ - measure parallelism, contention, CPU, RAM, and saturation;
331
+ - classify failures and enforce watchdog budgets;
332
+ - fix provider/model for comparison experiments;
333
+ - never convert missing telemetry to zero.
334
+
335
+ ### Phase 7 — Loop engineer
336
+
337
+ - maintain real issues and a baseline without the Harness;
338
+ - run evals by version, profile, and fixed provider/model;
339
+ - score each quality dimension from 0 to 100;
340
+ - produce periodic results and blocker packages;
341
+ - promote approved learnings into profile or adapter changes;
342
+ - repeat: run → measure → review → adjust → validate.
343
+
344
+ ## Release scope for 0.4.0
345
+
346
+ ### In scope
347
+
348
+ - kernel/adapters separation with compatible public exports;
349
+ - versioned capability, event, and error contracts;
350
+ - configurable phase profiles and bounded retries;
351
+ - versioned artifacts, decision log, and idempotent resume;
352
+ - structured preflight/`grill-me` and adversarial verdicts;
353
+ - deterministic PR intent and immutable content binding;
354
+ - per-phase token, cost, cache, memory, duration, parallelism, CPU, RAM, and
355
+ failure metrics;
356
+ - contracts for coding agents, Orca, Doc Bridge, code review, memory, cache,
357
+ runtime, GitHub, and Linear;
358
+ - `safe`, `yolo`, and `dry-run` profiles;
359
+ - quality gates, eval battery, documentation, and extension examples;
360
+ - real integration evals for every touched AgentsKit component, with pinned
361
+ versions and release evidence;
362
+ - Event Bridge contract and capability manifest for future MCP integration.
363
+
364
+ ### Out of scope
365
+
366
+ - external event broker;
367
+ - mutating or remote MCP server;
368
+ - dynamic plugin marketplace/loader;
369
+ - custom dashboard or UI;
370
+ - mandatory concrete provider/tracker clients;
371
+ - unmeasured optimizations or breaking migration of all consumers.
372
+
373
+ ## Deliverables and issue breakdown
374
+
375
+ Each issue is a vertical unit with a contract, evidence, and rollback plan.
376
+
377
+ ### H-040 — Baseline and boundary map
378
+
379
+ - [ ] inventory modules, imports, and public exports;
380
+ - [ ] classify every module and record dependency exceptions;
381
+ - [ ] record reproducible baselines;
382
+ - [ ] create the versioned eval manifest and no-Harness baseline;
383
+ - [ ] define rubrics, thresholds, repetition counts, and comparison policy;
384
+ - [ ] create the kernel/adapters ADR.
385
+
386
+ DoD: reviewed map, reproducible test/metric/eval baseline, and no new runtime
387
+ behavior.
388
+
389
+ ### H-041 — Capability, event, and error contracts
390
+
391
+ - [ ] version plugin/capability interfaces;
392
+ - [ ] standardize lifecycle, cancellation, timeout, effects, and telemetry;
393
+ - [ ] standardize event envelope and idempotency key;
394
+ - [ ] standardize stable error codes;
395
+ - [ ] validate schemas at boundaries;
396
+ - [ ] publish a static capability manifest.
397
+
398
+ DoD: contracts compile and pass round-trip/compatibility tests.
399
+
400
+ ### H-042 — Physical organization and API compatibility
401
+
402
+ - [ ] move modules only across real capability boundaries;
403
+ - [ ] preserve `src/index.ts` re-exports;
404
+ - [ ] remove kernel imports of adapters;
405
+ - [ ] add directional dependency tests;
406
+ - [ ] update organization docs and ADRs.
407
+
408
+ DoD: typecheck, consumer tests, and package checks pass without public API
409
+ breakage.
410
+
411
+ ### H-043 — Phase profile and deterministic executor
412
+
413
+ - [ ] define phase schema with inputs, outputs, dependencies, gates, retries,
414
+ and budgets;
415
+ - [ ] compose over existing workflow, state machine, and policy primitives;
416
+ - [ ] run preflight before mutation;
417
+ - [ ] aggregate human ambiguity decisions;
418
+ - [ ] implement safe, yolo, and dry-run profiles;
419
+ - [ ] reject cycles and infinite retries.
420
+
421
+ DoD: the same contract yields the same route; pass/block/escalate/retry,
422
+ cancel, and resume are covered.
423
+
424
+ ### H-044 — Artifacts, decision log, and resume
425
+
426
+ - [ ] implement versioned `ArtifactEnvelope`;
427
+ - [ ] bind artifacts to run, issue, SHA, contract, config, and context;
428
+ - [ ] record plans, findings, decisions, repairs, and blockers;
429
+ - [ ] resume idempotently from the event log;
430
+ - [ ] invalidate stale evidence;
431
+ - [ ] provide human-readable and JSON inspection.
432
+
433
+ DoD: interruptions at every phase are resumable or honestly blocked.
434
+
435
+ ### H-045 — Execution and context adapters
436
+
437
+ - [ ] adapt coding agents with structured results, diffs, usage, and failures;
438
+ - [ ] complete Orca lease/lock/worktree and remote SHA confirmation;
439
+ - [ ] enrich Doc Bridge with relevance, source, hash, and cost;
440
+ - [ ] measure memory and cache scope, validity, hits, and savings;
441
+ - [ ] retain process/Docker selection by profile;
442
+ - [ ] keep GitHub/Linear effects idempotent.
443
+
444
+ DoD: every adapter has a fake/dry-run path and cannot bypass policy or evidence.
445
+
446
+ ### H-046 — Adversarial review and delivery gates
447
+
448
+ - [ ] add configurable parallel review lenses;
449
+ - [ ] require evidence/reproduction for findings;
450
+ - [ ] treat missing reviewers as unverified/block;
451
+ - [ ] generate PR intent from structured fields;
452
+ - [ ] bind PR content to G2/G3 hashes;
453
+ - [ ] publish only after checks, DoD, and audit pass;
454
+ - [ ] transition Linear to QA after feature validation.
455
+
456
+ DoD: incomplete, modified, or unaudited PRs cannot be published.
457
+
458
+ ### H-047 — Telemetry, eval, and quality matrix
459
+
460
+ - [ ] record per-phase and per-adapter metrics;
461
+ - [ ] measure tokens, cost, duration, CPU, RAM, memory, cache, and parallelism;
462
+ - [ ] classify failures and enforce watchdog budgets;
463
+ - [ ] run the eval battery on every relevant change;
464
+ - [ ] produce 0–100 scores and baseline deltas;
465
+ - [ ] keep missing telemetry explicitly unknown.
466
+
467
+ DoD: reproducible report covers quality, cost, speed, precision, and resources.
468
+
469
+ ### H-047A — Eval battery and touched-component impact
470
+
471
+ Normal tests validate implementation. Evals validate behavior and quality;
472
+ both are mandatory.
473
+
474
+ The eval manifest is created in H-040 and extended by every issue. A feature
475
+ cannot enter implementation without a manifest entry describing its expected
476
+ behavior, affected components, grader, threshold, and evidence output.
477
+
478
+ Required layers:
479
+
480
+ 1. contract eval: schemas, exports, errors, events, idempotency, compatibility;
481
+ 2. deterministic behavior: state, workflow, gates, retries, cancel, resume,
482
+ and dry-run;
483
+ 3. integration eval for every touched real adapter;
484
+ 4. quality eval for completeness, precision, grounding, evidence, escalation,
485
+ and PR quality;
486
+ 5. regression/golden eval against previous version and no-Harness baseline;
487
+ 6. resource eval for tokens, cache, memory, duration, parallelism, CPU, RAM,
488
+ and cost.
489
+
490
+ | Component | Required eval focus |
491
+ |---|---|
492
+ | Core/state machine | Contracts, determinism, replay, policy, compatibility |
493
+ | Workflow | Legal/illegal transitions, cycles, retry, cancel, fan-out/fan-in |
494
+ | Memory | Scope, relevance, contamination, TTL, redaction, context budget |
495
+ | Cache | Keys, validity, invalidation, isolation, measured savings |
496
+ | Doc Bridge | Recall/precision, source/hash, stale rejection, cost |
497
+ | Agent/model adapter | Output schema, tool calls, usage, timeout, abort, failures |
498
+ | Orca/worktree | Claims, locks, deterministic branch, conflicts, resume, cleanup |
499
+ | Runtime | Limits, process/Docker parity, egress, attestation, cancellation |
500
+ | Code review | Independent lenses, refutation, reproduction, missing reviewer |
501
+ | GitHub/Linear | Idempotency, states, SHA, PR intent, transitions |
502
+ | Eval/metrics | Calibration, reproducibility, false positives/negatives |
503
+
504
+ Minimum thresholds:
505
+
506
+ - critical contracts, security, policy, provenance, and idempotency: 100% pass;
507
+ - required deterministic corpus: 100% pass;
508
+ - subjective quality: manifest threshold, initially 80/100;
509
+ - no dimension regresses more than 5 points without a recorded decision;
510
+ - `unknown`, `unverified`, and `stale` never count as approval;
511
+ - a failure in a touched component blocks dependent work;
512
+ - prompt, model, memory, cache, or adapter changes require comparative eval.
513
+
514
+ ### H-047B — AgentsKit ecosystem compatibility eval
515
+
516
+ This issue closes the gap between adapter interfaces and real ecosystem
517
+ behavior. It is required whenever a change touches an AgentsKit package,
518
+ repository, prompt, or provider integration.
519
+
520
+ - [ ] pin the exact versions/revisions of every touched AgentsKit component;
521
+ - [ ] run the component's own tests and documented evals;
522
+ - [ ] run the Harness integration eval using the real adapter boundary;
523
+ - [ ] compare behavior with the previous version and no-Harness baseline;
524
+ - [ ] record compatibility, migration, and rollback evidence;
525
+ - [ ] publish or update the affected package only after its eval gate passes;
526
+ - [ ] record the published artifact/version in the Harness release manifest.
527
+
528
+ The initial component matrix includes core, memory, adapters, runtime,
529
+ Doc Bridge, code review, and eval. Untouched components receive a compatibility
530
+ smoke test; touched components require the full relevant battery. A passing
531
+ Harness test with a failing upstream component eval is a release blocker.
532
+
533
+ ### H-048 — Documentation and adoption
534
+
535
+ - [ ] update README with kernel/adapters architecture;
536
+ - [ ] document minimum profile, minimum adapter, and dry-run;
537
+ - [ ] add agent, Doc Bridge, code-review, and tracking examples;
538
+ - [ ] document extension and troubleshooting;
539
+ - [ ] update ADRs, changelog, migration notes, and capability manifest.
540
+
541
+ DoD: a consumer can install, run a fake profile, and write an adapter without
542
+ reading internals.
543
+
544
+ ### H-049 — Hardening and release candidate
545
+
546
+ - [ ] run unit, contract, integration, CLI, and consumer-tarball tests;
547
+ - [ ] run `ak-verify` against the current contract;
548
+ - [ ] validate build, pack, exports, docs, and generated output;
549
+ - [ ] run the complete eval battery and fixed-provider pilot benchmark;
550
+ - [ ] run every required AgentsKit component eval for the actual touched
551
+ versions/revisions;
552
+ - [ ] verify that CI release gates consume the same eval manifest and evidence
553
+ bundle as the release candidate;
554
+ - [ ] perform adversarial review of the full diff;
555
+ - [ ] close or classify every blocker.
556
+
557
+ DoD: no P0 criterion is pending and the release candidate is reproducible from
558
+ a clean revision.
559
+
560
+ ## 0.4.0 quality gates
561
+
562
+ | Dimension | Release gate |
563
+ |---|---|
564
+ | Contracts/provenance | 100% external interfaces schema-validated and hash-bound |
565
+ | Determinism | 100% reference-profile cases reproducible |
566
+ | Eval battery | 100% required layers and touched-component evals executed |
567
+ | Security | Zero policy, egress, or secret violations |
568
+ | Evidence | 100% pilot criteria have current evidence |
569
+ | Delivery | Zero PRs without intent, DoD, and audit |
570
+ | Recovery | Every interruption point resumes or blocks honestly |
571
+ | Efficiency | Baseline recorded; no >10% regression without justification |
572
+ | Technical quality | Typecheck, tests, build, pack, and consumer checks green |
573
+ | Documentation | README, organization, ADRs, changelog, and examples current |
574
+ | Observability | Missing token/cost/resource data remains explicitly unknown |
575
+
576
+ An aggregate score cannot compensate for a failed P0 gate. The release cannot
577
+ ship with any required criterion `blocked`, `unverified`, or `stale`.
578
+
579
+ ### Scoring and reproducibility
580
+
581
+ Each dimension is a versioned set of weighted criteria. For criterion `i`,
582
+ `statusScore(i)` is `1` for pass, `0.5` for explicitly partial, and `0` for
583
+ fail, unknown, unverified, or stale. `not-applicable` is removed from the
584
+ denominator only with a recorded reason.
585
+
586
+ ```text
587
+ dimensionScore = round(100 × Σ(weight[i] × statusScore(i)) / Σ(weight[i]))
588
+ overallScore = round(Σ(dimensionWeight[d] × dimensionScore[d]) /
589
+ Σ(dimensionWeight[d]))
590
+ delta = candidateScore − baselineScore
591
+ ```
592
+
593
+ The manifest fixes the criteria, weights, corpus version, provider/model,
594
+ prompt/tool hashes, profile, configuration hash, repetition count, and
595
+ seed/temperature where supported. Deterministic checks run once; nondeterministic
596
+ provider or judge checks use the manifest repetition count and report
597
+ min/median/max. A critical criterion is a veto: it must be `1`, regardless of
598
+ the aggregate score. A score without these inputs is not comparable.
599
+
600
+ ## Dependency order
601
+
602
+ ```text
603
+ H-040 → H-041 → H-042 → H-043 → H-044
604
+ ↘ H-045 → H-046 → H-047 → H-047A → H-047B → H-048 → H-049
605
+ ```
606
+
607
+ H-045 may start after H-041 when it uses stable contracts. H-046 requires
608
+ H-043 and H-044. H-047/H-047A start early for baseline collection but close
609
+ only after every touched adapter and AgentsKit component is evaluated. H-047B
610
+ may run in parallel for independent components, but must close before H-048 and
611
+ H-049. H-049 is hardening and release, not a place for new features.
612
+
613
+ ## 0.4.0 publication checklist
614
+
615
+ 1. Merge H-040 through H-049 into `main` in dependency order.
616
+ 2. Update `package.json` to `0.4.0` and add the changelog entry.
617
+ 3. Run `pnpm typecheck`, `pnpm test`, `pnpm build`, and `pnpm pack`.
618
+ 4. Run the real CLI flow, `ak-verify`, the complete eval battery, and pilot
619
+ benchmarks.
620
+ 5. Confirm revision, contract, configuration, and run IDs in the final report.
621
+ 6. Merge to `main`; Trusted Publishing releases only when the package version
622
+ changes and never uses `NPM_TOKEN`.
623
+ 7. Verify the registry tarball and `@agentskit/harness@0.4.0`.
624
+ 8. Run a smoke test as a consumer of the published package.
625
+ 9. Record publication evidence and start the next baseline.
626
+
627
+ Any failure leaves the release `BLOCKED`; there is no manual bypass.
628
+
629
+ ## Open decisions
630
+
631
+ - final profile format: JSON, YAML, or validated TypeScript;
632
+ - artifact persistence: local filesystem only or storage adapter;
633
+ - mandatory phases for the pilot profile;
634
+ - quality-score weights and HITL thresholds;
635
+ - retention and redaction policy for memory/context logs;
636
+ - first real-issue corpus and no-Harness baseline.
637
+
638
+ These decisions require a human choice when they change product behavior, risk,
639
+ cost, or policy. Agents should provide options, evidence, and a recommendation.