dsh-harbor-evolution 0.4.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.
@@ -1,114 +1,133 @@
1
- # Initialization Reference
1
+ # Strict Project Initialization
2
2
 
3
- Load this reference only when the user needs a new Harbor self-evolution workspace or is missing one of the required contracts.
3
+ Load this reference only when the project is missing the Evaluation Stack structure or the user asks to initialize it.
4
4
 
5
- ## Readiness checklist
5
+ ## Readiness worksheet
6
6
 
7
- Confirm these prerequisites before the first Job:
7
+ Resolve every value before calling `harbor_evolution_init`:
8
8
 
9
- - Docker is available to Harbor.
10
- - Node.js 22+, the selected DSH version, `harbor`, and `harbor-dsh` are available to the DSH process.
11
- - `projectRoot` is the intended workspace security boundary.
12
- - Candidate, Dataset, Job, and Promotion Policy paths stay within `projectRoot`.
13
- - Runtime credentials use evaluation accounts and are not stored in Candidate files.
9
+ | Field | Required meaning |
10
+ | --- | --- |
11
+ | `datasetPath` | Existing Harbor Dataset inside `projectRoot` |
12
+ | `stackId` / `stackVersion` | Stable identity of the complete evaluation architecture |
13
+ | `datasetId` / `datasetVersion` | Stable identity of task population and GT boundary |
14
+ | `contractId` / `contractVersion` | Stable metric semantics |
15
+ | `primaryMetric` / `primaryDirection` | Exact reward key and `maximize` or `minimize` |
16
+ | Judge provider/model/version | Reproducible Judge identity, never credentials |
17
+ | Policy id/version | Stable Gate identity |
18
+ | `minImprovement` | Accepted primary-metric delta |
14
19
 
15
- ## Clarification worksheet
20
+ Also establish diagnostic metrics, min/max thresholds, non-regression metrics, mutation surface, repeat policy, and promotion owner. The initializer creates a minimal Policy; update its explicit placeholders before a formal Gate.
16
21
 
17
- Use known repository evidence first. Ask the user only for unresolved choices.
22
+ If the Evaluator itself will be optimized, separately establish Ground Truth id/version, source kind (`human`, `programmatic`, `consensus`, `model`, or `external`), provenance, owner, Criteria, case population, and adjudication rule. Do not hide these semantics inside the Agent Dataset identity. Use `harbor_ground_truth_init` only after they are accepted.
18
23
 
19
- | Contract field | Example | Why it matters |
20
- | --- | --- | --- |
21
- | Target behavior | Produce cited research answers | Defines task success |
22
- | Candidate identity | `deep-research-agent` | Keeps v1/v2 in one product line |
23
- | Candidate path | `candidates/deep-research/v1` | Defines what is snapshotted |
24
- | Dataset path | `datasets/deep-research-regression` | Fixes tasks and Verifier |
25
- | Primary metric | `reward` | Ranks Candidates |
26
- | Minimums | completion and citation >= 0.95 | Prevents unsafe tradeoffs |
27
- | Non-regression | tool success, latency | Protects existing capability |
28
- | Mutation surface | prompt and search plugin only | Controls causal attribution |
29
- | Repeat policy | 5 fixed-seed runs | Controls stochastic variance |
30
- | Promotion owner | CI gate plus human approval | Keeps deployment external |
31
-
32
- ## Recommended layout
24
+ ## Generated layout
33
25
 
34
26
  ```text
35
- agent-workspace/
27
+ projectRoot/
28
+ ├── .harbor/
29
+ │ ├── evolution.yml
30
+ │ └── evaluation-stack.yml
36
31
  ├── candidates/
37
- │ └── <agent-id>/
38
- │ ├── v1/
39
- │ │ ├── cordis.yml
40
- │ │ ├── package.json
41
- │ │ ├── package-lock.json
42
- │ │ └── business plugins...
43
- │ └── v2/
44
32
  ├── datasets/
45
- │ └── <suite>/
46
- ├── task.toml
47
- ├── instruction.md
48
- ├── environment/Dockerfile
49
- │ └── tests/
50
- ├── test.sh
51
- │ └── verifier files...
52
- ├── policies/
53
- │ └── <suite>.json
33
+ ├── integrations/default.py
34
+ ├── renderers/default.py
35
+ ├── evaluators/default.py
36
+ ├── rubrics/default.md
37
+ ├── diagnosers/default.py
38
+ ├── optimizers/default.py
39
+ ├── runners/harbor.py
40
+ ├── reporters/default.py
41
+ ├── policies/promotion.json
54
42
  └── jobs/
55
43
  ```
56
44
 
57
- Generate `candidate-manifest.json` with `harbor_candidate_snapshot`; do not hand-author it. One immutable Candidate may be evaluated by many Jobs.
58
-
59
- ## Candidate rules
60
-
61
- A Candidate is the complete DSH/Cordis composition required to reproduce behavior:
62
-
63
- - `package.json` supplies the default Candidate id and version.
64
- - `cordis.yml` composes the model, tools, skills, loop, storage, and business plugins.
65
- - A lockfile pins transitive runtime dependencies.
66
- - Local plugin files and prompts belong in the Candidate and therefore affect its digest.
67
- - Secrets, mutable session state, Jobs, and production deployment configuration do not belong in the Candidate.
45
+ The initializer never overwrites existing files. `created` and `preserved` in its result are part of the audit. Placeholder components provide identities, not a finished business evaluator.
46
+
47
+ ## Evaluation Stack shape
48
+
49
+ ```yaml
50
+ schema_version: 1
51
+ stack_id: vertical-search
52
+ version: 1.0.0
53
+ components:
54
+ integration: { id: search-api, version: 1.0.0, entry: integrations/default.py }
55
+ renderer: { id: search-renderer, version: 1.0.0, entry: renderers/default.py }
56
+ evaluator: { id: search-evaluator, version: 1.0.0, entry: evaluators/default.py }
57
+ rubric: { id: search-rubric, version: 1.0.0, entry: rubrics/default.md }
58
+ diagnoser: { id: search-diagnoser, version: 1.0.0, entry: diagnosers/default.py }
59
+ optimizer: { id: search-optimizer, version: 1.0.0, entry: optimizers/default.py }
60
+ runner: { id: harbor-runner, version: 1.0.0, entry: runners/harbor.py, semantic: false }
61
+ reporter: { id: search-reporter, version: 1.0.0, entry: reporters/default.py }
62
+ judge:
63
+ provider: accepted-provider
64
+ model: accepted-model
65
+ version: pinned-version
66
+ parameters: { temperature: 0 }
67
+ evaluation_contract:
68
+ contract_id: vertical-search
69
+ version: 1.0.0
70
+ primary_metric: reward
71
+ metrics:
72
+ - { id: reward, label: Overall reward, direction: maximize }
73
+ - { id: valid_search_rate, label: Valid search rate, direction: maximize }
74
+ - { id: citation_accuracy, label: Citation accuracy, direction: maximize }
75
+ hard_requirements:
76
+ - { id: input_integrity }
77
+ - { id: agent_completed }
78
+ - { id: integration_valid }
79
+ - { id: renderer_valid }
80
+ - { id: judge_completed }
81
+ - { id: artifact_schema_valid }
82
+ ```
68
83
 
69
- Copy an existing known-good Candidate when possible. If none exists, create the smallest valid DSH composition for the actual business Agent; do not invent a model provider or credential scheme.
84
+ The validity requirements answer whether a quality score is admissible. They are separate from metric thresholds. Infrastructure and evaluation failures may retain raw verifier output for audit, but must emit `score.valid=false` and never enter Population aggregates.
70
85
 
71
- ## Dataset and Verifier rules
86
+ Do not duplicate Evaluator logic inside each Task. Reference one Stack Evaluator from task metadata when task-specific routing is needed.
72
87
 
73
- A Harbor Dataset contains one or more fixed Tasks. Each Task should define:
88
+ ## Dataset rules
74
89
 
75
- - `task.toml`: Task identity, timeouts, environment, and Harbor contract.
76
- - `instruction.md`: the behavior requested from the Candidate.
77
- - `environment/Dockerfile`: a reproducible sandbox with required runtime dependencies.
78
- - `tests/test.sh`: the verifier entrypoint.
79
- - Verifier code that writes primary and diagnostic metrics to Harbor's reward output.
90
+ Keep `dataset-manifest.json` at Dataset root. Generate it through initialization or `harbor-dsh dataset snapshot`; do not hand-edit its digest. Validation rejects:
80
91
 
81
- For a research Agent, useful diagnostic metrics include task completion, tool-call success, valid-search rate, citation correctness, latency, and cost. Keep their exact definitions in version control. Do not convert tool errors, empty searches, or invalid citations into prose-only observations; expose them as metrics or structured failure evidence.
92
+ - Missing/duplicate Task ids or empty instructions.
93
+ - Duplicate normalized queries.
94
+ - Missing/out-of-root paths or symlinks.
95
+ - Source/file counts that no longer match.
96
+ - Secret-bearing metadata fields.
82
97
 
83
- ## Promotion Policy starter
98
+ Intentional Dataset changes require a new Dataset version, a new snapshot, and a fresh baseline.
84
99
 
85
- Create this only after the user accepts the metric names and thresholds:
100
+ ## Promotion Policy v2
86
101
 
87
102
  ```json
88
103
  {
89
- "schema_version": 1,
104
+ "schema_version": 2,
105
+ "policy_id": "vertical-search",
106
+ "version": "1.0.0",
90
107
  "primary_metric": "reward",
108
+ "primary_direction": "maximize",
91
109
  "min_improvement": 0.05,
92
- "minimums": {
93
- "task_completion": 0.95
94
- },
95
- "non_regression": [
96
- "tool_call_success",
97
- "citation_correctness"
98
- ],
99
- "non_regression_tolerance": 0.0
110
+ "minimums": { "citation_accuracy": 0.9 },
111
+ "maximums": { "latency_seconds": 20 },
112
+ "non_regression": ["valid_search_rate"],
113
+ "metric_directions": { "valid_search_rate": "maximize" },
114
+ "non_regression_tolerance": 0.0,
115
+ "hard_requirements": ["exception_free", "artifact_schema_valid", "doctor_error_free"]
100
116
  }
101
117
  ```
102
118
 
103
- This is a structural example, not a universal default. Thresholds must reflect business risk and sample size. Version the policy; changing it invalidates comparisons made under the old promotion contract.
119
+ Use business-accepted thresholds. Do not assume all metrics are `/10`, maximized, or universal across domains.
120
+
121
+ ## Handoff before the first Job
104
122
 
105
- ## First-cycle handoff
123
+ Show the user:
106
124
 
107
- Before calling an evaluation tool, show the user:
125
+ 1. Resolved Candidate, Dataset, Stack, Policy, and Jobs paths.
126
+ 2. Role identities and which ones affect reward comparability.
127
+ 3. Metric directions, thresholds, groups, and hard requirements.
128
+ 4. Holdout, mutation, side-effect, repeat, and deployment boundaries.
129
+ 5. Doctor findings and Context preview.
108
130
 
109
- 1. The resolved Candidate, Dataset, Job, and policy paths.
110
- 2. The metric and promotion contract.
111
- 3. The mutation and side-effect boundaries.
112
- 4. Any assumptions still being used.
131
+ Start with a baseline. Do not create Candidate v2 until baseline evidence supports one controlled hypothesis.
113
132
 
114
- Then snapshot and run the baseline. Do not initialize v2 until baseline evidence identifies a concrete hypothesis.
133
+ The first completed Job should produce `trial-lifecycle.json`, `trial-events.jsonl`, Trial Assessment v2 files, `artifact-registry.json`, Population Report v2, and Optimization Report v2. Treat missing 0.6 capabilities on older Jobs as read-only historical limitations, not synthetic defaults.