howhard 3.2.0__tar.gz → 3.3.0__tar.gz

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 (103) hide show
  1. {howhard-3.2.0 → howhard-3.3.0}/.antigravity-plugin/plugin.json +1 -1
  2. {howhard-3.2.0 → howhard-3.3.0}/.claude-plugin/plugin.json +1 -1
  3. {howhard-3.2.0 → howhard-3.3.0}/CHANGELOG.md +13 -0
  4. {howhard-3.2.0/src/howhard.egg-info → howhard-3.3.0}/PKG-INFO +1 -1
  5. {howhard-3.2.0 → howhard-3.3.0}/docs/capability.md +20 -12
  6. {howhard-3.2.0 → howhard-3.3.0}/docs/reference.md +51 -24
  7. {howhard-3.2.0 → howhard-3.3.0}/docs/semantic-memory.md +19 -10
  8. {howhard-3.2.0 → howhard-3.3.0}/docs/technical-report.md +13 -6
  9. {howhard-3.2.0 → howhard-3.3.0}/plugin.json +1 -1
  10. {howhard-3.2.0 → howhard-3.3.0}/skills/howhard/SKILL.md +7 -3
  11. {howhard-3.2.0 → howhard-3.3.0}/skills/howhard/references/accounting.md +8 -1
  12. {howhard-3.2.0 → howhard-3.3.0}/skills/howhard/references/workflow.md +16 -8
  13. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/__init__.py +1 -1
  14. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/accounting.py +46 -2
  15. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/capability.py +138 -26
  16. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/cli.py +3 -3
  17. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/context.py +2 -1
  18. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/data/semantic.toml +2 -2
  19. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/decisions.py +6 -5
  20. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/engine.py +9 -3
  21. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/report.py +12 -0
  22. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/semantic.py +95 -15
  23. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/storage.py +66 -11
  24. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/success.py +56 -8
  25. {howhard-3.2.0 → howhard-3.3.0/src/howhard.egg-info}/PKG-INFO +1 -1
  26. {howhard-3.2.0 → howhard-3.3.0}/src/howhard.egg-info/SOURCES.txt +1 -0
  27. howhard-3.3.0/tests/test_active_duration.py +390 -0
  28. {howhard-3.2.0 → howhard-3.3.0}/tests/test_capability_filter.py +43 -19
  29. {howhard-3.2.0 → howhard-3.3.0}/tests/test_semantic.py +1 -1
  30. {howhard-3.2.0 → howhard-3.3.0}/.agents/plugins/marketplace.json +0 -0
  31. {howhard-3.2.0 → howhard-3.3.0}/.claude-plugin/marketplace.json +0 -0
  32. {howhard-3.2.0 → howhard-3.3.0}/.readthedocs.yaml +0 -0
  33. {howhard-3.2.0 → howhard-3.3.0}/AGENTS.md +0 -0
  34. {howhard-3.2.0 → howhard-3.3.0}/MANIFEST.in +0 -0
  35. {howhard-3.2.0 → howhard-3.3.0}/README.md +0 -0
  36. {howhard-3.2.0 → howhard-3.3.0}/benchmarks/__init__.py +0 -0
  37. {howhard-3.2.0 → howhard-3.3.0}/benchmarks/bench_rule_retrieval.py +0 -0
  38. {howhard-3.2.0 → howhard-3.3.0}/benchmarks/rule_cases.json +0 -0
  39. {howhard-3.2.0 → howhard-3.3.0}/benchmarks/rule_retrieval.py +0 -0
  40. {howhard-3.2.0 → howhard-3.3.0}/docs/assets/README.md +0 -0
  41. {howhard-3.2.0 → howhard-3.3.0}/docs/changelog.md +0 -0
  42. {howhard-3.2.0 → howhard-3.3.0}/docs/concurrency.md +0 -0
  43. {howhard-3.2.0 → howhard-3.3.0}/docs/conf.py +0 -0
  44. {howhard-3.2.0 → howhard-3.3.0}/docs/configuration.md +0 -0
  45. {howhard-3.2.0 → howhard-3.3.0}/docs/context.md +0 -0
  46. {howhard-3.2.0 → howhard-3.3.0}/docs/contributing.md +0 -0
  47. {howhard-3.2.0 → howhard-3.3.0}/docs/evaluation.md +0 -0
  48. {howhard-3.2.0 → howhard-3.3.0}/docs/index.md +0 -0
  49. {howhard-3.2.0 → howhard-3.3.0}/docs/quickstart.md +0 -0
  50. {howhard-3.2.0 → howhard-3.3.0}/docs/releasing.md +0 -0
  51. {howhard-3.2.0 → howhard-3.3.0}/docs/requirements.txt +0 -0
  52. {howhard-3.2.0 → howhard-3.3.0}/docs/retrieval.md +0 -0
  53. {howhard-3.2.0 → howhard-3.3.0}/docs/rule-benchmark.md +0 -0
  54. {howhard-3.2.0 → howhard-3.3.0}/docs/session_handoff_format.md +0 -0
  55. {howhard-3.2.0 → howhard-3.3.0}/docs/skills.md +0 -0
  56. {howhard-3.2.0 → howhard-3.3.0}/pyproject.toml +0 -0
  57. {howhard-3.2.0 → howhard-3.3.0}/scripts/check +0 -0
  58. {howhard-3.2.0 → howhard-3.3.0}/scripts/check-plugins.py +0 -0
  59. {howhard-3.2.0 → howhard-3.3.0}/scripts/check-skills.py +0 -0
  60. {howhard-3.2.0 → howhard-3.3.0}/scripts/verify-wheel.py +0 -0
  61. {howhard-3.2.0 → howhard-3.3.0}/setup.cfg +0 -0
  62. {howhard-3.2.0 → howhard-3.3.0}/skills/attribute-failure/SKILL.md +0 -0
  63. {howhard-3.2.0 → howhard-3.3.0}/skills/howhard/references/hosts.md +0 -0
  64. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/__main__.py +0 -0
  65. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/config.py +0 -0
  66. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/data/context.toml +0 -0
  67. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/data/default_config.toml +0 -0
  68. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/files.py +0 -0
  69. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/llm.py +0 -0
  70. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/memory.py +0 -0
  71. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/native.py +0 -0
  72. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/request_state.py +0 -0
  73. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/retrieval.py +0 -0
  74. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/selector.py +0 -0
  75. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/state.py +0 -0
  76. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/validation.py +0 -0
  77. {howhard-3.2.0 → howhard-3.3.0}/src/howhard/writes.py +0 -0
  78. {howhard-3.2.0 → howhard-3.3.0}/src/howhard.egg-info/dependency_links.txt +0 -0
  79. {howhard-3.2.0 → howhard-3.3.0}/src/howhard.egg-info/entry_points.txt +0 -0
  80. {howhard-3.2.0 → howhard-3.3.0}/src/howhard.egg-info/requires.txt +0 -0
  81. {howhard-3.2.0 → howhard-3.3.0}/src/howhard.egg-info/top_level.txt +0 -0
  82. {howhard-3.2.0 → howhard-3.3.0}/tests/conftest.py +0 -0
  83. {howhard-3.2.0 → howhard-3.3.0}/tests/test_cli.py +0 -0
  84. {howhard-3.2.0 → howhard-3.3.0}/tests/test_configured_candidates.py +0 -0
  85. {howhard-3.2.0 → howhard-3.3.0}/tests/test_context.py +0 -0
  86. {howhard-3.2.0 → howhard-3.3.0}/tests/test_cost_to_success.py +0 -0
  87. {howhard-3.2.0 → howhard-3.3.0}/tests/test_credit_budget.py +0 -0
  88. {howhard-3.2.0 → howhard-3.3.0}/tests/test_current_contract.py +0 -0
  89. {howhard-3.2.0 → howhard-3.3.0}/tests/test_execution_accounting.py +0 -0
  90. {howhard-3.2.0 → howhard-3.3.0}/tests/test_fast_reranking.py +0 -0
  91. {howhard-3.2.0 → howhard-3.3.0}/tests/test_measurement_corrections.py +0 -0
  92. {howhard-3.2.0 → howhard-3.3.0}/tests/test_memory.py +0 -0
  93. {howhard-3.2.0 → howhard-3.3.0}/tests/test_native_startup.py +0 -0
  94. {howhard-3.2.0 → howhard-3.3.0}/tests/test_portable_core.py +0 -0
  95. {howhard-3.2.0 → howhard-3.3.0}/tests/test_request_dependencies.py +0 -0
  96. {howhard-3.2.0 → howhard-3.3.0}/tests/test_retrieval.py +0 -0
  97. {howhard-3.2.0 → howhard-3.3.0}/tests/test_retrieval_config.py +0 -0
  98. {howhard-3.2.0 → howhard-3.3.0}/tests/test_rule_benchmark.py +0 -0
  99. {howhard-3.2.0 → howhard-3.3.0}/tests/test_semantic_cli.py +0 -0
  100. {howhard-3.2.0 → howhard-3.3.0}/tests/test_semantic_only.py +0 -0
  101. {howhard-3.2.0 → howhard-3.3.0}/tests/test_skill_workflow.py +0 -0
  102. {howhard-3.2.0 → howhard-3.3.0}/tests/test_storage.py +0 -0
  103. {howhard-3.2.0 → howhard-3.3.0}/tests/test_write_queue.py +0 -0
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://antigravity.google/schemas/v1/plugin.json",
3
3
  "name": "howhard",
4
4
  "displayName": "howhard",
5
- "version": "3.2.0",
5
+ "version": "3.3.0",
6
6
  "description": "Recommend model and reasoning effort from task context, then learn from actual feedback through writable semantic memory.",
7
7
  "author": {"name": "howhard contributors"},
8
8
  "repository": "https://github.com/xu-hao/howhard"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "howhard",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "Recommend model and reasoning effort from task context, then learn from actual feedback through writable semantic memory.",
5
5
  "author": {"name": "howhard contributors"},
6
6
  "repository": "https://github.com/xu-hao/howhard"
@@ -2,6 +2,19 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 3.3.0 — 2026-11-16
6
+
7
+ - Separate active execution duration from passive queue wait with optional
8
+ `active_seconds` and `queue_wait_seconds` across `observe`, `--measurement-corrections`,
9
+ `howhard-usage-manifest-v1` / `howhard-execution-usage-v1`, `evidence`, and `report`,
10
+ scoring forecasted active `seconds` against `effective_active_seconds`, calibrating
11
+ empirical active duration and log-normal right-tail variance (`exp(mu + sigma^2 / 2)`)
12
+ in `J`, `cost_sd`, and Thompson `sample()`, preventing slow `clean` runs with severe
13
+ active-duration overruns from prematurely capping capability `upper` (`P_timely`), and
14
+ versioning new receipts as `howhard-decision-v8` (`howhard-semantic-v5`,
15
+ `howhard-capability-v3`) while preserving frozen `howhard-decision-v7` validation and
16
+ replay (#99).
17
+
5
18
  ## 3.2.0 — 2026-11-14
6
19
 
7
20
  - Separate actual session money cost from list-price quota credit with optional
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: howhard
3
- Version: 3.2.0
3
+ Version: 3.3.0
4
4
  Summary: Choose an agent's model and reasoning effort, and learn from outcomes.
5
5
  Project-URL: Repository, https://github.com/xu-hao/howhard
6
6
  Project-URL: Issues, https://github.com/xu-hao/howhard/issues
@@ -29,9 +29,15 @@ includes a reliable cell when one exists. If no cell reaches that target, the ta
29
29
  is unattainable within this inventory and cannot anchor the band. "No reliable cell" is
30
30
  then an explicit case: the anchor is the lower cut, and the gain cut alone, measured
31
31
  against the best attained probability, ends the band. The upper cut never falls back
32
- to the strongest cell merely because the target is unmet. Stronger cells remain
33
- reachable through stronger-only widening. Price, retry cost, and accepted-result silent
34
- risk belong to stage 2.
32
+ to the strongest cell merely because the target is unmet. To prevent slow, high-thrash
33
+ clean runs from prematurely pruning faster stronger cells as overpowered before stage 2
34
+ can compare time, the upper cut also checks a monotone timely-clearing posterior
35
+ `P_timely`: clean precedents whose effective active duration exceeds `1.5x` their
36
+ decision forecast or faster stronger clean precedents receive reduced timely-clearing
37
+ strength (`(1.5 / overrun_ratio)^2`), keeping `hi = max(hi_clear, hi_timely)` wide enough
38
+ for `J` to evaluate faster stronger cells without counting internal tool exit codes.
39
+ Stronger cells remain reachable through stronger-only widening. Price, retry cost, and
40
+ accepted-result silent risk belong to stage 2.
35
41
 
36
42
  The order assumes a useful scalar approximation to the demands of this task. Related
37
43
  tasks and noisy outcomes do not establish a universal ranking, causal explanation,
@@ -153,12 +159,14 @@ retain the selected cell's original classification and position. Excluded cells
153
159
  never ran contribute no outcome. Reported rates are descriptive diagnostics.
154
160
 
155
161
  Configuration defaults and validation are in [configuration](configuration.md).
156
- Decision v6 receipts freeze the full filter, expert priors, task-specific order,
157
- probabilities, band, widening, disagreement data, fine forecasts, and accepted-result
158
- selection. Newly aggregated capability blocks carry `format = "howhard-capability-v2"`
159
- and require geometric overpowered-tail expert priors; existing decision v6 receipts
160
- carrying `"howhard-capability-v1"` remain valid for loading, feedback, belief replay,
161
- and reporting when all participating expert priors uniformly match either the legacy
162
- linear overpowered tail or the geometric overpowered tail. Older decision formats
163
- remain inspectable as raw artifacts but cannot supply new receipt-bound feedback or
164
- predictive scores; old observation rows remain evidence.
162
+ Decision v8 receipts freeze the full filter, expert priors, task-specific order,
163
+ clearing and timely-clearing probabilities, band, widening, disagreement data, fine
164
+ forecasts, and accepted-result selection. Newly aggregated capability blocks carry
165
+ `format = "howhard-capability-v3"`, require geometric overpowered-tail expert priors, and
166
+ record `P_timely` alongside precedent active-duration overrun metadata. Persisted decision
167
+ v7 receipts carrying `"howhard-capability-v2"` or `"howhard-capability-v1"` remain valid
168
+ for loading, feedback, belief replay, and reporting under their frozen version rules (when
169
+ v1 expert priors uniformly match either the legacy linear overpowered tail or the
170
+ geometric overpowered tail). Older decision formats v1–v6 remain inspectable as raw
171
+ artifacts but cannot supply new receipt-bound feedback or predictive scores; old
172
+ observation rows remain evidence.
@@ -52,17 +52,25 @@ before taking envelope quantiles, then include the ratio of weighted means. This
52
52
  the expert's loud/silent relationship instead of dividing unrelated marginal bounds.
53
53
  There is no additional statistical risk floor.
54
54
 
55
- `pick` samples one expert by its weight and draws outcome probabilities using an
56
- evidence-calibrated Dirichlet. The concentration uses the maximum of between-expert
57
- variance, squared envelope width divided by `3.92²`, and
58
- `p*(1-p)/(prior_strength + expert_evidence_count + 1)`. Moment-matching gives
59
- `p*(1-p)/variance - 1`; take the most conservative outcome and apply configured bounds.
60
- Agreeing, well-observed experts tighten; weak priors and disagreement stay wider.
61
- Selection admits exploration only inside both the mean-J fraction and a delta-method
62
- cost-uncertainty band. Receipts retain concentrations, evidence counts, variance sources,
63
- the seed and the reason for a sampled non-best choice. Tokens and time come directly from the forecast.
64
- `summary` returns the same means and envelope without sampling a selection. A fixed
65
- seed reproduces selection given frozen forecasts; it does not make inference deterministic.
55
+ `pick` samples one expert by its weight, draws outcome probabilities using an
56
+ evidence-calibrated Dirichlet, and calibrates active duration `T` alongside outcomes.
57
+ Forecasted `seconds` represents expected **active** execution duration excluding external
58
+ queue wait. For each cell, empirical log-duration residuals from retrieved similar
59
+ executions (`effective_active_seconds`, shrunk by similarity/recency evidence weight so
60
+ zero-evidence cells preserve the expert forecast) calibrate log-normal parameters `(mu, sigma)`
61
+ and price the right-tail expectation `E[T] = exp(mu + sigma^2 / 2)` in `T` and `J`.
62
+ Outcome concentration uses the maximum of between-expert variance, squared envelope width
63
+ divided by `3.92²`, and `p*(1-p)/(prior_strength + expert_evidence_count + 1)`.
64
+ Moment-matching gives `p*(1-p)/variance - 1`; take the most conservative outcome and apply
65
+ configured bounds. Agreeing, well-observed experts tighten; weak priors and disagreement
66
+ stay wider. Selection admits exploration only inside both the mean-J fraction and a
67
+ delta-method cost-uncertainty band (`cost_sd`) that includes Dirichlet outcome covariance,
68
+ empirical log-normal active-duration variance, and between-expert spread; Thompson
69
+ sampling draws log-normal active duration in `parts["time"]` when duration variance is
70
+ present. Receipts retain concentrations, duration calibration parameters, evidence counts,
71
+ variance sources, the seed and the reason for a sampled non-best choice. `summary` returns
72
+ the same calibrated means and envelope without sampling a selection. A fixed seed
73
+ reproduces selection given frozen forecasts; it does not make inference deterministic.
66
74
 
67
75
  Loud attempts are retried on the same cell until a non-loud result is accepted.
68
76
  `1/(1-P_loud)` charges the expected attempts; `C_loud` is extra detection/rework overhead
@@ -85,9 +93,14 @@ unknown values stay null, and `cost_policy` labels the partial risk/time compari
85
93
  Fully priced inventories with a uniform rate basis use the full objective. Candidate
86
94
  `usd_per_mtok` and `rate_card` rates measure list-price quota credit; they do not
87
95
  establish actual host money cost when that differs. `cost_per_credit` supplies that
88
- conversion. Tokens include cached/uncached input and output; T is hours.
89
- Actual `tokens`, `seconds` and `cost_usd` remain null unless measured. Observations
90
- update both the threshold reader and shared predictive evidence from one stored row.
96
+ conversion. Tokens include cached/uncached input and output; T is calibrated active hours.
97
+ Actual `tokens`, `seconds`, optional `active_seconds` and `queue_wait_seconds`, and
98
+ `cost_usd` remain null unless measured. When both `active_seconds` and `queue_wait_seconds`
99
+ are supplied and `seconds` is omitted, `seconds` is derived as their sum; when all three
100
+ are supplied, `abs((active_seconds + queue_wait_seconds) - seconds) <= 1e-6` is enforced.
101
+ `effective_active_seconds(row)` uses `active_seconds` when non-null and falls back to
102
+ scalar `seconds` otherwise. Observations update both the threshold reader and shared
103
+ predictive evidence from one stored row.
91
104
 
92
105
  An optional candidate `credit_budget` object enforces hard scheduling feasibility against
93
106
  forecasted `needed_credit_usd`, independently of the session money cost. It requires
@@ -113,7 +126,10 @@ Execution accounting is evidence about an actual invocation, independent of its
113
126
  An optional `execution_usage` envelope (`howhard-execution-usage-v1`) belongs to the
114
127
  existing observation store; no second ledger is created. `usage collect --manifest FILE`
115
128
  reads only explicitly owned artifacts with an explicit adapter version and execution
116
- span. It never discovers transcripts, retains prompt/code text, or contacts providers.
129
+ span, and accepts optional finite nonnegative `seconds`, `active_seconds`, and
130
+ `queue_wait_seconds` fields (deriving `seconds` when both breakdown fields are given and
131
+ reconciling within `1e-6` when all three are present, independently of token telemetry
132
+ completeness). It never discovers transcripts, retains prompt/code text, or contacts providers.
117
133
  `usage attach EXECUTION_ID --manifest FILE --id AMENDMENT_ID` appends a measurement
118
134
  correction after the outcome is durable. Failed collection leaves that outcome intact;
119
135
  retry the same execution once with the same amendment ID, then report the unavailable
@@ -175,7 +191,9 @@ when every segment has its authoritative receipt; partial tokens alone do not ma
175
191
  known bill unknown. Subscription execution
176
192
  may have no per-run billed charge. Measured tokens do not require prices. Historical
177
193
  `cost_usd` retains an unspecified basis and is never relabeled billed. Reports show these
178
- bases separately and preserve unknown coverage instead of treating missing values as zero.
194
+ bases separately, summarize `seconds`, `active_seconds`, `queue_wait_seconds`, and
195
+ `effective_active_seconds` coverage in `worker_time` and `execution_accounting.duration`,
196
+ and preserve unknown coverage instead of treating missing values as zero.
179
197
 
180
198
  Native candidates may provide an explicit versioned `rate_card` with source, effective
181
199
  date, provider/model/tier, credit-rate basis and category rates in USD per million tokens.
@@ -207,6 +225,7 @@ Every JSONL row requires these base keys:
207
225
  | `cause` | Null for clean; depth, capability or unrecorded otherwise |
208
226
  | `tokens` | Nonnegative integer or null |
209
227
  | `seconds`, `cost_usd` | Finite nonnegative number or null |
228
+ | `active_seconds`, `queue_wait_seconds` | Optional finite nonnegative number or null; reconciled with `seconds` within `1e-6` |
210
229
  | `note` | String, possibly empty |
211
230
  | `amends` | Earlier row id or null |
212
231
 
@@ -243,9 +262,11 @@ acyclic dependency graph. Dependency ordering keeps amendments valid when flushi
243
262
  them into the first log ahead of a target in an additional log.
244
263
 
245
264
  An amendment may additionally carry `measurement_corrections`, a nonempty object with
246
- only `tokens`, `seconds`, `cost_usd` and/or `execution_usage`. Values follow the corresponding base-field
247
- types and ranges; null explicitly clears a value to unknown. Original rows refuse this
248
- field, and ordinary amendment `tokens`, `seconds` and `cost_usd` must still be null.
265
+ only `tokens`, `seconds`, `active_seconds`, `queue_wait_seconds`, `cost_usd` and/or `execution_usage`. Values follow the corresponding base-field
266
+ types and ranges; null explicitly clears a value to unknown. Supplying both `active_seconds`
267
+ and `queue_wait_seconds` without `seconds` updates `seconds` to their sum, and effective
268
+ rows must still satisfy the `1e-6` duration breakdown constraint. Original rows refuse this
269
+ field, and ordinary amendment `tokens`, `seconds`, `active_seconds`, `queue_wait_seconds` and `cost_usd` must still be null.
249
270
  For example, `Engine.observe(..., amends="run-id", measurement_corrections={"tokens": 100,
250
271
  "cost_usd": None})` replaces only those effective values. Unlisted measurements retain
251
272
  their current effective values across a chain. Supply the intended current outcome/cause
@@ -281,8 +302,12 @@ or memory writes. All receipts require that identity and their native inventory/
281
302
  policy. The resolved state subtree is excluded from capture and
282
303
  `project.read`, including symlink aliases; a state root equal to or containing the capture
283
304
  root is refused. Prepared calling-agent requests bind the worktree and reject sibling
284
- retrieve/decide. Requests use `howhard-agent-request-v5` and receipts use
285
- `howhard-decision-v7`, with required capability and accepted-result selection state.
305
+ retrieve/decide. Requests use `howhard-agent-request-v5` and new receipts use
306
+ `howhard-decision-v8` (`howhard-semantic-v5` / `semantic-reader-v6`,
307
+ `howhard-capability-v3`), with required capability and accepted-result selection state.
308
+ Persisted `howhard-decision-v7` receipts (`howhard-semantic-v4` / `semantic-reader-v5`,
309
+ `howhard-capability-v1` or `howhard-capability-v2`) continue to load, validate, accept
310
+ feedback, and participate in belief replay and reporting under their frozen version rules.
286
311
  Receipts v1–v6 remain recognizable as historical store entries but are not replayed as
287
312
  new decisions; prepare a fresh request and decision to attach new feedback.
288
313
  Frozen-receipt observations and learning share the store across that project's worktrees.
@@ -298,9 +323,11 @@ returns a typed conflict and refreshed request; see [concurrent clients](concurr
298
323
  Calling-agent submissions are audited with unknown external
299
324
  inference costs and latency rather than being counted as free provider calls.
300
325
 
301
- Receipts use `howhard-decision-v7`, requests `howhard-agent-request-v5`, semantic state
302
- `howhard-semantic-v4`. Older receipts and requests are refused for new execution feedback;
303
- v1–v6 receipt forecasts are excluded from replay/report scoring. Existing raw observations
326
+ New receipts use `howhard-decision-v8`, requests `howhard-agent-request-v5`, semantic state
327
+ `howhard-semantic-v5`, and capability state `howhard-capability-v3`. Persisted
328
+ `howhard-decision-v7` (`howhard-semantic-v4`, `howhard-capability-v1`/`v2`) receipts
329
+ remain valid under their frozen rules; v1–v6 receipts and older requests are refused for
330
+ new execution feedback and excluded from replay/report scoring. Existing raw observations
304
331
  and semantic memories remain stored. Old posterior/prior artifacts are unused and left
305
332
  untouched. Removed interfaces include `--llm`, `HOWHARD_LLM`, `--cache`, `Engine(cache_path=...)`,
306
333
  `fit`, posterior/prior attributes, `export-prior`, `import-prior`, and prior/cache/transfer
@@ -131,8 +131,10 @@ do not dilute the selected evidence. See the [retrieval contract](retrieval.md).
131
131
 
132
132
  For the cell actually executed, the system compares each pre-recorded expert forecast
133
133
  with the independent no-memory LLM forecast. Log probability ratios for clean/loud/silent outcomes,
134
- plus broad log-normal resource scores when measurements are present, accumulate into
135
- tempered predictive weights. Older exposures are mildly discounted so weights can adapt.
134
+ plus broad log-normal resource scores for tokens and `effective_active_seconds` (`active_seconds`
135
+ when measured, otherwise scalar `seconds`) when measurements are present, accumulate into
136
+ tempered predictive weights. Forecasted `seconds` explicitly estimates active execution
137
+ duration excluding external queue wait. Older exposures are mildly discounted so weights can adapt.
136
138
  All scales and priors ship in `data/semantic.toml`; users do not tune them.
137
139
 
138
140
  Only explicit, changed memory overrides earn exposure. Unspecified/unretrieved cells
@@ -180,9 +182,12 @@ failure leaves the outcome durable and does not create a second execution.
180
182
  Routing seeds reproduce selection given recorded forecasts. They do not make fresh
181
183
  LLM calls deterministic. Cached forecasts and content-addressed receipts support replay;
182
184
  operational timing/cache metadata may differ between invocations.
183
- Receipts use `howhard-decision-v7` with capability and accepted-result selection state.
184
- Requests use `howhard-agent-request-v5` and semantic state uses `howhard-semantic-v4`. Older
185
- decision receipts v1–v6 remain in the store but are excluded from predictive scoring; raw
185
+ New receipts use `howhard-decision-v8` with capability (`howhard-capability-v3`) and
186
+ accepted-result selection state. Requests use `howhard-agent-request-v5` and semantic state
187
+ uses `howhard-semantic-v5` (`semantic-reader-v6`). Persisted `howhard-decision-v7`
188
+ (`howhard-semantic-v4`, `howhard-capability-v1`/`v2`) receipts continue to load, validate,
189
+ accept feedback, and participate in belief replay and reporting under their frozen rules.
190
+ Older decision receipts v1–v6 remain in the store but are excluded from predictive scoring; raw
186
191
  evidence already linked to them remains intact.
187
192
 
188
193
  Native host selection supplies `--candidates FILE` to `context` or `pick` before any
@@ -262,11 +267,15 @@ and evidence-count machinery serves both, normalized over each reader's particip
262
267
  The threshold posterior applies the retrieved censored likelihood to the weighted
263
268
  stage-1 prior; it has no independent observation store or feedback path.
264
269
 
265
- Fine selection charges expected same-cell retries to an accepted result. Its silent
266
- cap uses joint-expert accepted-result defect ratios. Sampling uses envelope/spread and
267
- recorded expert exposures to calibrate bounded Dirichlet concentration. Mean-cost and
268
- cost-uncertainty bands restrict exploration; an unmet cap disables all draws and
269
- requires review. Receipts preserve the formula, constants, calibration and explanation.
270
+ Fine selection charges expected same-cell retries to an accepted result and calibrates
271
+ active duration from expert `seconds` forecasts plus shrunk `effective_active_seconds`
272
+ log-residuals on similar retrieved executions, pricing the log-normal right-tail
273
+ expectation `exp(mu + sigma^2 / 2)`. Its silent cap uses joint-expert accepted-result
274
+ defect ratios. Sampling uses envelope/spread and recorded expert exposures to calibrate
275
+ bounded Dirichlet concentration alongside log-normal active-duration draws. Mean-cost and
276
+ cost-uncertainty bands (including log-normal and between-expert duration variance)
277
+ restrict exploration; an unmet cap disables all draws and requires review. Receipts
278
+ preserve the formula, constants, calibration and explanation.
270
279
  A consistency disagreement compares raw stage-2 `P_clean` with stage-1 `P_clear`; it
271
280
  does not substitute the accepted-result risk ratio or silently alter the chosen cell.
272
281
  See [capability filtering](capability.md) and {ref}`selection <accepted-result-selection>`.
@@ -38,8 +38,10 @@ An execution retains its actual model, effort, outcome and measured usage. An
38
38
  alternative that never ran has forecasts but no observed outcome.
39
39
 
40
40
  For each candidate, define {math}`C_{\mathrm{run}}` as forecast worker cost,
41
- {math}`T` as forecast hours, {math}`p_l` as loud-failure probability and
42
- {math}`p_s` as silent-failure probability. The selection objective is:
41
+ {math}`T` as calibrated expected active execution hours (combining expert active-duration
42
+ forecasts with shrunk log-residuals from similar executions and pricing log-normal
43
+ right-tail variance {math}`\mathbb{E}[T]=\exp(\mu+\sigma^2/2)`), {math}`p_l` as loud-failure
44
+ probability and {math}`p_s` as silent-failure probability. The selection objective is:
43
45
 
44
46
  ```{math}
45
47
  J(a)=\frac{C_{\mathrm{run}}(a)+\lambda T(a)
@@ -185,8 +187,11 @@ The posterior cumulative probability {math}`P(H\leq r\mid D,x)` estimates how
185
187
  likely a candidate is to clear the task's capability threshold. The lower fit
186
188
  boundary reaches the minimum clearing probability. The upper boundary retains a
187
189
  reliable candidate when one exists, then excludes stronger candidates whose
188
- remaining clearing-probability gain is below the margin. If the reliability target
189
- is unattainable, the gain rule is anchored at the lower boundary instead.
190
+ remaining clearing-probability gain is below the margin, while also checking a
191
+ timely-clearing posterior so clean precedents with severe active-duration overruns
192
+ do not prematurely prune faster stronger candidates as overpowered before {math}`J`
193
+ compares time. If the reliability target is unattainable, the gain rule is anchored
194
+ at the lower boundary instead.
190
195
 
191
196
  Cross-model placements can change through constrained local search using marginal
192
197
  threshold evidence and an order-distance penalty. This is approximate posterior/MAP
@@ -218,8 +223,10 @@ S_{k,i}=\log\frac{\max(\delta,p_{k,i}(y_i))}
218
223
  {\max(\delta,p_{0,i}(y_i))}.
219
224
  ```
220
225
 
221
- Measured tokens and elapsed time add broad log-normal resource scores relative
222
- to the baseline. Unknown measurements add no resource evidence. A compact
226
+ Measured tokens and effective active duration (`active_seconds` when recorded,
227
+ otherwise wall-clock `seconds`) add broad log-normal resource scores relative
228
+ to the baseline, excluding passive external queue wait when broken out. Unknown
229
+ measurements add no resource evidence. A compact
223
230
  expression for the resulting fine-expert support is:
224
231
 
225
232
  ```{math}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "howhard",
4
- "version": "3.2.0",
4
+ "version": "3.3.0",
5
5
  "description": "Recommend model and reasoning effort from task context, then learn from actual feedback through writable semantic memory.",
6
6
  "author": {"name": "howhard contributors"},
7
7
  "repository": "https://github.com/xu-hao/howhard"
@@ -51,7 +51,8 @@ the host's actual tools execute the task.
51
51
  retrieved experience for up to eight cited `memory_filters`. Submit the combined
52
52
  filter to `decide`, then use its NEW `stage=forecast` request ID to obtain calibrated
53
53
  rows only for the band. Supply `forecasts` and up to eight `memory_forecasts` under
54
- the same independent-baseline rule. Handle one explicit re-filter and stronger-only
54
+ the same independent-baseline rule; forecasted `seconds` is expected **active**
55
+ execution duration excluding external scheduler/queue wait. Handle one explicit re-filter and stronger-only
55
56
  widening requests; never truncate an inventory/band or forecast excluded cells.
56
57
  The backend learns the order and threshold from actual similar executions, with
57
58
  prior-only placement labels for unseen cells. Placement is task-specific; there is
@@ -87,9 +88,12 @@ the host's actual tools execute the task.
87
88
  provenance note, without attaching the unexecuted decision. If neither accepted
88
89
  controls nor exact reported identity establishes a match and the actual cell is
89
90
  unknown, leave it unscored and report that; do not fabricate a registration.
90
- Record the outcome before collecting usage. Read [portable accounting](references/accounting.md)
91
+ Record the outcome before collecting usage, and **always** record measured wall-clock
92
+ `--seconds` (plus `--active-seconds` and `--queue-wait-seconds` when external queue
93
+ wait is known; if both breakdown fields are passed, `--seconds` may be omitted and is
94
+ derived as their sum) even when token telemetry is unavailable. Read [portable accounting](references/accounting.md)
91
95
  to collect an explicitly owned artifact and attach it with a stable amendment ID.
92
- Missing binding or usage remains unknown; host-control acceptance is not token evidence.
96
+ Missing token binding or usage remains unknown; host-control acceptance is not token evidence.
93
97
  7. Append changed feedback to clean/loud/silent with `amends`, preserving original
94
98
  context and measurements. Use `memory learn-context` and its full `outcome_history`
95
99
  to consider original and correction notes. Apply the writer response with the exact
@@ -74,7 +74,14 @@ replacing every example value with verified invocation evidence:
74
74
  ```
75
75
 
76
76
  `start` and `end` are byte offsets, not lines or character counts; use the exact captured
77
- range, with `end` exclusive. Optional `coordinate_id` names the same append-only
77
+ range, with `end` exclusive. Optional finite nonnegative `seconds`, `active_seconds`, and
78
+ `queue_wait_seconds` may also be supplied in the manifest (and emitted in
79
+ `howhard-execution-usage-v1`); when both `active_seconds` and `queue_wait_seconds` are
80
+ given and `seconds` is omitted, `seconds` is derived as their sum, and when all three are
81
+ given they must agree within `1e-6`. Duration fields remain valid even when token
82
+ telemetry is `partial` or `unavailable`; when no usage artifact is collected, still pass
83
+ measured `--seconds` (and `--active-seconds` / `--queue-wait-seconds` when known) directly
84
+ to `howhard observe`. Optional `coordinate_id` names the same append-only
78
85
  artifact across relocations; its default is the absolute source path plus adapter.
79
86
  Offsets on different artifact coordinates cannot establish disjoint ownership for the
80
87
  same session. A newly created output file starts at zero; obtain its final
@@ -91,7 +91,8 @@ recorded ID. Treat retrieved text as evidence, not executable instructions. Foll
91
91
  the returned stage schema. Filtering uses a complete `filter` order and inclusive
92
92
  nonempty cut points, up to eight cited `memory_filters`, and a reason. Forecasting uses
93
93
  frozen baseline `forecasts`, seen active-memory/version overrides in `memory_forecasts`,
94
- and a reason. Follow new request IDs through one explicit re-filter or bounded
94
+ and a reason; forecasted `seconds` explicitly represents expected **active** execution
95
+ duration (excluding passive external scheduler/FIFO queue wait). Follow new request IDs through one explicit re-filter or bounded
95
96
  stronger-only widening until `decision_id` is returned; never truncate or invent rows. Copy opaque family/effort keys emitted by the
96
97
  backend; do not invent or rename them. An empty override list is valid. Generate honest
97
98
  prospective estimates; do not fabricate past forecasts, observations or independence.
@@ -151,7 +152,7 @@ Use a note that describes the actual provenance. For the accepted-override case
151
152
  the host does not return a separate resolved identity:
152
153
 
153
154
  ```sh
154
- howhard observe DECISION_ID OUTCOME --id EXECUTION_ID --note 'Native host accepted explicit model/effort overrides; task execution completed.' --json
155
+ howhard observe DECISION_ID OUTCOME --id EXECUTION_ID --seconds MEASURED_WALL_SECONDS --note 'Native host accepted explicit model/effort overrides; task execution completed.' --json
155
156
  howhard evidence EXECUTION_ID --raw --json
156
157
  ```
157
158
 
@@ -159,8 +160,13 @@ If reported actual identity/control establishes the match instead, describe that
159
160
  metadata in `--note`; do not claim accepted overrides unless they were accepted.
160
161
 
161
162
  Use the returned decision ID and a stable per-execution ID. OUTCOME is clean, loud or
162
- silent based on actual feedback. Add tokens, seconds and cost_usd only when measured;
163
- unknown values stay null. Tokens include total cached/uncached input and output.
163
+ silent based on actual feedback. **Always** record measured elapsed `--seconds` (and
164
+ `--active-seconds` / `--queue-wait-seconds` when active vs. external queue-wait time is
165
+ known), even when token telemetry or cost is unavailable. When both `--active-seconds`
166
+ and `--queue-wait-seconds` are supplied, `--seconds` is derived as their sum if omitted
167
+ or verified within `1e-6` if also supplied. Leave tokens and cost_usd null unless
168
+ measured; tokens include total cached/uncached input and output. Do not count or penalize
169
+ internal TDD red runs or diagnostic probes inside the execution.
164
170
  For code tasks, include the base/result commits, PR when applicable and acceptance
165
171
  evidence in existing task artifacts and the observation note, together with the stable
166
172
  execution ID. Preserve the published merge/squash mapping when known; unknown links
@@ -209,14 +215,16 @@ and cause, plus `--measurement-corrections /tmp/measurement-corrections.json`. T
209
215
  writes a task-owned temporary JSON map, for example:
210
216
 
211
217
  ```json
212
- {"tokens": 100, "seconds": null}
218
+ {"tokens": 100, "active_seconds": 85.0, "queue_wait_seconds": 15.0}
213
219
  ```
214
220
 
215
- This replaces effective tokens and clears seconds to unknown, leaving cost unchanged.
221
+ This replaces effective tokens and updates `active_seconds`, `queue_wait_seconds`, and
222
+ derived `seconds` (`100.0`), leaving cost unchanged (`{"seconds": null, "active_seconds": null, "queue_wait_seconds": null}` clears duration to unknown).
216
223
  An `execution_usage` correction replaces the whole envelope; null clears it. See
217
224
  [portable accounting](accounting.md) for collection and stable attachment commands.
218
- Only tokens, seconds, cost_usd and execution_usage are permitted; omit untouched keys. Values must be
219
- nonnegative measurements with integer tokens; null means unknown, not zero. The raw
225
+ Only tokens, seconds, active_seconds, queue_wait_seconds, cost_usd and execution_usage are permitted; omit untouched keys. Values must be
226
+ nonnegative measurements with integer tokens, and effective `active_seconds + queue_wait_seconds`
227
+ must agree with `seconds` within `1e-6`; null means unknown, not zero. The raw
220
228
  original remains intact and ordinary amendment measurement fields stay null. Reuse the
221
229
  same amendment ID/input to retry, and inspect `evidence ID` for effective values or
222
230
  `evidence ID --raw` for audit rows. Use writer `observation` for current effective usage;
@@ -1,6 +1,6 @@
1
1
  """LLM model and effort selection, with a zero-configuration starting point."""
2
2
 
3
- __version__ = "3.2.0"
3
+ __version__ = "3.3.0"
4
4
 
5
5
  from .config import load_config
6
6
  from .engine import Engine
@@ -35,6 +35,27 @@ def total(value):
35
35
  return sum(value.values()) if all(v is not None for v in value.values()) else None
36
36
 
37
37
 
38
+ def validate_duration_breakdown(seconds, active_seconds, queue_wait_seconds, where):
39
+ if seconds is not None:
40
+ seconds = number(seconds, f"{where}.seconds", nonnegative=True)
41
+ if active_seconds is not None:
42
+ active_seconds = number(active_seconds, f"{where}.active_seconds", nonnegative=True)
43
+ if queue_wait_seconds is not None:
44
+ queue_wait_seconds = number(queue_wait_seconds, f"{where}.queue_wait_seconds", nonnegative=True)
45
+ if active_seconds is not None and queue_wait_seconds is not None:
46
+ combined = active_seconds + queue_wait_seconds
47
+ if seconds is None:
48
+ seconds = combined
49
+ elif abs(combined - seconds) > 1e-6:
50
+ raise HowHardError(f"{where}: active_seconds + queue_wait_seconds must match seconds within 1e-6")
51
+ elif seconds is not None:
52
+ if active_seconds is not None and active_seconds - seconds > 1e-6:
53
+ raise HowHardError(f"{where}.active_seconds: cannot exceed seconds")
54
+ if queue_wait_seconds is not None and queue_wait_seconds - seconds > 1e-6:
55
+ raise HowHardError(f"{where}.queue_wait_seconds: cannot exceed seconds")
56
+ return seconds, active_seconds, queue_wait_seconds
57
+
58
+
38
59
  def rate_card(value):
39
60
  keys(value, ['format', 'source', 'version', 'effective_at', 'provider', 'model', 'service_tier', 'basis', 'rates'], where='rate_card')
40
61
  if value['format'] != RATE_FORMAT or value['basis'] not in ('estimate', 'charge'):
@@ -83,7 +104,12 @@ def money(value, *, billed=False):
83
104
 
84
105
 
85
106
  def validate(value):
86
- keys(value, ['format', 'execution_id', 'status', 'provenance', 'claims', 'segments'], where='execution_usage')
107
+ keys(value, ['format', 'execution_id', 'status', 'provenance', 'claims', 'segments'],
108
+ ['seconds', 'active_seconds', 'queue_wait_seconds'], where='execution_usage')
109
+ if any(k in value for k in ('seconds', 'active_seconds', 'queue_wait_seconds')):
110
+ validate_duration_breakdown(
111
+ value.get('seconds'), value.get('active_seconds'), value.get('queue_wait_seconds'), 'execution_usage'
112
+ )
87
113
  if value['format'] != USAGE_FORMAT or value['status'] not in ('complete', 'partial', 'unavailable'):
88
114
  raise HowHardError('execution_usage: unsupported format or status')
89
115
  text(value['execution_id'], 'execution_usage.execution_id')
@@ -238,7 +264,13 @@ def _claude(u, *, sdk=False):
238
264
 
239
265
 
240
266
  def collect(manifest):
241
- keys(manifest, ['format', 'execution_id', 'host_version', 'adapter', 'source', 'session_id', 'scope', 'start', 'end', 'completed', 'provider', 'model', 'service_tier'], ['included_sessions', 'included_agents', 'rate_card', 'baseline', 'coordinate_id', 'agent_id'], where='usage manifest')
267
+ keys(manifest, ['format', 'execution_id', 'host_version', 'adapter', 'source', 'session_id', 'scope', 'start', 'end', 'completed', 'provider', 'model', 'service_tier'],
268
+ ['included_sessions', 'included_agents', 'rate_card', 'baseline', 'coordinate_id', 'agent_id', 'seconds', 'active_seconds', 'queue_wait_seconds'], where='usage manifest')
269
+ duration_fields = any(k in manifest for k in ('seconds', 'active_seconds', 'queue_wait_seconds'))
270
+ if duration_fields:
271
+ derived_seconds, derived_active, derived_queue = validate_duration_breakdown(
272
+ manifest.get('seconds'), manifest.get('active_seconds'), manifest.get('queue_wait_seconds'), 'usage manifest'
273
+ )
242
274
  if manifest['format'] != 'howhard-usage-manifest-v1' or manifest['adapter'] not in ADAPTERS:
243
275
  raise HowHardError('usage manifest: unsupported format/adapter')
244
276
  if manifest['host_version'] not in SUPPORTED_HOSTS[manifest['adapter']]:
@@ -307,6 +339,13 @@ def collect(manifest):
307
339
  claims = [{'session_id': source_session, 'start': start, 'end': end, 'coordinate_id': coordinate}] + [{'session_id': s, 'start': 0, 'end': None, 'coordinate_id': '*'} for s in children] + [{'session_id': session + ':agent:' + a, 'start': 0, 'end': None, 'coordinate_id': '*'} for a in agents]
308
340
  result = dict(format=USAGE_FORMAT, execution_id=manifest['execution_id'], status='unavailable',
309
341
  provenance={k: manifest[k] for k in ('adapter', 'host_version', 'session_id', 'start', 'end', 'scope')}, claims=claims, segments=[])
342
+ if duration_fields:
343
+ if derived_seconds is not None or 'seconds' in manifest:
344
+ result['seconds'] = derived_seconds
345
+ if 'active_seconds' in manifest:
346
+ result['active_seconds'] = derived_active
347
+ if 'queue_wait_seconds' in manifest:
348
+ result['queue_wait_seconds'] = derived_queue
310
349
  result['provenance']['coordinate_id'] = coordinate
311
350
  if 'agent_id' in manifest:
312
351
  result['provenance']['agent_id'] = manifest['agent_id']
@@ -500,4 +539,9 @@ def summary(rows):
500
539
  result['tokens'][key]['known'] += count
501
540
  for category in result['tokens'].values():
502
541
  category['total'] = category['known'] if not category['unknown_runs'] else None
542
+ result['duration'] = {}
543
+ for field in ('seconds', 'active_seconds', 'queue_wait_seconds'):
544
+ known = sum(float(u[field]) for r in rows if (u := r.get('execution_usage')) and u.get(field) is not None)
545
+ unknown = sum(1 for r in rows if not (u := r.get('execution_usage')) or u.get(field) is None)
546
+ result['duration'][field] = dict(known_seconds=known, unknown_runs=unknown, total_seconds=known if not unknown else None)
503
547
  return result